Exemple #1
0
function seo_set()
{
    global $head_url;
    if (!submitcheck('submit')) {
        $info = pick_common_get();
        $info['open_seo_mod'] = dunserialize($info['open_seo_mod']);
        $info['open_seo_mod_show'][0] = in_array(1, $info['open_seo_mod']) ? 1 : 0;
        //门户
        $info['open_seo_mod_show'][1] = in_array(2, $info['open_seo_mod']) ? 1 : 0;
        //论坛
        $info['open_seo_mod_show'][2] = in_array(3, $info['open_seo_mod']) ? 1 : 0;
        //博客
        $info = dhtmlspecialchars($info);
        return $info;
    } else {
        $set = $_GET['set'];
        $set['open_seo_mod'] = serialize($set['open_seo_mod']);
        pick_common_set($set);
        cpmsg(milu_lang('op_success'), PICK_GO . "seo", 'succeed');
    }
}
Exemple #2
0
function virtualdata_set()
{
    global $head_url, $header_config;
    if (!submitcheck('submit')) {
        require_once libfile('function/forumlist');
        $info = pick_common_get();
        $info['vir_cache_time'] = $info['vir_cache_time'] ? $info['vir_cache_time'] : 10;
        $info['vir_data_forum'] = unserialize($info['vir_data_forum']);
        $info['vir_data_usergroup'] = unserialize($info['vir_data_usergroup']);
        $info['forumselect'] = '<select name="set[vir_data_forum][]" size="10" multiple="multiple"><option value="">' . cplang('plugins_empty') . '</option>' . forumselect(FALSE, 0, $info['vir_data_forum'], TRUE) . '</select>';
        return $info;
    } else {
        $set = $_GET['set'];
        if (!$set['vir_data_forum'][0] && count($set['vir_data_forum']) == 1) {
            $set['vir_data_forum'] = '';
        }
        pick_common_set($set);
        save_syscache('milu_pick_vir_postdata', '');
        save_syscache('milu_pick_vir_data', '');
        save_syscache('milu_pick_vir_online', '');
        cpmsg(milu_lang('op_success'), PICK_GO . "virtual_data", 'succeed');
    }
}
Exemple #3
0
function cloud_match_rules($get_type, $url, $content)
{
    global $_G;
    pload('F:fastpick');
    $setting = get_pick_set();
    $pick_config = $_G['cache']['evn_milu_pick']['pick_config'];
    $server_cache_time = $pick_config['index_server_cache_time'];
    if ($get_type == '3') {
        //智能学习规则索引过期时间比较短
        $server_cache_time = $pick_config['evo_index_server_cache_time'];
    }
    $milu_set = pick_common_get();
    if ($setting['open_cloud_pick'] != 1) {
        return FALSE;
    }
    pload('F:copyright');
    $host_info = GetHostInfo($url);
    $domain = $host_info['host'];
    $domain_hash = md5($domain);
    $url_temp = preg_replace('/\\d+/', '', $url);
    $arr_temp = parse_url($url_temp);
    $path_hash = md5($arr_temp['path']);
    $over_dateline = $_G['timestamp'] - $server_cache_time;
    $count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_searchindex') . " WHERE  domain_hash='" . $domain_hash . "' AND path_hash='" . $path_hash . "' AND type='" . $get_type . "3' AND dateline > {$over_dateline}"), 0);
    //3是服务端 4是本地的缓存
    if ($count) {
        return FALSE;
    }
    $args = array('get_type' => $get_type, 'url' => $url);
    $rpcClient = rpcClient();
    $client_info = get_client_info();
    $re = $rpcClient->cloud_match_rules($args, $client_info);
    if (is_object($re) || $re->Number == 0) {
        if ($re->Message) {
            return milu_lang('phprpc_error', array('msg' => $re->Message));
        }
        $re = (array) $re;
    }
    $data = array();
    if ($re['data_type'] == 1) {
        //返回规则
        $rules_info = $re['data'];
        if ($get_type == 3) {
            $data = evo_rules_get_article($content, $rules_info);
        } else {
            $data = rules_get_article($content, $rules_info);
        }
        if ($data || $data['content'] && $get_type == 3) {
            //规则验证有效,下载到本地
            if ($get_type == 3) {
                $data_id = import_evo_data($rules_info);
            } else {
                $data_id = import_fastpick_data($rules_info);
            }
            if ($data_id) {
                //先清除之前的索引
                DB::query('DELETE FROM ' . DB::table('strayer_searchindex') . " WHERE domain_hash='" . $domain_hash . "' AND path_hash='" . $path_hash . "'");
                add_search_index($domain_hash, $path_hash, $get_type . '4', $data_id);
                //添加索引
            }
        }
    } else {
        if ($re['data_type'] == 2) {
            //返回内容
            $data = $re['data'];
        } else {
            //一无所获,那也要告诉客户端,别再骚扰服务端了
            add_search_index($domain_hash, $path_hash, $get_type . '3', 0);
        }
    }
    return $data;
}
Exemple #4
0
function no_member_tips()
{
    $tips_arr = dunserialize(pick_common_get(0, 'pick_tips'));
    if ($tips_arr['no_user']) {
        return;
    }
    $check = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_member')), 0);
    if ($check) {
        return;
    }
    return show_tips('<div class="tipsblock"><li>' . milu_lang('no_member_tips', array('url' => '?' . PICK_GO . 'member&myac=member_import_online&tpl=no')) . '</li></ul></div>', array('key' => 'no_user', 'w' => 380, 'h' => 250));
}
Exemple #5
0
function import_article()
{
    global $_G;
    $file_name = PICK_CACHE . '/temp_im.zip';
    if (!$_GET['checking']) {
        $tmp_name = str_iconv($_FILES['file']['tmp_name']);
        $fp = fopen($tmp_name, 'r');
        $data = fread($fp, $_FILES['file']['size']);
        $flag = file_put_contents($file_name, $data);
        cpmsg(milu_lang('import_article_loading'), PICK_GO . 'picker_manage&myac=import_article&checking=1&pid=' . $_GET['pid'], 'loading', '', false);
    }
    require_once libfile('class/zip');
    $zip_obj = new SimpleUnzip($file_name);
    $total = 0;
    foreach ($zip_obj->Entries as $k => $v) {
        $data = unserialize(base64_decode(dstripslashes($v->Data)));
        //print_r($data);exit();
        $total += import_article_data($data);
    }
    @unlink($file_name);
    cpmsg(milu_lang('import_article_success', array('c' => $total)), PICK_GO . "picker_manage", 'succeed');
}
function fastpick_evo_log_del()
{
    $id = $_GET['id'];
    if ($id) {
        $id_arr = is_array($id) ? $id : array($id);
        $id_str = base64_encode(serialize($id_arr));
    }
    $submit = $_GET['submit'];
    if ($submit) {
        $id_arr = unserialize(base64_decode($_GET['id_str']));
        DB::query("DELETE FROM " . DB::table('strayer_evo_log') . " WHERE id IN (" . dimplode($id_arr) . ")");
        cpmsg(milu_lang('del_finsh'), PICK_GO . "fast_pick&myac=fastpick_evo_log", 'succeed');
    } else {
        cpmsg(milu_lang('del_confirm'), PICK_GO . 'fast_pick&myac=fastpick_evo_log_del&id_str=' . $id_str . '&submit=1', 'form');
    }
}
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));
}
Exemple #8
0
function evo_server_config()
{
    $get = function_exists('ini_get') ? TRUE : FALSE;
    $memory_str = $get ? ini_get('memory_limit') : '-1';
    if ($memory_str > 0) {
        $m = intval($memory_str);
        $memory_msg = milu_lang('memory_notice');
    }
    $config_arr['php_version'] = array('name' => milu_lang('phpversion'), 'value' => phpversion(), 'msg' => '', 'best_value' => '');
    $config_arr['memory_limit'] = array('name' => milu_lang('php_memory_set'), 'value' => $memory_str == '-1' ? milu_lang('un_know') : $memory_str, 'msg' => $memory_msg, 'best_value' => '256MB' . milu_lang('set_up'));
    $dis_fun = $get ? ini_get("disable_functions") : '-1';
    $config_arr['display_function'] = array('name' => milu_lang('no_use_func'), 'value' => $dis_fun ? $dis_fun != '-1' ? $dis_fun : milu_lang('un_know') : milu_lang('no_have'));
    $max_time = $get ? ini_get("max_execution_time") : '-1';
    $config_arr['max_execution_time'] = array('name' => milu_lang('time_out_time'), 'value' => $max_time ? $max_time != '-1' ? $max_time . milu_lang('sec') : milu_lang('un_know') : milu_lang('no_limit'), 'best_value' => milu_lang('no_limit'));
    return $config_arr;
}
Exemple #9
0
function create_variable()
{
    global $_G;
    ob_clean();
    ob_end_flush();
    $url = format_url($_GET['url']);
    $rid = $_GET['rid'];
    $arr = explode('(*)', $url);
    $count = count($arr);
    $data = get_rules_info($rid);
    $url_var = unserialize($data['url_var']);
    for ($i = 1; $i < $count; $i++) {
        if ($url_var[$i]['var_type'][$i] == 'select' || $url_var[$i]['var_type'][$i] == 'selects') {
            $show_keyword = "display:none";
        } else {
            $show_ext = "display:none";
        }
        if ($url_var[$i]['var_type'][$i] == 'text') {
            $select_text = 'selected="selected"';
        }
        if ($url_var[$i]['var_type'][$i] == 'textarea') {
            $select_textarea = 'selected="selected"';
        }
        if ($url_var[$i]['var_type'][$i] == 'select') {
            $select_select = 'selected="selected"';
        }
        if ($url_var[$i]['var_type'][$i] == 'selects') {
            $select_selects = 'selected="selected"';
        }
        if ($url_var[$i]['var_ext_keyword'][$i] == 1) {
            $check_box = 'checked="checked" ';
        }
        $html .= '<tr class="hover"><td><input name="url_var[' . $i . '][var_title][' . $i . ']" type="text" value="' . $url_var[$i]['var_title'][$i] . '" class="shorttxt" id="var_title[' . $i . ']" size="15"></td><td><select class="var_ext_select_' . $i . '" onchange="show_var_ext(this.value, ' . $i . ')" name="url_var[' . $i . '][var_type][' . $i . ']" id="var_type[' . $i . ']">
			<option ' . $select_text . ' value="text" selected="">' . milu_lang('text') . '(text)</option>
			<option ' . $select_textarea . ' value="textarea">' . milu_lang('textarea') . '(textarea)</option>
			<option ' . $select_select . ' value="select">' . milu_lang('select') . '(select)</option>
			<option ' . $select_selects . ' value="selects">' . milu_lang('selects') . '(selects)</option>
		</select></td>
<td>
  <label id="var_keyword_' . $i . '" style="' . $show_keyword . '">
  <input ' . $check_box . ' name="url_var[' . $i . '][var_ext_keyword][' . $i . ']" type="checkbox" id="var_ext_keyword[' . $i . ']" value="checkbox" />' . milu_lang('open_keyword') . '</label>
  <div id="var_select_' . $i . '" style="' . $show_ext . '"><textarea style="float:left" rows="6" ondblclick="textareasize(this, 1)" onkeyup="textareasize(this, 0)" name="url_var[' . $i . '][var_ext_select][' . $i . ']" id="var_ext_select[' . $i . ']" cols="50" class="tarea">' . $url_var[$i]['var_ext_select'][$i] . '</textarea>
<span style="float:left"> <em>' . milu_lang('desc_demo') . '</em> </span></div></td>
<td><textarea rows="6" ondblclick="textareasize(this, 1)" onkeyup="textareasize(this, 0)" name="url_var[' . $i . '][var_desc][' . $i . ']" id="var_desc' . $i . '" cols="50" class="tarea">' . $url_var[$i]['var_desc'][$i] . '</textarea></td>
</tr>';
        unset($show_keyword, $show_ext, $select_text, $select_textarea, $select_select, $select_selects);
    }
    echo $html;
    define(FOOTERDISABLED, false);
    exit;
}
 function get_normal_text()
 {
     $f_c_max = $this->full_stop_count - 1;
     $max_info = $text_info = '';
     foreach ($this->text_arr as $k => $v) {
         $f_c = substr_count($v, milu_lang('full_stop'));
         $v_o = _striptext($v);
         $txt_len = strlen($v_o);
         $html_len = strlen($v);
         $pro = $txt_len / $html_len;
         $this->temp_fc_arr[$k] = $f_c;
         $this->temp_dom_arr[$k] = array('html' => $v, 'f_c' => $f_c, 'txt_len' => $txt_len, 'html_len' => $html_len, 'pro' => $pro, 'key' => $k);
         $v_a['no_vis_per'] = $this->vis_percent($this->temp_dom_arr[$k], $this->no_vis_tag);
         $v_a['vis_per'] = $this->vis_percent($this->temp_dom_arr[$k], $this->vis_tag);
         $new_test_arr[$k] = $v_a;
         $v_a['html'] = $v;
         if ($f_c > 0 && $f_c > $f_c_max) {
             if ($pro < $this->min_pro) {
                 continue;
             }
             $fc_arr[$k] = $f_c;
             $html_arr[$k] = $this->temp_dom_arr[$k];
             if (!$max_info) {
                 $max_info = $html_arr[$k];
             }
             if (!$min_f_c) {
                 $min_f_c = $f_c;
             }
             if ($f_c < $min_f_c) {
                 $min_f_c = $f_c;
             }
             if ($txt_len > $max_info['txt_len']) {
                 $max_info = $html_arr[$k];
             }
         }
     }
     foreach ($html_arr as $k => $v) {
         if ($v['f_c'] > $min_f_c) {
             unset($html_arr[$k]);
         }
     }
     foreach ($html_arr as $k => $v) {
         $text_info = $text_info ? $v['pro'] > $text_info['pro'] ? $v : $text_info : $v;
     }
     $this->temp_arr = $html_arr;
     if (!$fc_arr) {
         return FALSE;
     }
     $vis_per = $this->vis_percent($text_info, $this->vis_tag);
     $no_vis_per = $this->vis_percent($text_info, $this->no_vis_tag);
     //有个特殊的列子 http://news.bandao.cn/news_html/201210/20121005/news_20121005_1994736.shtml
     if ($vis_per < 0.05 && $no_vis_per < 0.15) {
         $chinese_count = chineseCount($text_info['html']);
         if ($chinese_count < 1000) {
             return FALSE;
         }
     } else {
         if ($vis_per > $this->min_vis_per || $no_vis_per < $this->min_no_vis_per || $text_info['pro'] == 1) {
             return FALSE;
         }
     }
     $text_info['get_level'] = 1;
     return $text_info;
 }
Exemple #11
0
function show_tips($msg, $args = array())
{
    extract($args);
    $title = $title ? $title : milu_lang('msg_notice');
    $w = $w ? $w : 600;
    $h = $h ? $h : 387;
    $html = '<script type="text/javascript" language="javascript">
show_html_window(\'' . $key . '\', \'<em>' . $title . '</em>\', ' . $w . ', ' . $h . ', \'<div class="c bart" style=" width:100%; height:' . ($h - 60) . 'px;">' . $msg . '</div><p class="o pns"><button onclick="pick_tips(\\\'' . $key . '\\\');hideWindow(\\\'' . $key . '\\\');" class="pn pnc" name="dsf" type="submit"><span>' . milu_lang('never_notice') . '</span></button></p>\');</script>';
    return $html;
}
function num_limit($table_name, $limit_num, $lang)
{
    $f_num = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table($table_name)), 0);
    if (!VIP && $f_num > $limit_num) {
        cpmsg_error(milu_lang($lang, array('n' => $limit_num)));
    }
}
Exemple #13
0
            $setarr['reply_is_extend'] = 0;
        }
        $setarr = paddslashes($setarr);
        $data_info = get_pick_info();
        if ($data_info['cron_day'] == 0) {
            $data_info['cron_day'] = -1;
        }
        //数据库中的字段类型为未签署,导致没法小于0
        if ($data_info['cron_minute'] != $setarr['cron_minute'] || $data_info['cron_hour'] != $setarr['cron_hour'] || $data_info['cron_day'] != $setarr['cron_day'] || $data_info['cron_weekday'] != $setarr['cron_weekday']) {
            //计划任务修改时,把下次执行时间清空
            save_syscache('pick_run', TIMESTAMP);
            $setarr['lastrun'] = $setarr['nextrun'] = 0;
        }
        DB::update('strayer_picker', $setarr, array('pid' => $pid));
        $url = PICK_GO . 'picker_manage';
    } else {
        $msg = milu_lang('add');
        $setarr = paddslashes($setarr);
        $setarr['picker_hash'] = create_hash();
        $pid = DB::insert('strayer_picker', $setarr, TRUE);
    }
    $url = PICK_GO . 'picker_manage&myaction=edit_pick&pid=' . $pid . '&step=' . $_GET['step'];
    if (!$pid) {
        cpmsg_error($msg . milu_lang('fail'));
    }
    cpmsg(milu_lang('pick_op_finsh', array('msg' => $msg)), $url, 'succeed');
}
if (!$info['jump_num']) {
    $info['jump_num'] = $pick_config['pick_num'];
}
include template('milu_pick:picker_edit');
Exemple #14
0
function get_person_blog_class($uid = '', $now_id = '')
{
    global $_G;
    include_once libfile('function/spacecp');
    $uid = $uid ? $uid : intval($_GET['uid']);
    $classarr = $uid ? getclassarr($uid) : getclassarr($_G['uid']);
    $output = '<select name="classid" id="classid" onchange="addSort(this)" ><option value="0">------</option>';
    foreach ((array) $classarr as $key => $value) {
        if ($value['classid'] == $now_id) {
            $output .= '<option value="' . $value[classid] . '" selected>' . $value[classname] . '</option>';
        } else {
            $output .= '<option value="' . $value[classid] . '">' . $value[classname] . '</option>';
        }
    }
    $output .= '<option value="addoption" style="color:red;">+' . milu_lang('add_class') . '</option>';
    $output .= '</select>';
    return $output;
}
Exemple #15
0
 function finsh()
 {
     cache_del('pick' . $this->pid);
     $this->all_get_time = $this->pick_cache_data['all_get_time'];
     $all_get_time_str = diff_time($this->all_get_time, 1);
     $get_url_count = $this->i - 1;
     $avg_get_time = $this->all_get_time / $get_url_count;
     $all_get_time_str = $all_get_time_str ? $all_get_time_str : sprintf('%.2f', $this->all_get_time) . milu_lang('sec');
     $finsh_output = milu_lang('pick_finsh', array('guc' => $get_url_count, 'g_v' => $get_url_count - $this->v_i, 'v_i' => $this->v_i, 'a' => $this->a, 'a_va' => $this->a - $this->v_a, 'v_a' => $this->v_a, 'all' => $all_get_time_str, 'avg' => sprintf('%.2f', $avg_get_time)));
     $this->get_pick_status(1);
     $this->status_arr['pro'] = 100;
     $this->status_arr['wait_time'] = $this->status_arr['wait_count'] = 0;
     show_pick_info($finsh_output, 'finsh', $this->status_arr);
     $this->words = null;
     $this->snoopy = null;
     $this->p_arr = null;
     exit;
 }