当前位置: 首页>>代码示例>>PHP>>正文


PHP check_form_key函数代码示例

本文整理汇总了PHP中check_form_key函数的典型用法代码示例。如果您正苦于以下问题:PHP check_form_key函数的具体用法?PHP check_form_key怎么用?PHP check_form_key使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_form_key函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

 function main($id, $mode)
 {
     global $db, $user, $auth, $template, $cache, $request;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     $this->config = $config;
     $this->request = $request;
     $user->add_lang('acp/common');
     $user->add_lang_ext('vinny/shareon', 'acp/info_acp_shareon');
     $this->tpl_name = 'acp_shareon';
     $this->page_title = $user->lang['SHARE_ON_MOD'];
     add_form_key('acp_shareon');
     if ($request->is_set_post('submit')) {
         if (!check_form_key('acp_shareon')) {
             trigger_error('FORM_INVALID');
         }
         $config->set('so_status', $request->variable('so_status', true));
         $config->set('so_type', $request->variable('so_type', true));
         $config->set('so_facebook', $request->variable('so_facebook', true));
         $config->set('so_twitter', $request->variable('so_twitter', true));
         $config->set('so_tuenti', $request->variable('so_tuenti', true));
         $config->set('so_sonico', $request->variable('so_sonico', true));
         $config->set('so_friendfeed', $request->variable('so_friendfeed', true));
         $config->set('so_digg', $request->variable('so_digg', true));
         $config->set('so_reddit', $request->variable('so_reddit', true));
         $config->set('so_delicious', $request->variable('so_delicious', true));
         $config->set('so_vk', $request->variable('so_vk', true));
         $config->set('so_tumblr', $request->variable('so_tumblr', true));
         $config->set('so_google', $request->variable('so_google', true));
         trigger_error($user->lang['SO_SAVED'] . adm_back_link($this->u_action));
     }
     $template->assign_vars(array('SO_STATUS' => !empty($this->config['so_status']) ? true : false, 'SO_TYPE' => !empty($this->config['so_type']) ? true : false, 'SO_FACEBOOK' => !empty($this->config['so_facebook']) ? true : false, 'SO_TWITTER' => !empty($this->config['so_twitter']) ? true : false, 'SO_TUENTI' => !empty($this->config['so_tuenti']) ? true : false, 'SO_SONICO' => !empty($this->config['so_sonico']) ? true : false, 'SO_FRIENDFEED' => !empty($this->config['so_friendfeed']) ? true : false, 'SO_DIGG' => !empty($this->config['so_digg']) ? true : false, 'SO_REDDIT' => !empty($this->config['so_reddit']) ? true : false, 'SO_DELICIOUS' => !empty($this->config['so_delicious']) ? true : false, 'SO_VK' => !empty($this->config['so_vk']) ? true : false, 'SO_TUMBLR' => !empty($this->config['so_tumblr']) ? true : false, 'SO_GOOGLE' => !empty($this->config['so_google']) ? true : false, 'U_ACTION' => $this->u_action));
 }
开发者ID:phpbb-store,项目名称:OfficeForum,代码行数:32,代码来源:shareon_module.php

示例2: do_submit_stuff

 /**
  * Abstracted method to do the submit part of the acp. Checks values, saves them
  * and displays the message.
  * If error happens, Error is shown and config not saved. (so this method quits and returns false.
  *
  * @param array $display_vars The display vars for this acp site
  * @param array $special_functions Assoziative Array with config values where special functions should run on submit instead of simply save the config value. Array should contain 'config_value' => function ($this) { function code here }, or 'config_value' => null if no function should run.
  * @return bool Submit valid or not.
  */
 protected function do_submit_stuff($display_vars, $special_functions = array())
 {
     $this->new_config = $this->config;
     $cfg_array = $this->request->is_set('config') ? $this->request->variable('config', array('' => '')) : $this->new_config;
     $error = isset($error) ? $error : array();
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if (!check_form_key($this->form_key)) {
         $error[] = $this->user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
         return false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         // We want to skip that, or run the function. (We do this before checking if there is a request value set for it,
         // cause maybe we want to run a function anyway, based on whatever. We can check stuff manually inside this function)
         if (is_array($special_functions) && array_key_exists($config_name, $special_functions)) {
             $func = $special_functions[$config_name];
             if (isset($func) && is_callable($func)) {
                 $func();
             }
             continue;
         }
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         // Sets the config value
         $this->new_config[$config_name] = $cfg_array[$config_name];
         $this->config->set($config_name, $cfg_array[$config_name]);
     }
     return true;
 }
开发者ID:Galixte,项目名称:advancedpolls,代码行数:43,代码来源:advancedpolls_module.php

示例3: main

 function main($id, $mode)
 {
     global $config, $request, $template, $user, $phpbb_log;
     $user->add_lang('acp/common');
     $this->tpl_name = 'acp_postnumbers';
     $this->page_title = $user->lang('POSTNUMBERS_TITLE');
     add_form_key('acp_postnumbers');
     if ($request->is_set_post('submit')) {
         if (!check_form_key('acp_postnumbers')) {
             trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action));
         }
         $config->set('kasimi.postnumbers.enabled.viewtopic', $request->variable('postnumbers_enabled_viewtopic', 0));
         $config->set('kasimi.postnumbers.enabled.review_reply', $request->variable('postnumbers_enabled_review_reply', 0));
         $config->set('kasimi.postnumbers.enabled.review_mcp', $request->variable('postnumbers_enabled_review_mcp', 0));
         $config->set('kasimi.postnumbers.skip_nonapproved', $request->variable('postnumbers_skip_nonapproved', 0));
         $config->set('kasimi.postnumbers.display_ids', $request->variable('postnumbers_display_ids', 0));
         $config->set('kasimi.postnumbers.clipboard', $request->variable('postnumbers_clipboard', 0));
         $config->set('kasimi.postnumbers.bold', $request->variable('postnumbers_bold', 0));
         $user_id = empty($user->data) ? ANONYMOUS : $user->data['user_id'];
         $user_ip = empty($user->ip) ? '' : $user->ip;
         $phpbb_log->add('admin', $user_id, $user_ip, 'POSTNUMBERS_CONFIG_UPDATED');
         trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     $template->assign_vars(array('POSTNUMBERS_VERSION' => isset($config['kasimi.postnumbers.version']) ? $config['kasimi.postnumbers.version'] : 'X.Y.Z', 'POSTNUMBERS_ENABLED_VIEWTOPIC' => isset($config['kasimi.postnumbers.enabled.viewtopic']) ? $config['kasimi.postnumbers.enabled.viewtopic'] : 0, 'POSTNUMBERS_ENABLED_REVIEW_REPLY' => isset($config['kasimi.postnumbers.enabled.review_reply']) ? $config['kasimi.postnumbers.enabled.review_reply'] : 0, 'POSTNUMBERS_ENABLED_REVIEW_MCP' => isset($config['kasimi.postnumbers.enabled.review_mcp']) ? $config['kasimi.postnumbers.enabled.review_mcp'] : 0, 'POSTNUMBERS_SKIP_NONAPPROVED' => isset($config['kasimi.postnumbers.skip_nonapproved']) ? $config['kasimi.postnumbers.skip_nonapproved'] : 0, 'POSTNUMBERS_DISPLAY_IDS' => isset($config['kasimi.postnumbers.display_ids']) ? $config['kasimi.postnumbers.display_ids'] : 0, 'POSTNUMBERS_CLIPBOARD' => isset($config['kasimi.postnumbers.clipboard']) ? $config['kasimi.postnumbers.clipboard'] : 0, 'POSTNUMBERS_BOLD' => isset($config['kasimi.postnumbers.bold']) ? $config['kasimi.postnumbers.bold'] : 0, 'U_ACTION' => $this->u_action));
 }
开发者ID:phpbb-addons,项目名称:phpbb-ext-postnumbers,代码行数:25,代码来源:postnumbers_module.php

示例4: main

 /**
  * Main ACP module
  *
  * @param int $id
  * @param string $mode
  * @access public
  */
 public function main($id, $mode)
 {
     $this->tpl_name = 'acp_topic_preview';
     $this->page_title = $this->user->lang('TOPIC_PREVIEW');
     $form_key = 'acp_topic_preview';
     add_form_key($form_key);
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key($form_key)) {
             trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         $this->config->set('topic_preview_limit', abs($this->request->variable('topic_preview_limit', 0)));
         // abs() no negative values
         $this->config->set('topic_preview_width', abs($this->request->variable('topic_preview_width', 0)));
         // abs() no negative values
         $this->config->set('topic_preview_delay', abs($this->request->variable('topic_preview_delay', 0)));
         // abs() no negative values
         $this->config->set('topic_preview_drift', $this->request->variable('topic_preview_drift', 0));
         $this->config->set('topic_preview_avatars', $this->request->variable('topic_preview_avatars', 0));
         $this->config->set('topic_preview_last_post', $this->request->variable('topic_preview_last_post', 0));
         $this->config->set('topic_preview_strip_bbcodes', $this->request->variable('topic_preview_strip_bbcodes', ''));
         $styles = $this->get_styles();
         foreach ($styles as $row) {
             $this->set_style_theme($row['style_id'], $this->request->variable('style_' . $row['style_id'], ''));
         }
         trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     $styles = $this->get_styles();
     foreach ($styles as $row) {
         $this->template->assign_block_vars('styles', array('STYLE_ID' => $row['style_id'], 'STYLE_THEME' => $this->user->lang('TOPIC_PREVIEW_THEME', $row['style_name']), 'STYLE_THEME_EXPLAIN' => $this->user->lang('TOPIC_PREVIEW_THEME_EXPLAIN', $row['style_name']), 'THEME_OPTIONS' => $this->theme_options($row['topic_preview_theme'])));
     }
     $this->template->assign_vars(array('TOPIC_PREVIEW_LIMIT' => $this->config['topic_preview_limit'], 'TOPIC_PREVIEW_WIDTH' => $this->config['topic_preview_width'], 'TOPIC_PREVIEW_DELAY' => $this->config['topic_preview_delay'], 'TOPIC_PREVIEW_DRIFT' => $this->config['topic_preview_drift'], 'S_TOPIC_PREVIEW_AVATARS' => $this->config['topic_preview_avatars'], 'S_TOPIC_PREVIEW_LAST_POST' => $this->config['topic_preview_last_post'], 'TOPIC_PREVIEW_STRIP' => $this->config['topic_preview_strip_bbcodes'], 'U_ACTION' => $this->u_action));
 }
开发者ID:CageStooge,项目名称:dsForums,代码行数:39,代码来源:topic_preview_module.php

示例5: main

 function main($id, $mode)
 {
     global $user, $config, $request, $template;
     add_form_key('wwh');
     $user->add_lang('ucp');
     $this->tpl_name = 'acp_wwh';
     $this->page_title = $user->lang['WWH_TITLE'];
     $submit = $request->is_set_post('submit');
     if ($submit) {
         if (!check_form_key('wwh')) {
             trigger_error('FORM_INVALID');
         }
         $config->set('wwh_disp_bots', $request->variable('wwh_disp_bots', 0));
         $config->set('wwh_disp_guests', $request->variable('wwh_disp_guests', 0));
         $config->set('wwh_disp_hidden', $request->variable('wwh_disp_hidden', 0));
         $config->set('wwh_disp_time', $request->variable('wwh_disp_time', 0));
         $config->set('wwh_disp_time_format', $request->variable('wwh_disp_time_format', 'H:i'));
         $config->set('wwh_disp_ip', $request->variable('wwh_disp_ip', 0));
         $config->set('wwh_version', $request->variable('wwh_version', 0));
         $config->set('wwh_del_time_h', $request->variable('wwh_del_time_h', 0));
         $config->set('wwh_del_time_m', $request->variable('wwh_del_time_m', 0));
         $config->set('wwh_del_time_s', $request->variable('wwh_del_time_s', 0));
         $config->set('wwh_sort_by', $request->variable('wwh_sort_by', 0));
         $config->set('wwh_record', $request->variable('wwh_record', 0));
         $config->set('wwh_record_timestamp', $request->variable('wwh_record_timestamp', 'D j. M Y'));
         if ($request->variable('wwh_reset', 0) > 0) {
             $config->set('wwh_record_ips', 1);
             $config->set('wwh_record_time', time());
             $config->set('wwh_reset_time', time());
         }
         trigger_error($user->lang['WWH_SAVED_SETTINGS'] . adm_back_link($this->u_action));
     }
     $template->assign_vars(array('WWH_MOD_VERSION' => sprintf($user->lang['WWH_INSTALLED'], $config['wwh_mod_version']), 'WWH_DISP_BOTS' => $config['wwh_disp_bots'], 'WWH_DISP_GUESTS' => $config['wwh_disp_guests'], 'WWH_DISP_HIDDEN' => $config['wwh_disp_hidden'], 'WWH_DISP_TIME' => $config['wwh_disp_time'], 'WWH_DISP_TIME_FORMAT' => $config['wwh_disp_time_format'], 'WWH_DISP_IP' => $config['wwh_disp_ip'], 'WWH_VERSION' => $config['wwh_version'], 'WWH_DEL_TIME_H' => $config['wwh_del_time_h'], 'WWH_DEL_TIME_M' => $config['wwh_del_time_m'], 'WWH_DEL_TIME_S' => $config['wwh_del_time_s'], 'WWH_SORT_BY' => $config['wwh_sort_by'], 'WWH_RECORD' => $config['wwh_record'], 'WWH_RECORD_TIMESTAMP' => $config['wwh_record_timestamp'], 'U_ACTION' => $this->u_action));
 }
开发者ID:alhitary,项目名称:who-was-here,代码行数:34,代码来源:acp_wwh_module.php

示例6: display_options

 /**
  * Display the options a user can configure for this extension
  *
  * @return null
  * @access public
  */
 public function display_options()
 {
     // Create a form key for preventing CSRF attacks
     $form_key = 'sitelogo';
     add_form_key($form_key);
     // Is the form being submitted
     if ($this->request->is_set_post('submit')) {
         // Is the submitted form is valid
         if (!check_form_key($form_key)) {
             trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // If no errors, process the form data
         // Set the options the user configured
         $this->set_options();
         // Add option settings change action to the admin log
         $phpbb_log = $this->container->get('log');
         $phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'SITE_LOGO_LOG');
         // Option settings have been updated and logged
         // Confirm this to the user and provide link back to previous page
         trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     // Set output vars for display in the template
     // Positions
     $positions = array();
     $positions[] = $this->user->lang('LOGO_LEFT');
     $positions[] = $this->user->lang('LOGO_CENTRE');
     $positions[] = $this->user->lang('LOGO_RIGHT');
     foreach ($positions as $value => $label) {
         $this->template->assign_block_vars('positions', array('S_CHECKED' => $this->config['site_logo_position'] == $value ? true : false, 'LABEL' => $label, 'VALUE' => $value));
     }
     $this->template->assign_vars(array('SITE_LOGO_HEIGHT' => isset($this->config['site_logo_height']) ? $this->config['site_logo_height'] : '', 'SITE_LOGO_IMAGE' => isset($this->config['site_logo_image']) ? $this->config['site_logo_image'] : '', 'SITE_LOGO_LEFT' => isset($this->config['site_logo_left']) ? $this->config['site_logo_left'] : '', 'SITE_LOGO_PIXELS' => isset($this->config['site_logo_pixels']) ? $this->config['site_logo_pixels'] : '', 'SITE_LOGO_REMOVE' => isset($this->config['site_logo_remove']) ? $this->config['site_logo_remove'] : '', 'SITE_LOGO_RIGHT' => isset($this->config['site_logo_right']) ? $this->config['site_logo_right'] : '', 'SITE_LOGO_WIDTH' => isset($this->config['site_logo_width']) ? $this->config['site_logo_width'] : '', 'SITE_NAME_SUPRESS' => isset($this->config['site_name_supress']) ? $this->config['site_name_supress'] : '', 'SITE_SEARCH_REMOVE' => isset($this->config['site_search_remove']) ? $this->config['site_search_remove'] : '', 'U_ACTION' => $this->u_action));
 }
开发者ID:Galixte,项目名称:david63-sitelogo,代码行数:38,代码来源:admin_controller.php

示例7: main

 function main($id, $mode)
 {
     global $db, $user, $auth, $template;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     $user->add_lang('acp/board');
     $captcha_vars = array('captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', 'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE', 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED', 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE', 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE', 'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS');
     if (isset($_GET['demo'])) {
         $captcha_vars = array_keys($captcha_vars);
         foreach ($captcha_vars as $captcha_var) {
             $config[$captcha_var] = isset($_REQUEST[$captcha_var]) ? request_var($captcha_var, 0) : $config[$captcha_var];
         }
         if ($config['captcha_gd']) {
             include $phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx;
         } else {
             include $phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx;
         }
         $captcha = new captcha();
         $captcha->execute(gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)), time());
         exit;
     }
     $config_vars = array('enable_confirm' => 'REG_ENABLE', 'enable_post_confirm' => 'POST_ENABLE', 'confirm_refresh' => 'CONFIRM_REFRESH', 'captcha_gd' => 'CAPTCHA_GD');
     $this->tpl_name = 'acp_captcha';
     $this->page_title = 'ACP_VC_SETTINGS';
     $form_key = 'acp_captcha';
     add_form_key($form_key);
     $submit = request_var('submit', '');
     if ($submit && check_form_key($form_key)) {
         $config_vars = array_keys($config_vars);
         foreach ($config_vars as $config_var) {
             set_config($config_var, request_var($config_var, ''));
         }
         $captcha_vars = array_keys($captcha_vars);
         foreach ($captcha_vars as $captcha_var) {
             $value = request_var($captcha_var, 0);
             if ($value >= 0) {
                 set_config($captcha_var, $value);
             }
         }
         add_log('admin', 'LOG_CONFIG_VISUAL');
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     } else {
         if ($submit) {
             trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
         } else {
             $preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&demo=demo"));
             if (@extension_loaded('gd')) {
                 $template->assign_var('GD', true);
             }
             foreach ($config_vars as $config_var => $template_var) {
                 $template->assign_var($template_var, isset($_REQUEST[$config_var]) ? request_var($config_var, '') : $config[$config_var]);
             }
             foreach ($captcha_vars as $captcha_var => $template_var) {
                 $var = isset($_REQUEST[$captcha_var]) ? request_var($captcha_var, 0) : $config[$captcha_var];
                 $template->assign_var($template_var, $var);
                 $preview_image_src .= "&{$captcha_var}=" . $var;
             }
             $template->assign_vars(array('CAPTCHA_PREVIEW' => $preview_image_src, 'PREVIEW' => isset($_POST['preview'])));
         }
     }
 }
开发者ID:html,项目名称:PI,代码行数:60,代码来源:acp_captcha.php

示例8: display_options

    /**
     * Display the options a user can configure for this extension
     *
     * @return null
     * @access public
     */
    public function display_options()
    {
        add_form_key('acp_donation');
        // Is the form being submitted to us?
        if ($this->request->is_set_post('submit')) {
            if (!check_form_key('acp_donation')) {
                $error[] = 'FORM_INVALID';
            }
            $donation_row = array('donation_body' => $this->request->variable('donation_body', '', true), 'donation_cancel' => $this->request->variable('donation_cancel', '', true), 'donation_success' => $this->request->variable('donation_success', '', true));
            foreach ($donation_row as $this->config_name => $this->config_value) {
                $sql = 'UPDATE ' . $this->donation_table . "\n\t\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->config_value) . "'\n\t\t\t\t\tWHERE config_name = '" . $this->db->sql_escape($this->config_name) . "'";
                $this->db->sql_query($sql);
            }
            // Set the options the user configured
            $this->set_options();
            // Add option settings change action to the admin log
            $this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'DONATION_SAVED');
            trigger_error($this->user->lang['DONATION_SAVED'] . adm_back_link($this->u_action));
        }
        // let's get it on
        $sql = 'SELECT *
		FROM ' . $this->donation_table;
        $result = $this->db->sql_query($sql);
        $donation = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $donation[$row['config_name']] = $row['config_value'];
        }
        $this->db->sql_freeresult($result);
        $donation_body = isset($donation['donation_body']) ? $donation['donation_body'] : '';
        $donation_cancel = isset($donation['donation_cancel']) ? $donation['donation_cancel'] : '';
        $donation_success = isset($donation['donation_success']) ? $donation['donation_success'] : '';
        $donation_version = isset($this->config['donation_version']) ? $this->config['donation_version'] : '';
        $this->template->assign_vars(array('DONATION_VERSION' => $donation_version, 'DONATION_ENABLE' => $this->config['donation_enable'], 'DONATION_INDEX_ENABLE' => $this->config['donation_index_enable'], 'DONATION_INDEX_TOP' => $this->config['donation_index_top'], 'DONATION_INDEX_BOTTOM' => $this->config['donation_index_bottom'], 'DONATION_EMAIL' => $this->config['donation_email'], 'DONATION_ACHIEVEMENT_ENABLE' => $this->config['donation_achievement_enable'], 'DONATION_ACHIEVEMENT' => $this->config['donation_achievement'], 'DONATION_GOAL_ENABLE' => $this->config['donation_goal_enable'], 'DONATION_GOAL' => $this->config['donation_goal'], 'DONATION_GOAL_CURRENCY_ENABLE' => $this->config['donation_goal_currency_enable'], 'DONATION_GOAL_CURRENCY' => $this->config['donation_goal_currency'], 'DONATION_BODY' => $donation_body, 'DONATION_CANCEL' => $donation_cancel, 'DONATION_SUCCESS' => $donation_success, 'U_ACTION' => $this->u_action));
    }
开发者ID:3D-I,项目名称:paypaldonation,代码行数:40,代码来源:admin_controller.php

示例9: display_options

 /**
  * Display the options a user can configure for this extension
  *
  * @return null
  * @access public
  */
 public function display_options()
 {
     // Create a form key for preventing CSRF attacks
     $form_key = 'login_redirect';
     add_form_key($form_key);
     // Is the form being submitted
     if ($this->request->is_set_post('submit')) {
         // Is the submitted form is valid
         if (!check_form_key($form_key)) {
             trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // Check that the entered topics are valid
         $this->topic_valid($this->request->variable('redirect_announce_topic_id', ''), $this->user->lang('INVALID_ANNOUNCEMENT_TOPIC'));
         $this->topic_valid($this->request->variable('redirect_welcome_topic_id', ''), $this->user->lang('INVALID_WELCOME_TOPIC'));
         $this->topic_valid($this->request->variable('redirect_group_topic_id', ''), $this->user->lang('INVALID_GROUP_TOPIC'));
         // If no errors, process the form data
         // Set the options the user configured
         $this->set_options();
         // Add option settings change action to the admin log
         $phpbb_log = $this->container->get('log');
         $phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_LOGIN_REDIRECT');
         // Option settings have been updated and logged
         // Confirm this to the user and provide link back to previous page
         trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     // Set output vars for display in the template
     $this->template->assign_vars(array('REDIRECT_ANNOUNCE' => isset($this->config['redirect_announce']) ? $this->config['redirect_announce'] : '', 'REDIRECT_ANNOUNCE_PRIORITY' => isset($this->config['redirect_announce_priority']) ? $this->config['redirect_announce_priority'] : '', 'REDIRECT_ANNOUNCE_REFRESH' => isset($this->config['redirect_announce_refresh']) ? $this->config['redirect_announce_refresh'] : '', 'REDIRECT_ANNOUNCE_TOPIC_ID' => isset($this->config['redirect_announce_topic_id']) ? $this->config['redirect_announce_topic_id'] : '', 'REDIRECT_ANY_ANNOUNCE' => isset($this->config['redirect_any_announce']) ? $this->config['redirect_any_announce'] : '', 'REDIRECT_ENABLED' => isset($this->config['redirect_enabled']) ? $this->config['redirect_enabled'] : '', 'REDIRECT_GROUP' => isset($this->config['redirect_group']) ? $this->config['redirect_group'] : '', 'REDIRECT_GROUP_ALL' => isset($this->config['redirect_group_all']) ? $this->config['redirect_group_all'] : '', 'REDIRECT_GROUP_REFRESH' => isset($this->config['redirect_group_refresh']) ? $this->config['redirect_group_refresh'] : '', 'REDIRECT_GROUP_TOPIC_ID' => isset($this->config['redirect_group_topic_id']) ? $this->config['redirect_group_topic_id'] : '', 'REDIRECT_WELCOME' => isset($this->config['redirect_welcome']) ? $this->config['redirect_welcome'] : '', 'REDIRECT_WELCOME_REFRESH' => isset($this->config['redirect_welcome_refresh']) ? $this->config['redirect_welcome_refresh'] : '', 'REDIRECT_WELCOME_TOPIC_ID' => isset($this->config['redirect_welcome_topic_id']) ? $this->config['redirect_welcome_topic_id'] : '', 'S_REDIRECT_GROUP_OPTIONS' => group_select_options($this->config['redirect_group_id'], false, false), 'U_ACTION' => $this->u_action));
 }
开发者ID:Galixte,项目名称:david63-loginredirect,代码行数:34,代码来源:admin_controller.php

示例10: main

 public function main($id, $mode)
 {
     global $config, $user, $template, $request;
     $user->add_lang_ext('rinsrans/textbox', 'common');
     $this->tpl_name = 'acp_textbox_body';
     $this->page_title = $user->lang('ACP_TEXTBOX_TITLE');
     add_form_key('acp_textbox');
     // Form is submitted
     if ($request->is_set_post('submit')) {
         if (!check_form_key('acp_textbox')) {
             trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // Set the new settings to config
         $uid = $bitfield = $options = '';
         $textbox_content = $request->variable('textbox_content', '', true);
         generate_text_for_storage($textbox_content, $uid, $bitfield, $options, true, true, true);
         $config->set('textbox_content', $textbox_content);
         $config->set('textbox_bbcode_uid', $uid);
         $config->set('textbox_bbcode_bitfield', $bitfield);
         trigger_error($user->lang('ACP_TEXTBOX_SAVED') . adm_back_link($this->u_action));
     }
     $textbox_content = generate_text_for_edit($config['textbox_content'], $config['textbox_bbcode_uid'], 3);
     // Send the curent settings to template
     $template->assign_vars(array('U_ACTION' => $this->u_action, 'TEXTBOX_CONTENT' => $textbox_content['text']));
 }
开发者ID:rinsrans,项目名称:phpBB-textbox,代码行数:25,代码来源:textbox_module.php

示例11: main

 function main($id, $mode)
 {
     global $db, $user, $auth, $template, $cache, $request;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     $this->pool_root = $phpbb_root_path . 'store/d120de/banner/';
     $user->add_lang('acp/common');
     $this->tpl_name = 'banner_settings';
     $this->page_title = $user->lang('ACP_D120DE_BANNER_SETTINGS_DEFAULT');
     add_form_key('d120de/banner');
     $this->load_banner_list('default');
     $this->load_banner_list('event');
     if ($request->is_set_post('submit')) {
         if (!check_form_key('d120de/banner')) {
             trigger_error('FORM_INVALID');
         }
         $filename = $request->variable('d120de_banner_picture', '');
         $filepath = $this->pool_root . $filename;
         if (is_file($filepath)) {
             $image_dimension = getimagesize($filepath);
             $config->set('d120de_banner_width', $image_dimension[0]);
             $config->set('d120de_banner_height', $image_dimension[1]);
         } elseif ($filename != '') {
             trigger_error('The selected Image does not exist!', E_USER_WARNING);
         }
         $config->set('d120de_banner_link_default', $request->variable('d120de_banner_link_default', ''));
         $config->set('d120de_banner_picture', $request->variable('d120de_banner_picture', ''));
         $config->set('d120de_banner_alt_text_default', $request->variable('d120de_banner_alt_text_default', ''));
         $config->set('d120de_banner_hidesearchbox', $request->Is_set('d120de_banner_hidesearchbox'));
         $config->set('d120de_banner_hidesearchbox_default', $request->Is_set('d120de_banner_hidesearchbox_default'));
         trigger_error($user->lang('ACP_D120DE_BANNER_SETTING_SAVED') . adm_back_link($this->u_action));
     }
     $template->assign_vars(array('U_ACTION' => $this->u_action, 'D120DE_BANNER_LINK_DEFAULT' => $config['d120de_banner_link_default'], 'D120DE_BANNER_PICTURE' => $config['d120de_banner_picture'], 'D120DE_BANNER_ALT_TEXT_DEFAULT' => $config['d120de_banner_alt_text_default'], 'D120DE_BANNER_HIDESEARCHBOX' => $config['d120de_banner_hidesearchbox'], 'D120DE_BANNER_HIDESEARCHBOX_DEFAULT' => $config['d120de_banner_hidesearchbox_default']));
 }
开发者ID:d120,项目名称:phpbb-banner,代码行数:33,代码来源:main_module.php

示例12: main

 function main($id, $mode)
 {
     global $db, $config, $request, $template, $user;
     global $phpbb_root_path, $phpbb_admin_path, $phpEx;
     $this->page_title = $user->lang['SFS_CONTROL'];
     $this->tpl_name = 'stopforumspam_body';
     add_form_key('sfs');
     $allow_sfs = $this->allow_sfs();
     if ($request->is_set_post('submit')) {
         // Test if form key is valid
         if (!check_form_key('sfs')) {
             trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
         }
         if (!function_exists('validate_data')) {
             include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
         }
         $check_row = array('sfs_threshold' => $request->variable('sfs_threshold', 0));
         $validate_row = array('sfs_threshold' => array('num', false, 1, 99));
         $error = validate_data($check_row, $validate_row);
         // Replace "error" strings with their real, localised form
         $error = array_map(array($user, 'lang'), $error);
         if (!sizeof($error)) {
             // Set the options the user configured
             $this->set_options();
             trigger_error($user->lang['SFS_SETTINGS_SUCCESS'] . adm_back_link($this->u_action));
         }
     }
     $template->assign_vars(array('ERROR' => isset($error) ? sizeof($error) ? implode('<br />', $error) : '' : '', 'ALLOW_SFS' => $config['allow_sfs'] ? true : false, 'CURL_ACTIVE' => !empty($allow_sfs) ? '' : '<br /><span class="error">' . $user->lang['LOG_SFS_NEED_CURL'] . '</span>', 'SFS_THRESHOLD' => (int) $config['sfs_threshold'], 'SFS_BAN_IP' => $config['sfs_ban_ip'] ? true : false, 'SFS_LOG_MESSAGE' => $config['sfs_log_message'] ? true : false, 'SFS_DOWN' => $config['sfs_down'] ? true : false, 'SFS_BY_NAME' => $config['sfs_by_name'] ? true : false, 'SFS_BY_EMAIL' => $config['sfs_by_email'] ? true : false, 'SFS_BY_IP' => $config['sfs_by_ip'] ? true : false, 'SFS_BAN_REASON' => $config['sfs_ban_reason'] ? true : false, 'SFS_VERSION' => $config['sfs_version'], 'U_ACTION' => $this->u_action));
 }
开发者ID:cracknel,项目名称:ubuntudanmark.dk,代码行数:29,代码来源:stopforumspam_module.php

示例13: main

 function main($id, $mode)
 {
     global $db, $user, $auth, $template, $cache, $request;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $lang;
     $template->assign_vars(array('ACTUAL_STYLE' => $user->style['style_path'], 'MODE' => $mode));
     $submit = request_var('submit', '');
     $form_key = 'gantry';
     add_form_key($form_key);
     $this->new_config = $config;
     $this->request = $request;
     $cfg_array = isset($_REQUEST['config']) ? request_var('config', array('' => '')) : $this->new_config;
     $error = array();
     $this->tpl_name = 'acp_gantryadmin';
     // Save values
     if ($request->is_set_post('submit')) {
         if (!check_form_key($form_key)) {
             trigger_error('FORM_INVALID');
         }
         foreach ($item_list as $item) {
             $config->set((string) $style_prefix . $item, $request->variable((string) $item, ''));
         }
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     // Assign saved values into template
     $template->assign_vars(array('U_ACTION' => $this->u_action));
 }
开发者ID:Tanver186,项目名称:gantry5,代码行数:26,代码来源:gantryadmin_module.php

示例14: main

 function main($id, $mode)
 {
     global $config, $user, $template, $request;
     $this->tpl_name = 'acp_linkmenu_config';
     $this->page_title = $user->lang['ACP_LINKMENU_SETTINGS'];
     add_form_key('acp_linkmenu_config');
     $submit = $request->is_set_post('submit');
     if ($submit) {
         if (!check_form_key('acp_linkmenu_config')) {
             trigger_error('FORM_INVALID');
         }
         $config->set('linkmenu_enable', $request->variable('linkmenu_enable', 0));
         $config->set('linkmenu_enable_first', $request->variable('linkmenu_enable_first', 0));
         $config->set('linkmenu_name_field_first', utf8_normalize_nfc($request->variable('linkmenu_name_field_first', '', true)));
         $config->set('linkmenu_text_field_first', utf8_normalize_nfc($request->variable('linkmenu_text_field_first', '', true)));
         $config->set('linkmenu_enable_second', $request->variable('linkmenu_enable_second', 0));
         $config->set('linkmenu_name_field_second', utf8_normalize_nfc($request->variable('linkmenu_name_field_second', '', true)));
         $config->set('linkmenu_text_field_second', utf8_normalize_nfc($request->variable('linkmenu_text_field_second', '', true)));
         $config->set('linkmenu_enable_third', $request->variable('linkmenu_enable_third', 0));
         $config->set('linkmenu_name_field_third', utf8_normalize_nfc($request->variable('linkmenu_name_field_third', '', true)));
         $config->set('linkmenu_text_field_third', utf8_normalize_nfc($request->variable('linkmenu_text_field_third', '', true)));
         trigger_error($user->lang['ACP_LINKMENU_CONFIG_SAVED'] . adm_back_link($this->u_action));
     }
     $template->assign_vars(array('ACP_LINKMENU_VERSION' => isset($config['linkmenu_version']) ? $config['linkmenu_version'] : '', 'ACP_LINKMENU_ENABLE' => !empty($config['linkmenu_enable']) ? true : false, 'ACP_LINKMENU_ENABLE_FIRST' => !empty($config['linkmenu_enable_first']) ? true : false, 'LINKMENU_NAME_FIELD_FIRST' => isset($config['linkmenu_name_field_first']) ? $config['linkmenu_name_field_first'] : '', 'LINKMENU_TEXT_FIELD_FIRST' => isset($config['linkmenu_text_field_first']) ? $config['linkmenu_text_field_first'] : '', 'ACP_LINKMENU_ENABLE_SECOND' => !empty($config['linkmenu_enable_second']) ? true : false, 'LINKMENU_NAME_FIELD_SECOND' => isset($config['linkmenu_name_field_second']) ? $config['linkmenu_name_field_second'] : '', 'LINKMENU_TEXT_FIELD_SECOND' => isset($config['linkmenu_text_field_second']) ? $config['linkmenu_text_field_second'] : '', 'ACP_LINKMENU_ENABLE_THIRD' => !empty($config['linkmenu_enable_third']) ? true : false, 'LINKMENU_NAME_FIELD_THIRD' => isset($config['linkmenu_name_field_third']) ? $config['linkmenu_name_field_third'] : '', 'LINKMENU_TEXT_FIELD_THIRD' => isset($config['linkmenu_text_field_third']) ? $config['linkmenu_text_field_third'] : '', 'U_ACTION' => $this->u_action));
 }
开发者ID:alhitary,项目名称:Link-menu,代码行数:25,代码来源:linkmenu_module.php

示例15: main

 public function main($id, $mode)
 {
     global $config, $user, $template, $request;
     $user->add_lang_ext('tas2580/paypal', 'common');
     switch ($mode) {
         case 'settings':
             $this->tpl_name = 'acp_paypal_body';
             $this->page_title = $user->lang('ACP_PAYPAL_TITLE');
             add_form_key('acp_paypal');
             // Form is submitted
             if ($request->is_set_post('submit')) {
                 if (!check_form_key('acp_paypal')) {
                     trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
                 }
                 $config->set('paypal_email', $request->variable('paypal_email', ''));
                 $config->set('paypal_default_item', $request->variable('paypal_default_item', ''));
                 $config->set('paypal_description', $request->variable('paypal_description', ''));
                 trigger_error($user->lang('ACP_SAVED') . adm_back_link($this->u_action));
             }
             $template->assign_vars(array('U_ACTION' => $this->u_action, 'PAYPAL_EMAIL' => isset($config['paypal_email']) ? $config['paypal_email'] : '', 'PAYPAL_DEFAULT_ITEM' => isset($config['paypal_default_item']) ? $config['paypal_default_item'] : '', 'PAYPAL_DESCRIPTION' => isset($config['paypal_description']) ? $config['paypal_description'] : ''));
             break;
         case 'items':
             $this->tpl_name = 'acp_paypal_items_body';
             $this->page_title = $user->lang('ACP_PAYPAL_ITEMS');
             break;
     }
 }
开发者ID:Talk19Zehn,项目名称:paypal,代码行数:27,代码来源:paypal_module.php


注:本文中的check_form_key函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。