]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/poche/Poche.class.php
[fix] RSS Feeds don't validate / W3C #384
[github/wallabag/wallabag.git] / inc / poche / Poche.class.php
index 34f2ff5ae9c139c6390c2ccb2eb8b1814a5c935f..0c4143e190f3a87c20dfe9109017588e38e4ff0f 100755 (executable)
@@ -34,7 +34,8 @@ class Poche
       'pl_PL.utf8' => 'Polski',
       'ru_RU.utf8' => 'Pусский',
       'sl_SI.utf8' => 'Slovenščina',
-      'uk_UA.utf8' => 'Український',
+      'uk_UA.utf8' => 'Українська',
+      'pt_BR.utf8' => 'Brasileiro',
     );
     public function __construct()
     {
@@ -336,7 +337,7 @@ class Poche
         while (($language = readdir($handle)) !== false) {
             # Languages are stored in a directory, so all directory names are languages
             # @todo move language installation data to database
-            if (! is_dir(LOCALE . '/' . $language) || in_array($language, array('..', '.'))) {
+            if (! is_dir(LOCALE . '/' . $language) || in_array($language, array('..', '.', 'tools'))) {
                 continue;
             }
             
@@ -346,7 +347,7 @@ class Poche
                 $current = true;
             }
             
-            $languages[] = array('name' => $this->language_names[$language], 'value' => $language, 'current' => $current);
+            $languages[] = array('name' => (isset($this->language_names[$language]) ? $this->language_names[$language] : $language), 'value' => $language, 'current' => $current);
         }
         
         return $languages;
@@ -366,7 +367,7 @@ class Poche
         // Saving and clearing context
         $REAL = array();
         foreach( $GLOBALS as $key => $value ) {
-            if( $key != "GLOBALS" && $key != "_SESSION" ) {
+            if( $key != 'GLOBALS' && $key != '_SESSION' && $key != 'HTTP_SESSION_VARS' ) {
                 $GLOBALS[$key] = array();
                 $REAL[$key] = $value;
             }
@@ -660,6 +661,7 @@ class Poche
                     'entries' => '',
                     'page_links' => '',
                     'nb_results' => '',
+                    'listmode' => (isset($_COOKIE['listmode']) ? true : false),
                 );
                 
                 //if id is given - we retrive entries by tag: id is tag id
@@ -750,6 +752,8 @@ class Poche
         $currentConfig['theme'] = $_POST['theme'];
         
         $_SESSION['poche_user']->setConfig($currentConfig);
+
+        $this->emptyCache();
         
         Tools::redirect('?view=config');
     }
@@ -788,6 +792,8 @@ class Poche
         $currentConfig['language'] = $_POST['language'];
         
         $_SESSION['poche_user']->setConfig($currentConfig);
+
+        $this->emptyCache();
         
         Tools::redirect('?view=config');
     }
@@ -1124,6 +1130,7 @@ class Poche
         $currentConfig = $_SESSION['poche_user']->config;
         $currentConfig['token'] = $token;
         $_SESSION['poche_user']->setConfig($currentConfig);
+        Tools::redirect();
     }
 
     public function generateFeeds($token, $user_id, $tag_id, $type = 'home')
@@ -1140,8 +1147,9 @@ class Poche
         $feed = new FeedWriter(RSS2);
         $feed->setTitle('wallabag — ' . $type . ' feed');
         $feed->setLink(Tools::getPocheUrl());
-        $feed->setChannelElement('updated', date(DATE_RSS , time()));
-        $feed->setChannelElement('author', 'wallabag');
+        $feed->setChannelElement('pubDate', date(DATE_RSS , time()));
+        $feed->setChannelElement('generator', 'wallabag');
+        $feed->setDescription('wallabag ' . $type . ' elements');
 
         if ($type == 'tag') {
             $entries = $this->store->retrieveEntriesByTag($tag_id, $user_id);