예제 #1
0
     }
 }
 $urls = array_unique($urls);
 $u = 0;
 $sql[] = $title = $content = array();
 foreach ($urls as $key => $value) {
     $snoopy = new Snoopy();
     $snoopy->fetch($value);
     $temp = $snoopy->results;
     //title
     if (preg_match($remote_title_match, $temp, $match)) {
         $title = addslashes(trim($match[1]));
     }
     unset($match);
     if ($_POST['throw_similar']) {
         $sim = $news->findByTitle($title);
         if (empty($sim)) {
             //content
             if (preg_match($remote_content_match, $temp, $match)) {
                 $content = addslashes(trim($match[1]));
             }
             $u++;
             $sql[] = "('" . $title . "','" . $content . "','" . $_POST['data']['type_id'] . "'," . $time_stamp . ")";
         }
     } else {
         //content
         if (preg_match($remote_content_match, $temp, $match)) {
             $content = addslashes(trim($match[1]));
         }
         $u++;
         $sql[] = "('" . $title . "','" . $content . "','" . $_POST['data']['type_id'] . "'," . $time_stamp . ")";
예제 #2
0
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2048 $
 */
define('CURSCRIPT', 'detail');
require "../libraries/common.inc.php";
require "../share.inc.php";
uses("news", "tag");
$news = new Newses();
$tag = new Tags();
$conditions = array();
$viewhelper->setTitle(L("info", "tpl"));
$viewhelper->setPosition(L("info", "tpl"), "news/");
if (isset($_GET['title'])) {
    $title = rawurldecode(trim($_GET['title']));
    $res = $news->findByTitle($title);
    $id = $res['id'];
}
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
}
if (!empty($id)) {
    require CACHE_PATH . "cache_type.php";
    $news->clicked($id);
    $info = $news->read("*", $id);
    if (empty($info) or !$info) {
        flash("data_not_exists", '', 0);
    }
    if (!empty($info['tag_ids'])) {
        $tag->getTagsByIds($info['tag_ids'], true);
        $info['tag'] = $tag->tag;