Beispiel #1
0
<?php

/**
 * DiscuzX Convert
 *
 * $Id: stamp.php 15786 2010-08-27 00:27:21Z monkey $
 */
$table_target = $db_target->tablepre . 'common_moderate';
$table_target_thread = $db_target->tablepre . 'forum_thread';
$table_target_post = $db_target->tablepre . 'forum_post';
$db_target->query("TRUNCATE {$table_target}");
$query = $db_target->query("SELECT tid FROM {$table_target_thread} WHERE displayorder='-2'");
while ($row = $db_target->fetch_array($query)) {
    updatemoderate('tid', $row['tid']);
}
$query = $db_target->query("SELECT pid FROM {$table_target_post} WHERE invisible='-2' AND first='0'");
while ($row = $db_target->fetch_array($query)) {
    updatemoderate('pid', $row['pid']);
}
function updatemoderate($idtype, $ids)
{
    global $table_target, $db_target;
    $ids = is_array($ids) ? $ids : array($ids);
    if (!$ids) {
        return;
    }
    $time = time();
    foreach ($ids as $id) {
        $db_target->query("INSERT INTO {$table_target} (id,idtype,status,dateline) VALUES ('{$id}','{$idtype}','0','{$time}')");
    }
}
    }
    showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">' . cplang('moderate_all_validate') . '</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">' . cplang('moderate_all_delete') . '</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">' . cplang('moderate_all_ignore') . '</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">' . cplang('moderate_all_cancel') . '</a>', $multipage, false);
    showtablefooter();
    showformfooter();
} else {
    $moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
    $validates = $deletes = $ignores = 0;
    if (is_array($moderate)) {
        foreach ($moderate as $cid => $act) {
            $moderation[$act][] = $cid;
        }
    }
    if ($moderation['validate']) {
        $validates = C::t('portal_comment')->update($moderation['validate'], array('status' => '0'));
        updatemoderate($idtype . '_cid', $moderation['validate'], 2);
    }
    if ($moderation['delete']) {
        $validates = C::t('portal_comment')->delete($moderation['delete']);
        updatemoderate($idtype . '_cid', $moderation['delete'], 2);
    }
    if ($moderation['ignore']) {
        $validates = C::t('portal_comment')->update($ignore_cids, array('status' => '2'));
        updatemoderate($idtype . '_cid', $moderation['ignore'], 1);
    }
    if ($_GET['fast']) {
        echo callback_js($_GET['cid']);
        exit;
    } else {
        cpmsg('moderate_' . $operation . '_succeed', "action=moderate&operation={$operation}&page={$page}&filter={$filter}&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&catid={$_GET['catid']}&tpp={$_GET['tpp']}&showcensor={$showcensor}", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
    }
}
Beispiel #3
0
function blog_post($POST, $olds=array()) {
	global $_G, $space;

	$isself = 1;
	if(!empty($olds['uid']) && $olds['uid'] != $_G['uid']) {
		$isself = 0;
		$__G = $_G;
		$_G['uid'] = $olds['uid'];
		$_G['username'] = addslashes($olds['username']);
	}

	$POST['subject'] = getstr(trim($POST['subject']), 80);
	$POST['subject'] = censor($POST['subject']);
	if(strlen($POST['subject'])<1) $POST['subject'] = dgmdate($_G['timestamp'], 'Y-m-d');
	$POST['friend'] = intval($POST['friend']);

	$POST['target_ids'] = '';
	if($POST['friend'] == 2) {
		$uids = array();
		$names = empty($_POST['target_names'])?array():explode(',', preg_replace("/(\s+)/s", ',', $_POST['target_names']));
		if($names) {
			$uids = C::t('common_member')->fetch_all_uid_by_username($names);
		}
		if(empty($uids)) {
			$POST['friend'] = 3;
		} else {
			$POST['target_ids'] = implode(',', $uids);
		}
	} elseif($POST['friend'] == 4) {
		$POST['password'] = trim($POST['password']);
		if($POST['password'] == '') $POST['friend'] = 0;
	}
	if($POST['friend'] !== 2) {
		$POST['target_ids'] = '';
	}
	if($POST['friend'] !== 4) {
		$POST['password'] == '';
	}

	$POST['tag'] = dhtmlspecialchars(trim($POST['tag']));
	$POST['tag'] = getstr($POST['tag'], 500);
	$POST['tag'] = censor($POST['tag']);

	$POST['message'] = checkhtml($POST['message']);
	if($_G['mobile']) {
		$POST['message'] = getstr($POST['message'], 0, 0, 0, 1);
		$POST['message'] = censor($POST['message']);
	} else {
		$POST['message'] = getstr($POST['message'], 0, 0, 0, 0, 1);
		$POST['message'] = censor($POST['message']);
		$POST['message'] = preg_replace(array(
			"/\<div\>\<\/div\>/i",
			"/\<a\s+href\=\"([^\>]+?)\"\>/i"
		), array(
			'',
			'<a href="\\1" target="_blank">'
		), $POST['message']);
	}
	$message = $POST['message'];
	if(censormod($message) || censormod($POST['subject']) || $_G['group']['allowblogmod']) {
		$blog_status = 1;
	} else {
		$blog_status = 0;
	}

	if(empty($olds['classid']) || $POST['classid'] != $olds['classid']) {
		if(!empty($POST['classid']) && substr($POST['classid'], 0, 4) == 'new:') {
			$classname = dhtmlspecialchars(trim(substr($POST['classid'], 4)));
			$classname = getstr($classname);
			$classname = censor($classname);
			if(empty($classname)) {
				$classid = 0;
			} else {
				$classid = C::t('home_class')->fetch_classid_by_uid_classname($_G['uid'], $classname);
				if(empty($classid)) {
					$setarr = array(
						'classname' => $classname,
						'uid' => $_G['uid'],
						'dateline' => $_G['timestamp']
					);
					$classid = C::t('home_class')->insert($setarr, true);
				}
			}
		} else {
			$classid = intval($POST['classid']);

		}
	} else {
		$classid = $olds['classid'];
	}
	if($classid && empty($classname)) {
		$query = C::t('home_class')->fetch($classid);
		$classname = ($query['uid'] == $_G['uid']) ? $query['classname'] : '';
		if(empty($classname)) $classid = 0;
	}

	$blogarr = array(
		'subject' => $POST['subject'],
		'classid' => $classid,
		'friend' => $POST['friend'],
		'password' => $POST['password'],
		'noreply' => empty($POST['noreply'])?0:1,
		'catid' => intval($POST['catid']),
		'status' => $blog_status,
	);

	$titlepic = '';

	$uploads = array();
	if(!empty($POST['picids'])) {
		$picids = array_keys($POST['picids']);
		$query = C::t('home_pic')->fetch_all_by_uid($_G['uid'], 0, 0, $picids);
		foreach($query as $value) {
			if(empty($titlepic) && $value['thumb']) {
				$titlepic = getimgthumbname($value['filepath']);
				$blogarr['picflag'] = $value['remote']?2:1;
			}
			$picurl = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0);
			$uploads[md5($picurl)] = $value;
		}
		if(empty($titlepic) && $value) {
			$titlepic = $value['filepath'];
			$blogarr['picflag'] = $value['remote']?2:1;
		}
	}

	if($uploads) {
		$albumid = 0;
		if($POST['savealbumid'] < 0 && !empty($POST['newalbum'])) {
			$albumname = addslashes(dhtmlspecialchars(trim($POST['newalbum'])));
			if(empty($albumname)) $albumname = dgmdate($_G['timestamp'],'Ymd');
			$albumarr = array('albumname' => $albumname);
			$albumid = album_creat($albumarr);
		} else {
			$albumid = $POST['savealbumid'] < 0 ? 0 : intval($POST['savealbumid']);
		}
		if($albumid) {
			C::t('home_pic')->update_for_uid($_G['uid'], $picids, array('albumid' => $albumid));
			album_update_pic($albumid);
		}
		preg_match_all("/\s*\<img src=\"(.+?)\".*?\>\s*/is", $message, $mathes);
		if(!empty($mathes[1])) {
			foreach ($mathes[1] as $key => $value) {
				$urlmd5 = md5($value);
				if(!empty($uploads[$urlmd5])) {
					unset($uploads[$urlmd5]);
				}
			}
		}
		foreach ($uploads as $value) {
			$picurl = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0);
			$message .= "<div class=\"uchome-message-pic\"><img src=\"$picurl\"><p>$value[title]</p></div>";
		}
	}

	$ckmessage = preg_replace("/(\<div\>|\<\/div\>|\s|\&nbsp\;|\<br\>|\<p\>|\<\/p\>)+/is", '', $message);
	if(empty($ckmessage)) {
		return false;
	}


	if(checkperm('manageblog')) {
		$blogarr['hot'] = intval($POST['hot']);
	}

	if($olds['blogid']) {

		if($blogarr['catid'] != $olds['catid']) {
			if($olds['catid']) {
				C::t('home_blog_category')->update_num_by_catid(-1, $olds['catid'], true, true);
			}
			if($blogarr['catid']) {
				C::t('home_blog_category')->update_num_by_catid(1, $blogarr['catid']);
			}
		}

		$blogid = $olds['blogid'];
		C::t('home_blog')->update($blogid, $blogarr);

		$fuids = array();

		$blogarr['uid'] = $olds['uid'];
		$blogarr['username'] = $olds['username'];
	} else {

		if($blogarr['catid']) {
			C::t('home_blog_category')->update_num_by_catid(1, $blogarr['catid']);
		}

		$blogarr['uid'] = $_G['uid'];
		$blogarr['username'] = $_G['username'];
		$blogarr['dateline'] = empty($POST['dateline'])?$_G['timestamp']:$POST['dateline'];
		$blogid = C::t('home_blog')->insert($blogarr, true);

		C::t('common_member_status')->update($_G['uid'], array('lastpost' => $_G['timestamp']));
		C::t('common_member_field_home')->update($_G['uid'], array('recentnote'=>$POST['subject']));
	}

	$blogarr['blogid'] = $blogid;
	$class_tag = new tag();
	$POST['tag'] = $olds ? $class_tag->update_field($POST['tag'], $blogid, 'blogid') : $class_tag->add_tag($POST['tag'], $blogid, 'blogid');
	$fieldarr = array(
		'message' => $message,
		'postip' => $_G['clientip'],
		'target_ids' => $POST['target_ids'],
		'tag' => $POST['tag']
	);

	if(!empty($titlepic)) {
		$fieldarr['pic'] = $titlepic;
	}

	if($olds) {
		C::t('home_blogfield')->update($blogid, $fieldarr);
	} else {
		$fieldarr['blogid'] = $blogid;
		$fieldarr['uid'] = $blogarr['uid'];
		C::t('home_blogfield')->insert($fieldarr);
	}

	if($isself && !$olds && $blog_status == 0) {
		updatecreditbyaction('publishblog', 0, array('blogs' => 1));

		include_once libfile('function/stat');
		updatestat('blog');
	}

	if($olds['blogid'] && $blog_status == 1) {
		updatecreditbyaction('publishblog', 0, array('blogs' => -1), '', -1);
		include_once libfile('function/stat');
		updatestat('blog');
	}

	if($POST['makefeed'] && $blog_status == 0) {
		include_once libfile('function/feed');
		feed_publish($blogid, 'blogid', $olds?0:1);
	}

	if(!empty($__G)) $_G = $__G;
	if($blog_status == 1) {
		updatemoderate('blogid', $blogid);
		manage_addnotify('verifyblog');
	}
	return $blogarr;
}
                    $share['title_template'] = lang('spacecp', 'share_image');
                    break;
                case 'article':
                    $feed_hash_data = 'articleid' . $share['itemid'];
                    $share['title_template'] = lang('spacecp', 'share_article');
                    break;
                case 'link':
                    $feed_hash_data = '';
                    break;
            }
            feed_add('share', '{actor} ' . $share['title_template'], array('hash_data' => $feed_hash_data), $share['body_template'], dunserialize($share['body_data']), $share['body_general'], array($share['image']), array($share['image_link']), '', '', '', 0, 0, '', $share['uid'], $share['username']);
        }
        updatemoderate('sid', $moderation['validate'], 2);
    }
    if (!empty($moderation['delete'])) {
        require libfile('function/delete');
        $shares = deleteshares($moderation['delete']);
        $deletes = count($shares);
        updatemoderate('sid', $moderation['delete'], 2);
    }
    if ($ignore_sids = dimplode($moderation['ignore'])) {
        $ignores = C::t('home_share')->update($moderation['ignore'], array('status' => 2));
        updatemoderate('sid', $moderation['ignore'], 1);
    }
    if ($_GET['fast']) {
        echo callback_js($_GET['sid']);
        exit;
    } else {
        cpmsg('moderate_shares_succeed', "action=moderate&operation=shares&page={$page}&filter={$filter}&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp={$_GET['tpp']}&showcensor={$showcensor}", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
    }
}
Beispiel #5
0
    if ($_G['forum_auditstatuson']) {
        if ($audit == 1) {
            updatemoderate($isfirstpost ? 'tid' : 'pid', $isfirstpost ? $_G['tid'] : $pid, '2');
            showmessage('auditstatuson_succeed', $redirecturl, $param);
        } else {
            updatemoderate($isfirstpost ? 'tid' : 'pid', $isfirstpost ? $_G['tid'] : $pid);
            showmessage('audit_edit_succeed', '', $param);
        }
    } else {
        if (!empty($_G['gp_delete']) && $isfirstpost) {
            my_thread_log('delete', array('tid' => $_G['tid']));
            showmessage('post_edit_delete_succeed', "forum.php?mod=forumdisplay&fid={$_G['fid']}", $param);
        } elseif (!empty($_G['gp_delete'])) {
            my_post_log('delete', array('pid' => $pid));
            showmessage('post_edit_delete_succeed', "forum.php?mod=viewthread&tid={$_G['tid']}&page={$_G['gp_page']}&extra={$extra}" . ($vid && $isfirstpost ? "&vid={$vid}" : ''), $param);
        } else {
            if ($isfirstpost && $modnewthreads) {
                updatemoderate('tid', $_G['tid']);
                showmessage('edit_newthread_mod_succeed', $redirecturl, $param);
            } elseif (!$isfirstpost && $modnewreplies) {
                updatemoderate('pid', $pid);
                showmessage('edit_reply_mod_succeed', "forum.php?mod=forumdisplay&fid={$_G['fid']}", $param);
            } else {
                if ($pinvisible != -3) {
                    my_post_log('update', array('pid' => $pid));
                }
                showmessage('post_edit_succeed', $redirecturl, $param);
            }
        }
    }
}
Beispiel #6
0
function addportalarticlecomment($id, $message, $idtype = 'aid')
{
    global $_G;
    $id = intval($id);
    if (empty($id)) {
        return 'comment_comment_noexist';
    }
    $message = getstr($message, $_G['group']['allowcommentarticle'], 0, 0, 1, 0);
    if (strlen($message) < 2) {
        return 'content_is_too_short';
    }
    $idtype = in_array($idtype, array('aid', 'topicid')) ? $idtype : 'aid';
    $tablename = $idtype == 'aid' ? 'portal_article_title' : 'portal_topic';
    $data = C::t($tablename)->fetch($id);
    if (empty($data)) {
        return 'comment_comment_noexist';
    }
    if ($data['allowcomment'] != 1) {
        return 'comment_comment_notallowed';
    }
    $message = censor($message);
    if (censormod($message)) {
        $comment_status = 1;
    } else {
        $comment_status = 0;
    }
    $setarr = array('uid' => $_G['uid'], 'username' => $_G['username'], 'id' => $id, 'idtype' => $idtype, 'postip' => $_G['clientip'], 'dateline' => $_G['timestamp'], 'status' => $comment_status, 'message' => $message);
    $pcid = C::t('portal_comment')->insert($setarr, true);
    if ($comment_status == 1) {
        updatemoderate($idtype . '_cid', $pcid);
        $notifykey = $idtype == 'aid' ? 'verifyacommont' : 'verifytopiccommont';
        manage_addnotify($notifykey);
    }
    $tablename = $idtype == 'aid' ? 'portal_article_count' : 'portal_topic';
    C::t($tablename)->increase($id, array('commentnum' => 1));
    C::t('common_member_status')->update($_G['uid'], array('lastpost' => $_G['timestamp']), 'UNBUFFERED');
    if ($data['uid'] != $_G['uid']) {
        updatecreditbyaction('portalcomment', 0, array(), $idtype . $id);
    }
    return 'do_success';
}
                 $displayorder = '-1';
                 break;
             }
         }
     }
     if ($displayorder < 0) {
         if ($displayorder == '-2' && $first == 0) {
             if (DB::affected_rows(DB::query("UPDATE " . DB::table($posttable) . " SET invisible = '{$displayorder}' WHERE pid = {$pid} AND invisible >= 0")) > 0) {
                 $xver >= 2 && updatemoderate('pid', $pid);
                 $posts_mod++;
             }
         } else {
             if (DB::affected_rows(DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder = '{$displayorder}' WHERE tid = {$tid} and displayorder >= 0")) > 0) {
                 if ($displayorder == '-2') {
                     $threads_mod++;
                     $xver >= 2 && updatemoderate('tid', $tid);
                 }
                 $displayorder == '-1' && $threads_banned++;
             }
         }
     }
     $subject = preg_replace($array_find, $array_replace, addslashes($subject));
     $message = preg_replace($array_find, $array_replace, addslashes($message));
     if ($subject != addslashes($row['subject']) || $message != addslashes($row['message'])) {
         if (DB::query("UPDATE " . DB::table($posttable) . " SET subject = '{$subject}', message = '{$message}' WHERE pid = {$pid}")) {
             $convertedrows++;
         }
     }
     $converted = 1;
 }
 $sql2 = "SELECT tid,subject from " . DB::table('forum_thread') . " where tid >= {$start} and tid <= {$end} AND displayorder = 0 {$sqlplus}";
     C::t('common_member_field_home')->update($_G['uid'], $setarr);
     if ($_POST['to_signhtml'] && $_G['group']['maxsigsize']) {
         if ($_G['group']['maxsigsize'] < 200) {
             $signhtml = getstr($_POST['message'], $_G['group']['maxsigsize'], 0, 0, 1);
             $signhtml = preg_replace("/\\<br.*?\\>/i", ' ', $signhtml);
         } else {
             $signhtml = $message;
         }
         C::t('common_member_field_forum')->update($_G['uid'], array('sightml' => $signhtml));
     }
     if (helper_access::check_module('feed') && ckprivacy('doing', 'feed') && $doing_status == '0') {
         $feedarr = array('appid' => '', 'icon' => 'doing', 'uid' => $_G['uid'], 'username' => $_G['username'], 'dateline' => $_G['timestamp'], 'title_template' => lang('feed', 'feed_doing_title'), 'title_data' => serialize(array('message' => $message)), 'body_template' => '', 'body_data' => '', 'id' => $newdoid, 'idtype' => 'doid');
         C::t('home_feed')->insert($feedarr);
     }
     if ($doing_status == '1') {
         updatemoderate('doid', $newdoid);
         manage_addnotify('verifydoing');
     }
     require_once libfile('function/stat');
     updatestat('doing');
     C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED');
     if (!empty($_GET['fromcard'])) {
         showmessage($message . lang('spacecp', 'card_update_doing'));
     } else {
         showmessage('do_success', dreferer(), array('doid' => $newdoid), $_GET['spacenote'] ? array('showmsg' => false) : array('header' => true));
     }
 } elseif (submitcheck('commentsubmit')) {
     if (!checkperm('allowdoing')) {
         showmessage('no_privilege_doing_comment');
     }
     cknewuser();
Beispiel #9
0
			}
			$query = DB::query("SELECT idtype, cid FROM ".DB::table('home_comment')." WHERE status='1'");
			while($row = DB::fetch($query)) {
				updatemoderate($row['idtype'].'_cid', $row['cid']);
			}
			$query = DB::query("SELECT aid FROM ".DB::table('portal_article_title')." WHERE status='1'");
			while($row = DB::fetch($query)) {
				updatemoderate('aid', $row['aid']);
			}
			$query = DB::query("SELECT cid FROM ".DB::table('portal_comment')." WHERE idtype='aid' AND status='1'");
			while($row = DB::fetch($query)) {
				updatemoderate('aid_cid', $row['cid']);
			}
			$query = DB::query("SELECT cid FROM ".DB::table('portal_comment')." WHERE idtype='topic' AND status='1'");
			while($row = DB::fetch($query)) {
				updatemoderate('topicid_cid', $row['cid']);
			}
		}
		show_msg("Kiểm toán nâng cấp dữ liệu", "$theurl?step=data&op=$nextop");

	} elseif($_GET['op'] == 'moderate_update') {
		$nextop = 'founder';

		if($first_to_2_5 && DB::fetch_first("SHOW TABLES LIKE '".DB::table('common_moderate')."'")) {
			$tables = array(
				'tid' => 'forum_thread_moderate',
				'pid' => 'forum_post_moderate',
				'blogid' => 'home_blog_moderate',
				'picid' => 'home_pic_moderate',
				'doid' => 'home_doing_moderate',
				'sid' => 'home_share_moderate',
Beispiel #10
0
         if (isset($_G['gp_' . $pm]) && $_G['gp_' . $pm] != '' && $post['authorid']) {
             $pmlist[] = array('action' => 'modreplies_validate', 'notevar' => array('pid' => $post['pid'], 'tid' => $post['tid'], 'post' => dhtmlspecialchars(cutstr($post['message'], 30)), 'reason' => dhtmlspecialchars($_G['gp_' . $pm])), 'authorid' => $post['authorid']);
         }
     }
     foreach ($threads as $tid => $thread) {
         DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies+{$thread['posts']} {$thread['lastpostadd']} {$thread['attachadd']} WHERE tid='{$tid}'", 'UNBUFFERED');
     }
     foreach (array_unique($forums) as $fid) {
         updateforumcount($fid);
     }
     if (!empty($pidarray)) {
         DB::query("UPDATE " . DB::table(getposttable($posttable)) . " SET status='4' WHERE pid IN (0," . implode(',', $pidarray) . ") AND status='0' AND invisible='-2'");
         DB::query("UPDATE " . DB::table(getposttable($posttable)) . " SET invisible='0' WHERE pid IN (0," . implode(',', $pidarray) . ")");
         $validates = DB::affected_rows();
         updatemodworks('MOD', $validates);
         updatemoderate('pid', $pidarray, 2);
     } else {
         updatemodworks('MOD', 1);
     }
 }
 if ($pmlist) {
     foreach ($pmlist as $pm) {
         notification_add($pm['authorid'], 'system', $pm['action'], $pm['notevar'], 1);
     }
 }
 if ($_G['gp_fast']) {
     echo callback_js($_G['gp_pid']);
     exit;
 } else {
     cpmsg('moderate_replies_succeed', "action=moderate&operation=replies&page={$page}&filter={$filter}&modfid={$modfid}&posttableid={$posttable}&dateline={$_G['gp_dateline']}&username={$_G['gp_username']}&title={$_G['gp_title']}&ppp={$_G['gp_ppp']}&showcensor={$showcensor}", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
 }
Beispiel #11
0
     if ($article_status == 1) {
         DB::update('portal_article_title', array('status' => '1'), array('aid' => $aid));
     }
     unset($contents[0]);
 }
 if ($contents) {
     $inserts = array();
     foreach ($contents as $key => $value) {
         $value = trim($value);
         $inserts[] = "('{$aid}', '" . (empty($pagetitle[$key - 1]) ? $_POST['pagetitle'] : $pagetitle[$key - 1]) . "', '{$value}', '" . ($pageorder + $key) . "', '{$_G['timestamp']}', '{$id}', '{$idtype}')";
     }
     DB::query("INSERT INTO " . DB::table('portal_article_content') . "\r\n\t\t\t(aid, title, content, pageorder, dateline, id, idtype)\r\n\t\t\tVALUES " . implode(',', $inserts));
     DB::query('UPDATE ' . DB::table('portal_article_title') . " SET status = '{$article_status}', contents = contents+" . count($inserts) . " WHERE aid='{$aid}'");
 }
 if ($article_status == 1) {
     updatemoderate('aid', $aid);
     manage_addnotify('verifyarticle');
 }
 $newaids = array();
 $_POST['attach_ids'] = explode(',', $_POST['attach_ids']);
 foreach ($_POST['attach_ids'] as $newaid) {
     $newaid = intval($newaid);
     if ($newaid) {
         $newaids[$newaid] = $newaid;
     }
 }
 if ($newaids) {
     DB::update('portal_attachment', array('aid' => $aid), "attachid IN (" . dimplode($newaids) . ") AND aid='0'");
 }
 DB::query("DELETE FROM " . DB::table('portal_article_related') . " WHERE aid='{$aid}' OR raid='{$aid}'");
 if ($_POST['raids']) {
function blog_post($POST, $olds = array())
{
    global $_G, $space;
    $isself = 1;
    if (!empty($olds['uid']) && $olds['uid'] != $_G['uid']) {
        $isself = 0;
        $__G = $_G;
        $_G['uid'] = $olds['uid'];
        $_G['username'] = addslashes($olds['username']);
    }
    $POST['subject'] = getstr(trim($POST['subject']), 80, 1, 1);
    $POST['subject'] = censor($POST['subject']);
    if (strlen($POST['subject']) < 1) {
        $POST['subject'] = dgmdate($_G['timestamp'], 'Y-m-d');
    }
    $POST['friend'] = intval($POST['friend']);
    $POST['target_ids'] = '';
    if ($POST['friend'] == 2) {
        $uids = array();
        $names = empty($_POST['target_names']) ? array() : explode(',', preg_replace("/(\\s+)/s", ',', $_POST['target_names']));
        if ($names) {
            $query = DB::query("SELECT uid FROM " . DB::table('common_member') . " WHERE username IN (" . dimplode($names) . ")");
            while ($value = DB::fetch($query)) {
                $uids[] = $value['uid'];
            }
        }
        if (empty($uids)) {
            $POST['friend'] = 3;
        } else {
            $POST['target_ids'] = implode(',', $uids);
        }
    } elseif ($POST['friend'] == 4) {
        $POST['password'] = trim($POST['password']);
        if ($POST['password'] == '') {
            $POST['friend'] = 0;
        }
    }
    if ($POST['friend'] !== 2) {
        $POST['target_ids'] = '';
    }
    if ($POST['friend'] !== 4) {
        $POST['password'] == '';
    }
    $POST['tag'] = dhtmlspecialchars(trim($POST['tag']));
    $POST['tag'] = getstr($POST['tag'], 500, 1, 1);
    $POST['tag'] = censor($POST['tag']);
    if ($_G['mobile']) {
        $POST['message'] = getstr($POST['message'], 0, 1, 0, 1);
        $POST['message'] = censor($POST['message']);
    } else {
        $POST['message'] = checkhtml($POST['message']);
        $POST['message'] = getstr($POST['message'], 0, 1, 0, 0, 1);
        $POST['message'] = censor($POST['message']);
        $POST['message'] = preg_replace(array("/\\<div\\>\\<\\/div\\>/i", "/\\<a\\s+href\\=\"([^\\>]+?)\"\\>/i"), array('', '<a href="\\1" target="_blank">'), $POST['message']);
    }
    $message = $POST['message'];
    if (censormod($message) || censormod($POST['subject']) || $_G['group']['allowblogmod']) {
        $blog_status = 1;
    } else {
        $blog_status = 0;
    }
    if (empty($olds['classid']) || $POST['classid'] != $olds['classid']) {
        if (!empty($POST['classid']) && substr($POST['classid'], 0, 4) == 'new:') {
            $classname = dhtmlspecialchars(trim(substr($POST['classid'], 4)));
            $classname = getstr($classname, 0, 1, 1);
            $classname = censor($classname);
            if (empty($classname)) {
                $classid = 0;
            } else {
                $classid = DB::result(DB::query("SELECT classid FROM " . DB::table('home_class') . " WHERE uid='{$_G['uid']}' AND classname='{$classname}'"));
                if (empty($classid)) {
                    $setarr = array('classname' => $classname, 'uid' => $_G['uid'], 'dateline' => $_G['timestamp']);
                    $classid = DB::insert('home_class', $setarr, 1);
                }
            }
        } else {
            $classid = intval($POST['classid']);
        }
    } else {
        $classid = $olds['classid'];
    }
    if ($classid && empty($classname)) {
        $classname = DB::result(DB::query("SELECT classname FROM " . DB::table('home_class') . " WHERE classid='{$classid}' AND uid='{$_G['uid']}'"));
        if (empty($classname)) {
            $classid = 0;
        }
    }
    $blogarr = array('subject' => $POST['subject'], 'classid' => $classid, 'friend' => $POST['friend'], 'password' => $POST['password'], 'noreply' => empty($POST['noreply']) ? 0 : 1, 'catid' => intval($POST['catid']), 'status' => $blog_status);
    $titlepic = '';
    $uploads = array();
    if (!empty($POST['picids'])) {
        $picids = array_keys($POST['picids']);
        $query = DB::query("SELECT * FROM " . DB::table('home_pic') . " WHERE picid IN (" . dimplode($picids) . ") AND uid='{$_G['uid']}'");
        while ($value = DB::fetch($query)) {
            if (empty($titlepic) && $value['thumb']) {
                $titlepic = getimgthumbname($value['filepath']);
                $blogarr['picflag'] = $value['remote'] ? 2 : 1;
            }
            $uploads[$POST['picids'][$value['picid']]] = $value;
        }
        if (empty($titlepic) && $value) {
            $titlepic = $value['filepath'];
            $blogarr['picflag'] = $value['remote'] ? 2 : 1;
        }
    }
    if ($uploads) {
        preg_match_all("/\\[imgid\\=(\\d+)\\]/i", $message, $mathes);
        if (!empty($mathes[1])) {
            $searchs = $replaces = array();
            foreach ($mathes[1] as $key => $value) {
                if (!empty($uploads[$value])) {
                    $picurl = pic_get($uploads[$value]['filepath'], 'album', $uploads[$value]['thumb'], $uploads[$value]['remote'], 0);
                    $searchs[] = "[imgid={$value}]";
                    $replaces[] = "<img src=\"{$picurl}\">";
                    unset($uploads[$value]);
                }
            }
            if ($searchs) {
                $message = str_replace($searchs, $replaces, $message);
            }
        }
        foreach ($uploads as $value) {
            $picurl = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0);
            $message .= "<div class=\"uchome-message-pic\"><img src=\"{$picurl}\"><p>{$value['title']}</p></div>";
        }
    }
    $ckmessage = preg_replace("/(\\<div\\>|\\<\\/div\\>|\\s|\\&nbsp\\;|\\<br\\>|\\<p\\>|\\<\\/p\\>)+/is", '', $message);
    if (empty($ckmessage)) {
        return false;
    }
    $message = addslashes($message);
    if (checkperm('manageblog')) {
        $blogarr['hot'] = intval($POST['hot']);
    }
    if ($olds['blogid']) {
        if ($blogarr['catid'] != $olds['catid']) {
            if ($olds['catid']) {
                DB::query("UPDATE " . DB::table('home_blog_category') . " SET num=num-1 WHERE catid='{$olds['catid']}' AND num>0");
            }
            if ($blogarr['catid']) {
                DB::query("UPDATE " . DB::table('home_blog_category') . " SET num=num+1 WHERE catid='{$blogarr['catid']}'");
            }
        }
        $blogid = $olds['blogid'];
        DB::update('home_blog', $blogarr, array('blogid' => $blogid));
        $fuids = array();
        $blogarr['uid'] = $olds['uid'];
        $blogarr['username'] = $olds['username'];
    } else {
        if ($blogarr['catid']) {
            DB::query("UPDATE " . DB::table('home_blog_category') . " SET num=num+1 WHERE catid='{$blogarr['catid']}'");
        }
        $blogarr['uid'] = $_G['uid'];
        $blogarr['username'] = $_G['username'];
        $blogarr['dateline'] = empty($POST['dateline']) ? $_G['timestamp'] : $POST['dateline'];
        $blogid = DB::insert('home_blog', $blogarr, 1);
        DB::update('common_member_status', array('lastpost' => $_G['timestamp']), array('uid' => $_G['uid']));
        DB::update('common_member_field_home', array('recentnote' => $POST['subject']), array('uid' => $_G['uid']));
    }
    $blogarr['blogid'] = $blogid;
    $POST['tag'] = $olds ? modblogtag($POST['tag'], $blogid) : addblogtag($POST['tag'], $blogid);
    $fieldarr = array('message' => $message, 'postip' => $_G['clientip'], 'target_ids' => $POST['target_ids'], 'tag' => $POST['tag']);
    if (!empty($titlepic)) {
        $fieldarr['pic'] = $titlepic;
    }
    if ($olds) {
        DB::update('home_blogfield', $fieldarr, array('blogid' => $blogid));
    } else {
        $fieldarr['blogid'] = $blogid;
        $fieldarr['uid'] = $blogarr['uid'];
        DB::insert('home_blogfield', $fieldarr);
    }
    if ($isself && !$olds && $blog_status == 0) {
        updatecreditbyaction('publishblog', 0, array('blogs' => 1));
        include_once libfile('function/stat');
        updatestat('blog');
    }
    if ($POST['makefeed'] && $blog_status == 0) {
        include_once libfile('function/feed');
        feed_publish($blogid, 'blogid', $olds ? 0 : 1);
    }
    if (!empty($__G)) {
        $_G = $__G;
    }
    if ($blog_status == 1) {
        updatemoderate('blogid', $blogid);
        manage_addnotify('verifyblog');
    }
    return $blogarr;
}
Beispiel #13
0
while ($row = $db_target->fetch_array($query)) {
    updatemoderate('blogid', $row['blogid']);
}
$query = $db_target->query("SELECT doid FROM {$table_target_home_doing} WHERE status='1'");
while ($row = $db_target->fetch_array($query)) {
    updatemoderate('doid', $row['doid']);
}
$query = $db_target->query("SELECT picid FROM {$table_target_home_pic} WHERE status='1'");
while ($row = $db_target->fetch_array($query)) {
    updatemoderate('picid', $row['picid']);
}
$query = $db_target->query("SELECT sid FROM {$table_target_home_share} WHERE status='1'");
while ($row = $db_target->fetch_array($query)) {
    updatemoderate('sid', $row['sid']);
}
$query = $db_target->query("SELECT idtype, cid FROM {$table_target_home_comment} WHERE status='1'");
while ($row = $db_target->fetch_array($query)) {
    updatemoderate($row['idtype'] . '_cid', $row['cid']);
}
function updatemoderate($idtype, $ids)
{
    global $table_target, $db_target;
    $ids = is_array($ids) ? $ids : array($ids);
    if (!$ids) {
        return;
    }
    $time = time();
    foreach ($ids as $id) {
        $db_target->query("INSERT INTO {$table_target} (id,idtype,status,dateline) VALUES ('{$id}','{$idtype}','0','{$time}')");
    }
}
Beispiel #14
0
    showtablefooter();
    showformfooter();
} else {
    $moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
    $validates = $deletes = $ignores = 0;
    $moderatedata = array();
    if (is_array($moderate)) {
        foreach ($moderate as $cid => $act) {
            $moderation[$act][] = $cid;
            $moderatedata[$act][$_G['gp_idtypes'][$cid]][] = $cid;
        }
    }
    foreach ($moderatedata as $act => $typeids) {
        foreach ($typeids as $idtype => $ids) {
            $op = $act == 'ignore' ? 1 : 2;
            updatemoderate($idtype . '_cid', $ids, $op);
        }
    }
    if ($validate_cids = dimplode($moderation['validate'])) {
        DB::update('home_comment', array('status' => '0'), "cid IN ({$validate_cids})");
        $validates = DB::affected_rows();
    }
    if (!empty($moderation['delete'])) {
        require_once libfile('function/delete');
        $comments = deletecomments($moderation['delete']);
        $deletes = count($comments);
    }
    if ($ignore_cids = dimplode($moderation['ignore'])) {
        DB::update('home_comment', array('status' => '2'), "cid IN ({$ignore_cids})");
        $ignores = DB::affected_rows();
    }
function add_comment($message, $id, $idtype, $cid = 0)
{
    global $_G, $bbcode;
    $allowcomment = false;
    switch ($idtype) {
        case 'uid':
            $allowcomment = helper_access::check_module('wall');
            break;
        case 'picid':
            $allowcomment = helper_access::check_module('album');
            break;
        case 'blogid':
            $allowcomment = helper_access::check_module('blog');
            break;
        case 'sid':
            $allowcomment = helper_access::check_module('share');
            break;
    }
    if (!$allowcomment) {
        showmessage('quickclear_noperm');
    }
    $summay = getstr($message, 150, 0, 0, 0, -1);
    $comment = array();
    if ($cid) {
        $comment = C::t('home_comment')->fetch_by_id_idtype($id, $idtype, $cid);
        if ($comment && $comment['authorid'] != $_G['uid']) {
            $comment['message'] = preg_replace("/\\<div class=\"quote\"\\>\\<blockquote\\>.*?\\<\\/blockquote\\>\\<\\/div\\>/is", '', $comment['message']);
            $comment['message'] = $bbcode->html2bbcode($comment['message']);
            $message = "<div class=\"quote\"><blockquote><b>" . $comment['author'] . "</b>: " . getstr($comment['message'], 150, 0, 0, 2, 1) . '</blockquote></div>' . $message;
            if ($comment['idtype'] == 'uid') {
                $id = $comment['authorid'];
            }
        } else {
            $comment = array();
        }
    }
    $hotarr = array();
    $stattype = '';
    $tospace = $pic = $blog = $album = $share = $poll = array();
    switch ($idtype) {
        case 'uid':
            $tospace = getuserbyuid($id);
            $stattype = 'wall';
            break;
        case 'picid':
            $pic = C::t('home_pic')->fetch($id);
            if (empty($pic)) {
                showmessage('view_images_do_not_exist');
            }
            $picfield = C::t('home_picfield')->fetch($id);
            $pic['hotuser'] = $picfield['hotuser'];
            $tospace = getuserbyuid($pic['uid']);
            $album = array();
            if ($pic['albumid']) {
                $query = C::t('home_album')->fetch($pic['albumid']);
                if (!$query['albumid']) {
                    C::t('home_pic')->update_for_albumid($albumid, array('albumid' => 0));
                }
            }
            if (!ckfriend($album['uid'], $album['friend'], $album['target_ids'])) {
                showmessage('no_privilege_ckfriend_pic');
            } elseif (!$tospace['self'] && $album['friend'] == 4) {
                $cookiename = "view_pwd_album_{$album['albumid']}";
                $cookievalue = empty($_G['cookie'][$cookiename]) ? '' : $_G['cookie'][$cookiename];
                if ($cookievalue != md5(md5($album['password']))) {
                    showmessage('no_privilege_ckpassword_pic');
                }
            }
            $hotarr = array('picid', $pic['picid'], $pic['hotuser']);
            $stattype = 'piccomment';
            break;
        case 'blogid':
            $blog = array_merge(C::t('home_blog')->fetch($id), C::t('home_blogfield')->fetch_targetids_by_blogid($id));
            if (empty($blog)) {
                showmessage('view_to_info_did_not_exist');
            }
            $tospace = getuserbyuid($blog['uid']);
            if (!ckfriend($blog['uid'], $blog['friend'], $blog['target_ids'])) {
                showmessage('no_privilege_ckfriend_blog');
            } elseif (!$tospace['self'] && $blog['friend'] == 4) {
                $cookiename = "view_pwd_blog_{$blog['blogid']}";
                $cookievalue = empty($_G['cookie'][$cookiename]) ? '' : $_G['cookie'][$cookiename];
                if ($cookievalue != md5(md5($blog['password']))) {
                    showmessage('no_privilege_ckpassword_blog');
                }
            }
            if (!empty($blog['noreply'])) {
                showmessage('do_not_accept_comments');
            }
            if ($blog['target_ids']) {
                $blog['target_ids'] .= ",{$blog['uid']}";
            }
            $hotarr = array('blogid', $blog['blogid'], $blog['hotuser']);
            $stattype = 'blogcomment';
            break;
        case 'sid':
            $share = C::t('home_share')->fetch($id);
            if (empty($share)) {
                showmessage('sharing_does_not_exist');
            }
            $tospace = getuserbyuid($share['uid']);
            $hotarr = array('sid', $share['sid'], $share['hotuser']);
            $stattype = 'sharecomment';
            break;
        default:
            showmessage('non_normal_operation');
            break;
    }
    if (empty($tospace)) {
        showmessage('space_does_not_exist', '', array(), array('return' => true));
    }
    if (isblacklist($tospace['uid'])) {
        showmessage('is_blacklist');
    }
    if ($hotarr && $tospace['uid'] != $_G['uid']) {
        hot_update($hotarr[0], $hotarr[1], $hotarr[2]);
    }
    $fs = array();
    $fs['icon'] = 'comment';
    $fs['target_ids'] = '';
    $fs['friend'] = '';
    $fs['body_template'] = '';
    $fs['body_data'] = array();
    $fs['body_general'] = '';
    $fs['images'] = array();
    $fs['image_links'] = array();
    switch ($idtype) {
        case 'uid':
            $fs['icon'] = 'wall';
            $fs['title_template'] = 'feed_comment_space';
            $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">{$tospace['username']}</a>");
            break;
        case 'picid':
            $fs['title_template'] = 'feed_comment_image';
            $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">" . $tospace['username'] . "</a>");
            $fs['body_template'] = '{pic_title}';
            $fs['body_data'] = array('pic_title' => $pic['title']);
            $fs['body_general'] = $summay;
            $fs['images'] = array(pic_get($pic['filepath'], 'album', $pic['thumb'], $pic['remote']));
            $fs['image_links'] = array("home.php?mod=space&uid={$tospace['uid']}&do=album&picid={$pic['picid']}");
            $fs['target_ids'] = $album['target_ids'];
            $fs['friend'] = $album['friend'];
            break;
        case 'blogid':
            C::t('home_blog')->increase($id, 0, array('replynum' => 1));
            $fs['title_template'] = 'feed_comment_blog';
            $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">" . $tospace['username'] . "</a>", 'blog' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}&do=blog&id={$id}\">{$blog['subject']}</a>");
            $fs['target_ids'] = $blog['target_ids'];
            $fs['friend'] = $blog['friend'];
            break;
        case 'sid':
            $fs['title_template'] = 'feed_comment_share';
            $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">" . $tospace['username'] . "</a>", 'share' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}&do=share&id={$id}\">" . str_replace(lang('spacecp', 'share_action'), '', $share['title_template']) . "</a>");
            break;
    }
    $message = censor($message);
    if (censormod($message)) {
        $comment_status = 1;
    } else {
        $comment_status = 0;
    }
    $setarr = array('uid' => $tospace['uid'], 'id' => $id, 'idtype' => $idtype, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'dateline' => $_G['timestamp'], 'message' => $message, 'ip' => $_G['clientip'], 'port' => $_G['remoteport'], 'status' => $comment_status);
    $cid = C::t('home_comment')->insert($setarr, true);
    $action = 'comment';
    $becomment = 'getcomment';
    $note = $q_note = '';
    $note_values = $q_values = array();
    switch ($idtype) {
        case 'uid':
            $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=wall&cid={$cid}";
            $note_type = 'wall';
            $note = 'wall';
            $note_values = array('url' => $n_url);
            $q_note = 'wall_reply';
            $q_values = array('url' => $n_url);
            if ($comment) {
                $msg = 'note_wall_reply_success';
                $magvalues = array('username' => $tospace['username']);
                $becomment = '';
            } else {
                $msg = 'do_success';
                $magvalues = array();
                $becomment = 'getguestbook';
            }
            $action = 'guestbook';
            break;
        case 'picid':
            $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=album&picid={$id}&cid={$cid}";
            $note_type = 'comment';
            $note = 'pic_comment';
            $note_values = array('url' => $n_url);
            $q_note = 'pic_comment_reply';
            $q_values = array('url' => $n_url);
            $msg = 'do_success';
            $magvalues = array();
            break;
        case 'blogid':
            $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=blog&id={$id}&cid={$cid}";
            $note_type = 'comment';
            $note = 'blog_comment';
            $note_values = array('url' => $n_url, 'subject' => $blog['subject']);
            $q_note = 'blog_comment_reply';
            $q_values = array('url' => $n_url);
            $msg = 'do_success';
            $magvalues = array();
            break;
        case 'sid':
            $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=share&id={$id}&cid={$cid}";
            $note_type = 'comment';
            $note = 'share_comment';
            $note_values = array('url' => $n_url);
            $q_note = 'share_comment_reply';
            $q_values = array('url' => $n_url);
            $msg = 'do_success';
            $magvalues = array();
            break;
    }
    if (empty($comment)) {
        if ($tospace['uid'] != $_G['uid']) {
            if (ckprivacy('comment', 'feed')) {
                require_once libfile('function/feed');
                $fs['title_data']['hash_data'] = "{$idtype}{$id}";
                feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general'], $fs['images'], $fs['image_links'], $fs['target_ids'], $fs['friend']);
            }
            $note_values['from_id'] = $id;
            $note_values['from_idtype'] = $idtype;
            $note_values['url'] .= "&goto=new#comment_{$cid}_li";
            notification_add($tospace['uid'], $note_type, $note, $note_values);
        }
    } elseif ($comment['authorid'] != $_G['uid']) {
        notification_add($comment['authorid'], $note_type, $q_note, $q_values);
    }
    if ($comment_status == 1) {
        updatemoderate($idtype . '_cid', $cid);
        manage_addnotify('verifycommontes');
    }
    if ($stattype) {
        include_once libfile('function/stat');
        updatestat($stattype);
    }
    if ($tospace['uid'] != $_G['uid']) {
        $needle = $id;
        if ($idtype != 'uid') {
            $needle = $idtype . $id;
        } else {
            $needle = $tospace['uid'];
        }
        updatecreditbyaction($action, 0, array(), $needle);
        if ($becomment) {
            if ($idtype == 'uid') {
                $needle = $_G['uid'];
            }
            updatecreditbyaction($becomment, $tospace['uid'], array(), $needle);
        }
    }
    C::t('common_member_status')->update($_G['uid'], array('lastpost' => $_G['timestamp']), 'UNBUFFERED');
    $magvalues['cid'] = $cid;
    return array('cid' => $cid, 'msg' => $msg, 'magvalues' => $magvalues);
}
     case 'pic':
         DB::query("UPDATE " . DB::table('home_pic') . " SET sharetimes=sharetimes+1 WHERE picid='{$picid}'");
         break;
     case 'thread':
         DB::query("UPDATE " . DB::table('forum_thread') . " SET sharetimes=sharetimes+1 WHERE tid='{$id}'");
         if ($_G['setting']['heatthread']['type'] == 2) {
             require_once libfile('function/forum');
             update_threadpartake($id);
         }
         break;
     case 'article':
         DB::query("UPDATE " . DB::table('portal_article_count') . " SET sharetimes=sharetimes+1 WHERE aid='{$id}'");
         break;
 }
 if ($arr['status'] == 1) {
     updatemoderate('sid', $sid);
     manage_addnotify('verifyshare');
 }
 if ($type == 'link' || !DB::result_first("SELECT COUNT(*) FROM " . DB::table('home_share') . " WHERE uid='{$_G['uid']}' AND itemid='{$id}' AND type='{$type}'")) {
     include_once libfile('function/stat');
     updatestat('share');
 }
 if ($note_uid && $note_uid != $_G['uid']) {
     notification_add($note_uid, 'sharenotice', $note_message, $note_values);
 }
 $needle = $id ? $type . $id : '';
 updatecreditbyaction('createshare', $_G['uid'], array('sharings' => 1), $needle);
 $referer = "home.php?mod=space&uid={$_G['uid']}&do=share&view={$_GET['view']}&from={$_GET['from']}";
 $magvalues['sid'] = $sid;
 if (!$redirecturl) {
     $redirecturl = dreferer();
Beispiel #17
0
            $moderate[$act][] = $blogid;
        }
    }
    if ($validate_blogids = dimplode($moderate['validate'])) {
        DB::update('home_blog', array('status' => '0'), "blogid IN ({$validate_blogids})");
        $validates = DB::affected_rows();
        $query_t = DB::query("SELECT uid, COUNT(blogid) AS count\r\n\t\t\tFROM " . DB::table('home_blog') . "\r\n\t\t\tWHERE blogid IN ({$validate_blogids})\r\n\t\t\tGROUP BY uid");
        while ($blog_user = DB::fetch($query_t)) {
            $credit_times = $blog_user['count'];
            updatecreditbyaction('publishblog', $blog_user['uid'], array('blogs' => 1), '', $credit_times);
        }
        updatemoderate('blogid', $moderate['validate'], 2);
    }
    if ($moderate['delete']) {
        require_once libfile('function/delete');
        $delete_blogs = deleteblogs($moderate['delete']);
        $deletes = count($delete_blogs);
        updatemoderate('blogid', $moderate['delete'], 2);
    }
    if ($ignore_blogids = dimplode($moderate['ignore'])) {
        DB::update('home_blog', array('status' => '2'), "blogid IN ({$ignore_blogids})");
        $ignores = DB::affected_rows();
        updatemoderate('blogid', $moderate['ignore'], 1);
    }
    if ($_G['gp_fast']) {
        echo callback_js($_G['gp_blogid']);
        exit;
    } else {
        cpmsg('moderate_blogs_succeed', "action=moderate&operation=blogs&page={$page}&filter={$filter}&dateline={$_G['gp_dateline']}&username={$_G['gp_username']}&title={$_G['gp_title']}&tpp={$_G['gp_tpp']}&showcensor={$showcensor}", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
    }
}
Beispiel #18
0
         if ($tids) {
             $tidstr = dimplode($tids);
             C::t('forum_post')->update_by_tid(0, $tids, array('invisible' => 0), true, false, 1);
             C::t('forum_thread')->update($tids, array('displayorder' => 0, 'moderated' => 1));
             $threadsmod = DB::affected_rows();
             if ($_G['fid']) {
                 updateforumcount($_G['fid']);
             } else {
                 $fids = array_keys($modforums['list']);
                 foreach ($fids as $f) {
                     updateforumcount($f);
                 }
             }
             updatemodworks('MOD', $threadsmod);
             updatemodlog($tidstr, 'MOD');
             updatemoderate('tid', $tids, 2);
         }
     }
     if ($pmlist) {
         foreach ($pmlist as $pm) {
             $threadsubject = $pm['thread'];
             $_G['tid'] = intval($pm['tid']);
             notification_add($pm['authorid'], 'system', $pm['act'], $pm['notevar'], 1);
         }
     }
     showmessage('modcp_mod_succeed', "{$cpscript}?mod=modcp&action={$_GET['action']}&op={$op}&filter={$filter}&fid={$_G['fid']}");
 }
 $modcount = C::t('common_moderate')->count_by_seach_for_thread($moderatestatus, $modfids ? explode(',', $modfids) : null);
 $multipage = multi($modcount, $_G['tpp'], $page, "{$cpscript}?mod=modcp&action={$_GET['action']}&op={$op}&filter={$filter}&fid={$_G['fid']}");
 if ($modcount) {
     $posttablearr = array();
 public function newreply($parameters)
 {
     $this->_init_parameters($parameters);
     if ($this->thread['closed'] && !$this->forum['ismoderator'] && !$this->thread['isgroup']) {
         return $this->showmessage('post_thread_closed');
     } elseif (!$this->thread['isgroup'] && ($post_autoclose = checkautoclose($this->thread))) {
         return $this->showmessage($post_autoclose, '', array('autoclose' => $this->forum['autoclose']));
     }
     if (trim($this->param['subject']) == '' && trim($this->param['message']) == '' && $this->thread['special'] != 2) {
         return $this->showmessage('post_sm_isnull');
     } elseif ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $this->param['special'] == 2 && $this->group['allowposttrade'])) {
         return $this->showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
     } elseif (checkflood()) {
         return $this->showmessage('post_flood_ctrl', '', array('floodctrl' => $this->setting['floodctrl']));
     } elseif (checkmaxperhour('pid')) {
         return $this->showmessage('post_flood_ctrl_posts_per_hour', '', array('posts_per_hour' => $this->group['maxpostsperhour']));
     }
     $heatthreadset = update_threadpartake($this->thread['tid'], true);
     $bbcodeoff = checkbbcodes($this->param['message'], !empty($this->param['bbcodeoff']));
     $smileyoff = checksmilies($this->param['message'], !empty($this->param['smileyoff']));
     $parseurloff = !empty($this->param['parseurloff']);
     $htmlon = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
     $usesig = !empty($this->param['usesig']) && $this->group['maxsigsize'] ? 1 : 0;
     $this->param['isanonymous'] = $this->group['allowanonymous'] && !empty($this->param['isanonymous']) ? 1 : 0;
     $author = empty($this->param['isanonymous']) ? $this->member['username'] : '';
     list(, $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
     if ($this->thread['displayorder'] == -4) {
         $this->param['modnewreplies'] = 0;
     }
     $pinvisible = $this->param['modnewreplies'] ? -2 : ($this->thread['displayorder'] == -4 ? -3 : 0);
     $this->param['message'] = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->param['message']);
     if (!empty($this->param['noticetrimstr'])) {
         $this->param['message'] = $this->param['noticetrimstr'] . "\n\n" . $this->param['message'];
         $bbcodeoff = false;
     }
     $status = defined('IN_MOBILE') ? 8 : 0;
     if ($this->param['modstatus']) {
         foreach ($this->param['modstatus'] as $modbit => $modvalue) {
             $status = setstatus($modbit, $modvalue, $status);
         }
     }
     $this->pid = insertpost(array('fid' => $this->forum['fid'], 'tid' => $this->thread['tid'], 'first' => '0', 'author' => $this->member['username'], 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['timestamp'] ? $this->param['timestamp'] : getglobal('timestamp'), 'message' => $this->param['message'], 'useip' => $this->param['clientip'] ? $this->param['clientip'] : getglobal('clientip'), 'port' => $this->param['remoteport'] ? $this->param['remoteport'] : getglobal('remoteport'), 'invisible' => $pinvisible, 'anonymous' => $this->param['isanonymous'], 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'status' => $status));
     $this->param['updatethreaddata'] = $heatthreadset ? $heatthreadset : array();
     $this->param['maxposition'] = C::t('forum_post')->fetch_maxposition_by_tid($this->thread['posttableid'], $this->thread['tid']);
     $this->param['updatethreaddata'][] = DB::field('maxposition', $this->param['maxposition']);
     useractionlog($this->member['uid'], 'pid');
     if ($this->param['geoloc'] && IN_MOBILE == 2) {
         list($mapx, $mapy, $location) = explode('|', $this->param['geoloc']);
         if ($mapx && $mapy && $location) {
             C::t('forum_post_location')->insert(array('pid' => $this->pid, 'tid' => $this->thread['tid'], 'uid' => $this->member['uid'], 'mapx' => $mapx, 'mapy' => $mapy, 'location' => $location));
         }
     }
     $nauthorid = 0;
     if (!empty($this->param['noticeauthor']) && !$this->param['isanonymous'] && !$this->param['modnewreplies']) {
         list($ac, $nauthorid) = explode('|', authcode($this->param['noticeauthor'], 'DECODE'));
         if ($nauthorid != $this->member['uid']) {
             if ($ac == 'q') {
                 notification_add($nauthorid, 'post', 'reppost_noticeauthor', array('tid' => $this->thread['tid'], 'subject' => $this->thread['subject'], 'fid' => $this->forum['fid'], 'pid' => $this->pid, 'from_id' => $this->pid, 'from_idtype' => 'quote'));
             } elseif ($ac == 'r') {
                 notification_add($nauthorid, 'post', 'reppost_noticeauthor', array('tid' => $this->thread['tid'], 'subject' => $this->thread['subject'], 'fid' => $this->forum['fid'], 'pid' => $this->pid, 'from_id' => $this->thread['tid'], 'from_idtype' => 'post'));
             }
         }
     }
     if ($this->thread['authorid'] != $this->member['uid'] && getstatus($this->thread['status'], 6) && empty($this->param['noticeauthor']) && !$this->param['isanonymous'] && !$this->param['modnewreplies']) {
         $thapost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($this->thread['tid'], 0);
         notification_add($thapost['authorid'], 'post', 'reppost_noticeauthor', array('tid' => $this->thread['tid'], 'subject' => $this->thread['subject'], 'fid' => $this->forum['fid'], 'pid' => $this->pid, 'from_id' => $this->thread['tid'], 'from_idtype' => 'post'));
     }
     $this->forum['threadcaches'] && deletethreadcaches($this->thread['tid']);
     include_once libfile('function/stat');
     updatestat($this->thread['isgroup'] ? 'grouppost' : 'post');
     $this->param['showmsgparam']['fid'] = $this->forum['fid'];
     $this->param['showmsgparam']['tid'] = $this->thread['tid'];
     $this->param['showmsgparam']['pid'] = $this->pid;
     $this->param['showmsgparam']['from'] = $this->param['from'];
     $this->param['showmsgparam']['sechash'] = !empty($this->param['sechash']) ? $this->param['sechash'] : '';
     dsetcookie('clearUserdata', 'forum');
     if ($this->thread['replies'] <= 0) {
         C::t('forum_sofa')->delete($this->thread['tid']);
     }
     if ($this->param['modnewreplies']) {
         updatemoderate('pid', $this->pid);
         unset($this->param['showmsgparam']['pid']);
         if ($this->param['updatethreaddata']) {
             C::t('forum_thread')->update($this->thread['tid'], $this->param['updatethreaddata'], false, false, 0, true);
         }
         C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 0, 1, 1);
         manage_addnotify('verifypost');
         return 'post_reply_mod_succeed';
     } else {
         $fieldarr = array('lastposter' => array($author), 'replies' => 1);
         if ($this->thread['lastpost'] < getglobal('timestamp')) {
             $fieldarr['lastpost'] = array(getglobal('timestamp'));
         }
         $row = C::t('forum_threadaddviews')->fetch($this->thread['tid']);
         if (!empty($row)) {
             C::t('forum_threadaddviews')->update($this->thread['tid'], array('addviews' => 0));
             $fieldarr['views'] = $row['addviews'];
         }
         $this->param['updatethreaddata'] = array_merge($this->param['updatethreaddata'], C::t('forum_thread')->increase($this->thread['tid'], $fieldarr, false, 0, true));
         if ($this->thread['displayorder'] != -4) {
             updatepostcredits('+', $this->member['uid'], 'reply', $this->forum['fid']);
             if ($this->forum['status'] == 3) {
                 if ($this->forum['closed'] > 1) {
                     C::t('forum_thread')->increase($this->forum['closed'], $fieldarr, true);
                 }
                 C::t('forum_groupuser')->update_counter_for_user($this->member['uid'], $this->forum['fid'], 0, 1);
                 C::t('forum_forumfield')->update($this->forum['fid'], array('lastupdate' => TIMESTAMP));
                 require_once libfile('function/grouplog');
                 updategroupcreditlog($this->forum['fid'], $this->member['uid']);
             }
             $lastpost = $this->thread['tid'] . "\t" . $this->thread['subject'] . "\t" . getglobal('timestamp') . "\t" . $author;
             C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => $lastpost));
             C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 1, 1);
             if ($this->forum['type'] == 'sub') {
                 C::t('forum_forum')->update($this->forum['fup'], array('lastpost' => $lastpost));
             }
         }
         $this->param['page'] = getstatus($this->thread['status'], 4) ? 1 : @ceil(($this->thread['special'] ? $this->thread['replies'] + 1 : $this->thread['replies'] + 2) / getglobal('ppp'));
         if ($this->param['updatethreaddata']) {
             C::t('forum_thread')->update($this->thread['tid'], $this->param['updatethreaddata'], false, false, 0, true);
         }
         return 'post_reply_succeed';
     }
 }
function addportalarticlecomment($id, $message, $idtype = 'aid')
{
    global $_G;
    $id = intval($id);
    if (empty($id)) {
        return 'comment_comment_noexist';
    }
    $message = getstr($message, $_G['group']['allowcommentarticle'], 1, 1, 1, 0);
    if (strlen($message) < 2) {
        return 'content_is_too_short';
    }
    $idtype = in_array($idtype, array('aid', 'topicid')) ? $idtype : 'aid';
    $tablename = $idtype == 'aid' ? 'portal_article_title' : 'portal_topic';
    $data = DB::fetch_first("SELECT uid,allowcomment FROM " . DB::table($tablename) . " WHERE {$idtype}='{$id}'");
    if (empty($data)) {
        return 'comment_comment_noexist';
    }
    if ($data['allowcomment'] != 1) {
        return 'comment_comment_notallowed';
    }
    $message = censor($message);
    if (censormod($message)) {
        $comment_status = 1;
    } else {
        $comment_status = 0;
    }
    $setarr = array('uid' => $_G['uid'], 'username' => $_G['username'], 'id' => $id, 'idtype' => $idtype, 'postip' => $_G['onlineip'], 'dateline' => $_G['timestamp'], 'status' => $comment_status, 'message' => $message);
    $pcid = DB::insert('portal_comment', $setarr, true);
    if ($comment_status == 1) {
        updatemoderate($idtype . '_cid', $pcid);
        $notifykey = $idtype == 'aid' ? 'verifyacommont' : 'verifytopiccommont';
        manage_addnotify($notifykey);
    }
    $tablename = $idtype == 'aid' ? 'portal_article_count' : 'portal_topic';
    DB::query("UPDATE " . DB::table($tablename) . " SET commentnum=commentnum+1 WHERE {$idtype}='{$id}'");
    DB::update('common_member_status', array('lastpost' => $_G['timestamp']), array('uid' => $_G['uid']));
    if ($data['uid'] != $_G['uid']) {
        updatecreditbyaction('portalcomment', 0, array(), $idtype . $id);
    }
    return 'do_success';
}
Beispiel #21
0
 private function sendPost($extract)
 {
     global $_G;
     extract($extract);
     // 获取主题和帖子要插入的状态信息
     $topicStatus = ForumUtils::getPostSendStatus('topic', $_GET['platType']);
     $postStatus = ForumUtils::getPostSendStatus('post', $_GET['platType']);
     //copy from dz source/include/post/post_newthread.php
     if (empty($_G['forum']['fid']) || $_G['forum']['type'] == 'group') {
         return WebUtils::makeErrorInfo_oldVersion($res, 'forum_nonexistence');
     }
     if ($special == 1 && !$_G['group']['allowpostpoll'] || $special == 2 && !$_G['group']['allowposttrade'] || $special == 3 && !$_G['group']['allowpostreward'] || $special == 4 && !$_G['group']['allowpostactivity'] || $special == 5 && !$_G['group']['allowpostdebate']) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle']));
     }
     if (!$_G['uid'] && !(!$_G['forum']['postperm'] && $_G['group']['allowpost'] || $_G['forum']['postperm'] && forumperm($_G['forum']['postperm']))) {
         if (!defined('IN_MOBILE')) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission', array('{login}' => 1));
         } else {
             return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission_mobile', array('{login}' => 1));
         }
     } elseif (empty($_G['forum']['allowpost'])) {
         if (!$_G['forum']['postperm'] && !$_G['group']['allowpost']) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_none_nopermission');
         } elseif ($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) {
             $msg = mobcent_showmessagenoperm('postperm', $_G['fid'], $_G['forum']['formulaperm']);
             return WebUtils::makeErrorInfo_oldVersion($res, $msg['message'], $msg['params']);
         }
     } elseif ($_G['forum']['allowpost'] == -1) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_forum_newthread_nopermission');
     }
     if (!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission');
     }
     if (trim($subject) == '') {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_sm_isnull');
     }
     if (!$sortid && !$special && trim($message) == '') {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_sm_isnull');
     }
     if ($post_invalid = checkpost($subject, $message, $special || $sortid)) {
         return WebUtils::makeErrorInfo_oldVersion($res, $post_invalid, array('{minpostsize}' => $_G['setting']['minpostsize'], '{maxpostsize}' => $_G['setting']['maxpostsize']));
         //showmessage($post_invalid, '', array('minpostsize' => $_G['setting']['minpostsize'], 'maxpostsize' => $_G['setting']['maxpostsize']));
     }
     if (checkflood()) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_flood_ctrl', array('{floodctrl}' => $_G['setting']['floodctrl']));
     } elseif (checkmaxperhour('tid')) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'thread_flood_ctrl_threads_per_hour', array('{threads_per_hour}' => $_G['group']['maxthreadsperhour']));
     }
     $_GET['save'] = $_G['uid'] ? $_GET['save'] : 0;
     if ($_G['group']['allowsetpublishdate'] && $_GET['cronpublish'] && $_GET['cronpublishdate']) {
         $publishdate = strtotime($_GET['cronpublishdate']);
         if ($publishdate > $_G['timestamp']) {
             $_GET['save'] = 1;
         } else {
             $publishdate = $_G['timestamp'];
         }
     } else {
         $publishdate = $_G['timestamp'];
     }
     $typeid = isset($typeid) && isset($_G['forum']['threadtypes']['types'][$typeid]) && (empty($_G['forum']['threadtypes']['moderators'][$typeid]) || $_G['forum']['ismoderator']) ? $typeid : 0;
     $displayorder = $modnewthreads ? -2 : ($_G['forum']['ismoderator'] && $_G['group']['allowstickthread'] && !empty($_GET['sticktopic']) ? 1 : (empty($_GET['save']) ? 0 : -4));
     if ($displayorder == -2) {
         C::t('forum_forum')->update($_G['fid'], array('modworks' => '1'));
     } elseif ($displayorder == -4) {
         $_GET['addfeed'] = 0;
     }
     $digest = $_G['forum']['ismoderator'] && $_G['group']['allowdigestthread'] && !empty($_GET['addtodigest']) ? 1 : 0;
     $readperm = $_G['group']['allowsetreadperm'] ? $readperm : 0;
     $isanonymous = $_G['group']['allowanonymous'] && $_GET['isanonymous'] ? 1 : 0;
     $price = intval($price);
     $price = $_G['group']['maxprice'] && !$special ? $price <= $_G['group']['maxprice'] ? $price : $_G['group']['maxprice'] : 0;
     //强制主题类别判断
     if (!$typeid && $_G['forum']['threadtypes']['required'] && !$special) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_type_isnull');
     }
     //强制主题分类判断
     if (!$sortid && $_G['forum']['threadsorts']['required'] && !$special) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_sort_isnull');
     }
     //主题售价 客户端暂不支持
     if ($price > 0 && floor($price * (1 - $_G['setting']['creditstax'])) == 0) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
         showmessage('post_net_price_iszero');
     }
     //投票贴相关
     if ($special == 1) {
         $polloption = $_GET['tpolloption'] == 2 ? explode("\n", $_GET['polloptions']) : $_GET['polloption'];
         $pollarray = array();
         foreach ($polloption as $key => $value) {
             $polloption[$key] = censor($polloption[$key]);
             if (trim($value) === '') {
                 unset($polloption[$key]);
             }
         }
         if (count($polloption) > $_G['setting']['maxpolloptions']) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('post_poll_option_toomany', '', array('maxpolloptions' => $_G['setting']['maxpolloptions']));
         } elseif (count($polloption) < 2) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('post_poll_inputmore');
         }
         $curpolloption = count($polloption);
         $pollarray['maxchoices'] = empty($_GET['maxchoices']) ? 0 : ($_GET['maxchoices'] > $curpolloption ? $curpolloption : $_GET['maxchoices']);
         $pollarray['multiple'] = empty($_GET['maxchoices']) || $_GET['maxchoices'] == 1 ? 0 : 1;
         $pollarray['options'] = $polloption;
         $pollarray['visible'] = empty($_GET['visibilitypoll']);
         $pollarray['overt'] = !empty($_GET['overt']);
         if (preg_match("/^\\d*\$/", trim($_GET['expiration']))) {
             if (empty($_GET['expiration'])) {
                 $pollarray['expiration'] = 0;
             } else {
                 $pollarray['expiration'] = TIMESTAMP + 86400 * $_GET['expiration'];
             }
         } else {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('poll_maxchoices_expiration_invalid');
         }
     }
     // 分类信息有效期
     $_GET['typeexpiration'] = $_GET['typeoption']['typeexpiration'];
     $sortid = $special && $_G['forum']['threadsorts']['types'][$sortid] ? 0 : $sortid;
     $typeexpiration = intval($_GET['typeexpiration']);
     if ($_G['forum']['threadsorts']['expiration'][$typeid] && !$typeexpiration) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'threadtype_expiration_invalid');
     }
     $_G['forum_optiondata'] = array();
     if ($_G['forum']['threadsorts']['types'][$sortid] && !$_G['forum']['allowspecialonly']) {
         Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_threadsort.php');
         $_G['forum_optiondata'] = mobcent_threadsort_validator($_GET['typeoption'], $pid);
         if ($_G['forum_optiondata']['message'] != '') {
             return WebUtils::makeErrorInfo_oldVersion($res, $_G['forum_optiondata']['message'], $_G['forum_optiondata']['params']);
         }
     }
     $author = !$isanonymous ? $_G['username'] : '';
     $moderated = $digest || $displayorder > 0 ? 1 : 0;
     $thread['status'] = 0;
     $_GET['ordertype'] && ($thread['status'] = setstatus(4, 1, $thread['status']));
     $_GET['hiddenreplies'] && ($thread['status'] = setstatus(2, 1, $thread['status']));
     /*             if($_G['group']['allowpostrushreply'] && $_GET['rushreply']) {
              $_GET['rushreplyfrom'] = strtotime($_GET['rushreplyfrom']);
             $_GET['rushreplyto'] = strtotime($_GET['rushreplyto']);
             $_GET['rewardfloor'] = trim($_GET['rewardfloor']);
             $_GET['stopfloor'] = intval($_GET['stopfloor']);
             $_GET['creditlimit'] = $_GET['creditlimit'] == '' ? '-996' : intval($_GET['creditlimit']);
             if($_GET['rushreplyfrom'] > $_GET['rushreplyto'] && !empty($_GET['rushreplyto'])) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('post_rushreply_timewrong');
             }
             if(($_GET['rushreplyfrom'] > $_G['timestamp']) || (!empty($_GET['rushreplyto']) && $_GET['rushreplyto'] < $_G['timestamp']) || ($_GET['stopfloor'] == 1) ) {
             $closed = true;
             }
             if(!empty($_GET['rewardfloor']) && !empty($_GET['stopfloor'])) {
             $floors = explode(',', $_GET['rewardfloor']);
             if(!empty($floors) && is_array($floors)) {
             foreach($floors AS $key => $floor) {
             if(strpos($floor, '*') === false) {
             if(intval($floor) == 0) {
             unset($floors[$key]);
             } elseif($floor > $_GET['stopfloor']) {
             unset($floors[$key]);
             }
             }
             }
             $_GET['rewardfloor'] = implode(',', $floors);
             }
             }
             $thread['status'] = setstatus(3, 1, $thread['status']);
             $thread['status'] = setstatus(1, 1, $thread['status']);
             } */
     $_GET['allownoticeauthor'] && ($thread['status'] = setstatus(6, 1, $thread['status']));
     $isgroup = $_G['forum']['status'] == 3 ? 1 : 0;
     /*  if($_G['group']['allowreplycredit']) {
              $_GET['replycredit_extcredits'] = intval($_GET['replycredit_extcredits']);
             $_GET['replycredit_times'] = intval($_GET['replycredit_times']);
             $_GET['replycredit_membertimes'] = intval($_GET['replycredit_membertimes']);
             $_GET['replycredit_random'] = intval($_GET['replycredit_random']);
     
             $_GET['replycredit_random'] = $_GET['replycredit_random'] < 0 || $_GET['replycredit_random'] > 99 ? 0 : $_GET['replycredit_random'] ;
             $replycredit = $replycredit_real = 0;
             if($_GET['replycredit_extcredits'] > 0 && $_GET['replycredit_times'] > 0) {
             $replycredit_real = ceil(($_GET['replycredit_extcredits'] * $_GET['replycredit_times']) + ($_GET['replycredit_extcredits'] * $_GET['replycredit_times'] *  $_G['setting']['creditstax']));
             if($replycredit_real > getuserprofile('extcredits'.$_G['setting']['creditstransextra'][10])) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('replycredit_morethan_self');
             } else {
             $replycredit = ceil($_GET['replycredit_extcredits'] * $_GET['replycredit_times']);
             }
             }
             } */
     $newthread = array('fid' => $_G['fid'], 'posttableid' => 0, 'readperm' => $readperm, 'price' => $price, 'typeid' => $typeid, 'sortid' => $sortid, 'author' => $author, 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'lastpost' => $publishdate, 'lastposter' => $author, 'displayorder' => $displayorder, 'digest' => $digest, 'special' => $special, 'attachment' => 0, 'moderated' => $moderated, 'status' => $thread['status'] | $topicStatus, 'isgroup' => $isgroup, 'replycredit' => $replycredit, 'closed' => $closed ? 1 : 0);
     $tid = C::t('forum_thread')->insert($newthread, true);
     useractionlog($_G['uid'], 'tid');
     if (!getuserprofile('threads') && $_G['setting']['newbie']) {
         C::t('forum_thread')->update($tid, array('icon' => $_G['setting']['newbie']));
     }
     if ($publishdate != $_G['timestamp']) {
         loadcache('cronpublish');
         $cron_publish_ids = dunserialize($_G['cache']['cronpublish']);
         $cron_publish_ids[$tid] = $tid;
         $cron_publish_ids = serialize($cron_publish_ids);
         savecache('cronpublish', $cron_publish_ids);
     }
     if (!$isanonymous) {
         C::t('common_member_field_home')->update($_G['uid'], array('recentnote' => $subject));
     }
     if ($special == 3 && $_G['group']['allowpostreward']) {
         updatemembercount($_G['uid'], array($_G['setting']['creditstransextra'][2] => -$realprice), 1, 'RTC', $tid);
     }
     if ($moderated) {
         updatemodlog($tid, $displayorder > 0 ? 'STK' : 'DIG');
         updatemodworks($displayorder > 0 ? 'STK' : 'DIG', 1);
     }
     /* if($special == 1) {
     
             foreach($pollarray['options'] as $polloptvalue) {
             $polloptvalue = dhtmlspecialchars(trim($polloptvalue));
             C::t('forum_polloption')->insert(array('tid' => $tid, 'polloption' => $polloptvalue));
             }
             $polloptionpreview = '';
             $query = C::t('forum_polloption')->fetch_all_by_tid($tid, 1, 2);
             foreach($query as $option) {
             $polloptvalue = preg_replace("/\[url=(https?){1}:\/\/([^\[\"']+?)\](.+?)\[\/url\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $option['polloption']);
             $polloptionpreview .= $polloptvalue."\t";
             }
     
             $polloptionpreview = daddslashes($polloptionpreview);
     
             $data = array('tid' => $tid, 'multiple' => $pollarray['multiple'], 'visible' => $pollarray['visible'], 'maxchoices' => $pollarray['maxchoices'], 'expiration' => $pollarray['expiration'], 'overt' => $pollarray['overt'], 'pollpreview' => $polloptionpreview);
             C::t('forum_poll')->insert($data);
             } */
     if ($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata'])) {
         $filedname = $valuelist = $separator = '';
         foreach ($_G['forum_optiondata'] as $optionid => $value) {
             if ($value) {
                 $filedname .= $separator . $_G['forum_optionlist'][$optionid]['identifier'];
                 $valuelist .= $separator . "'" . daddslashes($value) . "'";
                 $separator = ' ,';
             }
             if ($_G['forum_optionlist'][$optionid]['type'] == 'image') {
                 $identifier = $_G['forum_optionlist'][$optionid]['identifier'];
                 $sortaids[] = intval($_GET['typeoption'][$identifier]['aid']);
             }
             C::t('forum_typeoptionvar')->insert(array('sortid' => $sortid, 'tid' => $tid, 'fid' => $_G['fid'], 'optionid' => $optionid, 'value' => censor($value), 'expiration' => $typeexpiration ? $publishdate + $typeexpiration : 0));
         }
         if ($filedname && $valuelist) {
             C::t('forum_optionvalue')->insert($sortid, "({$filedname}, tid, fid) VALUES ({$valuelist}, '{$tid}', '{$_G['fid']}')");
         }
     }
     if ($_G['group']['allowat']) {
         $atlist = $atlist_tmp = array();
         preg_match_all("/@([^\r\n]*?)\\s/i", $message . ' ', $atlist_tmp);
         $atlist_tmp = array_slice(array_unique($atlist_tmp[1]), 0, $_G['group']['allowat']);
         if (!empty($atlist_tmp)) {
             if (empty($_G['setting']['at_anyone'])) {
                 foreach (C::t('home_follow')->fetch_all_by_uid_fusername($_G['uid'], $atlist_tmp) as $row) {
                     $atlist[$row['followuid']] = $row['fusername'];
                 }
                 if (count($atlist) < $_G['group']['allowat']) {
                     $query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $atlist_tmp);
                     foreach ($query as $row) {
                         $atlist[$row['fuid']] = $row['fusername'];
                     }
                 }
             } else {
                 foreach (C::t('common_member')->fetch_all_by_username($atlist_tmp) as $row) {
                     $atlist[$row['uid']] = $row['username'];
                 }
             }
         }
         if ($atlist) {
             foreach ($atlist as $atuid => $atusername) {
                 $atsearch[] = "/@" . str_replace('/', '\\/', preg_quote($atusername)) . " /i";
                 $atreplace[] = "[url=home.php?mod=space&uid={$atuid}]@{$atusername}[/url] ";
             }
             $message = preg_replace($atsearch, $atreplace, $message . ' ', 1);
         }
     }
     $bbcodeoff = checkbbcodes($message, !empty($_GET['bbcodeoff']));
     $smileyoff = checksmilies($message, !empty($_GET['smileyoff']));
     $parseurloff = !empty($_GET['parseurloff']);
     $htmlon = $_G['group']['allowhtml'] && !empty($_GET['htmlon']) ? 1 : 0;
     $usesig = !empty($_GET['usesig']) && $_G['group']['maxsigsize'] ? 1 : 0;
     $class_tag = new tag();
     $tagstr = $class_tag->add_tag($_GET['tags'], $tid, 'tid');
     /* if($_G['group']['allowreplycredit']) {
         if($replycredit > 0 && $replycredit_real > 0) {
        updatemembercount($_G['uid'], array('extcredits'.$_G['setting']['creditstransextra'][10] => -$replycredit_real), 1, 'RCT', $tid);
        $insertdata = array(
                'tid' => $tid,
                'extcredits' => $_GET['replycredit_extcredits'],
                'extcreditstype' => $_G['setting']['creditstransextra'][10],
                'times' => $_GET['replycredit_times'],
                'membertimes' => $_GET['replycredit_membertimes'],
                'random' => $_GET['replycredit_random']
        );
        C::t('forum_replycredit')->insert($insertdata);
        }
        } */
     if ($_G['group']['allowpostrushreply'] && $_GET['rushreply']) {
         $rushdata = array('tid' => $tid, 'stopfloor' => $_GET['stopfloor'], 'starttimefrom' => $_GET['rushreplyfrom'], 'starttimeto' => $_GET['rushreplyto'], 'rewardfloor' => $_GET['rewardfloor'], 'creditlimit' => $_GET['creditlimit']);
         C::t('forum_threadrush')->insert($rushdata);
     }
     $pinvisible = $modnewthreads ? -2 : (empty($_GET['save']) ? 0 : -3);
     $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message);
     $pid = insertpost(array('fid' => $_G['fid'], 'tid' => $tid, 'first' => '1', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => $pinvisible, 'anonymous' => $isanonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'tags' => $tagstr, 'replycredit' => 0, 'status' => (defined('IN_MOBILE') ? 8 : 0) | $postStatus));
     if ($_G['group']['allowat'] && $atlist) {
         foreach ($atlist as $atuid => $atusername) {
             notification_add($atuid, 'at', 'at_message', array('from_id' => $tid, 'from_idtype' => 'at', 'buyerid' => $_G['uid'], 'buyer' => $_G['username'], 'tid' => $tid, 'subject' => $subject, 'pid' => $pid, 'message' => messagecutstr($message, 150)));
         }
         set_atlist_cookie(array_keys($atlist));
     }
     $threadimageaid = 0;
     $threadimage = array();
     if ($special == 4 && $_GET['activityaid']) {
         $threadimageaid = $_GET['activityaid'];
         convertunusedattach($_GET['activityaid'], $tid, $pid);
     }
     if ($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata']) && $sortaids) {
         foreach ($sortaids as $sortaid) {
             convertunusedattach($sortaid, $tid, $pid);
         }
     }
     if (($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_GET['attachnew'] || $sortid || !empty($_GET['activityaid']))) {
         updateattach($displayorder == -4 || $modnewthreads, $tid, $pid, $_GET['attachnew']);
         if (!$threadimageaid) {
             $threadimage = C::t('forum_attachment_n')->fetch_max_image('tid:' . $tid, 'tid', $tid);
             $threadimageaid = $threadimage['aid'];
         }
     }
     $values = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid, 'coverimg' => '', 'sechash' => !empty($_GET['sechash']) ? $_GET['sechash'] : '');
     $param = array();
     Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php');
     if ($_G['forum']['picstyle']) {
         if (!mobcent_setthreadcover($pid, 0, $threadimageaid)) {
             preg_match_all("/(\\[img\\]|\\[img=\\d{1,4}[x|\\,]\\d{1,4}\\])\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", $message, $imglist, PREG_SET_ORDER);
             $values['coverimg'] = "<p id=\"showsetcover\">" . lang('message', 'post_newthread_set_cover') . "<span id=\"setcoverwait\"></span></p><script>if(\$('forward_a')){\$('forward_a').style.display='none';setTimeout(\"\$('forward_a').style.display=''\", 5000);};ajaxget('forum.php?mod=ajax&action=setthreadcover&tid={$tid}&pid={$pid}&fid={$_G['fid']}&imgurl={$imglist[0][2]}&newthread=1', 'showsetcover', 'setcoverwait')</script>";
             $param['clean_msgforward'] = 1;
             $param['timeout'] = $param['refreshtime'] = 15;
         }
     }
     if ($threadimageaid) {
         if (!$threadimage) {
             $threadimage = C::t('forum_attachment_n')->fetch('tid:' . $tid, $threadimageaid);
         }
         $threadimage = daddslashes($threadimage);
         C::t('forum_threadimage')->insert(array('tid' => $tid, 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote']));
     }
     $statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread');
     include_once libfile('function/stat');
     updatestat($isgroup ? 'groupthread' : $statarr[$special]);
     if ($modnewthreads) {
         updatemoderate('tid', $tid);
         C::t('forum_forum')->update_forum_counter($_G['fid'], 0, 0, 1);
         manage_addnotify('verifythread');
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_newthread_mod_succeed', array('noError' => 1));
         //showmessage('post_newthread_mod_succeed', $returnurl, $values, $param);
     } else {
         if ($displayorder >= 0 && helper_access::check_module('follow') && !empty($_GET['adddynamic']) && !$isanonymous) {
             require_once libfile('function/discuzcode');
             require_once libfile('function/followcode');
             $feedcontent = array('tid' => $tid, 'content' => followcode($message, $tid, $pid, 1000));
             C::t('forum_threadpreview')->insert($feedcontent);
             C::t('forum_thread')->update_status_by_tid($tid, '512');
             $followfeed = array('uid' => $_G['uid'], 'username' => $_G['username'], 'tid' => $tid, 'note' => '', 'dateline' => TIMESTAMP);
             $values['feedid'] = C::t('home_follow_feed')->insert($followfeed, true);
             C::t('common_member_count')->increase($_G['uid'], array('feeds' => 1));
         }
         $feed = array('icon' => '', 'title_template' => '', 'title_data' => array(), 'body_template' => '', 'body_data' => array(), 'title_data' => array(), 'images' => array());
         if ($displayorder != -4) {
             if ($digest) {
                 updatepostcredits('+', $_G['uid'], 'digest', $_G['fid']);
             }
             //updatepostcredits('+',  $_G['uid'], 'post', $_G['fid']);
             Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php');
             //Yii::import('application.components.discuz.source.function.function_post', true);
             mobcent_updatepostcredits('+', $_G['uid'], 'post', $_G['fid']);
             if ($isgroup) {
                 C::t('forum_groupuser')->update_counter_for_user($_G['uid'], $_G['fid'], 1);
             }
             $subject = str_replace("\t", ' ', $subject);
             $lastpost = "{$tid}\t" . $subject . "\t{$_G['timestamp']}\t{$author}";
             C::t('forum_forum')->update($_G['fid'], array('lastpost' => $lastpost));
             C::t('forum_forum')->update_forum_counter($_G['fid'], 1, 1, 1);
             if ($_G['forum']['type'] == 'sub') {
                 C::t('forum_forum')->update($_G['forum']['fup'], array('lastpost' => $lastpost));
             }
         }
         if ($_G['forum']['status'] == 3) {
             C::t('forum_forumfield')->update($_G['fid'], array('lastupdate' => TIMESTAMP));
             require_once libfile('function/grouplog');
             updategroupcreditlog($_G['fid'], $_G['uid']);
         }
         /*如果显示地理位置,入库到表里*/
         if ($jsonInfo['isShowPostion']) {
             $data = DB::query('INSERT INTO  %t VALUES(null,%f,%f,%d,%d,%s)', array('home_surrounding_user', $jsonInfo['longitude'], $jsonInfo['latitude'], $tid, 3, (string) $jsonInfo['location']));
         }
         /*  //客户端发表主题积分入库
                $temp = DB::fetch_first('SELECT extcredits3  FROM '.DB::table('common_credit_rule').' WHERE rid =%d ',array(1));
                $extcredits3 = DB::fetch_first('SELECT extcredits3 FROM '.DB::table('common_member_count').' WHERE uid = %d',array($_G['uid']));
                $temp = $extcredits3['extcredits3'] + $temp['extcredits3'];
                DB::query('UPDATE '.DB::table('common_member_count').' set extcredits3 = %d WHERE uid = %d',array($temp,$_G['uid']));
             */
         //showmessage('post_newthread_succeed', $returnurl, $values, $param);
         // return array('rs'=>1,'errcode'=>WebUtils::t('发贴成功'));
         return $this->makeErrorInfo($res, 'mobcent_post_newthread_success', array('noError' => 1));
     }
 }
function threadpubsave($tid, $passapproval = false)
{
    global $_G;
    if ($_G['setting']['plugins']['func'][HOOKTYPE]['threadpubsave']) {
        $hookparam = func_get_args();
        hookscript('threadpubsave', 'global', 'funcs', array('param' => $hookparam, 'step' => 'check'), 'threadpubsave');
    }
    $thread = C::t('forum_thread')->fetch_by_tid_displayorder($tid, -4, '=', !$passapproval ? $_G['uid'] : null);
    if (!$thread) {
        return 0;
    }
    $threadpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid);
    $thread['message'] = $threadpost['message'];
    $modworksql = 0;
    $displayorder = 0;
    $dateline = $_G['timestamp'];
    $moderatepids = $saveposts = array();
    $return = 1;
    list($modnewthreads) = threadmodstatus($thread['subject'] . "\t" . $thread['message']);
    if ($modnewthreads && $passapproval === false) {
        updatemoderate('tid', $tid);
        manage_addnotify('verifythread');
        $displayorder = -2;
        $modworksql = 1;
        $return = -1;
    } else {
        C::t('forum_post')->update_by_tid('tid:' . $tid, $tid, array('dateline' => $dateline, 'invisible' => '0'), false, false, 1);
    }
    C::t('forum_thread')->update($tid, array('displayorder' => $displayorder, 'dateline' => $_G['timestamp'], 'lastpost' => $_G['timestamp']));
    $posts = $thread['replies'] + 1;
    if ($thread['replies']) {
        $saveposts = C::t('forum_post')->fetch_all_by_tid('tid:' . $tid, $tid, true, '', 0, 0, 0);
        foreach ($saveposts as $post) {
            $dateline++;
            $invisible = 0;
            list(, $modnewreplies) = threadmodstatus($post['subject'] . "\t" . $post['message']);
            if ($modnewreplies) {
                $moderatepids[] = $post['pid'];
                $verifypost = true;
                $invisible = -2;
                $modworksql = 1;
                $return = -2;
            }
            C::t('forum_post')->update('tid:' . $tid, $post['pid'], array('dateline' => $dateline, 'invisible' => $invisible));
            updatepostcredits('+', $thread['authorid'], 'reply', $thread['fid']);
        }
    }
    if ($moderatepids) {
        updatemoderate('pid', $moderatepids);
        manage_addnotify('verifypost');
    }
    updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
    $attachcount = C::t('forum_attachment_n')->count_by_id('tid:' . $thread['tid'], 'tid', $thread['tid']);
    updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']);
    if ($_G['forum']['status'] == 3) {
        C::t('forum_groupuser')->update_counter_for_user($thread['authorid'], $thread['fid'], 1);
    }
    $subject = str_replace("\t", ' ', $thread['subject']);
    $lastpost = $thread['tid'] . "\t" . $subject . "\t" . $thread['lastpost'] . "\t" . $thread['lastposter'];
    C::t('forum_forum')->update($_G['fid'], array('lastpost' => $lastpost));
    C::t('forum_forum')->update_forum_counter($thread['fid'], 1, $posts, $posts, $modworksql);
    if ($_G['forum']['type'] == 'sub') {
        C::t('forum_forum')->update($_G['forum']['fup'], array('lastpost' => $lastpost));
    }
    if ($_G['setting']['plugins']['func'][HOOKTYPE]['threadpubsave']) {
        hookscript('threadpubsave', 'global', 'funcs', array('param' => $hookparam, 'step' => 'save', 'posts' => $saveposts), 'threadpubsave');
    }
    return $return;
}
Beispiel #23
0
function pic_save($FILE, $albumid, $title, $iswatermark = true, $catid = 0)
{
    global $_G, $space;
    if ($albumid < 0) {
        $albumid = 0;
    }
    $allowpictype = array('jpg', 'jpeg', 'gif', 'png');
    $upload = new discuz_upload();
    $upload->init($FILE, 'album');
    if ($upload->error()) {
        return lang('spacecp', 'lack_of_access_to_upload_file_size');
    }
    if (!$upload->attach['isimage']) {
        return lang('spacecp', 'only_allows_upload_file_types');
    }
    $oldgid = $_G['groupid'];
    if (empty($space)) {
        $_G['member'] = $space = getuserbyuid($_G['uid']);
        $_G['username'] = $space['username'];
        $_G['groupid'] = $space['groupid'];
    }
    $_G['member'] = $space;
    loadcache('usergroup_' . $space['groupid'], $oldgid != $_G['groupid'] ? true : false);
    $_G['group'] = $_G['cache']['usergroup_' . $space['groupid']];
    if (!checkperm('allowupload')) {
        return lang('spacecp', 'not_allow_upload');
    }
    if (!cknewuser(1)) {
        if ($_G['setting']['newbiespan'] && $_G['timestamp'] - $_G['member']['regdate'] < $_G['setting']['newbiespan'] * 60) {
            return lang('message', 'no_privilege_newbiespan', array('newbiespan' => $_G['setting']['newbiespan']));
        }
        if ($_G['setting']['need_avatar'] && empty($_G['member']['avatarstatus'])) {
            return lang('message', 'no_privilege_avatar');
        }
        if ($_G['setting']['need_email'] && empty($_G['member']['emailstatus'])) {
            return lang('message', 'no_privilege_email');
        }
        if ($_G['setting']['need_friendnum']) {
            space_merge($_G['member'], 'count');
            if ($_G['member']['friends'] < $_G['setting']['need_friendnum']) {
                return lang('message', 'no_privilege_friendnum', array('friendnum' => $_G['setting']['need_friendnum']));
            }
        }
    }
    if ($_G['group']['maximagesize'] && $upload->attach['size'] > $_G['group']['maximagesize']) {
        return lang('spacecp', 'files_can_not_exceed_size', array('extend' => $upload->attach['ext'], 'size' => sizecount($_G['group']['maximagesize'])));
    }
    $maxspacesize = checkperm('maxspacesize');
    if ($maxspacesize) {
        space_merge($space, 'count');
        space_merge($space, 'field_home');
        if ($space['attachsize'] + $upload->attach['size'] > $maxspacesize + $space['addsize'] * 1024 * 1024) {
            return lang('spacecp', 'inadequate_capacity_space');
        }
    }
    $showtip = true;
    $albumfriend = 0;
    if ($albumid) {
        $catid = intval($catid);
        $albumid = album_creat_by_id($albumid, $catid);
    } else {
        $albumid = 0;
        $showtip = false;
    }
    $upload->save();
    if ($upload->error()) {
        return lang('spacecp', 'mobile_picture_temporary_failure');
    }
    if (!$upload->attach['imageinfo'] || !in_array($upload->attach['imageinfo']['2'], array(1, 2, 3, 6))) {
        @unlink($upload->attach['target']);
        return lang('spacecp', 'only_allows_upload_file_types');
    }
    $new_name = $upload->attach['target'];
    require_once libfile('class/image');
    $image = new image();
    $result = $image->Thumb($new_name, '', 140, 140, 1);
    $thumb = empty($result) ? 0 : 1;
    if ($_G['setting']['maxthumbwidth'] && $_G['setting']['maxthumbheight']) {
        if ($_G['setting']['maxthumbwidth'] < 300) {
            $_G['setting']['maxthumbwidth'] = 300;
        }
        if ($_G['setting']['maxthumbheight'] < 300) {
            $_G['setting']['maxthumbheight'] = 300;
        }
        $image->Thumb($new_name, '', $_G['setting']['maxthumbwidth'], $_G['setting']['maxthumbheight'], 1, 1);
    }
    if ($iswatermark) {
        $image->Watermark($new_name, '', 'album');
    }
    $pic_remote = 0;
    $album_picflag = 1;
    if (getglobal('setting/ftp/on')) {
        $ftpresult_thumb = 0;
        $ftpresult = ftpcmd('upload', 'album/' . $upload->attach['attachment']);
        if ($ftpresult) {
            @unlink($_G['setting']['attachdir'] . 'album/' . $upload->attach['attachment']);
            if ($thumb) {
                $thumbpath = getimgthumbname($upload->attach['attachment']);
                ftpcmd('upload', 'album/' . $thumbpath);
                @unlink($_G['setting']['attachdir'] . 'album/' . $thumbpath);
            }
            $pic_remote = 1;
            $album_picflag = 2;
        } else {
            if (getglobal('setting/ftp/mirror')) {
                @unlink($upload->attach['target']);
                @unlink(getimgthumbname($upload->attach['target']));
                return lang('spacecp', 'ftp_upload_file_size');
            }
        }
    }
    $title = getstr($title, 200);
    $title = censor($title);
    if (censormod($title) || $_G['group']['allowuploadmod']) {
        $pic_status = 1;
    } else {
        $pic_status = 0;
    }
    $setarr = array('albumid' => $albumid, 'uid' => $_G['uid'], 'username' => $_G['username'], 'dateline' => $_G['timestamp'], 'filename' => addslashes($upload->attach['name']), 'postip' => $_G['clientip'], 'title' => $title, 'type' => addslashes($upload->attach['ext']), 'size' => $upload->attach['size'], 'filepath' => $upload->attach['attachment'], 'thumb' => $thumb, 'remote' => $pic_remote, 'status' => $pic_status);
    $setarr['picid'] = C::t('home_pic')->insert($setarr, 1);
    C::t('common_member_count')->increase($_G['uid'], array('attachsize' => $upload->attach['size']));
    include_once libfile('function/stat');
    if ($pic_status) {
        updatemoderate('picid', $setarr['picid']);
    }
    updatestat('pic');
    return $setarr;
}
Beispiel #24
0
        showmessage('article_not_exist', dreferer());
    }
    if ($_POST['status'] == '0') {
        C::t('portal_article_title')->update($aid, array('status' => '0'));
        updatemoderate('aid', $aid, 2);
        $tourl = dreferer(fetch_article_url($article));
        showmessage('article_passed', $tourl);
    } elseif ($_POST['status'] == '2') {
        C::t('portal_article_title')->update($aid, array('status' => '2'));
        updatemoderate('aid', $aid, 1);
        $tourl = dreferer(fetch_article_url($article));
        showmessage('article_ignored', $tourl);
    } elseif ($_POST['status'] == '-1') {
        include_once libfile('function/delete');
        deletearticle(array($aid), 0);
        updatemoderate('aid', $aid, 2);
        $tourl = dreferer('portal.php?mod=portalcp&catid=' . $article['catid']);
        showmessage('article_deleted', $tourl);
    } else {
        showmessage('select_operation');
    }
}
if ($op == 'delete') {
    if (!$aid) {
        showmessage('article_edit_nopermission');
    }
    check_articleperm($article['catid'], $aid, $article);
    if (submitcheck('deletesubmit')) {
        include_once libfile('function/delete');
        $article = deletearticle(array(intval($_POST['aid'])), intval($_POST['optype']));
        showmessage('article_delete_success', "portal.php?mod=list&catid={$article[0][catid]}");
Beispiel #25
0
     $threadimage = daddslashes($threadimage);
     DB::insert('forum_threadimage', array('tid' => $tid, 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote']));
 }
 $param = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid);
 $statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread');
 include_once libfile('function/stat');
 updatestat($isgroup ? 'groupthread' : $statarr[$special]);
 dsetcookie('clearUserdata', 'forum');
 if ($specialextra) {
     $classname = 'threadplugin_' . $specialextra;
     if (class_exists($classname) && method_exists($threadpluginclass = new $classname(), 'newthread_submit_end')) {
         $threadpluginclass->newthread_submit_end($_G['fid'], $tid);
     }
 }
 if ($modnewthreads) {
     updatemoderate('tid', $tid);
     DB::query("UPDATE " . DB::table('forum_forum') . " SET todayposts=todayposts+1 WHERE fid='{$_G['fid']}'", 'UNBUFFERED');
     manage_addnotify('verifythread');
     showmessage('post_newthread_mod_succeed', "forum.php?mod=viewthread&tid={$tid}&extra={$extra}", $param);
 } else {
     $feed = array('icon' => '', 'title_template' => '', 'title_data' => array(), 'body_template' => '', 'body_data' => array(), 'title_data' => array(), 'images' => array());
     if (!empty($_G['gp_addfeed']) && $_G['forum']['allowfeed'] && !$isanonymous) {
         $message = !($price || $readperm) ? $message : '';
         if ($special == 0) {
             $feed['icon'] = 'thread';
             $feed['title_template'] = 'feed_thread_title';
             $feed['body_template'] = 'feed_thread_message';
             $feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$subject}</a>", 'message' => messagecutstr($message, 150));
             if (!empty($_G['forum_attachexist'])) {
                 $firstaid = DB::result_first("SELECT aid FROM " . DB::table(getattachtablebytid($tid)) . " WHERE pid='{$pid}' AND dateline>'0' AND isimage='1' ORDER BY dateline LIMIT 1");
                 if ($firstaid) {
 public function newthread($parameters)
 {
     require_once libfile('function/post');
     $this->tid = $this->pid = 0;
     $this->_init_parameters($parameters);
     if (trim($this->param['subject']) == '') {
         return $this->showmessage('post_sm_isnull');
     }
     if (!$this->param['sortid'] && !$this->param['special'] && trim($this->param['message']) == '') {
         return $this->showmessage('post_sm_isnull');
     }
     list($this->param['modnewthreads'], $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
     if ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $this->param['special'] || $this->param['sortid'])) {
         return $this->showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
     }
     if (checkflood()) {
         return $this->showmessage('post_flood_ctrl', '', array('floodctrl' => $this->setting['floodctrl']));
     } elseif (checkmaxperhour('tid')) {
         return $this->showmessage('thread_flood_ctrl_threads_per_hour', '', array('threads_per_hour' => $this->group['maxthreadsperhour']));
     }
     $this->param['save'] = $this->member['uid'] ? $this->param['save'] : 0;
     $this->param['typeid'] = isset($this->param['typeid']) && isset($this->forum['threadtypes']['types'][$this->param['typeid']]) && (!$this->forum['threadtypes']['moderators'][$this->param['typeid']] || $this->forum['ismoderator']) ? $this->param['typeid'] : 0;
     $this->param['displayorder'] = $this->param['modnewthreads'] ? -2 : ($this->forum['ismoderator'] && $this->group['allowstickthread'] && !empty($this->param['sticktopic']) ? 1 : (empty($this->param['save']) ? 0 : -4));
     if ($this->param['displayorder'] == -2) {
         C::t('forum_forum')->update($this->forum['fid'], array('modworks' => '1'));
     }
     $this->param['digest'] = $this->forum['ismoderator'] && $this->group['allowdigestthread'] && !empty($this->param['digest']) ? 1 : 0;
     $this->param['readperm'] = $this->group['allowsetreadperm'] ? $this->param['readperm'] : 0;
     $this->param['isanonymous'] = $this->group['allowanonymous'] && $this->param['isanonymous'] ? 1 : 0;
     $this->param['price'] = intval($this->param['price']);
     if (!$this->param['special']) {
         $this->param['price'] = $this->group['maxprice'] ? $this->param['price'] <= $this->group['maxprice'] ? $this->param['price'] : $this->group['maxprice'] : 0;
     }
     if (!$this->param['typeid'] && $this->forum['threadtypes']['required'] && !$this->param['special']) {
         return $this->showmessage('post_type_isnull');
     }
     if (!$this->param['sortid'] && $this->forum['threadsorts']['required'] && !$this->param['special']) {
         return $this->showmessage('post_sort_isnull');
     }
     if (!$this->param['special'] && $this->param['price'] > 0 && floor($this->param['price'] * (1 - $this->setting['creditstax'])) == 0) {
         return $this->showmessage('post_net_price_iszero');
     }
     $this->param['sortid'] = $this->param['special'] && $this->forum['threadsorts']['types'][$this->param['sortid']] ? 0 : $this->param['sortid'];
     $this->param['typeexpiration'] = intval($this->param['typeexpiration']);
     if ($this->forum['threadsorts']['expiration'][$this->param['typeid']] && !$this->param['typeexpiration']) {
         return $this->showmessage('threadtype_expiration_invalid');
     }
     $author = !$this->param['isanonymous'] ? $this->member['username'] : '';
     $this->param['moderated'] = $this->param['digest'] || $this->param['displayorder'] > 0 ? 1 : 0;
     $this->param['ordertype'] && ($this->param['tstatus'] = setstatus(4, 1, $this->param['tstatus']));
     $this->param['imgcontent'] && ($this->param['tstatus'] = setstatus(15, $this->param['imgcontent'], $this->param['tstatus']));
     $this->param['hiddenreplies'] && ($this->param['tstatus'] = setstatus(2, 1, $this->param['tstatus']));
     $this->param['allownoticeauthor'] && ($this->param['tstatus'] = setstatus(6, 1, $this->param['tstatus']));
     $this->param['isgroup'] = $this->forum['status'] == 3 ? 1 : 0;
     $this->param['publishdate'] = !$this->param['modnewthreads'] ? $this->param['publishdate'] : TIMESTAMP;
     $newthread = array('fid' => $this->forum['fid'], 'posttableid' => 0, 'readperm' => $this->param['readperm'], 'price' => $this->param['price'], 'typeid' => $this->param['typeid'], 'sortid' => $this->param['sortid'], 'author' => $author, 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['publishdate'], 'lastpost' => $this->param['publishdate'], 'lastposter' => $author, 'displayorder' => $this->param['displayorder'], 'digest' => $this->param['digest'], 'special' => $this->param['special'], 'attachment' => 0, 'moderated' => $this->param['moderated'], 'status' => $this->param['tstatus'], 'isgroup' => $this->param['isgroup'], 'replycredit' => $this->param['replycredit'], 'closed' => $this->param['closed'] ? 1 : 0);
     $this->tid = C::t('forum_thread')->insert($newthread, true);
     C::t('forum_newthread')->insert(array('tid' => $this->tid, 'fid' => $this->forum['fid'], 'dateline' => $this->param['publishdate']));
     useractionlog($this->member['uid'], 'tid');
     if (!getuserprofile('threads') && $this->setting['newbie']) {
         C::t('forum_thread')->update($this->tid, array('icon' => $this->setting['newbie']));
     }
     if ($this->param['publishdate'] != TIMESTAMP) {
         $cron_publish_ids = dunserialize($this->cache('cronpublish'));
         $cron_publish_ids[$this->tid] = $this->tid;
         $cron_publish_ids = serialize($cron_publish_ids);
         savecache('cronpublish', $cron_publish_ids);
     }
     if (!$this->param['isanonymous']) {
         C::t('common_member_field_home')->update($this->member['uid'], array('recentnote' => $this->param['subject']));
     }
     if ($this->param['moderated']) {
         updatemodlog($this->tid, $this->param['displayorder'] > 0 ? 'STK' : 'DIG');
         updatemodworks($this->param['displayorder'] > 0 ? 'STK' : 'DIG', 1);
     }
     $this->param['bbcodeoff'] = checkbbcodes($this->param['message'], !empty($this->param['bbcodeoff']));
     $this->param['smileyoff'] = checksmilies($this->param['message'], !empty($this->param['smileyoff']));
     $this->param['parseurloff'] = !empty($this->param['parseurloff']);
     $this->param['htmlon'] = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
     $this->param['usesig'] = !empty($this->param['usesig']) && $this->group['maxsigsize'] ? 1 : 0;
     $class_tag = new tag();
     $this->param['tagstr'] = $class_tag->add_tag($this->param['tags'], $this->tid, 'tid');
     $this->param['pinvisible'] = $this->param['modnewthreads'] ? -2 : (empty($this->param['save']) ? 0 : -3);
     $this->param['message'] = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->param['message']);
     $this->param['pstatus'] = intval($this->param['pstatus']);
     defined('IN_MOBILE') && ($this->param['pstatus'] = setstatus(4, 1, $this->param['pstatus']));
     if ($this->param['imgcontent']) {
         stringtopic($this->param['message'], $this->tid, true, $this->param['imgcontentwidth']);
     }
     $this->pid = insertpost(array('fid' => $this->forum['fid'], 'tid' => $this->tid, 'first' => '1', 'author' => $this->member['username'], 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['publishdate'], 'message' => $this->param['message'], 'useip' => $this->param['clientip'] ? $this->param['clientip'] : getglobal('clientip'), 'port' => $this->param['remoteport'] ? $this->param['remoteport'] : getglobal('remoteport'), 'invisible' => $this->param['pinvisible'], 'anonymous' => $this->param['isanonymous'], 'usesig' => $this->param['usesig'], 'htmlon' => $this->param['htmlon'], 'bbcodeoff' => $this->param['bbcodeoff'], 'smileyoff' => $this->param['smileyoff'], 'parseurloff' => $this->param['parseurloff'], 'attachment' => '0', 'tags' => $this->param['tagstr'], 'replycredit' => 0, 'status' => $this->param['pstatus']));
     $statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread');
     include_once libfile('function/stat');
     updatestat($this->param['isgroup'] ? 'groupthread' : $statarr[$this->param['special']]);
     if ($this->param['geoloc'] && IN_MOBILE == 2) {
         list($mapx, $mapy, $location) = explode('|', $this->param['geoloc']);
         if ($mapx && $mapy && $location) {
             C::t('forum_post_location')->insert(array('pid' => $this->pid, 'tid' => $this->tid, 'uid' => $this->member['uid'], 'mapx' => $mapx, 'mapy' => $mapy, 'location' => $location));
         }
     }
     if ($this->param['modnewthreads']) {
         updatemoderate('tid', $this->tid);
         C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 0, 1);
         manage_addnotify('verifythread');
         return 'post_newthread_mod_succeed';
     } else {
         if ($this->param['displayorder'] != -4) {
             if ($this->param['digest']) {
                 updatepostcredits('+', $this->member['uid'], 'digest', $this->forum['fid']);
             }
             updatepostcredits('+', $this->member['uid'], 'post', $this->forum['fid']);
             if ($this->param['isgroup']) {
                 C::t('forum_groupuser')->update_counter_for_user($this->member['uid'], $this->forum['fid'], 1);
             }
             $subject = str_replace("\t", ' ', $this->param['subject']);
             $lastpost = "{$this->tid}\t" . $subject . "\t" . TIMESTAMP . "\t{$author}";
             C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => $lastpost));
             C::t('forum_forum')->update_forum_counter($this->forum['fid'], 1, 1, 1);
             if ($this->forum['type'] == 'sub') {
                 C::t('forum_forum')->update($this->forum['fup'], array('lastpost' => $lastpost));
             }
         }
         if ($this->param['isgroup']) {
             C::t('forum_forumfield')->update($this->forum['fid'], array('lastupdate' => TIMESTAMP));
             require_once libfile('function/grouplog');
             updategroupcreditlog($this->forum['fid'], $this->member['uid']);
         }
         C::t('forum_sofa')->insert(array('tid' => $this->tid, 'fid' => $this->forum['fid']));
         return 'post_newthread_succeed';
     }
 }
Beispiel #27
0
function pick_blog_post($POST, $olds = array())
{
    global $_G, $space;
    $__G = $_G;
    $_G['uid'] = $POST['uid'];
    $_G['username'] = addslashes($POST['username']);
    $POST['subject'] = getstr(trim($POST['subject']), 80, 1, 1);
    //$POST['subject'] = addslashes($POST['subject']);
    if (strlen($POST['subject']) < 1) {
        $POST['subject'] = dgmdate($POST['public_time'], 'Y-m-d');
    }
    $POST['friend'] = intval($POST['friend']);
    $POST['target_ids'] = '';
    if ($POST['friend'] == 2) {
        $uids = array();
        $names = empty($_GET['target_names']) ? array() : explode(',', preg_replace("/(\\s+)/s", ',', $_GET['target_names']));
        if ($names) {
            $query = DB::query("SELECT uid FROM " . DB::table('common_member') . " WHERE username IN (" . dimplode($names) . ")");
            while ($value = DB::fetch($query)) {
                $uids[] = $value['uid'];
            }
        }
        if (empty($uids)) {
            $POST['friend'] = 3;
        } else {
            $POST['target_ids'] = implode(',', $uids);
        }
    } elseif ($POST['friend'] == 4) {
        $POST['password'] = trim($POST['password']);
        if ($POST['password'] == '') {
            $POST['friend'] = 0;
        }
    }
    if ($POST['friend'] !== 2) {
        $POST['target_ids'] = '';
    }
    if ($POST['friend'] !== 4) {
        $POST['password'] == '';
    }
    $POST['tag'] = dhtmlspecialchars(trim($POST['article_tag']));
    $POST['tag'] = getstr($POST['tag'], 500, 1, 1);
    $POST['tag'] = censor($POST['tag']);
    if ($_G['mobile']) {
        $POST['message'] = getstr($POST['message'], 0, 1, 0, 1);
        $POST['message'] = censor($POST['message']);
    } else {
        $POST['message'] = checkhtml($POST['message']);
        $POST['message'] = getstr($POST['message'], 0, 1, 0, 0, 1);
        //$POST['message'] = addslashes($POST['message']);
        $POST['message'] = preg_replace(array("/\\<div\\>\\<\\/div\\>/i", "/\\<a\\s+href\\=\"([^\\>]+?)\"\\>/i"), array('', '<a href="\\1" target="_blank">'), $POST['message']);
    }
    $message = $POST['message'];
    $blog_status = 0;
    if ($olds['blog_id']) {
        $info = DB::fetch_first("SELECT blogid FROM " . DB::table('home_blog') . " WHERE blogid='" . $olds['blog_id'] . "'");
    }
    if (empty($olds['classid']) || $POST['classid'] != $olds['classid']) {
        if (!empty($POST['classid']) && substr($POST['classid'], 0, 4) == 'new:') {
            $classname = dhtmlspecialchars(trim(substr($POST['classid'], 4)));
            $classname = getstr($classname, 0, 1, 1);
            $classname = censor($classname);
            if (empty($classname)) {
                $classid = 0;
            } else {
                $classid = DB::result(DB::query("SELECT classid FROM " . DB::table('home_class') . " WHERE uid='{$_G['uid']}' AND classname='{$classname}'"));
                if (empty($classid)) {
                    $setarr = array('classname' => $classname, 'uid' => $_G['uid'], 'dateline' => $_G['timestamp']);
                    $classid = DB::insert('home_class', $setarr, 1);
                }
            }
        } else {
            $classid = intval($POST['classid']);
        }
    } else {
        $classid = $olds['classid'];
    }
    if ($classid && empty($classname)) {
        $classname = DB::result(DB::query("SELECT classname FROM " . DB::table('home_class') . " WHERE classid='{$classid}' AND uid='{$_G['uid']}'"));
        if (empty($classname)) {
            $classid = 0;
        }
    }
    $blogarr = array('subject' => $POST['subject'], 'classid' => $classid, 'viewnum' => $POST['view_num'], 'friend' => $POST['friend'], 'password' => $POST['password'], 'noreply' => empty($POST['noreply']) ? 0 : 1, 'catid' => intval($POST['catid']), 'status' => $blog_status);
    $titlepic = '';
    $ckmessage = preg_replace("/(\\<div\\>|\\<\\/div\\>|\\s|\\&nbsp\\;|\\<br\\>|\\<p\\>|\\<\\/p\\>)+/is", '', $message);
    if (empty($ckmessage)) {
        return false;
    }
    $message = addslashes($message);
    if (checkperm('manageblog')) {
        $blogarr['hot'] = intval($POST['hot']);
    }
    if ($blogarr['catid']) {
        DB::query("UPDATE " . DB::table('home_blog_category') . " SET num=num+1 WHERE catid='{$blogarr['catid']}'");
    }
    $blogarr['uid'] = $_G['uid'];
    $blogarr['username'] = $_G['username'];
    $blogarr['dateline'] = empty($POST['public_time']) ? $_G['timestamp'] : $POST['public_time'];
    if ($info['blogid']) {
        DB::update('home_blog', $blogarr, array('blogid' => $info['blogid']));
        $blogid = $info['blogid'];
    } else {
        $blogid = DB::insert('home_blog', $blogarr, 1);
    }
    DB::update('common_member_status', array('lastpost' => $POST['public_time']), array('uid' => $_G['uid']));
    DB::update('common_member_field_home', array('recentnote' => $POST['subject']), array('uid' => $_G['uid']));
    $blogarr['blogid'] = $blogid;
    if (function_exists('modblogtag')) {
        $POST['tag'] = $olds ? modblogtag($POST['tag'], $blogid) : addblogtag($POST['tag'], $blogid);
    } else {
        $class_tag = new tag();
        $POST['tag'] = $olds ? $class_tag->update_field($POST['tag'], $blogid, 'blogid') : $class_tag->add_tag($POST['tag'], $blogid, 'blogid');
    }
    $fieldarr = array('message' => $message, 'postip' => $_G['clientip'], 'target_ids' => $POST['target_ids'], 'tag' => $POST['tag']);
    if (!empty($titlepic)) {
        $fieldarr['pic'] = $titlepic;
    }
    $fieldarr['blogid'] = $blogid;
    $fieldarr['uid'] = $blogarr['uid'];
    if ($info['blogid']) {
        DB::update('home_blogfield', $fieldarr, array('blogid' => $info['blogid']));
    } else {
        DB::query("UPDATE " . DB::table('common_member_count') . " SET blogs=blogs+1 WHERE uid='{$fieldarr['uid']}'");
        //更新数
        DB::insert('home_blogfield', $fieldarr);
    }
    if ($isself && !$olds && $blog_status == 0) {
        updatecreditbyaction('publishblog', 0, array('blogs' => 1));
        include_once libfile('function/stat');
        updatestat('blog');
    }
    if ($POST['makefeed'] && $blog_status == 0) {
        include_once libfile('function/feed');
        feed_publish($blogid, 'blogid', $olds ? 0 : 1);
    }
    if (!empty($__G)) {
        $_G = $__G;
    }
    if ($blog_status == 1) {
        updatemoderate('blogid', $blogid);
        manage_addnotify('verifyblog');
    }
    return $blogarr;
}