本文整理汇总了PHP中bool_to_sql_bool函数的典型用法代码示例。如果您正苦于以下问题:PHP bool_to_sql_bool函数的具体用法?PHP bool_to_sql_bool怎么用?PHP bool_to_sql_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bool_to_sql_bool函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_feed_access_key
private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false)
{
if (!$owner_uid) {
$owner_uid = $_SESSION["uid"];
}
$sql_is_cat = bool_to_sql_bool($is_cat);
$result = $this->dbh->query("SELECT access_key FROM ttrss_access_keys\n\t\t\tWHERE feed_id = '{$feed_id}'\tAND is_cat = {$sql_is_cat}\n\t\t\tAND owner_uid = " . $owner_uid);
if ($this->dbh->num_rows($result) == 1) {
$key = $this->dbh->escape_string(uniqid_short());
$this->dbh->query("UPDATE ttrss_access_keys SET access_key = '{$key}'\n\t\t\t\tWHERE feed_id = '{$feed_id}' AND is_cat = {$sql_is_cat}\n\t\t\t\tAND owner_uid = " . $owner_uid);
return $key;
} else {
return get_feed_access_key($feed_id, $is_cat, $owner_uid);
}
}
示例2: opml_import_filter
private function opml_import_filter($doc, $node, $owner_uid)
{
$attrs = $node->attributes;
$filter_type = db_escape_string($attrs->getNamedItem('filter-type')->nodeValue);
if ($filter_type == '2') {
$filter = json_decode($node->nodeValue, true);
if ($filter) {
$match_any_rule = bool_to_sql_bool($filter["match_any_rule"]);
$enabled = bool_to_sql_bool($filter["enabled"]);
db_query($this->link, "BEGIN");
db_query($this->link, "INSERT INTO ttrss_filters2 (match_any_rule,enabled,owner_uid)\n\t\t\t\t\tVALUES ({$match_any_rule}, {$enabled}," . $_SESSION["uid"] . ")");
$result = db_query($this->link, "SELECT MAX(id) AS id FROM ttrss_filters2 WHERE\n\t\t\t\t\towner_uid = " . $_SESSION["uid"]);
$filter_id = db_fetch_result($result, 0, "id");
if ($filter_id) {
$this->opml_notice(T_sprintf("Adding filter..."));
foreach ($filter["rules"] as $rule) {
$feed_id = "NULL";
$cat_id = "NULL";
if (!$rule["cat_filter"]) {
$tmp_result = db_query($this->link, "SELECT id FROM ttrss_feeds\n\t\t\t\t\t\t\t\tWHERE title = '" . db_escape_string($rule["feed"]) . "' AND owner_uid = " . $_SESSION["uid"]);
if (db_num_rows($tmp_result) > 0) {
$feed_id = db_fetch_result($tmp_result, 0, "id");
}
} else {
$tmp_result = db_query($this->link, "SELECT id FROM ttrss_feed_categories\n\t\t\t\t\t\t\t\tWHERE title = '" . db_escape_string($rule["feed"]) . "' AND owner_uid = " . $_SESSION["uid"]);
if (db_num_rows($tmp_result) > 0) {
$cat_id = db_fetch_result($tmp_result, 0, "id");
}
}
$cat_filter = bool_to_sql_bool($rule["cat_filter"]);
$reg_exp = db_escape_string($rule["reg_exp"]);
$filter_type = (int) $rule["filter_type"];
db_query($this->link, "INSERT INTO ttrss_filters2_rules (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter)\n\t\t\t\t\t\t\tVALUES ({$feed_id}, {$cat_id}, {$filter_id}, {$filter_type}, '{$reg_exp}', {$cat_filter})");
}
foreach ($filter["actions"] as $action) {
$action_id = (int) $action["action_id"];
$action_param = db_escape_string($action["action_param"]);
db_query($this->link, "INSERT INTO ttrss_filters2_actions (filter_id,action_id,action_param)\n\t\t\t\t\t\t\tVALUES ({$filter_id}, {$action_id}, '{$action_param}')");
}
}
db_query($this->link, "COMMIT");
}
}
}
示例3: update_feed_access_key
function update_feed_access_key($link, $feed_id, $is_cat, $owner_uid = false)
{
if (!$owner_uid) {
$owner_uid = $_SESSION["uid"];
}
$sql_is_cat = bool_to_sql_bool($is_cat);
$result = db_query($link, "SELECT access_key FROM ttrss_access_keys\n\t\t\tWHERE feed_id = '{$feed_id}'\tAND is_cat = {$sql_is_cat}\n\t\t\tAND owner_uid = " . $owner_uid);
if (db_num_rows($result) == 1) {
$key = db_escape_string(sha1(uniqid(rand(), true)));
db_query($link, "UPDATE ttrss_access_keys SET access_key = '{$key}'\n\t\t\t\tWHERE feed_id = '{$feed_id}' AND is_cat = {$sql_is_cat}\n\t\t\t\tAND owner_uid = " . $owner_uid);
return $key;
} else {
return get_feed_access_key($link, $feed_id, $is_cat, $owner_uid);
}
}
示例4: get_feed_access_key
function get_feed_access_key($link, $feed_id, $is_cat, $owner_uid = false)
{
if (!$owner_uid) {
$owner_uid = $_SESSION["uid"];
}
$sql_is_cat = bool_to_sql_bool($is_cat);
$result = db_query($link, "SELECT access_key FROM ttrss_access_keys\n\t\t\tWHERE feed_id = '{$feed_id}'\tAND is_cat = {$sql_is_cat}\n\t\t\tAND owner_uid = " . $owner_uid);
if (db_num_rows($result) == 1) {
return db_fetch_result($result, 0, "access_key");
} else {
$key = db_escape_string(sha1(uniqid(rand(), true)));
$result = db_query($link, "INSERT INTO ttrss_access_keys\n\t\t\t\t(access_key, feed_id, is_cat, owner_uid)\n\t\t\t\tVALUES ('{$key}', '{$feed_id}', {$sql_is_cat}, '{$owner_uid}')");
return $key;
}
return false;
}
示例5: hook_article_filter
function hook_article_filter($article)
{
if (!function_exists("curl_init")) {
return $article;
}
// do not process an article more than once
if (strpos($article['plugin_data'], "fullpost,{$owner_uid}:") !== false) {
if (isset($article['stored']['content'])) {
$article['content'] = $article['stored']['content'];
}
break;
}
$json_conf = $this->host->get($this, 'json_conf');
$showInfoEnabled = sql_bool_to_bool($this->host->get($this, "af_fullpost_showinfo", bool_to_sql_bool(TRUE)));
$owner_uid = $article['owner_uid'];
// get url's for exclusion
$data = explode(',', str_replace(",,", ",", str_replace("\n", ",", $json_conf)));
//$data = explode(",", $json_conf);
try {
// if there is some stuff in the array
if (is_array($data)) {
// check url for excluded
foreach ($data as $urlpart) {
if (stripos($article['link'], trim($urlpart)) !== false) {
$check_content = "Skipped";
break;
}
}
}
// if the array is empty or url in list
if ($check_content != "Skipped") {
$check_content = $this->get_full_post($article['link']);
}
// If enabled print some information if content was processed by readability
if ($check_content != "Failed" && $check_content != "Skipped" && trim($check_content) != "") {
$article['content'] = $check_content;
if ($showInfoEnabled === True) {
$article['content'] .= "<br>Processed by Readability";
}
} elseif ($check_content == "Skipped") {
$article['content'] = $article['content'];
if ($showInfoEnabled === True) {
$article['content'] .= "<br>You skipped Readability";
}
} else {
$article['content'] = $article['content'];
if ($showInfoEnabled === True) {
$article['content'] .= "<br>Failed processing by Readability";
}
}
} catch (Exception $e) {
// Readability failed to parse the page (?); don't process this article and keep going
$article['content'] = $article['content'] . "<br>ERROR processing by Readability<br>" . $e;
}
// clean links without http, some sites do <img src="//www.site.com"> for safe to get images with http and https
$toClean = array("\"//");
$article["content"] = str_replace($toClean, "\"http://", $article["content"], $count);
if ($showInfoEnabled === True) {
$article['content'] .= " + " . $count . " Replacements";
}
// mark article as processed
$article['plugin_data'] = "fullpost,{$owner_uid}:" . $article['plugin_data'];
return $article;
}
示例6: saveRulesAndActions
private function saveRulesAndActions($filter_id)
{
db_query($this->link, "DELETE FROM ttrss_filters2_rules WHERE filter_id = '{$filter_id}'");
db_query($this->link, "DELETE FROM ttrss_filters2_actions WHERE filter_id = '{$filter_id}'");
if ($filter_id) {
/* create rules */
$rules = array();
$actions = array();
foreach ($_REQUEST["rule"] as $rule) {
$rule = json_decode($rule, true);
unset($rule["id"]);
if (array_search($rule, $rules) === false) {
array_push($rules, $rule);
}
}
foreach ($_REQUEST["action"] as $action) {
$action = json_decode($action, true);
unset($action["id"]);
if (array_search($action, $actions) === false) {
array_push($actions, $action);
}
}
foreach ($rules as $rule) {
if ($rule) {
$reg_exp = strip_tags(db_escape_string(trim($rule["reg_exp"])));
$filter_type = (int) db_escape_string(trim($rule["filter_type"]));
$feed_id = db_escape_string(trim($rule["feed_id"]));
if (strpos($feed_id, "CAT:") === 0) {
$cat_filter = bool_to_sql_bool(true);
$cat_id = (int) substr($feed_id, 4);
$feed_id = "NULL";
if (!$cat_id) {
$cat_id = "NULL";
}
// Uncategorized
} else {
$cat_filter = bool_to_sql_bool(false);
$feed_id = (int) $feed_id;
$cat_id = "NULL";
if (!$feed_id) {
$feed_id = "NULL";
}
// Uncategorized
}
$query = "INSERT INTO ttrss_filters2_rules\n\t\t\t\t\t\t(filter_id, reg_exp,filter_type,feed_id,cat_id,cat_filter) VALUES\n\t\t\t\t\t\t('{$filter_id}', '{$reg_exp}', '{$filter_type}', {$feed_id}, {$cat_id}, {$cat_filter})";
db_query($this->link, $query);
}
}
foreach ($actions as $action) {
if ($action) {
$action_id = (int) db_escape_string($action["action_id"]);
$action_param = db_escape_string($action["action_param"]);
$action_param_label = db_escape_string($action["action_param_label"]);
if ($action_id == 7) {
$action_param = $action_param_label;
}
if ($action_id == 6) {
$action_param = (int) str_replace("+", "", $action_param);
}
$query = "INSERT INTO ttrss_filters2_actions\n\t\t\t\t\t\t(filter_id, action_id, action_param) VALUES\n\t\t\t\t\t\t('{$filter_id}', '{$action_id}', '{$action_param}')";
db_query($this->link, $query);
}
}
}
}
示例7: db_query
if (authenticate_user($link, $login, $password)) {
$result = db_query($link, "SELECT * FROM ttirc_settings_profiles\n\t\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY title");
print "<select style='width: 100%' name='profile'>";
print "<option value='0'>" . __("Default profile") . "</option>";
while ($line = db_fetch_assoc($result)) {
$id = $line["id"];
$title = $line["title"];
print "<option value='{$id}'>{$title}</option>";
}
print "</select>";
$_SESSION = array();
}
break;
case "toggle-connection":
$connection_id = (int) db_escape_string($_REQUEST["connection_id"]);
$status = bool_to_sql_bool(db_escape_string($_REQUEST["set_enabled"]));
db_query($link, "UPDATE ttirc_connections SET enabled = '{$status}'\n\t\t\tWHERE id = '{$connection_id}' AND owner_uid = " . $_SESSION["uid"]);
print json_encode(array("status" => $status));
break;
case "prefs-edit-notify":
notification_editor($link);
break;
case "prefs-save-notify":
$notify_events = json_encode($_REQUEST["notify_event"]);
set_pref($link, "NOTIFY_ON", $notify_events);
break;
case "prefs-edit-twitter":
twitter_editor($link);
break;
case "tweet-dlg":
$text = $_REQUEST['text'];
示例8: perform_data_import
function perform_data_import($filename, $owner_uid)
{
$num_imported = 0;
$num_processed = 0;
$num_feeds_created = 0;
libxml_disable_entity_loader(false);
$doc = @DOMDocument::load($filename);
if (!$doc) {
$contents = file_get_contents($filename);
if ($contents) {
$data = @gzuncompress($contents);
}
if (!$data) {
$data = @gzdecode($contents);
}
if ($data) {
$doc = DOMDocument::loadXML($data);
}
}
libxml_disable_entity_loader(true);
if ($doc) {
$xpath = new DOMXpath($doc);
$container = $doc->firstChild;
if ($container && $container->hasAttribute('schema-version')) {
$schema_version = $container->getAttribute('schema-version');
if ($schema_version != SCHEMA_VERSION) {
print "<p>" . __("Could not import: incorrect schema version.") . "</p>";
return;
}
} else {
print "<p>" . __("Could not import: unrecognized document format.") . "</p>";
return;
}
$articles = $xpath->query("//article");
foreach ($articles as $article_node) {
if ($article_node->childNodes) {
$ref_id = 0;
$article = array();
foreach ($article_node->childNodes as $child) {
if ($child->nodeName != 'label_cache') {
$article[$child->nodeName] = db_escape_string($child->nodeValue);
} else {
$article[$child->nodeName] = $child->nodeValue;
}
}
//print_r($article);
if ($article['guid']) {
++$num_processed;
//db_query("BEGIN");
//print 'GUID:' . $article['guid'] . "\n";
$result = db_query("SELECT id FROM ttrss_entries\n\t\t\t\t\t\t\tWHERE guid = '" . $article['guid'] . "'");
if (db_num_rows($result) == 0) {
$result = db_query("INSERT INTO ttrss_entries\n\t\t\t\t\t\t\t\t\t(title,\n\t\t\t\t\t\t\t\t\tguid,\n\t\t\t\t\t\t\t\t\tlink,\n\t\t\t\t\t\t\t\t\tupdated,\n\t\t\t\t\t\t\t\t\tcontent,\n\t\t\t\t\t\t\t\t\tcontent_hash,\n\t\t\t\t\t\t\t\t\tno_orig_date,\n\t\t\t\t\t\t\t\t\tdate_updated,\n\t\t\t\t\t\t\t\t\tdate_entered,\n\t\t\t\t\t\t\t\t\tcomments,\n\t\t\t\t\t\t\t\t\tnum_comments,\n\t\t\t\t\t\t\t\t\tauthor)\n\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t('" . $article['title'] . "',\n\t\t\t\t\t\t\t\t\t'" . $article['guid'] . "',\n\t\t\t\t\t\t\t\t\t'" . $article['link'] . "',\n\t\t\t\t\t\t\t\t\t'" . $article['updated'] . "',\n\t\t\t\t\t\t\t\t\t'" . $article['content'] . "',\n\t\t\t\t\t\t\t\t\t'" . sha1($article['content']) . "',\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t\t'0',\n\t\t\t\t\t\t\t\t\t'')");
$result = db_query("SELECT id FROM ttrss_entries\n\t\t\t\t\t\t\t\tWHERE guid = '" . $article['guid'] . "'");
if (db_num_rows($result) != 0) {
$ref_id = db_fetch_result($result, 0, "id");
}
} else {
$ref_id = db_fetch_result($result, 0, "id");
}
//print "Got ref ID: $ref_id\n";
if ($ref_id) {
$feed_url = $article['feed_url'];
$feed_title = $article['feed_title'];
$feed = 'NULL';
if ($feed_url && $feed_title) {
$result = db_query("SELECT id FROM ttrss_feeds\n\t\t\t\t\t\t\t\t\tWHERE feed_url = '{$feed_url}' AND owner_uid = '{$owner_uid}'");
if (db_num_rows($result) != 0) {
$feed = db_fetch_result($result, 0, "id");
} else {
// try autocreating feed in Uncategorized...
$result = db_query("INSERT INTO ttrss_feeds (owner_uid,\n\t\t\t\t\t\t\t\t\t\tfeed_url, title) VALUES ({$owner_uid}, '{$feed_url}', '{$feed_title}')");
$result = db_query("SELECT id FROM ttrss_feeds\n\t\t\t\t\t\t\t\t\t\tWHERE feed_url = '{$feed_url}' AND owner_uid = '{$owner_uid}'");
if (db_num_rows($result) != 0) {
++$num_feeds_created;
$feed = db_fetch_result($result, 0, "id");
}
}
}
if ($feed != 'NULL') {
$feed_qpart = "feed_id = {$feed}";
} else {
$feed_qpart = "feed_id IS NULL";
}
//print "$ref_id / $feed / " . $article['title'] . "\n";
$result = db_query("SELECT int_id FROM ttrss_user_entries\n\t\t\t\t\t\t\t\tWHERE ref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' AND {$feed_qpart}");
if (db_num_rows($result) == 0) {
$marked = bool_to_sql_bool(sql_bool_to_bool($article['marked']));
$published = bool_to_sql_bool(sql_bool_to_bool($article['published']));
$score = (int) $article['score'];
$tag_cache = $article['tag_cache'];
$label_cache = db_escape_string($article['label_cache']);
$note = $article['note'];
//print "Importing " . $article['title'] . "<br/>";
++$num_imported;
$result = db_query("INSERT INTO ttrss_user_entries\n\t\t\t\t\t\t\t\t\t(ref_id, owner_uid, feed_id, unread, last_read, marked,\n\t\t\t\t\t\t\t\t\t\tpublished, score, tag_cache, label_cache, uuid, note)\n\t\t\t\t\t\t\t\t\tVALUES ({$ref_id}, {$owner_uid}, {$feed}, false,\n\t\t\t\t\t\t\t\t\t\tNULL, {$marked}, {$published}, {$score}, '{$tag_cache}',\n\t\t\t\t\t\t\t\t\t\t\t'{$label_cache}', '', '{$note}')");
$label_cache = json_decode($label_cache, true);
if (is_array($label_cache) && $label_cache["no-labels"] != 1) {
foreach ($label_cache as $label) {
label_create($label[1], $label[2], $label[3], $owner_uid);
//.........这里部分代码省略.........
示例9: opml_import_domdoc
function opml_import_domdoc($link, $owner_uid)
{
if (is_file($_FILES['opml_file']['tmp_name'])) {
$doc = DOMDocument::load($_FILES['opml_file']['tmp_name']);
$result = db_query($link, "SELECT id FROM\n\t\t\t\tttrss_feed_categories WHERE title = 'Imported feeds' AND\n\t\t\t\towner_uid = '{$owner_uid}' LIMIT 1");
if (db_num_rows($result) == 1) {
$default_cat_id = db_fetch_result($result, 0, "id");
} else {
$default_cat_id = 0;
}
// Keep imported categories in order, after any pre-existing ones.
$new_cat_order_id = 0;
// Get the highest category order_id in use.
$result = db_query($link, "SELECT order_id FROM\n\t\t\t\tttrss_feed_categories WHERE owner_uid = '{$owner_uid}'\n\t\t\t\tORDER BY order_id DESC LIMIT 1");
if (db_num_rows($result) == 1) {
$new_cat_order_id = db_fetch_result($result, 0, "order_id");
}
if ($doc) {
$body = $doc->getElementsByTagName('body');
$xpath = new DOMXpath($doc);
$query = "/opml/body//outline";
$outlines = $xpath->query($query);
foreach ($outlines as $outline) {
$attributes = $outline->attributes;
$feed_title = db_escape_string($attributes->getNamedItem('text')->nodeValue);
if (!$feed_title) {
$feed_title = db_escape_string($attributes->getNamedItem('title')->nodeValue);
}
$cat_title = db_escape_string($attributes->getNamedItem('title')->nodeValue);
if (!$cat_title) {
$cat_title = db_escape_string($attributes->getNamedItem('text')->nodeValue);
}
$feed_url = db_escape_string($attributes->getNamedItem('xmlUrl')->nodeValue);
if (!$feed_url) {
$feed_url = db_escape_string($attributes->getNamedItem('xmlURL')->nodeValue);
}
$site_url = db_escape_string($attributes->getNamedItem('htmlUrl')->nodeValue);
$pref_name = db_escape_string($attributes->getNamedItem('pref-name')->nodeValue);
$label_name = db_escape_string($attributes->getNamedItem('label-name')->nodeValue);
$filter_name = db_escape_string($attributes->getNamedItem('filter-name')->nodeValue);
if ($cat_title && !$feed_url) {
if ($cat_title != "tt-rss-prefs" && $cat_title != 'tt-rss-labels' && $cat_title != 'tt-rss-filters') {
db_query($link, "BEGIN");
$result = db_query($link, "SELECT id FROM\n\t\t\t\t\t\t\t\t\tttrss_feed_categories WHERE title = '{$cat_title}' AND\n\t\t\t\t\t\t\t\t\towner_uid = '{$owner_uid}' LIMIT 1");
if (db_num_rows($result) == 0) {
$cat_order_id = ++$new_cat_order_id;
printf(__("<li>Adding category <b>%s</b>.</li>"), $cat_title);
db_query($link, "INSERT INTO ttrss_feed_categories\n\t\t\t\t\t\t\t\t\t\t(title,owner_uid,order_id)\n\t\t\t\t\t\t\t\t\t\tVALUES ('{$cat_title}', '{$owner_uid}', '{$cat_order_id}')");
}
db_query($link, "COMMIT");
}
}
// print "$active_category : $feed_title : $feed_url<br>";
if ($pref_name) {
$parent_node = $outline->parentNode;
if ($parent_node && $parent_node->nodeName == "outline") {
$cat_check = $parent_node->attributes->getNamedItem('title')->nodeValue;
if ($cat_check == "tt-rss-prefs") {
$pref_value = db_escape_string($outline->attributes->getNamedItem('value')->nodeValue);
printf("<li>" . __("Setting preference key %s to %s") . "</li>", $pref_name, $pref_value);
set_pref($link, $pref_name, $pref_value);
}
}
}
if ($label_name) {
$parent_node = $outline->parentNode;
if ($parent_node && $parent_node->nodeName == "outline") {
$cat_check = $parent_node->attributes->getNamedItem('title')->nodeValue;
if ($cat_check == "tt-rss-labels") {
$fg_color = db_escape_string($attributes->getNamedItem('label-fg-color')->nodeValue);
$bg_color = db_escape_string($attributes->getNamedItem('label-bg-color')->nodeValue);
if (!label_find_id($link, $label_name, $_SESSION['uid'])) {
printf("<li>" . __("Adding label %s") . "</li>", htmlspecialchars($label_name));
label_create($link, $label_name, $fg_color, $bg_color);
} else {
printf("<li>" . __("Duplicate label: %s") . "</li>", htmlspecialchars($label_name));
}
}
}
}
if ($filter_name) {
$parent_node = $outline->parentNode;
if ($parent_node && $parent_node->nodeName == "outline") {
$cat_check = $parent_node->attributes->getNamedItem('title')->nodeValue;
if ($cat_check == "tt-rss-filters") {
$filter = json_decode($outline->nodeValue, true);
if ($filter) {
$reg_exp = db_escape_string($filter['reg_exp']);
$filter_type = (int) $filter['filter_type'];
$action_id = (int) $filter['action_id'];
$result = db_query($link, "SELECT id FROM ttrss_filters WHERE\n\t\t\t\t\t\t\t\t\t\treg_exp = '{$reg_exp}' AND\n\t\t\t\t\t\t\t\t\t\tfilter_type = '{$filter_type}' AND\n\t\t\t\t\t\t\t\t\t\taction_id = '{$action_id}' AND\n\t\t\t\t\t\t\t\t\t\towner_uid = " . $_SESSION['uid']);
if (db_num_rows($result) == 0) {
$enabled = bool_to_sql_bool($filter['enabled']);
$action_param = db_escape_string($filter['action_param']);
$inverse = bool_to_sql_bool($filter['inverse']);
$filter_param = db_escape_string($filter['filter_param']);
$cat_filter = bool_to_sql_bool($filter['cat_filter']);
$feed_url = db_escape_string($filter['feed_url']);
$cat_title = db_escape_string($filter['cat_title']);
$result = db_query($link, "SELECT id FROM ttrss_feeds WHERE\n\t\t\t\t\t\t\t\t\t\t\tfeed_url = '{$feed_url}' AND owner_uid = " . $_SESSION['uid']);
//.........这里部分代码省略.........
示例10: push_message
function push_message($link, $connection_id, $channel, $message, $incoming = false, $message_type = MSGT_PRIVMSG, $from_nick = false)
{
if (!$message) {
return false;
}
$incoming = bool_to_sql_bool($incoming);
if ($channel != "---") {
$my_nick = get_nick($link, $connection_id);
} else {
$my_nick = "---";
}
if ($from_nick) {
$my_nick = $from_nick;
}
//$message = db_escape_string($message);
$result = db_query($link, "INSERT INTO ttirc_messages \n\t\t\t(incoming, connection_id, channel, sender, message, message_type) VALUES\n\t\t\t({$incoming}, {$connection_id}, '{$channel}', '{$my_nick}', '{$message}', \n\t\t\t'{$message_type}')");
}
示例11: get_feed_access_key
function get_feed_access_key($feed_id, $is_cat, $owner_uid = false)
{
if (!$owner_uid) {
$owner_uid = $_SESSION["uid"];
}
$sql_is_cat = bool_to_sql_bool($is_cat);
$result = db_query("SELECT access_key FROM ttrss_access_keys\n WHERE feed_id = '{$feed_id}' AND is_cat = {$sql_is_cat}\n AND owner_uid = " . $owner_uid);
if (db_num_rows($result) == 1) {
return db_fetch_result($result, 0, "access_key");
}
$key = db_escape_string(uniqid(base_convert(rand(), 10, 36)));
$result = db_query("INSERT INTO ttrss_access_keys\n (access_key, feed_id, is_cat, owner_uid)\n VALUES ('{$key}', '{$feed_id}', {$sql_is_cat}, '{$owner_uid}')");
return $key;
}