Example #1
0
function article_words_replace($data, $words = '')
{
    if (VIP) {
        return $data;
    }
    if (!$data) {
        return;
    }
    $words = $words ? $words : get_replace_words();
    if (is_array($data)) {
        foreach ($data as $k => $v) {
            if ($v['content']) {
                $v['content'] = strtr($v['content'], $words);
            }
            $data[$k] = $v;
        }
    } else {
        $data = strtr($data, $words);
    }
    return $data;
}
Example #2
0
function fast_pick()
{
    global $_G;
    d_s('f_g');
    d_s('g_t');
    pload('F:spider');
    $url = $_GET['url'];
    $content = get_contents($url, array('cache' => -1));
    $get_time = d_e(0, 'g_t');
    $type = $_GET['type'] ? $_GET['type'] : 'bbs';
    $milu_set = pick_common_get();
    $data = (array) get_single_article($content, $url);
    if ($milu_set['fp_word_replace_open'] == 1 && !VIP) {
        //开启同义词替换
        $words = get_replace_words();
        if ($data['title']) {
            $data['title'] = strtr($data['title'], $words);
        }
        if ($data['content']) {
            $data['content'] = strtr($data['content'], $words);
        }
    }
    if ($milu_set['fp_article_from'] == 1) {
        //开启来源
        $data['fromurl'] = $url;
        if ($type == 'bbs' && $data['content']) {
            $data['content'] .= "[p=30, 2, left]" . milu_lang('article_from') . ':' . $url . "[/p]";
        }
    }
    $data['get_text_time'] = $get_time;
    $data['all_get_time'] = d_e(0, 'f_g');
    $data = $data ? $data : array();
    $data = js_base64_encode($data);
    $re = json_encode($data);
    return $re;
}
Example #3
0
 function _ini_config($pid = 0, $is_cron = 0)
 {
     global $_G;
     $this->error = '';
     if ($pid == 0 && $is_cron > 0) {
         $this->error = 1;
         return;
     }
     $this->pid = $pid > 0 ? intval($pid) : intval($_GET['pid']);
     $this->pick_cache_data = load_cache('pick' . $this->pid);
     $this->i = $this->pick_cache_data['i'] ? $this->pick_cache_data['i'] : 1;
     $this->v_i = $this->pick_cache_data['v_i'] ? $this->pick_cache_data['v_i'] : 0;
     $this->a = $this->pick_cache_data['a'] ? $this->pick_cache_data['a'] : 0;
     $this->v_a = $this->pick_cache_data['v_a'] ? $this->pick_cache_data['v_a'] : 0;
     $this->all_get_time = $this->pick_cache_data['all_get_time'] ? $this->pick_cache_data['all_get_time'] : 0;
     $this->temp_arr['have_reply'] = 0;
     $this->plugin_set = get_pick_set();
     if ($is_cron > 0 && $this->plugin_set['is_log_cron'] > 0) {
         $is_log = 1;
     }
     $this->msg_args = array('is_cron' => $is_cron, 'pid' => $this->pid, 'is_log' => $is_log);
     if ($this->i == 1) {
         show_pick_info(milu_lang('pick_start'), '', $this->msg_args);
     }
     $p_arr = get_pick_info($this->pid);
     $p_arr = pstripslashes($p_arr);
     //if(!VIP) unset($p_arr['reply_rules'],$p_arr['reply_is_extend'], $p_arr['content_page_rules']);
     if ($p_arr['rules_type'] == 3) {
         $p_arr['url_range_type'] = '';
     }
     //新增
     $this->pick_set = pick_common_get();
     //插件设置
     $this->pick_config = $_G['cache']['evn_milu_pick'];
     $p_arr['rules_var'] = dstripslashes(unserialize($p_arr['rules_var']));
     $p_arr['many_page_list'] = dstripslashes(unserialize($p_arr['many_page_list']));
     $p_arr['title_filter_rules'] = dstripslashes(unserialize($p_arr['title_filter_rules']));
     $p_arr['content_filter_rules'] = dstripslashes(unserialize($p_arr['content_filter_rules']));
     $p_arr['reply_filter_rules'] = dstripslashes(unserialize($p_arr['reply_filter_rules']));
     $p_arr['content_filter_html'] = dstripslashes(unserialize($p_arr['content_filter_html']));
     $p_arr['reply_filter_html'] = dstripslashes(unserialize($p_arr['reply_filter_html']));
     $p_arr['public_class'] = dstripslashes(unserialize($p_arr['public_class']));
     //发布分类
     //if(!VIP) $p_arr['is_auto_public'] = 0;
     if ($p_arr['is_login'] == 2) {
         $p_arr['login_cookie'] = '';
     }
     if (!$p_arr['reply_max_num']) {
         $p_arr['reply_max_num'] = 200000;
     }
     //如果没有设置回复,这个就是最大数目了
     if ($p_arr['reply_is_extend']) {
         //继承内容规则
         $p_arr['reply_get_type'] = $p_arr['content_get_type'];
         $p_arr['reply_rules'] = $p_arr['content_rules'];
         if ($p_arr['is_fiter_content'] == 1) {
             //内容是过滤的
             if ($p_arr['is_fiter_reply'] == 1) {
                 //回复是过滤的
                 $p_arr['reply_replace_rules'] = array_merge((array) $p_arr['reply_replace_rules'], (array) $p_arr['content_replace_rules']);
                 $p_arr['reply_filter_rules'] = array_merge((array) $p_arr['content_filter_rules'], (array) $p_arr['reply_filter_rules']);
                 $p_arr['reply_filter_html'] = array_merge((array) $p_arr['content_filter_html'], (array) $p_arr['reply_filter_html']);
             } else {
                 //内容过滤,回复不过滤
                 $p_arr['reply_replace_rules'] = $p_arr['content_replace_rules'];
                 $p_arr['reply_filter_rules'] = $p_arr['content_filter_rules'];
                 $p_arr['reply_filter_html'] = $p_arr['content_filter_html'];
                 $p_arr['is_fiter_reply'] = 1;
             }
         }
     }
     $p_arr['stop_time'] = explode(',', $p_arr['stop_time']);
     $p_arr['stop_time'] = array_map('intval', $p_arr['stop_time']);
     $this->p_arr = $p_arr;
     $rules_hash = $this->p_arr['rules_hash'];
     if ($this->p_arr['is_auto_public'] == 1 && !$this->p_arr['public_class'][0]) {
         //既设置了自动发布,又没有设置发布栏目
         $this->error = 1;
         show_pick_info(milu_lang('no_set_public_class'), 'exit', $this->msg_args);
         return;
     }
     if ($this->p_arr['is_auto_public'] == 1 && $this->p_arr['is_word_replace'] == 1) {
         //即自动发布,又设置了同义词替换
         $this->words = get_replace_words();
     }
     pload('F:rules');
     if ($rules_hash) {
         $r_arr = get_rules_info($rules_hash);
     }
     $r_arr = pstripslashes($r_arr);
     $r_arr['url_var'] = dstripslashes(unserialize($r_arr['url_var']));
     $this->r_arr = $r_arr;
     $this->rid = $r_arr['rid'];
     $this->now_level = $this->pick_cache_data['now_level'];
     $this->max_level = $this->pick_cache_data['max_level'];
     if (!$this->pick_cache_data) {
         update_times($this->pid);
     }
     if (!$this->pick_cache_data['start_time']) {
         $this->pick_cache_data['start_time'] = TIMESTAMP;
     }
     $this->cache_time = PICK_ENABLE_CACHE ? 3600 * 24 : -1;
     //缓存
 }