Changeset 1629 for trunk/gregarius/cls
- Timestamp:
- 11/07/06 14:23:57 (2 years ago)
- Files:
-
- 1 modified
-
trunk/gregarius/cls/update.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gregarius/cls/update.php
r1561 r1629 65 65 66 66 function Update($doPopulate = true, $updatePrivateAlso = false) { 67 rss_plugin_hook('rss.plugins.updates.before', null);67 rss_plugin_hook('rss.plugins.updates.before', null); 68 68 if($doPopulate) { 69 69 $this->populate($updatePrivateAlso); … … 77 77 function populate($updatePrivateAlso = false) { 78 78 $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.") "; 81 81 82 82 if (hidePrivate() && !$updatePrivateAlso) { … … 104 104 } 105 105 } 106 106 107 107 setProperty('__meta__','meta.lastupdate','misc',time()); 108 108 109 109 if (count($newIds) > 0) { 110 110 rss_invalidate_cache(); 111 111 } 112 rss_plugin_hook('rss.plugins.updates.after', null);112 rss_plugin_hook('rss.plugins.updates.after', null); 113 113 } 114 114 115 115 function magpieError($error) { 116 if ( $error & MAGPIE_FEED_ORIGIN_CACHE) {116 if (is_numeric($error) && ($error & MAGPIE_FEED_ORIGIN_CACHE)) { 117 117 if ($error & MAGPIE_FEED_ORIGIN_HTTP_304) { 118 118 $label = __('OK (304 Not modified)'); … … 121 121 elseif ($error & MAGPIE_FEED_ORIGIN_HTTP_TIMEOUT) { 122 122 $label = __('HTTP Timeout (Local cache)'); 123 $cls = ERROR_ WARNING;123 $cls = ERROR_ERROR; 124 124 } 125 125 elseif ($error & MAGPIE_FEED_ORIGIN_NOT_FETCHED) { … … 131 131 $cls = ERROR_ERROR; 132 132 } 133 elseif ($error & MAGPIE_FEED_ORIGIN_HTTP_403) { 134 $label = __('403 Forbidden (Local cache)'); 135 $cls = ERROR_ERROR; 136 } 133 137 else { 134 138 $label = $error; … … 142 146 else { 143 147 if (is_numeric($error)) { 144 $label = __('ERROR') ;148 $label = __('ERROR') ." $error"; 145 149 $cls = ERROR_ERROR; 146 150 } else { … … 169 173 rss_set_hook('rss.plugins.bodystart', "pushHeaderCallBack"); 170 174 rss_set_hook('rss.plugins.bodyend', "pushFooterCallBack"); 171 175 172 176 ob_implicit_flush(); 173 177 } … … 260 264 echo "</table>\n"; 261 265 echo "<script type=\"text/javascript\">\n"; 262 echo "function runAjaxUpdate() { \n";266 echo "function runAjaxUpdate() { \n"; 263 267 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" Error268 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"; 270 274 } 271 275 } … … 305 309 306 310 class 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 334 338 /** 335 339 * CommandLineUpdateNews updates the feeds and displays only feeds with … … 337 341 */ 338 342 class 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 } 368 372 } 369 373 … … 417 421 echo "\n".PUSH_BOUNDARY."\n"; 418 422 echo "WARNING: YOUR BROWSER DOESN'T SUPPORT THIS SERVER-PUSH TECHNOLOGY.\n"; 419 423 420 424 flush(); 421 425 }
