本文整理汇总了PHP中get_pref函数的典型用法代码示例。如果您正苦于以下问题:PHP get_pref函数的具体用法?PHP get_pref怎么用?PHP get_pref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_pref函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fb_close
function fb_close()
{
$theme = get_pref('theme');
$root_path = get_pref('root');
require 'themes/' . $theme . '/page_footer.fbt';
mysql_close;
}
开发者ID:BackupTheBerlios,项目名称:fireblog-svn,代码行数:7,代码来源:core.inc.php
示例2: hook_article_button
function hook_article_button($line)
{
if (!get_pref($this->link, "COMBINED_DISPLAY_MODE")) {
$rv = "<img src=\"" . theme_image($this->link, 'plugins/close_button/button.png') . "\"\n\t\t\t\tclass='tagsPic' style=\"cursor : pointer\"\n\t\t\t\tonclick=\"closeArticlePanel()\"\n\t\t\t\ttitle='" . __('Close article') . "'>";
}
return $rv;
}
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:7,代码来源:init.php
示例3: plugin_list
function plugin_list($message = '')
{
global $event;
pagetop(gTxt('tab_plugins'), $message);
echo '<h1 class="txp-heading">' . gTxt('tab_plugins') . '</h1>';
echo '<div id="' . $event . '_control" class="txp-control-panel">';
echo n . plugin_form() . n . '</div>';
extract(gpsa(array('sort', 'dir')));
if ($sort === '') {
$sort = get_pref('plugin_sort_column', 'name');
}
if ($dir === '') {
$dir = get_pref('plugin_sort_dir', 'asc');
}
$dir = $dir == 'desc' ? 'desc' : 'asc';
if (!in_array($sort, array('name', 'status', 'author', 'version', 'modified', 'load_order'))) {
$sort = 'name';
}
$sort_sql = $sort . ' ' . $dir;
set_pref('plugin_sort_column', $sort, 'plugin', 2, '', 0, PREF_PRIVATE);
set_pref('plugin_sort_dir', $dir, 'plugin', 2, '', 0, PREF_PRIVATE);
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$rs = safe_rows_start('name, status, author, author_uri, version, description, length(help) as help, abs(strcmp(md5(code),code_md5)) as modified, load_order, flags', 'txp_plugin', '1 order by ' . $sort_sql);
if ($rs and numRows($rs) > 0) {
echo n . '<div id="' . $event . '_container" class="txp-container">';
echo '<form action="index.php" id="plugin_form" class="multi_edit_form" method="post" name="longform">' . n . '<div class="txp-listtables">' . n . startTable('', '', 'txp-list') . n . '<thead>' . tr(n . hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' title="' . gTxt('toggle_all_selected') . '" class="multi-edit"') . n . column_head('plugin', 'name', 'plugin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'name') . n . column_head('author', 'author', 'plugin', true, $switch_dir, '', '', ('author' == $sort ? "{$dir} " : '') . 'author') . n . column_head('version', 'version', 'plugin', true, $switch_dir, '', '', ('version' == $sort ? "{$dir} " : '') . 'version') . n . column_head('plugin_modified', 'modified', 'plugin', true, $switch_dir, '', '', ('modified' == $sort ? "{$dir} " : '') . 'modified') . n . hCell(gTxt('description'), '', ' class="description"') . n . column_head('active', 'status', 'plugin', true, $switch_dir, '', '', ('status' == $sort ? "{$dir} " : '') . 'status') . n . column_head('order', 'load_order', 'plugin', true, $switch_dir, '', '', ('load_order' == $sort ? "{$dir} " : '') . 'load-order') . n . hCell(gTxt('manage'), '', ' class="manage actions"')) . n . '</thead>';
echo '<tbody>';
while ($a = nextRow($rs)) {
foreach ($a as $key => $value) {
${$key} = txpspecialchars($value);
}
// Fix up the description for clean cases
$description = preg_replace(array('#<br />#', '#<(/?(a|b|i|em|strong))>#', '#<a href="(https?|\\.|\\/|ftp)([A-Za-z0-9:/?.=_]+?)">#'), array('<br />', '<$1>', '<a href="$1$2">'), $description);
$help = !empty($help) ? '<a class="plugin-help" href="?event=plugin' . a . 'step=plugin_help' . a . 'name=' . urlencode($name) . '">' . gTxt('help') . '</a>' : '';
$plugin_prefs = $flags & PLUGIN_HAS_PREFS ? '<a class="plugin-prefs" href="?event=plugin_prefs.' . urlencode($name) . '">' . gTxt('plugin_prefs') . '</a>' : '';
$manage = array();
if ($help) {
$manage[] = $help;
}
if ($plugin_prefs) {
$manage[] = $plugin_prefs;
}
$manage_items = $manage ? join(tag(sp . '|' . sp, 'span'), $manage) : '-';
$edit_url = eLink('plugin', 'plugin_edit', 'name', $name, $name);
echo tr(n . td(fInput('checkbox', 'selected[]', $name), '', 'multi-edit') . td($edit_url, '', 'name') . td(href($author, $author_uri, ' rel="external"'), '', 'author') . td($version, '', 'version') . td($modified ? '<span class="warning">' . gTxt('yes') . '</span>' : '', '', 'modified') . td($description, '', 'description') . td(status_link($status, $name, yes_no($status)), '', 'status') . td($load_order, '', 'load-order') . td($manage_items, '', 'manage'), $status ? ' class="active"' : '');
unset($name, $page, $deletelink);
}
echo '</tbody>', n, endTable(), n, '</div>', n, plugin_multiedit_form('', $sort, $dir, '', ''), n, tInput(), n, '</form>', n, '</div>';
// Show/hide "Options" link by setting the appropriate class on the plugins TR
echo script_js(<<<EOS
textpattern.Relay.register('txpAsyncHref.success', function(event, data) {
\t\$(data['this']).closest('tr').toggleClass('active');
});
EOS
);
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:57,代码来源:txp_plugin.php
示例4: plugin_list
/**
* The main panel listing all installed plugins.
*
* @param string|array $message The activity message
*/
function plugin_list($message = '')
{
global $event;
pagetop(gTxt('tab_plugins'), $message);
extract(gpsa(array('sort', 'dir')));
if ($sort === '') {
$sort = get_pref('plugin_sort_column', 'name');
} else {
if (!in_array($sort, array('name', 'status', 'author', 'version', 'modified', 'load_order'))) {
$sort = 'name';
}
set_pref('plugin_sort_column', $sort, 'plugin', 2, '', 0, PREF_PRIVATE);
}
if ($dir === '') {
$dir = get_pref('plugin_sort_dir', 'asc');
} else {
$dir = $dir == 'desc' ? "desc" : "asc";
set_pref('plugin_sort_dir', $dir, 'plugin', 2, '', 0, PREF_PRIVATE);
}
$sort_sql = "{$sort} {$dir}";
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
echo n . tag(hed(gTxt('tab_plugins'), 1, array('class' => 'txp-heading')), 'div', array('class' => 'txp-layout-2col-cell-1')) . n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => $event . '_container')) . n . tag(plugin_form(), 'div', array('class' => 'txp-control-panel'));
$rs = safe_rows_start("name, status, author, author_uri, version, description, length(help) AS help, ABS(STRCMP(MD5(code), code_md5)) AS modified, load_order, flags", 'txp_plugin', "1 = 1 ORDER BY {$sort_sql}");
if ($rs and numRows($rs) > 0) {
echo n . tag_start('form', array('class' => 'multi_edit_form', 'id' => 'plugin_form', 'name' => 'longform', 'method' => 'post', 'action' => 'index.php')) . n . tag_start('div', array('class' => 'txp-listtables')) . n . tag_start('table', array('class' => 'txp-list')) . n . tag_start('thead') . tr(hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' class="txp-list-col-multi-edit" scope="col" title="' . gTxt('toggle_all_selected') . '"') . column_head('plugin', 'name', 'plugin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-name') . column_head('author', 'author', 'plugin', true, $switch_dir, '', '', ('author' == $sort ? "{$dir} " : '') . 'txp-list-col-author') . column_head('version', 'version', 'plugin', true, $switch_dir, '', '', ('version' == $sort ? "{$dir} " : '') . 'txp-list-col-version') . column_head('plugin_modified', 'modified', 'plugin', true, $switch_dir, '', '', ('modified' == $sort ? "{$dir} " : '') . 'txp-list-col-modified') . hCell(gTxt('description'), '', ' class="txp-list-col-description" scope="col"') . column_head('active', 'status', 'plugin', true, $switch_dir, '', '', ('status' == $sort ? "{$dir} " : '') . 'txp-list-col-status') . column_head('order', 'load_order', 'plugin', true, $switch_dir, '', '', ('load_order' == $sort ? "{$dir} " : '') . 'txp-list-col-load-order') . hCell(gTxt('manage'), '', ' class="txp-list-col-manage" scope="col"')) . n . tag_end('thead') . n . tag_start('tbody');
while ($a = nextRow($rs)) {
foreach ($a as $key => $value) {
${$key} = txpspecialchars($value);
}
// Fix up the description for clean cases.
$description = preg_replace(array('#<br />#', '#<(/?(a|b|i|em|strong))>#', '#<a href="(https?|\\.|\\/|ftp)([A-Za-z0-9:/?.=_]+?)">#'), array('<br />', '<$1>', '<a href="$1$2">'), $description);
if (!empty($help)) {
$help = href(gTxt('help'), array('event' => 'plugin', 'step' => 'plugin_help', 'name' => $name), array('class' => 'plugin-help'));
}
if ($flags & PLUGIN_HAS_PREFS) {
$plugin_prefs = href(gTxt('plugin_prefs'), array('event' => 'plugin_prefs.' . $name), array('class' => 'plugin-prefs'));
} else {
$plugin_prefs = '';
}
$manage = array();
if ($help) {
$manage[] = $help;
}
if ($plugin_prefs) {
$manage[] = $plugin_prefs;
}
$manage_items = $manage ? join(tag(sp . '|' . sp, 'span'), $manage) : '-';
$edit_url = eLink('plugin', 'plugin_edit', 'name', $name, $name);
echo tr(td(fInput('checkbox', 'selected[]', $name), '', 'txp-list-col-multi-edit') . hCell($edit_url, '', ' class="txp-list-col-name" scope="row"') . td(href($author, $a['author_uri'], array('rel' => 'external')), '', 'txp-list-col-author') . td($version, '', 'txp-list-col-version') . td($modified ? span(gTxt('yes'), array('class' => 'warning')) : '', '', 'txp-list-col-modified') . td($description, '', 'txp-list-col-description') . td(status_link($status, $name, yes_no($status)), '', 'txp-list-col-status') . td($load_order, '', 'txp-list-col-load-order') . td($manage_items, '', 'txp-list-col-manage'), $status ? ' class="active"' : '');
unset($name, $page, $deletelink);
}
echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . plugin_multiedit_form('', $sort, $dir, '', '') . tInput() . n . tag_end('form');
}
echo n . tag_end('div');
}
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:60,代码来源:txp_plugin.php
示例5: textileRestricted
/**
* Parses content in a restricted mode.
*
* @param string|null $text The input document in textile format
* @param bool|null $lite Optional flag to switch the parser into lite mode
* @param bool|null $noimage Optional flag controlling the conversion of images into HTML img tags
* @param string|null $rel Relationship to apply to all generated links
* @return string The text from the input document
*/
public function textileRestricted($text, $lite = null, $noimage = null, $rel = null)
{
if ($lite === null) {
$lite = get_pref('comments_use_fat_textile', 1);
}
if ($noimage === null) {
$noimage = get_pref('comments_disallow_images', 1);
}
if ($rel === null && get_pref('comment_nofollow', 1)) {
$rel = 'nofollow';
}
return parent::textileRestricted($text, $lite, $noimage, $rel);
}
开发者ID:hcgtv,项目名称:textpattern,代码行数:22,代码来源:Parser.php
示例6: __construct
/**
* Constructor.
*
* Creates core Textfilters according to a preference and registers all
* available filters with the core.
*
* This method triggers 'textfilter.register' callback
* event.
*/
public function __construct()
{
if ($filters = get_pref('admin_textfilter_classes')) {
foreach (do_list($filters) as $filter) {
new $filter();
}
} else {
new Plain();
new Nl2Br();
new Textile();
}
$this->filters = array();
callback_event('textfilter', 'register', 0, $this);
}
开发者ID:scar45,项目名称:textpattern,代码行数:23,代码来源:Registry.php
示例7: opml_export
function opml_export($link, $owner_uid, $hide_private_feeds = False)
{
header("Content-type: application/xml+opml");
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
print "<opml version=\"1.0\">";
print "<head>\n\t\t\t<dateCreated>" . date("r", time()) . "</dateCreated>\n\t\t\t<title>Tiny Tiny RSS Feed Export</title>\n\t\t</head>";
print "<body>";
$cat_mode = false;
$select = "SELECT * ";
$where = "WHERE owner_uid = '{$owner_uid}'";
$orderby = "ORDER BY title";
if ($hide_private_feeds) {
$where = "WHERE owner_uid = '{$owner_uid}' AND private IS false";
}
if (get_pref($link, 'ENABLE_FEED_CATS')) {
$cat_mode = true;
$select = "SELECT \n\t\t\t\ttitle, feed_url, site_url,\n\t\t\t\t(SELECT title FROM ttrss_feed_categories WHERE id = cat_id) as cat_title";
$orderby = "ORDER BY cat_title, title";
}
$result = db_query($link, $select . " FROM ttrss_feeds " . $where . " " . $orderby);
$old_cat_title = "";
while ($line = db_fetch_assoc($result)) {
$title = htmlspecialchars($line["title"]);
$url = htmlspecialchars($line["feed_url"]);
$site_url = htmlspecialchars($line["site_url"]);
if ($cat_mode) {
$cat_title = htmlspecialchars($line["cat_title"]);
if ($old_cat_title != $cat_title) {
if ($old_cat_title) {
print "</outline>\n";
}
if ($cat_title) {
print "<outline title=\"{$cat_title}\">\n";
}
$old_cat_title = $cat_title;
}
}
if ($site_url) {
$html_url_qpart = "htmlUrl=\"{$site_url}\"";
} else {
$html_url_qpart = "";
}
print "<outline text=\"{$title}\" xmlUrl=\"{$url}\" {$html_url_qpart}/>\n";
}
if ($cat_mode && $old_cat_title) {
print "</outline>\n";
}
print "</body></opml>";
}
开发者ID:buggithubs,项目名称:Tiny-Tiny-RSS,代码行数:49,代码来源:opml.php
示例8: ccache_update_all
function ccache_update_all($owner_uid)
{
if (get_pref('ENABLE_FEED_CATS', $owner_uid)) {
$result = db_query("SELECT feed_id FROM ttrss_cat_counters_cache\n WHERE feed_id > 0 AND owner_uid = '{$owner_uid}'");
while ($line = db_fetch_assoc($result)) {
ccache_update($line["feed_id"], $owner_uid, true);
}
/* We have to manually include category 0 */
ccache_update(0, $owner_uid, true);
} else {
$result = db_query("SELECT feed_id FROM ttrss_counters_cache\n WHERE feed_id > 0 AND owner_uid = '{$owner_uid}'");
while ($line = db_fetch_assoc($result)) {
print ccache_update($line["feed_id"], $owner_uid);
}
}
}
开发者ID:adrianpietka,项目名称:bfrss,代码行数:16,代码来源:ccache.php
示例9: sed_das_article
function sed_das_article($evt, $stp, $data, $rs)
{
global $step;
$js = '';
if (in_array($step, array('', 'create'))) {
$level = get_pref(sed_das_prefix . '_default_status', '4');
$js = <<<EOJS
<script type="text/javascript">
jQuery(function() {
\tjQuery('input[id="status-{$level}"]').prop('checked', true);
});
</script>
EOJS;
}
return $data . $js;
}
开发者ID:netcarver,项目名称:sed_default_article_status,代码行数:16,代码来源:sed_default_article_status.php
示例10: init
function init($name = '')
{
static $instance;
if ($name === '') {
$name = pluggable_ui('admin_side', 'theme_name', get_pref('theme_name', 'classic'));
}
if ($instance && is_object($instance) && $name == $instance->name) {
return $instance;
} else {
$instance = null;
}
$instance = theme::factory($name);
if (!$instance) {
set_pref('theme_name', 'classic');
die(gTxt('cannot_instantiate_theme', array('{name}' => $name, '{class}' => "{$name}_theme", '{path}' => theme::path($name))));
}
return $instance;
}
开发者ID:psic,项目名称:websites,代码行数:18,代码来源:txplib_theme.php
示例11: page_edit
function page_edit($message = '')
{
global $event, $step;
pagetop(gTxt('edit_pages'), $message);
extract(gpsa(array('name', 'newname', 'copy', 'savenew')));
if ($step == 'page_delete' || empty($name) && $step != 'page_new' && !$savenew) {
$name = safe_field('page', 'txp_section', "name = 'default'");
} elseif (($copy || $savenew) && trim(preg_replace('/[<>&"\']/', '', $newname))) {
$name = $newname;
}
// Format of each entry is popTagLink -> array ( gTxt() string, class/ID)
$tagbuild_items = array('page_article' => array('page_article_hed', 'article-tags'), 'page_article_nav' => array('page_article_nav_hed', 'article-nav-tags'), 'page_nav' => array('page_nav_hed', 'nav-tags'), 'page_xml' => array('page_xml_hed', 'xml-tags'), 'page_misc' => array('page_misc_hed', 'misc-tags'), 'page_file' => array('page_file_hed', 'file-tags'));
$tagbuild_options = '';
foreach ($tagbuild_items as $tb => $item) {
$tagbuild_options .= n . n . '<div class="' . $item[1] . '">' . hed('<a href="#' . $item[1] . '">' . gTxt($item[0]) . '</a>', 3, ' class="plain lever' . (get_pref('pane_page_' . $item[1] . '_visible') ? ' expanded' : '') . '"') . n . '<div id="' . $item[1] . '" class="toggle" style="display:' . (get_pref('pane_page_' . $item[1] . '_visible') ? 'block' : 'none') . '">' . taglinks($tb) . '</div></div>';
}
echo '<div id="' . $event . '_container" class="txp-container txp-edit">' . startTable('edit', '', 'edit-pane') . tr(tda('<div id="tagbuild_links">' . n . hed(gTxt('tagbuilder'), 2) . $tagbuild_options . n . '</div>', ' class="column"') . tda(page_edit_form($name), ' class="column"') . tda('<div id="content_switcher">' . hed(gTxt('all_pages'), 2) . graf(sLink('page', 'page_new', gTxt('create_new_page')), ' class="action-create smallerbox"') . page_list($name) . '</div>', ' class="column"')) . endTable() . '</div>';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:18,代码来源:txp_page.php
示例12: plugin_list
function plugin_list($message = '')
{
global $event;
pagetop(gTxt('edit_plugins'), $message);
echo '<div id="' . $event . '_control" class="txp-control-panel">';
echo n . n . startTable('edit', '', 'plugin-install') . tr(tda(plugin_form(), ' colspan="8" style="height: 30px; border: none;"')) . endTable() . '</div>';
extract(gpsa(array('sort', 'dir')));
if ($sort === '') {
$sort = get_pref('plugin_sort_column', 'name');
}
if ($dir === '') {
$dir = get_pref('plugin_sort_dir', 'asc');
}
$dir = $dir == 'desc' ? 'desc' : 'asc';
if (!in_array($sort, array('name', 'status', 'author', 'version', 'modified', 'load_order'))) {
$sort = 'name';
}
$sort_sql = $sort . ' ' . $dir;
set_pref('plugin_sort_column', $sort, 'plugin', 2, '', 0, PREF_PRIVATE);
set_pref('plugin_sort_dir', $dir, 'plugin', 2, '', 0, PREF_PRIVATE);
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$rs = safe_rows_start('name, status, author, author_uri, version, description, length(help) as help, abs(strcmp(md5(code),code_md5)) as modified, load_order, flags', 'txp_plugin', '1 order by ' . $sort_sql);
if ($rs and numRows($rs) > 0) {
echo n . '<div id="' . $event . '_container" class="txp-container txp-list">';
echo '<form action="index.php" id="plugin_form" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . startTable('list', '', 'list') . n . '<thead>' . tr(column_head('plugin', 'name', 'plugin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'name') . column_head('author', 'author', 'plugin', true, $switch_dir, '', '', ('author' == $sort ? "{$dir} " : '') . 'author') . column_head('version', 'version', 'plugin', true, $switch_dir, '', '', ('version' == $sort ? "{$dir} " : '') . 'version') . column_head('plugin_modified', 'modified', 'plugin', true, $switch_dir, '', '', ('modified' == $sort ? "{$dir} " : '') . 'modified') . hCell(gTxt('description'), '', ' class="description"') . column_head('active', 'status', 'plugin', true, $switch_dir, '', '', ('status' == $sort ? "{$dir} " : '') . 'status') . column_head('order', 'load_order', 'plugin', true, $switch_dir, '', '', ('load_order' == $sort ? "{$dir} " : '') . 'load-order') . hCell(gTxt('manage'), '', ' class="manage actions"') . hCell('', '', ' class="multi-edit"')) . n . '</thead>';
$tfoot = n . '<tfoot>' . tr(tda(select_buttons() . plugin_multiedit_form('', $sort, $dir, '', ''), ' class="multi-edit" colspan="10" style="text-align: right; border: none;"')) . n . '</tfoot>';
echo $tfoot;
echo '<tbody>';
$ctr = 1;
while ($a = nextRow($rs)) {
foreach ($a as $key => $value) {
${$key} = htmlspecialchars($value);
}
// Fix up the description for clean cases
$description = preg_replace(array('#<br />#', '#<(/?(a|b|i|em|strong))>#', '#<a href="(https?|\\.|\\/|ftp)([A-Za-z0-9:/?.=_]+?)">#'), array('<br />', '<$1>', '<a href="$1$2">'), $description);
$help = !empty($help) ? n . t . '<li class="action-view"><a href="?event=plugin' . a . 'step=plugin_help' . a . 'name=' . urlencode($name) . '">' . gTxt('help') . '</a></li>' : '';
$plugin_prefs = $flags & PLUGIN_HAS_PREFS && $status ? n . t . '<li class="action-options"><a href="?event=plugin_prefs.' . urlencode($name) . '">' . gTxt('plugin_prefs') . '</a></li>' : '';
echo tr(n . td($name, '', 'name') . td(href($author, $author_uri), '', 'author') . td($version, 10, 'version') . td($modified ? gTxt('yes') : '', '', 'modified') . td($description, 260, 'description') . td(status_link($status, $name, yes_no($status)), 30, 'status') . td($load_order, '', 'load-order') . td(n . '<ul class="actions">' . $help . n . t . '<li class="action-edit">' . eLink('plugin', 'plugin_edit', 'name', $name, gTxt('edit')) . '</li>' . $plugin_prefs . n . '</ul>', '', 'manage') . td(fInput('checkbox', 'selected[]', $name), 30, 'multi-edit'), ' class="' . ($ctr % 2 == 0 ? 'even' : 'odd') . '"');
$ctr++;
unset($name, $page, $deletelink);
}
echo '</tbody>' . n . endTable() . n . '</form>' . n . '</div>';
}
}
开发者ID:psic,项目名称:websites,代码行数:44,代码来源:txp_plugin.php
示例13: init
function init($name = '')
{
static $instance;
if (empty($name)) {
$name = pluggable_ui('admin_side', 'theme_name', get_pref('theme_name', 'classic'));
}
if ($instance && is_object($instance) && $name == $instance->name) {
return $instance;
} else {
$instance = null;
}
$path = txpath . DS . THEME . DS . $name . DS . $name . '.php';
if (is_file($path)) {
require_once $path;
} else {
$name = 'classic';
set_pref('theme_name', $name);
require_once txpath . DS . THEME . DS . $name . DS . $name . '.php';
}
$t = "{$name}_theme";
$instance = new $t($name);
return $instance;
}
开发者ID:joebushi,项目名称:textpattern,代码行数:23,代码来源:txplib_theme.php
示例14: module_pref_prefs
function module_pref_prefs($link)
{
global $access_level_names;
$subop = $_REQUEST["subop"];
$prefs_blacklist = array("HIDE_FEEDLIST", "SYNC_COUNTERS", "ENABLE_LABELS", "ENABLE_SEARCH_TOOLBAR", "HIDE_READ_FEEDS");
$profile_blacklist = array("ALLOW_DUPLICATE_POSTS", "PURGE_OLD_DAYS", "PURGE_UNREAD_ARTICLES", "DIGEST_ENABLE", "DIGEST_CATCHUP", "BLACKLISTED_TAGS", "ENABLE_FEED_ICONS", "ENABLE_API_ACCESS", "UPDATE_POST_ON_CHECKSUM_CHANGE", "DEFAULT_UPDATE_INTERVAL", "MARK_UNREAD_ON_UPDATE");
if (FORCE_ARTICLE_PURGE != 0) {
array_push($prefs_blacklist, "PURGE_OLD_DAYS");
array_push($prefs_blacklist, "PURGE_UNREAD_ARTICLES");
}
if ($subop == "change-password") {
$old_pw = $_POST["OLD_PASSWORD"];
$new_pw = $_POST["NEW_PASSWORD"];
$con_pw = $_POST["CONFIRM_PASSWORD"];
if ($old_pw == "") {
print "ERROR: " . __("Old password cannot be blank.");
return;
}
if ($new_pw == "") {
print "ERROR: " . __("New password cannot be blank.");
return;
}
if ($new_pw != $con_pw) {
print "ERROR: " . __("Entered passwords do not match.");
return;
}
$old_pw_hash1 = encrypt_password($_POST["OLD_PASSWORD"]);
$old_pw_hash2 = encrypt_password($_POST["OLD_PASSWORD"], $_SESSION["name"]);
$new_pw_hash = encrypt_password($_POST["NEW_PASSWORD"], $_SESSION["name"]);
$active_uid = $_SESSION["uid"];
if ($old_pw && $new_pw) {
$login = db_escape_string($_SERVER['PHP_AUTH_USER']);
$result = db_query($link, "SELECT id FROM ttrss_users WHERE \n\t\t\t\t\tid = '{$active_uid}' AND (pwd_hash = '{$old_pw_hash1}' OR \n\t\t\t\t\t\tpwd_hash = '{$old_pw_hash2}')");
if (db_num_rows($result) == 1) {
db_query($link, "UPDATE ttrss_users SET pwd_hash = '{$new_pw_hash}' \n\t\t\t\t\t\tWHERE id = '{$active_uid}'");
$_SESSION["pwd_hash"] = $new_pw_hash;
print __("Password has been changed.");
} else {
print "ERROR: " . __('Old password is incorrect.');
}
}
return;
} else {
if ($subop == "save-config") {
# $_SESSION["prefs_op_result"] = "save-config";
$_SESSION["prefs_cache"] = false;
// print_r($_POST);
$orig_theme = get_pref($link, "_THEME_ID");
foreach (array_keys($_POST) as $pref_name) {
$pref_name = db_escape_string($pref_name);
$value = db_escape_string($_POST[$pref_name]);
set_pref($link, $pref_name, $value);
}
if ($orig_theme != get_pref($link, "_THEME_ID")) {
print "PREFS_THEME_CHANGED";
} else {
print __("The configuration was saved.");
}
return;
} else {
if ($subop == "getHelp") {
$pref_name = db_escape_string($_REQUEST["pn"]);
$result = db_query($link, "SELECT help_text FROM ttrss_prefs\n\t\t\t\tWHERE pref_name = '{$pref_name}'");
if (db_num_rows($result) > 0) {
$help_text = db_fetch_result($result, 0, "help_text");
print $help_text;
} else {
printf(__("Unknown option: %s"), $pref_name);
}
} else {
if ($subop == "change-email") {
$email = db_escape_string($_POST["email"]);
$active_uid = $_SESSION["uid"];
db_query($link, "UPDATE ttrss_users SET email = '{$email}' \n\t\t\t\tWHERE id = '{$active_uid}'");
print __("E-mail has been changed.");
return;
} else {
if ($subop == "reset-config") {
$_SESSION["prefs_op_result"] = "reset-to-defaults";
if ($_SESSION["profile"]) {
$profile_qpart = "profile = '" . $_SESSION["profile"] . "'";
} else {
$profile_qpart = "profile IS NULL";
}
db_query($link, "DELETE FROM ttrss_user_prefs \n\t\t\t\tWHERE {$profile_qpart} AND owner_uid = " . $_SESSION["uid"]);
initialize_user_prefs($link, $_SESSION["uid"], $_SESSION["profile"]);
print "PREFS_THEME_CHANGED";
// print __("The configuration was reset to defaults.");
return;
} else {
set_pref($link, "_PREFS_ACTIVE_TAB", "genConfig");
if ($_SESSION["profile"]) {
print_notice("Some preferences are only available in default profile.");
}
if (!SINGLE_USER_MODE) {
$result = db_query($link, "SELECT id FROM ttrss_users\n\t\t\t\t\tWHERE id = " . $_SESSION["uid"] . " AND pwd_hash \n\t\t\t\t\t= 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'");
if (db_num_rows($result) != 0) {
print format_warning(__("Your password is at default value, \n\t\t\t\t\t\tplease change it."), "default_pass_warning");
}
/* if ($_SESSION["pwd_change_result"] == "failed") {
//.........这里部分代码省略.........
开发者ID:buggithubs,项目名称:Tiny-Tiny-RSS,代码行数:101,代码来源:pref-prefs.php
示例15: update_rss_feed
function update_rss_feed($feed, $ignore_daemon = false, $no_cache = false)
{
$debug_enabled = defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug'];
_debug("start", $debug_enabled);
$result = db_query("SELECT id,update_interval,auth_login,\n\t\t\tfeed_url,auth_pass,cache_images,last_updated,\n\t\t\tmark_unread_on_update, owner_uid,\n\t\t\tpubsub_state, auth_pass_encrypted,\n\t\t\t(SELECT max(date_entered) FROM\n\t\t\t\tttrss_entries, ttrss_user_entries where ref_id = id AND feed_id = '{$feed}') AS last_article_timestamp\n\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'");
if (db_num_rows($result) == 0) {
_debug("feed {$feed} NOT FOUND/SKIPPED", $debug_enabled);
return false;
}
$last_updated = db_fetch_result($result, 0, "last_updated");
$last_article_timestamp = @strtotime(db_fetch_result($result, 0, "last_article_timestamp"));
if (defined('_DISABLE_HTTP_304')) {
$last_article_timestamp = 0;
}
$owner_uid = db_fetch_result($result, 0, "owner_uid");
$mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
$pubsub_state = db_fetch_result($result, 0, "pubsub_state");
$auth_pass_encrypted = sql_bool_to_bool(db_fetch_result($result, 0, "auth_pass_encrypted"));
db_query("UPDATE ttrss_feeds SET last_update_started = NOW()\n\t\t\tWHERE id = '{$feed}'");
$auth_login = db_fetch_result($result, 0, "auth_login");
$auth_pass = db_fetch_result($result, 0, "auth_pass");
if ($auth_pass_encrypted) {
require_once "crypt.php";
$auth_pass = decrypt_string($auth_pass);
}
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
$fetch_url = db_fetch_result($result, 0, "feed_url");
$feed = db_escape_string($feed);
$date_feed_processed = date('Y-m-d H:i');
$cache_filename = CACHE_DIR . "/simplepie/" . sha1($fetch_url) . ".xml";
$pluginhost = new PluginHost();
$pluginhost->set_debug($debug_enabled);
$user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid);
$pluginhost->load(PLUGINS, PluginHost::KIND_ALL);
$pluginhost->load($user_plugins, PluginHost::KIND_USER, $owner_uid);
$pluginhost->load_data();
$rss = false;
$rss_hash = false;
$force_refetch = isset($_REQUEST["force_refetch"]);
if (file_exists($cache_filename) && is_readable($cache_filename) && !$auth_login && !$auth_pass && filemtime($cache_filename) > time() - 30) {
_debug("using local cache.", $debug_enabled);
@($feed_data = file_get_contents($cache_filename));
if ($feed_data) {
$rss_hash = sha1($feed_data);
}
} else {
_debug("local cache will not be used for this feed", $debug_enabled);
}
if (!$rss) {
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FETCH_FEED) as $plugin) {
$feed_data = $plugin->hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed);
}
if (!$feed_data) {
_debug("fetching [{$fetch_url}]...", $debug_enabled);
_debug("If-Modified-Since: " . gmdate('D, d M Y H:i:s \\G\\M\\T', $last_article_timestamp), $debug_enabled);
$feed_data = fetch_file_contents($fetch_url, false, $auth_login, $auth_pass, false, $no_cache ? FEED_FETCH_NO_CACHE_TIMEOUT : FEED_FETCH_TIMEOUT, $force_refetch ? 0 : $last_article_timestamp);
global $fetch_curl_used;
if (!$fetch_curl_used) {
$tmp = @gzdecode($feed_data);
if ($tmp) {
$feed_data = $tmp;
}
}
$feed_data = trim($feed_data);
_debug("fetch done.", $debug_enabled);
/* if ($feed_data) {
$error = verify_feed_xml($feed_data);
if ($error) {
_debug("error verifying XML, code: " . $error->code, $debug_enabled);
if ($error->code == 26) {
_debug("got error 26, trying to decode entities...", $debug_enabled);
$feed_data = html_entity_decode($feed_data, ENT_COMPAT, 'UTF-8');
$error = verify_feed_xml($feed_data);
if ($error) $feed_data = '';
}
}
} */
}
if (!$feed_data) {
global $fetch_last_error;
global $fetch_last_error_code;
_debug("unable to fetch: {$fetch_last_error} [{$fetch_last_error_code}]", $debug_enabled);
$error_escaped = '';
// If-Modified-Since
if ($fetch_last_error_code != 304) {
$error_escaped = db_escape_string($fetch_last_error);
} else {
_debug("source claims data not modified, nothing to do.", $debug_enabled);
}
db_query("UPDATE ttrss_feeds SET last_error = '{$error_escaped}',\n\t\t\t\t\t\tlast_updated = NOW() WHERE id = '{$feed}'");
return;
}
}
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) {
$feed_data = $plugin->hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed);
//.........这里部分代码省略.........
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:101,代码来源:rssfuncs.php
示例16: log_list
function log_list($message = '')
{
global $event, $log_list_pageby, $expire_logs_after;
pagetop(gTxt('visitor_logs'), $message);
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('log_sort_column', 'time');
}
if ($dir === '') {
$dir = get_pref('log_sort_dir', 'desc');
}
$dir = $dir == 'asc' ? 'asc' : 'desc';
$expire_logs_after = assert_int($expire_logs_after);
safe_delete('txp_log', "time < date_sub(now(), interval {$expire_logs_after} day)");
switch ($sort) {
case 'ip':
$sort_sql = 'ip ' . $dir;
break;
case 'host':
$sort_sql = 'host ' . $dir;
break;
case 'page':
$sort_sql = 'page ' . $dir;
break;
case 'refer':
$sort_sql = 'refer ' . $dir;
break;
case 'method':
$sort_sql = 'method ' . $dir;
break;
case 'status':
$sort_sql = 'status ' . $dir;
break;
default:
$sort = 'time';
$sort_sql = 'time ' . $dir;
break;
}
set_pref('log_sort_column', $sort, 'log', 2, '', 0, PREF_PRIVATE);
set_pref('log_sort_dir', $dir, 'log', 2, '', 0, PREF_PRIVATE);
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$criteria = 1;
if ($search_method and $crit) {
$crit_escaped = doSlash(str_replace(array('\\', '%', '_', '\''), array('\\\\', '\\%', '\\_', '\\\''), $crit));
$critsql = array('ip' => "ip like '%{$crit_escaped}%'", 'host' => "host like '%{$crit_escaped}%'", 'page' => "page like '%{$crit_escaped}%'", 'refer' => "refer like '%{$crit_escaped}%'", 'method' => "method like '%{$crit_escaped}%'", 'status' => "status like '%{$crit_escaped}%'");
if (array_key_exists($search_method, $critsql)) {
$criteria = $critsql[$search_method];
$limit = 500;
} else {
$search_method = '';
$crit = '';
}
} else {
$search_method = '';
$crit = '';
}
$total = safe_count('txp_log', "{$criteria}");
echo '<div id="' . $event . '_control" class="txp-control-panel">';
if ($total < 1) {
if ($criteria != 1) {
echo n . log_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
} else {
echo graf(gTxt('no_refers_recorded'), ' class="indicator"') . '</div>';
}
return;
}
$limit = max($log_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo n . log_search_form($crit, $search_method) . '</div>';
$rs = safe_rows_start('*, unix_timestamp(time) as uTime', 'txp_log', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
if ($rs) {
echo n . '<div id="' . $event . '_container" class="txp-container txp-list">';
echo n . n . '<form action="index.php" id="log_form" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . startTable('list', '', 'list', '', '90%') . n . '<thead>' . n . tr(n . column_head('time', 'time', 'log', true, $switch_dir, $crit, $search_method, ('time' == $sort ? "{$dir} " : '') . 'date time') . column_head('IP', 'ip', 'log', true, $switch_dir, $crit, $search_method, ('ip' == $sort ? "{$dir} " : '') . 'log_detail ip') . column_head('host', 'host', 'log', true, $switch_dir, $crit, $search_method, ('host' == $sort ? "{$dir} " : '') . 'host') . column_head('page', 'page', 'log', true, $switch_dir, $crit, $search_method, ('page' == $sort ? "{$dir} " : '') . 'page') . column_head('referrer', 'refer', 'log', true, $switch_dir, $crit, $search_method, ('refer' == $sort ? "{$dir} " : '') . 'refer') . column_head('method', 'method', 'log', true, $switch_dir, $crit, $search_method, ('method' == $sort ? "{$dir} " : '') . 'log_detail method') . column_head('status', 'status', 'log', true, $switch_dir, $crit, $search_method, ('status' == $sort ? "{$dir} " : '') . 'log_detail status') . hCell('', '', ' class="multi-edit"')) . n . '</thead>';
$tfoot = n . '<tfoot>' . tr(tda(toggle_box('log_detail'), ' class="detail-toggle" colspan="2" style="text-align: left; border: none;"') . tda(select_buttons() . log_multiedit_form($page, $sort, $dir, $crit, $search_method), ' class="multi-edit" colspan="6" style="text-align: right; border: none;"')) . n . '</tfoot>';
echo $tfoot;
echo '<tbody>';
$ctr = 1;
while ($a = nextRow($rs)) {
extract($a, EXTR_PREFIX_ALL, 'log');
if ($log_refer) {
$log_refer = 'http://' . $log_refer;
$log_refer = '<a href="' . htmlspecialchars($log_refer) . '" target="_blank">' . htmlspecialchars(soft_wrap($log_refer, 30)) . '</a>';
}
if ($log_page) {
$log_anchor = preg_replace('/\\/$/', '', $l
|
请发表评论