/** * 默认执行函数 * * @access public * @param int $pid 文档ID * @return void */ public function index($pid) { /** 参数不符合要求? */ if (empty($pid) || !is_numeric($pid)) { go_back(); } /** 获得评论主题 */ $parent_post = $this->posts_mdl->get_post_by_id('pid', intval($pid)); /** 评论主题不存在? */ if (!$parent_post) { show_error('评论失败:找不到内容'); exit; } /** 此文不允许评论? */ if (0 == intval($parent_post->allowComment)) { show_error('评论失败:内容关闭了评论功能'); exit; } /** 如果库中已经存在当前ip为spam的comment则直接拒绝 */ $spams = $this->comments_mdl->get_cmts_by_ip('comment', 'spam', $this->input->ip_address()); if ($spams->num_rows() > 0) { show_404(); } unset($spams); /*** 加载验证条件 */ $this->_load_validation_rules(); /*** 验证失败还是成功? */ if ($this->form_validation->run() === FALSE) { show_error(validation_errors()); } else { /** To-do list: 这里还有两个功能没做:评论盖楼和登陆用户的评论设置 */ $this->load->library('user_agent'); /** 获取提交的数据 */ $comment = array('pid' => $parent_post->pid, 'author' => $this->input->post('author', TRUE), 'mail' => $this->input->post('mail', TRUE), 'url' => $this->input->post('url', TRUE), 'created' => now(), 'agent' => $this->agent->agent_string(), 'ip' => $this->input->ip_address(), 'ownerId' => $parent_post->authorId, 'type' => 'comment', 'status' => 1 == intval(setting_item('comments_require_moderation')) ? 'waiting' : 'approved', 'text' => $this->_filter_text($this->input->post('text', TRUE)), 'parent' => 0); /** 获取用户数据后的插件处理钩子 */ if ($this->plugin->check_hook_exist(ST_CORE_HOOK_COMMENT_PREPROCESS)) { $comment = $this->plugin->trigger(ST_CORE_HOOK_COMMENT_PREPROCESS, $comment, $parent_post); } /** 主数据入库 */ $insert_id = $this->comments_mdl->add_cmt($comment); /** 更新评论数据 */ if ('approved' == $comment['status']) { $this->posts_mdl->refresh_comments_count($comment['pid']); } if ('waiting' == $comment['status']) { $data['title'] = '评论提示'; $data['heading'] = '你的留言需要审核后才能显示'; $data['message'] = '由于本站开启了评论审核功能,你的留言需要审核后才能显示.'; $this->load_theme_view('msg', $data, FALSE); } if ('spam' == $comment['status']) { $data['title'] = '评论警告'; $data['heading'] = '你的留言有SPAM嫌疑'; $data['message'] = '你的留言IP已被系统自动屏蔽,如有误,请联系站点管理员.'; $this->load_theme_view('msg', $data, FALSE); } if (1 == setting_item('cache_enabled')) { $cache_expired = intval(setting_item('cache_expire_time')); $data['title'] = '评论成功'; $data['heading'] = '恭喜你,评论成功'; $data['message'] = "您的评论至多{$cache_expired}分钟后就会被显示出来."; $this->load_theme_view('msg', $data, FALSE); } else { go_back('#comment-' . $insert_id); } } }
/** * 合并 * * @access private * @param string $type 类型 * @return void */ private function _merge($type) { $metas = $this->input->post('mid', TRUE); if ($metas && is_array($metas)) { $merge = $this->input->post('merge', TRUE); if ('tag' == $type) { $merge = $this->metas_mdl->scan_tags($merge); if (empty($merge)) { $this->session->set_flashdata('error', '合并到的标签名不合法'); redirect('admin/metas/manage/tag'); } } $this->metas_mdl->merge_meta($merge, $type, $metas); $this->session->set_flashdata('success', $this->_map[$type] . '已被合并'); } else { $this->session->set_flashdata('error', '请选择需要合并到的' . $this->_map[$type]); } go_back(); }
WriteConfig('ATTACHMENT', $ATTACHMENT); $actiontime = date("F j, Y, g:i a"); write_log("Tracker ATTACHMENT settings updated by {$CURUSER['username']}. {$actiontime}", 'mod'); go_back(); } elseif ($action == 'savesettings_advertisement') { stdhead($lang_settings['head_save_advertisement_settings']); $validConfig = array('enablead', 'enablenoad', 'noad', 'enablebonusnoad', 'bonusnoad', 'bonusnoadpoint', 'bonusnoadtime', 'adclickbonus'); GetVar($validConfig); unset($ADVERTISEMENT); foreach ($validConfig as $config) { $ADVERTISEMENT[$config] = ${$config}; } WriteConfig('ADVERTISEMENT', $ADVERTISEMENT); $actiontime = date("F j, Y, g:i a"); write_log("Tracker ADVERTISEMENT settings updated by {$CURUSER['username']}. {$actiontime}", 'mod'); go_back(); } elseif ($action == 'tweaksettings') { stdhead($lang_settings['head_tweak_settings']); print $notice; print "<form method='post' action='" . $_SERVER["SCRIPT_NAME"] . "'><input type='hidden' name='action' value='savesettings_tweak' />"; yesorno($lang_settings['row_save_user_location'], 'where', $TWEAK["where"], $lang_settings['text_save_user_location_note']); yesorno($lang_settings['row_log_user_ips'], 'iplog1', $TWEAK["iplog1"], $lang_settings['text_store_user_ips_note']); tr($lang_settings['row_kps_enabled'], "<input type='radio' id='bonusenable' name='bonus'" . ($TWEAK["bonus"] == "enable" ? " checked='checked'" : "") . " value='enable' /> <label for='bonusenable'>" . $lang_settings['text_enabled'] . "</label> <input type='radio' id='bonusdisablesave' name='bonus'" . ($TWEAK["bonus"] == "disablesave" ? " checked='checked'" : "") . " value='disablesave' /> <label for='bonusdisablesave'>" . $lang_settings['text_disabled_but_save'] . "</label> <input type='radio' id='bonusdisable' name='bonus'" . ($TWEAK["bonus"] == "disable" ? " checked='checked'" : "") . " value='disable' /> <label for='bonusdisable'>" . $lang_settings['text_disabled_no_save'] . "</label> <br />" . $lang_settings['text_kps_note'], 1); yesorno($lang_settings['row_enable_location'], 'enablelocation', $TWEAK["enablelocation"], $lang_settings['text_enable_location_note']); yesorno($lang_settings['row_enable_tooltip'], 'enabletooltip', $TWEAK["enabletooltip"], $lang_settings['text_enable_tooltip_note']); tr($lang_settings['row_title_keywords'], "<input type='text' style=\"width: 300px\" name='titlekeywords' value='" . ($TWEAK["titlekeywords"] ? $TWEAK["titlekeywords"] : '') . "' /> <br />" . $lang_settings['text_title_keywords_note'], 1); tr($lang_settings['row_promotion_link_example_image'], "<input type='text' style=\"width: 300px\" name='prolinkimg' value='" . ($TWEAK["prolinkimg"] ? $TWEAK["prolinkimg"] : 'pic/prolink.png') . "' /> <br />" . $lang_settings['text_promotion_link_example_note'], 1); tr($lang_settings['row_meta_keywords'], "<input type='text' style=\"width: 300px\" name='metakeywords' value='" . ($TWEAK["metakeywords"] ? $TWEAK["metakeywords"] : '') . "' /> <br />" . $lang_settings['text_meta_keywords_note'], 1); tr($lang_settings['row_meta_description'], "<textarea cols=\"100\" style=\"width: 450px;\" rows=\"5\" name='metadescription'>" . ($TWEAK["metadescription"] ? $TWEAK["metadescription"] : '') . "</textarea> <br />" . $lang_settings['text_meta_description_note'], 1); tr($lang_settings['row_web_analytics_code'], "<textarea cols=\"100\" style=\"width: 450px;\" rows=\"5\" name='analyticscode'>" . ($TWEAK["analyticscode"] ? $TWEAK["analyticscode"] : '') . "</textarea> <br />" . $lang_settings['text_web_analytics_code_note'], 1); tr($lang_settings['row_see_sql_debug'], "<input type='checkbox' name='enablesqldebug' value='yes'" . ($TWEAK['enablesqldebug'] == 'yes' ? " checked='checked'" : "") . " />" . $lang_settings['text_allow'] . classlist('sqldebug', UC_STAFFLEADER, $TWEAK['sqldebug'], UC_MODERATOR) . $lang_settings['text_see_sql_list'] . get_user_class_name(UC_SYSOP, false, true, true), 1);
private function _redirect_with_msg($flag, $msg) { $this->session->set_flashdata($flag, $msg); go_back(); }
function smskey() { if (!is_logged()) { redirect(base_url()); } $this->config->load('rf_sms', FALSE, TRUE); $this->data['title'] = lang('off_votesms'); $s_pair = office_secure(trim($this->input->post('s_pair'))); #http://rf.mmotop.ru/sms/2650/?s_pair=dds34fr&votes_charname=&votes_server=167 $link = config('link') . '?s_pair=' . $s_pair . '&votes_charname=&votes_server=' . config('vote_server'); $html_page = file_get_contents($link); $html_page = iconv('UTF-8', 'CP1251', $html_page); $pos = strpos($html_page, 'Ваш голос учтен'); if ($pos == TRUE) { bonus_add(Get_AccountSerial(), config('pay')); $this->data['content'] = icon('32x32/accept.png') . lang('off_votesms_ok'); log_in_history('Получены бонусы за SMS голосование'); } else { log_in_history('Неудачная попытка получения бонуса за SMS'); $this->data['content'] = icon('32x32/delete.png') . lang('off_votesms_err') . go_back(); } compile(); }
public function edit() { $theme = $this->input->post('theme', TRUE); $file = $this->input->post('file', TRUE); $content = htmlspecialchars_decode($this->input->post('content', TRUE)); $path = FCPATH . ST_THEMES_DIR . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . $file; if (file_exists($path) && is_writeable($path)) { if (write_file($path, $content)) { $this->session->set_flashdata('success', '文件 ' . $file . ' 的更改已经保存'); } else { $this->session->set_flashdata('success', '文件 ' . $file . ' 无法被写入'); } go_back(); } else { show_error('您编辑的文件不存在'); exit; } }
function doit() { global $HTTP_POST_VARS, $nodeinfo; if (!defined("RED_NOTIFICATION_INC")) { } include "messages/red_notification.inc"; if (!defined("USER_INC")) { } include "dbapi/user.inc"; $errstr = '<ul>'; if ($HTTP_POST_VARS['expert_type'] == 'auto') { delete_expert($nodeinfo['id']); if ($HTTP_POST_VARS['old_expert'] != "") { $user = get_user_from_name($HTTP_POST_VARS['old_expert']); if ($user != -1) { if (isset($HTTP_POST_VARS['field_notify_user'])) { send_red_notification(LTMSG_FETERMN, $user['User_ID'], $nodeinfo['id']); } } } } else { if ($HTTP_POST_VARS['field_expert'] == "") { $errstr .= '<li>You have to enter an expert'; } else { if (!is_valid_expert($HTTP_POST_VARS['field_expert'])) { $errstr .= '<li>The expert you specified could not be found in the database.'; } } if ($HTTP_POST_VARS['field_description'] == "") { $errstr .= '<li>Please enter a descripiton for your expert.'; } if ($errstr != '<ul>') { $predef['Name'] = $HTTP_POST_VARS['field_expert']; $predef['About'] = $HTTP_POST_VARS['field_description']; print_error($errstr . '</ul>', $predef); } $currexp = get_def_expert($nodeinfo['id']); $newexp_id = get_user_from_name($HTTP_POST_VARS['field_expert']); $newexp_id = $newexp_id['User_ID']; if (is_array($currexp)) { edit_expert($nodeinfo['id'], $HTTP_POST_VARS['field_expert'], $HTTP_POST_VARS['field_description']); if ($HTTP_POST_VARS['old_expert'] != "") { $user = get_user_from_name($HTTP_POST_VARS['old_expert']); if ($user != -1) { if (isset($HTTP_POST_VARS['field_notify_user'])) { send_red_notification(LTMSG_FETERMN, $user['User_ID'], $nodeinfo['id']); } } } if (isset($HTTP_POST_VARS['field_notify_user'])) { send_red_notification(LTMSG_FEELECT, $newexp_id, $nodeinfo['id']); } } else { add_expert($nodeinfo['id'], $HTTP_POST_VARS['field_expert'], $HTTP_POST_VARS['field_description']); if (isset($HTTP_POST_VARS['field_notify_user'])) { send_red_notification(LTMSG_FEELECT, $newexp_id, $nodeinfo['id']); } } } go_back(); }
/** * 批量删除用户 * * @access public * @return void */ public function remove() { $users = $this->input->post('uid', TRUE); $deleted = 0; if ($users && is_array($users)) { foreach ($users as $user) { /** 不能删除自己 */ if ($user == $this->user->uid) { continue; } $posts_num = $this->posts_mdl->get_posts_by_author($user)->num_rows(); /** 不能删除文章数大于0的作者 */ if ($posts_num > 0) { continue; } $this->users_mdl->remove_user($user); $deleted++; } } $msg = $deleted > 0 ? '用户已经删除' : '没有用户被删除'; $notify = $deleted > 0 ? 'success' : 'error'; $this->session->set_flashdata($notify, $msg); go_back(); }
function meta_exist($def) { global $hlpfile, $language, $f_meta_nom, $f_titre, $adminimg; include "header.php"; GraphicAdmin($hlpfile); adminhead($f_meta_nom, $f_titre, $adminimg); echo ' <hr /> <div class="alert alert-danger"> <strong>' . $def . '</strong> <br />' . adm_translate("Ce META-MOT existe déjà") . '<br />' . adm_translate("Veuillez nommer différement ce nouveau META-MOT") . '<br /><br />'; echo go_back(''); echo ' </div>'; adminfoot('', '', '', ''); }
/** * 批量删除文章 * * @access private * @return void */ private function _remove() { $posts = $this->input->post('pid', TRUE); $deleted = 0; if ($posts && is_array($posts)) { foreach ($posts as $post) { if (empty($post)) { continue; } $content = $this->posts_mdl->get_post_by_id('pid', $post); if ($content && ($this->auth->exceed('editor', TRUE) || $content->authorId == $this->user->uid)) { /** remove post */ $this->posts_mdl->remove_post($post); /** remove related attachments */ $attachments = $this->posts_mdl->get_posts_by_order($post); if ($attachments->num_rows() > 0) { foreach ($attachments->result() as $attachment) { $info = unserialize($attachment->text); /** delete the file physically */ @unlink(FCPATH . $info['path']); /** delete the data in DB */ $this->posts_mdl->remove_post($attachment->pid); } } $metas = $this->metas_mdl->get_metas($post, TRUE); /** remove the relationship */ foreach ($metas as $meta) { $this->metas_mdl->meta_num_minus($meta['mid']); } $this->metas_mdl->remove_relationship('pid', $post); $deleted++; } $content = NULL; } } $deleted > 0 ? $this->session->set_flashdata('success', '成功删除文章及其附件') : $this->session->set_flashdata('error', '没有文章被删除'); go_back(); }
function lostpassword() { $stop = ''; $user = get_user(); $text = ''; $login = office_secure(trim($this->input->post('login', true))); $master_answer = md5(office_secure(trim($this->input->post('master_answer', true)))); if ($login == '' || $this->input->post('master_answer') == '') { redirect('main_index/lost', 'refresh'); } if (FastCheckBan(Get_AS(office_secure($login)))) { $stop = "You account is banned!"; } $query_auth = $this->MSSQL->query("SELECT * FROM {$user}.dbo.tbl_UserAccount WHERE id = '" . xss_clean($login) . "'"); if ($query_auth->num_rows() > 0) { foreach ($query_auth->result() as $row) { $seriala = $row->serial; } if (check_master_answer($seriala)) { $master_answer_query = show_master_answer($seriala); } else { $stop = lang('off_lost_error'); } } else { $stop = lang('off_lost_error'); } if ($stop == '') { $query = $this->MSSQL->query("SELECT id,Password FROM {$user}.dbo." . config('table_account', 'query') . " WHERE id = '" . $login . "'"); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $id_query = $row->id; $Password_query = $row->Password; } } else { $stop = lang('off_lost_error'); } } if ($stop == '') { if ($master_answer_query == $master_answer) { if (preg_name($Password_query) == '') { exit('Permabanned!'); } $this->session->set_userdata('login', xss_clean($login)); $this->session->set_userdata('passw', xss_clean($Password_query)); $this->session->set_userdata('lost_p', xss_clean($master_answer)); redirect('main', 'refresh'); } else { } } else { $text = $stop; } $this->data['content'] = icon('64x64/delete_user.png') . br(2) . go_back('', true) . $text; compile(); }
function check() { $this->load->library('validation'); // получем данные $login = office_secure(xss_clean($this->input->post('login'))); $id = office_secure(xss_clean($this->input->post('id'))); $password = office_secure(xss_clean($this->input->post('password'))); $email = office_secure(xss_clean($this->input->post('email'))); $part = office_secure(xss_clean($this->input->post('part'))); $secure = office_secure(xss_clean($this->input->post('secure'))); $stop = array(); // начинаем проверки if (!$this->validation->required($login)) { $stop[] = lang('off_reg_login_check'); } if (!$this->validation->required($password)) { $stop[] = lang('off_reg_pass_chk'); } if ($this->validation->alpha($password)) { $stop[] = lang('off_reg_pass_range'); } if (!$this->validation->valid_email($email)) { $stop[] = lang('off_reg_email'); } $sec_code_session = $this->session->userdata('sec_code_session'); //fix at 03.10.2011 if (preg_match("/[^0-9a-zA-Z_-]/", $login)) { $stop[] = lang('off_useletters'); } if (preg_match("/[^0-9a-zA-Z_-]/", $password)) { $stop[] = lang('off_useletters'); } if ($sec_code_session) { if ($sec_code_session != md5($secure)) { $stop[] = lang('off_reg_captha'); } } else { if ($_SESSION['sec_code_session'] != md5($secure)) { $stop[] = lang('off_reg_captha'); } } if (!$this->validation->valid_ip($this->session->userdata('ip_address'))) { $stop[] = lang('off_reg_chkip'); } if ($login === $password) { $stop[] = lang('off_reg_chk_logpass'); } if (count($stop) == 0) { $user = get_user(); // проверка на логин $query = $this->MSSQL->query("SELECT * FROM {$user}.dbo." . query_config('table_account') . " WHERE id = '{$login}'"); if ($query->num_rows() > 0) { $stop[] = lang('off_reg_loginuse'); } // проверка на мыло $query = $this->MSSQL->query("SELECT * FROM {$user}.dbo." . query_config('table_account') . " WHERE Email = '{$email}'"); if ($query->num_rows() > 0) { $stop[] = lang('off_reg_emailuse'); } // проверка на пароль $query = $this->MSSQL->query("SELECT * FROM {$user}.dbo." . query_config('table_account') . " WHERE password = '******'"); if ($query->num_rows() > 0) { $stop[] = lang('off_reg_passuse'); } // завершение реги if (count($stop) == 0) { // регистрация $this->config->load('core', FALSE, TRUE); $register = query_config('query_register'); $this->MSSQL->query($register, array($login, $password, $email)); var_dump($this); $result = $this->MSSQL->query("SELECT SCOPE_IDENTITY() AS [SCOPE_IDENTITY]"); var_dump($result); exit; $this->config->load('rf_settings', FALSE, TRUE); if ($id != '') { bonus_add($id, $this->config->item('REF_BONUS')); } elseif ($part != '') { bonus_add(GetASerialFromName($part), $this->config->item('REF_BONUS')); } $this->data['content'] = icon('48x48/image_accept.png') . lang('off_reg_comp') . go_back(); // не прошли проверки } else { $this->data['content'] = heading(icon('48x48/delete_image.png') . lang('off_reg_error'), 4) . ul($stop) . go_back('', true); } } else { $this->data['content'] = heading(icon('48x48/delete_image.png') . lang('off_reg_error'), 4) . ul($stop) . go_back('', true); } compile(); }
function meta_exist($def) { global $hlpfile, $language; include "header.php"; GraphicAdmin($hlpfile); echo "<p align=\"center\"><br />"; echo "<span class=\"rouge\"><b>"; echo $def . "</b></span><br /><br />"; echo adm_translate("Ce META-MOT existe déjà"); echo "<br /><br />" . adm_translate("Veuillez nommer différement ce nouveau META-MOT") . "."; go_back(""); include "footer.php"; }
function acceptdelitem() { $num = office_secure($this->input->post('num')); $serial = office_secure($this->input->post('serial')); $this->data['title'] = lang('off_acceptdelitemtitle'); $world = get_world(); if ($num > 100) { redirect(base_url()); } if (!is_numeric($serial)) { redirect('main'); } if (!secure_serial_check($serial)) { redirect('#warn'); } $this->MSSQL->query("UPDATE {$world}.dbo.tbl_inven SET K{$num}='-1', D{$num}='0',U{$num}=0xfffffff WHERE Serial='{$serial}'"); $this->data['content'] = icon('32x32/trash_can.png') . lang('off_acceptdelitem_suss') . go_back('main/inven/' . $serial); compile(); }
function transfer() { global $uid; global $fleet; global $PHP_SELF; global $HTTP_REFFERRER; if (!is_array($fleet)) { show_error("You have to select a fleet and some ships in order to transfer!"); return 0; } $i = 0; while (list($key, $value) = each($fleet)) { if ($value == "Y") { $fleets[$i] = new fleet($key); if (!$fleets[$i]->uid == $uid) { show_error("Hello! I'm your friend...Why are you trying such nasty things?"); return 0; } if (!$pid) { $pid = $fleets[$i]->pid; $sid = $fleets[$i]->sid; } else { if ($fleets[$i]->pid != $pid || $fleets[$i]->sid != $sid) { show_error("You may only select fleets which are at the same planet and system!"); return 0; } } } $i++; } $new_fleet = new fleet(); echo "<form action=\"" . $PHP_SELF . "\" method=post>"; for ($i = 0; $i < sizeof($fleets); $i++) { $temp_var = "fleet_" . $fleets[$i]->fid; global ${$temp_var}; foreach ((array) ${$temp_var} as $key => $value) { // Überprüfen ob die werte ok sind (key=>prod_id, value=>count) if ($fleets[$i]->ships[$key] && $fleets[$i]->ships[$key][0] >= $value && (int) $value > 0) { // Das wird nachher ausgelesen um die flotten auch um den wert zu reduzieren $fleets[$i]->ships[$key][0] -= $value; $aff_fleets[] = $fleets[$i]->fid; $new_fleet->add_ships_arr(array($key => array($value, $fleets[$i]->ships[$key][1]))); } elseif ($value == 0) { continue; } else { show_error("You entered a wrong shipcount for fleet " . $fleets[$i]->name . "!"); return 0; } form_hidden("fleet_" . $fleets[$i]->fid . "[" . $key . "]", $value); } } $fids = get_fids_by_pid($pid, $uid, $sid); for ($i = 0; $i < sizeof($fleets); $i++) { // mop: was für nen toller hack if (in_array($fleets[$i]->fid, $fids)) { // mop: umdrehen, damit wir das unsetten können ohne das array komplett durchsuchen zu müssen $fids_tmp = array_flip($fids); unset($fids_tmp[$fleets[$i]->fid]); // mop: und wieder zurück $fids = array_flip($fids_tmp); } form_hidden("fid[" . $i . "]", $fleets[$i]->fid); } // mop: wenn fertig fidsarray neubauen $fids = array_values($fids); // mop: jetzt die ausgewählten flotten abwählen for ($i = 0; $i < sizeof($fids); $i++) { $trans_fleets[$i] = new fleet($fids[$i]); } if (sizeof($trans_fleets) == 0) { center_headline("You have no fleets you could transfer these ships to:)"); go_back($_SERVER["PHP_SELF"]); } else { for ($i = 0; $i < sizeof($trans_fleets); $i++) { $head_array = ""; $text_arr = ""; $prod_arr = ""; table_start("center", "80%"); table_head_text(array("Fleet " . $trans_fleets[$i]->name), "20"); $head_array[0] = " "; $prod_arr[0] = ""; $text_arr[0] = "<input type=radio name=\"fleet\" value=\"" . $trans_fleets[$i]->fid . "\">"; reset($trans_fleets[$i]); while (list($prod_id, $ship_arr) = each($trans_fleets[$i]->ships)) { $head_array[] = get_name_by_prod_id($prod_id); $text_arr[] = $ship_arr[0]; } $mission = $trans_fleets[$i]->get_mission(); list($type, $location) = $trans_fleets[$i]->get_location(); if ($type == 0) { $mission_text = $mission[0] . " "; } else { $mission_text = "On its way to " . $mission[1] . " "; } list($location_id, $location_type) = $location; if ($location_type == 0) { $mission_text .= "planet " . get_planetname($trans_fleets[$i]->pid); $location_text = "Planet " . get_planetname($trans_fleets[$i]->pid) . "(" . get_systemname($trans_fleets[$i]->sid) . ")"; } else { $mission_text .= "system " . get_system_coords($trans_fleets[$i]->sid); $location_text = "System " . get_systemname($trans_fleets[$i]->sid); } table_text(array(" "), "", "", "20", "head"); table_text_open(); table_text_design("Mission:", "50", "", "", "smallhead"); table_text_design($mission_text, "", "", "19", "text"); table_text_close(); table_text($head_array, "", "", "", "smallhead"); table_text($text_arr, "", "", "", "text"); table_end(); echo "<br><br>\n"; } form_hidden("act", "transferab"); echo "<center>\n"; echo "<input type=submit value=\"Transfer\">"; echo "</center>\n"; echo "</form>"; } }
/** * 批量删除页面 * * @access public * @return void */ public function remove() { /** privilege confirm */ $this->auth->exceed('editor'); $pages = $this->input->post('pid', TRUE); $deleted = 0; if ($pages && is_array($pages)) { foreach ($pages as $page) { if (empty($page)) { continue; } /** remove post */ $this->posts_mdl->remove_post($page); /** remove related attachments */ $attachments = $this->posts_mdl->get_posts_by_order($page); if ($attachments->num_rows() > 0) { foreach ($attachments->result() as $attachment) { $info = unserialize($attachment->text); /** delete the file physically */ @unlink(FCPATH . $info['path']); /** delete the data in DB */ $this->posts_mdl->remove_post($attachment->pid); } } $deleted++; } } $deleted > 0 ? $this->session->set_flashdata('success', '成功删除页面及其附件') : $this->session->set_flashdata('error', '没有页面被删除'); go_back(); }