Skip to content

Commit

Permalink
403 Error message, updated Vietnamese, tiny changes to Admin, API
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.gregarius.net/svn/trunk/gregarius@1629 d826556c-87f9-0310-90b4-9554b5b11594
  • Loading branch information
mbonetti committed Nov 7, 2006
1 parent c3aa8a6 commit 76c8e23
Show file tree
Hide file tree
Showing 37 changed files with 733 additions and 249 deletions.
4 changes: 2 additions & 2 deletions admin/channels.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function channel_admin() {
}

if ($label != 'http://' && substr($label, 0,4) == "http") {
$tags = $_REQUEST['channel_tags'];
$tags = @$_REQUEST['channel_tags'];
$ret = add_channel($label,$fid,null,null,$tags);
//var_dump($ret);
if (is_array($ret) && $ret[0] > -1) {
Expand Down Expand Up @@ -899,7 +899,7 @@ function channel_edit_form($cid) {


// Description
$descr = strip_tags($descr);
$descr = trim(strip_tags($descr));
echo "<p><label for=\"c_descr\">". __('Description:') ."</label>\n"
."<input type=\"text\" id=\"c_descr\" name=\"c_descr\" value=\"$descr\" /></p>\n";

Expand Down
8 changes: 4 additions & 4 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
case 'search':
rss_require('extlib/JSON.php');
$json = new Services_JSON();
$query = sanitize(@$_REQUEST['q'], RSS_SANITIZER_WORDS);
$query = preg_replace('#[^a-z0-9\s]#','',@$_REQUEST['q']);
if ($query) {
$res = osSearch($query);
} else {
$res = array($query,array());
$res = array($query,array(),array(),array());
}
header('Content-Type: application/json');
header('Content-Type: text/plain');
die ($json->encode($res));
break;
}
Expand Down Expand Up @@ -217,6 +217,6 @@ function osSearch($q) {
$results[] = $item -> title;
}
}
return array($q,$results);
return array($q,$results,array(),array());
}
?>
138 changes: 71 additions & 67 deletions cls/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Update {
var $chans = array ();

function Update($doPopulate = true, $updatePrivateAlso = false) {
rss_plugin_hook('rss.plugins.updates.before', null);
rss_plugin_hook('rss.plugins.updates.before', null);
if($doPopulate) {
$this->populate($updatePrivateAlso);
}
Expand All @@ -76,8 +76,8 @@ function Update($doPopulate = true, $updatePrivateAlso = false) {

function populate($updatePrivateAlso = false) {
$sql = "select c.id, c.url, c.title from ".getTable("channels") . " c "
. " inner join " . getTable('folders') . " f on f.id = c.parent "
. " where not(c.mode & ".RSS_MODE_DELETED_STATE.") ";
. " inner join " . getTable('folders') . " f on f.id = c.parent "
. " where not(c.mode & ".RSS_MODE_DELETED_STATE.") ";

if (hidePrivate() && !$updatePrivateAlso) {
$sql .= " and not(mode & ".RSS_MODE_PRIVATE_STATE.") ";
Expand All @@ -103,24 +103,24 @@ function cleanUp($newIds, $ignorePrivate = false) {
." and id not in (".implode(",", $newIds).")");
}
}

setProperty('__meta__','meta.lastupdate','misc',time());

if (count($newIds) > 0) {
rss_invalidate_cache();
}
rss_plugin_hook('rss.plugins.updates.after', null);
rss_plugin_hook('rss.plugins.updates.after', null);
}

function magpieError($error) {
if ($error & MAGPIE_FEED_ORIGIN_CACHE) {
if (is_numeric($error) && ($error & MAGPIE_FEED_ORIGIN_CACHE)) {
if ($error & MAGPIE_FEED_ORIGIN_HTTP_304) {
$label = __('OK (304 Not modified)');
$cls = ERROR_NOERROR;
}
elseif ($error & MAGPIE_FEED_ORIGIN_HTTP_TIMEOUT) {
$label = __('HTTP Timeout (Local cache)');
$cls = ERROR_WARNING;
$cls = ERROR_ERROR;
}
elseif ($error & MAGPIE_FEED_ORIGIN_NOT_FETCHED) {
$label = __('OK (Local cache)');
Expand All @@ -130,6 +130,10 @@ function magpieError($error) {
$label = __('404 Not Found (Local cache)');
$cls = ERROR_ERROR;
}
elseif ($error & MAGPIE_FEED_ORIGIN_HTTP_403) {
$label = __('403 Forbidden (Local cache)');
$cls = ERROR_ERROR;
}
else {
$label = $error;
$cls = ERROR_ERROR;
Expand All @@ -141,7 +145,7 @@ function magpieError($error) {
}
else {
if (is_numeric($error)) {
$label = __('ERROR');
$label = __('ERROR') ." $error";
$cls = ERROR_ERROR;
} else {
// shoud contain MagpieError at this point
Expand All @@ -168,7 +172,7 @@ function HTTPServerPushUpdate() {
$GLOBALS['rss']->header->options |= HDR_NO_OUPUTBUFFERING;
rss_set_hook('rss.plugins.bodystart', "pushHeaderCallBack");
rss_set_hook('rss.plugins.bodyend', "pushFooterCallBack");

ob_implicit_flush();
}

Expand Down Expand Up @@ -259,14 +263,14 @@ function render() {

echo "</table>\n";
echo "<script type=\"text/javascript\">\n";
echo "function runAjaxUpdate() { \n";
echo "function runAjaxUpdate() { \n";
echo " for (k =0; k < " . AJAX_PARALLEL_SIZE . "; k++){\n";
echo " doUpdate();\n";
echo " }\n";
echo "}\n";
// Fix for IE's stupid "Operation Aborted" Error
echo " if (window.addEventListener) window.addEventListener(\"load\",runAjaxUpdate,false); else if (window.attachEvent) window.attachEvent(\"onload\",runAjaxUpdate);\n";
echo "</script>\n";
echo " doUpdate();\n";
echo " }\n";
echo "}\n";
// Fix for IE's stupid "Operation Aborted" Error
echo " if (window.addEventListener) window.addEventListener(\"load\",runAjaxUpdate,false); else if (window.attachEvent) window.attachEvent(\"onload\",runAjaxUpdate);\n";
echo "</script>\n";
}
}

Expand Down Expand Up @@ -304,67 +308,67 @@ function render() {
}

class MobileUpdate extends Update {
function MobileUpdate() {
parent::Update($doPopulate = true);
}
function render() {
$newIds = array();
foreach ($this->chans as $chan) {
list ($cid, $url, $title) = $chan;
echo "$title ...\t";
flush();
$ret = update($cid);

if (is_array($ret)) {
list ($error, $unreadIds) = $ret;
$newIds = array_merge($newIds, $unreadIds);
} else {
$error = 0;
$unreadIds = array ();
}
$unread = count($unreadIds);
list($label,$cls) = parent::magpieError($error);
echo "\n$label, $unread " . __('New Items') . "<br />";
flush();
function MobileUpdate() {
parent::Update($doPopulate = true);
}
function render() {
$newIds = array();
foreach ($this->chans as $chan) {
list ($cid, $url, $title) = $chan;
echo "$title ...\t";
flush();
$ret = update($cid);

if (is_array($ret)) {
list ($error, $unreadIds) = $ret;
$newIds = array_merge($newIds, $unreadIds);
} else {
$error = 0;
$unreadIds = array ();
}
$unread = count($unreadIds);
list($label,$cls) = parent::magpieError($error);
echo "\n$label, $unread " . __('New Items') . "<br />";
flush();
}
}
}
}


/**
* CommandLineUpdateNews updates the feeds and displays only feeds with
* errors or new items.
*/
class CommandLineUpdateNews extends CommandLineUpdate {
function render() {
$newIds = array();
foreach ($this->chans as $chan) {
list ($cid, $url, $title) = $chan;
$ret = update($cid);

if (is_array($ret)) {
list ($error, $unreadIds) = $ret;
$newIds = array_merge($newIds, $unreadIds);
} else {
$error = 0;
$unreadIds = array();
}
$unread = count($unreadIds);
function render() {
$newIds = array();
foreach ($this->chans as $chan) {
list ($cid, $url, $title) = $chan;
$ret = update($cid);

if (is_array($ret)) {
list ($error, $unreadIds) = $ret;
$newIds = array_merge($newIds, $unreadIds);
} else {
$error = 0;
$unreadIds = array();
}
$unread = count($unreadIds);

list($label, $cls) = parent::magpieError($error);
list($label, $cls) = parent::magpieError($error);

if (($cls != ERROR_NOERROR) || ($unread > 0)) {
echo "$title ...\t";
flush();
echo "\n$label, $unread " . __('New Items') . "\n\n";
flush();
}
}
if (($cls != ERROR_NOERROR) || ($unread > 0)) {
echo "$title ...\t";
flush();
echo "\n$label, $unread " . __('New Items') . "\n\n";
flush();
}
}

if (!hidePrivate()) {
parent::cleanUp($newIds);
}
if (!hidePrivate()) {
parent::cleanUp($newIds);
}
}
}


Expand Down Expand Up @@ -416,7 +420,7 @@ function pushFooterCallBack() {

echo "\n".PUSH_BOUNDARY."\n";
echo "WARNING: YOUR BROWSER DOESN'T SUPPORT THIS SERVER-PUSH TECHNOLOGY.\n";

flush();
}

Expand Down
5 changes: 5 additions & 0 deletions extlib/rss_fetch.inc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ define ('MAGPIE_FEED_ORIGIN_HTTP_404', 16);
define ('MAGPIE_FEED_ORIGIN_HTTP_TIMEOUT', 32);
// Not fetched because age < MAGPIE_CACHE_AGE
define ('MAGPIE_FEED_ORIGIN_NOT_FETCHED', 64);
// 403 Forbidden
define ('MAGPIE_FEED_ORIGIN_HTTP_403', 128);

/*
* CONSTANTS - redefine these in your script to change the
Expand Down Expand Up @@ -238,6 +240,9 @@ function fetch_rss ($url) {
case '404':
$rss -> rss_origin |= MAGPIE_FEED_ORIGIN_HTTP_404;
break;
case '403':
$rss -> rss_origin |= MAGPIE_FEED_ORIGIN_HTTP_403;
break;
default:
$rss -> rss_origin |= MAGPIE_FEED_ORIGIN_HTTP_TIMEOUT;
break;
Expand Down
Binary file modified intl/da/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit 76c8e23

Please sign in to comment.