当前位置: 首页>>代码示例>>PHP>>正文


PHP rss_query函数代码示例

本文整理汇总了PHP中rss_query函数的典型用法代码示例。如果您正苦于以下问题:PHP rss_query函数的具体用法?PHP rss_query怎么用?PHP rss_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rss_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkETag

function checkETag($withDB = true, $keyPrefix = "", $cacheValidity = 0)
{
    $key = $keyPrefix . '$Revision$' . $_SERVER["REQUEST_URI"];
    if ($withDB) {
        list($dt) = rss_fetch_row(rss_query('select timestamp from ' . getTable('cache') . " where cachekey='data_ts'"));
        $key .= $dt;
    }
    if (array_key_exists(RSS_USER_COOKIE, $_REQUEST)) {
        $key .= $_REQUEST[RSS_USER_COOKIE];
    }
    $key = md5($key);
    if (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER) && $_SERVER['HTTP_IF_NONE_MATCH'] == $key) {
        header("HTTP/1.1 304 Not Modified");
        header("X-RSS-CACHE-STATUS: HIT");
        header("ETag: {$key}");
        flush();
        exit;
    } else {
        header("ETag: {$key}");
        header("X-RSS-CACHE-STATUS: MISS");
        if ($cacheValidity) {
            header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $cacheValidity * 3600) . 'GMT');
        }
    }
}
开发者ID:jphpsf,项目名称:gregarius,代码行数:25,代码来源:core.php

示例2: rss_toolkit_channels_combo

function rss_toolkit_channels_combo($id, $all_channels_id = ALL_CHANNELS_ID, $selected = 0, $showDeprecated = false)
{
    $ret = "\t\t<select name=\"{$id}\" id=\"{$id}\">\n" . "\t\t\t<option value=\"" . $all_channels_id . "\"" . (0 == $selected ? " selected=\"selected\"" : "") . ">" . __('All') . "</option>\n";
    $sql = "select " . " c.id, c.title, f.name, f.id  " . " from " . getTable("channels") . " c " . " inner join " . getTable("folders") . " f " . "   on f.id = c.parent ";
    if (hidePrivate()) {
        $sql .= " and not(c.mode & " . RSS_MODE_PRIVATE_STATE . ") ";
    }
    if (false == $showDeprecated) {
        $sql .= " and not(c.mode & " . RSS_MODE_DELETED_STATE . ") ";
    }
    $sql .= " order by " . (getConfig('rss.config.absoluteordering') ? "f.position asc, c.position asc" : "f.name asc, c.title asc");
    $res = rss_query($sql);
    $prev_parent = -1;
    while (list($id_, $title_, $parent_, $parent_id_) = rss_fetch_row($res)) {
        if ($prev_parent != $parent_id_) {
            if ($prev_parent > -1) {
                $ret .= "\t\t\t</optgroup>\n";
            }
            if ($parent_ == "") {
                $parent_ = __('Root');
            }
            $ret .= "\t\t\t<optgroup label=\"{$parent_} /\">\n";
            $prev_parent = $parent_id_;
        }
        if (strlen($title_) > 25) {
            $title_ = substr($title_, 0, 22) . "...";
        }
        $ret .= "\t\t\t\t<option value=\"{$id_}\"" . ($selected == $id_ ? " selected=\"selected\"" : "") . ">{$title_}</option>\n";
    }
    if ($prev_parent != 0) {
        $ret .= "\t\t\t</optgroup>\n";
    }
    $ret .= "\t\t</select>\n";
    return $ret;
}
开发者ID:jphpsf,项目名称:gregarius,代码行数:35,代码来源:toolkit.php

示例3: relatedTags

function relatedTags($tags)
{
    /* related tags */
    $twhere = "";
    foreach ($tags as $tag) {
        $tag = rss_real_escape_string($tag);
        $twhere .= "t.tag='{$tag}' or ";
    }
    $twhere .= "1=0";
    $sql = "select fid,tid,m.tdate from " . getTable('metatag') . " m " . "inner join " . getTable('tag') . " t on t.id = m.tid  where m.ttype = 'item'" . " and ({$twhere})";
    //echo $sql;
    $res = rss_query($sql);
    $fids = array();
    $ctid = -1;
    while (list($fid, $tid) = rss_fetch_row($res)) {
        $fids[] = $fid;
        $tids[] = $tid;
    }
    $fids = array_unique($fids);
    $tids = array_unique($tids);
    $rtags = array();
    if (count($fids)) {
        $sql = "select t.tag, count(*) as cnt from " . getTable('metatag') . " m left join " . getTable('item') . " i on (m.fid=i.id) " . " inner join " . getTable('tag') . " t on (t.id = m.tid) " . " where m.fid in (" . implode(",", $fids) . ")" . " and t.id not in (" . implode(",", $tids) . ")";
        if (hidePrivate()) {
            $sql .= " and not(i.unread & " . RSS_MODE_PRIVATE_STATE . ") ";
        }
        $sql .= " group by t.tag order by cnt desc";
        //echo $sql;
        $res = rss_query($sql);
        while (list($rtag, $cnt) = rss_fetch_row($res)) {
            $rtags[$rtag] = $cnt;
        }
    }
    return $rtags;
}
开发者ID:abdallahchamas,项目名称:haiti_tracker,代码行数:35,代码来源:tags.php

示例4: render

 function render()
 {
     $res = rss_query("select url from " . getTable("channels") . " where id = " . $this->fid);
     if (!defined('MAGPIE_DEBUG') || !MAGPIE_DEBUG) {
         define('MAGPIE_DEBUG', true);
     }
     list($url) = rss_fetch_row($res);
     define('MAGPIE_CACHE_ON', false);
     $rss = fetch_rss($url);
     echo "<pre>\n";
     echo htmlentities(print_r($rss, 1));
     echo "</pre>\n";
 }
开发者ID:jphpsf,项目名称:gregarius,代码行数:13,代码来源:debugfeed.php

示例5: __exp__getFromDelicious

function __exp__getFromDelicious($id)
{
    list($url) = rss_fetch_row(rss_query('select url from ' . getTable('item') . " where id={$id}"));
    $ret = array();
    $durl = "http://del.icio.us/url/" . md5($url) . "?settagview=list";
    $bfr = getUrl($durl, 3000);
    if ($bfr) {
        define('DLSRX', '|<a href="/tag/([^"]+)".*>\\1</a>|U');
        if ($bfr && preg_match_all(DLSRX, $bfr, $hits, PREG_SET_ORDER)) {
            $hits = array_slice($hits, 0, MAX_TAGS_PER_ITEM);
            foreach ($hits as $hit) {
                $ret[] = $hit[1];
            }
        }
    }
    return "{$id}," . implode(" ", $ret);
}
开发者ID:jphpsf,项目名称:gregarius,代码行数:17,代码来源:delicious.php

示例6: set_admin_pass

function set_admin_pass($uname = null, $pass = null)
{
    $sql = "select count(*) from " . getTable('users') . " where password != '' and ulevel >=99";
    list($adminexists) = rss_fetch_row(rss_query($sql));
    if ($adminexists) {
        die('Oops. Admin already exists!');
    }
    if ($uname && $pass) {
        rss_query("update " . getTable('users') . " set uname='{$uname}', " . "password='" . md5(md5($pass)) . "' where ulevel=99");
        rss_invalidate_cache();
        rss_redirect('admin/');
        exit;
    }
    admin_header();
    ?>
	<script type="text/javascript">
	<!--
		function on_submit_password_match() {
			pass=document.getElementById('password').value;
			pass2=document.getElementById('password2').value;
			if(pass !== pass2){
				msg = '<?php 
    echo __('Passwords do not match!');
    ?>
';
				document.getElementById('admin_match_result').innerHTML = msg;
				document.getElementById('password').value = '';
				document.getElementById('password2').value = '';
				return false;
			}else{
				document.getElementById('password2').value = '';
				return loginHandler();
			}
		}	
	-->
	</script>
	
	<?php 
    echo "\n<div id=\"channel_admin\" class=\"frame\">";
    echo "<h2></h2>\n" . __('<p>No Administrator has been specified yet!</p><p>Please provide an Administrator username and password now!</p>');
    echo "<form action=\"" . $_SERVER['PHP_SELF'] . "\" onsubmit=\"return on_submit_password_match();\" method=\"post\">\n" . "<fieldset style=\"width:400px;\">" . "<p><label style=\"display:block\" for=\"username\">" . __('Username') . ":</label>\n" . "<input type=\"text\" id=\"username\" name=\"username\" /></p>\n" . "<p><label style=\"display:block\" for=\"password\">" . __('Password') . ":</label>\n" . "<input type=\"password\" id=\"password\" name=\"password\" /></p>\n" . "<p><label style=\"display:block\" for=\"password2\">" . __('Password (again)') . ":</label>\n" . "<input type=\"password\" id=\"password2\" name=\"password2\" /></p>\n" . "<p><input type=\"submit\" value=\"" . __('OK') . "\" /></p>\n" . "<div style=\"display:inline;\" id=\"admin_match_result\"></div>\n" . "</fieldset>\n" . "</form>\n";
    echo "</div>\n";
    admin_footer();
    exit;
}
开发者ID:jphpsf,项目名称:gregarius,代码行数:45,代码来源:users.php

示例7: dashboard

function dashboard()
{
    $idtoken = _VERSION_ . "-" . md5($_SERVER["HTTP_HOST"]);
    $magpieCacheAge = 60 * 60 * 24;
    if (function_exists('apache_request_headers')) {
        $hdrs = apache_request_headers();
        if (isset($hdrs['Pragma']) && $hdrs['Pragma'] == 'no-cache' || isset($hdrs['Cache-Control']) && $hdrs['Cache-Control'] == 'no-cache') {
            $magpieCacheAge = 0;
        }
    }
    define('MAGPIE_FETCH_TIME_OUT', 2);
    define('MAGPIE_CACHE_AGE', $magpieCacheAge);
    $rs = rss_query("select id, title, position, url, obj, unix_timestamp(daterefreshed), itemcount " . " from " . getTable('dashboard') . " order by position asc");
    $rss = array();
    while (list($id, $title, $pos, $url, $obj, $ts, $cnt) = rss_fetch_row($rs)) {
        if ($obj && time() - $ts < $magpieCacheAge) {
            $rss[$title] = unserialize($obj);
        } else {
            $old_level = error_reporting(E_ERROR);
            $rss[$title] = fetch_rss($url . $idtoken);
            error_reporting($old_level);
            if ($rss[$title] && is_object($rss[$title])) {
                $rss[$title]->items = array_slice($rss[$title]->items, 0, $cnt);
                rss_query('update ' . getTable('dashboard') . " set obj='" . rss_real_escape_string(serialize($rss[$title])) . "', " . " daterefreshed=now()\twhere id={$id}");
            }
        }
        if ($rss[$title] && is_object($rss[$title])) {
            if ($pos == 0) {
                echo "\n\t\t\t\t\t\t\t<h2 style=\"margin-bottom: 0.5em\">{$title}</h2>\n\t\t\t\t\t\t\t<div id=\"db_main\">\n\t\t\t\t\t\t\t<ul>";
                foreach ($rss[$title]->items as $item) {
                    echo "<li class=\"item unread\">\n" . "<h4><a href=\"" . $item['link'] . "\">" . $item['title'] . "</a></h4>\n" . "<h5>Posted: " . time_since(strtotime($item['pubdate'])) . " ago </h5>\n" . "<div class=\"content\">" . $item['content']['encoded'] . "</div>\n</li>\n";
                }
                echo "</ul></div>\n";
            } else {
                echo "<div class=\"frame db_side\">\n";
                db_side($title, $rss[$title]);
                echo "</div>";
            }
        }
    }
}
开发者ID:jphpsf,项目名称:gregarius,代码行数:41,代码来源:dashboard.php

示例8: channel_edit_form

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";
}
开发者ID:jphpsf,项目名称:gregarius,代码行数:76,代码来源:channels.php

示例9: rss_plugins_set_item_state

function rss_plugins_set_item_state($itemId, $bit_mask, $set, $sqlwhere = "", $entire_db = false)
{
    $retvalue = false;
    if ($itemId || $entire_db) {
        // Check to see if itemId is set or if we are allowed to fsck up the entire db
        // the bitmask has a one in the spot (field(s)) we want to change.
        if ($set) {
            // Set the value to the field to 1
            $sql = "update " . getTable("item") . " set unread = unread | " . $bit_mask;
        } else {
            // set the value of the field to 0
            $sql = "update " . getTable("item") . " set unread = unread & " . ~$bit_mask;
        }
        if ($itemId) {
            if (is_array($itemId)) {
                $sql .= " where id  in (" . implode(',', $itemId) . ")";
            } else {
                // assume it is a number or a string
                $sql .= " where id=" . $itemId;
            }
        } else {
            $sql .= " where 1";
        }
        if ($sqlwhere) {
            $sql .= " and " . $sqlwhere;
        }
        $retvalue = rss_query($sql);
        rss_invalidate_cache();
    } else {
        $retvalue = false;
    }
    return $retvalue;
}
开发者ID:jphpsf,项目名称:gregarius,代码行数:33,代码来源:plugins.php

示例10: theme_options_fill_override_array

function theme_options_fill_override_array($theme, $media, $array_input, $key = null)
{
    $ret = array();
    if (!is_array($array_input)) {
        $array_input = explode(",", $array_input);
    }
    foreach ($array_input as $inp) {
        if (!is_array($inp) && isset($inp)) {
            $inp = array('key_' => $inp);
        }
        if (isset($inp['key_'])) {
            $thisret = array();
            if ($key === null || $key === $inp['key_']) {
                $thisret = $inp;
                if ($inp['key_'] == 'rss.output.theme.scheme') {
                    $schemes = loadSchemeList(true, $theme, $media);
                    if (!isset($inp['default_'])) {
                        $thisret['default_'] = implode(',', $schemes) . ",0";
                    }
                    $thisret['type_'] = 'enum';
                    if (!isset($inp['desc_'])) {
                        $thisret['desc_'] = 'The color scheme to use.';
                    }
                    if (!isset($inp['export_'])) {
                        $thisret['export_'] = '';
                    }
                    $value = rss_theme_config_override_option($thisret['key_'], $thisret['default_'], $theme, $media);
                    $value = array_pop(explode(',', $value));
                    $thisret['value_'] = implode(',', $schemes) . "," . $value;
                } else {
                    $sql = "select * from " . getTable("config") . " where key_ like\n                           '" . $inp['key_'] . "'";
                    $res = rss_query($sql);
                    if ($row = rss_fetch_assoc($res)) {
                        foreach ($row as $rowkey => $rowval) {
                            if ($rowkey !== 'value_') {
                                if (!isset($inp[$rowkey])) {
                                    $thisret[$rowkey] = $rowval;
                                } else {
                                    $thisret[$rowkey] = $inp[$rowkey];
                                }
                            }
                        }
                    }
                    $thisret['value_'] = rss_theme_config_override_option($thisret['key_'], $thisret['default_'], $theme, $media);
                }
                if ($key === null) {
                    $ret[] = $thisret;
                } else {
                    $ret = $thisret;
                }
            }
        } else {
            rss_error('rss_theme_options_configure_overrides was passed an item with no key_', RSS_ERROR_ERROR, true);
        }
    }
    return $ret;
}
开发者ID:nerdling,项目名称:gregarius,代码行数:57,代码来源:themes.php

示例11: config_admin

function config_admin()
{
    $ret__ = CST_ADMIN_DOMAIN_CONFIG;
    if (isset($_REQUEST[CST_ADMIN_METAACTION])) {
        $action = $_REQUEST[CST_ADMIN_METAACTION];
    } else {
        $action = $_REQUEST['action'];
    }
    switch ($action) {
        case CST_ADMIN_DEFAULT_ACTION:
        case 'CST_ADMIN_DEFAULT_ACTION':
            if (!array_key_exists('key', $_REQUEST)) {
                rss_error(__('Invalid config key specified.'), RSS_ERROR_ERROR, true);
                break;
            }
            $key = sanitize($_REQUEST['key'], RSS_SANITIZER_NO_SPACES | RSS_SANITIZER_SIMPLE_SQL);
            $res = rss_query("select value_,default_,type_ from " . getTable('config') . " where key_='{$key}'");
            list($value, $default, $type) = rss_fetch_row($res);
            $value = real_strip_slashes($value);
            $default = real_strip_slashes($default);
            if ($value == $default) {
                rss_error(__("The value for '{$key}' is the same as its default value!"), RSS_ERROR_ERROR, true);
                break;
            }
            if (array_key_exists(CST_ADMIN_CONFIRMED, $_POST) && $_POST[CST_ADMIN_CONFIRMED] == __('Yes')) {
                rss_query("update " . getTable('config') . " set value_=default_ where key_='{$key}'");
                rss_invalidate_cache();
            } elseif (array_key_exists(CST_ADMIN_CONFIRMED, $_REQUEST) && $_REQUEST[CST_ADMIN_CONFIRMED] == __('No')) {
                //nop
            } else {
                echo "<form class=\"box\" method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n";
                config_default_form($key, $type, $default, CST_ADMIN_DOMAIN_CONFIG);
                echo "</form>\n";
                $ret = CST_ADMIN_DOMAIN_NONE;
            }
            break;
        case CST_ADMIN_EDIT_ACTION:
        case 'CST_ADMIN_EDIT_ACTION':
            $key_ = sanitize($_REQUEST['key'], RSS_SANITIZER_NO_SPACES | RSS_SANITIZER_SIMPLE_SQL);
            $res = rss_query("select * from " . getTable('config') . " where key_ ='{$key_}'");
            list($key, $value, $default, $type, $desc, $export) = rss_fetch_row($res);
            echo "<div>\n";
            echo "\n\n<h2>Edit '{$key}'</h2>\n";
            echo "<form style=\"display:inline\" id=\"cfg\" method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n";
            $onclickaction = null;
            config_edit_form($key, $value, $default, $type, $desc, $export, $onclickaction);
            echo "<p style=\"display:inline\">\n";
            echo isset($preview) ? "<input type=\"submit\" name=\"action\" value=\"" . __('Preview') . "\"" . ($onclickaction ? " onclick=\"{$onclickaction}\"" : "") . " />\n" : "";
            echo "<input type=\"hidden\" name=\"" . CST_ADMIN_METAACTION . "\" value=\"ACT_ADMIN_SUBMIT_CHANGES\" />";
            echo "<input type=\"submit\" name=\"action\" value=\"" . __('Submit Changes') . "\"" . ($onclickaction ? " onclick=\"{$onclickaction}\"" : "") . " /><input type=\"hidden\" name=\"" . CST_ADMIN_DOMAIN . "\" value=\"" . CST_ADMIN_DOMAIN_CONFIG . "\"/>\n</p></form>\n";
            echo "<form style=\"display:inline\" method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n" . "<p style=\"display:inline\">\n<input type=\"hidden\" name=\"" . CST_ADMIN_DOMAIN . "\" value=\"" . CST_ADMIN_DOMAIN_CONFIG . "\"/>\n" . "<input type=\"hidden\" name=\"" . CST_ADMIN_METAACTION . "\" value=\"ACT_ADMIN_SUBMIT_CANCEL\" />" . "<input type=\"submit\" name=\"action\" value=\"" . __('Cancel') . "\"/></p></form>\n" . "\n\n</div>\n";
            $ret__ = CST_ADMIN_DOMAIN_NONE;
            break;
        case __('Preview'):
        case 'ACT_ADMIN_PREVIEW_CHANGES':
            rss_error('fixme: preview not yet implemented', RSS_ERROR_ERROR, true);
            break;
        case __('Submit Changes'):
        case 'ACT_ADMIN_SUBMIT_CHANGES':
            $key = sanitize($_POST['key'], RSS_SANITIZER_NO_SPACES | RSS_SANITIZER_SIMPLE_SQL);
            $type = sanitize($_POST['type'], RSS_SANITIZER_CHARACTERS);
            $value = sanitize($_POST['value'], RSS_SANITIZER_SIMPLE_SQL);
            // sanitizine routines for values
            switch ($key) {
                case 'rss.output.title':
                    $value = strip_tags($value);
                    break;
                case 'rss.config.robotsmeta':
                    $value = preg_replace('#[^a-zA-Z,\\s]#', '', $value);
                    break;
            }
            switch ($key) {
                case 'rss.input.allowed':
                    $ret = array();
                    $tmp = explode(' ', $value);
                    foreach ($tmp as $key__) {
                        if (preg_match('|^[a-zA-Z]+$|', $key__)) {
                            $ret[$key__] = array();
                        } else {
                            $tmp2 = array();
                            $attrs = explode(',', $key__);
                            $key__ = array_shift($attrs);
                            foreach ($attrs as $attr) {
                                $tmp2[$attr] = 1;
                            }
                            $ret[$key__] = $tmp2;
                        }
                    }
                    $sql = "update " . getTable('config') . " set value_='" . serialize($ret) . "' where key_='{$key}'";
                    break;
                case 'rss.output.lang':
                    $langs = getLanguages();
                    $codes = array_keys($langs);
                    $out_val = implode(',', $codes);
                    $cntr = 0;
                    $idx = "0";
                    foreach ($codes as $code) {
                        if ($code == $value) {
                            $idx = $cntr;
                        }
//.........这里部分代码省略.........
开发者ID:nerdling,项目名称:gregarius,代码行数:101,代码来源:config.php

示例12: item_admin

/**
 * performs pruning action
 */
function item_admin()
{
    $ret__ = CST_ADMIN_DOMAIN_NONE;
    switch ($_REQUEST['action']) {
        case __('Delete'):
            $req = rss_query('select count(*) as cnt from ' . getTable('item') . " where not(unread & " . RSS_MODE_DELETED_STATE . ")");
            list($cnt) = rss_fetch_row($req);
            $prune_older = sanitize($_REQUEST['prune_older'], RSS_SANITIZER_NUMERIC);
            if (array_key_exists('prune_older', $_REQUEST) && strlen($_REQUEST['prune_older']) && is_numeric($_REQUEST['prune_older'])) {
                switch ($_REQUEST['prune_period']) {
                    case __('days'):
                        $period = 'day';
                        break;
                    case __('months'):
                        $period = 'month';
                        break;
                    case __('years'):
                        $period = 'year';
                        break;
                    default:
                        rss_error(__('Invalid pruning period'), RSS_ERROR_ERROR, true);
                        return CST_ADMIN_DOMAIN_ITEM;
                        break;
                }
                $sql = " from " . getTable('item') . " i inner join " . getTable('channels') . " c on c.id=i.cid " . " where 1=1 ";
                if (array_key_exists('prune_channel', $_REQUEST)) {
                    if (ALL_CHANNELS_ID != $_REQUEST['prune_channel']) {
                        $sql .= " and c.id = " . $_REQUEST['prune_channel'] . "";
                    }
                }
                if ($prune_older > 0) {
                    $prune_older_date = date("Y-m-d H:i:s", strtotime("-{$prune_older} {$period}"));
                    $sql .= " and ifnull(i.pubdate, i.added) <  '{$prune_older_date}'";
                }
                if (!array_key_exists('prune_include_sticky', $_REQUEST) || $_REQUEST['prune_include_sticky'] != '1') {
                    $sql .= " and not(unread & " . RSS_MODE_STICKY_STATE . ") ";
                }
                if (!array_key_exists('prune_include_flag', $_REQUEST) || $_REQUEST['prune_include_flag'] != '1') {
                    $sql .= " and not(unread & " . RSS_MODE_FLAG_STATE . ") ";
                }
                if (!array_key_exists('prune_include_unread', $_REQUEST) || $_REQUEST['prune_include_unread'] != '1') {
                    $sql .= " and not(unread & " . RSS_MODE_UNREAD_STATE . ") ";
                }
                if (array_key_exists('prune_exclude_tags', $_REQUEST) && trim($_REQUEST['prune_exclude_tags'])) {
                    if (trim($_REQUEST['prune_exclude_tags']) == '*') {
                        $tsql = " select distinct fid from " . getTable('metatag');
                    } else {
                        $exclude_tags = explode(" ", $_REQUEST['prune_exclude_tags']);
                        $trimmed_exclude_tags = array();
                        foreach ($exclude_tags as $etag) {
                            if ($tetag = rss_real_escape_string(trim($etag))) {
                                $trimmed_exclude_tags[] = $tetag;
                            }
                        }
                        $tsql = " select distinct fid from " . getTable('metatag') . " m " . " inner join " . getTable('tag') . " t" . "   on t.id = m.tid " . " where t.tag in ('" . implode("', '", $trimmed_exclude_tags) . "')";
                    }
                    $tres = rss_query($tsql);
                    $fids = array();
                    while (list($fid) = rss_fetch_row($tres)) {
                        $fids[] = $fid;
                    }
                    if (count($fids)) {
                        $sql .= " and i.id not in (" . implode(",", $fids) . ") ";
                    }
                }
                if (array_key_exists(CST_ADMIN_CONFIRMED, $_REQUEST)) {
                    // Possible fix for #207: max out execution time
                    // to avoid timeouts
                    @set_time_limit(0);
                    @ini_set('max_execution_time', 60 * 10);
                    //echo "<pre>\n";
                    //delete the tags for these items
                    $sqlids = "select distinct i.id,i.cid " . $sql . " order by i.cid, i.id desc";
                    $rs = rss_query($sqlids);
                    $ids = array();
                    $cids = array();
                    //echo "to be deleted\n";
                    while (list($id, $cid) = rss_fetch_row($rs)) {
                        $cids[$cid][] = $id;
                        //echo "cid=$cid, $id\n";
                    }
                    //echo "\n\n";
                    if (count($cids)) {
                        // Righto. Lets check which of these ids still is in cache:
                        $cacheIds = array();
                        // now, sort the ids to be deleted into two lists: in cache / to trash
                        $in_cache = array();
                        $to_trash = array();
                        foreach ($cids as $cid => $ids) {
                            $rsCache = rss_query("select itemsincache from " . getTable('channels') . " where id={$cid}");
                            list($idString) = rss_fetch_row($rsCache);
                            if ($idString) {
                                $cacheIds = unserialize($idString);
                            } else {
                                $cacheIds = array();
                            }
                            foreach ($ids as $iid) {
//.........这里部分代码省略.........
开发者ID:jphpsf,项目名称:gregarius,代码行数:101,代码来源:items.php

示例13: cleanUp

 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);
 }
开发者ID:nerdling,项目名称:gregarius,代码行数:13,代码来源:update.php

示例14: logout

 /**
  * Logs the user out.
  * - deletes the cookie
  * - removes the user's IP subnet from the list of valid subnets this
  *   user is allowed to log in with a cookie.
  */
 function logout()
 {
     if (array_key_exists(RSS_USER_COOKIE, $_COOKIE) || isset($_SESSION['mobile'])) {
         $subnet = preg_replace('#^([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+$#', '\\1', $_SERVER['REMOTE_ADDR']);
         if (($idx = array_search($subnet, $this->_validIPs)) !== FALSE) {
             $cnt = count($this->_validIPs);
             unset($this->_validIPs[$idx]);
             $uname = trim($this->_uname);
             if ($uname && $cnt > count($this->_validIPs)) {
                 $sql = "update " . getTable('users') . " set userips = '" . implode(' ', $this->_validIPs) . "'" . " where uname = '{$uname}' ";
                 rss_query($sql);
             }
         }
         // get rid of the cookie
         unset($_COOKIE[RSS_USER_COOKIE]);
         setcookie(RSS_USER_COOKIE, "", -1, getPath());
         if (isset($_SESSION['mobile'])) {
             unset($_SESSION['mobile']);
         }
         rss_invalidate_cache();
     }
 }
开发者ID:jphpsf,项目名称:gregarius,代码行数:28,代码来源:user.php

示例15: array

         $cats[$cid] = array();
     }
     $cats[$cid][] = $tag;
 }
 $sql = "select " . " c.id, c.title, c.url, c.siteurl, d.name, c.parent, c.descr " . " from " . getTable("channels") . " c " . " inner join " . getTable("folders") . " d on d.id = c.parent " . " where not (c.mode & " . RSS_MODE_DELETED_STATE . ") ";
 if (hidePrivate()) {
     $sql .= " and not(c.mode & " . RSS_MODE_PRIVATE_STATE . ") ";
 }
 // note: should we export deprecated feeds?
 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);
 $dateRes = rss_query("select max(dateadded) from " . getTable("channels"));
 list($dateModif) = rss_fetch_row($dateRes);
 $dateLabel = date("r", strtotime($dateModif));
 header("Content-Type: text/xml");
 echo "<?xml version=\"1.0\" encoding=\"" . getConfig('rss.output.encoding') . "\"?>\n" . "<?xml-stylesheet type=\"text/xsl\" href=\"" . getPath() . "css/opml.xsl\"?>\n" . "<!-- Generated by " . _TITLE_ . " " . _VERSION_ . " -->\n" . "<opml version=\"2.0\">\n";
 echo "\t<head>\n" . "\t\t<title>" . _TITLE_ . " OPML Feed</title>\n" . "\t\t<dateModified>{$dateLabel}</dateModified>\n" . "\t</head>\n" . "\t<body>\n";
 $prev_parent = 0;
 while (list($id, $title, $url, $siteurl, $name, $parent, $descr) = rss_fetch_row($res)) {
     $descr_ = htmlspecialchars($descr);
     $descr_ = trim(preg_replace('/(\\r\\n|\\r|\\n)/', ' ', $descr_));
     $title_ = htmlspecialchars($title);
     $url_ = preg_replace('|(https?://)([^:]+:[^@]+@)(.+)$|', '\\1\\3', $url);
     $url_ = htmlspecialchars($url_);
     $siteurl_ = preg_replace('|(https?://)([^:]+:[^@]+@)(.+)$|', '\\1\\3', $siteurl);
     $siteurl_ = htmlspecialchars($siteurl_);
     $name_ = htmlspecialchars($name);
开发者ID:jphpsf,项目名称:gregarius,代码行数:31,代码来源:opml.php


注:本文中的rss_query函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。