Browse Source

Ajustements manuels des espaces/tabulations

Christophe HENRY 7 years ago
parent
commit
78e139b8b6
8 changed files with 373 additions and 372 deletions
  1. 20 20
      MysqlEntity.class.php
  2. 47 47
      Plugin.class.php
  3. 43 43
      action.php
  4. 62 61
      article.php
  5. 2 2
      common.php
  6. 14 14
      i18n.php
  7. 68 68
      index.php
  8. 117 117
      templates/marigolds/js/script.js

+ 20 - 20
MysqlEntity.class.php

@@ -106,9 +106,9 @@ class MysqlEntity
     */
     public function truncate($debug=false)
     {
-            $query = 'TRUNCATE TABLE '.MYSQL_PREFIX.$this->TABLE_NAME.';';
-            if($this->debug)echo '<hr>'.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.'<br>'.mysql_error();
-            $myQuery = $this->customQuery($query);
+        $query = 'TRUNCATE TABLE '.MYSQL_PREFIX.$this->TABLE_NAME.';';
+        if($this->debug)echo '<hr>'.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.'<br>'.mysql_error();
+        $myQuery = $this->customQuery($query);
     }
 
     /**
@@ -154,15 +154,15 @@ class MysqlEntity
 
             foreach($events as $event){
 
-                    if($u){$query .=' union select ';}else{$u=true;}
+                if($u){$query .=' union select ';}else{$u=true;}
 
-                    $i=false;
-                    foreach($event->object_fields as $field=>$type){
-                        if($type!='key'){
-                            if($i){$query .=',';}else{$i=true;}
-                            $query .='"'.$this->secure($event->$field, $field).'"';
-                        }
+                $i=false;
+                foreach($event->object_fields as $field=>$type){
+                    if($type!='key'){
+                        if($i){$query .=',';}else{$i=true;}
+                        $query .='"'.$this->secure($event->$field, $field).'"';
                     }
+                }
 
 
             }
@@ -350,8 +350,8 @@ class MysqlEntity
             $whereClause = ' WHERE ';
             $i=false;
             foreach($columns as $column=>$value){
-                    if($i){$whereClause .=' AND ';}else{$i=true;}
-                    $whereClause .= '`'.$column.'`="'.$this->secure($value, $column).'"';
+                if($i){$whereClause .=' AND ';}else{$i=true;}
+                $whereClause .= '`'.$column.'`="'.$this->secure($value, $column).'"';
             }
         }
         $query = 'SELECT COUNT(1) FROM '.MYSQL_PREFIX.$this->TABLE_NAME.$whereClause;
@@ -374,14 +374,14 @@ class MysqlEntity
     public function delete($columns,$operation='=',$debug=false){
         $whereClause = '';
 
-            $i=false;
-            foreach($columns as $column=>$value){
-                if($i){$whereClause .=' AND ';}else{$i=true;}
-                $whereClause .= '`'.$column.'`'.$operation.'"'.$this->secure($value, $column).'"';
-            }
-            $query = 'DELETE FROM `'.MYSQL_PREFIX.$this->TABLE_NAME.'` WHERE '.$whereClause.' ;';
-            if($this->debug)echo '<hr>'.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.'<br>'.mysql_error();
-            $this->customQuery($query);
+        $i=false;
+        foreach($columns as $column=>$value){
+            if($i){$whereClause .=' AND ';}else{$i=true;}
+            $whereClause .= '`'.$column.'`'.$operation.'"'.$this->secure($value, $column).'"';
+        }
+        $query = 'DELETE FROM `'.MYSQL_PREFIX.$this->TABLE_NAME.'` WHERE '.$whereClause.' ;';
+        if($this->debug)echo '<hr>'.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.'<br>'.mysql_error();
+        $this->customQuery($query);
 
     }
 

+ 47 - 47
Plugin.class.php

@@ -95,71 +95,71 @@ class Plugin{
 
 
 
-        public static function addHook($hookName, $functionName) {
-            $GLOBALS['hooks'][$hookName][] = $functionName;
-        }
+    public static function addHook($hookName, $functionName) {
+        $GLOBALS['hooks'][$hookName][] = $functionName;
+    }
 
-        public static function addCss($css) {
-            $bt =  debug_backtrace();
+    public static function addCss($css) {
+        $bt =  debug_backtrace();
 
-            $path = Functions::relativePath(str_replace('\\','/',dirname(__FILE__)),str_replace('\\','/',dirname($bt[0]['file']).$css));
+        $path = Functions::relativePath(str_replace('\\','/',dirname(__FILE__)),str_replace('\\','/',dirname($bt[0]['file']).$css));
 
-            $GLOBALS['hooks']['css_files'][] = $path;
-        }
+        $GLOBALS['hooks']['css_files'][] = $path;
+    }
 
-        public static function callCss(){
-            $return='';
-            if(isset($GLOBALS['hooks']['css_files'])) {
-                foreach($GLOBALS['hooks']['css_files'] as $css_file) {
-                    $return .='<link rel="stylesheet" href="'.$css_file.'">'."\n";
-                }
+    public static function callCss(){
+        $return='';
+        if(isset($GLOBALS['hooks']['css_files'])) {
+            foreach($GLOBALS['hooks']['css_files'] as $css_file) {
+                $return .='<link rel="stylesheet" href="'.$css_file.'">'."\n";
             }
-            return $return;
         }
+        return $return;
+    }
 
-        public static function addLink($rel, $link) {
-            $GLOBALS['hooks']['head_link'][] = array("rel"=>$rel, "link"=>$link);
-        }
+    public static function addLink($rel, $link) {
+        $GLOBALS['hooks']['head_link'][] = array("rel"=>$rel, "link"=>$link);
+    }
 
-        public static function callLink(){
-            $return='';
-            if(isset($GLOBALS['hooks']['head_link'])) {
-                foreach($GLOBALS['hooks']['head_link'] as $head_link) {
-                    $return .='<link rel="'.$head_link['rel'].'" href="'.$head_link['link'].'" />'."\n";
-                }
+    public static function callLink(){
+        $return='';
+        if(isset($GLOBALS['hooks']['head_link'])) {
+            foreach($GLOBALS['hooks']['head_link'] as $head_link) {
+                $return .='<link rel="'.$head_link['rel'].'" href="'.$head_link['link'].'" />'."\n";
             }
-            return $return;
         }
+        return $return;
+    }
 
-        public static function path(){
-            $bt =  debug_backtrace();
-            return Functions::relativePath(str_replace('\\','/',dirname(__FILE__)),str_replace('\\','/',dirname($bt[0]['file']))).'/';
-        }
+    public static function path(){
+        $bt =  debug_backtrace();
+        return Functions::relativePath(str_replace('\\','/',dirname(__FILE__)),str_replace('\\','/',dirname($bt[0]['file']))).'/';
+    }
 
-        public static function addJs($js) {
-            $bt =  debug_backtrace();
-            $path = Functions::relativePath(str_replace('\\','/',dirname(__FILE__)),str_replace('\\','/',dirname($bt[0]['file']).$js));
-            $GLOBALS['hooks']['js_files'][] = $path;
-        }
+    public static function addJs($js) {
+        $bt =  debug_backtrace();
+        $path = Functions::relativePath(str_replace('\\','/',dirname(__FILE__)),str_replace('\\','/',dirname($bt[0]['file']).$js));
+        $GLOBALS['hooks']['js_files'][] = $path;
+    }
 
-        public static function callJs(){
-            $return='';
-            if(isset($GLOBALS['hooks']['js_files'])) {
-                foreach($GLOBALS['hooks']['js_files'] as $js_file) {
-                    $return .='<script type="text/javascript" src="'.$js_file.'"></script>'."\n";
-                }
+    public static function callJs(){
+        $return='';
+        if(isset($GLOBALS['hooks']['js_files'])) {
+            foreach($GLOBALS['hooks']['js_files'] as $js_file) {
+                $return .='<script type="text/javascript" src="'.$js_file.'"></script>'."\n";
             }
-            return $return;
         }
+        return $return;
+    }
 
-        public static function callHook($hookName, $hookArguments) {
-            //echo '<div style="display:inline;background-color:#CC47CB;padding:3px;border:5px solid #9F1A9E;border-radius:5px;color:#ffffff;font-size:15px;">'.$hookName.'</div>';
-            if(isset($GLOBALS['hooks'][$hookName])) {
-                foreach($GLOBALS['hooks'][$hookName] as $functionName) {
-                    call_user_func_array($functionName, $hookArguments);
-                }
+    public static function callHook($hookName, $hookArguments) {
+        //echo '<div style="display:inline;background-color:#CC47CB;padding:3px;border:5px solid #9F1A9E;border-radius:5px;color:#ffffff;font-size:15px;">'.$hookName.'</div>';
+        if(isset($GLOBALS['hooks'][$hookName])) {
+            foreach($GLOBALS['hooks'][$hookName] as $functionName) {
+                call_user_func_array($functionName, $hookArguments);
             }
         }
+    }
 
     public static function getFiles($onlyActivated=false){
 

+ 43 - 43
action.php

@@ -220,35 +220,35 @@ switch ($action){
 
 
     case 'exportFeed':
-            if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
-                /*********************/
-            /** Export **/
+        if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
             /*********************/
-            if(isset($_POST['exportButton'])){
-                $opml = new Opml();
-                $xmlStream = $opml->export();
-
-                header('Content-Description: File Transfer');
-                header('Content-Type: application/octet-stream');
-                header('Content-Disposition: attachment; filename=leed-'.date('d-m-Y').'.opml');
-                header('Content-Transfer-Encoding: binary');
-                header('Expires: 0');
-                header('Cache-Control: must-revalidate');
-                header('Pragma: public');
-                header('Content-Length: ' . strlen($xmlStream));
-                /*
-                //A decommenter dans le cas ou on a des pb avec ie
-                if(preg_match('/msie|(microsoft internet explorer)/i', $_SERVER['HTTP_USER_AGENT'])){
-                  header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-                  header('Pragma: public');
-                }else{
-                  header('Pragma: no-cache');
-                }
-                */
-                ob_clean();
-                flush();
-                echo $xmlStream;
+        /** Export **/
+        /*********************/
+        if(isset($_POST['exportButton'])){
+            $opml = new Opml();
+            $xmlStream = $opml->export();
+
+            header('Content-Description: File Transfer');
+            header('Content-Type: application/octet-stream');
+            header('Content-Disposition: attachment; filename=leed-'.date('d-m-Y').'.opml');
+            header('Content-Transfer-Encoding: binary');
+            header('Expires: 0');
+            header('Cache-Control: must-revalidate');
+            header('Pragma: public');
+            header('Content-Length: ' . strlen($xmlStream));
+            /*
+            //A decommenter dans le cas ou on a des pb avec ie
+            if(preg_match('/msie|(microsoft internet explorer)/i', $_SERVER['HTTP_USER_AGENT'])){
+              header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+              header('Pragma: public');
+            }else{
+              header('Pragma: no-cache');
             }
+            */
+            ob_clean();
+            flush();
+            echo $xmlStream;
+        }
     break;
 
 
@@ -348,21 +348,21 @@ switch ($action){
 
 
     case 'addFeed':
-            if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
-            require_once("SimplePie.class.php");
-            if(!isset($_['newUrl'])) break;
-            $newFeed = new Feed();
-            $newFeed->setUrl(Functions::clean_url($_['newUrl']));
-            if ($newFeed->notRegistered()) {
-                ///@TODO: avertir l'utilisateur du doublon non ajouté
-                $newFeed->getInfos();
-                $newFeed->setFolder(
-                    (isset($_['newUrlCategory'])?$_['newUrlCategory']:1)
-                );
-                $newFeed->save();
-                $newFeed->parse(time(), $_, true);
-            }
-             header('location: ./settings.php#manageBloc');
+        if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
+        require_once("SimplePie.class.php");
+        if(!isset($_['newUrl'])) break;
+        $newFeed = new Feed();
+        $newFeed->setUrl(Functions::clean_url($_['newUrl']));
+        if ($newFeed->notRegistered()) {
+            ///@TODO: avertir l'utilisateur du doublon non ajouté
+            $newFeed->getInfos();
+            $newFeed->setFolder(
+                (isset($_['newUrlCategory'])?$_['newUrlCategory']:1)
+            );
+            $newFeed->save();
+            $newFeed->parse(time(), $_, true);
+        }
+        header('location: ./settings.php#manageBloc');
     break;
 
     case 'changeFeedFolder':
@@ -385,7 +385,7 @@ switch ($action){
     case 'addFolder':
         if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
         if(isset($_['newFolder'])){
-                $folder = new Folder();
+            $folder = new Folder();
             if($folder->rowCount(array('name'=>$_['newFolder']))==0){
                 $folder->setParent(-1);
                 $folder->setIsopen(0);

+ 62 - 61
article.php

@@ -6,72 +6,73 @@
  @description: Page de gestion de l'affichage des articles. Sera utilisé de base ainsi que pour le scroll infini
  */
 
-    include ('common.php');
-    $view = "article";
-    //recuperation de tous les flux
-    $allFeeds = $feedManager->getFeedsPerFolder();
-    $tpl->assign('allFeeds',$allFeeds);
-    $tpl->assign('scrollpage',$_['scroll']);
-    // récupération des variables pour l'affichage
-    $articleDisplayContent = $configurationManager->get('articleDisplayContent');
-    $articleView = $configurationManager->get('articleView');
-    $articlePerPages = $configurationManager->get('articlePerPages');
-    $articleDisplayLink = $configurationManager->get('articleDisplayLink');
-    $articleDisplayDate = $configurationManager->get('articleDisplayDate');
-    $articleDisplayAuthor = $configurationManager->get('articleDisplayAuthor');
-    $articleDisplayHomeSort = $configurationManager->get('articleDisplayHomeSort');
-    $articleDisplayFolderSort = $configurationManager->get('articleDisplayFolderSort');
+include ('common.php');
+$view = "article";
+//recuperation de tous les flux
+$allFeeds = $feedManager->getFeedsPerFolder();
+$tpl->assign('allFeeds',$allFeeds);
+$tpl->assign('scrollpage',$_['scroll']);
+// récupération des variables pour l'affichage
+$articleDisplayContent = $configurationManager->get('articleDisplayContent');
+$articleView = $configurationManager->get('articleView');
+$articlePerPages = $configurationManager->get('articlePerPages');
+$articleDisplayLink = $configurationManager->get('articleDisplayLink');
+$articleDisplayDate = $configurationManager->get('articleDisplayDate');
+$articleDisplayAuthor = $configurationManager->get('articleDisplayAuthor');
+$articleDisplayHomeSort = $configurationManager->get('articleDisplayHomeSort');
+$articleDisplayFolderSort = $configurationManager->get('articleDisplayFolderSort');
 
-    $tpl->assign('articleView',$articleView);
-    $tpl->assign('articleDisplayLink',$articleDisplayLink);
-    $tpl->assign('articleDisplayDate',$articleDisplayDate);
-    $tpl->assign('articleDisplayAuthor',$articleDisplayAuthor);
-    $tpl->assign('articleDisplayContent',$articleDisplayContent);
+$tpl->assign('articleView',$articleView);
+$tpl->assign('articleDisplayLink',$articleDisplayLink);
+$tpl->assign('articleDisplayDate',$articleDisplayDate);
+$tpl->assign('articleDisplayAuthor',$articleDisplayAuthor);
+$tpl->assign('articleDisplayContent',$articleDisplayContent);
 
 
-    $hightlighted = $_['hightlighted'];
-    $tpl->assign('hightlighted',$hightlighted);
+$hightlighted = $_['hightlighted'];
+$tpl->assign('hightlighted',$hightlighted);
 
-    $tpl->assign('time',$_SERVER['REQUEST_TIME']);
+$tpl->assign('time',$_SERVER['REQUEST_TIME']);
 
-    $target = MYSQL_PREFIX.'event.title,'.MYSQL_PREFIX.'event.unread,'.MYSQL_PREFIX.'event.favorite,'.MYSQL_PREFIX.'event.feed,';
-    if($articleDisplayContent && $articleView=='partial') $target .= MYSQL_PREFIX.'event.description,';
-    if($articleDisplayContent && $articleView!='partial') $target .= MYSQL_PREFIX.'event.content,';
-    if($articleDisplayLink) $target .= MYSQL_PREFIX.'event.link,';
-    if($articleDisplayDate) $target .= MYSQL_PREFIX.'event.pubdate,';
-    if($articleDisplayAuthor) $target .= MYSQL_PREFIX.'event.creator,';
-    $target .= MYSQL_PREFIX.'event.id';
+$target = MYSQL_PREFIX.'event.title,'.MYSQL_PREFIX.'event.unread,'.MYSQL_PREFIX.'event.favorite,'.MYSQL_PREFIX.'event.feed,';
+if($articleDisplayContent && $articleView=='partial') $target .= MYSQL_PREFIX.'event.description,';
+if($articleDisplayContent && $articleView!='partial') $target .= MYSQL_PREFIX.'event.content,';
+if($articleDisplayLink) $target .= MYSQL_PREFIX.'event.link,';
+if($articleDisplayDate) $target .= MYSQL_PREFIX.'event.pubdate,';
+if($articleDisplayAuthor) $target .= MYSQL_PREFIX.'event.creator,';
+$target .= MYSQL_PREFIX.'event.id';
 
-    $startArticle = $_['scroll']*$articlePerPages-$_['nblus'];
-    $action = $_['action'];
+$startArticle = $_['scroll']*$articlePerPages-$_['nblus'];
+$action = $_['action'];
+
+switch($action){
+    /* AFFICHAGE DES EVENEMENTS D'UN FLUX EN PARTICULIER */
+    case 'selectedFeed':
+        $currentFeed = $feedManager->getById($_['feed']);
+        $allowedOrder = array('date'=>'pubdate DESC','older'=>'pubdate','unread'=>'unread DESC,pubdate DESC');
+        $order = (isset($_['order'])?$allowedOrder[$_['order']]:$allowedOrder['date']);
+        $events = $currentFeed->getEvents($startArticle,$articlePerPages,$order,$target);
+    break;
+    /* AFFICHAGE DES EVENEMENTS D'UN DOSSIER EN PARTICULIER */
+    case 'selectedFolder':
+        $currentFolder = $folderManager->getById($_['folder']);
+        if($articleDisplayFolderSort) {$order = MYSQL_PREFIX.'event.pubdate desc';} else {$order = MYSQL_PREFIX.'event.pubdate asc';}
+        $events = $currentFolder->getEvents($startArticle,$articlePerPages,$order,$target);
+    break;
+    /* AFFICHAGE DES EVENEMENTS FAVORIS */
+    case 'favorites':
+        $events = $eventManager->loadAllOnlyColumn($target,array('favorite'=>1),'pubDate DESC',$startArticle.','.$articlePerPages);
+    break;
+    /* AFFICHAGE DES EVENEMENTS NON LUS (COMPORTEMENT PAR DEFAUT) */
+    case 'unreadEvents':
+    default:
+        if($articleDisplayHomeSort) {$order = 'pubdate desc';} else {$order = 'pubdate asc';}
+        $events = $eventManager->loadAllOnlyColumn($target,array('unread'=>1),$order,$startArticle.','.$articlePerPages);
+    break;
+}
+$tpl->assign('events',$events);
+$tpl->assign('scroll',$_['scroll']);
+$view = "article";
+$html = $tpl->draw($view);
 
-    switch($action){
-        /* AFFICHAGE DES EVENEMENTS D'UN FLUX EN PARTICULIER */
-        case 'selectedFeed':
-            $currentFeed = $feedManager->getById($_['feed']);
-            $allowedOrder = array('date'=>'pubdate DESC','older'=>'pubdate','unread'=>'unread DESC,pubdate DESC');
-            $order = (isset($_['order'])?$allowedOrder[$_['order']]:$allowedOrder['date']);
-            $events = $currentFeed->getEvents($startArticle,$articlePerPages,$order,$target);
-        break;
-        /* AFFICHAGE DES EVENEMENTS D'UN DOSSIER EN PARTICULIER */
-        case 'selectedFolder':
-            $currentFolder = $folderManager->getById($_['folder']);
-            if($articleDisplayFolderSort) {$order = MYSQL_PREFIX.'event.pubdate desc';} else {$order = MYSQL_PREFIX.'event.pubdate asc';}
-            $events = $currentFolder->getEvents($startArticle,$articlePerPages,$order,$target);
-        break;
-        /* AFFICHAGE DES EVENEMENTS FAVORIS */
-        case 'favorites':
-            $events = $eventManager->loadAllOnlyColumn($target,array('favorite'=>1),'pubDate DESC',$startArticle.','.$articlePerPages);
-        break;
-        /* AFFICHAGE DES EVENEMENTS NON LUS (COMPORTEMENT PAR DEFAUT) */
-        case 'unreadEvents':
-        default:
-            if($articleDisplayHomeSort) {$order = 'pubdate desc';} else {$order = 'pubdate asc';}
-            $events = $eventManager->loadAllOnlyColumn($target,array('unread'=>1),$order,$startArticle.','.$articlePerPages);
-        break;
-    }
-    $tpl->assign('events',$events);
-    $tpl->assign('scroll',$_['scroll']);
-    $view = "article";
-    $html = $tpl->draw($view);
 ?>

+ 2 - 2
common.php

@@ -67,10 +67,10 @@ $tpl->assign('synchronisationCode',$configurationManager->get('synchronisationCo
 //Récuperation et sécurisation de toutes les variables POST et GET
 $_ = array();
 foreach($_POST as $key=>$val){
-$_[$key]=Functions::secure($val, 2); // on ne veut pas d'addslashes
+    $_[$key]=Functions::secure($val, 2); // on ne veut pas d'addslashes
 }
 foreach($_GET as $key=>$val){
-$_[$key]=Functions::secure($val, 2); // on ne veut pas d'addslashes
+    $_[$key]=Functions::secure($val, 2); // on ne veut pas d'addslashes
 }
 
 $tpl->assign('_',$_);

+ 14 - 14
i18n.php

@@ -7,24 +7,24 @@
  */
 
 
-    function i18n_init(){
-        global $i18n,$i18n_js;
-        if(!isset($i18n)){
-            $i18n_js =  file_get_contents(dirname(__FILE__).'/locale/'.LANGUAGE.'.json');
-            $i18n = json_decode($i18n_js,true);
-        }
+function i18n_init(){
+    global $i18n,$i18n_js;
+    if(!isset($i18n)){
+        $i18n_js =  file_get_contents(dirname(__FILE__).'/locale/'.LANGUAGE.'.json');
+        $i18n = json_decode($i18n_js,true);
     }
+}
 
-    function _t($key,$args=array(),$debug=false){
-        global $i18n;
+function _t($key,$args=array(),$debug=false){
+    global $i18n;
 
-        $value = (isset($i18n[$key])?$i18n[$key]:'');
-        for($i=0;$i<count($args);$i++){
-            $value = str_replace('$'.($i+1), $args[$i], $value);
-        }
-        if($debug) var_dump($key,$args,$i18n[$key],$value);
-        return $value;
+    $value = (isset($i18n[$key])?$i18n[$key]:'');
+    for($i=0;$i<count($args);$i++){
+        $value = str_replace('$'.($i+1), $args[$i], $value);
     }
+    if($debug) var_dump($key,$args,$i18n[$key],$value);
+    return $value;
+}
 
 
 ?>

+ 68 - 68
index.php

@@ -59,74 +59,74 @@ $tpl->assign('order','');
 $tpl->assign('unreadEventsForFolder','');
 $pagesArray = array();
 
-                switch($action){
-                    /* AFFICHAGE DES EVENEMENTS D'UN FLUX EN PARTICULIER */
-                    case 'selectedFeed':
-                        $currentFeed = $feedManager->getById($_['feed']);
-                        $tpl->assign('currentFeed',$currentFeed);
-                        $numberOfItem = $eventManager->rowCount(array('feed'=>$currentFeed->getId()));
-                        $allowedOrder = array('date'=>'pubdate DESC','older'=>'pubdate','unread'=>'unread DESC,pubdate DESC');
-                        $order = (isset($_['order'])?$allowedOrder[$_['order']]:$allowedOrder['date']);
-                        $page = (isset($_['page'])?$_['page']:1);
-                        $pages = ceil($numberOfItem/$articlePerPages);
-                        $startArticle = ($page-1)*$articlePerPages;
-                        $events = $currentFeed->getEvents($startArticle,$articlePerPages,$order,$target);
-
-                        $tpl->assign('order',(isset($_['order'])?$_['order']:''));
-
-                    break;
-                    /* AFFICHAGE DES EVENEMENTS D'UN DOSSIER EN PARTICULIER */
-                    case 'selectedFolder':
-                        $currentFolder = $folderManager->getById($_['folder']);
-                        $tpl->assign('currentFolder',$currentFolder);
-                        $numberOfItem = $currentFolder->unreadCount();
-                        $page = (isset($_['page'])?$_['page']:1);
-                        $pages = ceil($numberOfItem/$articlePerPages);
-                        $startArticle = ($page-1)*$articlePerPages;
-                        if($articleDisplayFolderSort) {$order = MYSQL_PREFIX.'event.pubdate desc';} else {$order = MYSQL_PREFIX.'event.pubdate asc';}
-                        $events = $currentFolder->getEvents($startArticle,$articlePerPages,$order,$target);
-
-
-                    break;
-                    /* AFFICHAGE DES EVENEMENTS FAVORIS */
-                    case 'favorites':
-                        $numberOfItem = $eventManager->rowCount(array('favorite'=>1));
-                        $page = (isset($_['page'])?$_['page']:1);
-                        $pages = ceil($numberOfItem/$articlePerPages);
-                        $startArticle = ($page-1)*$articlePerPages;
-                        $events = $eventManager->loadAllOnlyColumn($target,array('favorite'=>1),'pubDate DESC',$startArticle.','.$articlePerPages);
-                        $tpl->assign('numberOfItem',$numberOfItem);
-                    break;
-
-                    /* AFFICHAGE DES EVENEMENTS NON LUS (COMPORTEMENT PAR DEFAUT) */
-                    case 'unreadEvents':
-                    default:
-                        $numberOfItem = $eventManager->rowCount(array('unread'=>1));
-                        $page = (isset($_['page'])?$_['page']:1);
-                        $pages = ($articlePerPages>0?ceil($numberOfItem/$articlePerPages):1);
-                        $startArticle = ($page-1)*$articlePerPages;
-                        if($articleDisplayHomeSort) {$order = 'pubdate desc';} else {$order = 'pubdate asc';}
-                        $events = $eventManager->loadAllOnlyColumn($target,array('unread'=>1),$order,$startArticle.','.$articlePerPages);
-                        $tpl->assign('numberOfItem',$numberOfItem);
-
-                    break;
-                }
-                $tpl->assign('pages',$pages);
-                $tpl->assign('page',$page);
-
-                for($i=($page-PAGINATION_SCALE<=0?1:$page-PAGINATION_SCALE);$i<($page+PAGINATION_SCALE>$pages+1?$pages+1:$page+PAGINATION_SCALE);$i++){
-                    $pagesArray[]=$i;
-                }
-                $tpl->assign('pagesArray',$pagesArray);
-                $tpl->assign('previousPages',($page-PAGINATION_SCALE<0?-1:$page-PAGINATION_SCALE-1));
-                $tpl->assign('nextPages',($page+PAGINATION_SCALE>$pages+1?-1:$page+PAGINATION_SCALE));
-
-
-                Plugin::callHook("index_post_treatment", array(&$events));
-                $tpl->assign('events',$events);
-                $tpl->assign('time',$_SERVER['REQUEST_TIME']);
-                $tpl->assign('hightlighted',0);
-                $tpl->assign('scroll',false);
+switch($action){
+    /* AFFICHAGE DES EVENEMENTS D'UN FLUX EN PARTICULIER */
+    case 'selectedFeed':
+        $currentFeed = $feedManager->getById($_['feed']);
+        $tpl->assign('currentFeed',$currentFeed);
+        $numberOfItem = $eventManager->rowCount(array('feed'=>$currentFeed->getId()));
+        $allowedOrder = array('date'=>'pubdate DESC','older'=>'pubdate','unread'=>'unread DESC,pubdate DESC');
+        $order = (isset($_['order'])?$allowedOrder[$_['order']]:$allowedOrder['date']);
+        $page = (isset($_['page'])?$_['page']:1);
+        $pages = ceil($numberOfItem/$articlePerPages);
+        $startArticle = ($page-1)*$articlePerPages;
+        $events = $currentFeed->getEvents($startArticle,$articlePerPages,$order,$target);
+
+        $tpl->assign('order',(isset($_['order'])?$_['order']:''));
+
+    break;
+    /* AFFICHAGE DES EVENEMENTS D'UN DOSSIER EN PARTICULIER */
+    case 'selectedFolder':
+        $currentFolder = $folderManager->getById($_['folder']);
+        $tpl->assign('currentFolder',$currentFolder);
+        $numberOfItem = $currentFolder->unreadCount();
+        $page = (isset($_['page'])?$_['page']:1);
+        $pages = ceil($numberOfItem/$articlePerPages);
+        $startArticle = ($page-1)*$articlePerPages;
+        if($articleDisplayFolderSort) {$order = MYSQL_PREFIX.'event.pubdate desc';} else {$order = MYSQL_PREFIX.'event.pubdate asc';}
+        $events = $currentFolder->getEvents($startArticle,$articlePerPages,$order,$target);
+
+
+    break;
+    /* AFFICHAGE DES EVENEMENTS FAVORIS */
+    case 'favorites':
+        $numberOfItem = $eventManager->rowCount(array('favorite'=>1));
+        $page = (isset($_['page'])?$_['page']:1);
+        $pages = ceil($numberOfItem/$articlePerPages);
+        $startArticle = ($page-1)*$articlePerPages;
+        $events = $eventManager->loadAllOnlyColumn($target,array('favorite'=>1),'pubDate DESC',$startArticle.','.$articlePerPages);
+        $tpl->assign('numberOfItem',$numberOfItem);
+    break;
+
+    /* AFFICHAGE DES EVENEMENTS NON LUS (COMPORTEMENT PAR DEFAUT) */
+    case 'unreadEvents':
+    default:
+        $numberOfItem = $eventManager->rowCount(array('unread'=>1));
+        $page = (isset($_['page'])?$_['page']:1);
+        $pages = ($articlePerPages>0?ceil($numberOfItem/$articlePerPages):1);
+        $startArticle = ($page-1)*$articlePerPages;
+        if($articleDisplayHomeSort) {$order = 'pubdate desc';} else {$order = 'pubdate asc';}
+        $events = $eventManager->loadAllOnlyColumn($target,array('unread'=>1),$order,$startArticle.','.$articlePerPages);
+        $tpl->assign('numberOfItem',$numberOfItem);
+
+    break;
+}
+$tpl->assign('pages',$pages);
+$tpl->assign('page',$page);
+
+for($i=($page-PAGINATION_SCALE<=0?1:$page-PAGINATION_SCALE);$i<($page+PAGINATION_SCALE>$pages+1?$pages+1:$page+PAGINATION_SCALE);$i++){
+    $pagesArray[]=$i;
+}
+$tpl->assign('pagesArray',$pagesArray);
+$tpl->assign('previousPages',($page-PAGINATION_SCALE<0?-1:$page-PAGINATION_SCALE-1));
+$tpl->assign('nextPages',($page+PAGINATION_SCALE>$pages+1?-1:$page+PAGINATION_SCALE));
+
+
+Plugin::callHook("index_post_treatment", array(&$events));
+$tpl->assign('events',$events);
+$tpl->assign('time',$_SERVER['REQUEST_TIME']);
+$tpl->assign('hightlighted',0);
+$tpl->assign('scroll',false);
 
 $view = 'index';
 require_once('footer.php');

+ 117 - 117
templates/marigolds/js/script.js

@@ -216,13 +216,13 @@ function scrollInfini() {
 /* Cette fonction sera utilisé pour le scroll infinie, afin d'ajouter les évènements necessaires */
 function addEventsButtonLuNonLus(){
     var handler = function(event){
-            var target = event.target;
-            var id = this.id;
-            if($(target).hasClass('readUnreadButton')){
-                buttonAction(target,id);
-            }else{
-                targetThisEvent(this);
-            }
+    var target = event.target;
+    var id = this.id;
+    if($(target).hasClass('readUnreadButton')){
+        buttonAction(target,id);
+    }else{
+        targetThisEvent(this);
+    }
     }
     // on vire tous les évènements afin de ne pas avoir des doublons d'évènements
     $('article section').unbind('click');
@@ -308,42 +308,42 @@ function toggleFolder(element,folder){
 function addFavorite(element,id){
     var activeScreen = $('#pageTop').html();
     $.ajax({
-                  url: "./action.php?action=addFavorite",
-                  data:{id:id},
-                  success:function(msg){
-                        if(msg.status == 'noconnect') {
-                            alert(msg.texte)
-                        } else {
-                            if( console && console.log && msg!="" ) console.log(msg);
-                            $(element).attr('onclick','removeFavorite(this,'+id+');').html(_t('UNFAVORIZE'));
-                            // on compte combien d'article ont été remis en favoris sur la pages favoris (scroll infini)
-                            if (activeScreen=='favorites') {
-                                $(window).data('nblus', $(window).data('nblus')-1);
-                                $('#nbarticle').html(parseInt($('#nbarticle').html()) + 1);
-                            }
-                        }
-                  }
+        url: "./action.php?action=addFavorite",
+        data:{id:id},
+        success:function(msg){
+            if(msg.status == 'noconnect') {
+                alert(msg.texte)
+            } else {
+                if( console && console.log && msg!="" ) console.log(msg);
+                $(element).attr('onclick','removeFavorite(this,'+id+');').html(_t('UNFAVORIZE'));
+                // on compte combien d'article ont été remis en favoris sur la pages favoris (scroll infini)
+                if (activeScreen=='favorites') {
+                    $(window).data('nblus', $(window).data('nblus')-1);
+                    $('#nbarticle').html(parseInt($('#nbarticle').html()) + 1);
+                }
+            }
+        }
     });
 }
 
 function removeFavorite(element,id){
     var activeScreen = $('#pageTop').html();
     $.ajax({
-                  url: "./action.php?action=removeFavorite",
-                  data:{id:id},
-                  success:function(msg){
-                        if(msg.status == 'noconnect') {
-                            alert(msg.texte)
-                        } else {
-                            if( console && console.log && msg!="" ) console.log(msg);
-                            $(element).attr('onclick','addFavorite(this,'+id+');').html(_t('FAVORIZE'));
-                            // on compte combien d'article ont été remis en favoris sur la pages favoris (scroll infini)
-                            if (activeScreen=='favorites') {
-                                $(window).data('nblus', $(window).data('nblus')+1);
-                                $('#nbarticle').html(parseInt($('#nbarticle').html()) - 1);
-                            }
-                        }
-                  }
+        url: "./action.php?action=removeFavorite",
+        data:{id:id},
+        success:function(msg){
+            if(msg.status == 'noconnect') {
+                alert(msg.texte)
+            } else {
+                if( console && console.log && msg!="" ) console.log(msg);
+                $(element).attr('onclick','addFavorite(this,'+id+');').html(_t('FAVORIZE'));
+                // on compte combien d'article ont été remis en favoris sur la pages favoris (scroll infini)
+                if (activeScreen=='favorites') {
+                    $(window).data('nblus', $(window).data('nblus')+1);
+                    $('#nbarticle').html(parseInt($('#nbarticle').html()) - 1);
+                }
+            }
+        }
     });
 }
 
@@ -367,8 +367,8 @@ function saveRenameFolder(element,folder){
     $(element).attr('onclick','renameFolder(this,'+folder+')');
     folderNameCase.replaceWith('<span>'+value+'</span>');
     $.ajax({
-                  url: "./action.php?action=renameFolder",
-                  data:{id:folder,name:value}
+        url: "./action.php?action=renameFolder",
+        data:{id:folder,name:value}
     });
 }
 
@@ -399,8 +399,8 @@ function saveRenameFeed(element,feed,url){
     feedNameCase.replaceWith('<a href="'+url+'">'+feedNameValue+'</a>');
     feedUrlCase.replaceWith('<span class="underlink">'+feedUrlValue+'</span>');
     $.ajax({
-                  url: "./action.php?action=renameFeed",
-                  data:{id:feed,name:feedNameValue,url:feedUrlValue}
+        url: "./action.php?action=renameFeed",
+        data:{id:feed,name:feedNameValue,url:feedUrlValue}
     });
 }
 
@@ -418,66 +418,66 @@ function readThis(element,id,from,callback){
     //sur les éléments non lus
     if(!parent.hasClass('eventRead')){
         $.ajax({
-                      url: "./action.php?action=readContent",
-                      data:{id:id},
-                      success:function(msg){
-                            if(msg.status == 'noconnect') {
-                                alert(msg.texte)
-                            } else {
-                                if( console && console.log && msg!="" ) console.log(msg);
-                                switch (activeScreen){
-                                    case '':
-                                        // cas de la page d'accueil
-                                        parent.addClass('eventRead');
-                                        parent.fadeOut(200,function(){
-                                            if(callback){
-                                                callback();
-                                            }else{
-                                                targetThisEvent(nextEvent,true);
-                                            }
-                                            // on simule un scroll si tous les events sont cachés
-                                            if($('article section:last').attr('style')=='display: none;') {
-                                                $(window).scrollTop($(document).height());
-                                            }
-                                        });
-                                        // on compte combien d'article ont été lus afin de les soustraires de la requête pour le scroll infini
-                                        $(window).data('nblus', $(window).data('nblus')+1);
-                                        // on diminue le nombre d'article en haut de page
-                                        $('#nbarticle').html(parseInt($('#nbarticle').html()) - 1)
-                                    break;
-                                    case 'selectedFolder':
-                                        parent.addClass('eventRead');
-                                        targetThisEvent(nextEvent,true);
-                                        // on compte combien d'article ont été lus afin de les soustraires de la requête pour le scroll infini
-                                        $(window).data('nblus', $(window).data('nblus')+1);
-                                    break;
-                                    default:
-                                        // autres cas : favoris, selectedFeed ...
-                                        parent.addClass('eventRead');
-                                        targetThisEvent(nextEvent,true);
-                                    break;
+            url: "./action.php?action=readContent",
+            data:{id:id},
+            success:function(msg){
+                if(msg.status == 'noconnect') {
+                    alert(msg.texte)
+                } else {
+                    if( console && console.log && msg!="" ) console.log(msg);
+                    switch (activeScreen){
+                        case '':
+                            // cas de la page d'accueil
+                            parent.addClass('eventRead');
+                            parent.fadeOut(200,function(){
+                                if(callback){
+                                    callback();
+                                }else{
+                                    targetThisEvent(nextEvent,true);
                                 }
-                            }
-                      }
+                                // on simule un scroll si tous les events sont cachés
+                                if($('article section:last').attr('style')=='display: none;') {
+                                    $(window).scrollTop($(document).height());
+                                }
+                            });
+                            // on compte combien d'article ont été lus afin de les soustraires de la requête pour le scroll infini
+                            $(window).data('nblus', $(window).data('nblus')+1);
+                            // on diminue le nombre d'article en haut de page
+                            $('#nbarticle').html(parseInt($('#nbarticle').html()) - 1)
+                        break;
+                        case 'selectedFolder':
+                            parent.addClass('eventRead');
+                            targetThisEvent(nextEvent,true);
+                            // on compte combien d'article ont été lus afin de les soustraires de la requête pour le scroll infini
+                            $(window).data('nblus', $(window).data('nblus')+1);
+                        break;
+                        default:
+                            // autres cas : favoris, selectedFeed ...
+                            parent.addClass('eventRead');
+                            targetThisEvent(nextEvent,true);
+                        break;
+                    }
+                }
+            }
         });
     }else{  // sur les éléments lus
             // si ce n'est pas un clic sur le titre de l'event
-            if(from!='title'){
-                $.ajax({
-                        url: "./action.php?action=unreadContent",
-                        data:{id:id},
-                        success:function(msg){
-                            if(msg.status == 'noconnect') {
-                                alert(msg.texte)
-                            } else {
-                                if( console && console.log && msg!="" ) console.log(msg);
-                                parent.removeClass('eventRead');
-                                // on compte combien d'article ont été remis à non lus
-                                if ( (activeScreen=='') || (activeScreen=='selectedFolder') ) $(window).data('nblus', $(window).data('nblus')-1);
-                            }
+        if(from!='title'){
+            $.ajax({
+                    url: "./action.php?action=unreadContent",
+                    data:{id:id},
+                    success:function(msg){
+                        if(msg.status == 'noconnect') {
+                            alert(msg.texte)
+                        } else {
+                            if( console && console.log && msg!="" ) console.log(msg);
+                            parent.removeClass('eventRead');
+                            // on compte combien d'article ont été remis à non lus
+                            if ( (activeScreen=='') || (activeScreen=='selectedFolder') ) $(window).data('nblus', $(window).data('nblus')-1);
                         }
-                });
-            }
+                    }
+            });
+        }
     }
 
 }
@@ -486,24 +486,24 @@ function unReadThis(element,id,from){
     var activeScreen = $('#pageTop').html();
     var parent = $(element).parent().parent();
     if(parent.hasClass('eventRead')){
-            if(from!='title'){
-                $.ajax({
-                              url: "./action.php?action=unreadContent",
-                              data:{id:id},
-                              success:function(msg){
-                                if(msg.status == 'noconnect') {
-                                    alert(msg.texte)
-                                } else {
-                                    if( console && console.log && msg!="" ) console.log(msg);
-                                    parent.removeClass('eventRead');
-                                    // on compte combien d'article ont été remis à non lus
-                                    if ( (activeScreen=='') || (activeScreen=='selectedFolder') ) $(window).data('nblus', $(window).data('nblus')-1);
-                                    // on augmente le nombre d'article en haut de page
-                                    if (activeScreen=='') $('#nbarticle').html(parseInt($('#nbarticle').html()) + 1);
-                                }
-                              }
-                });
-            }
+        if(from!='title'){
+            $.ajax({
+                url: "./action.php?action=unreadContent",
+                data:{id:id},
+                success:function(msg){
+                    if(msg.status == 'noconnect') {
+                        alert(msg.texte)
+                    } else {
+                        if( console && console.log && msg!="" ) console.log(msg);
+                        parent.removeClass('eventRead');
+                        // on compte combien d'article ont été remis à non lus
+                        if ( (activeScreen=='') || (activeScreen=='selectedFolder') ) $(window).data('nblus', $(window).data('nblus')-1);
+                        // on augmente le nombre d'article en haut de page
+                        if (activeScreen=='') $('#nbarticle').html(parseInt($('#nbarticle').html()) + 1);
+                    }
+                }
+            });
+        }
     }
 
 }
@@ -511,9 +511,9 @@ function unReadThis(element,id,from){
 //synchronisation manuelle lancée depuis le boutton du menu
 function synchronize(code){
     if(code!=''){
-            $('article').prepend('<section>'+
-            '<iframe class="importFrame" src="action.php?action=synchronize&format=html&code='+code+'" name="idFrameSynchro" id="idFrameSynchro" width="100%" height="300" ></iframe>'+
-            '</section>');
+        $('article').prepend('<section>'+
+        '<iframe class="importFrame" src="action.php?action=synchronize&format=html&code='+code+'" name="idFrameSynchro" id="idFrameSynchro" width="100%" height="300" ></iframe>'+
+        '</section>');
     }else{
         alert(_t('YOU_MUST_BE_CONNECTED_FEED'));
     }