Browse Source

+ Reduction du nombre de requetes config pour ameliorer la rapidité
+ Supression des fichiers inutiles
+ Debugs divers



git-svn-id: http://projet.idleman.fr/leed.svn@9 cbb609ad-8cd9-463b-aa97-3ec7c4f0f680

Valentin CARRUESCO 9 years ago
parent
commit
a5997a4300

+ 27 - 6
Configuration.class.php

@@ -1,7 +1,7 @@
 <?php
 class Configuration extends SQLiteEntity{
 
-	protected $id,$key,$value;
+	protected $id,$key,$value,$confTab;
 	protected $TABLE_NAME = 'configuration';
 	protected $CLASS_NAME = 'Configuration';
 	protected $object_fields = 
@@ -15,17 +15,38 @@ class Configuration extends SQLiteEntity{
 		parent::__construct();
 	}
 
+	public function getAll(){
 
-	public function get($key){
+		if(!isset($_SESSION['configuration'])){
+	
 		$configurationManager = new Configuration();
-		$config = $configurationManager->load(array('key'=>$key));
-		return (is_object($config)?$config->getValue():'');
+		$configsQuery = $configurationManager->query('SELECT key,value FROM configuration');
+		$confTab = array();
+
+		while($config = $configsQuery->fetchArray() ){
+			$this->confTab[$config['key']] = $config['value'];
+		}
+
+		$_SESSION['configuration'] = serialize($this->confTab);
+		
+		}else{
+			$this->confTab = unserialize($_SESSION['configuration']);
+		}
+	}
+
+	public function get($key){
+		return (isset($this->confTab[$key])?$this->confTab[$key]:'');
 	}
 
 	public function put($key,$value){
 		$configurationManager = new Configuration();
-		$config = $configurationManager->load(array('key'=>$key));
-		$config = (!$config?new Configuration():$config);
+		$configurationManager->change(array('value'=>$value),array('key'=>$key));
+		$this->confTab[$key] = $value;
+		unset($_SESSION['configuration']);
+	}
+
+	public function add($key,$value){
+		$config = new Configuration();
 		$config->setKey($key);
 		$config->setValue($value);
 		$config->save();

+ 3 - 3
addFeed.php

@@ -54,9 +54,9 @@
 						<p>Affichage des articles: <input type="radio" <?php $articleView = $configurationManager->get('articleView'); if($articleView=='partial'){ ?> checked="checked" <?php } ?> value="partial" name="articleView">Partiel <input type="radio" <?php if($articleView=='complete'){ ?> checked="checked" <?php } ?> value="complete" name="articleView">Complet</p>
 						<h3>Nb: si vous choissisez un affichage partiel des articles, un click sur ces derniers menera à l'article sur le blog de l'auteur.</h3>
 						<p>Nombre d'articles par pages: <input type="text" value="<?php echo $configurationManager->get('articlePerPages'); ?>" name="articlePerPages"></p>
-						<p>Affichage du lien direct de l'article: <input type="radio" <?php if($configurationManager->get('articleDisplayLink')=='1'){ ?> checked="checked" <?php } ?> value="1" name="articleDisplayLink">Oui <input type="radio" value="0" name="articleDisplayLink">Non</p>
-						<p>Affichage de la date de l'article: <input type="radio" <?php if($configurationManager->get('articleDisplayDate')=='1'){ ?> checked="checked" <?php } ?> value="1" name="articleDisplayDate">Oui <input type="radio" value="0" name="articleDisplayDate">Non</p>
-						<p>Affichage de l'auteur de l'article: <input type="radio" <?php if($configurationManager->get('articleDisplayAuthor')=='1'){ ?> checked="checked" <?php } ?> value="1" name="articleDisplayAuthor">Oui <input type="radio" value="0" name="articleDisplayAuthor">Non</p>
+						<p>Affichage du lien direct de l'article: <input type="radio" <?php $articleDisplayLink = $configurationManager->get('articleDisplayLink'); if($articleDisplayLink=='1'){ ?> checked="checked" <?php } ?>value="1" name="articleDisplayLink">Oui <input type="radio" <?php if($articleDisplayLink=='0'){ ?> checked="checked" <?php } ?> value="0" name="articleDisplayLink">Non</p>
+						<p>Affichage de la date de l'article: <input type="radio" <?php $articleDisplayDate = $configurationManager->get('articleDisplayDate'); if($articleDisplayDate=='1'){ ?> checked="checked" <?php } ?> value="1" name="articleDisplayDate">Oui <input type="radio" <?php if($articleDisplayDate=='0'){ ?> checked="checked" <?php } ?> value="0" name="articleDisplayDate">Non</p>
+						<p>Affichage de l'auteur de l'article: <input type="radio" <?php $articleDisplayAuthor = $configurationManager->get('articleDisplayAuthor'); if($articleDisplayAuthor=='1'){ ?> checked="checked" <?php } ?> value="1" name="articleDisplayAuthor">Oui <input type="radio" <?php if($articleDisplayAuthor=='0'){ ?> checked="checked" <?php } ?> value="0" name="articleDisplayAuthor">Non</p>
 					</section>
 
 					<section>

BIN
apple-touch-icon-114x114-precomposed.png


BIN
apple-touch-icon-57x57-precomposed.png


BIN
apple-touch-icon-72x72-precomposed.png


BIN
apple-touch-icon-precomposed.png


BIN
apple-touch-icon.png


+ 4 - 6
common.php

@@ -1,6 +1,4 @@
-<?php 
-session_start();
-
+<?php session_start();
 require_once('SQLiteEntity.class.php');
 require_once('Feed.class.php');
 require_once('Event.class.php');
@@ -8,15 +6,15 @@ require_once('Functions.class.php');
 require_once('User.class.php');
 require_once('Folder.class.php');
 require_once('Configuration.class.php');
-
 $myUser = (isset($_SESSION['currentUser'])?unserialize($_SESSION['currentUser']):false);
-
-
 $feedManager = new Feed();
 $eventManager = new Event();
 $userManager = new User();
 $folderManager = new Folder();
 $configurationManager = new Configuration();
+
+$conf = $configurationManager->getAll();
+
 //Récuperation et sécurisation de toutes les variables POST et GET
 $_ = array();
 foreach($_POST as $key=>$val){

+ 3 - 1
css/style.css

@@ -262,7 +262,9 @@ header a,header a:hover{
 }
 
 #main article section.eventRead{
-	opacity:0.3;
+	opacity:0.4;
+	-moz-opacity : 0.4;
+    -ms-filter: "alpha(opacity=40)";
 }
 
 #feedTable{

BIN
favicon.ico


+ 2 - 2
footer.php

@@ -7,8 +7,8 @@
 		</footer>
 	</div>
 
-<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
-<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.2.min.js"><\/script>')</script>
+
+<script src="js/libs/jquery-1.7.2.min.js"></script>
 <script src="js/script.js"></script>
 
 </body>

+ 2 - 13
header.php

@@ -1,8 +1,4 @@
-<?php 
-require_once('common.php');
-
-?>
-
+<?php require_once('common.php'); ?>
 <!doctype html>
 <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
 <!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
@@ -11,17 +7,12 @@ require_once('common.php');
 <head>
 	<meta charset="utf-8">
 	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-
 	<title></title>
 	<meta name="description" content="">
 	<meta name="author" content="">
-
 	<meta name="viewport" content="width=device-width">
-
 	<link rel="stylesheet" href="css/style.css">
-
 	<script src="js/libs/modernizr-2.5.3-respond-1.1.0.min.js"></script>
-
 </head>
 <body>
 	<div id="header-container">
@@ -45,6 +36,4 @@ require_once('common.php');
 			</nav>
 		</header>
 	</div>
-
-
-	<div id="main-container">
+	<div id="main-container">

+ 6 - 32
humans.txt

@@ -3,41 +3,15 @@
 
 
 /* TEAM */
-  <your title>: <your name>
-  Site:
-  Twitter:
-  Location:
+  Creator: Idleman (idleman@idleman.fr)
+  Site: http://blog.idleman.fr
+  Twitter: none
+  Location: Nowhere
 
 /* THANKS */
-  Names (& URL):
+  Names (& URL): BoilerPlate, Modernizr, jQuery, Initializr, PHP authors & chuck norris
 
 /* SITE */
   Standards: HTML5, CSS3
   Components: Modernizr, jQuery
-  Software:
-
-
-
-                               -o/-
-                               +oo//-
-                              :ooo+//:
-                             -ooooo///-
-                             /oooooo//:
-                            :ooooooo+//-
-                           -+oooooooo///-
-           -://////////////+oooooooooo++////////////::
-            :+ooooooooooooooooooooooooooooooooooooo+:::-
-              -/+ooooooooooooooooooooooooooooooo+/::////:-
-                -:+oooooooooooooooooooooooooooo/::///////:-
-                  --/+ooooooooooooooooooooo+::://////:-
-                     -:+ooooooooooooooooo+:://////:--
-                       /ooooooooooooooooo+//////:-
-                      -ooooooooooooooooooo////-
-                      /ooooooooo+oooooooooo//:
-                     :ooooooo+/::/+oooooooo+//-
-                    -oooooo/::///////+oooooo///-
-                    /ooo+::://////:---:/+oooo//:
-                   -o+/::///////:-      -:/+o+//-
-                   :-:///////:-            -:/://
-                     -////:-                 --//:
-                       --                       -:
+  Software: Sublime Text2

+ 9 - 9
install.php

@@ -52,20 +52,20 @@ if(isset($_['installButton'])){
 	//Identification de l'utilisateur en session
 	$_SESSION['currentUser'] = serialize($admin);
 	//Ajout des préférences et reglages
-	$configurationManager->put('root',$_['root']);
+	$configurationManager->add('root',$_['root']);
 	//$configurationManager->put('view',$_['view']);
-	$configurationManager->put('articleView',$_['articleView']);
+	$configurationManager->add('articleView',$_['articleView']);
 
-	$configurationManager->put('articlePerPages',$_['articlePerPages']);
-	$configurationManager->put('articleDisplayLink',$_['articleDisplayLink']);
-	$configurationManager->put('articleDisplayDate',$_['articleDisplayDate']);
-	$configurationManager->put('articleDisplayAuthor',$_['articleDisplayAuthor']);
+	$configurationManager->add('articlePerPages',$_['articlePerPages']);
+	$configurationManager->add('articleDisplayLink',$_['articleDisplayLink']);
+	$configurationManager->add('articleDisplayDate',$_['articleDisplayDate']);
+	$configurationManager->add('articleDisplayAuthor',$_['articleDisplayAuthor']);
 
-	$configurationManager->put('plugin_shaarli',(isset($_['plugin_shaarli']) && $_['plugin_shaarli']=='on'?1:0));
-	$configurationManager->put('plugin_shaarli_link',$_['plugin_shaarli_link']);
+	$configurationManager->add('plugin_shaarli',(isset($_['plugin_shaarli']) && $_['plugin_shaarli']=='on'?1:0));
+	$configurationManager->add('plugin_shaarli_link',$_['plugin_shaarli_link']);
 
 
-	$configurationManager->put('synchronisationType',$_['synchronisationType']);
+	$configurationManager->add('synchronisationType',$_['synchronisationType']);
 
 	//Création du dossier de base
 	$folder = new Folder();