Changeset 1629

Show
Ignore:
Timestamp:
11/07/06 14:23:57 (2 years ago)
Author:
mbonetti
Message:

403 Error message, updated Vietnamese, tiny changes to Admin, API

Location:
trunk/gregarius
Files:
37 modified

Legend:

Unmodified
Added
Removed
  • trunk/gregarius/admin/channels.php

    r1602 r1629  
    281281 
    282282        if ($label != 'http://' &&  substr($label, 0,4) == "http") { 
    283             $tags = $_REQUEST['channel_tags']; 
     283            $tags = @$_REQUEST['channel_tags']; 
    284284            $ret = add_channel($label,$fid,null,null,$tags); 
    285285            //var_dump($ret); 
     
    900900 
    901901    // Description 
    902     $descr = strip_tags($descr); 
     902    $descr = trim(strip_tags($descr)); 
    903903    echo "<p><label for=\"c_descr\">". __('Description:') ."</label>\n" 
    904904    ."<input type=\"text\" id=\"c_descr\" name=\"c_descr\" value=\"$descr\" /></p>\n"; 
  • trunk/gregarius/api.php

    r1613 r1629  
    5252        rss_require('extlib/JSON.php'); 
    5353        $json = new Services_JSON(); 
    54         $query = sanitize(@$_REQUEST['q'], RSS_SANITIZER_WORDS); 
     54        $query = preg_replace('#[^a-z0-9\s]#','',@$_REQUEST['q']); 
    5555        if ($query) { 
    5656            $res = osSearch($query); 
    5757        } else { 
    58             $res = array($query,array()); 
     58            $res = array($query,array(),array(),array()); 
    5959        } 
    60         header('Content-Type: application/json'); 
     60        header('Content-Type: text/plain'); 
    6161        die ($json->encode($res)); 
    6262        break; 
     
    218218        } 
    219219    } 
    220     return array($q,$results); 
     220    return array($q,$results,array(),array()); 
    221221} 
    222222?> 
  • trunk/gregarius/cls/update.php

    r1561 r1629  
    6565 
    6666    function Update($doPopulate = true, $updatePrivateAlso = false) { 
    67     rss_plugin_hook('rss.plugins.updates.before', null); 
     67        rss_plugin_hook('rss.plugins.updates.before', null); 
    6868        if($doPopulate) { 
    6969            $this->populate($updatePrivateAlso); 
     
    7777    function populate($updatePrivateAlso = false) { 
    7878        $sql = "select c.id, c.url, c.title from ".getTable("channels") . " c " 
    79              . " inner join " . getTable('folders') . " f on f.id = c.parent " 
    80              . " where not(c.mode & ".RSS_MODE_DELETED_STATE.") "; 
     79               . " inner join " . getTable('folders') . " f on f.id = c.parent " 
     80               . " where not(c.mode & ".RSS_MODE_DELETED_STATE.") "; 
    8181 
    8282        if (hidePrivate() && !$updatePrivateAlso) { 
     
    104104            } 
    105105        } 
    106          
     106 
    107107        setProperty('__meta__','meta.lastupdate','misc',time()); 
    108          
     108 
    109109        if (count($newIds) > 0) { 
    110110            rss_invalidate_cache(); 
    111111        } 
    112     rss_plugin_hook('rss.plugins.updates.after', null); 
     112        rss_plugin_hook('rss.plugins.updates.after', null); 
    113113    } 
    114114 
    115115    function magpieError($error) { 
    116         if ($error & MAGPIE_FEED_ORIGIN_CACHE) { 
     116        if (is_numeric($error) && ($error & MAGPIE_FEED_ORIGIN_CACHE)) { 
    117117            if ($error & MAGPIE_FEED_ORIGIN_HTTP_304) { 
    118118                $label = __('OK (304 Not modified)'); 
     
    121121            elseif ($error & MAGPIE_FEED_ORIGIN_HTTP_TIMEOUT) { 
    122122                $label = __('HTTP Timeout (Local cache)'); 
    123                 $cls = ERROR_WARNING; 
     123                $cls = ERROR_ERROR; 
    124124            } 
    125125            elseif ($error & MAGPIE_FEED_ORIGIN_NOT_FETCHED) { 
     
    131131                $cls = ERROR_ERROR; 
    132132            } 
     133            elseif ($error & MAGPIE_FEED_ORIGIN_HTTP_403) { 
     134                $label = __('403 Forbidden (Local cache)'); 
     135                $cls = ERROR_ERROR; 
     136            } 
    133137            else { 
    134138                $label = $error; 
     
    142146        else { 
    143147            if (is_numeric($error)) { 
    144                 $label = __('ERROR'); 
     148                $label = __('ERROR') ." $error"; 
    145149                $cls = ERROR_ERROR; 
    146150            } else { 
     
    169173        rss_set_hook('rss.plugins.bodystart', "pushHeaderCallBack"); 
    170174        rss_set_hook('rss.plugins.bodyend', "pushFooterCallBack"); 
    171          
     175 
    172176        ob_implicit_flush(); 
    173177    } 
     
    260264        echo "</table>\n"; 
    261265        echo "<script type=\"text/javascript\">\n"; 
    262         echo "function runAjaxUpdate() { \n"; 
     266        echo "function runAjaxUpdate() { \n"; 
    263267        echo "    for (k =0; k < " . AJAX_PARALLEL_SIZE . "; k++){\n"; 
    264         echo "    doUpdate();\n"; 
    265         echo "    }\n"; 
    266         echo "}\n"; 
    267         // Fix for IE's stupid "Operation Aborted" Error 
    268         echo "   if (window.addEventListener) window.addEventListener(\"load\",runAjaxUpdate,false); else if (window.attachEvent) window.attachEvent(\"onload\",runAjaxUpdate);\n"; 
    269         echo "</script>\n"; 
     268        echo "    doUpdate();\n"; 
     269        echo "    }\n"; 
     270        echo "}\n"; 
     271        // Fix for IE's stupid "Operation Aborted" Error 
     272        echo "   if (window.addEventListener) window.addEventListener(\"load\",runAjaxUpdate,false); else if (window.attachEvent) window.attachEvent(\"onload\",runAjaxUpdate);\n"; 
     273        echo "</script>\n"; 
    270274    } 
    271275} 
     
    305309 
    306310class MobileUpdate extends Update { 
    307     function MobileUpdate() { 
    308         parent::Update($doPopulate = true); 
    309     } 
    310     function render() { 
    311         $newIds = array(); 
    312     foreach ($this->chans as $chan) { 
    313             list ($cid, $url, $title) = $chan; 
    314             echo "$title ...\t"; 
    315             flush(); 
    316             $ret = update($cid); 
    317  
    318             if (is_array($ret)) { 
    319                     list ($error, $unreadIds) = $ret; 
    320                     $newIds = array_merge($newIds, $unreadIds); 
    321             } else { 
    322                     $error = 0; 
    323                     $unreadIds = array (); 
    324             } 
    325             $unread = count($unreadIds); 
    326             list($label,$cls) = parent::magpieError($error); 
    327             echo "\n$label, $unread " . __('New Items') . "<br />"; 
    328             flush(); 
    329     } 
    330     } 
    331 } 
    332  
    333      
     311    function MobileUpdate() { 
     312        parent::Update($doPopulate = true); 
     313    } 
     314    function render() { 
     315        $newIds = array(); 
     316        foreach ($this->chans as $chan) { 
     317            list ($cid, $url, $title) = $chan; 
     318            echo "$title ...\t"; 
     319            flush(); 
     320            $ret = update($cid); 
     321 
     322            if (is_array($ret)) { 
     323                list ($error, $unreadIds) = $ret; 
     324                $newIds = array_merge($newIds, $unreadIds); 
     325            } else { 
     326                $error = 0; 
     327                $unreadIds = array (); 
     328            } 
     329            $unread = count($unreadIds); 
     330            list($label,$cls) = parent::magpieError($error); 
     331            echo "\n$label, $unread " . __('New Items') . "<br />"; 
     332            flush(); 
     333        } 
     334    } 
     335} 
     336 
     337 
    334338/** 
    335339 * CommandLineUpdateNews updates the feeds and displays only feeds with 
     
    337341 */ 
    338342class CommandLineUpdateNews extends CommandLineUpdate { 
    339         function render() { 
    340                 $newIds = array(); 
    341                 foreach ($this->chans as $chan) { 
    342                         list ($cid, $url, $title) = $chan; 
    343                         $ret = update($cid); 
    344  
    345                         if (is_array($ret)) { 
    346                                 list ($error, $unreadIds) = $ret; 
    347                                 $newIds = array_merge($newIds, $unreadIds); 
    348                         } else { 
    349                                 $error = 0; 
    350                                 $unreadIds = array(); 
    351                         } 
    352                         $unread = count($unreadIds); 
    353  
    354                         list($label, $cls) = parent::magpieError($error); 
    355  
    356                         if (($cls != ERROR_NOERROR) || ($unread > 0)) { 
    357                                 echo "$title ...\t"; 
    358                                 flush(); 
    359                                 echo "\n$label, $unread " . __('New Items') . "\n\n"; 
    360                                 flush(); 
    361                         } 
    362                 } 
    363  
    364                 if (!hidePrivate()) { 
    365                         parent::cleanUp($newIds); 
    366                 } 
    367         } 
     343    function render() { 
     344        $newIds = array(); 
     345        foreach ($this->chans as $chan) { 
     346            list ($cid, $url, $title) = $chan; 
     347            $ret = update($cid); 
     348 
     349            if (is_array($ret)) { 
     350                list ($error, $unreadIds) = $ret; 
     351                $newIds = array_merge($newIds, $unreadIds); 
     352            } else { 
     353                $error = 0; 
     354                $unreadIds = array(); 
     355            } 
     356            $unread = count($unreadIds); 
     357 
     358            list($label, $cls) = parent::magpieError($error); 
     359 
     360            if (($cls != ERROR_NOERROR) || ($unread > 0)) { 
     361                echo "$title ...\t"; 
     362                flush(); 
     363                echo "\n$label, $unread " . __('New Items') . "\n\n"; 
     364                flush(); 
     365            } 
     366        } 
     367 
     368        if (!hidePrivate()) { 
     369            parent::cleanUp($newIds); 
     370        } 
     371    } 
    368372} 
    369373 
     
    417421    echo "\n".PUSH_BOUNDARY."\n"; 
    418422    echo "WARNING: YOUR BROWSER DOESN'T SUPPORT THIS SERVER-PUSH TECHNOLOGY.\n"; 
    419      
     423 
    420424    flush(); 
    421425} 
  • trunk/gregarius/extlib/rss_fetch.inc

    r1164 r1629  
    5050// Not fetched because age < MAGPIE_CACHE_AGE 
    5151define ('MAGPIE_FEED_ORIGIN_NOT_FETCHED', 64); 
     52// 403 Forbidden 
     53define ('MAGPIE_FEED_ORIGIN_HTTP_403', 128); 
    5254 
    5355/* 
     
    239241                        $rss -> rss_origin |= MAGPIE_FEED_ORIGIN_HTTP_404; 
    240242                    break; 
     243                case '403': 
     244                        $rss -> rss_origin |= MAGPIE_FEED_ORIGIN_HTTP_403; 
     245                        break; 
    241246                default: 
    242247                    $rss -> rss_origin |= MAGPIE_FEED_ORIGIN_HTTP_TIMEOUT; 
  • trunk/gregarius/intl/da/LC_MESSAGES/messages.po

    r1614 r1629  
    55"Project-Id-Version: Gregarius 0.5.5\n" 
    66"Report-Msgid-Bugs-To: \n" 
    7 "POT-Creation-Date: 2006-10-30 16:21+0100\n" 
     7"POT-Creation-Date: 2006-11-07 14:25+0100\n" 
    88"PO-Revision-Date: \n" 
    99"Last-Translator: \n" 
     
    4040 
    4141#: author.php:41 cls/wrappers/item.php:222 author.php:42 
     42#: cls/wrappers/item.php:221 
    4243msgid " by " 
    4344msgstr " af " 
     
    5657#: cls/channels.php:158 cls/header.php:97 cls/wrappers/feeds.php:76 
    5758#: themes/default/mobile/nav.php:3 themes/milsi/feeds.php:1 
     59#: themes/default/mobile/nav.php:2 
    5860msgid "Feeds" 
    5961msgstr "Feeds" 
     
    113115msgstr "404 Ikke fundet (Lokal cache)" 
    114116 
    115 #: cls/update.php:137 cls/update.php:139 
     117#: cls/update.php:137 cls/update.php:139 cls/update.php:143 
    116118msgid "OK (HTTP 200)" 
    117119msgstr "OK (HTTP 200)" 
    118120 
    119 #: cls/update.php:142 cls/update.php:144 
     121#: cls/update.php:142 cls/update.php:144 cls/update.php:148 
    120122msgid "ERROR" 
    121123msgstr "FEJL" 
    122124 
    123125#: cls/update.php:175 cls/update.php:237 cls/update.php:179 cls/update.php:241 
     126#: cls/update.php:183 cls/update.php:245 
    124127#, php-format 
    125128msgid "Updating %d Feeds..." 
     
    127130 
    128131#: cls/update.php:178 cls/update.php:241 cls/update.php:182 cls/update.php:245 
     132#: cls/update.php:186 cls/update.php:249 
    129133msgid "Feed" 
    130134msgstr "Feed" 
    131135 
    132136#: cls/update.php:179 cls/update.php:242 cls/update.php:183 cls/update.php:246 
     137#: cls/update.php:187 cls/update.php:250 
    133138msgid "Status" 
    134139msgstr "Status" 
     
    136141#: cls/update.php:180 cls/update.php:243 cls/update.php:294 cls/update.php:323 
    137142#: cls/update.php:355 cls/update.php:184 cls/update.php:247 cls/update.php:298 
    138 #: cls/update.php:327 cls/update.php:359 
     143#: cls/update.php:327 cls/update.php:359 cls/update.php:188 cls/update.php:251 
     144#: cls/update.php:302 cls/update.php:331 cls/update.php:363 
    139145msgid "New Items" 
    140146msgstr "Nye items" 
     
    144150msgstr "Permanent link for " 
    145151 
    146 #: cls/wrappers/item.php:201 
     152#: cls/wrappers/item.php:201 cls/wrappers/item.php:200 
    147153msgid "Posted: " 
    148154msgstr "Skrevet: " 
    149155 
    150 #: cls/wrappers/item.php:201 
     156#: cls/wrappers/item.php:201 cls/wrappers/item.php:200 
    151157msgid "Fetched: " 
    152158msgstr "Hented: " 
     
    585591#: themes/default/mobile/item.php:15 themes/default/web/item.php:28 
    586592#: themes/lilina/web/item.php:52 themes/lilina/web/item.php:108 
     593#: themes/default/mobile/item.php:22 
    587594msgid "Tags" 
    588595msgstr "Tags" 
     
    652659 
    653660#: intl/en.php:225 intl/en.php:226 plugins/stickyflag/stickyflag.php:92 
    654 #: state.php:39 
     661#: state.php:39 themes/default/mobile/item.php:40 
    655662msgid "Sticky" 
    656663msgstr "Sticky" 
     
    722729#: cls/wrappers/feeds.php:73 themes/default/mobile/nav.php:4 
    723730#: admin/channels.php:100 admin/channels.php:864 
     731#: themes/default/mobile/nav.php:3 
    724732msgid "Categories" 
    725733msgstr "Kategorier" 
     
    745753#: intl/en.php:255 intl/en.php:256 themes/default/mobile/item.php:12 
    746754#: themes/default/web/item.php:24 themes/lilina/web/item.php:48 
    747 #: themes/lilina/web/item.php:104 
     755#: themes/lilina/web/item.php:104 themes/default/mobile/item.php:19 
    748756msgid "Enclosure:" 
    749757msgstr "Bilag:" 
     
    751759#: intl/en.php:256 intl/en.php:257 themes/default/mobile/item.php:12 
    752760#: themes/default/web/item.php:24 themes/lilina/web/item.php:48 
    753 #: themes/lilina/web/item.php:104 
     761#: themes/lilina/web/item.php:104 themes/default/mobile/item.php:19 
    754762msgid "download" 
    755763msgstr "download" 
     
    11001108msgstr "Slet ogs&aring; Sticky items: " 
    11011109 
     1110#: themes/default/mobile/item.php:34 
     1111msgid "Read" 
     1112msgstr "" 
     1113 
     1114#: themes/default/mobile/item.php:35 
     1115msgid "Unread" 
     1116msgstr "" 
     1117 
     1118#: themes/default/mobile/nav.php:4 
     1119msgid "Refresh" 
     1120msgstr "" 
     1121 
     1122#: themes/default/web/item.php:8 themes/default/web/item.php:9 
     1123msgid "Edit Item Properties" 
     1124msgstr "" 
     1125 
     1126#: cls/update.php:134 
     1127msgid "403 Forbidden (Local cache)" 
     1128msgstr "" 
     1129 
    11021130#, fuzzy 
    11031131#~ msgid "tag" 
  • trunk/gregarius/intl/de/LC_MESSAGES/messages.po

    r1614 r1629  
    55"Project-Id-Version: Gregarius 0.5.5\n" 
    66"Report-Msgid-Bugs-To: \n" 
    7 "POT-Creation-Date: 2006-10-30 16:21+0100\n" 
     7"POT-Creation-Date: 2006-11-07 14:25+0100\n" 
    88"PO-Revision-Date: 2006-10-23 05:28+0000\n" 
    99"Last-Translator: mbi <mbonetti@gmail.com>\n" 
     
    4040 
    4141#: author.php:41 cls/wrappers/item.php:222 author.php:42 
     42#: cls/wrappers/item.php:221 
    4243msgid " by " 
    4344msgstr " by " 
     
    5657#: cls/channels.php:158 cls/header.php:97 cls/wrappers/feeds.php:76 
    5758#: themes/default/mobile/nav.php:3 themes/milsi/feeds.php:1 
     59#: themes/default/mobile/nav.php:2 
    5860msgid "Feeds" 
    5961msgstr "Feeds" 
     
    113115msgstr "404 Not Found (Local cache)" 
    114116 
    115 #: cls/update.php:137 cls/update.php:139 
     117#: cls/update.php:137 cls/update.php:139 cls/update.php:143 
    116118msgid "OK (HTTP 200)" 
    117119msgstr "OK (HTTP 200)" 
    118120 
    119 #: cls/update.php:142 cls/update.php:144 
     121#: cls/update.php:142 cls/update.php:144 cls/update.php:148 
    120122msgid "ERROR" 
    121123msgstr "ERROR" 
    122124 
    123125#: cls/update.php:175 cls/update.php:237 cls/update.php:179 cls/update.php:241 
     126#: cls/update.php:183 cls/update.php:245 
    124127#, php-format 
    125128msgid "Updating %d Feeds..." 
     
    127130 
    128131#: cls/update.php:178 cls/update.php:241 cls/update.php:182 cls/update.php:245 
     132#: cls/update.php:186 cls/update.php:249 
    129133msgid "Feed" 
    130134msgstr "Feed" 
    131135 
    132136#: cls/update.php:179 cls/update.php:242 cls/update.php:183 cls/update.php:246 
     137#: cls/update.php:187 cls/update.php:250 
    133138msgid "Status" 
    134139msgstr "Status" 
     
    136141#: cls/update.php:180 cls/update.php:243 cls/update.php:294 cls/update.php:323 
    137142#: cls/update.php:355 cls/update.php:184 cls/update.php:247 cls/update.php:298 
    138 #: cls/update.php:327 cls/update.php:359 
     143#: cls/update.php:327 cls/update.php:359 cls/update.php:188 cls/update.php:251 
     144#: cls/update.php:302 cls/update.php:331 cls/update.php:363 
    139145msgid "New Items" 
    140146msgstr "Neue Begriffe" 
     
    144150msgstr "Permalink f&uuml;r " 
    145151 
    146 #: cls/wrappers/item.php:201 
     152#: cls/wrappers/item.php:201 cls/wrappers/item.php:200 
    147153msgid "Posted: " 
    148154msgstr "Ver&ouml;ffentlicht: " 
    149155 
    150 #: cls/wrappers/item.php:201 
     156#: cls/wrappers/item.php:201 cls/wrappers/item.php:200 
    151157msgid "Fetched: " 
    152158msgstr "geholt: " 
     
    589595#: themes/default/mobile/item.php:15 themes/default/web/item.php:28 
    590596#: themes/lilina/web/item.php:52 themes/lilina/web/item.php:108 
     597#: themes/default/mobile/item.php:22 
    591598msgid "Tags" 
    592599msgstr "Markierungen" 
     
    656663 
    657664#: intl/en.php:225 intl/en.php:226 plugins/stickyflag/stickyflag.php:92 
    658 #: state.php:39 
     665#: state.php:39 themes/default/mobile/item.php:40 
    659666msgid "Sticky" 
    660667msgstr "Sticky" 
     
    726733#: cls/wrappers/feeds.php:73 themes/default/mobile/nav.php:4 
    727734#: admin/channels.php:100 admin/channels.php:864 
     735#: themes/default/mobile/nav.php:3 
    728736msgid "Categories" 
    729737msgstr "Kategorien" 
     
    749757#: intl/en.php:255 intl/en.php:256 themes/default/mobile/item.php:12 
    750758#: themes/default/web/item.php:24 themes/lilina/web/item.php:48 
    751 #: themes/lilina/web/item.php:104 
     759#: themes/lilina/web/item.php:104 themes/default/mobile/item.php:19 
    752760msgid "Enclosure:" 
    753761msgstr "Enclosure (Einschl&uuml;sse):" 
     
    755763#: intl/en.php:256 intl/en.php:257 themes/default/mobile/item.php:12 
    756764#: themes/default/web/item.php:24 themes/lilina/web/item.php:48 
    757 #: themes/lilina/web/item.php:104 
     765#: themes/lilina/web/item.php:104 themes/default/mobile/item.php:19 
    758766msgid "download" 
    759767msgstr "download" 
     
    11011109msgstr "" 
    11021110 
     1111#: themes/default/mobile/item.php:34 
     1112msgid "Read" 
     1113msgstr "" 
     1114 
     1115#: themes/default/mobile/item.php:35 
     1116msgid "Unread" 
     1117msgstr "" 
     1118 
     1119#: themes/default/mobile/nav.php:4 
     1120msgid "Refresh" 
     1121msgstr "" 
     1122 
     1123#: themes/default/web/item.php:8 themes/default/web/item.php:9 
     1124msgid "Edit Item Properties" 
     1125msgstr "" 
     1126 
     1127#: cls/update.php:134 
     1128msgid "403 Forbidden (Local cache)" 
     1129msgstr "" 
     1130 
    11031131#, fuzzy 
    11041132#~ msgid "tag"