Ejemplo n.º 1
0
function member_import_online()
{
    $step = $_GET['step'];
    $url = GET_URL . 'plugin.php?id=pick_user:member&myac=download&tpl=no';
    $go_url = PICK_GO . 'member&myac=member_import_online';
    if (!$_GET['step']) {
        cpmsg(milu_lang('get_user_dataing'), $go_url . '&step=1&tpl=no', 'loading', '', false);
    }
    if ($step == 1) {
        if (!function_exists('gzinflate')) {
            cpmsg_error(milu_lang('disable_func', array('f' => 'gzinflate')));
        }
        $msg_arr = get_contents($url . '&get_type=1&v=' . urlencode(PICK_VERSION), array('cache' => -1));
        //echo $url.'&get_type=1&v='.urlencode(PICK_VERSION);
        if ($msg_arr < 0) {
            cpmsg_error(milu_lang('no_conn_server'));
        }
        $msg_arr = json_decode(base64_decode($msg_arr));
        echo '<table class="tb tb2 ">
<tbody><tr class="header hover"><td>' . milu_lang('hove_user_data') . '</td><td></td><td></td></tr>
<tr class="hover"><td><div class="tipsblock"><ul id="tipslis"><li>' . milu_lang('user_data_size') . ':' . $msg_arr->size . '</li ><li>' . milu_lang('update_dateline') . ': ' . dgmdate($msg_arr->modify_dateline) . ' </li ><li>' . milu_lang('member_count') . ':  ' . $msg_arr->count . milu_lang('tiao') . '</li ></ul></div></td><td><input type="button" class="btn" onclick="window.location.href=\'?' . $go_url . '&step=2&tpl=no&c=' . $msg_arr->count . '\'" value="' . milu_lang('confirm_download') . '"></td></tr></tbody></table>';
    } else {
        if ($step == 2) {
            cpmsg(milu_lang('data_downloading'), $go_url . '&step=3&tpl=no&c=' . $_GET['c'], 'loading', '', false);
        } else {
            if ($step == 3) {
                if ($_GET['finished']) {
                    cpmsg(milu_lang('run_finsh'), PICK_GO . "member&myac=member_list", 'succeed');
                }
                pload('F:spider');
                $snoopy_obj = get_snoopy_obj();
                $data_text = get_img_content($url . '&get_type=2&v=' . urlencode(PICK_VERSION), $snoopy_obj);
                if (!$data_text) {
                    cpmsg_error(milu_lang('download_fail'));
                }
                $file_name = PICK_CACHE . '/temp_m.zip';
                file_put_contents($file_name, $data_text);
                require_once libfile('class/zip');
                $zip_obj = new SimpleUnzip($file_name);
                foreach ($zip_obj->Entries as $k => $v) {
                    $data = unserialize(base64_decode(dstripslashes($v->Data)));
                }
                @unlink($file_name);
                $data = serialize(serialize_iconv($data));
                file_put_contents(PICK_CACHE . '/temp_m.txt', $data);
                $per_num = 250;
                pcpmsg_loading(milu_lang('importing'), PICK_GO . "member&myac=member_import_online&tpl=no&step=3&finished=1", 'loadingform', '', '<div id="percent">0%</div>', FALSE);
                $ajax_url = "admin.php?" . PICK_GO . "member&myac=ajax_func&inajax=1&af=member_import_online&step=4&tpl=no&confirmed=1";
                $finsh_url = "admin.php?" . PICK_GO . "member&myac=member_list";
                //echo $ajax_url;exit();
                echo pick_loading($ajax_url, $finsh_url, $_GET['c'], array('bat_num' => $per_num));
            } else {
                if ($step == 4) {
                    $file_name = PICK_CACHE . '/temp_m.txt';
                    ob_end_clean();
                    $pp = intval($_GET['pp']);
                    $currow = intval($_GET['currow']);
                    $data = file_get_contents($file_name);
                    if (!$data) {
                        echo 'TRUE';
                        exit;
                    }
                    //$data = dstripslashes($data);
                    $data = unserialize($data);
                    $i = 1;
                    foreach ((array) $data as $k => $v) {
                        if ($i > $pp) {
                            break;
                        }
                        import_member_data($v);
                        $i++;
                        unset($data[$k]);
                    }
                    if (!$data) {
                        echo 'TRUE';
                        @unlink($file_name);
                        exit;
                    }
                    $data = file_put_contents($file_name, serialize($data));
                    echo 'GO';
                    exit;
                }
            }
        }
    }
}
Ejemplo n.º 2
0
function article_batch()
{
    global $_G;
    $aid_arr = $_GET['aid'];
    $is_public_del = $_GET['is_public_del'];
    if (!VIP) {
        $today_arr = dunserialize(pick_common_get('', 'pick_today'));
        if ($today_arr['day'] != date('md', $_G['timestamp'])) {
            $c_set['pick_today'] = array();
            pick_common_set($c_set);
        } else {
            $article_public_num = $today_arr['article_public_num'];
            if ($article_public_num > 10000) {
                cpmsg_error(milu_lang('article_public_limit', array('n' => 10000)));
            }
        }
    }
    extract($_GET);
    extract($set);
    $public_start_time = strtotime($public_start_time);
    $public_end_time = strtotime($public_end_time);
    $args_arr = array('optype', 'pid', 'is_public_del', 'article_public_sort', 'is_public_del', 'public_start_time', 'public_end_time', 'status', 's', 'ordersc', 'orderby', 'time_public', 'portal', 'forums', 'threadtypeid', 'blog', 'perpage', 'oparea', 'article_batch_num', 'move_pid', 'p');
    $args_url = '';
    foreach ($args_arr as $k => $v) {
        $args_url .= '&' . $v . '=' . ${$v};
    }
    //$args_url .= '&myac='
    //echo $args_url;exit();
    $from_url = PICK_GO . "picker_manage&myac=article_manage&finished=1" . $args_url;
    if ($_GET['finished']) {
        cpmsg(milu_lang('run_finsh'), $from_url, 'succeed');
    }
    if (!$_GET['confirmed']) {
        $article_batch_num = $setrr['article_batch_num'] = $article_batch_num ? $article_batch_num : 15;
        pick_common_set($setrr);
        if (!$optype) {
            cpmsg_error(milu_lang('must_select_optype'));
        }
        if ($oparea == 'selected') {
            if (!$aid_arr) {
                cpmsg_error(milu_lang('must_select_data'));
            }
            $aid_str = base64_encode(serialize($aid_arr));
            $total = count($aid_arr);
        } else {
            if ($oparea == 'all') {
                $total = article_count($pid, $status, array('s' => $s));
            }
        }
        pcpmsg_loading(milu_lang('bat_import_article', array('a' => $article_batch_num, 't' => $total)), $from_url, 'loadingform', '', '<div id="percent">0%</div>', FALSE);
        $ajax_url = "admin.php?" . PICK_GO . "picker_manage&myac=ajax_func&inajax=1&af=" . $myac . "&tpl=no&confirmed=1&oparea={$oparea}&aid={$aid_str}" . $args_url;
        $finsh_url = "admin.php?" . PICK_GO . "picker_manage&myac=article_manage&finished=1" . $args_url;
        //echo $ajax_url;exit();
        echo pick_loading($ajax_url, $finsh_url, $total, array('bat_num' => $article_batch_num));
    } else {
        ob_end_clean();
        $total = intval($_GET['total']);
        $pp = intval($_GET['pp']);
        $pid = intval($_GET['pid']);
        $currow = intval($_GET['currow']);
        $oparea = $_GET['oparea'];
        $public_sort = $_GET['public_sort'];
        $public_sort = $public_sort == 1 ? 'asc' : 'desc';
        if ($oparea == 'selected') {
            $aid_arr = unserialize(base64_decode($aid));
            $where = $optype == 'timing_delete' ? " AND t.id IN (" . dimplode($aid_arr) . ") " : " AND aid IN (" . dimplode($aid_arr) . ") ";
        } else {
            if ($oparea == 'all') {
                $where = $optype == 'timing_delete' ? " AND  a.title like '%" . $_GET['s'] . "%' " : " AND title like '%" . $_GET['s'] . "%' ";
            }
        }
        $aid_arr = array();
        if ($is_public_del == 1 && ($optype == 'move_portal' || $optype == 'move_forums' || $optype == 'move_blog') || $optype == 'delete') {
            $currow = 0;
        }
        if ($optype == 'timing_delete') {
            $query = DB::query("SELECT a.aid,t.id, t.data_id FROM " . DB::table('strayer_timing') . " t Inner Join " . DB::table('strayer_article_title') . " a ON a.aid = t.data_id WHERE t.pid='{$pid}' {$where} ORDER by t.data_id LIMIT {$currow},{$pp}");
            while ($rs = DB::fetch($query)) {
                if ($rs['aid']) {
                    DB::update('strayer_article_title', array('status' => 1), array('aid' => $rs['aid']));
                }
                $aid_arr[] = $rs['id'];
            }
        } else {
            $query = DB::query("SELECT aid FROM " . DB::table('strayer_article_title') . " WHERE pid='{$pid}' {$where} ORDER by dateline " . $public_sort . " LIMIT {$currow},{$pp}");
            while ($rs = DB::fetch($query)) {
                $aid_arr[] = $rs['aid'];
            }
        }
        if ($optype == 'move_portal' || $optype == 'move_forums' || $optype == 'move_blog') {
            article_import($_GET['optype'], array('aid' => $aid_arr));
        } else {
            $action = 'article_' . $optype;
            $action($aid_arr, $pid);
        }
        if ($currow + $pp > $total) {
            echo 'TRUE';
            exit;
        }
        echo 'GO';
        exit;
    }
}