本文整理汇总了PHP中print_notice函数的典型用法代码示例。如果您正苦于以下问题:PHP print_notice函数的具体用法?PHP print_notice怎么用?PHP print_notice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_notice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: performUpdateTo
function performUpdateTo($version, $html_output = true)
{
if ($this->getSchemaVersion() == $version - 1) {
$lines = $this->getSchemaLines($version);
if (is_array($lines)) {
db_query("BEGIN");
foreach ($lines as $line) {
if (strpos($line, "--") !== 0 && $line) {
if (!db_query($line, false)) {
if ($html_output) {
print_notice("Query: {$line}");
print_error("Error: " . db_last_query_error());
} else {
_debug("Query: {$line}");
_debug("Error: " . db_last_query_error());
}
return false;
}
}
}
$db_version = $this->getSchemaVersion();
if ($db_version == $version) {
db_query("COMMIT");
return true;
} else {
db_query("ROLLBACK");
return false;
}
} else {
return true;
}
} else {
return false;
}
}
示例2: index
function index()
{
print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Error Log') . "\">";
if (LOG_DESTINATION == "sql") {
$result = $this->dbh->query("SELECT errno, errstr, filename, lineno,\n\t\t\t\tcreated_at, login FROM ttrss_error_log\n\t\t\t\tLEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id)\n\t\t\t\tORDER BY ttrss_error_log.id DESC\n\t\t\t\tLIMIT 100");
print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"updateSystemList()\">" . __('Refresh') . "</button> ";
print " <button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"clearSqlLog()\">" . __('Clear log') . "</button> ";
print "<p><table width=\"100%\" cellspacing=\"10\" class=\"prefErrorLog\">";
print "<tr class=\"title\">\n\t\t\t\t<td width='5%'>" . __("Error") . "</td>\n\t\t\t\t<td>" . __("Filename") . "</td>\n\t\t\t\t<td>" . __("Message") . "</td>\n\t\t\t\t<td width='5%'>" . __("User") . "</td>\n\t\t\t\t<td width='5%'>" . __("Date") . "</td>\n\t\t\t\t</tr>";
while ($line = $this->dbh->fetch_assoc($result)) {
print "<tr class=\"errrow\">";
foreach ($line as $k => $v) {
$line[$k] = htmlspecialchars($v);
}
print "<td class='errno'>" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")</td>";
print "<td class='filename'>" . $line["filename"] . ":" . $line["lineno"] . "</td>";
print "<td class='errstr'>" . $line["errstr"] . "</td>";
print "<td class='login'>" . $line["login"] . "</td>";
print "<td class='timestamp'>" . make_local_datetime($line["created_at"], false) . "</td>";
print "</tr>";
}
print "</table>";
} else {
print_notice("Please set LOG_DESTINATION to 'sql' in config.php to enable database logging.");
}
print "</div>";
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefSystem");
print "</div>";
#container
}
示例3: hook_prefs_tab
function hook_prefs_tab($args)
{
if ($args != "prefFeeds") {
return;
}
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('af_readability settings') . "\">";
print_notice("Enable the plugin for specific feeds in the feed editor.");
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\t\tevt.preventDefault();\n\t\t\tif (this.validate()) {\n\t\t\t\tconsole.log(dojo.objectToQuery(this.getValues()));\n\t\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\t\tnotify_info(transport.responseText);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//this.reset();\n\t\t\t}\n\t\t\t</script>";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_readability\">";
$enable_share_anything = $this->host->get($this, "enable_share_anything");
$enable_share_anything_checked = $enable_share_anything ? "checked" : "";
print "<input dojoType=\"dijit.form.CheckBox\"\n\t\t\t{$enable_share_anything_checked} name=\"enable_share_anything\" id=\"enable_share_anything\">\n\t\t\t<label for=\"enable_share_anything\">" . __("Use Readability for pages shared via bookmarklet.") . "</label>";
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Save") . "</button>";
print "</form>";
$enabled_feeds = $this->host->get($this, "enabled_feeds");
if (!is_array($enabled_feeds)) {
$enabled_feeds = array();
}
$enabled_feeds = $this->filter_unknown_feeds($enabled_feeds);
$this->host->set($this, "enabled_feeds", $enabled_feeds);
if (count($enabled_feeds) > 0) {
print "<h3>" . __("Currently enabled for (click to edit):") . "</h3>";
print "<ul class=\"browseFeedList\" style=\"border-width : 1px\">";
foreach ($enabled_feeds as $f) {
print "<li>" . "<img src='images/pub_set.png'\n\t\t\t\t\t\tstyle='vertical-align : middle'> <a href='#'\n\t\t\t\t\t\tonclick='editFeed({$f})'>" . getFeedTitle($f) . "</a></li>";
}
print "</ul>";
}
print "</div>";
}
示例4: display_main_help
private function display_main_help()
{
$info = get_hotkeys_info();
$imap = get_hotkeys_map();
$omap = array();
foreach ($imap[1] as $sequence => $action) {
if (!isset($omap[$action])) {
$omap[$action] = array();
}
array_push($omap[$action], $sequence);
}
print_notice("<a target=\"_blank\" href=\"http://tt-rss.org/wiki/InterfaceTips\">" . __("Other interface tips are available in the Tiny Tiny RSS wiki.") . "</a>");
print "<ul class='helpKbList' id='helpKbList'>";
print "<h2>" . __("Keyboard Shortcuts") . "</h2>";
foreach ($info as $section => $hotkeys) {
print "<li><h3>" . $section . "</h3></li>";
foreach ($hotkeys as $action => $description) {
if (is_array($omap[$action])) {
foreach ($omap[$action] as $sequence) {
if (strpos($sequence, "|") !== FALSE) {
$sequence = substr($sequence, strpos($sequence, "|") + 1, strlen($sequence));
} else {
$keys = explode(" ", $sequence);
for ($i = 0; $i < count($keys); $i++) {
if (strlen($keys[$i]) > 1) {
$tmp = '';
foreach (str_split($keys[$i]) as $c) {
switch ($c) {
case '*':
$tmp .= __('Shift') . '+';
break;
case '^':
$tmp .= __('Ctrl') . '+';
break;
default:
$tmp .= $c;
}
}
$keys[$i] = $tmp;
}
}
$sequence = join(" ", $keys);
}
print "<li>";
print "<span class='hksequence'>{$sequence}</span>";
print $description;
print "</li>";
}
}
}
}
print "</ul>";
}
示例5: hook_prefs_tab
function hook_prefs_tab($args)
{
if ($args != "prefFeeds") {
return;
}
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Import and export') . "\">";
print_notice(__("You can export and import your Starred and Archived articles for safekeeping or when migrating between tt-rss instances of same version."));
print "<p>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return exportData()\">" . __('Export my data') . "</button> ";
print "<hr>";
print "<iframe id=\"data_upload_iframe\"\n\t\t\tname=\"data_upload_iframe\" onload=\"dataImportComplete(this)\"\n\t\t\tstyle=\"width: 400px; height: 100px; display: none;\"></iframe>";
print "<form name=\"import_form\" style='display : block' target=\"data_upload_iframe\"\n\t\t\tenctype=\"multipart/form-data\" method=\"POST\"\n\t\t\taction=\"backend.php\">\n\t\t\t<input id=\"export_file\" name=\"export_file\" type=\"file\"> \n\t\t\t<input type=\"hidden\" name=\"op\" value=\"pluginhandler\">\n\t\t\t<input type=\"hidden\" name=\"plugin\" value=\"import_export\">\n\t\t\t<input type=\"hidden\" name=\"method\" value=\"dataimport\">\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return importData();\" type=\"submit\">" . __('Import') . "</button>";
print "</form>";
print "</p>";
print "</div>";
# pane
}
示例6: hook_prefs_tab
function hook_prefs_tab($args)
{
if ($args == "prefFeeds") {
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Bookmarklets') . "\">";
print_notice(__("Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it."));
$bm_subscribe_url = str_replace('%s', '', add_feed_url());
$confirm_str = str_replace("'", "\\'", __('Subscribe to %s in Tiny Tiny RSS?'));
$bm_url = htmlspecialchars("javascript:{if(confirm('{$confirm_str}'.replace('%s',window.location.href)))window.location.href='{$bm_subscribe_url}'+window.location.href}");
print "<p>";
print "<a href=\"{$bm_url}\" class='bookmarklet'>" . __('Subscribe in Tiny Tiny RSS') . "</a>";
print "</p>";
print_notice(__("Use this bookmarklet to publish arbitrary pages using Tiny Tiny RSS"));
print "<p>";
$bm_url = htmlspecialchars("javascript:(function(){var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='" . SELF_URL_PATH . "/public.php?op=sharepopup',l=d.location,e=encodeURIComponent,g=f+'&title='+((e(s))?e(s):e(document.title))+'&url='+e(l.href);function a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=500,height=250')){l.href=g;}}a();})()");
print "<a href=\"{$bm_url}\" class='bookmarklet'>" . __('Share with Tiny Tiny RSS') . "</a>";
print "</p>";
print "</div>";
#pane
}
}
示例7: hook_prefs_tab
function hook_prefs_tab($args)
{
if ($args != "prefFeeds") {
return;
}
print "<div id=\"af_redditimgur_prefs\" dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('af_redditimgur settings') . "\">";
$enable_readability = $this->host->get($this, "enable_readability");
$enable_readability_checked = $enable_readability ? "checked" : "";
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\t\tevt.preventDefault();\n\t\t\tif (this.validate()) {\n\t\t\t\tconsole.log(dojo.objectToQuery(this.getValues()));\n\t\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\t\tnotify_info(transport.responseText);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//this.reset();\n\t\t\t}\n\t\t\t</script>";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_redditimgur\">";
print "<h3>" . __("Global settings") . "</h3>";
print_notice("Uses Readability (full-text-rss) implementation by <a target='_blank' href='https://bitbucket.org/fivefilters/'>FiveFilters.org</a>");
print "<p/>";
print "<input dojoType=\"dijit.form.CheckBox\" id=\"enable_readability\"\n\t\t\t{$enable_readability_checked} name=\"enable_readability\"> ";
print "<label for=\"enable_readability\">" . __("Extract missing content using Readability") . "</label>";
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Save") . "</button>";
print "</form>";
print "</div>";
}
示例8: hook_prefs_tab
function hook_prefs_tab($args)
{
if ($args != "prefFeeds") {
return;
}
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('af_readability settings') . "\">";
print_notice("Enable the plugin for specific feeds in the feed editor.");
$enabled_feeds = $this->host->get($this, "enabled_feeds");
if (!array($enabled_feeds)) {
$enabled_feeds = array();
}
$enabled_feeds = $this->filter_unknown_feeds($enabled_feeds);
$this->host->set($this, "enabled_feeds", $enabled_feeds);
if (count($enabled_feeds) > 0) {
print "<h3>" . __("Currently enabled for (click to edit):") . "</h3>";
print "<ul class=\"browseFeedList\" style=\"border-width : 1px\">";
foreach ($enabled_feeds as $f) {
print "<li>" . "<img src='images/pub_set.png'\n\t\t\t\t\t\tstyle='vertical-align : middle'> <a href='#'\n\t\t\t\t\t\tonclick='editFeed({$f})'>" . getFeedTitle($f) . "</a></li>";
}
print "</ul>";
}
print "</div>";
}
示例9: print_error
}
}
} else {
print_error('Plese check the form again, you have failed the robot test.');
print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t</form>";
}
}
}
?>
<?php
} else {
?>
<?php
print_notice(__('New user registrations are currently closed.'));
?>
<?php
print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t</form>";
?>
<?php
}
?>
</div>
</body>
</html>
示例10: quickAddFeed
function quickAddFeed()
{
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"addfeed\">";
print "<div id='fadd_multiple_notify' style='display : none'>";
print_notice("Provided URL is a HTML page referencing multiple feeds, please select required feed from the dropdown menu below.");
print "<p></div>";
print "<div class=\"dlgSec\">" . __("Feed or site URL") . "</div>";
print "<div class=\"dlgSecCont\">";
print "<div style='float : right'>\n\t\t\t<img style='display : none'\n\t\t\t\tid='feed_add_spinner' src='images/indicator_white.gif'></div>";
print "<input style=\"font-size : 16px; width : 20em;\"\n\t\t\tplaceHolder=\"" . __("Feed or site URL") . "\"\n\t\t\tdojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">";
print "<hr/>";
if (get_pref('ENABLE_FEED_CATS')) {
print __('Place in category:') . " ";
print_feed_cat_select("cat", false, 'dojoType="dijit.form.Select"');
}
print "</div>";
print '<div id="feedDlg_feedsContainer" style="display : none">
<div class="dlgSec">' . __('Available feeds') . '</div>
<div class="dlgSecCont">' . '<select id="feedDlg_feedContainerSelect"
dojoType="dijit.form.Select" size="3">
<script type="dojo/method" event="onChange" args="value">
dijit.byId("feedDlg_feedUrl").attr("value", value);
</script>
</select>' . '</div></div>';
print "<div id='feedDlg_loginContainer' style='display : none'>\n\n\t\t\t\t<div class=\"dlgSec\">" . __("Authentication") . "</div>\n\t\t\t\t<div class=\"dlgSecCont\">" . " <input dojoType=\"dijit.form.TextBox\" name='login'\"\n\t\t\t\t\tplaceHolder=\"" . __("Login") . "\"\n\t\t\t\t\tstyle=\"width : 10em;\"> " . " <input\n\t\t\t\t\tplaceHolder=\"" . __("Password") . "\"\n\t\t\t\t\tdojoType=\"dijit.form.TextBox\" type='password'\n\t\t\t\t\tstyle=\"width : 10em;\" name='pass'\">\n\t\t\t</div></div>";
print "<div style=\"clear : both\">\n\t\t\t<input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"\n\t\t\t\t\tonclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>\n\t\t\t\t<label for=\"feedDlg_loginCheck\">" . __('This feed requires authentication.') . "</div>";
print "</form>";
print "<div class=\"dlgButtons\">\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">" . __('Subscribe') . "</button>";
if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) {
print "<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">" . __('More feeds') . "</button>";
}
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t</div>";
//return;
}
示例11: customizeCSS
function customizeCSS()
{
$value = get_pref("USER_STYLESHEET");
$value = str_replace("<br/>", "\n", $value);
print_notice(T_sprintf("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here. <a target=\"_blank\" class=\"visibleLink\" href=\"%s\">This file</a> can be used as a baseline.", "css/tt-rss.css"));
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setpref\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">";
print "<table width='100%'><tr><td>";
print "<textarea dojoType=\"dijit.form.SimpleTextarea\"\n\t\t\tstyle='font-size : 12px; width : 100%; height: 200px;'\n\t\t\tplaceHolder='body#ttrssMain { font-size : 14px; };'\n\t\t\tname='value'>{$value}</textarea>";
print "</td></tr></table>";
print "<div class='dlgButtons'>";
print "<button dojoType=\"dijit.form.Button\"\n\t\t\tonclick=\"dijit.byId('cssEditDlg').execute()\">" . __('Save') . "</button> ";
print "<button dojoType=\"dijit.form.Button\"\n\t\t\tonclick=\"dijit.byId('cssEditDlg').hide()\">" . __('Cancel') . "</button>";
print "</div>";
}
示例12: dbupdate
function dbupdate()
{
startup_gettext();
if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) {
$_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script.");
render_login_form();
exit;
}
?>
<html>
<head>
<title>Database Updater</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="css/utility.css"/>
</head>
<style type="text/css">
span.ok { color : #009000; font-weight : bold; }
span.err { color : #ff0000; font-weight : bold; }
</style>
<body>
<script type='text/javascript'>
function confirmOP() {
return confirm("Update the database?");
}
</script>
<div class="floatingLogo"><img src="images/logo_small.png"></div>
<h1><?php
echo __("Database Updater");
?>
</h1>
<div class="content">
<?php
@($op = $_REQUEST["subop"]);
$updater = new DbUpdater(Db::get(), DB_TYPE, SCHEMA_VERSION);
if ($op == "performupdate") {
if ($updater->isUpdateRequired()) {
print "<h2>Performing updates</h2>";
print "<h3>Updating to schema version " . SCHEMA_VERSION . "</h3>";
print "<ul>";
for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) {
print "<li>Performing update up to version {$i}...";
$result = $updater->performUpdateTo($i);
if (!$result) {
print "<span class='err'>FAILED!</span></li></ul>";
print_warning("One of the updates failed. Either retry the process or perform updates manually.");
print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t\t\t\t\t</form>";
break;
} else {
print "<span class='ok'>OK!</span></li>";
}
}
print "</ul>";
print_notice("Your Tiny Tiny RSS database is now updated to the latest version.");
print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t\t\t</form>";
} else {
print "<h2>Your database is up to date.</h2>";
print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t\t\t</form>";
}
} else {
if ($updater->isUpdateRequired()) {
print "<h2>Database update required</h2>";
print "<h3>";
printf("Your Tiny Tiny RSS database needs update to the latest version: %d to %d.", $updater->getSchemaVersion(), SCHEMA_VERSION);
print "</h3>";
print_warning("Please backup your database before proceeding.");
print "<form method='POST'>\n\t\t\t\t\t\t\t<input type='hidden' name='subop' value='performupdate'>\n\t\t\t\t\t\t\t<input type='submit' onclick='return confirmOP()' value='" . __("Perform updates") . "'>\n\t\t\t\t\t\t</form>";
} else {
print_notice("Tiny Tiny RSS database is up to date.");
print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t\t\t</form>";
}
}
?>
</div>
</body>
</html>
<?php
}
示例13: module_pref_filters
//.........这里部分代码省略.........
print "<button onclick=\"return filterEditSave()\">" . __('Save') . "</button> ";
print "<button onclick=\"return filterEditCancel()\">" . __('Cancel') . "</button>";
print "</div>";
return;
}
if ($subop == "editSave") {
global $memcache;
if ($memcache) {
$memcache->flush();
}
$reg_exp = db_escape_string(trim($_REQUEST["reg_exp"]));
$filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
$filter_id = db_escape_string($_REQUEST["id"]);
$feed_id = db_escape_string($_REQUEST["feed_id"]);
$action_id = db_escape_string($_REQUEST["action_id"]);
$action_param = db_escape_string($_REQUEST["action_param"]);
$action_param_label = db_escape_string($_REQUEST["action_param_label"]);
$enabled = checkbox_to_sql_bool(db_escape_string($_REQUEST["enabled"]));
$inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"]));
# for the time being, no other filters use params anyway...
$filter_param = db_escape_string($_REQUEST["filter_date_modifier"]);
if (!$feed_id) {
$feed_id = 'NULL';
} else {
$feed_id = sprintf("'%s'", db_escape_string($feed_id));
}
/* When processing 'assign label' filters, action_param_label dropbox
* overrides action_param */
if ($action_id == 7) {
$action_param = $action_param_label;
}
$result = db_query($link, "UPDATE ttrss_filters SET \n\t\t\t\t\treg_exp = '{$reg_exp}', \n\t\t\t\t\tfeed_id = {$feed_id},\n\t\t\t\t\taction_id = '{$action_id}',\n\t\t\t\t\tfilter_type = '{$filter_type}',\n\t\t\t\t\tenabled = {$enabled},\n\t\t\t\t\tinverse = {$inverse},\n\t\t\t\t\taction_param = '{$action_param}',\n\t\t\t\t\tfilter_param = '{$filter_param}'\n\t\t\t\t\tWHERE id = '{$filter_id}' AND owner_uid = " . $_SESSION["uid"]);
if (db_affected_rows($link, $result) != 0) {
print_notice(T_sprintf("Saved filter <b>%s</b>", htmlspecialchars($reg_exp)));
}
}
if ($subop == "remove") {
if ($memcache) {
$memcache->flush();
}
$ids = split(",", db_escape_string($_REQUEST["ids"]));
foreach ($ids as $id) {
db_query($link, "DELETE FROM ttrss_filters WHERE id = '{$id}' AND owner_uid = " . $_SESSION["uid"]);
}
}
if ($subop == "add") {
if ($memcache) {
$memcache->flush();
}
$regexp = db_escape_string(trim($_REQUEST["reg_exp"]));
$filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
$feed_id = db_escape_string($_REQUEST["feed_id"]);
$action_id = db_escape_string($_REQUEST["action_id"]);
$action_param = db_escape_string($_REQUEST["action_param"]);
$action_param_label = db_escape_string($_REQUEST["action_param_label"]);
$inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"]));
# for the time being, no other filters use params anyway...
$filter_param = db_escape_string($_REQUEST["filter_date_modifier"]);
if (!$regexp) {
return;
}
if (!$feed_id) {
$feed_id = 'NULL';
} else {
$feed_id = sprintf("'%s'", db_escape_string($feed_id));
}
示例14: hook_prefs_tab
function hook_prefs_tab($args)
{
if ($args != "prefFeeds") {
return;
}
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Mark similar articles as read') . "\">";
if (DB_TYPE != "pgsql") {
print_error("Database type not supported.");
}
$result = db_query("select 'similarity'::regproc");
if (db_num_rows($result) == 0) {
print_error("pg_trgm extension not found.");
}
$similarity = $this->host->get($this, "similarity");
$min_title_length = $this->host->get($this, "min_title_length");
$enable_globally = $this->host->get($this, "enable_globally");
if (!$similarity) {
$similarity = '0.75';
}
if (!$min_title_length) {
$min_title_length = '32';
}
$enable_globally_checked = $enable_globally ? "checked" : "";
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\t\tevt.preventDefault();\n\t\t\tif (this.validate()) {\n\t\t\t\tconsole.log(dojo.objectToQuery(this.getValues()));\n\t\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\t\tnotify_info(transport.responseText);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//this.reset();\n\t\t\t}\n\t\t\t</script>";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_psql_trgm\">";
print_notice("PostgreSQL trigram extension returns string similarity as a floating point number (0-1). Setting it too low might produce false positives, zero disables checking.");
print "<br/>";
print_notice("Enable the plugin for specific feeds in the feed editor.");
print "<h3>" . __("Global settings") . "</h3>";
print "<table>";
print "<tr><td width=\"40%\">" . __("Minimum similarity:") . "</td>";
print "<td>\n\t\t\t<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\tplaceholder=\"0.75\"\n\t\t\trequired=\"1\" name=\"similarity\" value=\"{$similarity}\"></td></tr>";
print "<tr><td width=\"40%\">" . __("Minimum title length:") . "</td>";
print "<td>\n\t\t\t<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\tplaceholder=\"32\"\n\t\t\trequired=\"1\" name=\"min_title_length\" value=\"{$min_title_length}\"></td></tr>";
print "<tr><td width=\"40%\">" . __("Enable for all feeds:") . "</td>";
print "<td>\n\t\t\t<input dojoType=\"dijit.form.CheckBox\"\n\t\t\t{$enable_globally_checked} name=\"enable_globally\"></td></tr>";
print "</table>";
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Save") . "</button>";
print "</form>";
$enabled_feeds = $this->host->get($this, "enabled_feeds");
if (!array($enabled_feeds)) {
$enabled_feeds = array();
}
$enabled_feeds = $this->filter_unknown_feeds($enabled_feeds);
$this->host->set($this, "enabled_feeds", $enabled_feeds);
if (count($enabled_feeds) > 0) {
print "<h3>" . __("Currently enabled for (click to edit):") . "</h3>";
print "<ul class=\"browseFeedList\" style=\"border-width : 1px\">";
foreach ($enabled_feeds as $f) {
print "<li>" . "<img src='images/pub_set.png'\n\t\t\t\t\t\tstyle='vertical-align : middle'> <a href='#'\n\t\t\t\t\t\tonclick='editFeed({$f})'>" . getFeedTitle($f) . "</a></li>";
}
print "</ul>";
}
print "</div>";
}
示例15: module_pref_users
//.........这里部分代码省略.........
print "</div>";
print "<div class=\"dlgSec\">" . __("Authentication") . "</div>";
print "<div class=\"dlgSecCont\">";
print __('Access level: ') . " ";
if (!$sel_disabled) {
print_select_hash("access_level", $access_level, $access_level_names, $sel_disabled);
} else {
print_select_hash("", $access_level, $access_level_names, $sel_disabled);
print "<input type=\"hidden\" name=\"access_level\" value=\"{$access_level}\">";
}
print "<br/>";
print __('Change password to') . " <input size=\"20\" onkeypress=\"return filterCR(event, userEditSave)\"\n\t\t\t\tname=\"password\">";
print "</div>";
print "<div class=\"dlgSec\">" . __("Options") . "</div>";
print "<div class=\"dlgSecCont\">";
print __('E-mail: ') . " <input size=\"30\" name=\"email\" onkeypress=\"return filterCR(event, userEditSave)\"\n\t\t\t\tvalue=\"{$email}\">";
print "</div>";
print "</table>";
print "</form>";
print "<div class=\"dlgButtons\">\n\t\t\t\t<button onclick=\"return userEditSave()\">" . __('Save') . "</button>\n\t\t\t\t<button onclick=\"return userEditCancel()\">" . __('Cancel') . "</button></div>";
print "</div>";
return;
}
if ($subop == "editSave") {
if (!WEB_DEMO_MODE && $_SESSION["access_level"] >= 10) {
$login = db_escape_string(trim($_REQUEST["login"]));
$uid = db_escape_string($_REQUEST["id"]);
$access_level = (int) $_REQUEST["access_level"];
$email = db_escape_string(trim($_REQUEST["email"]));
$password = db_escape_string(trim($_REQUEST["password"]));
if ($password) {
$pwd_hash = encrypt_password($password, $login);
$pass_query_part = "pwd_hash = '{$pwd_hash}', ";
print_notice(T_sprintf('Changed password of user <b>%s</b>.', $login));
} else {
$pass_query_part = "";
}
db_query($link, "UPDATE ttrss_users SET {$pass_query_part} login = '{$login}', \n\t\t\t\t\taccess_level = '{$access_level}', email = '{$email}' WHERE id = '{$uid}'");
}
} else {
if ($subop == "remove") {
if ($_SESSION["access_level"] >= 10) {
$ids = split(",", db_escape_string($_REQUEST["ids"]));
foreach ($ids as $id) {
if ($id != $_SESSION["uid"]) {
db_query($link, "DELETE FROM ttrss_tags WHERE owner_uid = '{$id}'");
db_query($link, "DELETE FROM ttrss_feeds WHERE owner_uid = '{$id}'");
db_query($link, "DELETE FROM ttrss_users WHERE id = '{$id}'");
}
}
}
} else {
if ($subop == "add") {
if ($_SESSION["access_level"] >= 10) {
$login = db_escape_string(trim($_REQUEST["login"]));
$tmp_user_pwd = make_password(8);
$pwd_hash = encrypt_password($tmp_user_pwd, $login);
$result = db_query($link, "SELECT id FROM ttrss_users WHERE \n\t\t\t\t\tlogin = '{$login}'");
if (db_num_rows($result) == 0) {
db_query($link, "INSERT INTO ttrss_users \n\t\t\t\t\t\t(login,pwd_hash,access_level,last_login,created)\n\t\t\t\t\t\tVALUES ('{$login}', '{$pwd_hash}', 0, null, NOW())");
$result = db_query($link, "SELECT id FROM ttrss_users WHERE \n\t\t\t\t\t\tlogin = '{$login}' AND pwd_hash = '{$pwd_hash}'");
if (db_num_rows($result) == 1) {
$new_uid = db_fetch_result($result, 0, "id");
print_notice(T_sprintf("Added user <b>%s</b> with password <b>%s</b>", $login, $tmp_user_pwd));
initialize_user($link, $new_uid);
} else {