refreshto("{$basename}a=view&aid={$aid}&pid={$pid}", 'operate_success'); } } elseif ($a == 'delphoto') { define('AJAX', '1'); S::gp(array('pid')); $photo = $photoService->delPhoto($pid); if (empty($photo)) { Showmsg('data_error'); } $weiboService = L::loadClass('weibo', 'sns'); /* @var $weiboService PW_Weibo */ $weibo = $weiboService->getWeibosByObjectIdsAndType($pid, 'photos'); if ($weibo) { $weiboService->deleteWeibos($weibo['mid']); } $affected_rows = delAppAction('photo', $pid) + 1; countPosts("-{$affected_rows}"); //积分变动 require_once R_P . 'require/credit.php'; $o_photos_creditset = unserialize($o_photos_creditset); $creditset = getCreditset($o_photos_creditset['Deletephoto'], false); $creditset = array_diff($creditset, array(0)); if (!empty($creditset)) { require_once R_P . 'require/postfunc.php'; $credit->sets($photo['uid'], $creditset, true); updateMemberid($photo['uid'], false); } if ($creditlog = unserialize($o_photos_creditlog)) { addLog($creditlog['Deletephoto'], $photo['uploader'], $photo['uid'], 'photos_Deletephoto'); } updateUserAppNum($photo['uid'], 'photo', 'minus');
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"; } ajax_footer(); }
foreach ($selid as $value) { if (is_numeric($value)) { $selids[] = $value; } } $selids = S::sqlImplode($selids); } !$selids && adminmsg('operate_error', "{$basename}&action=cp"); $selids = strpos($selids, ',') !== false ? "IN ({$selids})" : "= {$selids}"; $uids = $dids = array(); $query = $db->query("SELECT uid,dtid,did FROM pw_diary WHERE did {$selids}"); while ($rt = $db->fetch_array($query)) { //$db->update("DELETE FROM pw_diary WHERE did=".S::sqlEscape($rt['did'])); pwQuery::delete('pw_diary', 'did=:did', array($rt['did'])); $db->update("UPDATE pw_diarytype SET num=num-1 WHERE dtid=" . S::sqlEscape($rt['dtid'])); if ($affected_rows = delAppAction('diary', $rt['did'])) { countPosts("-{$affected_rows}"); } $uids[] = $rt['uid']; $dids[] = $rt['did']; } $uids = array_unique($uids); updateUserAppNum($uids, 'diary', 'recount'); //删除日志时,删除微博 $weiboService = L::loadClass('weibo', 'sns'); /* @var $weiboService PW_Weibo */ $weiboArr = $weiboService->getWeibosByObjectIdsAndType($dids, 'diary'); foreach ($weiboArr as $weibo) { $mids[] = $weibo['mid']; } $mids && $weiboService->deleteWeibos($mids);
$rt['title'] = $belong . "<a href=\"u.php?uid={$temp_uid}\" target=\"_blank\">" . $temp['album']['username'] . "</a>"; } elseif ($rt['type'] == 'group') { $rt['title'] = "<a href=\"{$rt['link']}\" target=\"_blank\">" . $temp['group']['name'] . "</a>"; } elseif ($rt['type'] == 'diary') { $rt['title'] = "<a href=\"{$rt['link']}\" target=\"_blank\">" . $temp['diary']['subject'] . "</a>"; } else { $rt['title'] = "<a href=\"{$rt['link']}\" target=\"_blank\">" . substrs($rt['link'], 40) . "</a>"; } $sharedb[] = $rt; } require_once PrintApp('share'); } elseif ($job == 'delete') { InitGP(array('selid', 'type', 'ifhidden', 'username', 'postdate_s', 'postdate_e', 'ordertype', 'page', 'lines')); empty($selid) && adminmsg("no_share_selid", "{$basename}&action=share"); require_once "mode/o/require/core.php"; foreach ($selid as $key => $id) { $sharedb = $db->get_one("SELECT uid FROM pw_share WHERE id=" . pwEscape($id)); if (empty($sharedb)) { adminmsg('data_error', "{$basename}&action=share"); } $uids[] = $sharedb['uid']; $db->update("DELETE FROM pw_share WHERE id=" . pwEscape($id)); if ($affected_rows = delAppAction('share', $id)) { countPosts("-{$affected_rows}"); } } $uids = array_unique($uids); updateUserAppNum($uids, 'share', 'recount'); adminmsg('operate_success', "{$basename}&action=share&job=list&type={$type}&username="******"&ifhidden={$ifhidden}&postdate_s={$postdate_s}&postdate_e={$postdate_e}&ordertype={$ordertype}&lines={$lines}&page={$page}&"); } }
$diaryService->delDiary($id); $weiboService = L::loadClass('weibo', 'sns'); /* @var $weiboService PW_Weibo */ $weibo = $weiboService->getWeibosByObjectIdsAndType($id, 'diary'); if ($weibo) { $weiboService->deleteWeibos($weibo['mid']); } // $diary = $db->get_one("SELECT did,dtid,uid,username FROM pw_diary WHERE did=".S::sqlEscape($id)); // !$diary && Showmsg('mode_o_no_diary'); // // if ($winduid != $diary['uid'] && !$isGM) { // Showmsg('mode_o_deldiary_permit_err'); // } // $db->update("DELETE FROM pw_diary WHERE did=".S::sqlEscape($id)); // $db->update("UPDATE pw_diarytype SET num=num-1 WHERE dtid=".S::sqlEscape($diary['dtid'])); if ($affected_rows = delAppAction('diary', $id)) { countPosts("-{$affected_rows}"); } $userCache = L::loadClass('Usercache', 'user'); $userCache->delete($winduid, 'carddiary'); /* $usercache = L::loadDB('Usercache', 'user'); $usercache->delete($winduid, 'diary', $id); */ //积分变动 require_once R_P . 'require/credit.php'; $o_diary_creditset = unserialize($o_diary_creditset); $creditset = getCreditset($o_diary_creditset['Delete'], false); $creditset = array_diff($creditset, array(0)); if (!empty($creditset)) { require_once R_P . 'require/postfunc.php';
$page = $numofpage; } $pages = numofpage($count, $page, $numofpage, "{$basename}&action=writes&job=list{$urladd}&"); $start = ($page - 1) * $lines; $limit = pwLimit($start, $lines); $query = $db->query("SELECT o.id,o.uid,m.username,o.postdate,o.source,o.content,o.c_num FROM pw_owritedata o LEFT JOIN pw_members m ON o.uid=m.uid WHERE {$sql} " . "ORDER BY postdate {$ordertype} " . $limit); while ($rt = $db->fetch_array($query)) { $rt['s_content'] = substrs($rt['content'], 40); $rt['postdate'] = $rt['postdate'] ? get_date($rt['postdate']) : '-'; $writedb[] = $rt; } require_once PrintApp('write'); } elseif ($job == 'delete') { InitGP(array('selid', 'content', 'username', 'postdate_s', 'postdate_e', 'ordertype', 'page', 'lines')); empty($selid) && adminmsg("no_write_selid", "{$basename}&action=writes"); require_once "mode/o/require/core.php"; foreach ($selid as $key => $id) { $writedb = $db->get_one("SELECT uid FROM pw_owritedata WHERE id=" . pwEscape($id)); if (empty($writedb)) { adminmsg('data_error', "{$basename}&action=writes"); } $uids[] = $writedb['uid']; $db->update("DELETE FROM pw_owritedata WHERE id=" . pwEscape($id)); $affected_rows = delAppAction('write', $id) + 1; countPosts("-{$affected_rows}"); } $uids = array_unique($uids); updateUserAppNum($uids, 'owrite', 'recount'); adminmsg('operate_success', "{$basename}&action=writes&job=list&content=" . rawurlencode($content) . "&username="******"&postdate_s={$postdate_s}&postdate_e={$postdate_e}&ordertype={$ordertype}&lines={$lines}&page={$page}&"); } }
/** *删除相册 *@param $aid int 相册ID */ function delAlbum($aid) { if (!$this->isDelRight() && !$this->isSelf() || intval($aid) <= 0) { return array(); } $photoDao = $this->_getDaoFactory('CnPhoto'); $albumDao = $this->_getDaoFactory('CnAlbum'); $photoList = $photoDao->getPhotosInfoByAid($aid); if (!empty($photoList)) { $affected_rows = 0; foreach ($photoList as $key => $value) { pwDelatt($value['path'], $this->_dbifftp); if ($value['ifthumb']) { $lastpos = strrpos($value['path'], '/') + 1; pwDelatt(substr($value['path'], 0, $lastpos) . 's_' . substr($value['path'], $lastpos), $this->_dbifftp); } $affected_rows += delAppAction('photo', $value['pid']) + 1; //TODO 效率? } pwFtpClose($ftp); countPosts("-{$affected_rows}"); } $photoDao->delPhotosByAid($aid); $albumDao->delete($aid); }