示例#1
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;
}
示例#2
0
function get_member_info()
{
    $info_str = milu_lang('member_field_str');
    $url = format_url($_GET['url']);
    $test_uid = intval(format_url($_GET['test_uid']));
    $uid_range = $test_uid ? $test_uid : format_url($_GET['uid_range']);
    $login_cookie = format_cookie($_GET['login_cookie']);
    $uid_arr = get_data_range($uid_range);
    $arr = get_user_url_arr($url, $uid_arr['list']);
    $test_url = $arr[0]['url'];
    if (!$test_url) {
        show_pick_window(milu_lang('get_link_list_test'), milu_lang('no_set_uidurl'), array('w' => 620, 'h' => '400', 'f' => 1));
    }
    $content = get_contents($test_url, array('cookie' => $login_cookie));
    if ($content == -1) {
        show_pick_window(milu_lang('get_link_list_test'), milu_lang('check_user_url'), array('w' => 620, 'h' => '400', 'f' => 1));
    }
    $info_arr = dom_get_manytext($content, 'div#ct div.mn li');
    //获取用户名
    preg_match_all('/<title>(.*)' . milu_lang('the_user_info') . '/i', $content, $matchs);
    $re_arr[milu_lang('user_name')] = $matchs[1][0];
    if (!$info_arr) {
        show_pick_window(milu_lang('get_link_list_test'), milu_lang('pick_must_set_cookie'), array('w' => 620, 'h' => '400', 'f' => 1));
    }
    $info_field_arr = explode('|', $info_str);
    $i = 0;
    foreach ((array) $info_arr as $k => $v) {
        foreach ($info_field_arr as $k2 => $v2) {
            $v2_arr = format_wrap($v2, '@@');
            $v2 = $v2_arr[1];
            if (strexists($v, $v2)) {
                $value = str_replace('<em>' . $v2 . '</em>', '', $v);
                if (strexists($v2, 'IP')) {
                    $value = str_replace(' -', '', $value);
                }
                $re_arr[$v2] = trim($value);
            }
        }
    }
    $output .= '<p>' . milu_lang('the_test_url') . ' : <a target="_brank" href="' . $test_url . '">' . $test_url . '</a></p></br>';
    $output .= '<table class="tb tb2">';
    foreach ((array) $re_arr as $k => $v) {
        $output .= '<tr><td>' . $k . ' : </td><td>' . $v . '</td></tr>';
    }
    $output .= '</table>';
    show_pick_window(milu_lang('get_link_list_test'), $output, array('w' => 620, 'h' => '400', 'f' => 1));
}
示例#3
0
 function get_reply($content, $reply_num = 0)
 {
     $type = $reply_num == 0 && $this->p_arr['reply_rules'] == $this->p_arr['content_rules'] ? 'reply' : 'all';
     $reply_num = $reply_num > 0 ? $reply_num : $this->reply_max_num;
     if ($this->p_arr['reply_get_type'] == 1) {
         $reply_arr = dom_get_manytext($content, $this->p_arr['reply_rules'], $type, $reply_num);
     } else {
         $this->p_arr['reply_rules'] = str_replace('[body]', '[reply]', $this->p_arr['reply_rules']);
         $reply_arr = str_get_str($content, $this->p_arr['reply_rules'], 'reply', -1);
         if ($type == 'reply') {
             unset($reply_arr[0]);
         }
         $reply_arr = count($reply_arr) > $reply_num ? array_slice($reply_arr, 0, $reply_num) : $reply_arr;
     }
     $reply_arr = sarray_unique($reply_arr);
     $reply_arr = array_filter($reply_arr);
     return (array) $reply_arr;
 }