function article_import($action, $args) { global $_G; $pick_common_set = get_pick_set(); $is_timing = $pick_common_set['is_timing']; //if(!VIP) $is_timing = 0; pload('F:spider'); $aid_arr = $args['aid'] ? $args['aid'] : $_GET['aid']; $op = 'article_' . $action; $type_arr = explode('_', $action); $type = $type_arr[1]; $pid = $args['pid'] ? $args['pid'] : intval($_GET['pid']); $p_arr = get_pick_info($pid); $view_arr = format_wrap($p_arr['view_num'], ','); $public_type = 1; if ($type == 'blog') { $public_type = 3; $type = 'album'; } if ($type == 'forums') { $public_type = 2; $type = 'forum'; } $today_public_num = 0; foreach ($aid_arr as $k => $aid) { $arr = $old_arr = article_info($aid); if (!$arr) { continue; } $arr['p_arr'] = $p_arr; $arr['public_start_time'] = $_GET['public_start_time'] ? $_GET['public_start_time'] : $p_arr['public_start_time']; $arr['public_end_time'] = $_GET['public_end_time'] ? $_GET['public_end_time'] : $p_arr['public_end_time']; $arr['public_time'] = 0; $time_arr = create_public_time($arr, 1); $arr['public_time'] = array_pop($time_arr); if ($args['cron_run'] && $args['public_time']) { $arr['public_time'] = $args['public_time'][$aid]; } $arr['title'] = htmlspecialchars_decode($arr['title'], ENT_QUOTES); $arr['content'] = htmlspecialchars_decode($arr['content'], ENT_QUOTES); $arr['title'] = format_html($arr['title']); $arr['content'] = format_html($arr['content']); unset($arr['pic']); $arr['view_num'] = rand($view_arr[0], $view_arr[1]); $rand_arr = get_rand_uid($p_arr); $arr['uid'] = $setarr['uid'] = $rand_arr[0]['uid'] ? $rand_arr[0]['uid'] : $_G['uid']; $arr['username'] = $setarr['username'] = $rand_arr[0]['username']; $arr['portal_cid'] = $timing_public_arr['portal'] = $args['portal'] ? $args['portal'] : $_GET['portal']; $arr['forum_fid'] = $timing_public_arr['forums'] = $args['forums'] ? $args['forums'] : $_GET['forums']; $arr['forum_typeid'] = $timing_public_arr['threadtypeid'] = $args['threadtypeid'] ? $args['threadtypeid'] : $_GET['threadtypeid']; $arr['blog_big_cid'] = $timing_public_arr['blog'] = $args['blog'] ? $args['blog'] : $_GET['blog']; $arr['blog_small_cid'] = $timing_public_arr['classid'] = $args['classid'] ? $args['classid'] : $_GET['classid']; $arr['is_download_img'] = $p_arr['is_download_img']; $arr['is_water_img'] = $p_arr['is_water_img']; $arr['content'] = clear_ad_html($arr['content']); $arr['summary'] = addslashes($arr['summary']); $arr['public_reply_seq'] = $p_arr['public_reply_seq']; $arr['is_public_reply'] = $p_arr['is_public_reply']; $arr['public_uid'] = $p_arr['public_uid']; $arr['reply_uid'] = $p_arr['reply_uid']; $arr['is_page_public'] = $p_arr['is_page_public']; $arr['page_url'] = $arr['url']; //发布时间大于当前时间,放入定时发布中 if ($arr['public_time'] > $_G['timestamp'] && $is_timing == 1) { $timing_setarr = array('public_type' => $public_type, 'data_id' => $aid, 'content_type' => 1, 'public_dateline' => $arr['public_time'], 'pid' => $pid, 'public_info' => serialize($timing_public_arr)); article_timing_add($timing_setarr); DB::update('strayer_article_title', array('status' => 4), array('aid' => $aid)); continue; } $arr['article_tag'] = $pick_common_set['open_tag'] == 1 && ($type == 'album' || $type == 'forum') && empty($arr['article_tag']) ? implode(',', dz_get_tag($arr['title'], $arr['content'], 1)) : $arr['article_tag']; $arr['cookie'] = $p_arr['login_cookie']; $arr['is_download_file'] = $p_arr['is_download_file']; $arr['content_filter_html'] = unserialize(dstripslashes($p_arr['content_filter_html'])); if ($arr['contents'] > 1 && $arr['is_bbs'] == 0 && $type == 'forum' && $p_arr['is_page_public'] == 2) { $arr['is_public_reply'] = 1; $arr['public_reply_seq'] = 0; $arr['is_content_reply'] = 1; $arr['is_bbs'] = 1; } else { if ($arr['is_bbs'] != 1) { $arr['reply'] = array(); } } if ($p_arr['is_word_replace'] == 1) { //同义词替换 if ($p_arr['is_bbs'] != 1 && $arr['contents'] > 1) { //有几页的文章 $arr['content_arr'] = article_words_replace($arr['content_arr']); } $arr['content'] = article_words_replace($arr['content']); if ($arr['reply']) { $arr['reply'] = article_words_replace($arr['reply']); } $arr['title'] = article_words_replace($arr['title']); } $arr['content'] = clear_ad_html($arr['content']); unset($arr['url']); //跟门户的跳转url重名 unset($arr['aid']); if ($type == 'forum') { $arr = $op($arr, $old_arr); $insert_aid = $setarr['forum_id'] = $arr['tid']; } else { $insert_aid = $op($arr, $old_arr); if ($type == 'portal') { $setarr['portal_id'] = $insert_aid; } else { $setarr['blog_id'] = $insert_aid; } } if ($insert_aid) { $arr['aid'] = $insert_aid; $arr['cookie'] = $p_arr['login_cookie']; if ($type == 'forum') { if ($arr['is_download_img'] == 1 || $arr['is_download_file'] == 1) { forum_downremotefile($arr, $old_arr); } } else { downremotefile($arr, $type, $old_arr); } if ($type == 'portal') { article_thumb($insert_aid); } } $p_arr['is_public_del'] = $p_arr['is_public_del'] ? $p_arr['is_public_del'] : intval($_GET['is_public_del']); $setarr['status'] = 2; $setarr['article_tag'] = $arr['article_tag']; $today_public_num++; if ($p_arr['is_public_del'] != 1 && $insert_aid) { DB::update('strayer_article_title', $setarr, array('aid' => $aid)); } } if (VIP) { $today_arr = dunserialize(pick_common_get('', 'pick_today')); $c_set['pick_today']['day'] = date('md', $_G['timestamp']); $c_set['pick_today']['article_public_num'] = $today_public_num + $today_arr['article_public_num']; pick_common_set($c_set); } if ($p_arr['is_public_del'] == 1) { article_delete($aid_arr); } //导入之后删除 return $insert_aid; }
function article_public($arr) { global $_G; pload('F:article'); $timing_public_arr = array(); $is_timing = $this->plugin_set['is_timing']; //if(!VIP) $is_timing = 0; $class_arr = $this->p_arr['public_class']; $old_arr = $arr; $arr['title'] = htmlspecialchars_decode($arr['title'], ENT_QUOTES); $arr['content'] = htmlspecialchars_decode($arr['content'], ENT_QUOTES); unset($arr['pic']); $view_arr = format_wrap($this->p_arr['view_num'], ','); $arr['view_num'] = rand($view_arr[0], $view_arr[1]); $rand_arr = get_rand_uid($this->p_arr); $arr['p_arr'] = $this->p_arr; $arr['uid'] = $this->public_info['uid'] = $setarr['uid'] = $rand_arr[0]['uid'] ? $rand_arr[0]['uid'] : $_G['uid']; $arr['username'] = $setarr['username'] = $rand_arr[0]['username'] ? $rand_arr[0]['username'] : $_G['username']; $arr['portal_cid'] = $arr['forum_fid'] = $arr['blog_big_cid'] = $class_arr[0]; $arr['forum_typeid'] = $arr['blog_small_cid'] = $class_arr[1]; $arr['is_download_img'] = $this->p_arr['is_download_img']; $arr['is_download_file'] = $this->p_arr['is_download_file']; $arr['content_filter_html'] = $this->p_arr['content_filter_html']; $arr['is_water_img'] = $this->p_arr['is_water_img']; $arr['content'] = clear_ad_html($arr['content']); $arr['summary'] = addslashes($arr['summary']); $arr['public_start_time'] = $this->p_arr['public_start_time']; $arr['public_end_time'] = $this->p_arr['public_end_time']; $time_arr = create_public_time($arr, 1); $arr['public_time'] = $this->public_info['public_time'] = array_pop($time_arr); $arr['public_reply_seq'] = $this->p_arr['public_reply_seq']; $arr['is_public_reply'] = $this->p_arr['is_public_reply']; $arr['public_uid'] = $this->p_arr['public_uid']; $arr['reply_uid'] = $this->p_arr['reply_uid']; $arr['is_page_public'] = $this->p_arr['is_page_public']; $arr['check'] = 1; $arr['page_url'] = $this->now_url; $arr['is_bbs'] = $this->p_arr['reply_rules'] || $this->p_arr['reply_is_extend'] ? 1 : 0; $this->temp_arr['article_status'] = 2; $this->temp_arr['timeing_data_id'] = 0; //发布时间大于当前时间,放入定时发布中 if ($arr['public_time'] > $_G['timestamp'] && $is_timing == 1) { if ($this->p_arr['public_type'] == 1) { //门户 $timing_public_arr['portal'] = $class_arr[0]; } else { if ($this->p_arr['public_type'] == 2) { //论坛 $timing_public_arr['forums'] = $class_arr[0]; $timing_public_arr['threadtypeid'] = $class_arr[1]; } else { $timing_public_arr['blog'] = $class_arr[0]; $timing_public_arr['classid'] = $class_arr[1]; } } $this->temp_arr['article_status'] = 4; //文章入库时标记文章发布状态为定时发布 $timing_setarr = array('public_type' => $this->p_arr['public_type'], 'data_id' => 0, 'content_type' => 1, 'public_dateline' => $arr['public_time'], 'pid' => $this->pid, 'public_info' => serialize($timing_public_arr)); $this->temp_arr['timing_id'] = DB::insert('strayer_timing', $timing_setarr, TRUE); return; } if ($this->p_arr['is_word_replace'] == 1) { //同义词替换 if ($this->p_arr['is_bbs'] != 1 && $arr['contents'] > 0) { //有几页的文章 $arr['content_arr'] = article_words_replace($arr['content_arr'], $this->words); } $arr['content'] = article_words_replace($arr['content'], $this->words); $arr['title'] = article_words_replace($arr['title'], $this->words); if ($arr['reply']) { $arr['reply'] = article_words_replace($arr['reply'], $this->words); } } unset($arr['url']); //跟门户的跳转url重名 unset($arr['aid']); if ($this->p_arr['public_type'] == 2) { //论坛 if ($arr['contents'] > 1 && $arr['is_bbs'] == 0 && $this->p_arr['is_page_public'] != 1) { $arr['is_public_reply'] = 1; $arr['public_reply_seq'] = 0; $arr['is_content_reply'] = 1; $arr['is_bbs'] = 1; unset($arr['content_arr'][0]); $arr['reply'] = $arr['content_arr']; } else { if ($arr['is_bbs'] != 1) { $arr['reply'] = array(); } } $arr = article_move_forums($arr, $old_arr); if (!is_array($arr)) { if (!$arr) { return -1; } } $insert_aid = $setarr['forum_id'] = $arr['tid']; } else { if ($this->p_arr['public_type'] == 1) { //门户 $setarr['portal_id'] = $insert_aid = article_move_portal($arr, $old_arr); } else { //博客 $setarr['blog_id'] = $insert_aid = article_move_blog($arr, $old_arr); } } if ($insert_aid) { $arr['aid'] = $insert_aid; if ($this->p_arr['public_type'] == 2) { //论坛 $arr['cookie'] = $this->p_arr['login_cookie']; if ($arr['is_download_img'] == 1) { forum_downremotefile($arr, $old_arr); } } else { $type = $this->p_arr['public_type'] == 1 ? 'portal' : 'album'; $arr['cookie'] = $this->p_arr['login_cookie']; downremotefile($arr, $type, $old_arr); } if ($type == 'portal') { article_thumb($insert_aid); } } else { return -1; } $this->public_info['insert_aid'] = $insert_aid; $this->public_info['title'] = $arr['title']; return $insert_aid; }