コード例 #1
0
ファイル: function.article.php プロジェクト: edmundwong/V604
function article_edit()
{
    global $_G;
    include_once libfile('function/portalcp');
    include_once libfile('function/spacecp');
    include_once libfile('function/home');
    require_once libfile('function/forumlist');
    pload('F:spider');
    if ($_GET['submit']) {
        $setarr = $_GET['set'];
        if (check_uid($setarr['uid']) == 'no') {
            cpmsg_error(milu_lang('user_no_exists'));
        }
        $pick_common_set = get_pick_set();
        $pid = intval($_GET['pid']);
        $p_arr = get_pick_info($pid);
        $setarr['portal_cid'] = $_GET['portal'];
        $setarr['forum_fid'] = $_GET['forums'];
        $setarr['forum_typeid'] = $_GET['threadtypeid'];
        $setarr['blog_big_cid'] = $_GET['blog'];
        $setarr['blog_small_cid'] = $_GET['classid'];
        $setarr['title'] = getstr(trim($setarr['title']), 80, 1, 1);
        if (strlen($setarr['title']) < 1) {
            cpmsg_error(milu_lang('title_no_empty'));
        }
        if (empty($setarr['summary'])) {
            $setarr['summary'] = portalcp_get_summary(stripslashes($_GET['message']));
        }
        $set_arr['summary'] = addslashes($setarr['summary']);
        $setarr['public_time'] = strtotime($setarr['public_time']);
        $setarr['from'] = dhtmlspecialchars($setarr['from']);
        $setarr['article_tag'] = dhtmlspecialchars($setarr['article_tag']);
        $setarr['fromurl'] = str_replace('&amp;', '&', dhtmlspecialchars($setarr['fromurl']));
        $aid = intval($_GET['aid']);
        $pid = intval($_GET['pid']);
        $status = intval($_GET['status']);
        $relatedarr = array();
        if ($_GET['raids']) {
            $relatedarr = array_map('intval', $_GET['raids']);
            $relatedarr = array_unique($relatedarr);
            $relatedarr = array_filter($relatedarr);
            $setarr['raids'] = serialize($relatedarr);
        }
        $setarr['tag'] = article_make_tag($_GET['tag']);
        $setarr['last_modify'] = $_G['timestamp'];
        $user_info = get_user_info($setarr['uid']);
        $setarr['username'] = $user_info['username'];
        $article_arr = $setarr;
        DB::update('strayer_article_title', paddslashes($setarr), array('aid' => $aid));
        $article_arr['is_download_img'] = $setarr['is_download_img'];
        $article_arr['is_water_img'] = $setarr['is_water_img'];
        $setarr = array();
        $content = $_GET['message'];
        if (!$_GET['is_bbs']) {
            $regexp = '/(###NextPage(\\[title=(.*?)\\])?###)+/';
            preg_match_all($regexp, $content, $arr);
            $contents = preg_split($regexp, $content);
            DB::delete('strayer_article_content', "aid='{$aid}'");
            foreach ($contents as $k => $v) {
                $v = dstripslashes($v);
                $setarr['content'] = trim($v);
                $setarr['pageorder'] = $k + 1;
                $setarr['aid'] = $aid;
                $setarr['dateline'] = $_G['timestamp'];
                $article_arr['content_arr'][$k] = $setarr;
                DB::insert("strayer_article_content", paddslashes($setarr), true);
            }
        } else {
            //如果是带回复的
            $setarr['content'] = trim($content);
            $setarr = dstripslashes($setarr);
            DB::update("strayer_article_content", paddslashes($setarr), array('aid' => $aid, 'pageorder' => 1));
        }
        //var_dump($aid);exit();
        $setarr = array();
        $article_view_url = '';
        if ($_GET['public_flag']) {
            $select = $_GET['select'];
            $article_arr['is_bbs'] = $_GET['is_bbs'];
            $article_arr['contents'] = $article_arr['is_bbs'] ? 1 : count($contents);
            $article_arr['content'] = dstripslashes(clear_ad_html($_GET['message']));
            $article_arr['public_reply_seq'] = $p_arr['public_reply_seq'];
            $article_arr['is_public_reply'] = $p_arr['is_public_reply'];
            $article_arr['reply_uid'] = $p_arr['reply_uid'];
            $article_arr['is_page_public'] = $p_arr['is_page_public'];
            if ($p_arr['is_word_replace'] == 1) {
                //同义词替换
                if ($article_arr['is_bbs'] != 1 && $article_arr['contents'] > 0) {
                    //有几页的文章
                    $article_arr['content_arr'] = article_words_replace($article_arr['content_arr']);
                }
                $article_arr['content'] = article_words_replace($article_arr['content']);
                $article_arr['title'] = article_words_replace($article_arr['title']);
                if ($article_arr['reply']) {
                    $article_arr['reply'] = article_words_replace($article_arr['reply']);
                }
            }
            $article_arr['content'] = str_replace("###NextPage###", "<\\br>", $article_arr['content']);
            $arr['content'] = htmlspecialchars_decode($arr['content'], ENT_QUOTES);
            $arr['content'] = format_html($arr['content']);
            $data_article_arr = article_info($aid);
            $is_timing = $pick_common_set['is_timing'];
            //if(!VIP) $is_timing = 0;
            //发布时间大于当前时间,放入定时发布中
            if ($article_arr['public_time'] > $_G['timestamp'] && $is_timing == 1 && $aid) {
                if ($select == 1) {
                    //门户
                    $timing_public_arr['portal'] = $article_arr['portal_cid'];
                } else {
                    if ($select == 2) {
                        //论坛
                        $timing_public_arr['forums'] = $article_arr['forum_fid'];
                        $timing_public_arr['threadtypeid'] = $article_arr['forum_typeid'];
                    } else {
                        $timing_public_arr['blog'] = $article_arr['blog_big_cid'];
                        $timing_public_arr['classid'] = $article_arr['blog_small_cid'];
                    }
                }
                $timing_setarr = array('public_type' => $select, 'data_id' => $aid, 'content_type' => 1, 'public_dateline' => $article_arr['public_time'], 'pid' => $pid, 'public_info' => serialize($timing_public_arr));
                article_timing_add($timing_setarr);
                cpmsg(milu_lang('article_public_timming', array('d' => dgmdate($article_arr['public_time'], 'u'))), PICK_GO . 'picker_manage&myfunc=article_edit&aid=' . $aid . '&pid=' . $pid, 'succeed');
                return;
            }
            if ($select == 1) {
                //门户
                $old_arr['portal_id'] = intval($_GET['old_portal_id']);
                $article_arr['relatedarr'] = $relatedarr;
                $setarr['portal_id'] = $article_arr['aid'] = article_move_portal($article_arr, $old_arr);
                //var_dump($setarr['portal_id']);exit();
                $article_arr['cookie'] = $p_arr['login_cookie'];
                $article_arr['page_url'] = $data_article_arr['url'];
                $article_arr['is_download_file'] = $p_arr['is_download_file'];
                $article_arr['content_filter_html'] = unserialize(dstripslashes($p_arr['content_filter_html']));
                downremotefile($article_arr, 'portal', $old_arr);
                article_thumb($setarr['portal_id']);
                $article_view_url = 'portal.php?mod=view&aid=' . $setarr['portal_id'];
            } else {
                if ($select == 2) {
                    //论坛
                    if ($article_arr['contents'] > 1 && $article_arr['is_bbs'] == 0 && $p_arr['is_page_public'] == 1) {
                        $article_arr['is_public_reply'] = 1;
                        $article_arr['public_reply_seq'] = 0;
                        $article_arr['is_content_reply'] = 1;
                        $article_arr['is_bbs'] = 1;
                        $article_arr['content'] = $article_arr['content_arr'][0]['content'];
                    } else {
                        if ($article_arr['is_bbs'] != 1) {
                            $article_arr['reply'] = array();
                        }
                    }
                    if ($article_arr['is_bbs']) {
                        $article_arr['reply'] = $data_article_arr['reply'];
                    }
                    $article_arr['cookie'] = $p_arr['login_cookie'];
                    $article_arr['page_url'] = $data_article_arr['url'];
                    $old_arr['forum_id'] = intval($_GET['old_forum_id']);
                    $forum_arr = article_move_forums($article_arr, $old_arr);
                    if ($forum_arr['is_download_img'] == 1) {
                        //下载图片
                        $forum_arr['cookie'] = $p_arr['login_cookie'];
                        $forum_arr['is_download_img'] = $article_arr['is_download_img'];
                        $forum_arr['is_download_file'] = $p_arr['is_download_file'];
                        $forum_arr['is_water_img'] = $article_arr['is_water_img'];
                        forum_downremotefile($forum_arr, $old_arr);
                    }
                    $setarr['forum_id'] = $article_arr['tid'] = $forum_arr['tid'];
                    $article_view_url = 'forum.php?mod=viewthread&tid=' . $setarr['forum_id'];
                } else {
                    //博客
                    $old_arr['catid'] = intval($_GET['old_blog_big_cid']);
                    $old_arr['classid'] = intval($_GET['old_blog_small_cid']);
                    $old_arr['uid'] = intval($_GET['old_uid']);
                    $old_arr['username'] = $_GET['old_username'];
                    $old_arr['blog_id'] = $_GET['old_blog_id'];
                    $setarr['blog_id'] = $article_arr['aid'] = article_move_blog($article_arr, $old_arr);
                    $article_arr['cookie'] = $p_arr['login_cookie'];
                    $article_arr['page_url'] = $data_article_arr['url'];
                    $arr['is_download_file'] = $p_arr['is_download_file'];
                    $arr['content_filter_html'] = unserialize(dstripslashes($p_arr['content_filter_html']));
                    downremotefile($article_arr, 'album', $old_arr);
                    $article_view_url = 'home.php?mod=space&do=blog&uid=' . $article_arr['uid'] . '&id=' . $setarr['blog_id'];
                }
            }
            $setarr['status'] = 2;
            DB::update('strayer_article_title', $setarr, array('aid' => $aid));
        }
        $msg = $_GET['public_flag'] ? milu_lang('public') : milu_lang('save');
        $return_url = '?' . PICK_GO . 'picker_manage&myac=article_manage&p=1&pid=' . $pid . $_GET['url_args'];
        $return_list_html = '<a href="' . $return_url . '">' . milu_lang('return_list') . '</a>';
        if ($article_view_url) {
            $article_view_output = '&nbsp;<span class="pipe">|</span>&nbsp;<a target="_blank" href="' . $article_view_url . '">' . milu_lang('view_article') . '</a>';
        }
        cpmsg(milu_lang('save_success', array('msg' => $msg)) . '<br><br><a href="?' . PICK_GO . 'picker_manage&myfunc=article_edit&aid=' . $aid . '&pid=' . $pid . '">' . milu_lang('continue_edit') . '</a>&nbsp;<span class="pipe">|</span>&nbsp;' . $return_list_html . $article_view_output, PICK_GO . 'picker_manage&myfunc=article_edit&aid=' . $aid . '&pid=' . $pid, 'succeed');
    } else {
        $pid = intval($_GET['pid']);
        $p_arr = get_pick_info($pid);
        $p_arr['public_class'] = unserialize($p_arr['public_class']);
        $aid = intval($_GET['aid']);
        $data = article_info($aid);
        $data['p_arr'] = $p_arr;
        $data['status'] = intval($_GET['status']);
        if (!$data['view_num']) {
            $view_arr = format_wrap($p_arr['view_num'], ',');
            if ($view_arr) {
                $data['view_num'] = rand($view_arr[0], $view_arr[1]);
            }
        }
        if ($data['contents'] > 1) {
            if ($data['content_arr']) {
                $data['content'] = content_merge($data['content_arr'], 1);
            }
        }
        $time_arr = create_public_time($data, 1);
        $data['public_time'] = array_pop($time_arr);
        $data['public_time'] = dgmdate($data['public_time'], 'Y-m-d H:i');
        if (!$data['uid']) {
            $rand_arr = get_rand_uid($p_arr);
            $data['uid'] = $rand_arr[0]['uid'];
        }
        $data['raids'] = unserialize($data['raids']);
        if ($data['raids']) {
            $query = DB::query("SELECT title,aid FROM " . DB::table('portal_article_title') . " WHERE aid IN (" . dimplode($data['raids']) . ")");
            $list = array();
            while ($value = DB::fetch($query)) {
                $list[$value['aid']] = $value;
                $data['raids_html'] .= '<li id="raid_li_' . $value['aid'] . '"><input type="hidden" name="raids[]" value="' . $value['aid'] . '" size="5"><a href="portal.php?mod=view&aid=' . $value['aid'] . '" target="_blank">' . $value['title'] . '</a>(' . milu_lang('article') . ' ID: ' . $value['aid'] . ')<a href="javascript:;" onclick="raid_delete(' . $value['aid'] . ');" class="xg1">' . milu_lang('del') . '</a></li>';
            }
        }
        if (!$data['forum_typeid']) {
            $data['forum_typeid'] = $p_arr['public_class'][1];
        }
        $data['threadtypes'] = getthreadtypes(array('typeid' => $p_arr['public_class'][1], 'fid' => $p_arr['public_class'][0]));
        $data['forumselect'] = '<select id="forums" name="forums" onchange="getthreadtypes(this.value, 0)">' . forumselect(FALSE, 0, $p_arr['public_class'][0], TRUE) . '</select>&nbsp;&nbsp;<span id="threadtypes">' . $data['threadtypes'] . '</span>';
        $data['portalselect'] = category_showselect('portal', 'portal', $p_arr['public_class'][0]);
        $data['blogselect'] = category_showselect('blog', 'blog', $p_arr['public_class'][0]);
        $data['article_tags'] = article_parse_tags($data['tag']);
        $data['tag_names'] = article_tagnames();
        $data['show_blog_class'] = get_person_blog_class($data['uid'], $data['blog_small_cid']);
        $data['pid'] = $pid;
        $data['public_type'] = $p_arr['public_type'];
        $data['content'] = dhtmlspecialchars($data['content']);
        $data['url_args'] = $_GET['url_args'];
        return $data;
    }
}
コード例 #2
0
ファイル: pick.class.php プロジェクト: edmundwong/V604
 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;
 }