- function quickAddCat() {
- $cat = db_escape_string($this->link, $_REQUEST["cat"]);
-
- add_feed_category($this->link, $cat);
-
- $result = db_query($this->link, "SELECT id FROM ttrss_feed_categories WHERE
- title = '$cat' AND owner_uid = " . $_SESSION["uid"]);
-
- if (db_num_rows($result) == 1) {
- $id = db_fetch_result($result, 0, "id");
- } else {
- $id = 0;
- }
-
- print_feed_cat_select($this->link, "cat_id", $id);
- }
-
- function regenFeedKey() {
- $feed_id = db_escape_string($this->link, $_REQUEST['id']);
- $is_cat = db_escape_string($this->link, $_REQUEST['is_cat']) == "true";
-
- $new_key = $this->update_feed_access_key($this->link, $feed_id, $is_cat);
-
- print json_encode(array("link" => $new_key));
- }
-
- // Silent
- function clearKeys() {
- db_query($this->link, "DELETE FROM ttrss_access_keys WHERE
- owner_uid = " . $_SESSION["uid"]);
- }
-
- // Silent
- function clearArticleKeys() {
- db_query($this->link, "UPDATE ttrss_user_entries SET uuid = '' WHERE
- owner_uid = " . $_SESSION["uid"]);
-
- return;
- }
-
- function verifyRegexp() {
- $reg_exp = $_REQUEST["reg_exp"];
-
- $status = @preg_match("/$reg_exp/i", "TEST") !== false;
-
- print json_encode(array("status" => $status));
- }
-
- /* function buttonPlugin() {
- $pclass = "button_" . basename($_REQUEST['plugin']);
- $method = $_REQUEST['plugin_method'];
-
- if (class_exists($pclass)) {
- $plugin = new $pclass($this->link);
- if (method_exists($plugin, $method)) {
- return $plugin->$method();
- }
- }
- } */
-
- function genHash() {
- $hash = sha1(uniqid(rand(), true));
-
- print json_encode(array("hash" => $hash));
- }
-
- function batchAddFeeds() {
- $cat_id = db_escape_string($this->link, $_REQUEST['cat']);
- $feeds = explode("\n", db_escape_string($this->link, $_REQUEST['feeds']));
- $login = db_escape_string($this->link, $_REQUEST['login']);
- $pass = db_escape_string($this->link, $_REQUEST['pass']);
- $need_auth = db_escape_string($this->link, $_REQUEST['need_auth']) != "";
-
- foreach ($feeds as $feed) {
- $feed = trim($feed);
-
- if (validate_feed_url($feed)) {
-
- db_query($this->link, "BEGIN");
-
- if ($cat_id == "0" || !$cat_id) {
- $cat_qpart = "NULL";
- } else {
- $cat_qpart = "'$cat_id'";
- }
-
- $result = db_query($this->link,
- "SELECT id FROM ttrss_feeds
- WHERE feed_url = '$feed' AND owner_uid = ".$_SESSION["uid"]);
-
- if (db_num_rows($result) == 0) {
- $result = db_query($this->link,
- "INSERT INTO ttrss_feeds
- (owner_uid,feed_url,title,cat_id,auth_login,auth_pass,update_method)
- VALUES ('".$_SESSION["uid"]."', '$feed',
- '[Unknown]', $cat_qpart, '$login', '$pass', 0)");