m_galbum.php文件部分代码:
} elseif ($a == 'upload') {
if (!$ifadmin && !$colony['ifFullMember']) {
Showmsg('colony_cnmenber');
}
banUser();
S::gp(array('aid', 'job'));
$tmpActionUrl .= '&a=upload' . ($job ? '&job=' . $job : '') . '&aid=' . $aid;
if (empty($_POST['step'])) {
$extra_url = $options = '';
$count = $db->get_value("SELECT COUNT(*) AS count FROM pw_cnalbum WHERE atype='1' AND ownerid=" . S::sqlEscape($cyid));
if (empty($count) && $ifadmin) {
$db->update("INSERT INTO pw_cnalbum SET " . S::sqlSingle(array(
'aname' => '默认相册', 'aintro' => '',
'atype' => 1, 'private' => 0,
'ownerid' => $cyid, 'owner' => $colony['cname'],
'lasttime' => $timestamp, 'crtime' => $timestamp,
'memopen' => 1
)));
//* $db->update("UPDATE pw_colonys SET albumnum=albumnum+1 WHERE id=" . S::sqlEscape($cyid));
pwQuery::update('pw_colonys', 'id=:id', array($cyid), null, array(PW_EXPR=>array('albumnum=albumnum+1')));
}
$query = $db->query("SELECT aid,aname,memopen FROM pw_cnalbum WHERE atype='1' AND ownerid=" . S::sqlEscape($cyid) . ' ORDER BY aid DESC');
while ($rt = $db->fetch_array($query)) {
if ($ifadmin || ($colony['ifFullMember'] && $rt['memopen'] == 1)) {
$memopen = 1;
} else {
$memopen = 0;
}
if ($memopen == 1) {
$options .= "<option value=\"$rt[aid]\"" . (($aid && $rt['aid'] == $aid) ? ' selected' : '') . ">$rt[aname]</option>";
}
}
!empty($options) && $uploadAvailable = true;
//(empty($options)) && $options="<option value=\"38\">默认分类</option>";
$aid && $extra_url = '&aid=' . $aid;
list($isheader,$isfooter,$tplname,$isleft) = array(false,true,"m_galbum",true);
} else {
S::gp(array('pintro'),'P');
!$aid && Showmsg('colony_albumclass');
PostCheck(1,$o_photos_gdcheck,$o_photos_qcheck && $db_question);
empty($pintro) && $pintro = array();
require_once(R_P.'require/bbscode.php');
$wordsfb = L::loadClass('FilterUtil', 'filter');
foreach ($pintro as $k => $v) {
if (($banword = $wordsfb->comprise($v)) !== false) {
Showmsg('content_wordsfb');
}
}
$rt = $db->get_one("SELECT aname,photonum,ownerid,lastphoto,memopen,private FROM pw_cnalbum WHERE atype='1' AND aid=" . S::sqlEscape($aid));
if (empty($rt)) {
Showmsg('undefined_action');
} elseif ($cyid <> $rt['ownerid']) {
Showmsg('colony_phototype');
} elseif ($rt['memopen']==0 && !$ifadmin) {
Showmsg('colony_album_memopen');
}
$groupRight['maxphotonum'] && $rt['photonum'] >= $groupRight['maxphotonum'] && Showmsg('colony_photofull');
L::loadClass('photoupload', 'upload', false);
if ($groupRight['maxphotonum'] && $rt['photonum'] + PwUpload::getUploadNum() > $groupRight['maxphotonum']) {
$uploadlimit = $groupRight['maxphotonum'] - $rt['photonum'];
$uploadlimit = $uploadlimit > 0 ? $uploadlimit : 0;
Showmsg('uploadphoto_leave');
}
$img = new PhotoUpload($aid);
PwUpload::upload($img);
pwFtpClose($ftp);
if (!$photos = $img->getAttachs()) {
Showmsg('colony_uploadnull');
}
$photoNum = count($photos);
$pid = $img->getNewID();
$lastpid = getLastPid($aid, 4);
array_unshift($lastpid, $pid);
$db->update("UPDATE pw_cnalbum SET photonum=photonum+" . S::sqlEscape($photoNum) . ",lasttime=" . S::sqlEscape($timestamp) . ',lastpid=' . S::sqlEscape(implode(',',$lastpid)) . (!$rt['lastphoto'] ? ',lastphoto='.S::sqlEscape($img->getLastPhoto()) : '') . " WHERE aid=" . S::sqlEscape($aid));
//countPosts("+$photoNum");
require_once(R_P.'apps/groups/lib/group.class.php');
$colony = getGroupByCyid($cyid);
//* $db->update("UPDATE pw_colonys SET photonum=photonum+" . S::sqlEscape($photoNum) . " WHERE id=" . S::sqlEscape($cyid));
$db->update(pwQuery::buildClause("UPDATE :pw_table SET photonum=photonum+:photonum WHERE id=:id", array('pw_colonys', $photoNum, $cyid)));
$colony['photonum']+=$photoNum;
updateGroupLevel($colony['id'], $colony);
if(!$rt['private']){
$weiboPhotos = array();
$tmpid = $pid;
foreach ($photos as $value) {
$value['pid'] = $tmpid;
$tmpid++;
$weiboPhotos[] = $value;
}
$weiboService = L::loadClass('weibo','sns');/* @var $weiboService PW_Weibo */
$objId = count($photos) > 1 ? 0 : $pid;
$weiboExtra = array(
'cyid' => $cyid,
'aid' => $aid,
'photos'=> $weiboPhotos,
'cname' => $colony['cname'],
'aname' => $rt['aname'],
);
$weiboService->send($winduid,'','group_photos',$objId,$weiboExtra);
}
//积分变动
require_once(R_P.'require/credit.php');
$creditset = getCreditset($o_groups_creditset['Uploadphoto']);
$creditset = array_diff($creditset,array(0));
if (!empty($creditset)) {
$credit->sets($winduid,$creditset,true);
updateMemberid($winduid);
addLog($creditlog,$windid,$winduid,'groups_Uploadphoto');
}
if ($creditlog = $o_groups_creditlog) {
addLog($creditlog['Post'],$windid,$winduid,'groups_Uploadphoto');
}
refreshto("{$basename}a=view&cyid=$cyid&pid=$pid",'operate_success');
}
} elseif ($a == 'selalbum') {