Esempio n. 1
0
 function render()
 {
     rss_plugin_hook('rss.plugins.sidemenu', null);
     foreach ($this->items as $item) {
         echo "<" . $this->ctnr . ' class="' . $item['class'] . '"' . ' id="sidemenu' . $item['id'] . '"' . ">" . '<a href="#" onclick="' . $item["action"] . '; return false;">' . $item["label"] . '</a>' . "</" . $this->ctnr . ">\n";
     }
 }
Esempio n. 2
0
function rss_main_object()
{
    rss_plugin_hook("rss.plugins.before.mainobject", null);
    foreach ($GLOBALS['rss']->mainObject as $o) {
        $o->render();
    }
}
Esempio n. 3
0
function rss_itemlist_prerender_callback()
{
    if (isset($GLOBALS['rss']->currentItemList->preRender) && count($GLOBALS['rss']->currentItemList->preRender)) {
        foreach ($GLOBALS['rss']->currentItemList->preRender as $prAction) {
            list($prAfnct, $prAargs) = $prAction;
            call_user_func($prAfnct, $prAargs);
        }
    }
    rss_plugin_hook('rss.plugins.items.beforeitemsimmediate', null);
}
Esempio n. 4
0
 function Navigation()
 {
     $this->appendNavItem(getPath(), __('<span>H</span>ome'), LOCATION_HOME);
     if (!getConfig("rss.config.restrictrefresh")) {
         $this->appendNavItem(getPath() . 'update.php', __('<span>R</span>efresh'), LOCATION_UPDATE);
     }
     $this->appendNavItem(getPath() . 'search.php', __('<span>S</span>earch'), LOCATION_SEARCH);
     $this->appendNavItem(getPath() . 'admin/', __('A<span>d</span>min'), LOCATION_ADMIN);
     if (($an = rss_plugin_hook('rss.plugins.afternav', null)) != null) {
         $this->postRender .= $an;
     }
     $GLOBALS['rss']->nav = $this;
     rss_plugin_hook('rss.plugins.navelements', null);
 }
Esempio n. 5
0
rss_main_feeds();
?>
<a href="http://haiti.ushahidi.com/"><img src="http://sitroom.ushahididev.com/wp-content/uploads/help-haiti.png"></a> 
</div>
<img src="img/logo.png" class="htlogo" >
<?php 
rss_errors_render();
rss_plugin_hook('rss.plugins.before.maindiv', rss_main_div_id());
?>
<div <?php 
echo rss_main_div_id();
?>
 class="frame">
 	<?php 
rss_main_object();
?>
</div>

<div id="footer" class="frame">
	<?php 
rss_main_footer();
?>
</div>

</div>
<?php 
rss_plugin_hook('rss.plugins.bodyend', null);
?>
</body>
</html>
Esempio n. 6
0
/** 
 * this exported AJAX method is only here so that the plugin callback
 * hook is asynchronous 
 */
function __exp_itemRatedCB($iid, $rt)
{
    rss_plugin_hook("rss.plugins.rating.rated", array($iid, $rt));
    return null;
}
Esempio n. 7
0
    if ($cntUnreadItems == 0 && $cntTotalItems) {
        // we showed no unread items
        // Should we show some uread items?
        if ($cntReadItems == -1) {
            readItems($cntTotalItems);
        } else {
            readItems($cntReadItems);
        }
    }
} else {
    // We are showing read and unread items
    if ($cntTotalItems) {
        readItems($cntTotalItems - $cntUnreadItems);
    }
}
rss_plugin_hook('rss.plugins.frontpage.afterread', null);
$GLOBALS['rss']->header = new Header("", LOCATION_HOME, array('cid' => null, 'fid' => null));
$GLOBALS['rss']->feedList = new FeedList(false);
$GLOBALS['rss']->renderWithTemplate('index.php');
/*
function getHiddenChannelIds() {
	static $hiddenIds;
	if ($hiddenIds == NULL) {
		$sql = "select fk_ref_object_id from " .getTable('properties')
		." where domain='feed' and property = 'Hide from front-page'";
		$rs = rss_query($sql);
		while (list($cid) = rss_fetch_row($rs)) {
			$hiddenIds[] = $cid;
		}
	}
	return $hiddenIds;
Esempio n. 8
0
<div class="item">
	<?php 
rss_plugin_hook("rss.plugins.items.beforetitle", rss_item_id());
?>
	<div class="item-title" id="i<?php 
echo rss_item_id();
?>
">
		<a href="<?php 
echo rss_item_url();
?>
" class="item_url" target="_blank"><?php 
echo rss_item_title();
?>
</a>
		<em>(<?php 
echo rss_item_date();
?>
 <?php 
echo rss_item_author();
?>
)</em>
	</div>
	<div class="item-body" style="display:none">
		<?php 
/*<div id="sad<?php echo rss_item_id(); ?>" style="display:none"></div>
		<?php if (rss_item_has_enclosure()) { ?>
				<h5><?php echo __('Enclosure:'); ?>&nbsp;[<a href="<?php echo rss_item_enclosure(); ?>"><?php echo __('download'); ?></a><?php rss_plugin_hook("rss.plugins.items.enclosure", null); ?>]</h5>
		<?php } ?>
		<div class="content" id="c<?php echo rss_item_id(); ?>">
			<?php echo rss_item_content(); ?>
Esempio n. 9
0
	<span><a href="#top">TOP</a></span>
	<?php 
echo rss_plugin_hook("rss.plugins.footer.span", null);
?>
	<span>
		<a href="http://gregarius.net/">Gregarius</a> <?php 
echo _VERSION_;
echo rss_svn_rev('.');
?>
		<!--
		<?php 
echo __(' powered by ');
?>
 <a href="http://php.net">PHP</a>,
		<a href="http://magpierss.sourceforge.net/">MagpieRSS</a>,
		<a href="http://sourceforge.net/projects/kses">kses</a>,
		<a href="http://www.modernmethod.com/sajax/">SAJAX</a>
		-->
	</span>
	<span>
		Tentatively valid <a title="Tentatively valid XHTML: the layout validates, but the actual content coming from the feeds I can't do very much."  href="http://validator.w3.org/check/referer">XHTML1.0</a>,
		<a href="http://jigsaw.w3.org/css-validator/check/referer">CSS2.0</a>
	</span>
	<span style="border-right:none">
		<?php 
echo __('Last Update');
?>
:&nbsp;<?php 
echo rss_footer_last_modif();
?>
	</span>
Esempio n. 10
0
/**
 * Returns the theme's "media" component, e.g. 'web', 
 * 'rss' or 'mobile'.
 */
function getThemeMedia()
{
    static $media;
    if ($media) {
        return $media;
    }
    // Default to "web".
    $media = 'web';
    // Has the user specified anything?
    if (isset($_GET['rss'])) {
        $media = 'rss';
    } elseif (isset($_SESSION['mobile']) || isset($_REQUEST['mobile']) || isMobileDevice()) {
        $media = 'mobile';
    }
    // This is here so that auto-detected (e.g. mobile) medias
    // can be overridden.
    if (isset($_REQUEST['media'])) {
        $media = sanitize($_REQUEST['media'], RSS_SANITIZER_WORDS);
    }
    // Finally: let plugins voice their opinion
    $media = rss_plugin_hook('rss.plugins.thememedia', $media);
    return $media;
}
Esempio n. 11
0
 function render()
 {
     $this->javascriptFiles = rss_plugin_hook('rss.plugins.javascript', $this->javascriptFiles);
     $GLOBALS['rss']->header =& $this;
     rss_require(RSS::getTemplateFile("header.php"));
     if ($this->extraHTML) {
         echo $this->extraHTML;
     }
 }
Esempio n. 12
0
 function render()
 {
     _pf("ItemList -> render()");
     if ($this->readCount + $this->unreadCount == 0 && $this->beforeList == "") {
         return;
     }
     $this->rss->currentItemList = $this;
     rss_plugin_hook('rss.plugins.items.beforeitems', null);
     include $this->rss->getTemplateFile($this->_template);
     _pf("done: ItemList -> render()");
     rss_plugin_hook('rss.plugins.items.afteritems', null);
 }
Esempio n. 13
0
function add_channel($url, $folderid = 0, $title_ = null, $descr_ = null, $tags = null)
{
    if (!$url || strlen($url) <= 7) {
        return array(-2, "Invalid URL {$url}");
    }
    if (!is_numeric($folderid)) {
        return array(-2, "Invalid folderid {$folderid}");
    }
    $url = sanitize(str_replace('&amp;', '&', $url), RSS_SANITIZER_URL);
    $urlDB = rss_real_escape_string($url);
    //htmlentities($url);
    $res = rss_query("select count(*) as channel_exists from " . getTable("channels") . " where url='{$urlDB}'");
    list($channel_exists) = rss_fetch_row($res);
    if ($channel_exists > 0) {
        // fatal
        return array(-2, "Looks like you are already subscribed to this channel");
    }
    $res = rss_query("select 1+max(position) as np from " . getTable("channels"));
    list($np) = rss_fetch_row($res);
    if (!$np) {
        $np = "0";
    }
    // Here we go!
    //error_reporting(E_ALL);
    $old_level = error_reporting(E_ERROR);
    $rss = fetch_rss($url);
    error_reporting($old_level);
    if ($rss) {
        if ($title_) {
            $title = rss_real_escape_string($title_);
        } elseif (is_object($rss) && array_key_exists('title#', $rss->channel)) {
            if (array_key_exists('title', $rss->channel)) {
                $title = rss_real_escape_string($rss->channel['title']);
            } else {
                $title = " ";
            }
        } else {
            $title = "";
        }
        if (is_object($rss) && array_key_exists('link', $rss->channel)) {
            $siteurl = rss_real_escape_string(htmlentities($rss->channel['link']));
        } else {
            $siteurl = "";
        }
        $refreshinterval = 0;
        if (is_object($rss) && array_key_exists('syn', $rss->channel)) {
            $syn = $rss->channel['syn'];
            if (array_key_exists('updateperiod', $syn)) {
                if ("hourly" == $syn['updateperiod']) {
                    if (array_key_exists('updatefrequency', $syn)) {
                        $refreshinterval = 60 * $syn['updatefrequency'];
                    }
                }
            }
        }
        if ($descr_) {
            $descr = rss_real_escape_string($descr_);
        } elseif (is_object($rss) && array_key_exists('description', $rss->channel)) {
            $descr = rss_real_escape_string($rss->channel['description']);
        } else {
            $descr = "";
        }
        //lets see if this server has a favicon
        $icon = "";
        if (getConfig('rss.output.showfavicons')) {
            // if we got nothing so far, lets try to fall back to
            // favicons
            if ($icon == "" && $siteurl != "") {
                $match = get_host($siteurl, $host);
                $uri = "http://" . $host . "favicon.ico";
                if ($match && getContentType($uri, $contentType)) {
                    if (preg_match("/image\\/x-icon/", $contentType)) {
                        $icon = $uri;
                    }
                }
            }
        }
        $private = preg_match('|(https?://)([^:]+:[^@]+@)(.+)$|', $url);
        if ($title != "") {
            $title = strip_tags($title);
            $descr = strip_tags($descr);
            // add channel to root folder by default
            if (!$folderid) {
                $folderid = getRootFolder();
            }
            list($title, $urlDB, $siteurl, $folderid, $descr, $icon) = rss_plugin_hook('rss.plugins.feed.new', array($title, $urlDB, $siteurl, $folderid, $descr, $icon));
            $mode = RSS_MODE_UNREAD_STATE;
            if ($private) {
                $mode |= RSS_MODE_PRIVATE_STATE;
            }
            $sql = "insert into " . getTable("channels") . " (title, url, siteurl, parent, descr, dateadded, icon, position, mode, daterefreshed)" . " values ('{$title}', '{$urlDB}', '{$siteurl}', {$folderid}, '{$descr}', now(), '{$icon}', {$np}, {$mode}, '0000-00-00 00:00:00')";
            rss_query($sql);
            $newid = rss_insert_id();
            if ($icon && cacheFavicon($icon)) {
                rss_query("update " . getTable("channels") . " set icon='blob:" . $icon . "'" . " where id={$newid}");
            }
            if ($tags != "") {
                __exp__submitTag($newid, $tags, "'channel'");
            }
            if (false == empty($refreshinterval)) {
                setProperty($newid, 'rss.config.refreshinterval', $refreshinterval);
            }
            return array($newid, "");
        } else {
            // non-fatal, will look further
            return array(-1, "I'm sorry, I couldn't extract a valid RSS feed from <a href=\"{$url}\">{$url}</a>.");
        }
    } else {
        global $MAGPIE_ERROR;
        $retError = "I'm sorry, I couldn't retrieve <a href=\"{$url}\">{$url}</a>.";
        if ($MAGPIE_ERROR) {
            $retError .= "\n<br />{$MAGPIE_ERROR}\n";
        }
        // non-fatal, will look further
        return array(-1, $retError);
    }
}
Esempio n. 14
0
    echo $title;
    ?>
</h2>
<?php 
    if (hidePrivate()) {
        ?>
	<p>(<a href="<?php 
        echo getPath();
        ?>
?mobilelogin&amp;media=mobile">Login</a> to mark items read)</p>
<?php 
    }
    ?>
<form method="post" action="<?php 
    print getPath();
    ?>
">
<?php 
}
rss_itemlist_feeds();
if (!isMobileDevice()) {
    ?>
<input type='hidden' name='mobile' />
<?php 
}
?>
<p id="nextitems"><input type='submit' value='Next  &raquo;&raquo;' /></p>
</form>
<?php 
rss_plugin_hook('rss.plugins.bodyend.media', getThemeMedia());
Esempio n. 15
0
 function cleanUp($newIds, $ignorePrivate = false)
 {
     if (!hidePrivate() || $ignorePrivate) {
         if (count($newIds) > 0 && getConfig('rss.config.markreadonupdate')) {
             rss_query("update " . getTable("item") . " set unread = unread & " . SET_MODE_READ_STATE . " where unread & " . RSS_MODE_UNREAD_STATE . " 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);
 }
Esempio n. 16
0
" />
	<link rel="stylesheet" type="text/css" href="<?php 
echo getExternalThemeFile('css/layout.css');
?>
" />
	<link rel="stylesheet" type="text/css" href="<?php 
echo getExternalThemeFile('css/look.css');
?>
" />
	<link rel="stylesheet" type="text/css" href="<?php 
echo getPath();
?>
css/print.css" media="print" />
	<?php 
echo rss_scheme_stylesheets();
echo rss_plugin_hook('rss.plugins.stylesheets', null);
if (rss_header_autorefreshtime() > 0 && !getConfig('rss.config.restrictrefresh')) {
    ?>
	<meta http-equiv="refresh"  content="<?php 
    echo rss_header_autorefreshtime();
    ?>
;<?php 
    echo rss_header_autorefreshurl();
    ?>
" />
<?php 
}
foreach (rss_header_links() as $link) {
    list($rel, $title, $href) = $link;
    ?>
	<link rel="<?php 
Esempio n. 17
0
 function render()
 {
     $GLOBALS['rss']->searchFormTitle = $this->title;
     $this->title = "";
     require $GLOBALS['rss']->getTemplateFile("searchform.php");
     $GLOBALS['rss']->currentItemList = $this;
     rss_plugin_hook('rss.plugins.items.beforeitems', null);
     require $GLOBALS['rss']->getTemplateFile("itemlist.php");
     rss_plugin_hook('rss.plugins.items.afteritems', null);
 }
Esempio n. 18
0
function rss_feeds_feed_read_label()
{
    return rss_plugin_hook('rss.plugins.sidemenu.feedunreadlabel', $GLOBALS['rss']->currentFeedsFeed->rdLbl);
}
Esempio n. 19
0
function channel_edit_form($cid)
{
    $sql = "select id, title, url, siteurl, parent, descr, icon, mode, daterefreshed, dateadded from " . getTable("channels") . " where id={$cid}";
    $res = rss_query($sql);
    list($id, $title, $url, $siteurl, $parent, $descr, $icon, $mode, $daterefreshed, $dateadded) = rss_fetch_row($res);
    $title = htmlentities($title, ENT_QUOTES);
    // get tags
    $sql = "select t.tag from " . getTable('tag') . " t " . "  inner join " . getTable('metatag') . " m " . "    on m.tid = t.id " . "where m.ttype = 'channel' and m.fid = {$cid}";
    $res = rss_query($sql);
    $tags = "";
    while ($r = rss_fetch_assoc($res)) {
        $tags .= $r['tag'] . " ";
    }
    echo "<div>\n";
    echo "\n\n<h2>" . __('Edit the feed ') . " '{$title}'</h2>\n";
    echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "#fa{$cid}\" id=\"channeledit\">\n";
    echo "<fieldset id=\"channeleditfs\">";
    // Timestamps
    if (!empty($daterefreshed)) {
        echo "<p><label>" . __('Added') . ": " . date("M-d-Y H:i", strtotime($dateadded)) . "</label></p>" . "<p><label>" . __('Last Update') . ": " . date("M-d-Y H:i", strtotime($daterefreshed)) . " (Age: " . round((time() - strtotime($daterefreshed)) / 60) . " minutes)</label></p>\n";
    } else {
        echo "<p><label>" . __('Added') . ": " . date("M-d-Y H:i", strtotime($dateadded)) . "</label></p>" . "<p><label>" . __('Last Update') . ": " . __('Never') . "</label></p>\n";
    }
    // Item name
    echo "<p><label for=\"c_name\">" . __('Title:') . "</label>\n" . "<input type=\"text\" id=\"c_name\" name=\"c_name\" value=\"{$title}\" />" . "<input type=\"hidden\" name=\"" . CST_ADMIN_DOMAIN . "\" value=\"" . CST_ADMIN_DOMAIN_CHANNEL . "\" />\n" . "<input type=\"hidden\" name=\"action\" value=\"" . CST_ADMIN_SUBMIT_EDIT . "\" />\n" . "<input type=\"hidden\" name=\"cid\" value=\"{$cid}\" /></p>\n" . "<p><label for=\"c_url\">" . __('RSS URL:') . "</label>\n" . "<a href=\"{$url}\">" . __('(visit)') . "</a>\n" . "<input type=\"text\" id=\"c_url\" name=\"c_url\" value=\"{$url}\" /></p>" . "<p><label for=\"c_siteurl\">" . __('Site URL:') . "</label>\n" . "<a href=\"{$siteurl}\">" . __('(visit)') . "</a>\n" . "<input type=\"text\" id=\"c_siteurl\" name=\"c_siteurl\" value=\"{$siteurl}\" /></p>" . "<p><label for=\"c_parent\">" . __('In folder:') . "</label>\n" . rss_toolkit_folders_combo('c_parent', $parent) . "</p>\n";
    // Tags
    echo "<p><label for=\"c_tags\">" . __('Categories') . ":</label>\n" . "<input type=\"text\" id=\"c_tags\" name=\"c_tags\" value=\"{$tags}\" /></p>";
    // Items state
    if ($mode & RSS_MODE_PRIVATE_STATE) {
        $pchk = " checked=\"checked\" ";
        $old_priv = "1";
    } else {
        $pchk = "";
        $old_priv = "0";
    }
    if ($mode & RSS_MODE_DELETED_STATE) {
        $dchk = " checked=\"checked\" ";
        $old_del = "1";
    } else {
        $dchk = "";
        $old_del = "0";
    }
    echo "<p>\n" . "<input style=\"display:inline\" type=\"checkbox\" id=\"c_private\" " . " name=\"c_private\" value=\"1\"{$pchk} />\n" . "<label for=\"c_private\">" . __('This feed is <strong>private</strong>, only admins see it.') . "</label>\n" . "<input type=\"hidden\" name=\"old_priv\" value=\"{$old_priv}\" />\n" . "</p>\n";
    echo "<p>\n" . "<input style=\"display:inline\" type=\"checkbox\" id=\"c_deleted\" " . " name=\"c_deleted\" value=\"1\"{$dchk} />\n" . "<label for=\"c_deleted\">" . __("This feed is <strong>deprecated</strong>, it won't be updated anymore and won't be visible in the feeds column.") . "</label>\n" . "<input type=\"hidden\" name=\"old_del\" value=\"{$old_del}\" />\n" . "</p>\n";
    // Description
    $descr = trim(htmlentities(strip_tags($descr), ENT_QUOTES));
    echo "<p><label for=\"c_descr\">" . __('Description:') . "</label>\n" . "<input type=\"text\" id=\"c_descr\" name=\"c_descr\" value=\"{$descr}\" /></p>\n";
    // Icon
    if (getConfig('rss.output.showfavicons')) {
        echo "<p><label for=\"c_icon\">" . __('Shown favicon:') . "</label>\n";
        if (trim($icon) != "") {
            if (substr($icon, 0, 5) == 'blob:') {
                $icon = substr($icon, 5);
            }
            echo "<img src=\"{$icon}\" alt=\"{$title}\" class=\"favicon\" width=\"16\" height=\"16\" />\n";
            echo "<span>" . __('(Leave blank for no icon)') . "</span>";
        }
        echo "<input type=\"text\" id=\"c_icon\" name=\"c_icon\" value=\"{$icon}\" /></p>\n";
    } else {
        echo "<p><input type=\"hidden\" name=\"c_icon\" id=\"c_icon\" value=\"{$icon}\" /></p>\n";
    }
    rss_plugin_hook('rss.plugins.admin.feed.properties', $cid);
    echo "</fieldset>\n";
    // Feed properties
    echo "<fieldset id=\"channeleditpropfs\">";
    echo "<p>" . "<span style=\"float:left;\">Allow Gregarius to look for updates in existing items for this feed?</span>" . "<span style=\"float:right;\">[<a  href=\"index.php?domain=config&amp;action=edit&amp;key=rss.input.allowupdates&amp;view=config\">Edit the global option</a>]</span>\n" . "&nbsp;" . "</p>";
    $rss_input_allowupdates_default_current = getProperty($cid, 'rss.input.allowupdates');
    $rss_input_allowupdates_default_value = $rss_input_allowupdates_default = "Use global option (" . (getConfig('rss.input.allowupdates') ? "Yes" : "No") . ")";
    echo "<p id=\"rss_input_allowupdates_options\">" . "<input type=\"radio\" " . "id=\"rss_input_allowupdates_yes\" " . "name=\"prop_rss_input_allowupdates\" value=\"1\"  " . ($rss_input_allowupdates_default_current === true ? " checked=\"checked\" " : "") . "/>\n" . "<label for=\"rss_input_allowupdates_yes\">Yes</label>\n" . "<input type=\"radio\" " . "id=\"rss_input_allowupdates_no\" " . "name=\"prop_rss_input_allowupdates\" value=\"0\"  " . ($rss_input_allowupdates_default_current === false ? " checked=\"checked\" " : "") . "/>\n" . "<label for=\"rss_input_allowupdates_no\">No</label>" . "<input type=\"radio\" " . "id=\"rss_input_allowupdates_default\" " . "name=\"prop_rss_input_allowupdates\" value=\"default\"  " . ($rss_input_allowupdates_default_current === null ? " checked=\"checked\" " : "") . "/>\n" . "<label for=\"rss_input_allowupdates_default\">{$rss_input_allowupdates_default}</label>" . "</p>\n";
    echo "<p>" . "<span style=\"float:left;\">Refresh Interval (minutes): </span>" . "&nbsp;" . "</p>";
    $rss_config_refreshinterval_default_current = getProperty($cid, 'rss.config.refreshinterval');
    echo "<p id=\"rss_config_refreshinterval_options\">" . "<input type=\"text\" id=\"rss_config_refreshinterval\" name=\"rss_config_refreshinterval\" value=\"" . (true == empty($rss_config_refreshinterval_default_current) ? 60 : $rss_config_refreshinterval_default_current) . "\">" . "</p>";
    echo "</fieldset>\n";
    echo "<p style=\"clear:both; padding: 1em 0\"><input type=\"submit\" name=\"action_\" value=\"" . __('Submit Changes') . "\" />" . "<input type=\"button\" name=\"_cancel\" value=\"" . __('Cancel') . "\" onclick=\"history.back(-1);\"></p>";
    echo "</form></div>\n";
}
Esempio n. 20
0
echo rss_item_id();
?>
" style="display:none"></div>
<?php 
if (rss_item_has_enclosure()) {
    ?>
		<h5><?php 
    echo __('Enclosure:');
    ?>
&nbsp;[<a href="<?php 
    echo rss_item_enclosure();
    ?>
"><?php 
    echo __('download');
    ?>
</a><?php 
    rss_plugin_hook("rss.plugins.items.enclosure", null);
    ?>
]</h5>
<?php 
}
?>
<div class="content" id="c<?php 
echo rss_item_id();
?>
">
	<?php 
echo rss_item_content();
?>
</div>
Esempio n. 21
0
function plugins()
{
    // Submit changes
    if (isset($_POST['admin_plugin_submit_changes'])) {
        $old_active_plugins = getConfig('rss.config.plugins');
        $active_plugins = array();
        foreach ($_REQUEST as $rkey => $rentry) {
            if (preg_match('/_gregarius_plugin.([a-zA-Z0-9_\\/\\-]+).php/', $rkey, $matches)) {
                $active_plugins[] = $matches[1] . ".php";
            }
        }
        $value = serialize($active_plugins);
        $sql = "update " . getTable('config') . " set value_='{$value}' where key_='rss.config.plugins'";
        rss_query($sql);
        rss_invalidate_cache();
        // deactivate
        $to_deactivate = array_diff($old_active_plugins, $active_plugins);
        foreach ($to_deactivate as $deactivatethis) {
            rss_load_plugin($deactivatethis);
            rss_plugin_hook("rss.plugins.admin.deactivate", "", $deactivatethis);
        }
        //activate
        $to_activate = array_diff($active_plugins, $old_active_plugins);
        foreach ($to_activate as $activatethis) {
            rss_load_plugin($activatethis);
            rss_plugin_hook("rss.plugins.admin.activate", "", $activatethis);
        }
    } else {
        $active_plugins = getConfig('rss.config.plugins');
    }
    // Check for updates
    $doUpdates = false;
    $updates = array();
    if (isset($_POST['admin_plugin_check_for_updates'])) {
        $updates = plugins_check_for_updates();
        $doUpdates = true;
    }
    // Rendering
    echo "<h2 class=\"trigger\">" . __('Plugins') . "</h2>\n" . "<div id=\"admin_plugins\">\n";
    echo __('<p style="font-size:small">Plugins are third-party scripts that offer extended functionalities. More plugins can be downloaded at the <a style="text-decoration:underline"  href="http://plugins.gregarius.net/">Plugin Repository</a>.</p>');
    echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n";
    echo "<p><input type=\"hidden\" name=\"" . CST_ADMIN_DOMAIN . "\" value=\"" . CST_ADMIN_DOMAIN_PLUGINS . "\" /></p>\n";
    echo "\n<table id=\"plugintable\">\n<tr>\n" . "<th>" . __('Active') . "</th>\n" . "<th>" . __('Name') . "</th>\n" . "<th>" . __('Version') . "</th>\n" . "<th>" . __('Author') . "</th>\n" . "<th>" . __('Description') . "</th>\n" . "<th>" . __('Options') . "</th>\n";
    if ($doUpdates) {
        echo "<th>" . __('Update Available') . "</th>\n";
    }
    echo "</tr>\n";
    $rss_plugins = getPlugins();
    $cntr = 0;
    if ($rss_plugins) {
        foreach ($rss_plugins as $entry => $info) {
            $active = in_array($entry, $active_plugins);
            if (count($info)) {
                $updateDl = null;
                if (is_array($updates) && array_key_exists($info['file'], $updates)) {
                    $lastV = $updates[$info['file']][0];
                    $thisV = $info['version'];
                    if ($lastV > $thisV) {
                        $updateDl = str_replace("&", "&amp;", $updates[$info['file']][1]);
                    }
                }
                $class = ($cntr++ % 2 == 0 ? "even" : "odd") . ($updateDl ? " hilite" : ($active ? " active" : ""));
                echo "<tr class=\"{$class}\">\n";
                echo "<td class=\"cntr\">" . "<input type=\"checkbox\" name=\"_gregarius_plugin_{$entry}\" " . " id=\"_gregarius_plugin_{$entry}\" value=\"1\" " . ($active ? "checked=\"checked\"" : "") . " />\n" . "</td>\n";
                echo "<td><label\n                for=\"_gregarius_plugin_{$entry}\">" . (array_key_exists('name', $info) ? $info['name'] : "&nbsp;") . "</label></td>\n";
                echo "<td class=\"cntr\">" . (array_key_exists('version', $info) ? $info['version'] : "&nbsp;") . "</td>\n";
                echo "<td>" . (array_key_exists('author', $info) ? $info['author'] : "&nbsp;") . "</td>\n";
                echo "<td>" . (array_key_exists('description', $info) ? $info['description'] : "&nbsp;") . "</td>\n";
                // output the column to call a plugin's config page.
                echo "<td  class=\"cntr\">";
                if (array_key_exists('configuration', $info)) {
                    $escaped_plugin_name = str_replace("/", "%2F", $entry);
                    echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?" . CST_ADMIN_DOMAIN . "=" . CST_ADMIN_DOMAIN_PLUGIN_OPTIONS . "&amp;action=" . CST_ADMIN_EDIT_ACTION . "&amp;plugin_name=" . $escaped_plugin_name . "&amp;" . CST_ADMIN_VIEW . "=" . CST_ADMIN_DOMAIN_PLUGIN_OPTIONS . "\">" . __('edit') . "</a>";
                } else {
                    echo "&nbsp;";
                }
                echo "</td>\n";
                if ($doUpdates && $updateDl) {
                    echo "<td class=\"cntr\">";
                    echo "<a href=\"{$updateDl}\">{$lastV}</a>";
                    echo "</td>";
                } elseif ($doUpdates) {
                    echo "<td>&nbsp;</td>";
                }
                echo "</tr>\n";
            }
        }
    }
    echo "</table>\n";
    echo "<p><input type=\"hidden\" name=\"" . CST_ADMIN_METAACTION . "\" value=\"ACT_ADMIN_SUBMIT_CHANGES\"/>\n";
    echo "<input type=\"submit\" name=\"admin_plugin_submit_changes\" value=\"" . __('Submit Changes') . "\" />\n";
    echo "<input type=\"submit\" name=\"admin_plugin_check_for_updates\" value=\"" . __('Check for Updates') . "\" /></p></form>\n";
    echo "</div>";
}