function rules_add($rules_data) { if (!$rules_data) { return; } $rules_data = serialize_iconv($rules_data); $rules_data = get_table_field_name('strayer_rules', $rules_data); $rules_hash = $rules_data['rules_hash']; $check = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_rules') . " WHERE rules_hash ='" . $rules_hash . "'"), 0); $rules_data = paddslashes($rules_data); unset($rules_data['rid']); del_search_index(2); if ($check) { DB::update("strayer_rules", $rules_data, array("rules_hash" => $rules_hash)); return 1; } else { $pid = DB::insert('strayer_rules', $rules_data, TRUE); return 2; } }
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; } } } } }
function download_fast_pick_data() { $id = intval($_GET['id']); $rpcClient = rpcClient(); $client_info = get_client_info(); $re = $rpcClient->download_data('fastpick', $id, $client_info); if (is_object($re) || $re->Number == 0) { if ($re->Message) { return milu_lang('phprpc_error', array('msg' => $re->Message)); } $re = (array) $re; } $re = serialize_iconv($re); import_fastpick_data($re); return 'ok'; }