Example #1
0
            } else {
                showmessage('message_can_not_send');
            }
        }
    }
} elseif ($_GET['op'] == 'ignore') {
    if (submitcheck('ignoresubmit')) {
        $single = intval($_G['gp_single']);
        if ($single) {
            uc_pm_blackls_add($_G['uid'], $_POST['ignoreuser']);
            showmessage('do_success', dreferer(), array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => 1));
        } else {
            uc_pm_blackls_set($_G['uid'], $_POST['ignorelist']);
            showmessage('do_success', 'home.php?mod=space&do=pm&view=ignore', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => 1));
        }
    }
} else {
    cknewuser();
    if (!checkperm('allowsendpm')) {
        showmessage('no_privilege');
    }
    $friends = array();
    if ($space['friendnum']) {
        $query = DB::query("SELECT fuid AS uid, fusername AS username FROM " . DB::table('home_friend') . " WHERE uid={$_G['uid']} AND status='1' ORDER BY num DESC, dateline DESC LIMIT 0,100");
        while ($value = DB::fetch($query)) {
            $value['username'] = daddslashes($value['username']);
            $friends[] = $value;
        }
    }
}
include_once template("home/spacecp_pm");
Example #2
0
function pic_save($FILE, $albumid, $title, $iswatermark = true)
{
    global $_G, $space;
    if ($albumid < 0) {
        $albumid = 0;
    }
    $allowpictype = array('jpg', 'jpeg', 'gif', 'png');
    require_once libfile('class/upload');
    $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');
    }
    if (empty($space)) {
        $_G['member'] = $space = getspace($_G['uid']);
        $_G['username'] = addslashes($space['username']);
    }
    if (!checkperm('allowupload')) {
        return lang('spacecp', 'not_allow_upload');
    }
    if (!ckrealname('album', 1)) {
        return lang('spacecp', 'not_allow_upload');
    }
    if (!ckvideophoto('album', array(), 1)) {
        return lang('spacecp', 'not_allow_upload');
    }
    if (!cknewuser(1)) {
        return lang('spacecp', 'not_allow_upload');
    }
    $maxspacesize = checkperm('maxspacesize');
    $maxspacesize = $maxspacesize * 1024 * 1024;
    if ($maxspacesize) {
        space_merge($space, 'count');
        space_merge($space, 'field_home');
        if ($space['attachsize'] + $upload->attach['size'] > $maxspacesize + $space['addsize']) {
            return lang('spacecp', 'inadequate_capacity_space');
        }
    }
    $showtip = true;
    $albumfriend = 0;
    if ($albumid) {
        $albumid = album_creat_by_id($albumid);
    } else {
        $albumid = 0;
        $showtip = false;
    }
    $upload->save();
    if ($upload->error()) {
        return lang('spacecp', 'mobile_picture_temporary_failure');
    }
    $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);
    }
    $pic_remote = 0;
    $album_picflag = 1;
    if (getglobal('setting/ftp/on')) {
        $ftpresult_thumb = 0;
        $ftpresult = ftpcmd('upload', 'album/' . $upload->attach['attachment']);
        if ($ftpresult) {
            if ($thumb) {
                ftpcmd('upload', 'album/' . $upload->attach['attachment'] . '.thumb.jpg');
            }
            $pic_remote = 1;
            $album_picflag = 2;
        } else {
            if (getglobal('setting/ftp/mirror')) {
                @unlink($upload->attach['target']);
                @unlink($upload->attach['target'] . '.thumb.jpg');
                return lang('spacecp', 'ftp_upload_file_size');
            }
        }
    }
    $title = getstr($title, 200, 1, 1, 1);
    $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);
    $setarr['picid'] = DB::insert('home_pic', $setarr, 1);
    DB::query("UPDATE " . DB::table('common_member_count') . " SET attachsize=attachsize+{$upload->attach['size']} WHERE uid='{$_G['uid']}'");
    include_once libfile('function/stat');
    updatestat('pic');
    return $setarr;
}
function pic_save($FILE, $albumid, $title, $topicid=0) {
	global $_SGLOBAL, $_SCONFIG, $space, $_SC;

	if($albumid<0) $albumid = 0;
	
	//允许上传类型
	$allowpictype = array('jpg','jpeg','gif','png');

	//检查
	$FILE['size'] = intval($FILE['size']);
	if(empty($FILE['size']) || empty($FILE['tmp_name']) || !empty($FILE['error'])) {
		return cplang('lack_of_access_to_upload_file_size');
	}

	//判断后缀
	$fileext = fileext($FILE['name']);
	if(!in_array($fileext, $allowpictype)) {
		return cplang('only_allows_upload_file_types');
	}

	//获取目录
	if(!$filepath = getfilepath($fileext, true)) {
		return cplang('unable_to_create_upload_directory_server');
	}

	//检查空间大小
	if(empty($space)) {
		$space = getspace($_SGLOBAL['supe_uid']);
	}
	
	//用户组
	if(!checkperm('allowupload')) {
		ckspacelog();
		return cplang('inadequate_capacity_space');
	}
	
	//实名认证
	if(!ckrealname('album', 1)) {
		return cplang('inadequate_capacity_space');
	}
	
	//视频认证
	if(!ckvideophoto('album', array(), 1)) {
		return cplang('inadequate_capacity_space');
	}
	
	//新用户见习
	if(!cknewuser(1)) {
		return cplang('inadequate_capacity_space');
	}

	$maxattachsize = checkperm('maxattachsize');//单位MB
	if($maxattachsize) {//0为不限制
		if($space['attachsize'] + $FILE['size'] > $maxattachsize + $space['addsize']) {
			return cplang('inadequate_capacity_space');
		}
	}

	//相册选择
	$showtip = true;
	$albumfriend = 0;
	if($albumid) {
		preg_match("/^new\:(.+)$/i", $albumid, $matchs);
		if(!empty($matchs[1])) {
			$albumname = shtmlspecialchars(trim($matchs[1]));
			if(empty($albumname)) $albumname = sgmdate('Ymd');
			$albumid = album_creat(array('albumname' => $albumname));
		} else {
			$albumid = intval($albumid);
			if($albumid) {
				$query = $_SGLOBAL['db']->query("SELECT albumname,friend FROM ".tname('album')." WHERE albumid='$albumid' AND uid='$_SGLOBAL[supe_uid]'");
				if($value = $_SGLOBAL['db']->fetch_array($query)) {
					$albumname = addslashes($value['albumname']);
					$albumfriend = $value['friend'];
				} else {
					$albumname = sgmdate('Ymd');
					$albumid = album_creat(array('albumname' => $albumname));
				}
			}
		}
	} else {
		$albumid = 0;
		$showtip = false;
	}

	//本地上传
	$new_name = $_SC['attachdir'].'./'.$filepath;
	$tmp_name = $FILE['tmp_name'];
	if(@copy($tmp_name, $new_name)) {
		@unlink($tmp_name);
	} elseif((function_exists('move_uploaded_file') && @move_uploaded_file($tmp_name, $new_name))) {
	} elseif(@rename($tmp_name, $new_name)) {
	} else {
		return cplang('mobile_picture_temporary_failure');
	}
	
	//检查是否图片
	if(function_exists('getimagesize')) {
		$tmp_imagesize = @getimagesize($new_name);
		list($tmp_width, $tmp_height, $tmp_type) = (array)$tmp_imagesize;
		$tmp_size = $tmp_width * $tmp_height;
		if($tmp_size > 16777216 || $tmp_size < 4 || empty($tmp_type) || strpos($tmp_imagesize['mime'], 'flash') > 0) {
			@unlink($new_name);
			return cplang('only_allows_upload_file_types');
		}
	}

	//缩略图
	include_once(S_ROOT.'./source/function_image.php');
	$thumbpath = makethumb($new_name);
	$thumb = empty($thumbpath)?0:1;

	//是否压缩
	//获取上传后图片大小
	if(@$newfilesize = filesize($new_name)) {
		$FILE['size'] = $newfilesize;
	}

	//水印
	if($_SCONFIG['allowwatermark']) {
		makewatermark($new_name);
	}

	//进行ftp上传
	if($_SCONFIG['allowftp']) {
		include_once(S_ROOT.'./source/function_ftp.php');
		if(ftpupload($new_name, $filepath)) {
			$pic_remote = 1;
			$album_picflag = 2;
		} else {
			@unlink($new_name);
			@unlink($new_name.'.thumb.jpg');
			runlog('ftp', 'Ftp Upload '.$new_name.' failed.');
			return cplang('ftp_upload_file_size');
		}
	} else {
		$pic_remote = 0;
		$album_picflag = 1;
	}
	
	//入库
	$title = getstr($title, 200, 1, 1, 1);

	//入库
	$setarr = array(
		'albumid' => $albumid,
		'uid' => $_SGLOBAL['supe_uid'],
		'username' => $_SGLOBAL['supe_username'],
		'dateline' => $_SGLOBAL['timestamp'],
		'filename' => addslashes($FILE['name']),
		'postip' => getonlineip(),
		'title' => $title,
		'type' => addslashes($FILE['type']),
		'size' => $FILE['size'],
		'filepath' => $filepath,
		'thumb' => $thumb,
		'remote' => $pic_remote,
		'topicid' => $topicid
	);
	$setarr['picid'] = inserttable('pic', $setarr, 1);

	//更新附件大小
	//积分
	$setsql = '';
	if($showtip) {
		$reward = getreward('uploadimage', 0);
		if($reward['credit']) {
			$setsql = ",credit=credit+$reward[credit]";
		}
		if($reward['experience']) {
			$setsql .= ",experience=experience+$reward[experience]";
		}
	}
	$_SGLOBAL['db']->query("UPDATE ".tname('space')." SET attachsize=attachsize+'$FILE[size]', updatetime='$_SGLOBAL[timestamp]' $setsql WHERE uid='$_SGLOBAL[supe_uid]'");

	//相册更新
	if($albumid) {
		$file = $filepath.($thumb?'.thumb.jpg':'');
		$_SGLOBAL['db']->query("UPDATE ".tname('album')."
			SET picnum=picnum+1, updatetime='$_SGLOBAL[timestamp]', pic='$file', picflag='$album_picflag'
			WHERE albumid='$albumid'");
	}
	
	//统计
	updatestat('pic');

	return $setarr;
}
Example #4
0
    }
    if ($oldtidsnew) {
        $query = DB::query("SELECT tid, subject FROM " . DB::table('forum_thread') . " WHERE tid IN (" . dimplode($oldtidsnew) . ")");
        while ($oldthread = DB::fetch($query)) {
            $oldthreads[$oldthread['tid']] = $oldthread['subject'];
        }
    }
}
$_G['group']['allowpost'] = !$_G['forum']['postperm'] && $_G['group']['allowpost'] || $_G['forum']['postperm'] && forumperm($_G['forum']['postperm']) || isset($_G['forum']['allowpost']) && $_G['forum']['allowpost'] == 1 && $_G['group']['allowpost'];
$fastpost = $_G['setting']['fastpost'] && $_G['group']['allowpost'] && !$_G['forum']['allowspecialonly'] && !$_G['forum']['threadsorts']['required'];
$fastpost = $fastpost && !$_G['forum']['allowspecialonly'];
$_G['group']['allowpost'] = isset($_G['forum']['allowpost']) && $_G['forum']['allowpost'] == -1 ? false : $_G['group']['allowpost'];
$_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : '';
$allowpostattach = $fastpost && ($_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || !$_G['forum']['postattachperm'] && $_G['group']['allowpostattach'] || $_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm'])));
if ($fastpost) {
    if (!$_G['adminid'] && (!cknewuser(1) || $_G['setting']['newbiespan'] && (!getuserprofile('lastpost') || TIMESTAMP - getuserprofile('lastpost') < $_G['setting']['newbiespan'] * 60) && TIMESTAMP - $_G['member']['regdate'] < $_G['setting']['newbiespan'] * 60)) {
        $fastpost = false;
    }
    $usesigcheck = $_G['uid'] && $_G['group']['maxsigsize'];
    $seccodecheck = $_G['setting']['seccodestatus'] & 4 && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']);
    $secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']);
}
$showpoll = $showtrade = $showreward = $showactivity = $showdebate = 0;
if ($_G['forum']['allowpostspecial']) {
    $showpoll = $_G['forum']['allowpostspecial'] & 1;
    $showtrade = $_G['forum']['allowpostspecial'] & 2;
    $showreward = isset($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]) && $_G['forum']['allowpostspecial'] & 4;
    $showactivity = $_G['forum']['allowpostspecial'] & 8;
    $showdebate = $_G['forum']['allowpostspecial'] & 16;
}
if ($_G['group']['allowpost']) {
}
if ($_G['forum_thread']['stamp'] >= 0) {
    $_G['forum_threadstamp'] = $_G['cache']['stamps'][$_G['forum_thread']['stamp']];
}
$lastmod = viewthread_lastmod($_G['forum_thread']);
$showsettings = str_pad(decbin($_G['setting']['showsettings']), 3, '0', STR_PAD_LEFT);
$showsignatures = $showsettings[0];
$showavatars = $showsettings[1];
$_G['setting']['showimages'] = $showsettings[2];
$highlightstatus = isset($_GET['highlight']) && str_replace('+', '', $_GET['highlight']) ? 1 : 0;
$_G['forum']['allowreply'] = isset($_G['forum']['allowreply']) ? $_G['forum']['allowreply'] : '';
$_G['forum']['allowpost'] = isset($_G['forum']['allowpost']) ? $_G['forum']['allowpost'] : '';
$allowpostreply = $_G['forum']['allowreply'] != -1 && ($_G['forum_thread']['isgroup'] || !$_G['forum_thread']['closed'] && !checkautoclose($_G['forum_thread']) || $_G['forum']['ismoderator']) && (!$_G['forum']['replyperm'] && $_G['group']['allowreply'] || $_G['forum']['replyperm'] && forumperm($_G['forum']['replyperm']) || $_G['forum']['allowreply']);
$fastpost = $_G['setting']['fastpost'] && !$_G['forum_thread']['archiveid'] && ($_G['forum']['status'] != 3 || $_G['isgroupuser']);
$allowfastpost = $_G['setting']['fastpost'] && $allowpostreply;
if (!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum']) || !$_G['adminid'] && (!cknewuser(1) || $_G['setting']['newbiespan'] && (!getuserprofile('lastpost') || TIMESTAMP - getuserprofile('lastpost') < $_G['setting']['newbiespan'] * 60) && TIMESTAMP - $_G['member']['regdate'] < $_G['setting']['newbiespan'] * 60)) {
    $allowfastpost = false;
}
$_G['group']['allowpost'] = $_G['forum']['allowpost'] != -1 && (!$_G['forum']['postperm'] && $_G['group']['allowpost'] || $_G['forum']['postperm'] && forumperm($_G['forum']['postperm']) || $_G['forum']['allowpost']);
$_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : '';
$allowpostattach = $allowpostreply && ($_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || !$_G['forum']['postattachperm'] && $_G['group']['allowpostattach'] || $_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm'])));
if ($_G['group']['allowpost']) {
    $_G['group']['allowpostpoll'] = $_G['group']['allowpostpoll'] && $_G['forum']['allowpostspecial'] & 1;
    $_G['group']['allowposttrade'] = $_G['group']['allowposttrade'] && $_G['forum']['allowpostspecial'] & 2;
    $_G['group']['allowpostreward'] = $_G['group']['allowpostreward'] && $_G['forum']['allowpostspecial'] & 4 && isset($_G['setting']['extcredits'][$_G['setting']['creditstrans']]);
    $_G['group']['allowpostactivity'] = $_G['group']['allowpostactivity'] && $_G['forum']['allowpostspecial'] & 8;
    $_G['group']['allowpostdebate'] = $_G['group']['allowpostdebate'] && $_G['forum']['allowpostspecial'] & 16;
} else {
    $_G['group']['allowpostpoll'] = $_G['group']['allowposttrade'] = $_G['group']['allowpostreward'] = $_G['group']['allowpostactivity'] = $_G['group']['allowpostdebate'] = FALSE;
}
$_G['forum']['threadplugin'] = $_G['group']['allowpost'] && $_G['setting']['threadplugins'] ? is_array($_G['forum']['threadplugin']) ? $_G['forum']['threadplugin'] : dunserialize($_G['forum']['threadplugin']) : array();
Example #6
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;
}
Example #7
0
         exit;
     }
 } else {
     if (!checkperm('allowdoing')) {
         $add_tracking = 0;
     }
     //实名
     if (!ckrealname('doing', 1)) {
         $add_tracking = 0;
     }
     //视频
     if (!ckvideophoto('doing', array(), 1)) {
         $add_tracking = 0;
     }
     //新用户
     if (!cknewuser(1)) {
         $add_tracking = 0;
     }
     $waittime = interval_check('post');
     if ($waittime > 0) {
         $add_tracking = 0;
     }
 }
 $message = getstr($_POST['message'], 40, 1, 1, 1);
 //替换表情
 $message = preg_replace("/\\{em:(\\d+):}/is", "<img src=\"image/face/\\1.gif\" class=\"face\">", $message);
 $message = preg_replace("/\\<br.*?\\>/is", ' ', $message);
 if (strlen($message) < 1) {
     echo 'should_write_that';
     exit;
 }
Example #8
0
function video_save($FILE, $title, $desc, $tovideoid = 0, $albumid)
{
    global $_SGLOBAL, $_SCONFIG, $space, $_SC;
    //允许上传类型
    $allowpictype = array('flv');
    //检查
    $FILE['size'] = intval($FILE['size']);
    if (empty($FILE['size']) || empty($FILE['tmp_name']) || !empty($FILE['error'])) {
        return cplang('lack_of_access_to_upload_file_size');
    }
    //判断后缀
    $fileext = fileext($FILE['name']);
    if (!in_array($fileext, $allowpictype)) {
        return cplang('only_allows_upload_file_types');
    }
    //获取目录
    if (!($filepath = getfilepath($fileext, true))) {
        return cplang('unable_to_create_upload_directory_server');
    }
    //检查空间大小
    if (empty($space)) {
        $space = getspace($_SGLOBAL['supe_uid']);
    }
    //用户组
    if (!checkperm('allowupload')) {
        ckspacelog();
        return cplang('inadequate_capacity_space');
    }
    //实名认证
    if (!ckrealname('album', 1)) {
        return cplang('inadequate_capacity_space');
    }
    //视频认证
    if (!ckvideophoto('album', array(), 1)) {
        return cplang('inadequate_capacity_space');
    }
    //新用户见习
    if (!cknewuser(1)) {
        return cplang('inadequate_capacity_space');
    }
    $maxattachsize = checkperm('maxattachsize');
    //单位MB
    if ($maxattachsize) {
        //0为不限制
        if ($space['attachsize'] + $FILE['size'] > $maxattachsize + $space['addsize']) {
            return cplang('inadequate_capacity_space');
        }
    }
    if ($albumid < 0) {
        $albumid = 0;
    }
    $showtip = true;
    $albumfriend = 0;
    if ($albumid) {
        preg_match("/^new\\:(.+)\$/i", $albumid, $matchs);
        if (!empty($matchs[1])) {
            $albumname = shtmlspecialchars(trim($matchs[1]));
            if (empty($albumname)) {
                $albumname = sgmdate('Ymd');
            }
            $albumid = album_creat(array('albumname' => $albumname));
        } else {
            $albumid = intval($albumid);
            if ($albumid) {
                $query = $_SGLOBAL['db']->query("SELECT albumname,friend FROM " . tname('album') . " WHERE albumid='{$albumid}' AND uid='{$_SGLOBAL['supe_uid']}'");
                if ($value = $_SGLOBAL['db']->fetch_array($query)) {
                    $albumname = addslashes($value['albumname']);
                    $albumfriend = $value['friend'];
                } else {
                    $albumname = sgmdate('Ymd');
                    $albumid = album_creat(array('albumname' => $albumname));
                }
            }
        }
    } else {
        $albumid = 0;
        $showtip = false;
    }
    //本地上传
    $new_name = $_SC['attachdir'] . './' . $filepath;
    $tmp_name = $FILE['tmp_name'];
    if (@copy($tmp_name, $new_name)) {
        @unlink($tmp_name);
    } elseif (function_exists('move_uploaded_file') && @move_uploaded_file($tmp_name, $new_name)) {
    } elseif (@rename($tmp_name, $new_name)) {
    } else {
        return cplang('mobile_picture_temporary_failure');
    }
    //入库
    $setarr = array('albumid' => $albumid, 'uid' => $_SGLOBAL['supe_uid'], 'username' => $_SGLOBAL['supe_username'], 'dateline' => $_SGLOBAL['timestamp'], 'postip' => getonlineip(), 'filename' => addslashes($FILE['name']), 'title' => $title, 'desc' => $desc, 'size' => $FILE['size'], 'filepath' => $filepath);
    $setarr['id'] = inserttable('video', $setarr, 1);
    $setsql = '';
    if ($showtip) {
        $reward = getreward('uploadimage', 0);
        if ($reward['credit']) {
            $setsql = ",credit=credit+{$reward['credit']}";
        }
        if ($reward['experience']) {
            $setsql .= ",experience=experience+{$reward['experience']}";
        }
    }
    $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET attachsize=attachsize+'{$FILE['size']}', updatetime='{$_SGLOBAL['timestamp']}' {$setsql} WHERE uid='{$_SGLOBAL['supe_uid']}'");
    updatestat('video');
    return $setarr;
}