function hook_article_filter($article) { if (strpos($article["link"], "volksstimme.de") !== FALSE) { $doc = new DOMDocument(); @$doc->loadHTML(mb_convert_encoding(fetch_file_contents($article["link"]), 'HTML-ENTITIES', "auto")); $basenode = ""; if ($doc) { $xpath = new DOMXPath($doc); // first remove advertisement stuff /* $stuff = $xpath->query('(//div[contains(@class, "em_left")])|(//div[contains(@class, "em_artikelansicht_tags")])|(//div[contains(@class, "em_ads_")])'); */ /* foreach ($stuff as $removethis) { */ /* $removethis->parentNode->removeChild($removethis); */ /* } */ $entries = $xpath->query('(//div[@itemprop="image"]|//div[@itemprop="articleBody"])'); foreach ($entries as $entry) { _debug("Muh, found stuff..."); $basenode = $basenode . $doc->saveXML($entry); _debug("Length of basenode: " . strlen($basenode)); } if (!empty($basenode)) { $article["content"] = $basenode; } } } return $article; }
public function __call($event, $args) { if ($this->state) { _debug("calling state handler '" . $this->state . "' for incoming event '" . $event . "'"); $call = method_exists($this, $this->state) ? array(&$this, $this->state) : $this->state; $r = call_user_func($call, $event, $args); if (is_array($r) && sizeof($r) == 2) { list($this->state, $ret) = $r; } else { if (is_array($r) && sizeof($r) == 1) { $this->state = $r[0]; } else { if (is_string($r)) { $this->state = $r; } else { $this->handle_invalid_state($r); } } } _debug("current state '" . $this->state . "'"); if (is_array($r) && sizeof($r) == 2) { return $ret; } } else { _debug("invalid state found, nothing called for event " . $event . ""); } }
function hook_article_filter($article) { if (strpos($article["link"], "taz.de") !== FALSE) { $doc = new DOMDocument(); @$doc->loadHTML(mb_convert_encoding(fetch_file_contents($article["link"]), 'HTML-ENTITIES', "UTF-8")); $basenode = false; if ($doc) { $xpath = new DOMXPath($doc); // first remove advertisement stuff $stuff = $xpath->query('(//script)|(//noscript)|(//iframe)|(//style)|(//div[@class="sectfoot"])|(//div[@id="tzi_paywall"])|(//div[contains(@class, "rack")])'); foreach ($stuff as $removethis) { _debug("Remove1: " . $doc->saveXML($removethis)); $removethis->parentNode->removeChild($removethis); } $entries = $xpath->query('(//div[@class="sectbody"])'); foreach ($entries as $entry) { $basenode = $entry; break; } if ($basenode) { _debug("Result: " . $doc->saveXML($basenode)); $article["content"] = $doc->saveXML($basenode); } } } return $article; }
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; } }
/** * * Function sort out paramaters * This function creates folders needed when duplicating a template * @param number $folder_name_id - the id of this template * @param number $tutorial_id_from_post - the parent template name for the new tutorial * @version 1.0 * @author Patrick Lockley */ function create_new_template($folder_name_id, $parent_template_name) { global $dir_path, $new_path, $temp_dir_path, $temp_new_path, $xerte_toolkits_site; $row_framework = db_query_one("SELECT template_framework from {$xerte_toolkits_site->database_table_prefix}originaltemplatesdetails WHERE template_name = ?", array($parent_template_name)); // I think this is wrong, currently looking like : /home/david/src/xerteonlinetoolkits/modules//templates/0 should presumably be home/david/src/xerteonlinetoolkits/modules/xerte/templates/Nottingham $dir_path = $xerte_toolkits_site->basic_template_path . $row_framework['template_framework'] . "/templates/" . $parent_template_name; /** * Get the id of the folder we are looking to copy into */ _debug("Creating new template : {$folder_name_id}, {$parent_template_name}"); $new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $parent_template_name; $path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $parent_template_name; if (is_dir($path)) { _debug("Trying to create new template at location - {$path} - it's already in use. Aborting"); die("Template directory already exists; will not overwrite/re-create."); } if (mkdir($path)) { _debug("Created {$path} ok"); if (@chmod($path, 0777)) { $ok = copy_r($dir_path, $path); _debug("Copy_r returned " . print_r($ok, true)); return $ok; } else { _debug("Failed to set rights "); receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "MAJOR", "Failed to set rights on parent folder for template", "Failed to set rights on parent folder " . $path); return false; } } else { receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "CRITICAL", "Failed to create parent folder for template", "Failed to create parent folder " . $path); return false; } }
function process(&$article) { if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "Comic:") !== FALSE) { if ($debug_enabled) { _debug("af_pennyarcade: Processing comic"); } $doc = new DOMDocument(); $doc->loadHTML(fetch_file_contents($article["link"])); $basenode = false; if ($doc) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0); if ($basenode) { $article["content"] = $doc->saveXML($basenode); } } return true; } if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "News Post:") !== FALSE) { if ($debug_enabled) { _debug("af_pennyarcade: Processing news post"); } $doc = new DOMDocument(); $doc->loadHTML(fetch_file_contents($article["link"])); if ($doc) { $xpath = new DOMXPath($doc); $entries = $xpath->query('(//div[@class="post"])'); $basenode = false; foreach ($entries as $entry) { $basenode = $entry; } $meta = $xpath->query('(//div[@class="meta"])')->item(0); if ($meta->parentNode) { $meta->parentNode->removeChild($meta); } $header = $xpath->query('(//div[@class="postBody"]/h2)')->item(0); if ($header->parentNode) { $header->parentNode->removeChild($header); } $header = $xpath->query('(//div[@class="postBody"]/div[@class="comicPost"])')->item(0); if ($header->parentNode) { $header->parentNode->removeChild($header); } $avatar = $xpath->query('(//div[@class="avatar"]//img)')->item(0); if ($basenode) { $basenode->insertBefore($avatar, $basenode->firstChild); } $uninteresting = $xpath->query('(//div[@class="avatar"])'); foreach ($uninteresting as $i) { $i->parentNode->removeChild($i); } if ($basenode) { $article["content"] = $doc->saveXML($basenode); } } return true; } return false; }
function hook_article_filter($article) { $owner_uid = $article["owner_uid"]; if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "Comic:") !== FALSE) { if (strpos($article["plugin_data"], "pennyarcade,{$owner_uid}:") === FALSE) { if ($debug_enabled) { _debug("af_pennyarcade: Processing comic"); } $doc = new DOMDocument(); $doc->loadHTML(fetch_file_contents($article["link"])); $basenode = false; if ($doc) { $xpath = new DOMXPath($doc); $entries = $xpath->query('(//div[@class="post comic"])'); foreach ($entries as $entry) { $basenode = $entry; } if ($basenode) { $article["content"] = $doc->saveXML($basenode); $article["plugin_data"] = "pennyarcade,{$owner_uid}:" . $article["plugin_data"]; } } } else { if (isset($article["stored"]["content"])) { $article["content"] = $article["stored"]["content"]; } } } if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "News Post:") !== FALSE) { if (strpos($article["plugin_data"], "pennyarcade,{$owner_uid}:") === FALSE) { if ($debug_enabled) { _debug("af_pennyarcade: Processing news post"); } $doc = new DOMDocument(); $doc->loadHTML(fetch_file_contents($article["link"])); if ($doc) { $xpath = new DOMXPath($doc); $entries = $xpath->query('(//div[@class="post"])'); $basenode = false; foreach ($entries as $entry) { $basenode = $entry; } $uninteresting = $xpath->query('(//div[@class="heading"])'); foreach ($uninteresting as $i) { $i->parentNode->removeChild($i); } if ($basenode) { $article["content"] = $doc->saveXML($basenode); $article["plugin_data"] = "pennyarcade,{$owner_uid}:" . $article["plugin_data"]; } } } else { if (isset($article["stored"]["content"])) { $article["content"] = $article["stored"]["content"]; } } } return $article; }
/** * Send by mail a digest of last articles. * * @param mixed $link The database connection. * @param integer $limit The maximum number of articles by digest. * @return boolean Return false if digests are not enabled. */ function send_headlines_digests($debug = false) { require_once 'classes/ttrssmailer.php'; $user_limit = 15; // amount of users to process (e.g. emails to send out) $limit = 1000; // maximum amount of headlines to include if ($debug) { _debug("Sending digests, batch of max {$user_limit} users, headline limit = {$limit}"); } if (DB_TYPE == "pgsql") { $interval_query = "last_digest_sent < NOW() - INTERVAL '1 days'"; } elseif (DB_TYPE == "mysql") { $interval_query = "last_digest_sent < DATE_SUB(NOW(), INTERVAL 1 DAY)"; } $result = db_query("SELECT id,email FROM ttrss_users\n WHERE email != '' AND (last_digest_sent IS NULL OR {$interval_query})"); while ($line = db_fetch_assoc($result)) { if (@get_pref('DIGEST_ENABLE', $line['id'], false)) { $preferred_ts = strtotime(get_pref('DIGEST_PREFERRED_TIME', $line['id'], '00:00')); // try to send digests within 2 hours of preferred time if ($preferred_ts && time() >= $preferred_ts && time() - $preferred_ts <= 7200) { if ($debug) { _debug("Sending digest for UID:" . $line['id'] . " - " . $line["email"]); } $do_catchup = get_pref('DIGEST_CATCHUP', $line['id'], false); global $tz_offset; // reset tz_offset global to prevent tz cache clash between users $tz_offset = -1; $tuple = prepare_headlines_digest($line["id"], 1, $limit); $digest = $tuple[0]; $headlines_count = $tuple[1]; $affected_ids = $tuple[2]; $digest_text = $tuple[3]; if ($headlines_count > 0) { $mail = new ttrssMailer(); $rc = $mail->quickMail($line["email"], $line["login"], DIGEST_SUBJECT, $digest, $digest_text); if (!$rc && $debug) { _debug("ERROR: " . $mail->ErrorInfo); } if ($debug) { _debug("RC={$rc}"); } if ($rc && $do_catchup) { if ($debug) { _debug("Marking affected articles as read..."); } catchupArticlesById($affected_ids, 0, $line["id"]); } } elseif ($debug) { _debug("No headlines"); } db_query("UPDATE ttrss_users SET last_digest_sent = NOW()\n WHERE id = " . $line["id"]); } } } if ($debug) { _debug("All done."); } }
function logout() { global $_SESSION; _debug("logging out user " . $_SESSION["s_user"]); $_SESSION = array(); session_destroy(); header("location: " . $GLOBALS["script_name"]); }
public static function shutdown_handler() { try { if (null !== ($error = error_get_last())) { throw new JAXLException($error['message'], $error['type'], $error['file'], $error['line']); } } catch (Exception $e) { _debug("shutdown handler catched with exception " . json_encode($e)); } }
public function logged_out($stanza) { if ($stanza->name == "error" && $stanza->ns == NS_XMPP) { $reason = $stanza->childrens[0]->name; $this->jaxl->handle_auth_failure($reason); $this->jaxl->send_end_stream(); return array("logged_out", 0); } else { _debug("uncatched stanza received in logged_out"); } }
public function actionShow() { $url = end(App::parseRoute($_SERVER['REQUEST_URI'])['routes']); $article = Article::findOne(['url_crc' => crc32($url)]); _debug('Url: ' . $url . ' (crc: ' . crc32($url) . ')'); if (empty($article)) { return Controller::redirectTo404($_SERVER['REQUEST_URI']); } $comments = $article->getComments(); return $this->view->render('showArticle', ['article' => $article, 'commentsCount' => count($comments), 'comments' => $comments]); }
function hook_article_filter($article) { if ($this->lang) { $entry_language = $this->lang->detect($article['title'] . " " . $article['content'], 1); if (count($entry_language) > 0) { $possible = array_keys($entry_language); $entry_language = $possible[0]; _debug("detected language: {$entry_language}"); $article["language"] = $entry_language; } } return $article; }
function add_transcode_job($inputFilename, $outputFilename) { // Ubuntu 14.04 - libav-tools, libavcodec-extra-54 if (is_file('/usr/bin/ffmpeg')) { $cmd = 'ffmpeg -i ' . escapeshellarg($inputFilename) . ' -sameq -ar 22050 -vcodec libx264 ' . escapeshellarg($outputFilename) . ' 2>&1'; } else { $cmd = 'avconv ' . '-i ' . escapeshellarg($inputFilename) . ' -c:v h264 ' . '-b:v 2000k ' . '-c:a aac ' . '-b:a 196k ' . '-f mp4 ' . '-strict experimental ' . escapeshellarg($outputFilename) . ' 2>&1'; } _debug("Running: {$cmd}"); $output = array(); $return = null; exec($cmd, $output, $return); _debug("Returned: {$return}, Output: " . print_r($output, true)); }
/** * Wordpress filter (see add_filter), designed to hook in on the action/event 'editor_save_data'. * * Check the validity of the XML passed in when saving a template via use of simplexml_load_string. * If there are errors, we _debug() them and return boolean false. * If there aren't any errors, we return the pretty printed variant of the string. * * @return string (xml) or boolean false on failure */ function xml_check_parseability() { $args = func_get_args(); $xml_string = $args[0]; $validator = new Xerte_Validate_Xml(); if ($validator->isValid($xml_string)) { _debug("XML parsing passed"); return $xml_string; } else { _debug("Invalid XML passed in : '{$xml_string}'"); error_log("Invalid XML passed in : '{$xml_string}'"); return false; } }
function _debugToFile($value, $print_r = false, $novoArquivo = false) { $caminho = $_SERVER["SCRIPT_FILENAME"]; _debug($caminho); $pos = strrpos($caminho, "/"); $arquivo = substr($caminho, 0, $pos + 1) . "err.log"; if ($print_r == true) { $e = new Exception(); $value = print_r($value, true) . "\n" . $e->getTraceAsString(); } $f = fopen($arquivo, $novoArquivo ? "w+" : "a+"); $linha = date("d/m/Y H:i:s") . " : " . $value . "\n"; fwrite($f, $linha); fclose($f); }
/** * @see modules/site/engine/upload.php */ function filter_by_extension_name() { Xerte_Validate_FileExtension::$BLACKLIST = 'php,php5,pl,cgi,exe,vbs,pif,application,gadget,msi,msp,com,scr,hta,htaccess,ini,cpl,msc,jar,bat,cmd,vb,vbe,jsp,jse,ws,wsf,wsc,wsh,ps1,ps1xml,ps2,ps2xml,psc1,psc2,msh,msh1,msh2,mshxml,msh1xml,msh2xml,scf,lnk,inf,reg,docm,dotm,xlsm,xltm,xlam,pptm,potm,ppam,ppsm,sldm'; $args = func_get_args(); $files = $args[0]; if (!Xerte_Validate_FileExtension::canRun()) { return $files; } foreach ($files as $file) { $validator = new Xerte_Validate_FileExtension(); if (!$validator->isValid($file['name'])) { _debug("Invalid file {$file['name']} type uploaded - matches blacklist"); return false; } } return $files; }
function upload_items($dir) { _debug("fun_up_ajaxupload.upload_items({$dir})"); if (!permissions_grant($dir, NULL, "create")) { show_error($GLOBALS["error_msg"]["accessfunc"]); } if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") { _debug("linking to list({$dir})"); header("Location: " . make_link("list", $dir, NULL)); return; } global $no_access; $additional_header_information = file_get_contents("_lib/ajaxupload/upload.html"); $additional_header_information = preg_replace("/@destination_folder@/", $dir, $additional_header_information); $additional_header_information = preg_replace("/@filter_pattern@/", "/{$no_access}/", $additional_header_information); show_header($GLOBALS["messages"]["actupload"], $additional_header_information); ?> <br> <div id="example1" class="example"> <div class="wrapper"> <div id="button1" class="button">Upload</div> </div> <ol class="status"></ol> <p>Uploaded files:</p> <ol class="files"></ol> </div> <table> <tr> <td> <input type="button" onClick="window.location = '<?php echo make_link("list", $dir, NULL); ?> ';" value="<?php echo $GLOBALS["error_msg"]["back"]; ?> "> </td> </tr> </table> </form> <br> <?php return; }
public function start($method = 'GET') { $this->method = $method; $this->parts = parse_url($this->url); $transport = $this->_transport(); $ip = $this->_ip(); $port = $this->_port(); $socket_path = $transport . '://' . $ip . ':' . $port; if ($this->client->connect($socket_path)) { _debug("connection to {$this->url} established"); // send request data $this->send_request(); // start main loop JAXLLoop::run(); } else { _debug("unable to open {$this->url}"); } }
function xml_import($args) { $filename = $args['xml_import']; if (!is_file($filename)) { print "error: input filename ({$filename}) doesn't exist.\n"; return; } _debug("please enter your username:"******"importing {$filename} for user {$username}...\n"); $result = db_query("SELECT id FROM ttrss_users WHERE login = '******'"); if (db_num_rows($result) == 0) { print "error: could not find user {$username}.\n"; return; } $owner_uid = db_fetch_result($result, 0, "id"); $this->perform_data_import($filename, $owner_uid); }
static function save(rAntiSpamAttrActionHandler $self, $record) { $chks = array($self->GetName(), $self->GetName() . "2", $self->GetName() . "_confirm"); _debug($_POST); foreach ($chks as $chk) { _debug($chk); if (!isset($record[$chk]) || empty($record[$chk]) || !is_numeric($record[$chk])) { throw new YoureARobotException(); } } if ($record[$self->GetName()] + $record[$self->GetName() . "2"] == $record[$self->GetName() . "_confirm"]) { foreach ($chks as $chk) { unset($record[$chk]); } } else { throw new YoureARobotException(); } }
public function isValid($filename) { $this->messages = array(); $blacklist = explode(',', strtolower(self::$BLACKLIST)); $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); _debug($blacklist); _debug($extension); if (empty($extension)) { _debug("File extension not found for '{$filename}'."); $this->messages['NO_EXTENSION'] = "File extension not found."; return false; } if (in_array($extension, $blacklist)) { _debug("Invalid file type uploaded - '{$extension}' matches entry in blacklist"); $this->messages["INVALID_EXTENSION"] = "Invalid file format - {$extension} is blacklisted"; return false; } return true; }
public function isValid($filename) { $this->messages = array(); if (file_exists($filename)) { $command = self::$BINARY . " " . escapeshellarg($filename); $retval = -1; exec($command, $output, $retval); if ($retval == 0) { return true; } else { error_log("Virus found in file upload? {$filename} --- From " . __FILE__ . " - ClamAV output: {$retval} / {$output}"); _debug("Virus found? {$retval} / {$output} (When scanning : {$filename})"); $this->messages[$retval] = "Virus found? {$output}"; } } else { $this->messages['FILE_NOT_FOUND'] = "{$filename} doesn't exist. Cannot scan"; } return false; }
/** * @see modules/site/engine/upload.php */ function filter_by_mimetype() { $args = func_get_args(); $files = $args[0]; _debug($args); foreach ($files as $file) { _debug("Checking {$file['name']} for mimetype etc"); $user_filename = $file['name']; $php_upload_filename = $file['tmp_name']; $validator = new Xerte_Validate_FileMimeType(); if ($validator->isValid($php_upload_filename)) { _debug("Mime check of {$php_upload_filename} ({$user_filename}) - ok"); } else { _debug("Mime check of {$php_upload_filename} ({$user_filename}) failed. "); return false; } } return $files; }
function parse_args() { global $config_values, $argc, $argv, $test_run, $verbosity; for ($i = 1; $i < $argc; $i++) { switch ($_SERVER['argv'][$i]) { case '-c': $i++; $config_values['Settings']['Cache Dir'] = $_SERVER['argv'][$i]; break; case '-C': unset($config_values['Settings']['Cache Dir']); break; case '-d': $config_values['Settings']['Run Torrentwatch'] = 0; break; case '-D': $config_values['Settings']['Run Torrentwatch'] = 1; break; case '-h': usage(); exit(1); case '-nv': $verbosity = 0; break; case '-q': $verbosity = -1; break; case '-t': $test_run = 1; break; case '-v': $verbosity = 1; break; case '-vv': $verbosity = 2; break; default: _debug("Unknown command line argument: " . $_SERVER['argv'][$i] . "\n", 0); break; } } }
/** * checks if the fields already exist and if so, disables them (sets them to be "hidden") */ function _updateFields() { $customFields = new CustomFields(); $blogFields = $customFields->getBlogCustomFields($this->_blogInfo->getId()); // check if the checkbox fields exists if (array_key_exists("password_protected", $blogFields)) { _debug("hiding! password field!"); $protectedField = $blogFields["password_protected"]; $protectedField->setHidden(true); $customFields->updateCustomField($protectedField); } // check if the field for the password exists if (array_key_exists("password_field", $blogFields)) { _debug("hiding! pass-word field!"); $passwordField = $blogFields["password_field"]; $passwordField->setHidden(true); $customFields->updateCustomField($passwordField); } return true; }
public static function saveArticle($params) { if (isset($params['id'])) { $article = Article::findById($params['id']); } else { $article = new Article(); } if ($article->checkRequiredColumns($params)) { $url = Text::translitUrl($params['title']); $article->author_id = 1; $article->title = $params['title']; $article->url = $url; $article->url_crc = crc32($url); $article->content = $params['content']; $article->img_preview_url = $params['img_preview_url']; $article->save(); } _debug('saving article...'); _debug('url: ' . $url . ' (crc: ' . crc32($url) . ')', true); }
public function check() { global $xerte_toolkits_site; _debug("Calling check"); // check for existence of the 'user' db table? $x = db_query("select 1 from {$xerte_toolkits_site->database_table_prefix}user"); if ($x === false) { // Create the user table $x = db_query("create table {$xerte_toolkits_site->database_table_prefix}user ( `iduser` INT NOT NULL AUTO_INCREMENT, `username` VARCHAR(45) NULL , `password` VARCHAR(45) NULL , `firstname` VARCHAR(45) NULL , `surname` VARCHAR(45) NULL , `email` VARCHAR(45) NULL, PRIMARY KEY (`iduser`) )"); if (empty($x)) { _debug("Failed: Does the user table exist?"); $this->addError("Does the user table exist?"); return false; } else { _debug("Succeeded!"); return true; } } _debug("Succeeded!"); return true; }
function _download_items($dir, $items) { // check if user selected any items to download _debug("count items: '{$items['0']}'"); if (count($items) == 0) { show_error($GLOBALS["error_msg"]["miscselitems"]); } // check if user has permissions to download // this file if (!_is_download_allowed($dir, $items)) { show_error($GLOBALS["error_msg"]["accessitem"]); } // if we have exactly one file and this is a real // file we directly download it if (count($items) == 1 && get_is_file($dir, $items[0])) { $abs_item = get_abs_item($dir, $items[0]); _download($abs_item, $items[0]); } // otherwise we do the zip download zip_download(get_abs_dir($dir), $items); }
function hook_article_filter($article) { $wpm = 180; // arbitrary value, based on adult averages $word_count = str_word_count($article["content"]); $minutes = round($word_count / $wpm); $minimum_time_bucket = 5; // minutes $time_label = $this->minutes_to_time_label($minutes, $minimum_time_bucket); _debug("estimated reading time: {$minutes} min ({$time_label}), based on {$word_count} words at {$wpm} WPM"); $owner_uid = $article["owner_uid"]; if (!label_find_id($time_label, $owner_uid)) { label_create($time_label); } $guid = $article["guid"]; $result = db_query("SELECT id FROM ttrss_entries WHERE guid = '{$guid}'"); if (db_num_rows($result) != 0) { $ref_id = db_fetch_result($result, 0, "id"); label_add_article($ref_id, $time_label, $owner_uid); } return $article; }