/**
  * @param string $list_name whitelist or blacklist
  * @param string $u_action phpbb acp-u_action
  */
 private function manage_list($u_action, $list_name)
 {
     $list_name_upper = strtoupper($list_name);
     // Define the name of the form for use as a form key
     $form_name = 'topictags';
     add_form_key($form_name);
     $errors = array();
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key($form_name)) {
             trigger_error('FORM_INVALID');
         }
         $this->config->set(prefixes::CONFIG . '_' . $list_name . '_enabled', $this->request->variable(prefixes::CONFIG . '_' . $list_name . '_enabled', 0));
         $list = rawurldecode(base64_decode($this->request->variable(prefixes::CONFIG . '_' . $list_name, '')));
         if (!empty($list)) {
             $list = json_decode($list, true);
             $tags = array();
             for ($i = 0, $size = sizeof($list); $i < $size; $i++) {
                 $tags[] = $list[$i]['text'];
             }
             $list = json_encode($tags);
         }
         // store the list
         $this->config_text->set(prefixes::CONFIG . '_' . $list_name, $list);
         trigger_error($this->user->lang('TOPICTAGS_' . $list_name_upper . '_SAVED') . adm_back_link($u_action));
     }
     // display
     $list = $this->config_text->get(prefixes::CONFIG . '_' . $list_name);
     $list = base64_encode(rawurlencode($list));
     $this->template->assign_vars(array('TOPICTAGS_VERSION' => $this->user->lang('TOPICTAGS_INSTALLED', $this->config[prefixes::CONFIG . '_version']), 'TOPICTAGS_' . $list_name_upper . '_ENABLED' => $this->config[prefixes::CONFIG . '_' . $list_name . '_enabled'], 'TOPICTAGS_' . $list_name_upper => $list, 'S_RH_TOPICTAGS_INCLUDE_NG_TAGS_INPUT' => true, 'S_RH_TOPICTAGS_INCLUDE_CSS' => true, 'TOPICTAGS_CONVERT_SPACE_TO_MINUS' => $this->config[prefixes::CONFIG . '_convert_space_to_minus'] ? 'true' : 'false', 'S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'U_ACTION' => $u_action));
 }
 public function main($id, $mode)
 {
     global $config, $request, $template, $user;
     $this->config = $config;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     // Add the common lang file
     $this->user->add_lang(array('acp/common'));
     // Add the board snowstormlights ACP lang file
     $this->user->add_lang_ext('prosk8er/snowstormlights', 'info_acp_snowstorm_lights');
     // Load a template from adm/style for our ACP page
     $this->tpl_name = 'snowstorm_lights';
     // Set the page title for our ACP page
     $this->page_title = $user->lang['ACP_SNOWSTORM_LIGHTS'];
     // Define the name of the form for use as a form key
     $form_key = 'acp_snowstorm_lights';
     add_form_key($form_key);
     // If form is submitted or previewed
     if ($this->request->is_set_post('submit')) {
         // Test if form key is valid
         if (!check_form_key($form_key)) {
             trigger_error('FORM_INVALID');
         }
         // Store the config enable/disable state
         $scl_enabled = $this->request->variable('scl_enabled', 0);
         $this->config->set('scl_enabled', $scl_enabled);
         $snow_enabled = $request->variable('snow_enabled', 0);
         $this->config->set('snow_enabled', $snow_enabled);
         // Output message to user for the update
         trigger_error($this->user->lang('SNOWSTORM_LIGHTS_SAVED') . adm_back_link($this->u_action));
     }
     // Output data to the template
     $this->template->assign_vars(array('SCL_ENABLED' => isset($this->config['scl_enabled']) ? $this->config['scl_enabled'] : '', 'SNOW_ENABLED' => isset($this->config['snow_enabled']) ? $this->config['snow_enabled'] : '', 'U_ACTION' => $this->u_action));
 }
 public function main($id, $mode)
 {
     global $config, $request, $template, $user;
     $this->config = $config;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->user->add_lang('acp/common');
     $this->user->add_lang_ext('phpbbmodders/holidayflare', 'holidayflare_acp');
     $this->tpl_name = 'acp_holidayflare';
     $this->page_title = $this->user->lang('ACP_HOLIDAYFLARE');
     $form_key = 'acp_holidayflare';
     add_form_key($form_key);
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key($form_key)) {
             trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         /* XMAS Start */
         $enable_xmas = $this->request->variable('enable_xmas', 0);
         $this->config->set('enable_xmas', $enable_xmas);
         /* XMAS Stop */
         /* Valentine Start */
         $enable_valentine = $this->request->variable('enable_valentine', 0);
         $this->config->set('enable_valentine', $enable_valentine);
         /* Valentine Stop */
         trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('S_ENABLE_XMAS' => isset($this->config['enable_xmas']) ? $this->config['enable_xmas'] : '', 'S_ENABLE_VALENTINE' => isset($this->config['enable_valentine']) ? $this->config['enable_valentine'] : '', 'U_ACTION' => $this->u_action));
 }
 protected function set_personal_settings()
 {
     if ($this->request->is_set_post('submit')) {
         $gallery_settings = array('watch_own' => $this->request->variable('watch_own', false), 'watch_com' => $this->request->variable('watch_com', false), 'user_allow_comments' => $this->request->variable('allow_comments', false));
         $additional_settings = array();
         /**
          * Event set personal settings
          *
          * @event phpbbgallery.core.ucp.set_settings_submit
          * @var	array	additional_settings		array of additional settings
          * @since 1.2.0
          */
         $vars = array('additional_settings');
         extract($this->dispatcher->trigger_event('phpbbgallery.core.ucp.set_settings_submit', compact($vars)));
         $gallery_settings = array_merge($gallery_settings, $additional_settings);
         if (!$this->config['phpbb_gallery_allow_comments'] || !$this->config['phpbb_gallery_comment_user_control']) {
             unset($gallery_settings['user_allow_comments']);
         }
         $this->gallery_user->set_user_id($this->user->data['user_id']);
         $this->gallery_user->update_data($gallery_settings);
         meta_refresh(3, $this->u_action);
         trigger_error($this->user->lang['WATCH_CHANGED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'));
     }
     /**
      * Event no submit personal settings
      *
      * @event phpbbgallery.core.ucp.set_settings_nosubmit
      * @since 1.2.0
      */
     $this->dispatcher->dispatch('phpbbgallery.core.ucp.set_settings_nosubmit');
     $this->template->assign_vars(array('S_PERSONAL_SETTINGS' => true, 'S_UCP_ACTION' => $this->u_action, 'L_TITLE' => $this->user->lang['UCP_GALLERY_SETTINGS'], 'L_TITLE_EXPLAIN' => $this->user->lang['WATCH_NOTE'], 'S_WATCH_OWN' => $this->gallery_user->get_data('watch_own'), 'S_WATCH_COM' => $this->gallery_user->get_data('watch_com'), 'S_ALLOW_COMMENTS' => $this->gallery_user->get_data('user_allow_comments'), 'S_COMMENTS_ENABLED' => $this->config['phpbb_gallery_allow_comments'] && $this->config['phpbb_gallery_comment_user_control']));
 }
 /**
  * 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));
 }
 /**
  * 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));
 }
 /**
  * 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));
 }
 function main($id, $mode)
 {
     global $phpbb_container, $user, $template, $config, $request;
     $this->phpbb_container = $phpbb_container;
     $this->user = $user;
     $this->template = $template;
     $this->config = $config;
     $this->request = $request;
     $this->log = $this->phpbb_container->get('log');
     $this->tpl_name = 'acp_codebox_plus';
     $this->page_title = $this->user->lang('CODEBOX_PLUS_TITLE');
     add_form_key('o0johntam0o/acp_codebox_plus');
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key('o0johntam0o/acp_codebox_plus')) {
             trigger_error('FORM_INVALID');
         }
         $this->config->set('codebox_plus_syntax_highlighting', $request->variable('codebox_plus_syntax_highlighting', 0));
         $this->config->set('codebox_plus_expanded', $request->variable('codebox_plus_expanded', 0));
         $this->config->set('codebox_plus_download', $request->variable('codebox_plus_download', 0));
         $this->config->set('codebox_plus_login_required', $request->variable('codebox_plus_login_required', 0));
         $this->config->set('codebox_plus_prevent_bots', $request->variable('codebox_plus_prevent_bots', 0));
         $this->config->set('codebox_plus_captcha', $request->variable('codebox_plus_captcha', 0));
         $this->config->set('codebox_plus_max_attempt', $request->variable('codebox_plus_max_attempt', 0));
         $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'CODEBOX_PLUS_LOG_MSG');
         trigger_error($this->user->lang('CODEBOX_PLUS_SAVED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('U_ACTION' => $this->u_action, 'S_CODEBOX_PLUS_VERSION' => isset($this->config['codebox_plus_version']) ? $this->config['codebox_plus_version'] : 0, 'S_CODEBOX_PLUS_SYNTAX_HIGHLIGHTING' => isset($this->config['codebox_plus_syntax_highlighting']) ? $this->config['codebox_plus_syntax_highlighting'] : 0, 'S_CODEBOX_PLUS_EXPANDED' => isset($this->config['codebox_plus_expanded']) ? $this->config['codebox_plus_expanded'] : 0, 'S_CODEBOX_PLUS_DOWNLOAD' => isset($this->config['codebox_plus_download']) ? $this->config['codebox_plus_download'] : 0, 'S_CODEBOX_PLUS_LOGIN_REQUIRED' => isset($this->config['codebox_plus_login_required']) ? $this->config['codebox_plus_login_required'] : 0, 'S_CODEBOX_PLUS_PREVENT_BOTS' => isset($this->config['codebox_plus_prevent_bots']) ? $this->config['codebox_plus_prevent_bots'] : 0, 'S_CODEBOX_PLUS_CAPTCHA' => isset($this->config['codebox_plus_captcha']) ? $this->config['codebox_plus_captcha'] : 0, 'S_CODEBOX_PLUS_MAX_ATTEMPT' => isset($this->config['codebox_plus_max_attempt']) ? $this->config['codebox_plus_max_attempt'] : 0));
 }
示例#9
0
 public function main($id, $mode)
 {
     global $phpbb_container, $table_prefix;
     if (!defined('CHAT_TABLE')) {
         $chat_table = $table_prefix . 'ajax_chat';
         define('CHAT_TABLE', $chat_table);
     }
     $this->id = $id;
     $this->mode = $mode;
     // Initialization
     $this->auth = $phpbb_container->get('auth');
     $this->config = $phpbb_container->get('config');
     $this->db = $phpbb_container->get('dbal.conn');
     $this->user = $phpbb_container->get('user');
     $this->template = $phpbb_container->get('template');
     $this->request = $phpbb_container->get('request');
     $this->u_action = $this->request->variable('action', '', true);
     $submit = $this->request->is_set_post('submit') ? true : false;
     $this->form_key = 'acp_ajax_chat';
     add_form_key($this->form_key);
     $display_vars = ['title' => 'ACP_AJAX_CHAT_TITLE', 'vars' => ['legend1' => 'AJAX_CHAT_SETTINGS', 'display_ajax_chat' => ['lang' => 'DISPLAY_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'index_display_ajax_chat' => ['lang' => 'INDEX_DISPLAY_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'whois_chatting' => ['lang' => 'WHOIS_CHATTING', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'rule_ajax_chat' => ['lang' => 'RULE_AJAX_CHAT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true], 'ajax_chat_archive_amount' => ['lang' => 'ARCHIVE_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:500', 'explain' => true], 'ajax_chat_popup_amount' => ['lang' => 'POPUP_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:150', 'explain' => true], 'ajax_chat_index_amount' => ['lang' => 'INDEX_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:150', 'explain' => true], 'ajax_chat_chat_amount' => ['lang' => 'CHAT_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:150', 'explain' => true], 'ajax_chat_time_setting' => ['lang' => 'TIME_SETTING_AJAX_CHAT', 'validate' => 'string', 'type' => 'text:10:20', 'explain' => true], 'refresh_online_chat' => ['lang' => 'REFRESH_ONLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'refresh_idle_chat' => ['lang' => 'REFRESH_IDLE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'refresh_offline_chat' => ['lang' => 'REFRESH_OFFLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'status_online_chat' => ['lang' => 'STATUS_ONLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'status_idle_chat' => ['lang' => 'STATUS_IDLE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'status_offline_chat' => ['lang' => 'STATUS_OFFLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'legend2' => 'AJAX_CHAT_LOCATION', 'location_ajax_chat_override' => ['lang' => 'LOCATION_AJAX_CHAT_OVERRIDE', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'location_ajax_chat' => ['lang' => 'LOCATION_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], 'legend3' => 'AJAX_CHAT_POSTS', 'ajax_chat_forum_posts' => ['lang' => 'FORUM_POSTS_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_topic' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_reply' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_REPLY', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_edit' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_EDIT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_quote' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_QUOTE', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'legend4' => 'AJAX_CHAT_PRUNE', 'prune_ajax_chat' => ['lang' => 'PRUNE_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'prune_keep_ajax_chat' => ['lang' => 'PRUNE_KEEP_AJAX_CHAT', 'validate' => 'int', 'type' => 'number', 'explain' => false], 'prune_now' => ['lang' => 'PRUNE_NOW', 'validate' => 'bool', 'type' => 'custom', 'explain' => false, 'method' => 'prune_chat'], 'truncate_now' => ['lang' => 'TRUNCATE_NOW', 'validate' => 'bool', 'type' => 'custom', 'explain' => false, 'method' => 'truncate_chat'], 'ajax_chat_counter' => ['lang' => 'CHAT_COUNTER', 'validate' => 'bool', 'type' => 'custom', 'explain' => false, 'method' => 'chat_counter'], 'legend5' => 'ACP_SUBMIT_CHANGES']];
     #region Submit
     if ($submit) {
         $submit = $this->do_submit_stuff($display_vars);
         // If the submit was valid, so still submitted
         if ($submit) {
             trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action), E_USER_NOTICE);
         }
     }
     #endregion
     $this->generate_stuff_for_cfg_template($display_vars);
     // Output page template file
     $this->tpl_name = 'ajax_chat';
     $this->page_title = $this->user->lang($display_vars['title']);
 }
示例#10
0
    /**
     * 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));
    }
示例#11
0
 /**
  * Validate config vars and update config table if needed
  *
  * @return null
  */
 public function process()
 {
     $submit = $this->request->is_set_post('submit') ? true : false;
     $this->new_config = $this->config;
     $cfg_array = $this->request->is_set('config') ? $this->request->variable('config', array('' => ''), true) : $this->new_config;
     $error = array();
     // We validate the complete config if whished
     validate_config_vars($this->display_vars['vars'], $cfg_array, $error);
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($this->display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             $this->config->set($config_name, $config_value);
         }
     }
     if ($submit) {
         $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'DIR_CONFIG_SETTINGS');
         trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('L_TITLE' => $this->user->lang[$this->display_vars['title']], 'L_TITLE_EXPLAIN' => $this->user->lang[$this->display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
 }
 public function main($id, $mode)
 {
     global $phpbb_container;
     // Initialization
     $this->config = $phpbb_container->get('config');
     $this->db = $phpbb_container->get('dbal.conn');
     $this->user = $phpbb_container->get('user');
     $this->template = $phpbb_container->get('template');
     $this->request = $phpbb_container->get('request');
     $action = $this->request->variable('action', '', true);
     $submit = $this->request->is_set_post('submit') ? true : false;
     $this->form_key = 'acp_advancedpolls';
     add_form_key($this->form_key);
     $display_vars = array('title' => 'AP_TITLE_ACP', 'vars' => array('legend1' => 'AP_GLOBAL_SETTINGS', 'wolfsblvt.advancedpolls.activate_incremental_votes' => array('lang' => 'AP_ACT_INCREMENTAL_VOTES', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.activate_closed_voting' => array('lang' => 'AP_ACT_CLOSED_VOTING', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.activate_no_vote' => array('lang' => 'AP_ACT_POLL_NO_VOTE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.activate_poll_end' => array('lang' => 'AP_ACT_POLL_END', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.activate_notifications' => array('lang' => 'AP_ACT_POLL_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend2' => 'AP_PER_POLL_SETTINGS', 'wolfsblvt.advancedpolls.activate_poll_scoring' => array('lang' => 'AP_ACT_POLL_SCORING', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.default_poll_votes_change' => array('lang' => 'AP_DEFAULT_VOTES_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'wolfsblvt.advancedpolls.activate_poll_votes_hide' => array('lang' => 'AP_ACT_VOTES_HIDE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.default_poll_votes_hide' => array('lang' => 'AP_DEFAULT_VOTES_HIDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'wolfsblvt.advancedpolls.activate_poll_voters_show' => array('lang' => 'AP_ACT_VOTERS_SHOW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.default_poll_voters_show' => array('lang' => 'AP_DEFAULT_VOTERS_SHOW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'wolfsblvt.advancedpolls.activate_poll_voters_limit' => array('lang' => 'AP_ACT_VOTERS_LIMIT', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.default_poll_voters_limit' => array('lang' => 'AP_DEFAULT_VOTERS_LIMIT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'wolfsblvt.advancedpolls.activate_poll_show_ordered' => array('lang' => 'AP_ACT_SHOW_ORDERED', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'wolfsblvt.advancedpolls.default_poll_show_ordered' => array('lang' => 'AP_DEFAULT_SHOW_ORDERED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend3' => 'ACP_SUBMIT_CHANGES'));
     #region Submit
     if ($submit) {
         $submit = $this->do_submit_stuff($display_vars);
         // If the submit was valid, so still submitted
         if ($submit) {
             trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action), E_USER_NOTICE);
         }
     }
     #endregion
     $this->generate_stuff_for_cfg_template($display_vars);
     // Output page template file
     $this->tpl_name = 'acp_advancedpolls';
     $this->page_title = $this->user->lang($display_vars['title']);
 }
 /**
  * Set ACP board settings
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function acp_board_settings($event)
 {
     if ($event['mode'] == 'features') {
         $this->helper->modify_acp_display_vars($event);
         $this->user->add_lang_ext('marc/quickedit', 'quickedit_acp');
         if ($this->request->is_set_post('allow_quick_edit_enable')) {
             $this->helper->enable_quick_edit($event);
         }
     }
 }
 public function main($id, $mode)
 {
     global $config, $db, $request, $template, $user, $phpbb_root_path, $phpEx, $phpbb_container;
     $this->config = $config;
     $this->db = $db;
     $this->log = $phpbb_container->get('log');
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $phpEx;
     // Load a template from adm/style for our ACP page
     $this->tpl_name = 'acp_usermerge';
     // Set the page title for our ACP page
     $this->page_title = 'ACP_USER_MERGE';
     // Quick var-checking and var setup.
     $action = $this->request->variable('action', '');
     $merge = $action == 'merge' ? true : false;
     $errors = array();
     $old_username = $this->request->variable('old_username', '', true);
     $new_username = $this->request->variable('new_username', '', true);
     $form_key = 'acp_user_merge';
     add_form_key($form_key);
     // Hath we an invalid form key?
     if ($this->request->is_set_post('submit') && !check_form_key($form_key)) {
         $errors[] = $user->lang['FORM_INVALID'];
     }
     if ($this->request->is_set_post('submit') || $merge) {
         $old_user_id = $this->check_user($old_username, $errors, true);
         $new_user_id = $this->check_user($new_username, $errors, false);
     }
     // Make sure we have submitted the form, and that we do not have errors
     if (($this->request->is_set_post('submit') || $merge) && !sizeof($errors)) {
         if ($old_user_id == $new_user_id) {
             $warning = sprintf($this->user->lang['CANNOT_MERGE_SAME'], $old_username);
             trigger_error($warning . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // Have we confirmed this change?
         if (confirm_box(true)) {
             // Let's roll!
             $this->user_merge($old_user_id, $new_user_id);
             $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_USERS_MERGED', time(), array($old_username . ' &raquo; ' . $new_username));
             trigger_error($this->user->lang['USERS_MERGED'] . adm_back_link($this->u_action));
         } else {
             $hidden_fields = array('i' => $id, 'mode' => $mode, 'old_username' => $old_username, 'new_username' => $new_username, 'action' => 'merge');
             // Be annoying.  Are you suuuuuuuuuuuure?  No, really, are you sure?
             $merge_users_confirm = sprintf($this->user->lang['MERGE_USERS_CONFIRM'], $old_username);
             confirm_box(false, $merge_users_confirm, build_hidden_fields($hidden_fields));
         }
     }
     $user_merge_version = !empty($this->config['usermerge_version']) ? $this->config['usermerge_version'] : '';
     // Assign template stuffs now.
     $this->page_title = $this->user->lang['ACP_USER_MERGE_TITLE'];
     $template->assign_vars(array('S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'USER_MERGE_VERSION' => $user_merge_version, 'U_FIND_OLD_USERNAME' => append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=searchuser&amp;form=user_merge&amp;field=old_username&amp;select_single=true'), 'U_FIND_NEW_USERNAME' => append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=searchuser&amp;form=user_merge&amp;field=new_username&amp;select_single=true'), 'OLD_USERNAME' => !empty($old_user_id) ? $old_username : '', 'NEW_USERNAME' => !empty($new_user_id) ? $new_username : '', 'L_TITLE' => $this->user->lang['ACP_USER_MERGE_TITLE'], 'L_EXPLAIN' => $this->user->lang['ACP_USER_MERGE_EXPLAIN'], 'USERMERGE_VERSION' => $user_merge_version, 'U_ACTION' => $this->u_action));
 }
 /**
  * GeoModerate settings
  *
  */
 public function display_settings()
 {
     add_form_key(self::FORM_KEY);
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key(self::FORM_KEY)) {
             trigger_error('FORM_INVALID');
         }
         $this->save_settings();
         $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'AKISMET_LOG_SETTING_CHANGED');
         trigger_error($this->user->lang('ACP_AKISMET_SETTING_SAVED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('U_ACTION' => $this->u_action, 'GOTHICK_AKISMET_API_KEY' => $this->config['gothick_akismet_api_key']));
 }
示例#16
0
 /**
  * {@inheritdoc}
  */
 public function save_autogroup_rule($autogroups_id = 0)
 {
     // Process auto group form data if form was submitted
     if ($this->request->is_set_post('submit')) {
         $this->submit_autogroup_rule($autogroups_id);
     }
     // Get data for the auto group so we can display it
     $autogroups_data = $this->get_autogroup($autogroups_id);
     // Process the auto group data for display in the template
     $this->build_groups_menu(array($autogroups_data['autogroups_group_id']), true);
     $this->build_conditions_menu($autogroups_data['autogroups_type_id']);
     $this->template->assign_vars(array('S_ADD' => (bool) (!$autogroups_id), 'S_EDIT' => (bool) $autogroups_id, 'MIN_VALUE' => (int) $autogroups_data['autogroups_min_value'], 'MAX_VALUE' => (int) $autogroups_data['autogroups_max_value'], 'S_DEFAULT' => (bool) $autogroups_data['autogroups_default'], 'S_NOTIFY' => (bool) $autogroups_data['autogroups_notify'], 'U_FORM_ACTION' => $this->u_action . '&amp;action=' . ($autogroups_id ? 'edit' : 'add') . '&amp;autogroups_id=' . $autogroups_id, 'U_ACTION' => $this->u_action, 'U_BACK' => $this->u_action));
 }
示例#17
0
 /**
  * @inheritdoc
  */
 public function handle()
 {
     $this->user->add_lang_ext('vse/topicpreview', 'topic_preview_acp');
     $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->settings->set_settings();
         trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars($this->settings->display_settings($this->u_action));
 }
 function main($id, $mode)
 {
     global $cache, $config, $db, $phpbb_log, $request, $template, $user, $phpbb_root_path, $phpEx, $phpbb_container;
     $this->cache = $cache;
     $this->config = $config;
     $this->config_text = $phpbb_container->get('config_text');
     $this->db = $db;
     $this->log = $phpbb_log;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $phpEx;
     $this->phpbb_container = $phpbb_container;
     // Add the board rules ACP lang file
     $this->user->add_lang_ext('darkdiesel/pagescroller', 'pagescroller_acp');
     $this->tpl_name = 'pagescroller';
     $this->page_title = $user->lang('ACP_PAGESCROLLER_SETTINGS');
     add_form_key('darkdiesel/pagescroller');
     /** @var \darkdiesel\pagescroller\event\main_listener $listener */
     $listener = $this->phpbb_container->get('darkdiesel.pagescroller.listener');
     $scroller_styles = $listener->get_images('.svg', 'chevron-up-style');
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key('darkdiesel/pagescroller')) {
             $this->user->add_lang('acp/common');
             trigger_error('FORM_INVALID');
         }
         $this->config->set('darkdiesel_pagescroller_horizontal_pos', $this->request->variable('darkdiesel_pagescroller_horizontal_pos', 'right'));
         $this->config->set('darkdiesel_pagescroller_vertical_pos', $this->request->variable('darkdiesel_pagescroller_vertical_pos', 'bottom'));
         $this->config->set('darkdiesel_pagescroller_style_type', $this->request->variable('darkdiesel_pagescroller_style_type', '1'));
         $this->config->set('darkdiesel_pagescroller_style_hide_btns', $this->request->variable('darkdiesel_pagescroller_style_hide_btns', 'false'));
         $this->config->set('darkdiesel_pagescroller_style_bgcolor', $this->request->variable('darkdiesel_pagescroller_style_bgcolor', '#0076b1'));
         $this->config->set('darkdiesel_pagescroller_style_chevroncolor', $this->request->variable('darkdiesel_pagescroller_style_chevroncolor', '#FFFFFF'));
         $this->config->set('darkdiesel_pagescroller_scroll_up_speed', $this->request->variable('darkdiesel_pagescroller_scroll_up_speed', '800'));
         $this->config->set('darkdiesel_pagescroller_scroll_down_speed', $this->request->variable('darkdiesel_pagescroller_scroll_down_speed', '800'));
         $this->config->set('darkdiesel_pagescroller_animation_hideshow_enable', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_enable', 'false'));
         $this->config->set('darkdiesel_pagescroller_animation_hideshow_duration_show', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_duration_show', '200'));
         $this->config->set('darkdiesel_pagescroller_animation_hideshow_duration_hide', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_duration_hide', '500'));
         $this->config->set('darkdiesel_pagescroller_animation_hideshow_visible_part', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_visible_part', '20'));
         $this->config->set('darkdiesel_pagescroller_animation_hideshow_distance_to_page', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_distance_to_page', '0'));
         trigger_error($user->lang('ACP_PAGESCROLLER_SETTING_SAVED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('U_ACTION' => $this->u_action, 'DARKDIESEL_PAGESCROLLER_HORIZONTAL_POS' => $this->config['darkdiesel_pagescroller_horizontal_pos'], 'DARKDIESEL_PAGESCROLLER_VERTICAL_POS' => $this->config['darkdiesel_pagescroller_vertical_pos'], 'DARKDIESEL_PAGESCROLLER_STYLE_TYPE' => $this->config['darkdiesel_pagescroller_style_type'], 'DARKDIESEL_PAGESCROLLER_STYLE_HIDE_BTNS' => $this->config['darkdiesel_pagescroller_style_hide_btns'], 'DARKDIESEL_PAGESCROLLER_STYLE_BGCOLOR' => $this->config['darkdiesel_pagescroller_style_bgcolor'], 'DARKDIESEL_PAGESCROLLER_STYLE_CHEVRONCOLOR' => $this->config['darkdiesel_pagescroller_style_chevroncolor'], 'DARKDIESEL_PAGESCROLLER_SCROLL_UP_SPEED' => $this->config['darkdiesel_pagescroller_scroll_up_speed'], 'DARKDIESEL_PAGESCROLLER_SCROLL_DOWN_SPEED' => $this->config['darkdiesel_pagescroller_scroll_down_speed'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_ENABLE' => $this->config['darkdiesel_pagescroller_animation_hideshow_enable'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_DURATION_SHOW' => $this->config['darkdiesel_pagescroller_animation_hideshow_duration_show'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_DURATION_HIDE' => $this->config['darkdiesel_pagescroller_animation_hideshow_duration_hide'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_VISIBLE_PART' => $this->config['darkdiesel_pagescroller_animation_hideshow_visible_part'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_DISTANCE_TO_PAGE' => $this->config['darkdiesel_pagescroller_animation_hideshow_distance_to_page'], 'S_DARKDIESEL_PAGESCROLLER' => true));
     for ($i = 0; $i < count($scroller_styles); $i++) {
         $img = 'pagescroller/styles/all/theme/assets/images/' . 'chevron-up-style' . ($i + 1) . '.svg';
         $img_url = isset($scroller_styles['ext/' . $img]) ? '/ext/darkdiesel/' . $img : '';
         $this->template->assign_block_vars('style_images', array('STYLE' => $i + 1, 'IMAGE' => generate_board_url() . $img_url));
     }
 }
示例#19
0
    public function edit_user_ranks()
    {
        $this->template->assign_vars(array('U_ACTION' => $this->u_action, 'S_FIND_USER' => true, 'U_FIND_USERNAME' => append_sid("{$this->root_path}memberlist.{$this->php_ext}", 'mode=searchuser&amp;form=select_user&amp;field=username&amp;select_single=true')));
        if ($this->request->is_set_post('submit-user')) {
            $username = $this->request->variable('username', '', true);
            $sql = 'SELECT *
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $this->db->sql_query($sql);
            $user = $this->db->sql_fetchrow($result);
            $this->db->sql_freeresult($result);
            if (!$user['user_id']) {
                trigger_error($this->user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
            }
            $sql = 'SELECT *
					FROM ' . RANKS_TABLE . '
					WHERE rank_special = 1
					ORDER BY rank_title';
            $result = $this->db->sql_query($sql);
            $s_rank_one_options = '<option value="0"' . (!$user['user_rank'] ? ' selected="selected"' : '') . '>' . $this->user->lang['ACP_NO_SPEC_RANK'] . '</option>';
            $s_rank_two_options = '<option value="0"' . (!$user['user_rank_two'] ? ' selected="selected"' : '') . '>' . $this->user->lang['ACP_NO_SPEC_RANK'] . '</option>';
            $s_rank_three_options = '<option value="0"' . (!$user['user_rank_three'] ? ' selected="selected"' : '') . '>' . $this->user->lang['ACP_NO_SPEC_RANK'] . '</option>';
            while ($row = $this->db->sql_fetchrow($result)) {
                $selected1 = $user['user_rank'] && $row['rank_id'] == $user['user_rank'] ? ' selected="selected"' : '';
                $s_rank_one_options .= '<option value="' . $row['rank_id'] . '"' . $selected1 . '>' . $row['rank_title'] . '</option>';
                $selected2 = $user['user_rank_two'] && $row['rank_id'] == $user['user_rank_two'] ? ' selected="selected"' : '';
                $s_rank_two_options .= '<option value="' . $row['rank_id'] . '"' . $selected2 . '>' . $row['rank_title'] . '</option>';
                $selected3 = $user['user_rank_three'] && $row['rank_id'] == $user['user_rank_three'] ? ' selected="selected"' : '';
                $s_rank_three_options .= '<option value="' . $row['rank_id'] . '"' . $selected3 . '>' . $row['rank_title'] . '</option>';
            }
            $this->db->sql_freeresult($result);
            $this->template->assign_vars(array('ACP_MR_USER' => sprintf($this->user->lang['ACP_EDIT_USER_RANK'], $user['username']), 'S_EDIT_RANKS' => true, 'S_FIND_USER' => false, 'S_RANK_ONE_OPTIONS' => $s_rank_one_options, 'S_RANK_TWO_OPTIONS' => $s_rank_two_options, 'S_RANK_THREE_OPTIONS' => $s_rank_three_options, 'HIDDEN_RANK_USER_ID' => (int) $user['user_id']));
        }
        add_form_key('submit-rank-key');
        if ($this->request->is_set_post('submit-rank')) {
            if (check_form_key('submit-rank-key')) {
                $rank_one = (int) $this->request->variable('user_rank_one', 0);
                $rank_two = (int) $this->request->variable('user_rank_two', 0);
                $rank_thr = (int) $this->request->variable('user_rank_three', 0);
                $upd_user_id = (int) $this->request->variable('hidden_user_id', 0);
                $upd_sql = 'UPDATE ' . USERS_TABLE . '
							SET user_rank = ' . $rank_one . ',
								user_rank_two = ' . $rank_two . ',
								user_rank_three = ' . $rank_thr . '
							WHERE user_id = ' . $upd_user_id;
                $this->db->sql_query($upd_sql);
                trigger_error($this->user->lang('ACP_MR_SAVED') . adm_back_link($this->u_action));
            }
        }
    }
    /**
     * Edit a flag
     *
     * @param int $flag_id The flag identifier to edit
     * @return null
     * @access public
     */
    public function edit_flag($flag_id)
    {
        // Add form key
        add_form_key('edit_flag');
        $errors = array();
        $flag_row = array('flag_name' => utf8_normalize_nfc($this->request->variable('flag_name', '', true)), 'flag_image' => $this->request->variable('flag_image', ''));
        if ($this->request->is_set_post('submit')) {
            $errors = $this->check_flag($flag_row['flag_image'], $flag_row['flag_name'], $errors, 'edit_flag');
            if (!sizeof($errors)) {
                $sql = 'UPDATE ' . $this->flags_table . '
					SET ' . $this->db->sql_build_array('UPDATE', $flag_row) . '
					WHERE flag_id = ' . (int) $flag_id;
                $this->db->sql_query($sql);
                $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_FLAG_EDIT', time(), array($flag_row['flag_name']));
                $this->cache->destroy('_user_flags');
                $this->functions->cache_flags();
                trigger_error($this->user->lang['MSG_FLAG_EDITED'] . adm_back_link($this->u_action));
            }
        }
        $sql = 'SELECT flag_id, flag_name, flag_image
			FROM ' . $this->flags_table . '
			WHERE flag_id =' . (int) $flag_id;
        $result = $this->db->sql_query($sql);
        $flag_row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        if (!$flag_row) {
            trigger_error($this->user->lang['FLAG_ERROR_NOT_EXIST'] . adm_back_link($this->u_action . '&amp;mode=manage'), E_USER_WARNING);
        }
        $this->template->assign_vars(array('L_TITLE' => $this->user->lang['FLAG_EDIT'], 'U_ACTION' => $this->u_action . "&amp;flag_id={$flag_id}&amp;action=edit", 'U_BACK' => $this->u_action . '&amp;mode=manage', 'ERROR_MSG' => sizeof($errors) ? implode('<br />', $errors) : '', 'FLAG_NAME' => $flag_row['flag_name'], 'FLAG_IMAGE' => $flag_row['flag_image'], 'FLAG_ID' => $flag_row['flag_id'], 'S_ADD_FLAG' => true, 'S_ERROR' => sizeof($errors) ? true : false));
    }
示例#21
0
 /**
  * Primary work on banner, can edit, copy or check a banner
  *
  * @param	string	$banner	The banner's remote url
  * @param	array	$error	The array error, passed by reference
  * @return	null
  */
 public function banner_process(&$banner, &$error)
 {
     $old_banner = $this->request->variable('old_banner', '');
     $destination = $this->dir_helper->get_banner_path();
     // Can we upload?
     $can_upload = $this->config['dir_storage_banner'] && file_exists($this->root_path . $destination) && phpbb_is_writable($this->root_path . $destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
     if ($banner && $can_upload) {
         $file = $this->_banner_upload($banner, $error);
     } else {
         if ($banner) {
             $file = $this->_banner_remote($banner, $error);
         } else {
             if ($this->request->is_set_post('delete_banner') && $old_banner) {
                 $this->_banner_delete($old_banner);
                 return;
             }
         }
     }
     if (!sizeof($error)) {
         if ($banner && $old_banner && !preg_match('/^(http:\\/\\/|https:\\/\\/|ftp:\\/\\/|ftps:\\/\\/|www\\.).+/si', $old_banner)) {
             $this->_banner_delete($old_banner);
         }
         $banner = !empty($file) ? $file : '';
     }
 }
    /**
     * Clear user reputation
     *
     * @param int $uid	User ID
     * @return null
     * @access public
     */
    public function clear_user($uid)
    {
        $this->user->add_lang_ext('pico/reputation', 'reputation_system');
        $is_ajax = $this->request->is_ajax();
        $submit = false;
        $sql_array = array('SELECT' => 'r.*, ut.username AS username_to', 'FROM' => array($this->reputations_table => 'r'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'ut'), 'ON' => 'r.user_id_to = ut.user_id ')), 'WHERE' => 'r.user_id_to = ' . $uid);
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        //We couldn't find this reputation. May be it was deleted meanwhile?
        if (empty($row)) {
            $message = $this->user->lang('RS_NO_REPUTATION');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}index.{$this->php_ext}");
            $redirect_text = 'RETURN_INDEX';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        $redirect = $this->helper->route('reputation_details_controller', array('uid' => $uid));
        if ($this->request->is_set_post('cancel')) {
            redirect($redirect);
        }
        $post_ids = array();
        $post_type_id = (int) $this->reputation_manager->get_reputation_type_id('post');
        $sql = 'SELECT reputation_item_id
			FROM ' . $this->reputations_table . "\n\t\t\tWHERE user_id_to = {$uid}\n\t\t\t\tAND reputation_type_id = {$post_type_id}\n\t\t\tGROUP BY reputation_item_id";
        $result = $this->db->sql_query($sql);
        while ($post_row = $this->db->sql_fetchrow($result)) {
            $post_ids[] = $post_row['reputation_item_id'];
        }
        $this->db->sql_freeresult($result);
        $redirect_text = 'RETURN_PAGE';
        if ($this->auth->acl_gets('m_rs_moderate')) {
            if ($is_ajax) {
                $submit = true;
            } else {
                $s_hidden_fields = build_hidden_fields(array('u' => $uid));
                if (confirm_box(true)) {
                    $submit = true;
                } else {
                    confirm_box(false, $this->user->lang('RS_CLEAR_POST_CONFIRM'), $s_hidden_fields);
                }
            }
        } else {
            $message = $this->user->lang('RS_USER_CANNOT_DELETE');
            $json_data = array('error_msg' => $message);
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        if ($submit) {
            try {
                $this->reputation_manager->clear_user_reputation($uid, $row, $post_ids);
            } catch (\pico\reputation\exception\base $e) {
                // Catch exception
                trigger_error($e->get_message($this->user));
            }
            $message = $this->user->lang('RS_CLEARED_USER');
            $json_data = array('clear_user' => true, 'post_ids' => $post_ids, 'poster_id' => $uid, 'user_reputation' => 0, 'post_reputation' => 0, 'reputation_class' => 'neutral');
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
    }
 function acp_page($id, &$module)
 {
     $captcha_vars = array(self::$CONFIG_SITEKEY => 'RECAPTCHA2_SITEKEY', self::$CONFIG_SECRETKEY => 'RECAPTCHA2_SECRETKEY');
     $module->tpl_name = '@gothick_recaptcha2/captcha_recaptcha2_acp';
     $module->page_title = 'ACP_VC_SETTINGS';
     $form_key = 'acp_captcha';
     add_form_key($form_key);
     if ($this->request->is_set_post('submit') && check_form_key($form_key)) {
         $captcha_vars = array_keys($captcha_vars);
         foreach ($captcha_vars as $captcha_var) {
             $value = $this->request->variable($captcha_var, '');
             if ($value) {
                 $this->config->set($captcha_var, $value);
             }
         }
         $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_CONFIG_VISUAL');
         trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action));
     } else {
         if ($this->request->is_set_post('submit')) {
             trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($module->u_action));
         }
     }
     foreach ($captcha_vars as $captcha_var => $template_var) {
         $var = $this->request->is_set_post($captcha_var) ? $this->request->variable($captcha_var, '') : (isset($this->config[$captcha_var]) ? $this->config[$captcha_var] : '');
         $this->template->assign_var($template_var, $var);
     }
     $this->template->assign_vars(array('CAPTCHA_PREVIEW' => $this->get_demo_template($id), 'CAPTCHA_NAME' => $this->get_service_name(), 'U_ACTION' => $module->u_action));
 }
 /**
  * Calculates the template data for the topic
  *
  * @param int $topic_id the id of the topic
  * @param boolean $is_edit_first_post whether it is a first post edit or not
  * @return array the page data
  */
 private function get_template_data_for_topic($topic_id, $is_edit_first_post)
 {
     $page_data = array();
     $page_data['RH_TOPICTAGS_SHOW_FIELD'] = true;
     // do we got some preview-data?
     $tags = array();
     if ($this->request->is_set_post('rh_topictags')) {
         // use data from post-request
         $tags = $this->get_tags_from_post_request();
     } else {
         if ($is_edit_first_post) {
             // use data from db
             $tags = $this->tags_manager->get_assigned_tags($topic_id);
         }
     }
     $page_data['RH_TOPICTAGS'] = base64_encode(rawurlencode(json_encode($tags)));
     $page_data['RH_TOPICTAGS_ALLOWED_TAGS_REGEX'] = $this->config[prefixes::CONFIG . '_allowed_tags_regex'];
     $page_data['RH_TOPICTAGS_CONVERT_SPACE_TO_MINUS'] = $this->config[prefixes::CONFIG . '_convert_space_to_minus'] ? 'true' : 'false';
     $page_data['S_RH_TOPICTAGS_WHITELIST_ENABLED'] = $this->config[prefixes::CONFIG . '_whitelist_enabled'];
     if ($this->config[prefixes::CONFIG . '_whitelist_enabled']) {
         $page_data['S_RH_TOPICTAGS_WHITELIST_ENABLED'] = true;
         $tags = $this->tags_manager->get_whitelist_tags();
         for ($i = 0, $size = sizeof($tags); $i < $size; $i++) {
             $this->template->assign_block_vars('rh_topictags_whitelist', array('LINK' => '#', 'NAME' => $tags[$i]));
         }
     } else {
         $page_data['RH_TOPICTAGS_ALLOWED_TAGS_EXP'] = $this->config[prefixes::CONFIG . '_allowed_tags_exp_for_users'];
     }
     $page_data['S_RH_TOPICTAGS_INCLUDE_NG_TAGS_INPUT'] = true;
     $page_data['S_RH_TOPICTAGS_INCLUDE_CSS'] = true;
     return $page_data;
 }
 /**
  *  @param		$id			post_id
  *  @param		$part		Code part
  *  @return		mixed		Render output to the template
  **/
 public function downloader($id = 0, $part = 0)
 {
     $id = (int) $id;
     // If download function was disabled
     if (!$this->enable_download) {
         $this->template->assign_var('S_CODEBOX_PLUS_ERROR', $this->user->lang['CODEBOX_PLUS_ERROR_DOWNLOAD_DISABLED']);
         return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
     }
     // Prevent bots
     if ($this->enable_prevent_bots && $this->user->data['is_bot']) {
         redirect(append_sid("{$this->root_path}index.{$this->php_ext}"));
     }
     // Check permission
     $sql = 'SELECT forum_id FROM ' . POSTS_TABLE . ' WHERE post_id = ' . $id;
     $result = $this->db->sql_query($sql);
     $row = $this->db->sql_fetchrow($result);
     $this->db->sql_freeresult($result);
     if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
         $this->template->assign_var('S_CODEBOX_PLUS_ERROR', $this->user->lang['CODEBOX_PLUS_ERROR_NO_PERMISSION']);
         return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
     }
     // Login to download
     if ($this->enable_login_required && !$this->user->data['is_registered']) {
         login_box($this->helper->route('o0johntam0o_codeboxplus_download_controller', array('id' => $id, 'part' => $part)), $this->user->lang['CODEBOX_PLUS_ERROR_LOGIN_REQUIRED']);
     }
     // Captcha
     if ($this->enable_captcha) {
         $tmp_captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
         $tmp_captcha->init(CONFIRM_LOGIN);
         $ok = false;
         if ($this->request->is_set_post('submit')) {
             $tmp_captcha->validate();
             if ($tmp_captcha->is_solved()) {
                 $tmp_captcha->reset();
                 $ok = true;
             }
         }
         // If the form was not submitted yet or the CAPTCHA was not solved
         if (!$ok) {
             // Too many request...
             if ($tmp_captcha->get_attempt_count() >= $this->max_attempt) {
                 $this->template->assign_var('S_CODEBOX_PLUS_ERROR', $this->user->lang['CODEBOX_PLUS_ERROR_CONFIRM']);
                 return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
             }
             $this->template->assign_vars(array('S_CODE_DOWNLOADER_ACTION' => $this->helper->route('o0johntam0o_codeboxplus_download_controller', array('id' => $id, 'part' => $part)), 'S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $tmp_captcha->get_template()));
             return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
         } else {
             // Downloading
             $this->codebox_output($id, $part);
             garbage_collection();
             return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
             //exit_handler();
         }
     } else {
         // Downloading
         $this->codebox_output($id, $part);
         return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
     }
 }
示例#26
0
    /**
     * Delete a thing
     *
     * @param int $id	The Thing ID
     * @return type
     */
    public function wa($user_id)
    {
        $this->user->add_lang_ext('tas2580/mobilenotifier', 'common');
        $sql = 'SELECT username, user_allow_whatsapp, user_whatsapp
			FROM ' . USERS_TABLE . '
				WHERE user_id = ' . (int) $user_id;
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        $submit = $this->request->is_set_post('submit');
        if ($submit) {
            $wa = $this->phpbb_container->get('tas2580.mobilenotifier.src.helper');
            $wa->send($row['user_whatsapp'], 'test');
        }
        $this->template->assign_vars(array('U_ACTION' => $this->helper->route('tas2580_mobilenotifier_send', array('user_id' => $user_id)), 'SEND_WHATSAPP' => $this->user->lang('SEND_WHATSAPP', $row['username'])));
        return $this->helper->render('whatsapp_send.html', $this->user->lang('SEND_WHATSAPP', $row['username']));
    }
示例#27
0
 public function manage()
 {
     if (!$this->auth->acl_get('a_')) {
         return $this->finish('SLIDER_INVALID_LOGIN', 403);
     }
     if (!check_form_key('slider_settings')) {
         return $this->finish('SLIDER_INVALID_FORM', 400);
     }
     if ($this->request->is_set_post('submit_sl_op')) {
         $this->config->set('slider_sl_sw', $this->request->variable('slider_sl_sw', '0'));
         $this->config->set('slider_sl_mfx', $this->request->variable('slider_sl_mfx', '0'));
         $this->config->set('slider_sl_slc', max(1, $this->request->variable('slider_sl_slc', 0)));
         $this->config->set('slider_sl_bxc', max(1, $this->request->variable('slider_sl_bxc', 0)));
         $this->config->set('slider_sl_bxr', max(1, $this->request->variable('slider_sl_bxr', 0)));
         $this->config->set('slider_sl_aspd', max(1, $this->request->variable('slider_sl_aspd', 0)));
         $this->config->set('slider_sl_ptm', max(1, $this->request->variable('slider_sl_ptm', 0)));
         $this->config->set('slider_sl_dnv_sw', $this->request->variable('slider_sl_dnv_sw', '0'));
         $this->config->set('slider_sl_cnv_sw', $this->request->variable('slider_sl_cnv_sw', '0'));
         $this->config->set('slider_sl_poh_sw', $this->request->variable('slider_sl_poh_sw', '0'));
         $this->config->set('slider_sl1_img', $this->request->variable('slider_sl1_img', '', true));
         $this->config->set('slider_sl1_url', $this->request->variable('slider_sl1_url', '', true));
         $this->config->set('slider_sl1_cap', $this->request->variable('slider_sl1_cap', '', true));
         $this->config->set('slider_sl2_img', $this->request->variable('slider_sl2_img', '', true));
         $this->config->set('slider_sl2_url', $this->request->variable('slider_sl2_url', '', true));
         $this->config->set('slider_sl2_cap', $this->request->variable('slider_sl2_cap', '', true));
         $this->config->set('slider_sl3_img', $this->request->variable('slider_sl3_img', '', true));
         $this->config->set('slider_sl3_url', $this->request->variable('slider_sl3_url', '', true));
         $this->config->set('slider_sl3_cap', $this->request->variable('slider_sl3_cap', '', true));
         $this->config->set('slider_sl4_img', $this->request->variable('slider_sl4_img', '', true));
         $this->config->set('slider_sl4_url', $this->request->variable('slider_sl4_url', '', true));
         $this->config->set('slider_sl4_cap', $this->request->variable('slider_sl4_cap', '', true));
         $this->config->set('slider_sl5_img', $this->request->variable('slider_sl5_img', '', true));
         $this->config->set('slider_sl5_url', $this->request->variable('slider_sl5_url', '', true));
         $this->config->set('slider_sl5_cap', $this->request->variable('slider_sl5_cap', '', true));
         $this->config->set('slider_sl6_img', $this->request->variable('slider_sl6_img', '', true));
         $this->config->set('slider_sl6_url', $this->request->variable('slider_sl6_url', '', true));
         $this->config->set('slider_sl6_cap', $this->request->variable('slider_sl6_cap', '', true));
         $this->config->set('slider_sl7_img', $this->request->variable('slider_sl7_img', '', true));
         $this->config->set('slider_sl7_url', $this->request->variable('slider_sl7_url', '', true));
         $this->config->set('slider_sl7_cap', $this->request->variable('slider_sl7_cap', '', true));
         $this->config->set('slider_sl8_img', $this->request->variable('slider_sl8_img', '', true));
         $this->config->set('slider_sl8_url', $this->request->variable('slider_sl8_url', '', true));
         $this->config->set('slider_sl8_cap', $this->request->variable('slider_sl8_cap', '', true));
     }
     return $this->finish('SLIDER_SETTINGS_SAVED', 200, 3);
 }
示例#28
0
 /**
  * Constructor
  *
  * @param \phpbb\cache\service								$cache				Cache object
  * @param \phpbb\db\driver\driver_interface 					$db					Database object
  * @param \phpbb\controller\helper							$helper				Helper object
  * @param \phpbb\log\log										$log				Log object
  * @param \phpbb\request\request								$request			Request object
  * @param \phpbb\template\template							$template			Template object
  * @param \phpbb\user										$user				User object
  * @param \ernadoo\phpbbdirectory\core\categorie				$categorie			PhpBB Directory extension categorie object
  * @param \ernadoo\phpbbdirectory\core\helper				$dir_helper			PhpBB Directory extension helper object
  * @param \ernadoo\phpbbdirectory\core\nestedset_category	$nestedset_category	PhpBB Directory extension nestedset object
  */
 public function __construct(\phpbb\cache\service $cache, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\log\log $log, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\helper $dir_helper, \ernadoo\phpbbdirectory\core\nestedset_category $nestedset_category)
 {
     $this->cache = $cache;
     $this->db = $db;
     $this->helper = $helper;
     $this->phpbb_log = $log;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->categorie = $categorie;
     $this->dir_helper = $dir_helper;
     $this->nestedset_category = $nestedset_category;
     $this->form_key = 'acp_dir_cat';
     add_form_key($this->form_key);
     $this->action = $this->request->variable('action', '');
     $this->cat_id = $request->variable('c', 0);
     $this->parent_id = $request->variable('parent_id', 0);
     $this->update = $this->request->is_set_post('update') ? true : false;
 }
 /**
  * Display the options a user can configure for this extension
  *
  * @return null
  * @access public
  */
 public function display_options()
 {
     // Add the language file
     $this->language->add_lang('acp_autobackup', 'david63/autodbbackup');
     // Create a form key for preventing CSRF attacks
     $form_key = 'auto_db_backup';
     add_form_key($form_key);
     $this->get_filetypes();
     $time = time();
     // Submit
     if ($this->request->is_set_post('submit')) {
         // Is the submitted form is valid?
         if (!check_form_key($form_key)) {
             trigger_error($this->language->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // Get the date/time variables
         $day = $this->request->variable('auto_db_backup_day', 0);
         $month = $this->request->variable('auto_db_backup_month', 0);
         $year = $this->request->variable('auto_db_backup_year', 0);
         $hour = $this->request->variable('auto_db_backup_hour', 0);
         $minute = $this->request->variable('auto_db_backup_minute', 0);
         $enable = $this->request->variable('auto_db_backup_enable', 0);
         // Let's do a bit of validation
         if (!checkdate($month, $day, $year)) {
             trigger_error($this->language->lang('DATE_TIME_ERROR') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         $dst = date('I', $time);
         $this->backup_date = mktime($hour + $dst, $minute, 0, $month, $day, $year);
         // Skip this check if disabling
         if ($enable && $this->backup_date <= $time) {
             trigger_error($this->language->lang('AUTO_DB_BACKUP_TIME_ERROR') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // Set the options the user has configured
         $this->set_options();
         // Add option settings change action to the admin log
         $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_AUTO_DB_BACKUP_SETTINGS');
         trigger_error($this->language->lang('AUTO_DB_BACKUP_SETTINGS_CHANGED') . adm_back_link($this->u_action));
     }
     $next_backup_date = $this->config['auto_db_backup_last_gc'] > $time ? getdate($this->config['auto_db_backup_last_gc']) : getdate($this->config['auto_db_backup_last_gc'] + $this->config['auto_db_backup_gc']);
     // Output the page
     $this->template->assign_vars(array('AUTO_DB_BACKUP_COPIES' => $this->config['auto_db_backup_copies'], 'AUTO_DB_BACKUP_DAY' => $next_backup_date['mday'], 'AUTO_DB_BACKUP_GC' => $this->config['auto_db_backup_gc'] / 3600, 'AUTO_DB_BACKUP_HOUR' => $next_backup_date['hours'], 'AUTO_DB_BACKUP_MINUTE' => $next_backup_date['minutes'], 'AUTO_DB_BACKUP_MONTH' => $next_backup_date['mon'], 'AUTO_DB_BACKUP_VERSION' => ext::AUTO_DB_BACKUP_VERSION, 'AUTO_DB_BACKUP_YEAR' => $next_backup_date['year'], 'S_AUTO_DB_BACKUP_ENABLE' => $this->config['auto_db_backup_enable'], 'S_AUTO_DB_BACKUP_OPTIMIZE' => $this->config['auto_db_backup_optimize'], 'U_ACTION' => $this->u_action, 'YEAR_START' => $next_backup_date['year'], 'YEAR_END' => $next_backup_date['year'] + 1));
 }
示例#30
0
文件: Trader.php 项目: vidakk/trader
 public function editFeedbackAction()
 {
     $feedback_id = $this->request->variable('feedback_id', 0);
     $feedback_row = $this->manager->getAllFeedbackInfo($feedback_id);
     if (!$feedback_row) {
         trigger_error($this->user->lang('E_FEEDBACK_NOT_FOUND') . '<br /><br />');
     }
     $return_user_id = $this->request->variable('u', $feedback_row['to_user_id']);
     $return_user = $this->getUser($return_user_id);
     $feedback_route = $this->helper->route('rfd_trader_view', array('u' => $return_user_id));
     $trader_profile_url = $trader_profile_url = '<a href=' . $feedback_route . '>' . $this->user->lang['BACK_TO_PREV'] . '</a>';
     if (!$this->canEditFeedback($feedback_row['date_created'], $feedback_row['from_user_id'])) {
         trigger_error($this->user->lang('E_CANNOT_EDIT') . '<br /><br />' . $trader_profile_url);
     }
     $edit_history = $this->manager->getFeedbackComments($feedback_id);
     //        unset($edit_history[0]);
     $submit = $this->request->is_set_post('submit');
     $to_user_row = $this->getUser($feedback_row['to_user_id']);
     $rating = $this->request->variable('trader_rating', $feedback_row['rating']);
     $new_short = utf8_normalize_nfc(trim($this->request->variable('short_comment', $feedback_row['short_comment'], true)));
     $new_long = utf8_normalize_nfc(trim($this->request->variable('long_comment', $feedback_row['long_comment'], true)));
     $delete_feedback = $this->request->variable('delete_feedback', $feedback_row['is_deleted']);
     if ($submit && (strlen($new_short) < self::MIN_SHORT_LENGTH || strlen($new_short) > self::MAX_SHORT_LENGTH)) {
         $err_comments['short'] = $this->user->lang['REQUIRED_CHARACTERS'];
     }
     if ($submit && strlen($new_long) > self::MAX_LONG_LENGTH) {
         $err_comments['long'] = true;
     }
     if ($this->user->data['user_timezone']) {
         $timezone = new \DateTimeZone($this->user->data['user_timezone']);
     } else {
         $timezone = new \DateTimeZone($this->config['board_timezone']);
     }
     foreach ($edit_history as $key => $revision) {
         $editor_row = $this->getUser($revision['editor_user_id']);
         $revision['username'] = $editor_row['username'];
         $revision['date_created'] = new \DateTime('@' . $revision['date_created']);
         $revision['date_created']->setTimezone($timezone);
         $edit_history[$key] = $revision;
     }
     if ($submit && !$err_comments['short'] && !$err_comments['long']) {
         if ($delete_feedback != $feedback_row['is_deleted']) {
             if ($delete_feedback) {
                 $this->manager->deleteFeedback($feedback_row, $this->isEditMod());
             } else {
                 $this->manager->revertDelete($feedback_row);
             }
         }
         $this->manager->editFeedback($feedback_row, $rating, $new_short, $new_long, $delete_feedback, $this->user->data['user_id']);
         trigger_error($this->user->lang('E_SUCCESSFUL_EDIT') . '<br /><br />' . $trader_profile_url);
     }
     $this->template->assign_vars(array('EDIT' => true, 'MODERATOR' => $this->isEditMod(), 'HISTORY' => $edit_history, 'DELETED' => $delete_feedback, 'ERROR' => $err_comments, 'RATING' => $rating, 'SHORT' => $new_short, 'LONG' => $new_long, 'USERNAME' => $to_user_row['username'], 'TOPIC_TITLE' => $feedback_row['topic_title'], 'TOPIC_TYPE' => $feedback_row['topic_type'], 'TRADER_USERNAME' => $return_user['username'], 'U_TRADER_PROFILE' => append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&amp;u=' . $return_user_id), 'U_TRADER_FEEDBACK' => $feedback_route, 'U_DATE_FORMAT' => $this->user->data['user_dateformat']));
     return $this->helper->render('TraderFeedback.html', $this->user->lang['FEEDBACK_TITLE_EDIT'] . $to_user_row['username']);
 }