$ifthumb = 1; } } $path = $savedir . $filename; } else { $path = $rt['path']; $ifthumb = $rt['ifthumb']; } $photos[] = array('aid' => $selaid, 'pintro' => '', 'path' => $path, 'uploader' => $windid, 'uptime' => $timestamp, 'ifthumb' => $ifthumb); $lastphoto = $path; } if ($photos) { $db->update("INSERT INTO pw_cnphoto (aid,pintro,path,uploader,uptime,ifthumb) VALUES " . S::sqlMulti($photos)); $pid = $db->insert_id(); $photoNum = count($photos); $lastpid = getLastPid($selaid, 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)) . (!$selalbum['lastphoto'] ? ',lastphoto=' . S::sqlEscape($lastphoto) : '') . " WHERE aid=" . S::sqlEscape($selaid)); countPosts("+{$photoNum}"); require_once R_P . 'require/functions.php'; 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'); }
if (empty($rt)) { Showmsg('undefined_action'); } elseif ($winduid != $rt['ownerid']) { Showmsg('colony_phototype'); } $o_maxphotonum && $rt['photonum'] >= $o_maxphotonum && Showmsg('colony_photofull'); require_once R_P . 'lib/upload/photoupload.class.php'; $img = new PhotoUpload($aid); PwUpload::upload($img); pwFtpClose($ftp); if (!($photos = $img->getAttachs())) { refreshto("{$basename}a=upload", 'colony_uploadnull'); } $photoNum = count($photos); $pid = $img->getNewID(); $lastpid = getLastPid($aid, 4); array_unshift($lastpid, $pid); if (!$rt['private']) { $feedText = "[url={$db_bbsurl}/{$basename}space=1&a=album&aid={$aid}&u={$winduid}]{$rt[aname]}[/url]\n"; foreach ($photos as $value) { $feedText .= "[url={$db_bbsurl}/{#APPS_BASEURL#}q=photos&space=1&a=view&pid={$pid}&u={$winduid}][img]" . getphotourl($value['path'], $value['ifthumb']) . "[/img][/url] "; } pwAddFeed($winduid, 'photo', $pid, array('num' => $photoNum, 'text' => $feedText)); //会员资讯缓存 $usercache = L::loadDB('Usercache'); $usercachedata = $usercache->get($winduid, 'photos'); $usercachedata = explode(',', $usercachedata['value']); is_array($usercachedata) || ($usercachedata = array()); if (count($usercachedata) >= 4) { array_pop($usercachedata); }
if (!$ifadmin && (!$colony['ifcyer'] || $colony['ifadmin'] == '-1')) { Showmsg('colony_cnmenber'); } define('AJAX', '1'); InitGP(array('pid'), null, 2); $photo = $db->get_one("SELECT cp.uploader,cp.path,ca.aid,ca.lastphoto,ca.lastpid,m.uid FROM pw_cnphoto cp LEFT JOIN pw_cnalbum ca ON cp.aid=ca.aid LEFT JOIN pw_members m ON cp.uploader=m.username WHERE cp.pid=" . pwEscape($pid) . " AND ca.atype='1' AND ca.ownerid=" . pwEscape($cyid)); if (empty($photo) || !$ifadmin && $photo['uploader'] != $windid) { Showmsg('data_error'); } $db->update("DELETE FROM pw_cnphoto WHERE pid=" . pwEscape($pid)); $pwSQL = array(); if ($photo['path'] == $photo['lastphoto']) { $pwSQL['lastphoto'] = $db->get_value("SELECT path FROM pw_cnphoto WHERE aid=" . pwEscape($photo['aid']) . " ORDER BY pid DESC LIMIT 1"); } if (strpos(",{$photo['lastpid']},", ",{$pid},") !== false) { $pwSQL['lastpid'] = implode(',', getLastPid($photo['aid'])); } $upsql = $pwSQL ? ',' . pwSqlSingle($pwSQL) : ''; $db->update("UPDATE pw_cnalbum SET photonum=photonum-1{$upsql} WHERE aid=" . pwEscape($photo['aid'])); pwDelatt($photo['path'], $db_ifftp); $lastpos = strrpos($photo['path'], '/') + 1; pwDelatt(substr($photo['path'], 0, $lastpos) . 's_' . substr($photo['path'], $lastpos), $db_ifftp); pwFtpClose($ftp); $affected_rows = delAppAction('photo', $pid) + 1; countPosts("-{$affected_rows}"); //积分变动 require_once R_P . 'require/credit.php'; $o_groups_creditset = unserialize($o_groups_creditset); $creditset = getCreditset($o_groups_creditset['Deletephoto'], false); $creditset = array_diff($creditset, array(0)); if (!empty($creditset)) {