Ejemplo n.º 1
0
	public function __construct($tid = null, $pid = null) {
		parent::__construct();
		require_once libfile('function/post');
		require_once libfile('function/forumlist');
		if($tid) {
			include_once libfile('function/forum');
			loadforum(null, $tid);
			if($pid) {
				$this->post = get_post_by_tid_pid($tid, $pid);
			}
		}
		$this->forum = &$this->app->var['forum'];
		$this->thread = &$this->app->var['thread'];
		$this->group = &$this->app->var['group'];
	}
Ejemplo n.º 2
0
<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: post_editpost.php 33417 2013-06-08 08:25:16Z andyzheng $
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
$orig = get_post_by_tid_pid($_G['tid'], $pid);
$isfirstpost = $orig['first'] ? 1 : 0;
if ($isfirstpost && ($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'])) {
    showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
if ($_G['setting']['magicstatus']) {
    $magiclog = C::t('forum_threadmod')->fetch_by_tid_magicid($_G['tid'], 10);
    $magicid = $magiclog['magicid'];
    $_G['group']['allowanonymous'] = $_G['group']['allowanonymous'] || $magicid ? 1 : $_G['group']['allowanonymous'];
}
$isorigauthor = $_G['uid'] && $_G['uid'] == $orig['authorid'];
$isanonymous = ($_G['group']['allowanonymous'] || $orig['anonymous']) && getgpc('isanonymous') ? 1 : 0;
$audit = $orig['invisible'] == -2 || $thread['displayorder'] == -2 ? $_GET['audit'] : 0;
if (empty($orig)) {
    showmessage('post_nonexistence');
} elseif ((!$_G['forum']['ismoderator'] || !$_G['group']['alloweditpost'] || in_array($orig['adminid'], array(1, 2, 3)) && $_G['adminid'] > $orig['adminid']) && !(($_G['forum']['alloweditpost'] || $orig['invisible'] == -3) && $isorigauthor)) {
    showmessage('post_edit_nopermission', NULL);
} elseif ($isorigauthor && !$_G['forum']['ismoderator'] && $orig['invisible'] != -3) {
    $alloweditpost_status = getstatus($_G['setting']['alloweditpost'], $special + 1);
    if (!$alloweditpost_status && $_G['group']['edittimelimit'] && TIMESTAMP - $orig['dateline'] > $_G['group']['edittimelimit'] * 60) {