public function message_del() { $ids = I('post.ids'); if (empty($ids)) { $this->error('未选择'); } if (isIntArray($ids)) { $idstr = implode(",", $ids); $messages = D('messages'); $messages->where("id in ({$idstr})")->delete(); $this->success('删除成功'); } }
public function delarticles() { $aids = I('post.aids'); if (empty($aids)) { $this->error('未选择'); } if (isIntArray($aids)) { $aidstr = implode(",", $aids); $Articles = D('articles'); $Articles->where("aid in ({$aidstr})")->delete(); $this->success('删除成功'); } }
public function delproducts() { $aids = I('post.aids'); if (empty($aids)) { $this->error('未选择'); } if (isIntArray($aids)) { $aidstr = implode(",", $aids); $Products = D('products'); $Products->where("proid in ({$aidstr})")->delete(); $this->success('删除成功', 'manage'); } }
$db->row_delete("articles", "channelid={$cid}"); //Delete Channels $db->row_delete("channels", "id={$cid}"); writeChannelsCache(); succeedFlag(); } catch (Exception $e) { echo $e; } break; case "modifychannel": try { $doaction = strFilter($_POST['doaction']); $channel['channeltype'] = intval($_POST['channeltype']); $channel['alias'] = strFilter($_POST['alias']); $channel['ishidden'] = intval($_POST['ishidden']); $channel['positions'] = isIntArray($_POST['positions']) ? "|" . implode($_POST['positions'], "|") . "|" : ""; $channel['pid'] = intval($_POST['pid']); $channel['langid'] = $_SYS['alangid']; $channel['title'] = strFilter($_POST['title']); $channel['seotitle'] = strFilter($_POST['seotitle']); $channel['metadesc'] = strFilter($_POST['metadesc']); $channel['metakeywords'] = strFilter($_POST['metakeywords']); if ($doaction == "edit") { $id = intval($_POST['id']); $db->row_update("channels", $channel, "id={$id}"); } else { $tmprow = $db->row_query_one("SELECT max(ordernum) AS morder FROM `{$db->pre}channels` WHERE langid={$_SYS['alangid']} Limit 1"); $channel['content'] = ''; $channel['ordernum'] = ++$tmprow['morder']; $db->row_insert("channels", $channel); }
$db->row_update("products", $product, "id={$id}"); } } succeedFlag(); } catch (Exception $e) { echo $e; } break; case "doproducts": try { $postaction = $_POST['postaction']; $aids = $_POST['aids']; if (empty($aids)) { exit($_AL['products.nosel']); } if (isIntArray($aids)) { $aidstr = implode(",", $aids); switch ($postaction) { case "": case "delProducts": $db->row_delete("products", "id in ({$aidstr})"); succeedFlag(); break; default: echo $_AL['all.noaction']; break; } } } catch (Exception $e) { echo $e; }
require_once '../inc/init.php'; require_once '../inc/cache.php'; require_once './inc/adminfun.php'; require_once "./language/language.php"; if (!isAdmin()) { exit($_AL['all.notlogin']); } if (!hasPopedom("user")) { exit(_LANG($_AL['admin.nopopedom'], array($_AL['index.admin.set']))); } $action = strFilter($_GET['action']); switch ($action) { case "delusers": try { $deluid = $_POST['deluid']; if (isIntArray($deluid)) { foreach ($deluid as $uid) { //delete users $db->row_delete("users", "id={$uid}"); } } writeUsersCache(); succeedFlag(); } catch (Exception $e) { echo $e; } break; case "savepopedom": $userid = intval($_POST['userid']); //check at least one user had popedom of user setting $row = $db->row_select_one("users", "id<>{$userid} and popedom like '%|user|%' and ishidden=0");
$id = intval($_GET['id']); $action = strFilter($_GET["action"]); $action = empty($action) ? "view" : $action; switch ($action) { case "vote": case "view": $votetips = ''; if ($action == "vote") { $voteitemid = $_POST['voteitemid']; $voteid = intval($_POST['voteid']); $voterow = $db->row_select_one("votes", "id={$voteid}"); if ($voterow['starttime'] > $_SYS['time'] || $voterow['stoptime'] < $_SYS['time']) { $votetips = $_SLANG['vote.expired']; } if (!empty($voteitemid)) { if (isIntArray($voteitemid) && count($voteitemid) <= $voterow['maxvotes']) { //合法 } else { $votetips = _LANG($_SLANG['vote.max2'], array($voterow['maxvotes'])); } $rows = $db->row_select("voteitems", "voteid={$voteid}"); if ($voterow['level'] > 0) { foreach ($rows as $row) { if (stristr(",{$row['voteips']},", "," . getIP() . ",")) { $votetips = $_SLANG['vote.voted']; } } } if ($voterow['level'] == 2 && intval(getCookies("vote{$voteid}")) == 1) { $votetips = $_SLANG['vote.voted']; }
public function ajax() { $action = I('get.action'); switch ($action) { case "createFolder": $folder['title'] = I('post.newfoldername'); if (empty($folder['title'])) { exit("文件夹名称为空"); } $folder['updatetime'] = time(); $folders = D('Folders'); $folders->add($folder); writeFoldersCache(); exit('ok'); break; case "renameFolder": try { $folderid = intval(I('post.folderid')); $folder['title'] = I('post.newfoldername'); if (empty($folder['title'])) { exit("error"); } $folders = D('folders'); $folders->where("id={$folderid}")->setField($folder); writeFoldersCache(); exit('ok'); } catch (Exception $e) { echo $e; } break; case "delFolder": try { $folderids = I('post.ids'); $deltype = intval($_POST['deltype']); $deltype = I('post.deltype', '', 'int'); if (isIntArray($folderids)) { //ignore default dir foreach ($folderids as $key => $folderid) { if (intval($folderid) == 1) { unset($folderids[$key]); } } //del dir $delfolderids = implode(",", $folderids); $folders = D('Folders'); $folders->where("id in ({$delfolderids})")->delete(); $attach = D('attachments'); if ($deltype == 1) { //del file $rows = $attach->where("folderid in ({$delfolderids})"); foreach ($rows as $row) { $filepath = __ROOT__ . "/Public/uploadfile/images/" . $row['filepath']; if (file_exists($filepath)) { @unlink($filepath); } $filepath = __ROOT__ . "/Public/uploadfile//thumb/" . $row['filepath']; if (file_exists($filepath)) { @unlink($filepath); } $attach->where("id={$row['id']}")->delete(); } } elseif ($deltype == 0) { //to default dir $attach->where("folderid in ({$delfolderids})")->setField('folderid', 1); } writeFoldersCache(); exit('ok'); } else { exit('error'); } } catch (Exception $e) { echo $e; } break; case "deleteAttachment": $id = intval(I('get.id')); $attach = D('attachments'); $row = $attach->where("id={$id}")->find(); if (!empty($row)) { $attachpath = ROOT_PATH . "/Public/uploadfile/images/{$row['filepath']}"; if (file_exists($attachpath)) { unlink($attachpath); } $attachpath = ROOT_PATH . "/Public/uploadfile/thumb/{$row['filepath']}"; if (file_exists($attachpath)) { unlink($attachpath); } $attach->where("id={$id}")->delete(); exit('ok'); } else { exit('删除失败,文件可能不存在'); } break; case "delFiles": try { $fileids = I('post.ids'); if (isIntArray($fileids)) { $delfileids = implode(",", $fileids); //del files $attach = D('attachments'); $attrows = $attach->where("id in ({$delfileids})")->select(); foreach ($attrows as $row) { $filepath = ROOT_PATH . "/Public/uploadfile/images/" . $row['filepath']; if (file_exists($filepath)) { @unlink($filepath); } $filepath = ROOT_PATH . "/Public/uploadfile/thumb/" . $row['filepath']; if (file_exists($filepath)) { @unlink($filepath); } $attach->where("id={$row['id']}")->delete(); } exit('ok'); } else { exit('error'); } } catch (Exception $e) { echo $e; } break; case "moveFiles": try { $fileids = I('post.ids'); $targetfolder = intval(I('post.targetfolder')); if (isIntArray($fileids)) { $movefileids = implode(",", $fileids); $attach['folderid'] = $targetfolder; $folders = D('attachments'); $folders->where("id in ({$movefileids})")->setField($attach); exit('ok'); } else { exit('error'); } } catch (\Exception $e) { echo $e; } break; default: echo '未定义行为'; break; } }
if (empty($proid)) { exit($_SLANG['ajaxmember.parmerr']); } $favobj["proid"] = $proid; $favobj["memberid"] = $lg["memberid"]; $favobj["addtime"] = time(); $favobj['langid'] = $_SYS['langid']; $row = $db->row_select_one("favs", "proid={$proid} and memberid={$lg['memberid']} and langid={$_SYS['langid']}"); if (empty($row)) { $db->row_insert("favs", $favobj); } else { $db->row_update("favs", $favobj, "proid={$proid} and memberid={$lg['memberid']} and langid={$_SYS['langid']}"); } succeedFlag(); break; case "delFav": $favids = $_POST['favids']; if (empty($favids)) { echo $_SLANG['ajaxmember.nofav']; return; } if (isIntArray($favids)) { $favidstr = implode(",", $favids); $db->row_delete("favs", "id in ({$favidstr}) and memberid={$lg['memberid']} and langid={$_SYS['langid']}"); } succeedFlag(); break; default: echo "No Such Action"; break; }
$msg['replytime'] = time(); $id = intval($_POST['id']); $db->row_update("msgs", $msg, "id={$id}"); printRes("{$_AL['msg.reply.succeed']}<script>setTimeout(function(){reloadSelf('admin.php?inc=msg&action=list');},1500);</script>"); } catch (Exception $e) { echo $e; } break; case "domsgs": try { $postaction = $_POST['postaction']; $ids = $_POST['ids']; if (empty($ids)) { exit($_AL['msg.nochoose']); } if (isIntArray($ids)) { $idstr = implode(",", $ids); switch ($postaction) { case "delMsg": $db->row_delete("msgs", "id in ({$idstr})"); break; case "verifyY": $msg['state'] = 1; $db->row_update("msgs", $msg, "id in ({$idstr})"); break; case "verifyN": $msg['state'] = 0; $db->row_update("msgs", $msg, "id in ({$idstr})"); break; default: echo $_AL['all.noaction'];
} $db->row_delete("attachments", "id={$row['id']}"); } succeedFlag(); } else { exit($_AL['folder.choose.file']); } } catch (Exception $e) { echo $e; } break; case "moveFiles": try { $fileids = $_POST['ids']; $targetfolder = intval($_POST['targetfolder']); if (isIntArray($fileids)) { $movefileids = implode(",", $fileids); $attach['folderid'] = $targetfolder; $db->row_update("attachments", $attach, "id in ({$movefileids})"); succeedFlag(); } else { exit($_AL['folder.choose.file']); } } catch (Exception $e) { echo $e; } break; default: echo $_AL['all.noaction']; break; }
writeTemplatevarsCache(); } if ($doaction == "editvar") { printRes("{$_AL['template.editsucceed']}<script>setTimeout(function(){self.location.href='admin.php?inc=template&action=varlist'},1000);</script>"); } else { printRes("{$_AL['template.addsucceed']}<script>setTimeout(function(){self.location.href='admin.php?inc=template&action=varlist'},1000);</script>"); } } catch (Exception $e) { echo $e; } break; case "dotemplatevars": try { $vids = $_POST['vids']; if (empty($vids)) { exit("{$_AL['template.noselect']}"); } if (isIntArray($vids)) { $vidstr = implode(",", $vids); $db->row_delete("templatevars", "id in ({$vidstr})"); succeedFlag(); } writeTemplatevarsCache(); } catch (Exception $e) { echo $e; } break; default: echo $_AL['all.noaction']; break; }
require_once '../inc/cache.php'; require_once './inc/adminfun.php'; require_once "./language/language.php"; if (!isAdmin()) { exit($_AL['all.notlogin']); } if (!hasPopedom("link")) { exit(_LANG($_AL['admin.nopopedom'], array($_AL['index.frilink.list']))); } $action = strFilter($_GET['action']); switch ($action) { case "savelinks": try { $links_delid = $_POST['links_delid']; //DELETE if (isIntArray($links_delid)) { $delids = implode(",", $links_delid); $db->row_delete("links", "id in ({$delids})"); } //UPDATE $links_ordernum = $_POST['links_ordernum']; $links_name = $_POST['links_name']; $links_url = $_POST['links_url']; $links_content = $_POST['links_content']; $links_logo = $_POST['links_logo']; $links_lang = $_POST['links_lang']; if (is_array($links_name)) { foreach ($links_name as $key => $link_name) { $linkobj['ordernum'] = intval($links_ordernum[$key]); $linkobj['name'] = $links_name[$key]; $linkobj['url'] = $links_url[$key];