Ejemplo n.º 1
0
function rules_get_contents($content, $rules)
{
    //再取内容
    if ($rules['content_get_type'] == 3) {
        //智能识别
        if ($rules['theme_get_type'] != 3) {
            $info_arr = get_single_article($content);
            return $info_arr['content'];
        }
    } else {
        if ($rules['content_get_type'] == 1) {
            //dom获取
            $info_arr = dom_single_article($content, array('content' => $rules['content_rules']));
            return $info_arr['content'];
        } else {
            if ($rules['content_get_type'] == 2) {
                //字符串
                return str_get_str($content, $rules['content_rules'], 'body', -1);
            }
        }
    }
    return FALSE;
}
Ejemplo n.º 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;
}
Ejemplo n.º 3
0
         } else {
             $auto = $auto == 'yes' ? true : false;
             $link_arr = get_url_range($arr['url_page_range'], $auto);
         }
     }
     $url = url_auto($link_arr[0]);
     if ($arr['url']) {
         $url = $arr['url'];
     }
     if ($arr['article_get_type'] == 'dom') {
         $a_info = dom_single_article($url, array('title' => $arr['title'], 'content' => $arr['content']));
     } else {
         if ($arr['article_get_type'] == 'regexp') {
             $a_info = regexp_single_article($url, array('title' => $arr['title'], 'content' => $arr['content']));
         } else {
             $a_info = get_single_article($url);
         }
     }
     if ($a_info['content'] || $a_info['title']) {
         if ($a_info['content'] == 'list') {
             $a_info['content'] = milu_lang('article_too_many_link');
         }
         $html = '<h3><strong>' . milu_lang('article_link') . ':</strong></h3><a target="_blank"  href="' . $url . '">' . $url . '</a><br><br><h3><strong>' . milu_lang('article_title') . ':</strong></h3>' . $a_info['title'] . '<br><br><h3><strong>' . milu_lang('article_body') . ':</strong><br></h3>' . $a_info['content'] . '<br>';
     } else {
         $html = milu_lang('no_get_content');
     }
     show_pick_window(milu_lang('get_content_test'), $html, array('w' => 750, 'h' => '460', 'f' => 1));
 case 'article_delete':
     $aid = intval($_GET['aid']);
     $url_str = '&pid=' . $_GET['pid'] . '&status=' . $_GET['status'] . '&p=' . $_GET['p'] . '&s=' . $_GET['s'] . '&orderby=' . $_GET['orderby'] . '&ordersc=' . $_GET['ordersc'] . '&perpage=' . $perpage . '&page=' . $page;
     if ($aid && $submit) {
Ejemplo n.º 4
0
function test_window($get_type, $url_test, $is_fiter, $rules, $replace_rules, $filter_data, $show_type, $login_cookie, $filter_html_arr)
{
    $url_test = rpc_str($url_test);
    $rules = rpc_str($rules);
    $replace_rules = rpc_str($replace_rules);
    $login_cookie = rpc_str(urlencode($login_cookie));
    foreach ($filter_data as $k => $v) {
        if ($v) {
            $filter_data[$k][1] = rpc_str($v[1]);
        }
    }
    $filter_html_arr = sarray_unique($filter_html_arr);
    //去重
    if ($show_type == 'title') {
        $show_name = milu_lang('title');
    } else {
        if ($show_type == 'body') {
            $show_name = milu_lang('body');
        } else {
            $show_name = milu_lang('reply');
        }
    }
    $contents = get_contents($url_test, array('cookie' => $login_cookie));
    $contents = dz_attach_format($url_test, $contents);
    $c_arr = format_article_imgurl($url_test, $contents);
    $contents = $c_arr['message'];
    if ($get_type == 1) {
        //dom
        if ($show_type == 'reply') {
            $result_data = dom_get_manytext($contents, $rules);
        } else {
            if ($show_type == 'title') {
                $dom_rules['title'] = $rules;
            } else {
                $dom_rules['content'] = $rules;
            }
            $re = dom_single_article($contents, $dom_rules);
            $result_data = $show_type == 'title' ? $re['title'] : $re['content'];
        }
    } else {
        if ($get_type == 2) {
            //字符串
            if ($contents != -1) {
                if ($show_type == 'reply') {
                    $rules = str_replace('[body]', '[reply]', $rules);
                    $result_data = str_get_str($contents, $rules, $show_type, -1);
                    unset($result_data[0]);
                } else {
                    $result_data = str_get_str($contents, $rules, $show_type, 1);
                }
            }
        } else {
            //智能获取
            if ($contents != -1) {
                $re = get_single_article($contents, $url_test);
                if ($show_type == 'title') {
                    $result_data = $re['title'];
                } else {
                    $result_data = $re['content'];
                }
            }
        }
    }
    if ($result_data == -1) {
        echo milu_lang('unable_pick');
        return;
    } else {
        if ($result_data == -2) {
            echo milu_lang('get_time_out');
            return;
        }
    }
    if (!$result_data) {
        echo milu_lang('no_get_data') . $show_name;
        return;
    }
    $format_args = array('is_fiter' => $is_fiter, 'show_type' => $show_type, 'result_data' => $result_data, 'replace_rules' => $replace_rules, 'filter_data' => $filter_data, 'test' => 1, 'filter_html' => $filter_html_arr);
    $result_data = filter_article($format_args);
    if ($show_type == 'reply') {
        $body = show_reply_output($result_data);
    } else {
        $body .= $result_data;
    }
    $body .= $notice;
    echo $body;
}
Ejemplo n.º 5
0
 function get_article($content, $url = '')
 {
     global $_G;
     $url = $url ? $url : $this->now_url;
     $pick_config = $_G['cache']['evn_milu_pick']['pick_config'];
     require_once libfile('function/home');
     if ($this->temp_arr['have_page'] != 1) {
         $this->a++;
         $this->pick_cache_data['a'] = $this->a;
     }
     if ($this->p_arr['rules_type'] == 3) {
         //一键采集
         $article_info = get_single_article($content, $url);
     } else {
         //先取标题
         if ($this->p_arr['theme_get_type'] == 3) {
             //智能识别
             $article_info = get_single_article($content, $url);
         } else {
             if ($this->p_arr['theme_get_type'] == 1) {
                 //dom获取
                 $article_info = dom_single_article($content, array('title' => $this->p_arr['theme_rules']));
             } else {
                 if ($this->p_arr['theme_get_type'] == 2) {
                     //字符串
                     $re = pregmessage($content, '<title>[title]</title>', 'title', -1);
                     $article_info['other']['old_title'] = $re[0];
                     $article_info['title'] = str_get_str($content, $this->p_arr['theme_rules'], 'title', -1);
                 }
             }
         }
         //标题要做额外的工作,清理掉多余的html
         $article_info['title'] = format_html($article_info['title']);
         if (!trim($article_info['title'])) {
             return $article_info;
         }
         //如果标题都取不到,不必浪费时间获取内容
         //再取内容
         if ($this->p_arr['content_get_type'] == 3) {
             //智能识别
             if ($this->p_arr['theme_get_type'] != 3) {
                 $info_arr = get_single_article($content, $url);
                 $article_info['content'] = $info_arr['content'];
             }
         } else {
             if ($this->p_arr['content_get_type'] == 1) {
                 //dom获取
                 $info_arr = dom_single_article($content, array('content' => $this->p_arr['content_rules']));
                 $article_info['content'] = $info_arr['content'];
             } else {
                 if ($this->p_arr['content_get_type'] == 2) {
                     //字符串
                     $article_info['content'] = str_get_str($content, $this->p_arr['content_rules'], 'body', -1);
                 }
             }
         }
         if (!$article_info['content'] && $pick_config['ask_mode'] == 1) {
             $article_info['content'] = $article_info['title'];
         }
         //取其他内容
         $other_arr = $this->get_article_other($content);
         $other_arr = $other_arr ? $other_arr : array();
         $article_info = array_merge($article_info, $other_arr);
     }
     //附件
     if ($this->p_arr['is_download_file'] == 1) {
         $article_info['content'] = attach_format($url, $article_info['content']);
     }
     //需要回复才能看到的内容
     if (VIP) {
         $article_info['content'] = post($article_info['content'], array('cookie' => $this->p_arr['login_cookie'], 'page_url' => $url));
     }
     $article_info['content'] = format_html($article_info['content']);
     $article_info['content'] = unhtmlentities($article_info['content']);
     $article_info['url'] = $url;
     $article_info['content'] = clear_ad_html($article_info['content']);
     $article_info['content'] = getstr($article_info['content'], 0, 1, 1, 0, 1);
     return $article_info;
 }