function transfer() { if (empty($this->flashatt)) { return false; } global $db_enhideset, $db_sellset, $db_ifpwcache, $timestamp; require_once R_P . 'require/functions.php'; $pw_attachs = L::loadDB('attachs', 'forum'); $saveAttach = $this->getSaveAttach($this->uid); $deltmp = array(); $attach = $pw_attachs->gets(array('tid' => 0, 'pid' => 0, 'uid' => $this->uid, 'did' => 0, 'mid' => 0)); foreach ($attach as $rt) { if (!isset($this->flashatt[$rt['aid']])) { pwDelatt($rt['attachurl'], $this->ifftp); $deltmp[] = $rt['aid']; continue; } $saveAttach && $saveAttach->add($rt); $value = $this->flashatt[$rt['aid']]; $rt['descrip'] = $value['desc']; $pw_attachs->updateById($rt['aid'], array('mid' => '1', 'descrip' => $rt['descrip'])); $this->attachs[$rt['aid']] = array('aid' => $rt['aid'], 'name' => $rt['name'], 'type' => $rt['type'], 'attachurl' => $rt['attachurl'], 'size' => $rt['size'], 'hits' => $rt['hits'], 'desc' => str_replace('\\', '', $rt['descrip']), 'ifthumb' => $rt['ifthumb']); $this->fieldDatas[] = array('uid' => $this->uid, 'aid' => $rt['aid'], 'mid' => $this->mid, 'rid' => $this->rid, 'status' => 1); } $saveAttach && $saveAttach->execute(); $deltmp && $pw_attachs->delete($deltmp); return true; }
function transfer() { if (empty($this->flashatt)) { return false; } global $timestamp, $winddb; require_once R_P . 'require/functions.php'; $saveAttach = $this->getSaveAttach($this->uid); $deltmp = array(); $attach = $this->pw_attachs->gets(array('tid' => 0, 'pid' => 0, 'uid' => $this->uid, 'did' => 0, 'mid' => 0)); foreach ($attach as $rt) { if (!isset($this->flashatt[$rt['aid']])) { pwDelatt($rt['attachurl'], $this->ifftp); $deltmp[] = $rt['aid']; continue; } $saveAttach && $saveAttach->add($rt); $value = $this->flashatt[$rt['aid']]; $rt['descrip'] = $value['desc']; $this->attachs[$rt['aid']] = array('aid' => $rt['aid'], 'name' => $rt['name'], 'type' => $rt['type'], 'attachurl' => $rt['attachurl'], 'needrvrc' => 0, 'special' => 0, 'ctype' => '', 'size' => $rt['size'], 'hits' => $rt['hits'], 'desc' => str_replace('\\', '', $rt['descrip']), 'ifthumb' => $rt['ifthumb']); if ($rt['descrip']) { $this->pw_attachs->updateById($rt['aid'], array('descrip' => $rt['descrip'])); } $winddb['uploadnum']++; $winddb['uploadtime'] = $timestamp; $this->ifupload = $rt['type'] == 'img' ? 1 : ($rt['type'] == 'txt' ? 2 : 3); } $saveAttach && $saveAttach->execute(); $deltmp && $this->pw_attachs->delete($deltmp); return true; }
function transfer() { if (empty($this->flashatt)) { return false; } global $timestamp, $winddb; require_once R_P . 'require/functions.php'; $pw_attachs = L::loadDB('attachs', 'forum'); $saveAttach = $this->getSaveAttach($this->uid); $deltmp = array(); $attach = $pw_attachs->gets(array('tid' => 0, 'pid' => 0, 'uid' => $this->uid, 'did' => 0, 'mid' => 0)); foreach ($attach as $rt) { $deltmp[] = $rt['aid']; if (!isset($this->flashatt[$rt['aid']])) { pwDelatt($rt['attachurl'], $this->ifftp); continue; } $saveAttach && $saveAttach->add($rt); $value = $this->flashatt[$rt['aid']]; $rt['descrip'] = $value['desc']; $this->attachs[] = array('id' => $rt['aid'], 'attname' => 'attachment', 'name' => $rt['name'], 'type' => $rt['type'], 'fileuploadurl' => $rt['attachurl'], 'size' => $rt['size'], 'descrip' => str_replace('\\', '', $rt['descrip']), 'ifthumb' => $rt['ifthumb']); $winddb['uploadnum']++; $winddb['uploadtime'] = $timestamp; } $saveAttach && $saveAttach->execute(); $deltmp && $pw_attachs->delete($deltmp); return true; }
function transfer() { if (empty($this->flashatt)) { return false; } require_once R_P . 'require/functions.php'; $saveAttach = $this->getSaveAttach($this->uid); $deltmp = array(); $query = $this->db->query("SELECT * FROM pw_actattachs WHERE actid=0 AND uid=" . S::sqlEscape($this->uid)); while ($rt = $this->db->fetch_array($query)) { if (!isset($this->flashatt[$rt['aid']])) { pwDelatt($rt['attachurl'], $this->ifftp); $deltmp[] = $rt['aid']; continue; } $saveAttach && $saveAttach->add($rt); $value = $this->flashatt[$rt['aid']]; $rt['descrip'] = $value['desc']; if ($rt['descrip']) { $this->db->update("UPDATE pw_actattachs SET " . S::sqlSingle(array('descrip' => $rt['descrip'])) . ' WHERE aid=' . S::sqlEscape($rt['aid'])); } $this->attachs[$rt['aid']] = array('aid' => $rt['aid'], 'name' => $rt['name'], 'type' => $rt['type'], 'attachurl' => $rt['attachurl'], 'size' => $rt['size'], 'hits' => $rt['hits'], 'desc' => str_replace('\\', '', $rt['descrip']), 'ifthumb' => $rt['ifthumb']); } $saveAttach && $saveAttach->execute(); if ($deltmp) { $this->db->update("DELETE FROM pw_actattachs WHERE aid IN(" . S::sqlImplode($deltmp) . ')'); } return true; }
function transfer() { if (empty($this->flashatt)) { return false; } global $db_enhideset, $db_sellset, $db_ifpwcache, $timestamp; require_once R_P . 'require/functions.php'; $saveAttach = $this->getSaveAttach($this->post->uid); $deltmp = array(); $attach = $this->pw_attachs->gets(array('tid' => 0, 'pid' => 0, 'uid' => $this->post->uid, 'did' => 0, 'mid' => 0)); foreach ($attach as $rt) { if (!isset($this->flashatt[$rt['aid']])) { pwDelatt($rt['attachurl'], $this->ifftp); $deltmp[] = $rt['aid']; continue; } $saveAttach && $saveAttach->add($rt); $value = $this->flashatt[$rt['aid']]; $rt['descrip'] = $value['desc']; $rt['special'] = intval($value['special']); $rt['needrvrc'] = intval($value['needrvrc']); $rt['ctype'] = $value['ctype']; $this->attachs[$rt['aid']] = array('aid' => $rt['aid'], 'name' => $rt['name'], 'type' => $rt['type'], 'attachurl' => $rt['attachurl'], 'needrvrc' => 0, 'special' => 0, 'ctype' => '', 'size' => $rt['size'], 'hits' => $rt['hits'], 'desc' => str_replace('\\', '', $rt['descrip']), 'ifthumb' => $rt['ifthumb']); $pwSQL = array('fid' => $this->forum->fid, 'descrip' => $rt['descrip']); if ($rt['needrvrc'] > 0 && ($rt['special'] == 1 && $this->post->allowencode && in_array($rt['ctype'], $db_enhideset['type']) || $rt['special'] == 2 && $this->post->allowsell && in_array($rt['ctype'], $db_sellset['type']))) { $this->attachs[$rt['aid']]['needrvrc'] = $pwSQL['needrvrc'] = $rt['needrvrc']; $this->attachs[$rt['aid']]['special'] = $pwSQL['special'] = $rt['special']; $this->attachs[$rt['aid']]['ctype'] = $pwSQL['ctype'] = $rt['ctype']; } if ($rt['type'] == 'img') { $this->uploadImgNum++; } $this->post->user['uploadnum']++; $this->post->user['uploadtime'] = $timestamp; $this->pw_attachs->updateById($rt['aid'], $pwSQL); $this->ifupload = $rt['type'] == 'img' ? 1 : ($rt['type'] == 'txt' ? 2 : 3); if ($db_ifpwcache & 512 && !$rt['needrvrc'] && $rt['type'] == 'img' && !$this->elementpic) { $this->elementpic = array('aid' => $rt['aid'], 'attachurl' => $rt['attachurl'], 'ifthumb' => $rt['ifthumb']); } } $saveAttach && $saveAttach->execute(); $deltmp && $this->pw_attachs->delete($deltmp); return true; }
function delByUids($uids) { global $db_ifftp; if (!$uids || !is_array($uids)) { return false; } $diaryDb = $this->_getDiaryDB(); $diaryDb->delDiaryByUids($uids); $diaryDb->delDiaryTypeByUids($uids); $attachsService = L::loadClass('attachs', 'forum'); /* @var $attachsService PW_attachs */ $attachs = array(); $attachs = $attachsService->getByUids($uids); foreach ($attachs as $attach) { pwDelatt("diary/" . $attach['attachurl'], $db_ifftp); $attachsService->delByids(array($attach['aid'])); } return true; }
<?php !defined('P_W') && exit('Forbidden'); require_once R_P . 'u/lib/space.class.php'; $newSpace = new PwSpace($winduid); $space = $newSpace->getInfo(); pwDelatt($space['banner'], $db_ifftp); $newSpace->updateInfo(array('banner' => '')); echo 'ok'; ajax_footer();
<?php !defined('P_W') && exit('Forbidden'); $aids = array(); $query = $db->query("SELECT aid,attachurl,ifthumb FROM pw_attachs WHERE tid='0' AND pid='0' AND uid=" . S::sqlEscape($winduid)); while ($rt = $db->fetch_array($query)) { $rt['attachurl'] = substr($rt['attachurl'], 11); pwDelatt('mutiupload/' . $rt['attachurl'], $db_ifftp); $rt['ifthumb'] & 1 && pwDelatt('mutiupload/s1_' . $rt['attachurl'], $db_ifftp); $rt['ifthumb'] & 2 && pwDelatt('mutiupload/s2_' . $rt['attachurl'], $db_ifftp); $aids[] = $rt['aid']; } S::isArray($aids) && $db->update("DELETE FROM pw_attachs WHERE aid IN (" . S::sqlImplode($aids) . ')'); echo 'ok'; ajax_footer();
!$attach && Showmsg('job_attach_error'); if (empty($attach['attachurl']) || strpos($attach['attachurl'], '..') !== false) { Showmsg('job_attach_error'); } $aid = $attach['aid']; //获取管理权限 $isGM = S::inArray($windid, $manager); !$isGM && ($groupid = 3 && ($isGM = 1)); if ($isGM) { $admincheck = 1; } else { $admincheck = 0; } $attach['attachurl'] = "diary/" . $attach['attachurl']; if ($admincheck || $attach['uid'] == $winduid) { pwDelatt($attach['attachurl'], $db_ifftp); pwFtpClose($ftp); $diaryService = L::loadClass('Diary', 'diary'); /* @var $diaryService PW_Diary */ $diary = array(); $diary = $diaryService->get($did); $attachs = unserialize($diary['aid']); if (is_array($attachs)) { unset($attachs[$aid]); $attachs = $attachs ? serialize($attachs) : ''; //$db->update("UPDATE pw_diary SET aid=".S::sqlEscape($attachs)."WHERE did=" . S::sqlEscape($did)); pwQuery::update('pw_diary', 'did =:did', array($did), array('aid' => $attachs)); } $db->update("DELETE FROM pw_attachs WHERE aid=" . S::sqlEscape($aid)); echo 'success'; ajax_footer();
function Delcnimg($filename) { return pwDelatt("cn_img/{$filename}", $GLOBALS['db_ifftp']); }
function delete_att($attachdb, $ifdel = true) { require_once R_P . 'require/functions.php'; $delaids = array(); foreach ($attachdb as $key => $value) { is_numeric($key) && ($delaids[] = $key); if ($ifdel) { pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']); $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']); } } if ($delaids) { $pw_attachs = L::loadDB('attachs', 'forum'); if ($ifdel) { $pw_attachs->delete($delaids); } else { $pw_attachs->updateById($delaids, array('fid' => 0)); } } return $delaids; }
function DelIcon($filename) { if (strpos($filename, '..') !== false) { return false; } require_once R_P . 'require/functions.php'; pwDelatt("upload/{$filename}", $GLOBALS['db_ifftp']); pwDelatt("upload/middle/{$filename}", $GLOBALS['db_ifftp']); pwDelatt("upload/small/{$filename}", $GLOBALS['db_ifftp']); return true; }
function DelIcon($filename) { if (strpos($filename, '..') !== false) { return false; } pwDelatt("upload/{$filename}", $GLOBALS['db_ifftp']); pwDelatt("upload/middle/{$filename}", $GLOBALS['db_ifftp']); pwDelatt("upload/small/{$filename}", $GLOBALS['db_ifftp']); return true; }
function pwDelThreadAtt($path, $ifftp, $ifthumb = 3) { pwDelatt($path, $ifftp); $ifthumb & 1 && pwDelatt('thumb/' . $path, $ifftp); $ifthumb & 2 && pwDelatt('thumb/mini/' . $path, $ifftp); }
function recycle($ids) { global $db, $fid; $delids = array(); foreach ($ids as $key => $value) { if (is_numeric($value)) { $delids[] = $value; } } if ($delids) { $delids = pwImplode($delids); } else { Showmsg('forumcp_recycle_nodata'); } $query = $db->query("SELECT r.*,t.special,t.ifshield,t.ifupload,t.ptable,t.replies,t.fid AS ckfid FROM pw_recycle r LEFT JOIN pw_threads t ON r.tid=t.tid WHERE r.tid IN ({$delids}) AND r.pid='0' AND r.fid=" . pwEscape($fid)); $taid_a = $ttable_a = $ptable_a = array(); $delids = $pollids = $actids = $delaids = $rewids = $ids = array(); while (@extract($db->fetch_array($query))) { $ids[] = $tid; ($ifshield != '2' || $replies == '0' || $ckfid == '0') && ($delids[] = $tid); $special == 1 && ($pollids[] = $tid); $special == 2 && ($actids[] = $tid); $special == 3 && ($rewids[] = $tid); if ($ifshield != '2' || $replies == '0' || $ckfid == '0') { $ptable_a[$ptable] = 1; $ttable_a[GetTtable($tid)][] = $tid; } if ($ifupload) { $taid_a[GetTtable($tid)][] = $tid; if ($ifshield != '2' || $replies == '0' || $ckfid == '0') { $pw_posts = GetPtable($ptable); $query2 = $db->query("SELECT aid FROM {$pw_posts} WHERE tid=" . pwEscape($tid) . " AND aid!=''"); while (@extract($db->fetch_array($query2))) { if (!$aid) { continue; } $attachs = unserialize(stripslashes($aid)); foreach ($attachs as $key => $value) { is_numeric($key) && ($delaids[] = $key); pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']); $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']); } } } } } foreach ($taid_a as $pw_tmsgs => $value) { $value = pwImplode($value); $query = $db->query("SELECT aid FROM {$pw_tmsgs} WHERE tid IN({$value}) AND aid!=''"); while (@extract($db->fetch_array($query))) { if (!$aid) { continue; } $attachs = unserialize(stripslashes($aid)); foreach ($attachs as $key => $value) { is_numeric($key) && ($delaids[] = $key); pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']); $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']); } } } if ($pollids) { $pollids = pwImplode($pollids); $db->update("DELETE FROM pw_polls WHERE tid IN({$pollids})"); } if ($actids) { $actids = pwImplode($actids); $db->update("DELETE FROM pw_activity WHERE tid IN({$actids})"); $db->update("DELETE FROM pw_actmember WHERE actid IN({$actids})"); } if ($rewids) { $rewids = pwImplode($rewids); $db->update("DELETE FROM pw_reward WHERE tid IN({$rewids})"); } if ($delaids) { $pw_attachs = L::loadDB('attachs'); $pw_attachs->delete($delaids); } $delids = pwImplode($delids); if ($delids) { # $db->update("DELETE FROM pw_threads WHERE tid IN($delids)"); # ThreadManager $threadManager = L::loadClass("threadmanager"); $threadManager->deleteByThreadIds($fid, $delids); } foreach ($ttable_a as $pw_tmsgs => $val) { $val = pwImplode($val); $db->update("DELETE FROM {$pw_tmsgs} WHERE tid IN({$val})"); } foreach ($ptable_a as $key => $val) { $pw_posts = GetPtable($key); $db->update("DELETE FROM {$pw_posts} WHERE tid IN({$delids})"); } delete_tag($delids); if ($ids) { $ids = pwImplode($ids); $db->update("DELETE FROM pw_recycle WHERE tid IN ({$ids})"); } pwFtpClose($GLOBALS['ftp']); }
} elseif ($rt['type'] == 'forum') { if ($rt['cms'] && !$cms || !$rt['cms'] && $cms) { adminmsg('setforum_cms'); } $type = 'sub'; } elseif ($rt['type'] == 'sub') { $type = 'sub2'; } if ($f_type == 'hidden' && $allowvisit == '') { $basename = "{$admin_file}?adminjob=setforum&action=edit&fid={$fid}"; adminmsg('forum_hidden'); } $db_uploadfiletype = !empty($db_uploadfiletype) ? is_array($db_uploadfiletype) ? $db_uploadfiletype : unserialize($db_uploadfiletype) : array(); if ($logotype == 'upload') { if ($ifdellogo == 1) { pwDelatt($forum['logo'], $db_ifftp); $db->update("UPDATE pw_forums SET logo='' WHERE fid=" . pwEscape($fid)); $forum['logo'] = ''; } require_once R_P . 'require/postfunc.php'; $uploaddb = UploadFile($winduid, 'forumlogo'); $logo = !empty($uploaddb) ? $uploaddb[0]['attachurl'] : $forum['logo']; } elseif ($logotype == 'url') { $logo = $logo_url; } $modelids = ''; foreach ($modelid as $value) { $modelids .= $modelids ? ',' . $value : $value; } //团购活动 $pcids = '';
/** * 删除活动 * void */ function delActive($id) { list($activedb) = $this->searchList(array('id' => $id)); foreach ($activedb as $key => $value) { if ($value['poster']) { pwDelatt($value['poster'], $GLOBALS['db_ifftp']); } //* $this->_db->update("UPDATE pw_colonys SET activitynum=activitynum-1 WHERE id=". S::sqlEscape($value['cid'])); $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET activitynum=activitynum-1 WHERE id=:id", array('pw_colonys', $value['cid']))); } $this->_db->update("DELETE FROM pw_actmembers WHERE actid" . $this->sqlIn($id)); $this->_db->update("DELETE FROM pw_active WHERE id" . $this->sqlIn($id)); }
Showmsg('colony_out_right'); } if (empty($_POST['step'])) { require_once PrintEot('thread_set'); footer(); } else { S::gp(array('password')); if (!threadSetCheckOwnerPassword($winduid, $password)) { Showmsg('您输入的密码不正确!'); } if ($db->get_value("SELECT COUNT(*) as sum FROM pw_cnalbum WHERE atype=1 AND ownerid=" . S::sqlEscape($cyid)) > 0) { Showmsg('colony_del_photo'); } if ($colony['cnimg']) { require_once R_P . 'require/functions.php'; pwDelatt("cn_img/{$colony['cnimg']}", $db_ifftp); pwFtpClose($ftp); } $query = $db->query("SELECT uid FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($cyid) . " AND ifadmin != '-1'"); while ($rt = $db->fetch_array($query)) { $cMembers[] = $rt['uid']; } updateUserAppNum($cMembers, 'group', 'minus'); $db->update("DELETE FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($cyid)); //* $db->update("DELETE FROM pw_colonys WHERE id=" . S::sqlEscape($cyid)); pwQuery::delete('pw_colonys', 'id=:id', array($cyid)); $db->update("UPDATE pw_cnclass SET cnsum=cnsum-1 WHERE fid=" . S::sqlEscape($colony['classid']) . " AND cnsum>0"); $db->update("DELETE FROM pw_argument WHERE cyid=" . S::sqlEscape($cyid)); refreshto("apps.php?q=groups", '解散群组成功!'); } } else {
/** * 删除相片 *@param $pid int 相片ID *@return Array 返回相片相关信息 */ function delPhoto($pid) { if (intval($pid) <= 0) { return array(); } $albumDao = $this->_getDaoFactory('CnAlbum'); $photoDao = $this->_getDaoFactory('CnPhoto'); $photo = $photoDao->getPhotoUnionInfoByPid($pid); if (empty($photo) || $photo['ownerid'] != $GLOBALS['winduid'] && !$this->isDelRight()) { return array(); } $photoDao->delete($pid); $thumbPath = $this->getPhotoThumb($photo['path'], $photo['ifthumb']); $photoPath = $this->getPhotoThumb($photo['path'], 0); if (empty($photo['lastphoto']) || $thumbPath == $photo['lastphoto'] || $photoPath == $photo['lastphoto']) { $result = $photoDao->getPhotosInfoByAid($photo['aid'], 1, 1); $data['lastphoto'] = $this->getPhotoThumb($result[0]['path'], $result[0]['ifthumb']); } $data['photonum'] = intval($photo['photonum']) - 1; $albumDao->update($data, $photo['aid']); pwDelatt($photo['path'], $this->_dbifftp); // if($photo['ifthumb']){ pwDelatt($thumbPath, $this->_dbifftp); // pwDelatt($path, $this->_dbifftp); // } pwFtpClose($ftp); $photo['uid'] = $this->_uid; return $photo; }
$album = $db->get_one("SELECT * FROM pw_cnalbum WHERE aid=" . pwEscape($aid) . " AND atype='0'"); if (empty($album) || $album['ownerid'] != $winduid && $groupid != 3) { Showmsg('data_error'); } if (empty($_POST['step'])) { require_once PrintEot('m_ajax'); ajax_footer(); } else { $query = $db->query("SELECT pid,path,ifthumb FROM pw_cnphoto WHERE aid=" . pwEscape($aid)); if (($num = $db->num_rows($query)) > 0) { $affected_rows = 0; while ($rt = $db->fetch_array($query)) { pwDelatt($rt['path'], $db_ifftp); if ($rt['ifthumb']) { $lastpos = strrpos($rt['path'], '/') + 1; pwDelatt(substr($rt['path'], 0, $lastpos) . 's_' . substr($rt['path'], $lastpos), $db_ifftp); } $affected_rows += delAppAction('photo', $rt['pid']) + 1; //TODO 效率? } pwFtpClose($ftp); countPosts("-{$affected_rows}"); } $db->update("DELETE FROM pw_cnphoto WHERE aid=" . pwEscape($aid)); $db->update("DELETE FROM pw_cnalbum WHERE aid=" . pwEscape($aid)); updateUserAppNum($album['ownerid'], 'photo', 'minus', $album['photonum']); if ($album['ownerid'] != $winduid) { echo getLangInfo('msg', 'operate_success') . "\tjump\t{$basename}a=friend"; } else { echo getLangInfo('msg', 'operate_success') . "\tjump\t{$basename}a=own"; }
function updateData($id) { global $db; $db->update("UPDATE pw_active SET " . S::sqlSingle($this->data) . ' WHERE id=' . S::sqlEscape($id)); if ($this->delattach) { foreach ($this->delattach as $key => $value) { pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']); $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']); } $db->update("DELETE FROM pw_actattachs WHERE aid IN (" . S::sqlImplode(array_keys($this->delattach)) . ')'); } if ($this->alterattach) { foreach ($this->alterattach as $aid => $v) { $this->att->updateById($aid, $v); } } if (is_object($this->att) && ($aids = $this->att->getAids())) { $this->att->updateById($aids, array('actid' => $id)); } }