Example #1
0
function rss_item_url()
{
    $url = $GLOBALS['rss']->currentItem->url;
    if (substr($url, 0, 4) == 'http') {
        return $url;
    }
    return guessTransportProto() . $_SERVER['HTTP_HOST'] . getPath() . rss_item_pl_url();
}
Example #2
0
/**
 * Changes:
 * 0.4 - Properly escape the RSS url's entities.
 * 0.5 - Adapted to the new theme model
 * 0.6 - Don't put a link in admin and other locations
 * 0.7 - Show ATOM link as well.
 */
function __rss_view_url($type = "rss")
{
    $url = guessTransportProto() . $_SERVER['HTTP_HOST'];
    $url .= $_SERVER["REQUEST_URI"];
    if (strstr($_SERVER['REQUEST_URI'], "?") !== FALSE) {
        $url .= "&media={$type}&";
    } else {
        $url .= "?media={$type}";
    }
    $url .= __rss_view_post2get();
    $url = str_replace('&', '&', $url);
    return str_replace('&', '&', $url);
}
Example #3
0
 function Header($title = "", $active = 0, $cidfid = null, $onLoadAction = "", $options = HDR_NONE, $links = NULL)
 {
     _pf('Header() ctor');
     $this->docTitle = $title;
     $this->active = $active;
     $this->cidfid = $cidfid;
     $this->onLoadAction = $onLoadAction;
     $this->options = $options;
     $this->rawTitle = $title;
     $this->extraHeaders = array();
     $this->docTitle = makeTitle($title);
     if (getConfig("rss.output.titleunreadcnt") && is_array($cidfid) && ($uc = getUnreadCount($cidfid['cid'], $cidfid['fid']))) {
         $this->docTitle .= " ({$uc} " . __('unread') . ")";
     }
     if ($active == 1 && MINUTE * getConfig('rss.config.refreshafter') >= 40 * MINUTE) {
         $this->redirectUrl = guessTransportProto() . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
         if (substr($this->redirectUrl, -1) != "/") {
             $this->redirectUrl .= "/";
         }
         $this->redirectUrl .= "update.php";
         $this->redirectTimeout = MINUTE * getConfig('rss.config.refreshafter');
     }
     $this->links = array();
     $this->links[] = array('start', 'Home', getPath());
     $this->links[] = array('search', 'Search', getPath() . "search.php");
     $this->links[] = array('tags', 'Tags', getPath() . (getConfig('rss.output.usemodrewrite') ? "tag/" : "tags.php?alltags"));
     if ($links != NULL) {
         //var_dump($links);
         foreach ($links as $rel => $link) {
             $this->links[] = array($rel, $link['title'], $link['href']);
         }
     }
     $this->javascriptFiles[] = getPath() . "ajax.php?js";
     $this->javascriptFiles[] = getPath() . "extlib/md5.js";
     if (getConfig('rss.output.channelcollapse')) {
         $this->javascriptFiles[] = getPath() . "extlib/fcollapse.js";
     }
     $GLOBALS['rss']->sideMenu = new SideMenu();
     $GLOBALS['rss']->sideMenu->addMenu(__('Feeds'), 'FeedList', "_side('FeedList')");
     $GLOBALS['rss']->sideMenu->addMenu(__('Categories'), 'CatList', "_side('CatList')");
     $GLOBALS['rss']->sideMenu->addMenu(__('Tags'), 'TagList', "_side('TagList')");
 }
Example #4
0
?>
<feed xmlns="http://www.w3.org/2005/Atom">
        <id>urn:<?php 
echo str_replace('.', '-', $_SERVER['HTTP_HOST']) . ":feeds:atom";
?>
</id>
	<title><?php 
echo rss_header_title();
?>
</title>
	<subtitle><?php 
echo rss_header_title();
?>
</subtitle>      
        <link rel="alternate" type="text/html" href="<?php 
echo guessTransportProto() . $_SERVER['HTTP_HOST'] . getPath();
?>
" />
        <link rel="self" type="text/xml" href="<?php 
echo guessTransportProto() . $_SERVER['HTTP_HOST'] . getPath();
?>
?media=atom"/>
        <updated><?php 
echo rss_date('c', getLastModif());
?>
</updated>
	<?php 
rss_main_object();
?>
</feed>
Example #5
0
         $relPlus = array_key_exists($rtag, $taggedItems->allTags);
         if ($relPlus) {
             $relLbl .= sprintf('&nbsp;[<a title="%d %s %s \'%s %s %s"\' href="%s+%s">+</a>]', $cnt, $cnt > 1 ? __('items') : __('item'), $cnt > 1 || $cnt == 0 ? __('tagged') : __('tagged'), htmlspecialchars($hrTag, ENT_QUOTES), __('and'), htmlspecialchars($rtag, ENT_QUOTES), getPath(getConfig('rss.output.usemodrewrite') ? "tag/{$rtag}" : "tags.php?tag={$rtag}"), htmlspecialchars($urlTag, ENT_QUOTES));
             "&nbsp;[<a " . "title=\"{$cnt} " . ($cnt > 1 ? __('items') : __('item')) . " " . ($cnt > 1 || $cnt == 0 ? __('tagged') : __('tagged')) . " '" . htmlspecialchars($hrTag, ENT_QUOTES) . " " . __('and') . " " . htmlspecialchars($rtag, ENT_QUOTES) . "'\" " . "href=\"" . getPath() . "" . (getConfig('rss.output.usemodrewrite') ? "tag/{$rtag}" : "tags.php?tag={$rtag}") . "" . "+" . $urlTag . "\">+</a>]";
         }
         $idx = $relPlus ? $taggedItems->allTags[$rtag] : 0;
         $related["{$idx}" . "_" . "{$rtag}"] = $relLbl . "";
     }
     krsort($related);
 }
 // done! Render some stuff
 if (array_key_exists('rss', $_REQUEST)) {
     rss_require('cls/rdf.php');
     // RSS view
     $title = _TITLE_ . " - " . __('Tags') . " - " . $hrTag;
     $baselink = guessTransportProto() . $_SERVER['HTTP_HOST'] . getPath() . (getConfig('rss.output.usemodrewrite') ? "tag/" : "tags.php?tag=");
     if ($gotsome) {
         $rdf = new RDFItemList($taggedItems);
     } else {
         $rdf = new RDFItemList(null);
     }
     $rdf->baselink = $baselink;
     $rdf->resource = $urlTag;
     $rdf->render($title);
     exit;
 } else {
     // HTML view
     //rss_header("Tags " . TITLE_SEP . " " . $hrTag);
     $GLOBALS['rss']->header = new Header("Tags " . TITLE_SEP . " " . $hrTag);
     $GLOBALS['rss']->feedList = new FeedList(false);
     //echo "\n\n<div id=\"items\" class=\"frame\">\n";
Example #6
0
function rss_plugins_get_plugins_http_path()
{
    //returns http://example.com/rss/plugins/
    return guessTransportProto() . $_SERVER['HTTP_HOST'] . getPath() . RSS_PLUGINS_DIR . "/";
}
Example #7
0
function channels()
{
    echo "<h2>" . __('Feeds:') . "</h2>\n";
    echo "<div id=\"admin_channels\">\n";
    echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n";
    echo "<p><input type=\"hidden\" name=\"" . CST_ADMIN_DOMAIN . "\" value=\"" . CST_ADMIN_DOMAIN_CHANNEL . "\" />\n";
    echo "<label for=\"new_channel\">" . __('Add a feed:') . "</label>\n";
    echo "<input type=\"text\" name=\"new_channel\" id=\"new_channel\" value=\"http://\" onmouseover=\"clearOnHover(this);\" onfocus=\"this.select()\" />\n";
    echo "<label for=\"add_channel_to_folder\">" . __('to folder:') . "</label>\n";
    echo rss_toolkit_folders_combo('add_channel_to_folder');
    echo "<label for=\"channel_tags\">" . __('Categories') . ":</label>\n";
    echo "<input type=\"text\" name=\"channel_tags\" id=\"channel_tags\" />\n";
    echo "<input type=\"hidden\" name=\"" . CST_ADMIN_METAACTION . "\" value=\"ACT_ADMIN_ADD\" />\n";
    echo "<input type=\"submit\" name=\"action\" value=\"" . __('Add') . "\" /></p>\n";
    echo "<p style=\"font-size:small\">" . __('(Enter either the URL of an RSS feed or of a Website whose feed you wish to subscribe to)') . "</p>";
    echo "</form>\n\n";
    // bookmarklet
    $b_url = guessTransportProto() . $_SERVER["HTTP_HOST"] . getPath() . "admin/index.php";
    $b_url .= "?domain=feeds&amp;add_channel_to_folder=0&amp;action=Add&amp;new_channel=";
    $bookmarklet = "javascript:void(document.location = " . "('{$b_url}'.concat(escape(document.location).replace(/\\s/,'%2520'))))";
    echo "<p style=\"font-size:small\">" . __('Subscription bookmarklet [<a href="http://www.squarefree.com/bookmarklets/">?</a>]:') . " <a class=\"bookmarklet\" href=\"{$bookmarklet}\">" . __('Subscribe in Gregarius!') . "</a></p>\n";
    // feed handler - similar to bookmarklet, but with %s
    $feedhandler_url = "javascript:navigator.registerContentHandler(\\'application/vnd.mozilla.maybe.feed\\',\\'{$b_url}%s\\',\\'Gregarius\\');";
    echo "<script type=\"text/javascript\">\n" . "//<!--\n" . "if (navigator && typeof(navigator.registerContentHandler) == 'function'){\n" . "\tdocument.write('<p style=\"font-size:small\">" . __('Register as Feed Handler [<a href="http://www.bengoodger.com/software/mb/feeds/feed-handling.html">?</a>]:') . " <a class=\"bookmarklet\" href=\"{$feedhandler_url}\">" . __('Register Gregarius!') . "</a></p>');\n" . "}\n" . "// -->\n" . "</script>\n";
    // feeds
    ?>
<script type="text/javascript">
// <!--
	function cbtoggle() {
    	var c=document.getElementById('mastercb').checked;
    	var cs=document.getElementById('channeltable').getElementsByTagName('input');
    	for(i=0;i<cs.length;i++) {
    		if (cs[i].type == 'checkbox') cs[i].checked = c;
    	}
    }
    function clearOnHover(o) {
    	if (o.value && o.value=='http://') o.value='';
    };
	function admin_menu_toggle(o,id){
		var i,lis=document.getElementById('channels_admin_sidemenu').getElementsByTagName('li');
		for(i=0;i<lis.length;i++) {
			lis[i].className='';
		}
		o.parentNode.className='active';		
		var ps = document.getElementById('channels_admin_menu').getElementsByTagName('p');
		for(i=0;i<ps.length;i++) {
			if (ps[i].id == 'channels_admin_'+id) {
				ps[i].style.display='block';
			} else {
				ps[i].style.display='none';
			}
		}
		return false;
	}
	/** quick hack to toggle through deprecated / private feeds' checkbox */
	document.checkedState='none';
	function cb_state_toggle() {
		switch (document.checkedState) {
			case 'none': document.checkedState = 'deprecated'; break;
			case 'deprecated': document.checkedState = 'private'; break;
			case 'private': document.checkedState = 'none'; break;
		}
		var id,trs = document.getElementById('channeltable').getElementsByTagName('tr');
		for(var i in trs) {
			if (id = trs[i].id) {
				document.getElementById('scb_'+id.replace(/[^0-9]/g,'')).checked = 
					(trs[i].className.search(document.checkedState) >= 0);
			}
		}
		return false;
	}

// -->
</script>
<?php 
    echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n";
    echo "<table id=\"channeltable\">\n" . "<tr>\n" . "\t<th><input type=\"checkbox\" id=\"mastercb\" onclick=\"cbtoggle();\" /></th>\n" . "\t<th>" . __('Title') . "</th>\n" . "\t<th class=\"cntr\">" . __('Folder') . "</th>\n" . "\t<th>" . __('Description') . "</th>\n" . "\t<th>" . __('Categories') . "</th>\n" . "\t<th><a href=\"#\" onclick=\"return cb_state_toggle();\">" . __('Flags') . "</a></th>\n";
    if (getConfig('rss.config.absoluteordering')) {
        echo "\t<th>" . __('Move') . "</th>\n";
    }
    echo "\t<th class=\"cntr\">" . __('Action') . "</th>\n" . "</tr>\n";
    $sql = "select " . " c.id, c.title, c.url, c.siteurl, d.name, c.descr, c.parent, c.icon, c.mode, c.daterefreshed " . " from " . getTable("channels") . " c " . " inner join " . getTable("folders") . " d " . "   on d.id = c.parent ";
    if (getConfig('rss.config.absoluteordering')) {
        $sql .= " order by d.position asc, c.position asc";
    } else {
        $sql .= " order by d.name asc, c.title asc";
    }
    $res = rss_query($sql);
    $cntr = 0;
    while (list($id, $title, $url, $siteurl, $parent, $descr, $pid, $icon, $mode, $daterefreshed) = rss_fetch_row($res)) {
        if (getConfig('rss.output.usemodrewrite')) {
            $outUrl = getPath() . preg_replace("/[^A-Za-z0-9\\.]/", "_", "{$title}") . "/";
        } else {
            $outUrl = getPath() . "feed.php?channel={$id}";
        }
        $parentLabel = $parent == '' ? __('Root') : $parent;
        $class_ = $cntr++ % 2 == 0 ? "even" : "odd";
        // get feed's tags
        $tags = "";
        $sql2 = "select t.id, t.tag from " . getTable('tag') . " t " . "inner join " . getTable('metatag') . " m " . "  on m.tid = t.id " . "where m.ttype = 'channel' and m.fid = {$id}";
        $res2 = rss_query($sql2);
        while (list($id_, $name_) = rss_fetch_row($res2)) {
            if (getConfig('rss.output.usemodrewrite')) {
                $tags .= "<a href=\"" . getPath() . "{$name_}/\">{$name_}</a> ";
            } else {
                $tags .= "<a href=\"" . getPath() . "feed.php?vfolder={$id_}\">{$name_}</a> ";
            }
        }
        if (NULL == $daterefreshed) {
            $dead = true;
        } else {
            $dead = time() - strtotime($daterefreshed) > getConfig('rss.config.deadthreshhold') * 60 * 60 ? true : false;
        }
        $fmode = array();
        if ($mode & RSS_MODE_PRIVATE_STATE) {
            $fmode[] = "P";
            $class_ .= ' private';
        }
        if ($mode & RSS_MODE_DELETED_STATE) {
            $fmode[] = "D";
            $dead = false;
            $class_ .= ' deprecated';
        }
        $slabel = count($fmode) ? implode(", ", $fmode) : "&nbsp;";
        if ($icon && substr($icon, 0, 5) == 'blob:') {
            $icon = getPath("extlib/favicon.php?url=" . rss_real_escape_string(substr($icon, 5)));
        }
        $style_ = "display:block;";
        if ($icon && getConfig('rss.output.showfavicons')) {
            $style_ .= "background: url({$icon}) no-repeat; padding-left: 22px;";
        }
        if ($dead) {
            $style_ .= 'text-decoration:line-through';
        }
        echo "<tr class=\"{$class_}\" id=\"fa{$id}\">\n" . "\t<td><input type=\"checkbox\" name=\"fcb{$id}\" value=\"{$id}\" id=\"scb_{$id}\" /></td>\n" . "\t<td>" . "<label for=\"scb_{$id}\" style=\"{$style_}\">" . $title . "</label>" . "</td>\n" . "\t<td class=\"cntr\">" . preg_replace('/ /', '&nbsp;', $parentLabel) . "</td>\n" . "\t<td>{$descr}</td>\n" . "\t<td>{$tags}</td>\n" . "\t<td class=\"cntr\">{$slabel}</td>\n";
        if (getConfig('rss.config.absoluteordering')) {
            echo "\t<td class=\"cntr\"><a href=\"" . $_SERVER['PHP_SELF'] . "?" . CST_ADMIN_DOMAIN . "=" . CST_ADMIN_DOMAIN_CHANNEL . "&amp;action=" . CST_ADMIN_MOVE_UP_ACTION . "&amp;cid={$id}\">" . __('&uarr;') . "</a>&nbsp;-&nbsp;<a href=\"" . $_SERVER['PHP_SELF'] . "?" . CST_ADMIN_DOMAIN . "=" . CST_ADMIN_DOMAIN_CHANNEL . "&amp;action=" . CST_ADMIN_MOVE_DOWN_ACTION . "&amp;cid={$id}\">" . __('&darr;') . "</a></td>\n";
        }
        echo "\t<td class=\"cntr\"><a href=\"" . $_SERVER['PHP_SELF'] . "?" . CST_ADMIN_DOMAIN . "=" . CST_ADMIN_DOMAIN_CHANNEL . "&amp;" . CST_ADMIN_VIEW . "=" . CST_ADMIN_DOMAIN_CHANNEL . "&amp;action=" . CST_ADMIN_EDIT_ACTION . "&amp;cid={$id}\">" . __('edit') . "</a>";
        if (!getConfig('rss.config.restrictrefresh')) {
            echo "|<a href=\"" . getPath() . "update.php?cid={$id}\">" . __('update') . "</a>\n";
        }
        echo "|<a href=\"" . $_SERVER['PHP_SELF'] . "?" . CST_ADMIN_DOMAIN . "=" . CST_ADMIN_DOMAIN_CHANNEL . "&amp;" . CST_ADMIN_VIEW . "=" . CST_ADMIN_DOMAIN_CHANNEL . "&amp;action=" . CST_ADMIN_DELETE_ACTION . "&amp;cid={$id}\">" . __('delete') . "</a></td>\n" . "</tr>\n";
    }
    echo "</table>\n";
    echo "" . "<ul class=\"sidemenu\" id=\"channels_admin_sidemenu\">\n" . "<li class=\"active\"><a href=\"#\" onclick=\"return admin_menu_toggle(this,'folders');\">" . __('Folders') . "</a></li>\n" . "<li><a href=\"#\" onclick=\"return admin_menu_toggle(this,'categories');\">" . __('Categories') . "</a></li>\n" . "<li><a href=\"#\" onclick=\"return admin_menu_toggle(this,'state');\">" . __('State') . "</a></li>\n" . "<li><a href=\"#\" onclick=\"return admin_menu_toggle(this,'delete');\">" . __('Delete') . "</a></li>\n" . "</ul>";
    echo "<div id=\"channels_admin_menu\" class=\"frame\">";
    echo "" . "<p id=\"channels_admin_folders\" style=\"display:block\">" . "<label for=\"me_folder\">" . __('In folder:') . "</label>\n" . rss_toolkit_folders_combo('me_folder', null) . "<input type=\"submit\" id=\"me_move_to_folder\" name=\"me_move_to_folder\" value=\"" . __('Move') . "\" />\n" . "</p>";
    echo "" . "<p id=\"channels_admin_categories\" style=\"display:none\">" . "<label for=\"me_categories\">" . __('Categories:') . "</label>\n" . "<input id=\"me_categories\" name=\"me_categories\" type=\"text\" />" . "<input type=\"submit\" id=\"me_set_categories\" name=\"me_set_categories\" value=\"" . __('Set') . "\" />\n" . "</p>";
    echo "" . "<p id=\"channels_admin_state\" style=\"display:none\">" . "<label>" . __('State:') . "</label>\n" . "<input type=\"checkbox\" name=\"me_deprecated\" id=\"me_deprecated\" value=\"" . RSS_MODE_DELETED_STATE . "\" />\n" . "<label for=\"me_deprecated\">" . __('Deprecated') . "</label>\n" . "<input type=\"checkbox\" name=\"me_private\" id=\"me_private\" value=\"" . RSS_MODE_PRIVATE_STATE . "\" />\n" . "<label for=\"me_private\">" . __('Private') . "</label>\n" . "<input type=\"submit\" id=\"me_state\" name=\"me_state\" value=\"" . __('Set') . "\" />\n" . "</p>";
    echo "" . "<p id=\"channels_admin_delete\" style=\"display:none\">" . "<input type=\"checkbox\" name=\"me_do_delete\" id=\"me_do_delete\" value=\"1\" />\n" . "<label for=\"me_do_delete\">" . __("I'm sure!") . "</label>\n" . "<input type=\"submit\" id=\"me_delete\" name=\"me_delete\" value=\"" . __('Delete') . "\" />\n" . "<input type=\"hidden\" name=\"" . CST_ADMIN_DOMAIN . "\" value=\"" . CST_ADMIN_DOMAIN_CHANNEL . "\" />\n" . "<input type=\"hidden\" name=\"action\" value=\"" . CST_ADMIN_MULTIEDIT . "\" />\n" . "</p>\n";
    echo "</div>";
    echo "</form></div>\n\n\n";
}
Example #8
0
function rss_redirect($url = "")
{
    header("Location: " . (guessTransportProto() . $_SERVER['HTTP_HOST'] . getPath() . $url));
}