本文整理汇总了PHP中checkbox_to_sql_bool函数的典型用法代码示例。如果您正苦于以下问题:PHP checkbox_to_sql_bool函数的具体用法?PHP checkbox_to_sql_bool怎么用?PHP checkbox_to_sql_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkbox_to_sql_bool函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
$enable_readability = checkbox_to_sql_bool($_POST["enable_readability"]) == "true";
$enable_content_dupcheck = checkbox_to_sql_bool($_POST["enable_content_dupcheck"]) == "true";
$this->host->set($this, "enable_readability", $enable_readability, false);
$this->host->set($this, "enable_content_dupcheck", $enable_content_dupcheck);
echo __("Configuration saved");
}
示例2: hook_prefs_save_feed
function hook_prefs_save_feed($feed_id)
{
$enabled_feeds = $this->host->get($this, "enabled_feeds");
if (!is_array($enabled_feeds)) {
$enabled_feeds = array();
}
$enable = checkbox_to_sql_bool($_POST["af_readability_enabled"]) == 'true';
$key = array_search($feed_id, $enabled_feeds);
if ($enable) {
if ($key === FALSE) {
array_push($enabled_feeds, $feed_id);
}
} else {
if ($key !== FALSE) {
unset($enabled_feeds[$key]);
}
}
$this->host->set($this, "enabled_feeds", $enabled_feeds);
}
示例3: editsaveops
function editsaveops($batch)
{
$feed_title = $this->dbh->escape_string(trim($_POST["title"]));
$feed_link = $this->dbh->escape_string(trim($_POST["feed_url"]));
$upd_intl = (int) $this->dbh->escape_string($_POST["update_interval"]);
$purge_intl = (int) $this->dbh->escape_string($_POST["purge_interval"]);
$feed_id = (int) $this->dbh->escape_string($_POST["id"]);
/* editSave */
$feed_ids = $this->dbh->escape_string($_POST["ids"]);
/* batchEditSave */
$cat_id = (int) $this->dbh->escape_string($_POST["cat_id"]);
$auth_login = $this->dbh->escape_string(trim($_POST["auth_login"]));
$auth_pass = trim($_POST["auth_pass"]);
$private = checkbox_to_sql_bool($this->dbh->escape_string($_POST["private"]));
$include_in_digest = checkbox_to_sql_bool($this->dbh->escape_string($_POST["include_in_digest"]));
$cache_images = checkbox_to_sql_bool($this->dbh->escape_string($_POST["cache_images"]));
$hide_images = checkbox_to_sql_bool($this->dbh->escape_string($_POST["hide_images"]));
$always_display_enclosures = checkbox_to_sql_bool($this->dbh->escape_string($_POST["always_display_enclosures"]));
$mark_unread_on_update = checkbox_to_sql_bool($this->dbh->escape_string($_POST["mark_unread_on_update"]));
$feed_language = $this->dbh->escape_string(trim($_POST["feed_language"]));
if (strlen(FEED_CRYPT_KEY) > 0) {
require_once "crypt.php";
$auth_pass = substr(encrypt_string($auth_pass), 0, 250);
$auth_pass_encrypted = 'true';
} else {
$auth_pass_encrypted = 'false';
}
$auth_pass = $this->dbh->escape_string($auth_pass);
if (get_pref('ENABLE_FEED_CATS')) {
if ($cat_id && $cat_id != 0) {
$category_qpart = "cat_id = '{$cat_id}',";
$category_qpart_nocomma = "cat_id = '{$cat_id}'";
} else {
$category_qpart = 'cat_id = NULL,';
$category_qpart_nocomma = 'cat_id = NULL';
}
} else {
$category_qpart = "";
$category_qpart_nocomma = "";
}
if (!$batch) {
$result = db_query("SELECT feed_url FROM ttrss_feeds WHERE id = " . $feed_id);
$orig_feed_url = db_fetch_result($result, 0, "feed_url");
$reset_basic_info = $orig_feed_url != $feed_link;
$this->dbh->query("UPDATE ttrss_feeds SET\n\t\t\t\t{$category_qpart}\n\t\t\t\ttitle = '{$feed_title}', feed_url = '{$feed_link}',\n\t\t\t\tupdate_interval = '{$upd_intl}',\n\t\t\t\tpurge_interval = '{$purge_intl}',\n\t\t\t\tauth_login = '{$auth_login}',\n\t\t\t\tauth_pass = '{$auth_pass}',\n\t\t\t\tauth_pass_encrypted = {$auth_pass_encrypted},\n\t\t\t\tprivate = {$private},\n\t\t\t\tcache_images = {$cache_images},\n\t\t\t\thide_images = {$hide_images},\n\t\t\t\tinclude_in_digest = {$include_in_digest},\n\t\t\t\talways_display_enclosures = {$always_display_enclosures},\n\t\t\t\tmark_unread_on_update = {$mark_unread_on_update},\n\t\t\t\tfeed_language = '{$feed_language}'\n\t\t\tWHERE id = '{$feed_id}' AND owner_uid = " . $_SESSION["uid"]);
if ($reset_basic_info) {
require_once "rssfuncs.php";
set_basic_feed_info($feed_id);
}
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_SAVE_FEED, "hook_prefs_save_feed", $feed_id);
} else {
$feed_data = array();
foreach (array_keys($_POST) as $k) {
if ($k != "op" && $k != "method" && $k != "ids") {
$feed_data[$k] = $_POST[$k];
}
}
$this->dbh->query("BEGIN");
foreach (array_keys($feed_data) as $k) {
$qpart = "";
switch ($k) {
case "title":
$qpart = "title = '{$feed_title}'";
break;
case "feed_url":
$qpart = "feed_url = '{$feed_link}'";
break;
case "update_interval":
$qpart = "update_interval = '{$upd_intl}'";
break;
case "purge_interval":
$qpart = "purge_interval = '{$purge_intl}'";
break;
case "auth_login":
$qpart = "auth_login = '{$auth_login}'";
break;
case "auth_pass":
$qpart = "auth_pass = '{$auth_pass}' AND\n\t\t\t\t\t\t\tauth_pass_encrypted = {$auth_pass_encrypted}";
break;
case "private":
$qpart = "private = {$private}";
break;
case "include_in_digest":
$qpart = "include_in_digest = {$include_in_digest}";
break;
case "always_display_enclosures":
$qpart = "always_display_enclosures = {$always_display_enclosures}";
break;
case "mark_unread_on_update":
$qpart = "mark_unread_on_update = {$mark_unread_on_update}";
break;
case "cache_images":
$qpart = "cache_images = {$cache_images}";
break;
case "hide_images":
$qpart = "hide_images = {$hide_images}";
break;
case "cat_id":
$qpart = $category_qpart_nocomma;
break;
//.........这里部分代码省略.........
示例4: add
function add()
{
$savemode = db_escape_string($_REQUEST["savemode"]);
$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"]);
$cat_id = db_escape_string($_REQUEST["cat_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"]));
$cat_filter = checkbox_to_sql_bool(db_escape_string($_REQUEST["cat_filter"]));
# 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));
}
if (!$cat_id) {
$cat_id = 'NULL';
} else {
$cat_id = sprintf("'%d'", db_escape_string($cat_id));
}
/* When processing 'assign label' filters, action_param_label dropbox
* overrides action_param */
if ($action_id == 7) {
$action_param = $action_param_label;
}
if ($action_id == 6) {
$action_param = (int) str_replace("+", "", $action_param);
}
if ($savemode != "test") {
$result = db_query($this->link, "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id,\n\t\t\t\t\taction_id, action_param, inverse, filter_param, cat_id, cat_filter)\n\t\t\t\tVALUES\n\t\t\t\t\t('{$regexp}', '{$filter_type}','" . $_SESSION["uid"] . "',\n\t\t\t\t\t{$feed_id}, '{$action_id}', '{$action_param}', {$inverse},\n\t\t\t\t\t'{$filter_param}', {$cat_id}, {$cat_filter})");
if (db_affected_rows($this->link, $result) != 0) {
print T_sprintf("Created filter <b>%s</b>", htmlspecialchars($regexp));
}
} else {
$this->filter_test($filter_type, $regexp, $action_id, $action_param, $filter_param, sql_bool_to_bool($inverse), (int) $_REQUEST["feed_id"], (int) $_REQUEST['cat_id'], sql_bool_to_bool($cat_filter));
print "<div align='center'>";
print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return dijit.byId('filterTestDlg').hide()\">" . __('Close this window') . "</button>";
print "</div>";
}
}
示例5: editsaveops
function editsaveops($batch)
{
$feed_title = db_escape_string(trim($_POST["title"]));
$feed_link = db_escape_string(trim($_POST["feed_url"]));
$upd_intl = (int) db_escape_string($_POST["update_interval"]);
$purge_intl = (int) db_escape_string($_POST["purge_interval"]);
$feed_id = (int) db_escape_string($_POST["id"]);
/* editSave */
$feed_ids = db_escape_string($_POST["ids"]);
/* batchEditSave */
$cat_id = (int) db_escape_string($_POST["cat_id"]);
$auth_login = db_escape_string(trim($_POST["auth_login"]));
$auth_pass = db_escape_string(trim($_POST["auth_pass"]));
$private = checkbox_to_sql_bool(db_escape_string($_POST["private"]));
$rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"]));
$include_in_digest = checkbox_to_sql_bool(db_escape_string($_POST["include_in_digest"]));
$cache_images = checkbox_to_sql_bool(db_escape_string($_POST["cache_images"]));
$update_method = (int) db_escape_string($_POST["update_method"]);
$always_display_enclosures = checkbox_to_sql_bool(db_escape_string($_POST["always_display_enclosures"]));
$mark_unread_on_update = checkbox_to_sql_bool(db_escape_string($_POST["mark_unread_on_update"]));
$update_on_checksum_change = checkbox_to_sql_bool(db_escape_string($_POST["update_on_checksum_change"]));
if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
if ($cat_id && $cat_id != 0) {
$category_qpart = "cat_id = '{$cat_id}',";
$category_qpart_nocomma = "cat_id = '{$cat_id}'";
} else {
$category_qpart = 'cat_id = NULL,';
$category_qpart_nocomma = 'cat_id = NULL';
}
} else {
$category_qpart = "";
$category_qpart_nocomma = "";
}
$cache_images_qpart = "cache_images = {$cache_images},";
if (!$batch) {
$result = db_query($this->link, "UPDATE ttrss_feeds SET\n\t\t\t\t{$category_qpart}\n\t\t\t\ttitle = '{$feed_title}', feed_url = '{$feed_link}',\n\t\t\t\tupdate_interval = '{$upd_intl}',\n\t\t\t\tpurge_interval = '{$purge_intl}',\n\t\t\t\tauth_login = '{$auth_login}',\n\t\t\t\tauth_pass = '{$auth_pass}',\n\t\t\t\tprivate = {$private},\n\t\t\t\trtl_content = {$rtl_content},\n\t\t\t\t{$cache_images_qpart}\n\t\t\t\tinclude_in_digest = {$include_in_digest},\n\t\t\t\talways_display_enclosures = {$always_display_enclosures},\n\t\t\t\tmark_unread_on_update = {$mark_unread_on_update},\n\t\t\t\tupdate_on_checksum_change = {$update_on_checksum_change},\n\t\t\t\tupdate_method = '{$update_method}'\n\t\t\t\tWHERE id = '{$feed_id}' AND owner_uid = " . $_SESSION["uid"]);
} else {
$feed_data = array();
foreach (array_keys($_POST) as $k) {
if ($k != "op" && $k != "method" && $k != "ids") {
$feed_data[$k] = $_POST[$k];
}
}
db_query($this->link, "BEGIN");
foreach (array_keys($feed_data) as $k) {
$qpart = "";
switch ($k) {
case "title":
$qpart = "title = '{$feed_title}'";
break;
case "feed_url":
$qpart = "feed_url = '{$feed_link}'";
break;
case "update_interval":
$qpart = "update_interval = '{$upd_intl}'";
break;
case "purge_interval":
$qpart = "purge_interval = '{$purge_intl}'";
break;
case "auth_login":
$qpart = "auth_login = '{$auth_login}'";
break;
case "auth_pass":
$qpart = "auth_pass = '{$auth_pass}'";
break;
case "private":
$qpart = "private = {$private}";
break;
case "include_in_digest":
$qpart = "include_in_digest = {$include_in_digest}";
break;
case "always_display_enclosures":
$qpart = "always_display_enclosures = {$always_display_enclosures}";
break;
case "mark_unread_on_update":
$qpart = "mark_unread_on_update = {$mark_unread_on_update}";
break;
case "update_on_checksum_change":
$qpart = "update_on_checksum_change = {$update_on_checksum_change}";
break;
case "cache_images":
$qpart = "cache_images = {$cache_images}";
break;
case "rtl_content":
$qpart = "rtl_content = {$rtl_content}";
break;
case "update_method":
$qpart = "update_method = '{$update_method}'";
break;
case "cat_id":
$qpart = $category_qpart_nocomma;
break;
}
if ($qpart) {
db_query($this->link, "UPDATE ttrss_feeds SET {$qpart} WHERE id IN ({$feed_ids})\n\t\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]);
print "<br/>";
}
}
db_query($this->link, "COMMIT");
}
//.........这里部分代码省略.........
示例6: add
function add()
{
if ($_REQUEST["savemode"] && $_REQUEST["savemode"] == "test") {
return $this->testFilter();
}
# print_r($_REQUEST);
$enabled = checkbox_to_sql_bool($_REQUEST["enabled"]);
$match_any_rule = checkbox_to_sql_bool($_REQUEST["match_any_rule"]);
db_query($this->link, "BEGIN");
/* create base filter */
$result = db_query($this->link, "INSERT INTO ttrss_filters2\n\t\t\t(owner_uid, match_any_rule, enabled) VALUES\n\t\t\t(" . $_SESSION["uid"] . ",{$match_any_rule},{$enabled})");
$result = db_query($this->link, "SELECT MAX(id) AS id FROM ttrss_filters2\n\t\t\tWHERE owner_uid = " . $_SESSION["uid"]);
$filter_id = db_fetch_result($result, 0, "id");
$this->saveRulesAndActions($filter_id);
db_query($this->link, "COMMIT");
}
示例7: add
function add()
{
if ($_REQUEST["savemode"] && $_REQUEST["savemode"] == "test") {
return $this->testFilter();
}
# print_r($_REQUEST);
$enabled = checkbox_to_sql_bool($_REQUEST["enabled"]);
$match_any_rule = checkbox_to_sql_bool($_REQUEST["match_any_rule"]);
$title = $this->dbh->escape_string($_REQUEST["title"]);
$inverse = checkbox_to_sql_bool($_REQUEST["inverse"]);
$this->dbh->query("BEGIN");
/* create base filter */
$result = $this->dbh->query("INSERT INTO ttrss_filters2\n\t\t\t(owner_uid, match_any_rule, enabled, title, inverse) VALUES\n\t\t\t(" . $_SESSION["uid"] . ",{$match_any_rule},{$enabled}, '{$title}', {$inverse})");
$result = $this->dbh->query("SELECT MAX(id) AS id FROM ttrss_filters2\n\t\t\tWHERE owner_uid = " . $_SESSION["uid"]);
$filter_id = $this->dbh->fetch_result($result, 0, "id");
$this->saveRulesAndActions($filter_id);
$this->dbh->query("COMMIT");
}
示例8: save
function save()
{
$json_conf = $_POST['json_conf'];
$this->host->set($this, 'json_conf', $json_conf);
$this->host->set($this, "af_fullpost_showinfo", checkbox_to_sql_bool($_POST["af_fullpost_showinfo"]));
echo __("Configuration saved.");
}
示例9: save
function save()
{
$enable_readability = checkbox_to_sql_bool($_POST["enable_readability"]) == "true";
$this->host->set($this, "enable_readability", $enable_readability);
echo __("Configuration saved");
}
示例10: module_pref_filters
//.........这里部分代码省略.........
}
print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" {$checked}>\n\t\t\t\t\t<label for=\"enabled\">" . __('Enabled') . "</label><hr/>";
if ($inverse) {
$checked = "checked=\"1\"";
} else {
$checked = "";
}
print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\" {$checked}>\n\t\t\t\t<label for=\"inverse\">" . __('Inverse match') . "</label>";
print "</div>";
print "</div>";
print "<div class=\"dlgButtons\">";
print "<div style=\"float : left\">";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').removeFilter()\">" . __('Remove') . "</button>";
print "</div>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').test()\">" . __('Test') . "</button> ";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">" . __('Save') . "</button> ";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">" . __('Cancel') . "</button>";
print "</div>";
return;
}
if ($subop == "editSave") {
global $memcache;
if ($memcache) {
$memcache->flush();
}
$savemode = db_escape_string($_REQUEST["savemode"]);
$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;
}
if ($action_id == 6) {
$action_param = (int) str_replace("+", "", $action_param);
}
if ($savemode != "test") {
$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"]);
} else {
filter_test($link, $filter_type, $reg_exp, $action_id, $action_param, $filter_param, sql_bool_to_bool($inverse), (int) $_REQUEST["feed_id"]);
print "<div align='center'>";
print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"return dijit.byId('filterTestDlg').hide()\">" . __('Close this window') . "</button>";
print "</div>";
}
return;
}
if ($subop == "remove") {
if ($memcache) {
$memcache->flush();
}
$ids = split(",", db_escape_string($_REQUEST["ids"]));
foreach ($ids as $id) {
示例11: module_pref_feeds
//.........这里部分代码省略.........
print "<br/><input disabled type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"\n\t\t\t\t{$checked}> <label class='insensitive' id=\"rtl_content_l\" for=\"rtl_content\">" . __('Right-to-left content') . "</label>";
print " ";
batch_edit_cbox("rtl_content", "rtl_content_l");
print "<br/><input disabled type=\"checkbox\" id=\"include_in_digest\" \n\t\t\t\tname=\"include_in_digest\" \n\t\t\t\t{$checked}> <label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">" . __('Include in e-mail digest') . "</label>";
print " ";
batch_edit_cbox("include_in_digest", "include_in_digest_l");
print "<br/><input disabled type=\"checkbox\" id=\"always_display_enclosures\" \n\t\t\t\tname=\"always_display_enclosures\" \n\t\t\t\t{$checked}> <label id=\"always_display_enclosures_l\" class='insensitive' for=\"always_display_enclosures\">" . __('Always display image attachments') . "</label>";
print " ";
batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l");
print "<br/><input disabled type=\"checkbox\" id=\"cache_images\" \n\t\t\t\tname=\"cache_images\" \n\t\t\t\t{$checked}> <label class='insensitive' id=\"cache_images_l\" \n\t\t\t\t\tfor=\"cache_images\">" . __('Cache images locally') . "</label>";
if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) {
print " ";
batch_edit_cbox("cache_images", "cache_images_l");
}
print "</div>";
print "</div>";
print "</form>";
print "<div class='dlgButtons'>\n\t\t\t\t<input type=\"submit\" class=\"button\" \n\t\t\t\tonclick=\"return feedsEditSave()\" value=\"" . __('Save') . "\">\n\t\t\t\t<input type='submit' class='button'\t\t\t\n\t\t\t\tonclick=\"return feedEditCancel()\" value=\"" . __('Cancel') . "\">\n\t\t\t\t</div>";
return;
}
if ($subop == "editSave" || $subop == "batchEditSave") {
$feed_title = db_escape_string(trim($_POST["title"]));
$feed_link = db_escape_string(trim($_POST["feed_url"]));
$upd_intl = db_escape_string($_POST["update_interval"]);
$purge_intl = db_escape_string($_POST["purge_interval"]);
$feed_id = db_escape_string($_POST["id"]);
/* editSave */
$feed_ids = db_escape_string($_POST["ids"]);
/* batchEditSave */
$cat_id = db_escape_string($_POST["cat_id"]);
$auth_login = db_escape_string(trim($_POST["auth_login"]));
$auth_pass = db_escape_string(trim($_POST["auth_pass"]));
$parent_feed = db_escape_string($_POST["parent_feed"]);
$private = checkbox_to_sql_bool(db_escape_string($_POST["private"]));
$rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"]));
$include_in_digest = checkbox_to_sql_bool(db_escape_string($_POST["include_in_digest"]));
$cache_images = checkbox_to_sql_bool(db_escape_string($_POST["cache_images"]));
$update_method = (int) db_escape_string($_POST["update_method"]);
$always_display_enclosures = checkbox_to_sql_bool(db_escape_string($_POST["always_display_enclosures"]));
if (get_pref($link, 'ENABLE_FEED_CATS')) {
if ($cat_id && $cat_id != 0) {
$category_qpart = "cat_id = '{$cat_id}',";
$category_qpart_nocomma = "cat_id = '{$cat_id}'";
} else {
$category_qpart = 'cat_id = NULL,';
$category_qpart_nocomma = 'cat_id = NULL';
}
} else {
$category_qpart = "";
$category_qpart_nocomma = "";
}
if ($parent_feed && $parent_feed != 0) {
$parent_qpart = "parent_feed = '{$parent_feed}'";
} else {
$parent_qpart = 'parent_feed = NULL';
}
if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) {
$cache_images_qpart = "cache_images = {$cache_images},";
} else {
$cache_images_qpart = "";
}
if ($subop == "editSave") {
$result = db_query($link, "UPDATE ttrss_feeds SET \n\t\t\t\t\t{$category_qpart} {$parent_qpart},\n\t\t\t\t\ttitle = '{$feed_title}', feed_url = '{$feed_link}',\n\t\t\t\t\tupdate_interval = '{$upd_intl}',\n\t\t\t\t\tpurge_interval = '{$purge_intl}',\n\t\t\t\t\tauth_login = '{$auth_login}',\n\t\t\t\t\tauth_pass = '{$auth_pass}',\n\t\t\t\t\tprivate = {$private},\n\t\t\t\t\trtl_content = {$rtl_content},\n\t\t\t\t\t{$cache_images_qpart}\n\t\t\t\t\tinclude_in_digest = {$include_in_digest},\n\t\t\t\t\talways_display_enclosures = {$always_display_enclosures},\n\t\t\t\t\tupdate_method = '{$update_method}'\n\t\t\t\t\tWHERE id = '{$feed_id}' AND owner_uid = " . $_SESSION["uid"]);
if (get_pref($link, 'ENABLE_FEED_CATS')) {
# update linked feed categories
$result = db_query($link, "UPDATE ttrss_feeds SET\n\t\t\t\t\t\t{$category_qpart_nocomma} WHERE parent_feed = '{$feed_id}' AND\n\t\t\t\t\t\towner_uid = " . $_SESSION["uid"]);
示例12: module_pref_filters
//.........这里部分代码省略.........
}
print "<input type=\"checkbox\" name=\"enabled\" id=\"enabled\" {$checked}>\n\t\t\t\t\t<label for=\"enabled\">" . __('Enabled') . "</label><br/>";
if ($inverse) {
$checked = "checked";
} else {
$checked = "";
}
print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\" {$checked}>\n\t\t\t\t<label for=\"inverse\">" . __('Inverse match') . "</label>";
print "</div>";
print "</div>";
print "<div class=\"dlgButtons\">";
$reg_exp = htmlspecialchars($reg_exp, ENT_QUOTES);
// second escaping seems to be needed for javascript
print "<div style=\"float : left\">";
print "<button onclick='return removeFilter({$filter_id}, \"{$reg_exp}\")'>" . __('Remove') . "</button>";
print "</div>";
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"]));
示例13: module_pref_feeds
//.........这里部分代码省略.........
print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"include_in_digest\"\n\t\t\t\tname=\"include_in_digest\"\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">" . __('Include in e-mail digest') . "</label>";
print " ";
batch_edit_cbox("include_in_digest", "include_in_digest_l");
print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"always_display_enclosures\"\n\t\t\t\tname=\"always_display_enclosures\"\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"always_display_enclosures_l\" class='insensitive' for=\"always_display_enclosures\">" . __('Always display image attachments') . "</label>";
print " ";
batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l");
if (SIMPLEPIE_CACHE_IMAGES) {
print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"cache_images\"\n\t\t\t\t\tname=\"cache_images\"\n\t\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"cache_images_l\"\n\t\t\t\t\tfor=\"cache_images\">" . __('Cache images locally') . "</label>";
print " ";
batch_edit_cbox("cache_images", "cache_images_l");
}
print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"mark_unread_on_update\"\n\t\t\t\tname=\"mark_unread_on_update\"\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"mark_unread_on_update_l\" class='insensitive' for=\"mark_unread_on_update\">" . __('Mark updated articles as unread') . "</label>";
print " ";
batch_edit_cbox("mark_unread_on_update", "mark_unread_on_update_l");
print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"update_on_checksum_change\"\n\t\t\t\tname=\"update_on_checksum_change\"\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"> <label id=\"update_on_checksum_change_l\" class='insensitive' for=\"update_on_checksum_change\">" . __('Mark posts as updated on content change') . "</label>";
print " ";
batch_edit_cbox("update_on_checksum_change", "update_on_checksum_change_l");
print "</div>";
print "<div class='dlgButtons'>\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"return dijit.byId('feedEditDlg').execute()\">" . __('Save') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return dijit.byId('feedEditDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t\t</div>";
return;
}
if ($subop == "editSave" || $subop == "batchEditSave") {
$feed_title = db_escape_string(trim($_POST["title"]));
$feed_link = db_escape_string(trim($_POST["feed_url"]));
$upd_intl = (int) db_escape_string($_POST["update_interval"]);
$purge_intl = (int) db_escape_string($_POST["purge_interval"]);
$feed_id = (int) db_escape_string($_POST["id"]);
/* editSave */
$feed_ids = db_escape_string($_POST["ids"]);
/* batchEditSave */
$cat_id = (int) db_escape_string($_POST["cat_id"]);
$auth_login = db_escape_string(trim($_POST["auth_login"]));
$auth_pass = db_escape_string(trim($_POST["auth_pass"]));
$private = checkbox_to_sql_bool(db_escape_string($_POST["private"]));
$rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"]));
$include_in_digest = checkbox_to_sql_bool(db_escape_string($_POST["include_in_digest"]));
$cache_images = checkbox_to_sql_bool(db_escape_string($_POST["cache_images"]));
$update_method = (int) db_escape_string($_POST["update_method"]);
$always_display_enclosures = checkbox_to_sql_bool(db_escape_string($_POST["always_display_enclosures"]));
$mark_unread_on_update = checkbox_to_sql_bool(db_escape_string($_POST["mark_unread_on_update"]));
$update_on_checksum_change = checkbox_to_sql_bool(db_escape_string($_POST["update_on_checksum_change"]));
if (get_pref($link, 'ENABLE_FEED_CATS')) {
if ($cat_id && $cat_id != 0) {
$category_qpart = "cat_id = '{$cat_id}',";
$category_qpart_nocomma = "cat_id = '{$cat_id}'";
} else {
$category_qpart = 'cat_id = NULL,';
$category_qpart_nocomma = 'cat_id = NULL';
}
} else {
$category_qpart = "";
$category_qpart_nocomma = "";
}
if (SIMPLEPIE_CACHE_IMAGES) {
$cache_images_qpart = "cache_images = {$cache_images},";
} else {
$cache_images_qpart = "";
}
if ($subop == "editSave") {
$result = db_query($link, "UPDATE ttrss_feeds SET\n\t\t\t\t\t{$category_qpart}\n\t\t\t\t\ttitle = '{$feed_title}', feed_url = '{$feed_link}',\n\t\t\t\t\tupdate_interval = '{$upd_intl}',\n\t\t\t\t\tpurge_interval = '{$purge_intl}',\n\t\t\t\t\tauth_login = '{$auth_login}',\n\t\t\t\t\tauth_pass = '{$auth_pass}',\n\t\t\t\t\tprivate = {$private},\n\t\t\t\t\trtl_content = {$rtl_content},\n\t\t\t\t\t{$cache_images_qpart}\n\t\t\t\t\tinclude_in_digest = {$include_in_digest},\n\t\t\t\t\talways_display_enclosures = {$always_display_enclosures},\n\t\t\t\t\tmark_unread_on_update = {$mark_unread_on_update},\n\t\t\t\t\tupdate_on_checksum_change = {$update_on_checksum_change},\n\t\t\t\t\tupdate_method = '{$update_method}'\n\t\t\t\t\tWHERE id = '{$feed_id}' AND owner_uid = " . $_SESSION["uid"]);
} else {
if ($subop == "batchEditSave") {
$feed_data = array();
foreach (array_keys($_POST) as $k) {
if ($k != "op" && $k != "subop" && $k != "ids") {
$feed_data[$k] = $_POST[$k];