if (censormod($title) || $_G['group']['allowuploadmod']) { $pic_status = 1; manage_addnotify('verifypic'); } else { $pic_status = 0; } $wherearr = array('picid' => $picid); if (!$managealbum) { $wherearr['uid'] = $_G['uid']; } C::t('home_pic')->update($picid, array('title' => $title, 'status' => $pic_status)); } if ($_GET['subop'] == 'delete') { if ($_POST['ids']) { require_once libfile('function/delete'); deletepics($_POST['ids']); if ($albumid > 0) { $return = album_update_pic($albumid); } } } elseif ($_GET['subop'] == 'move') { if ($_POST['ids']) { $sqluid = $managealbum ? '' : $_G['uid']; $_POST['newalbumid'] = intval($_POST['newalbumid']); if ($_POST['newalbumid']) { if (!($album = C::t('home_album')->fetch($_POST['newalbumid'], $sqluid))) { $_POST['newalbumid'] = 0; } } if ($managealbum) { $updatecount = C::t('home_pic')->update($_POST['ids'], array('albumid' => $_POST['newalbumid']));
function onPhotoRemove($uId, $pIds) { $result = false; if (!$pIds && !is_array($pIds)) { $errCode = 121; $errMessage = 'Invalid Picture Id'; return new ErrorResponse($errCode, $errMessage); } require_once libfile('function/delete'); $picInfos = deletepics($pIds); $result = array(); $deleteIds = array(); foreach ($picInfos as $picInfo) { $deleteIds[] = $picInfo['picid']; $result[] = array('pId' => $picInfo['picid'], 'status' => true); } $errorIds = array_diff($pIds, $deleteIds); foreach ($errorIds as $pId) { $result[] = array('pId' => $pId, 'status' => false); } return $result; }
showsetting('pic_search_perpage', '', $_G['gp_perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>"); showsetting('pic_search_albumid', 'albumid', $albumid, 'text'); showsetting('pic_search_user', 'users', $users, 'text'); showsetting('pic_search_picid', 'picid', $picid, 'text'); showsetting('pic_search_ip', 'postip', $postip, 'text'); showsetting('pic_search_hot', array('hot1', 'hot2'), array('', ''), 'range'); showsetting('pic_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange'); showsubmit('searchsubmit'); showtablefooter(); showformfooter(); showtagfooter('div'); } else { $picids = authcode($picids, 'DECODE'); $picidsadd = $picids ? explode(',', $picids) : $_G['gp_delete']; include_once libfile('function/delete'); $deletecount = count(deletepics($picidsadd)); $cpmsg = cplang('pic_succeed', array('deletecount' => $deletecount)); ?> <script type="text/JavaScript">alert('<?php echo $cpmsg; ?> ');parent.$('picforum').searchsubmit.click();</script> <?php } if (submitcheck('searchsubmit', 1) || $newlist) { $picids = $piccount = '0'; $sql = $error = ''; $users = trim($users); if ($starttime != '0') { $starttime = strtotime($starttime); $sql .= " AND p.dateline>'{$starttime}'";
} if ($blogs) { deleteblogs($blogs); } else { $next = 0; $nextdeleteitem = 'pic'; } } if ($deleteitem == 'pic') { $pics = array(); $query = C::t('home_pic')->fetch_all_by_uid($uids, 0, $pertask); foreach ($query as $pic) { $pics[] = $pic['picid']; } if ($pics) { deletepics($pics); } else { $next = 0; $nextdeleteitem = 'doing'; } } if ($deleteitem == 'doing') { $doings = array(); $query = C::t('home_doing')->fetch_all_by_uid_doid($uids, '', '', 0, $pertask); foreach ($query as $doings) { $doings[] = $doing['doid']; } if ($doings) { deletedoings($doings); } else { $next = 0;
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; } } }
function deletealbums($albumids) { global $_G; $sizes = $dels = $newids = $counts = array(); $allowmanage = checkperm('managealbum'); $value = C::t('home_album')->fetch($albumids); if ($value['albumid']) { if ($allowmanage || $value['uid'] == $_G['uid']) { $dels[] = $value; $newids[] = $value['albumid']; if (!empty($value['pic'])) { include_once libfile('function/home'); pic_delete($value['pic'], 'album', 0, $value['picflag'] == 2 ? 1 : 0); } } $counts[$value['uid']]['albums'] -= 1; } if (empty($dels)) { return array(); } $pics = $picids = array(); $query = C::t('home_pic')->fetch_all_by_albumid($newids); foreach ($query as $value) { $pics[] = $value; $picids[] = $value['picid']; $sizes[$value['uid']] = $sizes[$value['uid']] + $value['size']; } if ($picids) { deletepics($picids); } C::t('home_album')->delete($newids); C::t('home_feed')->delete_by_id_idtype($newids, 'albumid'); if ($picids) { C::t('home_clickuser')->delete_by_id_idtype($picids, 'picid'); } if ($sizes) { foreach ($sizes as $uid => $value) { $attachsize = intval($sizes[$uid]); $albumnum = $counts[$uid]['albums'] ? $counts[$uid]['albums'] : 0; updatemembercount($uid, array('albums' => $albumnum, 'attachsize' => -$attachsize), false); } } return $dels; }
/* [UCenter Home] (C) 2007-2008 Comsenz Inc. $Id: admincp_pic.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 } if (submitcheck('batchsubmit')) { include_once S_ROOT . './source/function_delete.php'; if (!empty($_POST['ids']) && deletepics($_POST['ids'])) { cpmessage('do_success', $_POST['mpurl']); } else { cpmessage('choose_to_delete_pictures', $_POST['mpurl']); } } $mpurl = 'admincp.php?ac=pic'; // process the user name if ($_GET['username']) { $query = $_SGLOBAL['db']->query("SELECT uid FROM " . tname('space') . " WHERE username='******'username']}'"); if ($value = $_SGLOBAL['db']->fetch_array($query)) { $_GET['uid'] = $value['uid']; } } // Search Processing $intkeys = array('albumid', 'uid', 'picid');
} else { $moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array()); $validates = $deletes = $ignores = 0; if (is_array($moderate)) { foreach ($moderate as $picid => $act) { $moderation[$act][] = $picid; } } if ($validate_picids = dimplode($moderation['validate'])) { DB::update('home_pic', array('status' => '0'), "picid IN ({$validate_picids})"); $validates = DB::affected_rows(); updatemoderate('picid', $moderation['validate'], 2); } if (!empty($moderation['delete'])) { require_once libfile('function/delete'); $pics = deletepics($moderation['delete']); $deletes = count($pics); updatemoderate('picid', $moderation['delete'], 2); } if ($ignore_picids = dimplode($moderation['ignore'])) { DB::update('home_pic', array('status' => '2'), "picid IN ({$ignore_picids})"); $ignores = DB::affected_rows(); updatemoderate('picid', $moderation['ignore'], 1); } if ($_G['gp_fast']) { echo callback_js($_G['gp_picid']); exit; } else { cpmsg('moderate_pictures_succeed', "action=moderate&operation=pictures&page={$page}&filter={$filter}&dateline={$_G['gp_dateline']}&username={$_G['gp_username']}&title={$_G['gp_title']}&tpp={$_G['gp_tpp']}&showcensor={$showcensor}", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes)); } }
foreach ($_POST['title'] as $picid => $value) { $picid = intval($picid); if(empty($_POST['ids'][$picid])) { $title = getstr($value, 150, 1, 1, 1); $wherearr = array('picid'=>$picid); if(!$managealbum) $wherearr['uid'] = $_SGLOBAL['supe_uid'];//自己 updatetable('pic', array('title'=>$title), $wherearr); } else { $deleteids[$picid] = $picid; } } if($deleteids) { include_once(S_ROOT.'./source/function_delete.php'); deletepics($deleteids); } } elseif($_GET['subop'] == 'update') { foreach ($_POST['title'] as $picid => $value) { $title = getstr($value, 150, 1, 1, 1); $picid = intval($picid); $wherearr = array('picid'=>$picid); if(!$managealbum) $wherearr['uid'] = $_SGLOBAL['supe_uid'];//自己 updatetable('pic', array('title'=>$title), $wherearr); } } elseif($_GET['subop'] == 'move') { //先更新title
} elseif ($filetype == 'attach') { if ($fileac == 'upload') { $feed_file = uploadFile($_FILES['attachupload']); if ($feed_file && is_array($feed_file)) { $arr = array('name' => $feed_file['filename'], 'path' => $feed_file['filepath'], 'size' => $feed_file['size'], 'aid' => $feed_file['aid']); //nameºÍsizeÊÇÏÔʾÓÃµÄ //aidÓëpathÊÇ´æ´¢ÓÃµÄ echo json_encode($arr); exit; } } elseif ($fileac == 'delete') { $picid = $_GET['aid'] ? $_GET['aid'] : 0; $delete[$picid] = $picid; if ($delete) { include_once S_ROOT . './source/function_delete.php'; $msg = deletepics($delete); if ($msg && is_array($msg)) { echo "ok"; exit; } } } } if ($eventid) { $query = $_SGLOBAL['db']->query("SELECT e.*, ef.* FROM " . tname("event") . " e LEFT JOIN " . tname("eventfield") . " ef ON e.eventid=ef.eventid WHERE e.eventid='{$_GET['eventid']}'"); $event = $_SGLOBAL['db']->fetch_array($query); if (empty($event)) { showmessage('event_does_not_exist'); } if ($event['grade'] == -2) { showmessage('event_is_closed');
/** * 删除照片 * * @param integer $uId 用户Id * @param array $pIds 照片Id列表 * @return array */ function remove($uId, $pIds) { $result = false; if (!$pIds && !is_array($pIds)) { $errCode = 121; $errMessage = 'Invalid Picture Id'; return new APIErrorResponse($errCode, $errMessage); } include_once S_ROOT . './source/function_delete.php'; $picInfos = deletepics($pIds); $result = array(); $deleteIds = array(); foreach ($picInfos as $picInfo) { $deleteIds[] = $picInfo['picid']; $result[] = array('pId' => $picInfo['picid'], 'status' => true); } $errorIds = array_diff($pIds, $deleteIds); foreach ($errorIds as $pId) { $result[] = array('pId' => $pId, 'status' => false); } return new APIResponse($result); }
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++; } }
function deletealbums($albumids) { global $_G; $sizes = $dels = $newids = $counts = array(); $allowmanage = checkperm('managealbum'); $query = DB::query("SELECT * FROM " . DB::table('home_album') . " WHERE albumid IN (" . dimplode($albumids) . ")"); while ($value = DB::fetch($query)) { if ($allowmanage || $value['uid'] == $_G['uid']) { $dels[] = $value; $newids[] = $value['albumid']; if (!empty($value['pic'])) { include_once libfile('function/home'); pic_delete($value['pic'], 'album', 0, $value['picflag'] == 2 ? 1 : 0); } } $counts[$value['uid']]['albums'] -= 1; } if (empty($dels)) { return array(); } $pics = $picids = array(); $query = DB::query("SELECT * FROM " . DB::table('home_pic') . " WHERE albumid IN (" . dimplode($newids) . ")"); while ($value = DB::fetch($query)) { $pics[] = $value; $picids[] = $value['picid']; $sizes[$value['uid']] = $sizes[$value['uid']] + $value['size']; } if ($picids) { deletepics($picids); } DB::query("DELETE FROM " . DB::table('home_album') . " WHERE albumid IN (" . dimplode($newids) . ")"); DB::query("DELETE FROM " . DB::table('home_feed') . " WHERE id IN (" . dimplode($newids) . ") AND idtype='albumid'"); if ($picids) { DB::query("DELETE FROM " . DB::table('home_clickuser') . " WHERE id IN (" . dimplode($picids) . ") AND idtype='picid'"); } if ($sizes) { foreach ($sizes as $uid => $value) { $attachsize = intval($sizes[$uid]); $albumnum = $counts[$uid]['albums'] ? $counts[$uid]['albums'] : 0; updatemembercount($uid, array('albums' => $albumnum, 'attachsize' => -$attachsize), false); } } return $dels; }