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));
 }
Example #3
0
    public function handle_downloadlog()
    {
        if (!$this->auth->acl_get('a_')) {
            trigger_error('Access Denied');
        } else {
            $this->user->add_lang_ext('dmzx/downloadlog', 'common');
            $fileid = $this->request->variable('file', 0);
            $start = $this->request->variable('start', 0);
            // Pagination number from ACP
            $dll = $this->config['downloadlog_value'];
            // Generate pagination
            $sql = 'SELECT COUNT(downloadslog_id) AS total_downloadlogs
				FROM ' . $this->userdownloadslog_table . '
				WHERE user_id = user_id
				AND file_id = ' . $fileid;
            $result = $this->db->sql_query($sql);
            $total_downloadlogs = (int) $this->db->sql_fetchfield('total_downloadlogs');
            $sql = 'SELECT d.user_id, d.down_date, u.user_id, u.username, u.user_colour
				FROM ' . $this->userdownloadslog_table . ' d, ' . USERS_TABLE . ' u
				WHERE u.user_id = d.user_id
				AND file_id = ' . $fileid . '
				ORDER BY d.down_date DESC';
            $top_result = $this->db->sql_query_limit($sql, $dll, $start);
            while ($row = $this->db->sql_fetchrow($top_result)) {
                $this->template->assign_block_vars('downloaders', array('D_USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'D_TIME' => $this->user->format_date($row['down_date'])));
            }
        }
        $pagination_url = $this->helper->route('dmzx_downloadlog_controller', array('file' => $fileid));
        //Start pagination
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_downloadlogs, $dll, $start);
        $this->template->assign_vars(array('DOWNLOADERS_USERS' => $total_downloadlogs == 1 ? $this->user->lang['DOWNLOADERS_COUNT'] : sprintf($this->user->lang['DOWNLOADERS_COUNTS'], $total_downloadlogs), 'DOWNLOADERS_VERSION' => $this->config['downloadlog_version']));
        page_header('Downloaders Log', false);
        $this->template->set_filenames(array('body' => 'DownloadLog.html'));
        page_footer();
    }
 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']));
 }
 /**
  * {@inheritdoc}
  */
 public function get_cookie_categories()
 {
     // Get categories from the cookie and htmlspecialchars decode it
     $cookie_data = htmlspecialchars_decode($this->request->variable($this->config['cookie_name'] . '_ccat', '', true, \phpbb\request\request_interface::COOKIE));
     // json decode the cookie data and return an array
     return (array) json_decode($cookie_data, true);
 }
 /**
  * Allow to change their colour
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function modify_profile_info($event)
 {
     $this->user->add_lang_ext('dmzx/usernamecolourchanger', 'common');
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('user_colour' => $this->request->variable('user_colour', $this->user->data['user_colour'], true)));
     $this->template->assign_vars(array('COLOUR' => $event['data']['user_colour'], 'USE_USERNAMECOLOURCHANGER' => $this->auth->acl_get('u_usernamecolourchanger_use')));
 }
Example #7
0
 public function acp_manage_forums_request_data($event)
 {
     $sfpo_array = $event['forum_data'];
     $sfpo_array['sfpo_guest_enable'] = $this->request->variable('sfpo_guest_enable', 0);
     $sfpo_array['sfpo_characters'] = $this->request->variable('sfpo_characters', 0);
     $event['forum_data'] = $sfpo_array;
 }
Example #8
0
 /**
  * Delete a shoutbox post
  *
  * @param int $id
  *
  * @throws \paul999\ajaxshoutbox\exceptions\shoutbox_exception
  */
 public function delete_post($id)
 {
     if (!$id) {
         $id = $this->request->variable('id', 0);
     }
     $sql = 'SELECT user_id FROM ' . $this->table . ' WHERE shout_id = ' . (int) $id;
     $result = $this->db->sql_query($sql);
     $row = $this->db->sql_fetchrow();
     $this->db->sql_freeresult($result);
     if (!$row) {
         throw new shoutbox_exception('AJAX_SHOUTBOX_NO_SUCH_POST');
     }
     if (!$this->auth->acl_get('m_shoutbox_delete')) {
         // User has no m_ permission.
         if ($row['user_id'] != $this->user->data['user_id']) {
             throw new shoutbox_exception('AJAX_SHOUTBOX_NO_SUCH_POST');
         }
         if (!$this->auth->acl_get('u_shoutbox_delete')) {
             throw new shoutbox_exception('AJAX_SHOUTBOX_NO_PERMISSION');
         }
     }
     if ($this->push->canPush()) {
         if ($this->push->delete($id) === false) {
             throw new shoutbox_exception('AJAX_SHOUTBOX_PUSH_NOT_AVAIL');
         }
     }
     $sql = 'DELETE FROM ' . $this->table . ' WHERE shout_id =  ' . (int) $id;
     $this->db->sql_query($sql);
 }
 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));
 }
 /**
  * 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));
 }
 /**
  * @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));
 }
Example #12
0
    public function base()
    {
        $note = utf8_normalize_nfc($this->request->variable('note', '', true));
        $submit = isset($_POST['submit']) ? true : false;
        $error = array();
        // check if user s logged in, since this page can be used only after registration...
        if (!$this->user->data['is_registered']) {
            login_box($this->helper->route('vinny_usersnotes_controller'));
        }
        // ... and also this is not for bots (especially for bad ones :)
        if ($this->user->data['is_bot']) {
            redirect(append_sid("{$this->phpbb_root_path}index.{$this->phpEx}"));
        }
        $s_action = $this->helper->route('vinny_usersnotes_controller');
        $s_hidden_fields = '';
        add_form_key('postform');
        // create a template variables
        $this->template->assign_vars(array('S_POST_ACTION' => $s_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'ERROR' => sizeof($error) ? implode('<br />', $error) : ''));
        if ($submit) {
            /*if(!check_form_key('postform'))
            		{
            			trigger_error('FORM_INVALID');
            		}*/
            $sql = 'UPDATE ' . USERS_TABLE . '
				SET user_note = "' . $note . '"
				WHERE user_id = ' . $this->user->data['user_id'];
            $this->db->sql_query($sql);
            meta_refresh(3, $this->helper->route('vinny_usersnotes_controller'));
            trigger_error(sprintf($this->user->lang['NOTES_SAVED'], $this->helper->route('vinny_usersnotes_controller')));
        }
        // create a template variables
        $this->template->assign_vars(array('NOTE' => $this->user->data['user_note']));
        $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['NOTES']));
        return $this->helper->render('notes.html', $this->user->lang['NOTES']);
    }
Example #13
0
 public function ucp_prefs_get_data($event)
 {
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('rt_enable' => $this->request->variable('rt_enable', (int) $this->user->data['user_rt_enable']), 'rt_alt_location' => $this->request->variable('rt_alt_location', (int) $this->user->data['user_rt_alt_location']), 'rt_sort_start_time' => $this->request->variable('rt_sort_start_time', (int) $this->user->data['user_rt_sort_start_time']), 'rt_unread_only' => $this->request->variable('rt_unread_only', (int) $this->user->data['user_rt_unread_only'])));
     // Output the data vars to the template (except on form submit)
     if (!$event['submit'] && $this->auth->acl_get('u_rt_view')) {
         $this->user->add_lang_ext('paybas/recenttopics', 'recenttopics_ucp');
         $template_vars = array();
         if ($this->auth->acl_get('u_rt_enable') || $this->auth->acl_get('u_rt_alt_location') || $this->auth->acl_get('u_rt_sort_start_time') || $this->auth->acl_get('u_rt_unread_only')) {
             $template_vars += array('S_RT_SHOW' => true);
         }
         if ($this->auth->acl_get('u_rt_enable')) {
             $template_vars += array('A_RT_ENABLE' => true, 'S_RT_ENABLE' => $event['data']['rt_enable']);
         }
         if ($this->auth->acl_get('u_rt_alt_location')) {
             $template_vars += array('A_RT_ALT_LOCATION' => true, 'S_RT_ALT_LOCATION' => $event['data']['rt_alt_location']);
         }
         if ($this->auth->acl_get('u_rt_sort_start_time')) {
             $template_vars += array('A_RT_SORT_START_TIME' => true, 'S_RT_SORT_START_TIME' => $event['data']['rt_sort_start_time']);
         }
         if ($this->auth->acl_get('u_rt_unread_only')) {
             $template_vars += array('A_RT_UNREAD_ONLY' => true, 'S_RT_UNREAD_ONLY' => $event['data']['rt_unread_only']);
         }
         $this->template->assign_vars($template_vars);
     }
 }
 /**
  * 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));
 }
Example #15
0
 /**
  * Add a new data field to the UCP
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function ucp_profile_modify_profile_info($event)
 {
     // Only if the user can add to map
     if ($this->auth->acl_get('u_usermap_add')) {
         $hide = $this->auth->acl_get('u_usermap_hide') ? $this->request->variable('usermap_hide', $this->user->data['user_usermap_hide']) : 0;
         if ($this->config['tas2580_usermap_input_method'] == 'zip') {
             $this->user->data['user_usermap_default_country'] = empty($this->user->data['user_usermap_default_country']) ? $this->config['tas2580_usermap_default_country'] : $this->user->data['user_usermap_default_country'];
             $usermap_zip = $this->request->variable('usermap_zip', $this->user->data['user_usermap_zip']);
             $default_country = $this->request->variable('default_country', $this->user->data['user_usermap_default_country']);
             // Query only if zip code has changed
             if ($usermap_zip != $this->user->data['user_usermap_zip'] && $usermap_zip != 0) {
                 $data = $this->get_cords_form_zip($usermap_zip, $default_country, $error);
                 $lon = $data['lon'];
                 $lat = $data['lat'];
             } else {
                 if (empty($usermap_zip) || $usermap_zip == 0) {
                     $lon = 0;
                     $lat = 0;
                 } else {
                     $lon = $this->user->data['user_usermap_lon'];
                     $lat = $this->user->data['user_usermap_lat'];
                 }
             }
         } else {
             $usermap_zip = $default_country = '';
             $lon = substr($this->request->variable('usermap_lon', $this->user->data['user_usermap_lon']), 0, 10);
             $lat = substr($this->request->variable('usermap_lat', $this->user->data['user_usermap_lat']), 0, 10);
         }
         $event['data'] = array_merge($event['data'], array('user_usermap_lon' => empty($lon) ? '' : $lon, 'user_usermap_lat' => empty($lat) ? '' : $lat, 'user_usermap_hide' => (int) $hide, 'user_usermap_zip' => $usermap_zip, 'user_usermap_default_country' => $default_country));
         $this->add_field($event['data']['user_usermap_lon'], $event['data']['user_usermap_lat'], $event['data']['user_usermap_hide'], $event['data']['user_usermap_zip'], $event['data']['user_usermap_default_country']);
     }
 }
 /**
  * Add configuration to UCP
  *
  * @param object	$event The event object
  * @return null
  * @access public
  */
 public function ucp_prefs_add($event)
 {
     $this->user->add_lang_ext('crizzo/maxwidthswitch', 'ucp');
     // I'm so happy that this is just a radiobox! Just a boolean! <3
     $maxwidth = $this->request->variable('maxwidth', (bool) $this->user->data['user_maxwidth']);
     $event['data'] = array_merge($event['data'], array('maxwidth' => $maxwidth));
     $this->template->assign_vars(array('S_MAXWIDTH' => $maxwidth));
 }
 /**
  * Controller for mChat actions called with Ajax requests
  *
  * @param $action The action to perform, one of add|edit|del|clean|refresh|whois
  * @return A Symfony JsonResponse object
  */
 public function action($action)
 {
     if (!$this->request->is_ajax()) {
         throw new \phpbb\exception\http_exception(403, 'NO_AUTH_OPERATION');
     }
     $data = call_user_func(array($this->mchat, 'action_' . $action));
     return new JsonResponse($data);
 }
Example #18
0
 /**
  * Get user's Similar Topics option and display it in UCP Prefs View page
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function ucp_prefs_get_data($event)
 {
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('similar_topics' => $this->request->variable('similar_topics', (int) $this->user->data['user_similar_topics'])));
     // Output the data vars to the template (except on form submit)
     if (!$event['submit']) {
         $this->user->add_lang_ext('vse/similartopics', 'similar_topics');
         $this->template->assign_vars(array('S_SIMILAR_TOPICS' => $this->config['similar_topics'] && $this->auth->acl_get('u_similar_topics'), 'S_DISPLAY_SIMILAR_TOPICS' => $event['data']['similar_topics']));
     }
 }
Example #19
0
 /**
  * Get user's option and display it in UCP Prefs View page
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function ucp_prefs_get_data($event)
 {
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('elonw' => $this->request->variable('elonw', (int) $this->user->data['user_elonw'])));
     // Output the data vars to the template (except on form submit)
     if (!$event['submit']) {
         $this->user->add_lang_ext('rmcgirr83/elonw', 'elonw_ucp');
         $this->template->assign_vars(array('S_UCP_ELONW' => $event['data']['elonw']));
     }
 }
Example #20
0
 /**
  * Get user's Topic Preview option and display it in UCP Prefs View page
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function ucp_prefs_get_data($event)
 {
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('topic_preview' => $this->request->variable('topic_preview', (int) $this->user->data['user_topic_preview'])));
     // Output the data vars to the template (except on form submit)
     if (!$event['submit']) {
         $this->user->add_lang_ext('vse/topicpreview', 'topic_preview_ucp');
         $this->template->assign_vars(array('S_TOPIC_PREVIEW' => $this->config['topic_preview_limit'], 'S_DISPLAY_TOPIC_PREVIEW' => $event['data']['topic_preview']));
     }
 }
 /**
  * Set the options a user can configure
  *
  * @return null
  * @access protected
  */
 protected function set_options()
 {
     $this->config->set('userranks_enable', $this->request->variable('userranks_enable', 0));
     $this->config->set('userranks_header_link', $this->request->variable('userranks_header_link', 0));
     $this->config->set('userranks_ignore_bots', $this->request->variable('userranks_ignore_bots', 0));
     $this->config->set('userranks_members', $this->request->variable('userranks_members', 0));
     $this->config->set('userranks_members_admin', $this->request->variable('userranks_members_admin', 0));
     $this->config->set('userranks_special', $this->request->variable('userranks_special', 0));
     $this->config->set('userranks_special_admin', $this->request->variable('userranks_special_admin', 0));
 }
Example #22
0
 /**
  * Add a new data field to the UCP
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function ucp_profile_modify_profile_info($event)
 {
     // Only if the user can add to map
     if ($this->auth->acl_get('u_usermap_add')) {
         $lon = substr($this->request->variable('usermap_lon', $this->user->data['user_usermap_lon']), 0, 10);
         $lat = substr($this->request->variable('usermap_lat', $this->user->data['user_usermap_lat']), 0, 10);
         $event['data'] = array_merge($event['data'], array('user_usermap_lon' => empty($lon) ? '' : $lon, 'user_usermap_lat' => empty($lat) ? '' : $lat));
         $this->add_field($event['data']['user_usermap_lon'], $event['data']['user_usermap_lat']);
     }
 }
Example #23
0
 /**
  * Check email
  *
  * @return object
  */
 public function email()
 {
     $data = array('email' => $this->request->variable('email', '', true));
     $error = validate_data($data, array('email' => array(array('string', false, 6, 60), array('user_email'))));
     $error = $this->set_error($error);
     if (sizeof($error)) {
         return new Response(implode('<br>', $error));
     }
     return new Response($this->user->lang('EMAIL_GOOD'));
 }
 function main()
 {
     // Only registered users can go beyond this point
     if (!$this->user->data['is_registered']) {
         if ($this->user->data['is_bot']) {
             redirect(append_sid("{$this->phpbb_root_path}index.{$this->phpEx}"));
         }
         login_box('', $this->user->lang['LOGIN_INFO']);
     }
     $adm_points = $this->request->variable('adm_points', false);
     $u_id = $this->request->variable('user_id', 0);
     $post_id = $this->request->variable('post_id', 0);
     if (empty($u_id)) {
         $message = $this->user->lang['EDIT_NO_ID_SPECIFIED'] . '<br /><br /><a href="' . $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'bank_edit')) . '">&laquo; ' . $this->user->lang['BACK_TO_PREV'] . '</a>';
         trigger_error($message);
     }
     $user_id = $u_id;
     add_form_key('bank_edit');
     if ($adm_points != false && ($this->auth->acl_get('a_') || $this->auth->acl_get('m_chg_bank'))) {
         $this->template->assign_block_vars('administer_bank', array());
         $submit = isset($_POST['submit']) ? true : false;
         if ($submit) {
             if (!check_form_key('bank_edit')) {
                 trigger_error('FORM_INVALID');
             }
             $new_points = round($this->request->variable('points', 0.0), 2);
             $this->functions_points->set_bank($u_id, $new_points);
             $sql_array = array('SELECT' => 'user_id, username, user_points, user_colour', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'user_id = ' . (int) $u_id);
             $sql = $this->db->sql_build_query('SELECT', $sql_array);
             $result = $this->db->sql_query($sql);
             $points_user = $this->db->sql_fetchrow($result);
             // Add logs
             $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MOD_BANK', false, array($points_user['username']));
             $message = $post_id ? sprintf($this->user->lang['EDIT_P_RETURN_POST'], '<a href="' . append_sid("{$this->phpbb_root_path}viewtopic.{$this->phpEx}", "p=" . $post_id) . '">', '</a>') : sprintf($this->user->lang['EDIT_P_RETURN_INDEX'], '<a href="' . append_sid("{$this->phpbb_root_path}index.{$this->phpEx}") . '">', '</a>');
             trigger_error(sprintf($this->user->lang['EDIT_POINTS_SET'], $this->config['points_name']) . $message);
         } else {
             $sql_array = array('SELECT' => 'u.user_id, u.username, u.user_points, u.user_colour, b.holding', 'FROM' => array(USERS_TABLE => 'u'), 'LEFT_JOIN' => array(array('FROM' => array($this->points_bank_table => 'b'), 'ON' => 'u.user_id = b.user_id')), 'WHERE' => 'u.user_id = ' . (int) $u_id);
             $sql = $this->db->sql_build_query('SELECT', $sql_array);
             $result = $this->db->sql_query($sql);
             $row = $this->db->sql_fetchrow($result);
             if (empty($u_id)) {
                 $message = $this->user->lang['EDIT_USER_NOT_EXIST'] . '<br /><br /><a href="' . $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'bank_edit')) . '">&laquo; ' . $this->user->lang['BACK_TO_PREV'] . '</a>';
                 trigger_error($message);
             }
             $hidden_fields = build_hidden_fields(array('user_id' => $u_id, 'post_id' => $post_id));
             $this->template->assign_vars(array('USER_NAME' => get_username_string('full', $u_id, $row['username'], $row['user_colour']), 'BANK_POINTS' => sprintf($this->functions_points->number_format_points($row['holding'])), 'POINTS_NAME' => $this->config['points_name'], 'CURRENT_VALUE' => $row['holding'], 'L_POINTS_MODIFY' => sprintf($this->user->lang['EDIT_BANK_MODIFY'], $this->config['points_name']), 'L_P_BANK_TITLE' => sprintf($this->user->lang['EDIT_P_BANK_TITLE'], $this->config['points_name']), 'L_USERNAME' => $this->user->lang['USERNAME'], 'L_SET_AMOUNT' => $this->user->lang['EDIT_SET_AMOUNT'], 'U_USER_LINK' => append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", "mode=viewprofile&amp;u=" . $u_id), 'S_ACTION' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'bank_edit', 'adm_points' => '1')), 'S_HIDDEN_FIELDS' => $hidden_fields));
         }
     }
     // Generate the page
     page_header($this->user->lang['EDIT_POINTS_ADMIN']);
     // Generate the page template
     $this->template->set_filenames(array('body' => 'points/points_bank_edit.html'));
     page_footer();
 }
 /**
  * {@inheritdoc}
  */
 public function handle($forum_id)
 {
     // Throw an exception for non-AJAX requests or invalid link requests
     if (!$this->request->is_ajax() || !$this->is_valid($forum_id) || !check_link_hash($this->request->variable('hash', ''), 'collapsible_' . $forum_id)) {
         throw new \phpbb\exception\http_exception(403, 'NO_AUTH_OPERATION');
     }
     // Update the user's collapsed category data for the given forum
     $response = $this->operator->set_user_categories($forum_id);
     // Return a JSON response
     return new \Symfony\Component\HttpFoundation\JsonResponse(array('success' => $response));
 }
Example #26
0
 /**
  * Mentions controller accessed from the URL /mentions/user_list
  *
  * @return null
  * @access public
  */
 public function get_userlist()
 {
     // Send a JSON response if an AJAX request was used
     if ($this->request->is_ajax()) {
         // If we have a query_string, we just get those usernames
         $query_string = $this->request->variable('term', '') ? $this->request->variable('term', '') : false;
         $user_list = $this->mentions->get_userlist($query_string);
         $user_list = array_values($user_list);
         $json_response = new \phpbb\json_response();
         $json_response->send($user_list);
     }
 }
Example #27
0
 /**
  * Controller for mChat
  *
  * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
  */
 public function handle()
 {
     $ret = $this->render_helper->render_data_for_page();
     // If this was an ajax request, we just create an json_response and return that. It's not ours to handle here.
     if ($this->request->is_ajax() && is_array($ret) && isset($ret['json']) && $ret['json'] === true) {
         return new \Symfony\Component\HttpFoundation\JsonResponse($ret);
     }
     // If error occured, render it
     if (isset($ret['error']) && $ret['error'] == true) {
         return $this->helper->error($ret['error_text'], $ret['error_type']);
     }
     return $this->helper->render($ret['filename'], $ret['lang_title']);
 }
Example #28
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));
 }
Example #29
0
    public function handle_didyouknow()
    {
        $mode = $this->request->variable('mode', '');
        switch ($mode) {
            case 'hide':
                $sql = 'UPDATE ' . USERS_TABLE . '
					SET user_didyouknow = 0
					WHERE user_id = ' . (int) $this->user->data['user_id'];
                $this->db->sql_query($sql);
                $message = $this->user->lang['DIDYOUKNOW_HIDE'] . '<br /><br /><a href="' . append_sid("{$this->phpbb_root_path}index.{$this->phpEx}") . '">' . $this->user->lang['DIDYOUKNOW_BACK_TO_INDEX'] . '</a>';
                trigger_error($message);
                break;
        }
    }
    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));
            }
        }
    }