コード例 #1
0
ファイル: function.spider.php プロジェクト: edmundwong/V604
function dom_single_article($content = '', $dom_arr = '')
{
    $content = jammer_replace($content);
    if (!$content) {
        return;
    }
    $html = get_htmldom_obj($content);
    if (!$html) {
        return false;
    }
    if ($dom_arr['title']) {
        $div2 = $html->find('title');
        $re['other']['old_title'] = str_iconv($div2[0]->innertext);
        $re['title'] = dom_get_str($html, $dom_arr['title']);
        $re['other']['old_title'] = jammer_replace($re['other']['old_title'], 1);
        $re['title'] = jammer_replace($re['title'], 1);
        unset($div2);
    }
    $re['content'] = dom_get_str($html, $dom_arr['content']);
    $re['content'] = jammer_replace($re['content'], 1);
    $re['content'] = clear_ad_html($re['content']);
    $html->clear();
    unset($html);
    return $re;
}
コード例 #2
0
ファイル: function.article.php プロジェクト: edmundwong/V604
function forum_article_content($arr)
{
    global $_G;
    require_once libfile('function/editor');
    require_once libfile('function/home');
    $setarr['attachment'] = $arr['attachment'];
    $setarr['message'] = html2bbcode(media_htmlbbcode(dstripslashes(clear_ad_html($arr['message']))));
    $setarr['message'] = htmlspecialchars_decode($setarr['message']);
    if (DISCUZ_VERSION != 'X2') {
        //2.5版本
        $setarr = dstripslashes($setarr);
    } else {
        $setarr = daddslashes($setarr);
    }
    DB::update('forum_post', $setarr, array('pid' => $arr['pid']));
    if (!$arr['is_post'] || $arr['is_post'] > 0 && $arr['attachment'] > 0) {
        DB::update('forum_thread', array('attachment' => $arr['attachment']), array('tid' => $arr['tid']));
    }
    if (!$arr['is_post'] || $arr['is_post'] > 0 && $arr['attachment'] > 0) {
        DB::update('forum_thread', array('attachment' => $arr['attachment']), array('tid' => $arr['tid']));
        //图片列表模式的帖子设置封面
        $forumpicstyle = DB::result_first("SELECT picstyle FROM " . DB::table('forum_forumfield') . " WHERE fid='{$arr['forum_fid']}'");
        if ($forumpicstyle) {
            if ($_G['setting']['forumpicstyle']) {
                $_G['setting']['forumpicstyle'] = dunserialize($_G['setting']['forumpicstyle']);
                empty($_G['setting']['forumpicstyle']['thumbwidth']) && ($_G['setting']['forumpicstyle']['thumbwidth'] = 214);
                empty($_G['setting']['forumpicstyle']['thumbheight']) && ($_G['setting']['forumpicstyle']['thumbheight'] = 160);
            } else {
                $_G['setting']['forumpicstyle'] = array('thumbwidth' => 214, 'thumbheight' => 160);
            }
            setthreadcover($arr['pid']);
        }
    }
}
コード例 #3
0
ファイル: function.pick.php プロジェクト: edmundwong/V604
function pick_log($msg, $args = array())
{
    extract($args);
    $log_dir = PICK_PATH . '/data/log/' . $pid . '/';
    $log_file = $log_dir . date("Y-m-d", time()) . '.txt';
    if (!is_dir($log_dir)) {
        dmkdir($log_dir);
    }
    $msg = clear_ad_html($msg);
    $msg = str_replace(milu_lang('loading'), '', $msg);
    if ($memory) {
        $m_str = 'memory:' . $memory;
    }
    $log_str .= date("Y-m-d H:i:s") . '	' . $m_str . '	' . strip_tags($msg) . "\r\n";
    $log_str .= str_repeat('-', 100) . "\r\n";
    require_once PICK_DIR . '/lib/cache.class.php';
    IO::write($log_file, $log_str, 1);
}
コード例 #4
0
ファイル: pick.class.php プロジェクト: edmundwong/V604
 function article_public($arr)
 {
     global $_G;
     pload('F:article');
     $timing_public_arr = array();
     $is_timing = $this->plugin_set['is_timing'];
     //if(!VIP) $is_timing = 0;
     $class_arr = $this->p_arr['public_class'];
     $old_arr = $arr;
     $arr['title'] = htmlspecialchars_decode($arr['title'], ENT_QUOTES);
     $arr['content'] = htmlspecialchars_decode($arr['content'], ENT_QUOTES);
     unset($arr['pic']);
     $view_arr = format_wrap($this->p_arr['view_num'], ',');
     $arr['view_num'] = rand($view_arr[0], $view_arr[1]);
     $rand_arr = get_rand_uid($this->p_arr);
     $arr['p_arr'] = $this->p_arr;
     $arr['uid'] = $this->public_info['uid'] = $setarr['uid'] = $rand_arr[0]['uid'] ? $rand_arr[0]['uid'] : $_G['uid'];
     $arr['username'] = $setarr['username'] = $rand_arr[0]['username'] ? $rand_arr[0]['username'] : $_G['username'];
     $arr['portal_cid'] = $arr['forum_fid'] = $arr['blog_big_cid'] = $class_arr[0];
     $arr['forum_typeid'] = $arr['blog_small_cid'] = $class_arr[1];
     $arr['is_download_img'] = $this->p_arr['is_download_img'];
     $arr['is_download_file'] = $this->p_arr['is_download_file'];
     $arr['content_filter_html'] = $this->p_arr['content_filter_html'];
     $arr['is_water_img'] = $this->p_arr['is_water_img'];
     $arr['content'] = clear_ad_html($arr['content']);
     $arr['summary'] = addslashes($arr['summary']);
     $arr['public_start_time'] = $this->p_arr['public_start_time'];
     $arr['public_end_time'] = $this->p_arr['public_end_time'];
     $time_arr = create_public_time($arr, 1);
     $arr['public_time'] = $this->public_info['public_time'] = array_pop($time_arr);
     $arr['public_reply_seq'] = $this->p_arr['public_reply_seq'];
     $arr['is_public_reply'] = $this->p_arr['is_public_reply'];
     $arr['public_uid'] = $this->p_arr['public_uid'];
     $arr['reply_uid'] = $this->p_arr['reply_uid'];
     $arr['is_page_public'] = $this->p_arr['is_page_public'];
     $arr['check'] = 1;
     $arr['page_url'] = $this->now_url;
     $arr['is_bbs'] = $this->p_arr['reply_rules'] || $this->p_arr['reply_is_extend'] ? 1 : 0;
     $this->temp_arr['article_status'] = 2;
     $this->temp_arr['timeing_data_id'] = 0;
     //发布时间大于当前时间,放入定时发布中
     if ($arr['public_time'] > $_G['timestamp'] && $is_timing == 1) {
         if ($this->p_arr['public_type'] == 1) {
             //门户
             $timing_public_arr['portal'] = $class_arr[0];
         } else {
             if ($this->p_arr['public_type'] == 2) {
                 //论坛
                 $timing_public_arr['forums'] = $class_arr[0];
                 $timing_public_arr['threadtypeid'] = $class_arr[1];
             } else {
                 $timing_public_arr['blog'] = $class_arr[0];
                 $timing_public_arr['classid'] = $class_arr[1];
             }
         }
         $this->temp_arr['article_status'] = 4;
         //文章入库时标记文章发布状态为定时发布
         $timing_setarr = array('public_type' => $this->p_arr['public_type'], 'data_id' => 0, 'content_type' => 1, 'public_dateline' => $arr['public_time'], 'pid' => $this->pid, 'public_info' => serialize($timing_public_arr));
         $this->temp_arr['timing_id'] = DB::insert('strayer_timing', $timing_setarr, TRUE);
         return;
     }
     if ($this->p_arr['is_word_replace'] == 1) {
         //同义词替换
         if ($this->p_arr['is_bbs'] != 1 && $arr['contents'] > 0) {
             //有几页的文章
             $arr['content_arr'] = article_words_replace($arr['content_arr'], $this->words);
         }
         $arr['content'] = article_words_replace($arr['content'], $this->words);
         $arr['title'] = article_words_replace($arr['title'], $this->words);
         if ($arr['reply']) {
             $arr['reply'] = article_words_replace($arr['reply'], $this->words);
         }
     }
     unset($arr['url']);
     //跟门户的跳转url重名
     unset($arr['aid']);
     if ($this->p_arr['public_type'] == 2) {
         //论坛
         if ($arr['contents'] > 1 && $arr['is_bbs'] == 0 && $this->p_arr['is_page_public'] != 1) {
             $arr['is_public_reply'] = 1;
             $arr['public_reply_seq'] = 0;
             $arr['is_content_reply'] = 1;
             $arr['is_bbs'] = 1;
             unset($arr['content_arr'][0]);
             $arr['reply'] = $arr['content_arr'];
         } else {
             if ($arr['is_bbs'] != 1) {
                 $arr['reply'] = array();
             }
         }
         $arr = article_move_forums($arr, $old_arr);
         if (!is_array($arr)) {
             if (!$arr) {
                 return -1;
             }
         }
         $insert_aid = $setarr['forum_id'] = $arr['tid'];
     } else {
         if ($this->p_arr['public_type'] == 1) {
             //门户
             $setarr['portal_id'] = $insert_aid = article_move_portal($arr, $old_arr);
         } else {
             //博客
             $setarr['blog_id'] = $insert_aid = article_move_blog($arr, $old_arr);
         }
     }
     if ($insert_aid) {
         $arr['aid'] = $insert_aid;
         if ($this->p_arr['public_type'] == 2) {
             //论坛
             $arr['cookie'] = $this->p_arr['login_cookie'];
             if ($arr['is_download_img'] == 1) {
                 forum_downremotefile($arr, $old_arr);
             }
         } else {
             $type = $this->p_arr['public_type'] == 1 ? 'portal' : 'album';
             $arr['cookie'] = $this->p_arr['login_cookie'];
             downremotefile($arr, $type, $old_arr);
         }
         if ($type == 'portal') {
             article_thumb($insert_aid);
         }
     } else {
         return -1;
     }
     $this->public_info['insert_aid'] = $insert_aid;
     $this->public_info['title'] = $arr['title'];
     return $insert_aid;
 }