コード例 #1
0
ファイル: notify_user.php プロジェクト: ZerGabriel/phpbb
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->user->session_begin();
     $this->user->setup('common');
     if ($this->config['email_enable']) {
         include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
         // functions_messenger.php uses config to determine language paths
         // Remove when able
         global $config;
         $config = $this->config;
         $messenger = new \messenger(false);
         $messenger->template('installed', $this->install_config->get('user_language', 'en'));
         $messenger->to($this->config['board_email'], $this->install_config->get('admin_name'));
         $messenger->anti_abuse_headers($this->config, $this->user);
         $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($this->install_config->get('admin_name')), 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_passwd'))));
         $messenger->send(NOTIFY_EMAIL);
     }
     // Login admin
     // Ugly but works
     $this->auth->login($this->install_config->get('admin_name'), $this->install_config->get('admin_passwd'), false, true, true);
     $this->iohandler->set_cookie($this->config['cookie_name'] . '_sid', $this->user->session_id);
     $this->iohandler->set_cookie($this->config['cookie_name'] . '_u', $this->user->cookie_data['u']);
     $this->iohandler->set_cookie($this->config['cookie_name'] . '_k', $this->user->cookie_data['k']);
     // Create log
     $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_INSTALL_INSTALLED', false, array($this->config['version']));
     // Remove install_lock
     @unlink($this->phpbb_root_path . 'cache/install_lock');
 }
コード例 #2
0
 /**
  *
  */
 public function add_page_viewonline($event)
 {
     if (strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/mchat') === 0) {
         $event['location'] = $this->user->lang('MCHAT_TITLE');
         $event['location_url'] = $this->helper->route('dmzx_mchat_controller');
     }
 }
コード例 #3
0
ファイル: ajaxchat_module.php プロジェクト: Reaper88/ajaxchat
 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']);
 }
コード例 #4
0
ファイル: listener.php プロジェクト: 3D-I/joined
 public function modify_memberlist($event)
 {
     $poster_data = $event['data'];
     $b = $event['template_data'];
     $b['JOINED'] = $this->user->format_date($poster_data['user_regdate'], $this->date_format);
     $event['template_data'] = $b;
 }
コード例 #5
0
    /**
     * Display the user ranks page
     *
     * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
     * @access public
     */
    public function display($name)
    {
        // Get the rank details
        $sql = 'SELECT *
			FROM ' . RANKS_TABLE . '
			ORDER BY rank_special DESC, rank_min ASC, rank_title ASC';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            if ($this->config['userranks_special'] || $this->config['userranks_special_admin'] && $this->auth->acl_get('a_') || !$this->config['userranks_special'] && !$row['rank_special']) {
                $rank_row = array('S_RANK_IMAGE' => $row['rank_image'] ? true : false, 'S_SPECIAL_RANK' => $row['rank_special'] ? true : false, 'RANK_IMAGE' => $this->path_helper->get_web_root_path() . $this->config['ranks_path'] . '/' . $row['rank_image'], 'RANK_TITLE' => $row['rank_title'], 'MIN_POSTS' => $row['rank_min']);
                $this->template->assign_block_vars('ranks', $rank_row);
                // Are we displaying members?
                if ($this->config['userranks_members'] || $this->config['userranks_members_admin'] && $this->auth->acl_get('a_')) {
                    $rank_users = $this->get_user_rank_data($row['rank_id']);
                    if (sizeof($rank_users) > 0) {
                        foreach ($rank_users as $row_rank) {
                            $this->template->assign_block_vars('ranks.rank_member', array('MEMBERS' => get_username_string('full', $row_rank['user_id'], $row_rank['username'], $row_rank['user_colour'])));
                        }
                    } else {
                        $this->template->assign_block_vars('ranks.rank_member', array('MEMBERS' => $this->user->lang('NO_MEMBERS')));
                    }
                }
            }
        }
        $this->db->sql_freeresult($result);
        // Assign breadcrumb template vars for the user ranks page
        $this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('david63_userranks_main_controller', array('name' => 'ranks')), 'FORUM_NAME' => $this->user->lang('USER_RANKS')));
        // Send all data to the template file
        return $this->helper->render('user_ranks.html', $name);
    }
コード例 #6
0
 /**
  * Setup Smart Subjects
  *
  * @param \phpbb\event\data $event The event object
  * @return void
  */
 public function setup($event)
 {
     $this->user->add_lang_ext('vse/smartsubjects', 'smartsubjects');
     $page_data = $event['page_data'];
     $page_data['S_SMART_SUBJECTS_MOD'] = $this->forum_auth($event['forum_id']) && $this->auth->acl_get('m_', $event['forum_id']);
     $event['page_data'] = $page_data;
 }
コード例 #7
0
 public function main($event)
 {
     // add lang file
     $this->user->add_lang_ext('v12mike/postoftheday', 'postoftheday');
     $this->functions->topposts();
     $this->template->assign_vars(array('S_POSTOFTHEDAY' => 1, 'S_POSTOFTHEDAY_LOCATION' => $this->config['post_of_the_day_location']));
 }
コード例 #8
0
 public function acp_ranks_list_modify_rank_row($event)
 {
     $this->user->add_lang_ext('paybas/rankpoststyling', 'rankpoststyling');
     $rank_row = $event['rank_row'];
     $rank_row['RANK_STYLE'] = isset($event['row']['rank_style']) ? $event['row']['rank_style'] : '';
     $event['rank_row'] = $rank_row;
 }
コード例 #9
0
    /**
     * Display zodiac on viewing user profile
     *
     * @param object $event The event object
     * @return null
     * @access public
     */
    public function memberlist_view_profile($event)
    {
        $user_id = $event['member']['user_id'];
        $reg_date = $event['member']['user_regdate'];
        $this->user->add_lang_ext('rmcgirr83/searchusertopics', 'common');
        // get all topics started by the user and make sure they are visible
        $sql = 'SELECT t.*, p.post_visibility
			FROM ' . TOPICS_TABLE . ' t
			LEFT JOIN ' . POSTS_TABLE . ' p ON t.topic_first_post_id = p.post_id
			WHERE t.topic_poster = ' . $user_id . '
			ORDER BY t.topic_time ASC';
        $result = $this->db->sql_query($sql);
        $topics_num = 0;
        while ($row = $this->db->sql_fetchrow($result)) {
            if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
                continue;
            }
            if ($row['post_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
                continue;
            }
            ++$topics_num;
        }
        $this->db->sql_freeresult($result);
        if ($topics_num) {
            // Do the relevant calculations
            $users_days = max(1, round((time() - $reg_date) / 86400));
            $topics_per_day = $topics_num / $users_days;
            $topics_percent = $this->config['num_topics'] ? min(100, $topics_num / $this->config['num_topics'] * 100) : 0;
            $this->template->assign_vars(array('TOPICS' => $topics_num, 'L_TOTAL_TOPICS' => $this->user->lang('TOTAL_TOPICS', $topics_num), 'TOPICS_PER_DAY' => $this->user->lang('TOPICS_PER_DAY', $topics_per_day), 'TOPICS_PERCENT' => $this->user->lang('TOPICS_PERCENT', $topics_percent), 'U_SEARCH_TOPICS' => $this->auth->acl_get('u_search') ? append_sid("{$this->root_path}search.{$this->php_ext}", "author_id={$user_id}&sr=topics&sf=firstpost") : ''));
        }
    }
コード例 #10
0
ファイル: downloadlog.php プロジェクト: phpbb-es/Downloadlog
    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();
    }
コード例 #11
0
    /**
     * Display zodiac on viewing user profile
     *
     * @param object $event The event object
     * @return null
     * @access public
     */
    public function memberlist_view_profile($event)
    {
        $user_id = $event['member']['user_id'];
        $this->user->add_lang_ext('rmcgirr83/topicsbyuser', 'common');
        // get all topics started by the user and make sure they are visible
        $sql = 'SELECT t.*, p.post_visibility
			FROM ' . TOPICS_TABLE . ' t
			LEFT JOIN ' . POSTS_TABLE . ' p ON t.topic_first_post_id = p.post_id
			WHERE t.topic_poster = ' . $user_id . '
			ORDER BY t.topic_time ASC';
        $result = $this->db->sql_query($sql);
        $count = 0;
        $topic_options = '<option value="">' . $this->user->lang['CHOOSE_A_TOPIC'] . '</option>';
        while ($row = $this->db->sql_fetchrow($result)) {
            if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
                continue;
            }
            if ($row['post_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
                continue;
            }
            ++$count;
            $topic_color = $row['post_visibility'] != ITEM_APPROVED ? 'class="error"' : '';
            $topic_options .= '<option value="' . append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']) . '" ' . $topic_color . '>&nbsp;&nbsp;' . truncate_string($row['topic_title'], 30, 255, false, $this->user->lang['ELLIPSIS']) . '</option>';
        }
        $this->db->sql_freeresult($result);
        if (!empty($count)) {
            $this->template->assign_vars(array('HAS_TOPICS' => true, 'S_TOPIC_OPTIONS' => $topic_options));
        }
    }
コード例 #12
0
ファイル: date.php プロジェクト: Sajaki/customisation-db
 /**
  * Format the delta between two timestamps.
  *
  * @param \phpbb\user $user
  * @param int $start_time Lower time limit. If only $start_time is provided, then its value is used as the delta.
  * @param int $end_time Upper time limit.
  *
  * @return string Returns a translated string containing the appropriate label (up to days) for the time delta. Eg. Less than a minute, 2 Minutes, 1 Hour, 10 Days
  */
 public static function format_time_delta(\phpbb\user $user, $start_time, $end_time = 0)
 {
     if ($end_time) {
         $delta = abs($end_time - $start_time);
     } else {
         $delta = $start_time;
     }
     if ($delta < 60) {
         $delta = '';
         $delta_label = 'LESS_THAN_A_MINUTE';
     } else {
         if ($delta < 3600) {
             $delta = floor($delta / 60);
             $delta_label = 'MINUTE';
         } else {
             if ($delta < 86400) {
                 $delta = floor($delta / 3600);
                 $delta_label = 'HOUR';
             } else {
                 $delta = floor($delta / 86400);
                 $delta_label = 'DAY';
             }
         }
         $delta_label .= $delta != 1 ? 'S' : '';
     }
     return $delta . ' ' . $user->lang($delta_label);
 }
コード例 #13
0
ファイル: faq.php プロジェクト: Sajaki/customisation-db
 public function display_list()
 {
     $this->user->add_lang_ext('phpbb/titania', 'faq', false, true);
     /**
      * From phpBB faq.php
      */
     // Pull the array data from the lang pack
     $switch_column = $found_switch = false;
     $help_blocks = array();
     foreach ($this->user->help as $help_ary) {
         if ($help_ary[0] == '--') {
             if ($help_ary[1] == '--') {
                 $switch_column = true;
                 $found_switch = true;
                 continue;
             }
             $this->template->assign_block_vars('faq_block', array('BLOCK_TITLE' => $help_ary[1], 'SWITCH_COLUMN' => $switch_column));
             if ($switch_column) {
                 $switch_column = false;
             }
             continue;
         }
         $this->template->assign_block_vars('faq_block.faq_row', array('FAQ_QUESTION' => $help_ary[0], 'FAQ_ANSWER' => $help_ary[1]));
     }
     // Lets build a page ...
     $this->template->assign_vars(array('L_FAQ_TITLE' => $this->user->lang['FAQ_EXPLAIN'], 'L_BACK_TO_TOP' => $this->user->lang['BACK_TO_TOP'], 'SWITCH_COLUMN_MANUALLY' => !$found_switch));
     $this->display->assign_global_vars();
     return $this->helper->render('faq_body.html', 'FAQ_EXPLAIN');
 }
コード例 #14
0
 /**
  * @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));
 }
コード例 #15
0
ファイル: main.php プロジェクト: tas2580/wiki
 /**
  * Display an article
  *
  * @param	string	$article	URL of the article
  * @return	object
  */
 public function article($article)
 {
     $this->user->add_lang_ext('tas2580/wiki', 'common');
     if (!$this->auth->acl_get('u_wiki_view')) {
         trigger_error('NOT_AUTHORISED');
     }
     $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['WIKI'], 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_index', array())));
     $this->template->assign_vars(array('WIKI_FOOTER' => $this->user->lang('WIKI_FOOTER', base64_decode('aHR0cHM6Ly90YXMyNTgwLm5ldA=='), base64_decode('dGFzMjU4MA=='))));
     include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
     include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
     $action = $this->request->variable('action', '');
     $id = $this->request->variable('id', 0);
     switch ($action) {
         case 'edit':
             return $this->edit->edit_article($article);
         case 'versions':
             return $this->compare->view_versions($article);
         case 'compare':
             $from = $this->request->variable('from', 0);
             $to = $this->request->variable('to', 0);
             return $this->compare->compare_versions($article, $from, $to);
         case 'delete':
             return $this->delete->version($id);
         case 'detele_article':
             return $this->delete->article($article);
         case 'active':
             return $this->edit->active($id);
         case 'deactivate':
             return $this->edit->deactivate($article);
         default:
             return $this->view->view_article($article, $id);
     }
 }
コード例 #16
0
 /**
  * Display stats on index page
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function display_24_hour_stats($event)
 {
     // if the user is a bot
     if ($this->user->data['is_bot']) {
         return;
     }
     $this->user->add_lang_ext('rmcgirr83/activity24hours', 'common');
     // obtain posts/topics/new users activity
     $activity = $this->obtain_activity_data();
     // obtain user activity data
     $active_users = $this->obtain_active_user_data();
     // Obtain guests data
     $total_guests_online_24 = $this->obtain_guest_count_24();
     $user_count = 0;
     foreach ((array) $active_users as $row) {
         if (!$row['session_viewonline'] && !empty($row['session_time']) || !$row['user_allow_viewonline']) {
             if ($this->auth->acl_get('u_viewonline') || $row['user_id'] === $this->user->data['user_id']) {
                 $row['username'] = '******' . $row['username'] . '</em>';
             } else {
                 continue;
             }
         }
         if ($row['user_lastvisit'] < $this->interval && $row['session_time'] < $this->interval) {
             continue;
         }
         $max_last_visit = max($row['user_lastvisit'], $row['session_time']);
         $hover_info = ' title="' . $this->user->format_date($max_last_visit) . '"';
         ++$user_count;
         $this->template->assign_block_vars('lastvisit', array('USERNAME_FULL' => '<span' . $hover_info . '>' . get_username_string($row['user_type'] == USER_IGNORE ? 'no_profile' : 'full', $row['user_id'], $row['username'], $row['user_colour']) . '</span>'));
     }
     // assign the forum stats to the template.
     $this->template->assign_vars(array('USERS_24HOUR_TOTAL' => $this->user->lang('USERS_24HOUR_TOTAL', $user_count), 'USERS_ACTIVE' => $user_count, 'GUEST_ONLINE_24' => $this->config['load_online_guests'] ? $this->user->lang('GUEST_ONLINE_24', $total_guests_online_24) : '', 'HOUR_TOPICS' => $this->user->lang('24HOUR_TOPICS', $activity['topics']), 'HOUR_POSTS' => $this->user->lang('24HOUR_POSTS', $activity['posts']), 'HOUR_USERS' => $this->user->lang('24HOUR_USERS', $activity['users']), 'S_CAN_VIEW_24_HOURS' => true));
 }
コード例 #17
0
 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']);
 }
コード例 #18
0
ファイル: listener.php プロジェクト: sgtevmckay/Board3-Portal
 /**
  * Show users as viewing the portals on Who Is Online page
  *
  * @param object $event The event object
  * @return null
  */
 public function viewonline_page($event)
 {
     if ($event['on_page'][1] == 'app' && strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/portal') === 0) {
         $event['location'] = $this->user->lang('VIEWING_PORTAL');
         $event['location_url'] = $this->controller_helper->route('board3_portal_controller');
     }
 }
コード例 #19
0
 /**
  * This listener is run when the KernelEvents::EXCEPTION event is triggered
  *
  * @param GetResponseForExceptionEvent $event
  * @return null
  */
 public function on_kernel_exception(GetResponseForExceptionEvent $event)
 {
     $exception = $event->getException();
     $message = $exception->getMessage();
     if ($exception instanceof \phpbb\exception\exception_interface) {
         $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($message), $exception->get_parameters()));
     }
     if (!$event->getRequest()->isXmlHttpRequest()) {
         page_header($this->user->lang('INFORMATION'));
         $this->template->assign_vars(array('MESSAGE_TITLE' => $this->user->lang('INFORMATION'), 'MESSAGE_TEXT' => $message));
         $this->template->set_filenames(array('body' => 'message_body.html'));
         page_footer(true, false, false);
         $response = new Response($this->template->assign_display('body'), 500);
     } else {
         $data = array();
         if (!empty($message)) {
             $data['message'] = $message;
         }
         if (defined('DEBUG')) {
             $data['trace'] = $exception->getTrace();
         }
         $response = new JsonResponse($data, 500);
     }
     if ($exception instanceof HttpExceptionInterface) {
         $response->setStatusCode($exception->getStatusCode());
         $response->headers->add($exception->getHeaders());
     }
     $event->setResponse($response);
 }
コード例 #20
0
ファイル: top_rating.php プロジェクト: bb3mobi/bb3top
    /**
     * Runs this cron task.
     *
     * @return null
     */
    public function run()
    {
        $sql = 'UPDATE ' . RATING_TABLE . ' SET 
			`top_hits_before` = `top_hits`,
			`top_hosts_before` = `top_hosts`,
			`top_in_before` = `top_in`,
			`top_out_before` = `top_out`,
			`top_hits` = 0,
			`top_hosts` = 0,
			`top_in` = 0,
			`top_out` = 0
		WHERE `top_id` BETWEEN 1 AND 100000
			AND top_hosts > 1';
        $this->db->sql_query($sql);
        $this->db->sql_query('TRUNCATE TABLE ' . RATING_CLICK_TABLE);
        $this->db->sql_query('TRUNCATE TABLE ' . RATING_HITS_TABLE);
        $this->db->sql_query('TRUNCATE TABLE ' . RATING_ONLINE_TABLE);
        $this->db->sql_query('OPTIMIZE TABLE ' . RATING_TABLE);
        $this->db->sql_query('OPTIMIZE TABLE ' . RATING_CLICK_TABLE);
        $this->db->sql_query('OPTIMIZE TABLE ' . RATING_HITS_TABLE);
        $this->db->sql_query('OPTIMIZE TABLE ' . RATING_ONLINE_TABLE);
        //$this->config->set('rating_platforms_active', 0);
        $timestamp = time();
        $timezone = new \DateTimeZone($this->config['board_timezone']);
        $time = $this->user->get_timestamp_from_format('Y-m-d H:i:s', date('Y', $timestamp) . '-' . date('m', $timestamp) . '-' . date('d', $timestamp) . ' 00:00:00', $timezone);
        $this->config->set('top_rating_last_gc', $time);
    }
コード例 #21
0
 protected function get_year(array $now)
 {
     $start = $this->user->create_datetime()->setDate($now['year'], 1, 1)->setTime(0, 0, 0)->getTimestamp();
     $leap_year = gmdate('L', $start);
     $num_days = $leap_year ? 366 : 365;
     return array('start' => $start, 'stop' => $start + 86400 * $num_days - 1, 'date' => $this->user->format_date($start, 'Y', true));
 }
コード例 #22
0
 /**
  * Constructor
  *
  * @param	\phpbb\config\config				$config
  * @param	\phpbb\request\request_interface	$request
  * @param    \phpbb\user                         $user
  */
 public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user)
 {
     $this->config = $config;
     $this->request = $request;
     $this->user = $user;
     $this->user->add_lang_ext('AJHenderson/BattleNetOAuthUS', 'common');
 }
コード例 #23
0
ファイル: listener.php プロジェクト: phpbb-es/New-Topic
 public function page_header($event)
 {
     // add lang file
     $this->user->add_lang_ext('dmzx/newtopic', 'common');
     $forum_box = $this->make_forum_select2(false, false, false, false);
     $this->template->assign_vars(array('EXT_NEW_TOPIC' => $forum_box));
 }
コード例 #24
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);
     }
 }
コード例 #25
0
 /**
  * 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')));
 }
コード例 #26
0
ファイル: help.php プロジェクト: MrAdder/phpbb
 /**
  * Controller for /help/{mode} routes
  *
  * @param string		$mode
  * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
  * @throws http_exception when the $mode is not known by any extension
  */
 public function handle($mode)
 {
     switch ($mode) {
         case 'faq':
         case 'bbcode':
             $page_title = $mode === 'faq' ? $this->user->lang['FAQ_EXPLAIN'] : $this->user->lang['BBCODE_GUIDE'];
             $this->user->add_lang($mode, false, true);
             break;
         default:
             $page_title = $this->user->lang['FAQ_EXPLAIN'];
             $ext_name = $lang_file = '';
             /**
              * You can use this event display a custom help page
              *
              * @event core.faq_mode_validation
              * @var	string	page_title		Title of the page
              * @var	string	mode			FAQ that is going to be displayed
              * @var	string	lang_file		Language file containing the help data
              * @var	string	ext_name		Vendor and extension name where the help
              *								language file can be loaded from
              * @since 3.1.4-RC1
              */
             $vars = array('page_title', 'mode', 'lang_file', 'ext_name');
             extract($this->dispatcher->trigger_event('core.faq_mode_validation', compact($vars)));
             if ($ext_name === '' || $lang_file === '') {
                 throw new http_exception(404, 'Not Found');
             }
             $this->user->add_lang($lang_file, false, true, $ext_name);
             break;
     }
     $this->template->assign_vars(array('L_FAQ_TITLE' => $page_title, 'S_IN_FAQ' => true));
     $this->assign_to_template($this->user->help);
     make_jumpbox(append_sid("{$this->root_path}viewforum.{$this->php_ext}"));
     return $this->helper->render('faq_body.html', $page_title);
 }
コード例 #27
0
 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));
 }
コード例 #28
0
 /**
  * Show a message if can't post without approval
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function modify_template_vars($event)
 {
     if ($this->check_auth($event['forum_id'])) {
         $this->user->add_lang_ext('rmcgirr83/newtopicsneedapproval', 'common');
         $this->template->assign_var('S_REQUIRES_APPROVAL', true);
     }
 }
コード例 #29
0
 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));
 }
コード例 #30
0
 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));
 }