Пример #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 show_article_detail()
{
    $aid = intval($_GET['aid']);
    $ar_info = article_info($aid);
    //print_r($ar_info);exit();
    if (!$ar_info['content']) {
        $ar_info['content'] = milu_lang('article_content_empty');
    }
    if ($ar_info['is_bbs'] == 1) {
        $output = $ar_info['content'];
        $output .= show_reply_output($ar_info['reply']);
    } else {
        if ($ar_info['contents'] == 1) {
            //普通没分页文章
            $output = $ar_info['content'];
        } else {
            $output = show_page_output($ar_info['content_arr']);
        }
    }
    show_pick_window(dhtmlspecialchars($ar_info['title']), $output, array('w' => 645, 'h' => '460', 'f' => 1));
}