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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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}