} elseif ($_GET['op'] == 'delete') { if (!($album = C::t('home_album')->fetch($albumid))) { showmessage('album_does_not_exist'); } if ($album['uid'] != $_G['uid'] && !checkperm('managealbum')) { showmessage('no_privilege_album_del'); } $albums = getalbums($album['uid']); if (empty($albums[$albumid])) { showmessage('no_privilege_album_delother'); } if (submitcheck('deletesubmit')) { $_POST['moveto'] = intval($_POST['moveto']); if ($_POST['moveto'] < 0) { require_once libfile('function/delete'); deletealbums(array($albumid)); } else { if ($_POST['moveto'] > 0 && $_POST['moveto'] != $albumid && !empty($albums[$_POST['moveto']])) { C::t('home_pic')->update_for_albumid($albumid, array('albumid' => $_POST['moveto'])); album_update_pic($_POST['moveto']); } else { C::t('home_pic')->update_for_albumid($albumid, array('albumid' => 0)); } C::t('home_album')->delete($albumid); } showmessage('do_success', "home.php?mod=space&uid={$_GET['uid']}&do=album&view=me"); } } elseif ($_GET['op'] == 'editpic') { $managealbum = checkperm('managealbum'); require_once libfile('class/bbcode'); if ($albumid > 0) {
function onPhotoRemoveAlbum($uId, $aId, $action = null, $targetAlbumId = null) { $res = $this->getUserSpace($uId); if (!$res) { return new ErrorResponse('1', "User({$uId}) Not Exists"); } $aId = intval($aId); if ($aId < 1) { $errCode = 120; $errMessage = 'Invalid Album Id'; return new ErrorResponse($errCode, $errMessage); } if ($action == 'move') { $targetAlbumId = intval($targetAlbumId); if ($targetAlbumId < 1) { $errCode = 120; $errMessage = 'Invalid Target Album Id'; return new ErrorResponse($errCode, $errMessage); } $sql = 'SELECT picnum FROM ' . DB::table('home_album') . ' WHERE albumid=' . $aId . ' AND uid=' . $uId; $query = DB::query($sql); $albumInfo = DB::fetch($query); if (!$albumInfo) { $errCode = 120; $errMessage = 'Invalid Album Id'; return new ErrorResponse($errCode, $errMessage); } if ($albumInfo['picnum'] > 0) { $sql = sprintf('UPDATE %s SET picnum = picnum + %d, dateline=%d WHERE albumid =%d AND uid=%d', DB::table('home_album'), $albumInfo['picnum'], time(), $targetAlbumId, $uId); DB::query($sql); $existsAlbum = DB::affected_rows(); if (!$existsAlbum) { $errCode = 120; $errMessage = 'Invalid Target Album Id'; return new ErrorResponse($errCode, $errMessage); } DB::update('home_pic', array('albumid' => $targetAlbumId), array('albumid' => $aId, 'uid' => $uId)); } } require_once libfile('function/delete'); $res = deletealbums(array($aId)); if ($res && is_array($res)) { return true; } else { $errCode = 124; $errMessage = 'Delete Album Failure'; return new ErrorResponse($errCode, $errMessage); } }
/* [UCenter Home] (C) 2007-2008 Comsenz Inc. $Id: admincp_album.php 12568 2009-07-08 07:38:01Z zhengqingpeng $ */ if (!defined('IN_UCHOME') || !defined('IN_ADMINCP')) { exit('Access Denied'); } // Check Permissions if (!($allowmanage = checkperm('managealbum'))) { $_GET['uid'] = $_SGLOBAL['supe_uid']; // For Admin Only $_GET['username'] = ''; } if (submitcheck('deletesubmit')) { include_once S_ROOT . './source/function_delete.php'; if (!empty($_POST['ids']) && deletealbums($_POST['ids'])) { cpmessage('do_success', $_POST['mpurl']); } else { cpmessage('at_least_one_option_to_delete_albums', $_POST['mpurl']); } } $mpurl = 'admincp.php?ac=album'; // Search Processing $intkeys = array('uid', 'friend', 'albumid'); $strkeys = array('username'); $randkeys = array(array('sstrtotime', 'dateline')); $likekeys = array('albumname'); $results = getwheres($intkeys, $strkeys, $randkeys, $likekeys); $wherearr = $results['wherearr']; $wheresql = empty($wherearr) ? '1' : implode(' AND ', $wherearr); $mpurl .= '&' . implode('&', $results['urls']);
$cpmsg = cplang('album_succeed', array('deletecount' => $deletecount)); } else { $albums = $catids = array(); $selectalbumids = !empty($_G['gp_ids']) && is_array($_G['gp_ids']) ? $_G['gp_ids'] : array(); if ($selectalbumids) { $query = DB::query('SELECT albumid, catid FROM ' . DB::table('home_album') . " WHERE albumid IN (" . dimplode($selectalbumids) . ')'); while ($value = DB::fetch($query)) { $albums[$value['albumid']] = $value; $catids[] = intval($value['catid']); } } if ($albums) { $selectalbumids = array_keys($albums); if ($_POST['optype'] == 'delete') { include_once libfile('function/delete'); $deletecount = count(deletealbums($selectalbumids)); $cpmsg = cplang('album_succeed', array('deletecount' => $deletecount)); } elseif ($_POST['optype'] == 'move') { $tocatid = intval($_POST['tocatid']); $catids[] = $tocatid; $catids = array_merge($catids); DB::update('home_album', array('catid' => $tocatid), 'albumid IN (' . dimplode($selectalbumids) . ')'); foreach ($catids as $catid) { $catid = intval($catid); $cnt = DB::result_first('SELECT COUNT(*) FROM ' . DB::table('home_album') . " WHERE catid = '{$catid}'"); DB::update('home_album_category', array('num' => intval($cnt)), array('catid' => $catid)); } $cpmsg = cplang('album_move_succeed'); } else { $cpmsg = cplang('album_choose_at_least_one_operation'); }
function deleteinfo($ids) { global $_SGLOBAL; include_once S_ROOT . './source/function_delete.php'; $deltype = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('report') . " WHERE rid IN (" . simplode($ids) . ")"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $deltype[$value['idtype']][] = $value['id']; } $gid = getgroupid($_SGLOBAL['member']['credit'], $_SGLOBAL['member']['groupid']); //执行相应的删除操作 foreach ($deltype as $key => $value) { switch ($key) { case 'blog': $_SGLOBAL['usergroup'][$gid]['manageblog'] = 1; deleteblogs($value); break; case 'picid': $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1; deletepics($value); break; case 'album': $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1; deletealbums($value); break; case 'thread': $_SGLOBAL['usergroup'][$gid]['managethread'] = 1; deletethreads(0, $value); break; case 'mtag': $_SGLOBAL['usergroup'][$gid]['managemtag'] = 1; deletemtag($value); break; case 'share': $_SGLOBAL['usergroup'][$gid]['manageshare'] = 1; deleteshares($value); break; case 'space': $_SGLOBAL['usergroup'][$gid]['managespace'] = 1; foreach ($value as $uid) { deletespace($uid); } break; } } }
$groups = getfriendgroup(); } elseif($_GET['op'] == 'delete') { //获得相册 $albums = getalbums($_SGLOBAL['supe_uid']); if(empty($albums[$albumid])) { showmessage('no_privilege'); } if(submitcheck('deletesubmit')) { $_POST['moveto'] = intval($_POST['moveto']); if($_POST['moveto'] < 0) { //彻底删除 include_once(S_ROOT.'./source/function_delete.php'); if(!deletealbums(array($albumid))) { showmessage('no_privilege'); } } else { //转移 if($_POST['moveto'] && empty($albums[$_POST['moveto']])) { $_POST['moveto'] = 0; } if($_POST['moveto'] > 0) { $album = $albums[$albumid]; //更新图片 updatetable('pic', array('albumid'=>$_POST['moveto']), array('albumid'=>$albumid)); $_SGLOBAL['db']->query("UPDATE ".tname('album')." SET picnum=picnum+$album[picnum], updatetime='$_SGLOBAL[timestamp]' WHERE albumid='$_POST[moveto]'"); //删除相册 $_SGLOBAL['db']->query("DELETE FROM ".tname('album')." WHERE albumid='$albumid'");
/** * 移除相册 * * @param integer $uId 用户Id * @param integer $aId 相册Id * @param string $action 动作 * @param integer $targetAlbumId 目标相册Id * @return boolean */ function removeAlbum($uId, $aId, $action = null, $targetAlbumId = null) { global $_SGLOBAL; $aId = intval($aId); if ($aId < 1) { $errCode = 120; $errMessage = 'Invalid Album Id'; return new APIErrorResponse($errCode, $errMessage); } if ($action == 'move') { $targetAlbumId = intval($targetAlbumId); if ($targetAlbumId < 1) { $errCode = 120; $errMessage = 'Invalid Target Album Id'; return new APIErrorResponse($errCode, $errMessage); } $sql = 'SELECT picnum FROM ' . tname('album') . ' WHERE albumid=' . $aId . ' AND uid=' . $uId; $query = $_SGLOBAL['db']->query($sql); $albumInfo = $_SGLOBAL['db']->fetch_array($query); if (!$albumInfo) { $errCode = 120; $errMessage = 'Invalid Album Id'; return new APIErrorResponse($errCode, $errMessage); } if ($albumInfo['picnum'] > 0) { $sql = sprintf('UPDATE %s SET picnum = picnum + %d, dateline=%d WHERE albumid =%d AND uid=%d', tname('album'), $albumInfo['picnum'], time(), $targetAlbumId, $uId); $_SGLOBAL['db']->query($sql); $existsAlbum = $_SGLOBAL['db']->affected_rows(); if (!$existsAlbum) { $errCode = 120; $errMessage = 'Invalid Target Album Id'; return new APIErrorResponse($errCode, $errMessage); } updatetable('pic', array('albumid' => $targetAlbumId), array('albumid' => $aId, 'uid' => $uId)); } } include_once S_ROOT . './source/function_delete.php'; $res = deletealbums(array($aId)); if ($res && is_array($res)) { return new APIResponse(true); } else { $errCode = 124; $errMessage = 'Delete Album Failure'; return new APIErrorResponse($errCode, $errMessage); } }
showtableheader(); showsetting('album_search_detail', 'detail', $detail, 'radio'); showsetting('album_search_albumname', 'albumname', $albumname, 'text'); showsetting('album_search_albumid', 'albumid', $albumid, 'text'); showsetting('album_search_uid', 'uid', $uid, 'text'); showsetting('album_search_user', 'users', $users, 'text'); showsetting('album_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange'); showsubmit('searchsubmit'); showtablefooter(); showformfooter(); showtagfooter('div'); } else { $albumids = authcode($albumids, 'DECODE'); $albumidsadd = $albumids ? explode(',', $albumids) : $_G['gp_delete']; include_once libfile('function/delete'); $deletecount = count(deletealbums($albumidsadd)); $cpmsg = cplang('album_succeed', array('deletecount' => $deletecount)); ?> <script type="text/JavaScript">alert('<?php echo $cpmsg; ?> ');parent.$('albumforum').searchsubmit.click();</script> <?php } if (submitcheck('searchsubmit')) { $albumids = $albumcount = '0'; $sql = $error = ''; $users = trim($users); if ($users != '') { $uids = '-1'; $query = DB::query("SELECT uid FROM " . DB::table('home_album') . " WHERE username IN ('" . str_replace(',', '\',\'', str_replace(' ', '', $users)) . "')");
function deleteinfo($ids) { global $_SGLOBAL; include_once S_ROOT . './source/function_delete.php'; $deltype = array(); $reportuser = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('report') . " WHERE rid IN (" . simplode($ids) . ")"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $value['user'] = unserialize($value['uids']); $reportuser[] = array_shift(array_flip($value['user'])); $deltype[$value['idtype']][] = $value['id']; } $gid = getgroupid($_SGLOBAL['member']['experience'], $_SGLOBAL['member']['groupid']); //Perform the corresponding delete operations $i = 0; $_SGLOBAL['usergroup'][$gid]['managebatch'] = 1; foreach ($deltype as $key => $value) { switch ($key) { case 'blogid': $_SGLOBAL['usergroup'][$gid]['manageblog'] = 1; deleteblogs($value); break; case 'picid': $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1; deletepics($value); break; case 'albumid': $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1; deletealbums($value); break; case 'tid': $_SGLOBAL['usergroup'][$gid]['managethread'] = 1; deletethreads(0, $value); break; case 'tagid': $_SGLOBAL['usergroup'][$gid]['managemtag'] = 1; deletemtag($value); break; case 'sid': $_SGLOBAL['usergroup'][$gid]['manageshare'] = 1; deleteshares($value); break; case 'uid': $_SGLOBAL['usergroup'][$gid]['managedelspace'] = 1; foreach ($value as $uid) { deletespace($uid); } break; case 'eventid': $_SGLOBAL['usergroup'][$gid]['manageevent'] = 1; deleteevents($value); break; case 'pid': $_SGLOBAL['usergroup'][$gid]['managepoll'] = 1; deletepolls($value); break; case 'comment': $_SGLOBAL['usergroup'][$gid]['managecomment'] = 1; deletecomments($value); break; case 'post': $_SGLOBAL['usergroup'][$gid]['managethread'] = 1; deleteposts(0, $value); break; } //The first reporter award getreward('report', 1, $reportuser[$i], '', 0); $i++; } }