$article = array(); if ($articleid) { $article = $DB->fetch_one_array("SELECT title,attachments,visible FROM {$db_prefix}articles WHERE articleid='{$articleid}'"); if (!$article) { redirect('日志不存在'); } } if ($message) { $messages = array(1 => sprintf('成功上传了 %d 个附件到《' . $article['title'] . '》', $attach_total), 2 => '成功删除所选附件', 3 => '未选择任何附件', 4 => '成功清理不存在文件的附件记录', 5 => sprintf('附件清理结束,共删除了 %d 个冗余附件.', $deltotal)); } // 加载附件相关函数 require_once SABLOG_ROOT . 'include/func/attachment.func.php'; $attachdir = SABLOG_ROOT . $options['attachments_dir']; //批量删除附件 if ($action == 'delattachments') { if ($attachmentids = implode_ids($_POST['selectall'])) { $nokeep = $articledb = array(); //删除附件 $query = $DB->query("SELECT articleid,attachmentid,filepath,thumb_filepath FROM {$db_prefix}attachments WHERE attachmentid IN ({$attachmentids})"); while ($attach = $DB->fetch_array($query)) { $articledb[$attach['articleid']][] = $attach['attachmentid']; $nokeep[$attach['attachmentid']] = $attach; } removeattachment($nokeep); if ($articledb) { foreach ($articledb as $articleid => $attachid) { $attach_total = count($articledb[$article['articleid']]); $DB->unbuffered_query("UPDATE {$db_prefix}articles SET attachments=attachments-{$attach_total} WHERE articleid='" . $article['articleid'] . "'"); } } $location = getlink('attachment', 'list', array('message' => 2));
$location = getlink('link', 'list', array('message' => 2)); } else { $DB->query("UPDATE {$db_prefix}links SET name='{$new_name}', url='{$new_url}', note='{$new_note}' WHERE linkid='{$linkid}'"); $location = getlink('link', 'list', array('message' => 3)); } links_recache(); } } else { $location = getlink('link', str_replace('link', '', $action), array('message' => 4)); } header("Location: {$location}"); exit; } //批量处理 if ($action == 'domorelink') { if ($doit && ($ids = implode_ids($_POST['selectall']))) { if ($doit == 'delete') { $DB->query("DELETE FROM\t{$db_prefix}links WHERE linkid IN ({$ids})"); $location = getlink('link', 'list', array('message' => 5)); } elseif ($doit == 'enable') { $DB->query("UPDATE {$db_prefix}links SET visible='1' WHERE linkid IN ({$ids})"); $location = getlink('link', 'list', array('message' => 6)); } elseif ($doit == 'disable') { $DB->query("UPDATE {$db_prefix}links SET visible='0' WHERE linkid IN ({$ids})"); $location = getlink('link', 'list', array('message' => 7)); } elseif ($doit == 'home') { $DB->query("UPDATE {$db_prefix}links SET home='1' WHERE linkid IN ({$ids})"); $location = getlink('link', 'list', array('message' => 8)); } elseif ($doit == 'page') { $DB->query("UPDATE {$db_prefix}links SET home='0' WHERE linkid IN ({$ids})"); $location = getlink('link', 'list', array('message' => 9));
$email = char_cv($email); $url = char_cv($url); $DB->unbuffered_query("UPDATE {$db_prefix}users SET url='{$url}', email='{$email}' {$password_sql} WHERE userid='{$sax_uid}'"); if ($newpassword) { dcookies(); redirect('资料已修改成功,您修改了密码,需要重新登陆.', $options['url'] . 'cp.php?action=login'); } else { $location = getlink('user', 'profile', array('message' => 12, 'userid' => $sax_uid)); } } header("Location: {$location}"); exit; } //删除用户 if ($_POST['action'] == 'delusers') { if ($uids = implode_ids($_POST['selectall'])) { $aids = $comma = ''; $comment_count = $a_total = $a_stick = 0; // 删除该用户发表的文章以及相关数据 require_once SABLOG_ROOT . 'include/func/attachment.func.php'; $query = $DB->query("SELECT articleid,visible,uid,comments,stick FROM {$db_prefix}articles WHERE uid IN ({$uids})"); while ($article = $DB->fetch_array($query)) { $aids .= $comma . $article['articleid']; $comma = ','; if ($article['visible']) { $a_total++; $mids = get_mids($article['articleid']); $DB->unbuffered_query("UPDATE {$db_prefix}metas SET count=count-1 WHERE mid IN ({$mids})"); $comment_count = $comment_count + $article['comments']; } if ($article['stick']) {