public function signup() { switch ($_SERVER['REQUEST_METHOD']) { case 'GET': if (isset($_SESSION['user'])) { show_message('message success', "You're already connected as " . $_SESSION['user']); include 'views/home.php'; } else { include 'views/signup.php'; } break; case 'POST': if (isset($_POST['login']) && isset($_POST['password']) && isset($_POST['password_check'])) { $exist = User::exist_login($_POST['login']); if (!$exist) { if ($_POST['password'] == $_POST['password_check']) { User::insert(htmlspecialchars($_POST['login']), sha1($_POST['password']), htmlspecialchars($_POST['email'])); show_message('message success', "Signup of " . $_POST['login'] . ' !'); include 'views/signin.php'; } else { show_message('message error', "Not same password"); include 'views/signup.php'; } } else { show_message('message error', "Enter other information"); include 'views/signup.php'; } } else { show_message('message error', "Incomplete data!"); include 'views/signup.php'; } break; } }
public function actionCreate() { global $db_url; $url = parse_url($db_url); $url['path'] = urldecode($url['path']); $dbname = substr($url['path'], 1); is_admin(); $dir = "data/{$dbname}/"; if (!class_exists('ZipArchive')) { show_message(t('BACKUP_NOTSUPPORT'), true, 'index.php?action=control_panel&subtab=message'); } if (!is_flatfile()) { show_message(t('BACKUP_TYPE_NOTSUPPORT'), true, 'index.php?action=control_panel&subtab=message'); } $zip = new ZipArchive(); $filename = $dir . "backup-" . date('Ymd', time()) . ".zip"; if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) { exit("cannot open <{$filename}>\n"); } $d = dir($dir); while (false !== ($entry = $d->read())) { if (substr($entry, -4) == '.txt') { $zip->addFile($dir . $entry); } } $d->close(); $zip->close(); header("Location:{$filename}"); }
function user_has_got_integral($type, $user_id, $ever_validated = 0) { switch ($type) { case 'phone': if ($ever_validated == '0' || $ever_validated == 0) { $ever_validated = 2; } if ($ever_validated == '1' || $ever_validated == 1) { $ever_validated = 3; } break; case 'email': if ($ever_validated == '0' || $ever_validated == 0) { $ever_validated = 1; } if ($ever_validated == '2' || $ever_validated == 2) { $ever_validated = 3; } break; default: break; } $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET ever_validated = '{$ever_validated}' WHERE user_id='{$user_id}'"; if (!$GLOBALS['db']->query($sql)) { show_message('标记用户验证手机/邮箱失败', $_LANG['profile_lnk'], 'user.php'); } }
/** * check plugin requirements */ public static function procdn_requirements_check() { // WordPress version check if (version_compare($GLOBALS['wp_version'], PROCDN_MIN_WP . 'alpha', '<')) { show_message(sprintf('<div class="error"><p>%s</p></div>', sprintf(__("PROCDN is optimized for WordPress %s. Please disable the plugin or upgrade your WordPress installation (recommended).", "cdn"), PROCDN_MIN_WP))); } }
function modify_pwd() { $this->load->library('form_validation'); //验证 $validation = array(array('field' => 'oldpwd', 'label' => '旧密码', 'rules' => 'required|callback_oldpwd_check'), array('field' => 'newpwd', 'label' => '新密码', 'rules' => 'required'), array('field' => 'reqpwd', 'label' => '确认密码', 'rules' => 'required|matches[newpwd]')); $this->form_validation->set_rules($validation); //设置验证 //设置验证消息 $this->form_validation->set_message('required', '%s不能为空!'); $this->form_validation->set_message('oldpwd_check', '%s验证失!'); $this->form_validation->set_message('matches', '%s与%s不匹配!'); $this->form_validation->set_error_delimiters('<span class="round alert label">', '</span>'); //修改错误提示定界符 //表单提交验证 if ($this->form_validation->run() === FALSE) { $data['title'] = '管理员修改密码'; $this->load->view('templates/header', $data); $this->load->view('templates/top_navbar'); $this->load->view('user/modify_pwd', $data); $this->load->view('templates/footer'); } else { //验证成功是显示的消息 $data = array('password' => md5($this->input->post('newpwd'))); $this->admin_model->update($_SESSION['auth_admin'], $data); show_message($this, get_message_data('修改密码', '密码修改成功,下次登录时请使用新密码!', 0, current_url(), 3)); } }
function or_query($query, $pars = array()) { global $db; $id = start_query_timer($query, $pars); try { if (is_array($pars) && count($pars) > 0) { // parametrized query $stmt = $db->prepare($query); if (isset($pars[0]) && is_array($pars[0])) { foreach ($pars as $tpars) { $stmt->execute($tpars); } } else { $stmt->execute($pars); } } else { // non-parametrized query $stmt = $db->query($query); } } catch (PDOException $e) { show_message('<pre>Query error: ' . $e->getMessage() . "\nQuery: " . $query . "</pre>"); } $end = stop_query_timer($id); return $stmt; }
/** * Upgrade the XPressME . * * @param string $from New release unzipped path. * @param string $to Path to old WordPress installation. * @return WP_Error|null WP_Error on failure, null on success. */ function update_xpress($from, $to) { global $wp_filesystem, $_old_xpress_files, $wpdb; show_message( __('Disable overwrite of wp-config.php...', 'xpressme') ); // remove wp-config.php from the new version into place. $wp_config = $from . 'wp-config.php'; if ( !$wp_filesystem->delete($wp_config, true)){ return new WP_Error('delete_failed', $this->strings['delete_failed']); } // Copy new versions of XPressME Integration Kit files into place. show_message( __('Copy new versions of XPressME Integration Kit files into place...', 'xpressme') ); $result = copy_dir($from . $distro, $to); if ( is_wp_error($result) ) { $wp_filesystem->delete($maintenance_file); $wp_filesystem->delete($from, true); return $result; } // Remove old files show_message( __('Remove an unnecessary, old file...', 'xpressme') ); foreach ( $_old_xpress_files as $old_file ) { $old_file = $to . $old_file; if ( !$wp_filesystem->exists($old_file) ) continue; $wp_filesystem->delete($old_file, true); } show_message( __('Set templates directory chmod 777', 'xpressme') ); $wp_filesystem->chmod($to . 'templates/', 0777); // Remove working directory $working_dir = dirname(dirname($from)); show_message( sprintf(__('Remove working directory(%s)...', 'xpressme'),$working_dir) ); $wp_filesystem->delete($working_dir, true); }
public function do_login() { /** 检查登陆 */ if ($this->auth->is_admin()) { redirect('admin/login/index'); } $data['title'] = '用户登录'; if ($_POST) { $data = array('username' => $this->input->post('username', TRUE), 'password' => $this->input->post('password', TRUE)); if ($this->user_m->login($data)) { $uid = $this->session->userdata('uid'); //更新积分 $this->config->load('userset'); $this->user_m->update_credit($uid, $this->config->item('credit_login')); //更新最后登录时间 $this->user_m->update_user($uid, array('lastlogin' => time())); redirect('admin/login/index'); } else { show_message('用户名或密错误!'); } $captcha = $this->input->post('captcha_code'); if ($this->config->item('show_captcha') == 'on' && $this->session->userdata('yzm') != $captcha) { show_message('验证码不正确'); } } else { $data['csrf_name'] = $this->security->get_csrf_token_name(); $data['csrf_token'] = $this->security->get_csrf_hash(); $this->load->view('do_login', $data); } }
public function show($tag_title, $page = 1) { $data['title'] = urldecode(strip_tags($tag_title)); //分页 $limit = 10; $config['uri_segment'] = 4; $config['use_page_numbers'] = TRUE; $config['base_url'] = url('tag_show', '', $data['title']); $data['tag'] = $this->db->select('topics')->where('tag_title', $data['title'])->get('tags')->row_array(); $config['total_rows'] = @$data['tag']['topics']; $config['per_page'] = $limit; $config['first_link'] = '首页'; $config['last_link'] = '尾页'; $config['num_links'] = 10; $this->load->library('pagination'); $this->pagination->initialize($config); $start = ($page - 1) * $limit; $data['pagination'] = $this->pagination->create_links(); $data['tag_list'] = $this->tag_m->get_tag_topics_list($start, $limit, $data['title']); if ($data['tag_list']) { $this->load->view('tag_show', $data); } else { show_message('标签不存在', site_url()); } }
function after() { $plugin_file = $this->upgrader->plugin_info(); $install_actions = array(); $from = isset($_GET['from']) ? stripslashes($_GET['from']) : 'plugins'; // One-Click flow if (!empty($_GET['also']) && $_GET['also'] == 'activate') { if (!$this->result || is_wp_error($this->result)) { show_message(__('Cannot activate plugin.', 'wpsc')); } else { show_message(__('Activating the plugin…', 'wpsc')); echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&networkwide=0&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '"></iframe>'; } } else { $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin', 'wpsc') . '" target="_parent">' . __('Activate Plugin', 'wpsc') . '</a>'; if (is_multisite() && current_user_can('manage_network_plugins')) { $install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&networkwide=1&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network', 'wpsc') . '" target="_parent">' . __('Network Activate', 'wpsc') . '</a>'; unset($install_actions['activate_plugin']); } } $install_actions['store'] = '<a href="' . Sputnik_Admin::build_url() . '" title="' . esc_attr__('Return to Store', 'wpsc') . '" target="_parent" class="close">' . __('Return to Store', 'wpsc') . '</a>'; if (!$this->result || is_wp_error($this->result)) { unset($install_actions['activate_plugin']); unset($install_actions['network_activate']); } $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file); if (!empty($install_actions)) { $this->feedback(implode(' | ', (array) $install_actions)); } }
function show_profile_edit_form($db) { //require 'CUsers.php'; // Get information of logged user. $cUsers = new CUsers($db); $ret = $cUsers->getUserInfo($_SESSION['id']); // Create birthdate in correct format. $tmp = explode('-', $ret[0]['birthdate']); $ret[0]['birthdate'] = $tmp[2] . '.' . $tmp[1] . '.' . $tmp[0]; // Fields to add in form $fields = array('id' => 'hidden', 'firstname' => 'text', 'lastname' => 'text', 'city' => 'text', 'homepage' => 'text', 'birthdate' => 'text', 'email' => 'text', 'password' => 'password', 'password_again' => 'password'); // Field names $field_names = array('firstname' => 'Etunimi', 'lastname' => 'Sukunimi', 'password' => 'Salasana', 'password_again' => 'Salasana uudelleen', 'city' => 'Kaupunki', 'homepage' => 'Kotisivu', 'birthdate' => 'Syntymäpäivä (pv.kk.vvvv)', 'email' => 'Sähköposti'); echo '<div class="edit_profile">'; // Show message if there is any. // For example message will be shown if user has changed // his/her profile. show_message(); echo '<form action="edit_profile.php" method="post">'; echo '<table>'; // Add every field in the form. foreach ($fields as $key => $value) { echo '<tr>'; // We do not want add empty input boxes for hidden values! if ($value != 'hidden') { echo '<td>'; echo $field_names[$key]; echo '</td>'; echo '<td>'; // If text field is other than password, then we // should get user information as an default value. if ($key != 'password' && $key != 'password_again') { // If we are going to show birthdate, let's check // if it is empty value, eg. 00.00.0000. If it is, // then we want to show just empty string instead // of that 00.00.0000. if ($key == 'birthdate' && $ret[0][$key] == '00.00.0000') { $ret[0][$key] = ''; } echo '<input type="' . $value . '" value="' . $ret[0][$key] . '" name="' . $key . '">'; } else { echo '<input type="' . $value . '" name="' . $key . '">'; } echo '</td>'; } echo '</tr>'; } // "Päivitä tiedot" -button. echo '<tr>'; echo '<td colspan="2">'; echo '<input type="submit" value="Päivitä">'; echo '</td>'; echo '</tr>'; echo '</table>'; echo '<div class="bottom_note">'; echo 'Huom! Jos jätät salasanakentät tyhjäksi, salasana ' . 'pysyy muuttamattomana!'; echo '</div>'; echo '</form>'; echo '</div>'; }
function user_login($username = '', $password = '', $ret = false) { if (empty($username)) { if (!$ret) { show_message('Please enter your username!'); } else { $GLOBALS['smarty']->assign('error_mesg', 'Please enter your username!'); return false; } } if (empty($password)) { if (!$ret) { show_message('Please enter your password!'); } else { $GLOBALS['smarty']->assign('error_mesg', 'Please enter your password!'); return false; } } $password = md5($password); $user = $GLOBALS['db']->getRow("select * from author where username='******' and password='******'"); if (empty($user['user_id'])) { if (!$ret) { show_message('Wrong username or password!'); } else { $GLOBALS['smarty']->assign('error_mesg', 'Wrong username or password!'); return false; } } setcookie('user_id', $user['user_id'], time() + $GLOBALS['cookie_expire'] * 24 * 60 * 60); setcookie('password', $user['password'], time() + $GLOBALS['cookie_expire'] * 24 * 60 * 60); $GLOBALS['login_user'] = $user; $GLOBALS['smarty']->assign('login_user', $user); return true; }
public function logout($value = '') { $this->session->unset_userdata($this->session->userdata('user')); $this->session->sess_destroy(); show_message("已退出登录。", "/", 302); // header("location: http://".$_SERVER['HTTP_HOST']."/dede/bishe/index.php"); }
public function show($node_id, $page = 1) { //权限 if (!$this->auth->user_permit($node_id)) { show_message('您无限访问此节点', site_url()); } else { //分页 $limit = 10; $config['uri_segment'] = 4; $config['use_page_numbers'] = TRUE; $config['base_url'] = site_url('node/show/' . $node_id); $config['total_rows'] = $this->topic_m->count_topics($node_id); $config['per_page'] = $limit; $config['first_link'] = '首页'; $config['last_link'] = '尾页'; $config['num_links'] = 10; $this->load->library('pagination'); $this->pagination->initialize($config); $start = ($page - 1) * $limit; $data['pagination'] = $this->pagination->create_links(); //获取列表 $data['topic_list'] = $this->topic_m->get_topics_list($start, $limit, $node_id); $data['category'] = $this->cate_m->get_category_by_node_id($node_id); $data['title'] = strip_tags($data['category']['cname']); //获取分类 $this->load->model('cate_m'); $data['catelist'] = $this->cate_m->get_all_cates(); $this->load->view('node_show', $data); } }
function __construct() { parent::__construct(); /** 检查登陆 */ if (!$this->auth->is_admin()) { show_message('非管理员或未登录', site_url('admin/login/do_login')); } }
/** * TrackEmailStatAct::actIndex() * 列出符合条件的数据并分页显示 * @param string $condition 查询条件 * @param integer $curpage 页码 * @param integer $pagenum 每页个数 * @return array */ public function actIndex() { $data = array(); $condition = ''; $trackEmailStat = new TrackEmailStatModel(); //接收参数生成条件 $curpage = isset($_GET['page']) ? abs(intval($_GET['page'])) : 1; $type = isset($_GET['type']) ? trim($_GET['type']) : ''; $key = isset($_GET['key']) ? post_check(trim($_GET['key'])) : ''; $timeNode = isset($_GET['timeNode']) ? post_check(trim($_GET['timeNode'])) : ''; $condition .= "1"; if ($type && $key) { if (!in_array($type, array('trackNumber', 'platAccount'))) { redirect_to("index.php?mod=trackEmailStat&act=index"); } $condition .= ' AND ' . $type . " = '" . $key . "'"; } if (!empty($timeNode)) { if (!in_array($timeNode, array('addTime', 'lastTime'))) { redirect_to("index.php?mod=trackEmailStat&act=index"); } $startTime = isset($_GET['startTime']) ? strtotime(trim($_GET['startTime']) . " 00:00:00") : strtotime(date("Y-m-d", time()) . " 00:00:00"); $endTime = isset($_GET['endTime']) ? strtotime(trim($_GET['endTime']) . " 23:59:59") : strtotime(date("Y-m-d", time()) . " 23:59:59"); if ($startTime && $endTime) { $condition .= ' AND ' . $timeNode . " BETWEEN '" . $startTime . "' AND " . "'" . $endTime . "'"; } } //获取符合条件的数据并分页 $pagenum = 20; $total = $trackEmailStat->modListCount($condition); $res = $trackEmailStat->modList($condition, $curpage, $pagenum); $page = new Page($total, $pagenum, '', 'CN'); $pageStr = ""; if ($res) { if ($total > $pagenum) { $pageStr = $page->fpage(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $pageStr = $page->fpage(array(0, 1, 2, 3)); } } else { $pageStr = '暂无数据'; } //封装数据返回 $data['key'] = $key; $data['type'] = $type; $data['lists'] = $res; $data['pages'] = $pageStr; $data['timeNode'] = $timeNode; $data['startTime'] = $startTime ? date('Y-m-d', $startTime) : ''; $data['endTime'] = $endTime ? date('Y-m-d', $endTime) : ''; self::$errCode = trackEmailStatModel::$errCode; self::$errMsg = trackEmailStatModel::$errMsg; if (self::$errCode != 0) { show_message($this->smarty, self::$errMsg, ""); return false; } return $data; }
function show_xml($xml) { if ($xml == NULL) { show_message("No data returned"); return; } // unfortunately not pretty-printed... echo $xml->asXML(); }
function __construct() { parent::__construct(); $this->load->library('myclass'); $uid = $this->session->userdata('uid'); if (!$this->auth->is_user($uid)) { show_message('请登录后再查看', site_url('user/login')); } }
function __construct() { parent::__construct(); $this->load->library('myclass'); $file = FCPATH . 'install.lock'; if (file_exists($file)) { show_message('系统已安装过,请删除/intall.lock再重新安装', site_url()); } }
function news() { global $uid; global $PHP_SELF; $sth = mysql_query("select * from ticker where uid={$uid} order by time DESC"); if (!$sth) { show_message("Database error"); return 0; } table_start("center", "500"); table_head_text(array("News"), "4"); table_text(array(" "), "", "", "4", "text"); table_text_open(); table_text_design(" ", "15", "center", "", "head"); table_text_design("Time", "85", "center", "", "head"); table_text_design("Message", "350", "center", "", "head"); table_text_design(" ", "15", "center", "", "head"); table_text_close(); while ($news = mysql_fetch_array($sth)) { switch ($news["type"]) { case "w": $bild = "<img src=\"arts/wichtig.jpg\" width=\"15\" height=\"15\" alt=\"Anouncement\">"; break; case "r": $bild = "<img src=\"arts/research.jpg\" width=\"15\" height=\"15\" alt=\"Scientists Report\">"; break; case "s": $bild = "<img src=\"arts/spy.jpg\" width=\"15\" height=\"15\" alt=\"Covert Operations Report\">"; break; case "m": $bild = "<img src=\"arts/mail.jpg\" width=\"15\" height=\"15\" alt=\"Mailbox\">"; break; case "a": $bild = "<img src=\"arts/underattack.jpg\" width=\"15\" height=\"15\" alt=\"Military Report\">"; break; case "": $bild = " "; break; } //$zeit = substr($news["time"],6,2)."-".substr($news["time"],4,2)." ".substr($news["time"],8,2).":".substr($news["time"],10,2); $zeit = $news["time"]; $pos1 = strpos($news["text"], "*"); if ($pos1 === false) { table_text(array($bild, "<span class=\"textsmall\">" . $zeit . "</span>", strip_tags($news["text"]), "<a href=\"" . $PHP_SELF . "?act=del&id=" . $news["tid"] . "\">delete</a>"), "", "", "", "text"); } else { $pos2 = strrpos($news["text"], "*"); $link = substr($news["text"], $pos1 + 2, $pos2 - 2); $text = strrchr($news["text"], "*"); $text = substr_replace($text, "", 0, 1); table_text(array($bild, "<span class=\"textsmall\">" . $zeit . "</span>", "<a href=\"" . $link . "\">" . $text . "</a>", "<a href=\"" . $PHP_SELF . "?act=del&id=" . $news["tid"] . "\">delete</a>"), "", "", "", "text"); } } table_text(array("<a href=\"" . $PHP_SELF . "?act=delete_all\"<strong>Delete all news</strong></a>"), "center", "", "4", "head"); table_end(); echo "<br><br>\n"; }
function __construct() { parent::__construct(); $this->load->library('myclass'); $this->load->model('follow_m'); $uid = $this->session->userdata('uid'); if (!$this->auth->is_user($uid)) { show_message('非法用户uid'); } }
/** * Function executed from VersionPress\Initialization\Initializer that is given the progress message, decides * whether it is suitable for output and if so, calls `show_message()` (WP function). * * @param string $progressMessage */ function _vp_show_progress_message($progressMessage) { // We currently only output messages that are defined in VersionPress\Initialization\InitializerStates // which captures the main progress points without too many details $initializerStatesReflection = new ReflectionClass('VersionPress\\Initialization\\InitializerStates'); $progressConstantValues = array_values($initializerStatesReflection->getConstants()); if (in_array($progressMessage, $progressConstantValues)) { /** @noinspection PhpParamsInspection */ /** @noinspection PhpInternalEntityUsedInspection */ show_message($progressMessage); } }
/** * isLogin interface * @param string $priv * @access public * @return mix */ function isLogin() { if (empty($this->mLoginUser)) { show_message("请先登录!"); // echo '<SCRIPT> // setTimeout("parent.window.location.replace(\"admin.php?action=user&view=login\")",1000); // </SCRIPT>'; return false; } else { return true; } }
public function add() { $data['title'] = '增加链接'; if ($_POST) { $str = array('name' => $this->input->post('name'), 'url' => $this->input->post('url'), 'is_hidden' => $this->input->post('is_hidden')); if ($this->link_m->add_link($str)) { show_message('增加链接成功!', site_url('admin/links'), 1); } } $data['csrf_name'] = $this->security->get_csrf_token_name(); $data['csrf_token'] = $this->security->get_csrf_hash(); $this->load->view('link_add', $data); }
public function add() { $data['title'] = '增加页面'; if ($_POST) { $str = array('title' => $this->input->post('title'), 'content' => nl2br($this->input->post('content')), 'go_url' => $this->input->post('go_url'), 'is_hidden' => $this->input->post('is_hidden'), 'add_time' => time()); if ($this->page_m->add_page($str)) { show_message('添加页面成功!', site_url('admin/page'), 1); } } $data['csrf_name'] = $this->security->get_csrf_token_name(); $data['csrf_token'] = $this->security->get_csrf_hash(); $this->load->view('page_add', $data); }
function check_privilege($action) { if (!empty($_SESSION['group_id']) && $_SESSION['group_id'] != 0) { $admin_privilege = $GLOBALS['db']->getone('SELECT admin_privilege FROM ' . table('user_group') . " WHERE group_id='" . $_SESSION['group_id'] . "'"); $admin_privilege = explode(',', $admin_privilege); if (!in_array($action, $admin_privilege) && $admin_privilege[0] != 'all') { //$link_url=!empty($GLOBALS['referer_url'])?$GLOBALS['referer_url']:'./'; show_message('您没有权限访问该页面', 'admin.php?act=default'); } } elseif ($_SESSION['group_id'] == 0) { show_message('请先登录', 'admin.php?act=pre_login'); } }
public function get_key_tree($return_only = FALSE) { $redis_keys = $this->redis_model->get_all_keys(KEY_PREFIX); $namespaces = array(); $this->keys_to_tree($redis_keys, $namespaces); $key_tree = array(); $key_tree[] = '<ul>'; $this->_create_key_tree($namespaces, 'Keys', '', empty($namespaces), $key_tree); $key_tree[] = '</ul>'; $key_tree = implode(PHP_EOL, $key_tree); if ($return_only) { return $key_tree; } else { show_message(0, '', array('html' => $key_tree)); } }
/** * Function executed from VersionPress\Initialization\Initializer that is given the progress message, decides * whether it is suitable for output and if so, calls WP's `show_message()` function. Displaying can be forced * using the $forceDisplay parameter. * * @param string $progressMessage * @param bool $forceDisplay If true, displays the message regardless of its presence in InitializerStates enum */ function _vp_show_progress_message($progressMessage, $forceDisplay = false) { // We currently only output messages that are defined in VersionPress\Initialization\InitializerStates // which captures the main progress points without too many details. Or if $forceDisplay is true. $shouldDisplayMessage = $forceDisplay; if (!$shouldDisplayMessage) { $initializerStatesReflection = new ReflectionClass(InitializerStates::class); $progressConstantValues = array_values($initializerStatesReflection->getConstants()); $shouldDisplayMessage = in_array($progressMessage, $progressConstantValues); } if ($shouldDisplayMessage) { /** @noinspection PhpParamsInspection */ /** @noinspection PhpInternalEntityUsedInspection */ show_message($progressMessage); } }
function op_delclient() { $t = true; if (isset($_POST['delete']) && is_array($_POST['delete'])) { include_once "ClientModel.class.php"; $clientModel = new ClientModel(); foreach ($_POST['delete'] as $u) { $t *= $clientModel->deleteClient($u); } if ($t) { show_message_goback(lang('success')); } } show_message(lang('selectone')); goback(); }
/** * Handle the upgrade * * @param array the files to upgrade * @return bool true on success, false on failure */ public function upgrade($files = array()) { global $wp_filesystem; // Connect to the Filesystem first. $res = $this->fs_connect(array(WP_CONTENT_DIR, WP_PLUGIN_DIR)); if (!$res) { $this->skin->footer(); return false; } // Maintenance mode $this->maintenance_mode(true); $upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/'; $hmwp_ms_folder = $wp_filesystem->wp_plugins_dir() . 'mute-screamer/libraries/IDS/'; // Only check to see if the Dir exists upon creation failure. Less I/O this way. if (!$wp_filesystem->mkdir($upgrade_folder, FS_CHMOD_DIR) && !$wp_filesystem->is_dir($upgrade_folder)) { show_message(new WP_Error('mkdir_failed', __('Could not create directory.', 'mute-screamer'), $upgrade_folder)); $this->maintenance_mode(false); return false; } // Clean up contents of upgrade directory beforehand. $upgrade_files = $wp_filesystem->dirlist($upgrade_folder); if (!empty($upgrade_files)) { foreach ($upgrade_files as $file) { $wp_filesystem->delete($upgrade_folder . $file['name'], true); } } // Save files into upgrade folder, copy into place foreach ($files as $key => $val) { show_message(sprintf(__('Copying %s into place...', 'mute-screamer'), esc_html($key))); $new_file = $upgrade_folder . $key; $wp_filesystem->put_contents($new_file, $val['body'], FS_CHMOD_FILE); // Copy files into place if (!$wp_filesystem->copy($new_file, $hmwp_ms_folder . $key, true)) { $wp_filesystem->delete($upgrade_folder, true); show_message(new WP_Error('copy_failed', __('Could not copy files.', 'mute-screamer'))); $this->maintenance_mode(false); return false; } $wp_filesystem->chmod($hmwp_ms_folder . $key, FS_CHMOD_FILE); // Delete files from upgrade folder $wp_filesystem->delete($new_file, true); } $this->maintenance_mode(false); show_message(__('Mute Screamer updated successfully', 'mute-screamer')); show_message('<a target="_parent" href="' . esc_url(admin_url()) . '">' . __('Go to Dashboard', 'mute-screamer') . '</a>'); return true; }