/**
     * 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);
    }
Example #2
0
 /**
  * Constructor
  *
  * @param \phpbb\config\config $phpbb_config The phpBB configuration
  * @param \phpbb\path_helper $path_helper phpBB path helper
  * @param \phpbb\extension\manager $extension_manager phpBB extension manager
  * @param \Twig_LoaderInterface $loader Twig loader interface
  * @param array $options Array of options to pass to Twig
  */
 public function __construct($phpbb_config, \phpbb\path_helper $path_helper, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array())
 {
     $this->phpbb_config = $phpbb_config;
     $this->phpbb_path_helper = $path_helper;
     $this->extension_manager = $extension_manager;
     $this->phpbb_root_path = $this->phpbb_path_helper->get_phpbb_root_path();
     $this->web_root_path = $this->phpbb_path_helper->get_web_root_path();
     return parent::__construct($loader, $options);
 }
Example #3
0
 /**
  * Constructor
  *
  * @param \phpbb\config\config $phpbb_config The phpBB configuration
  * @param \phpbb\filesystem\filesystem $filesystem
  * @param \phpbb\path_helper $path_helper phpBB path helper
  * @param \Symfony\Component\DependencyInjection\ContainerInterface $container The dependency injection container
  * @param string $cache_path The path to the cache directory
  * @param \phpbb\extension\manager $extension_manager phpBB extension manager
  * @param \Twig_LoaderInterface $loader Twig loader interface
  * @param array $options Array of options to pass to Twig
  */
 public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, \Symfony\Component\DependencyInjection\ContainerInterface $container, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array())
 {
     $this->phpbb_config = $phpbb_config;
     $this->filesystem = $filesystem;
     $this->phpbb_path_helper = $path_helper;
     $this->extension_manager = $extension_manager;
     $this->container = $container;
     $this->phpbb_root_path = $this->phpbb_path_helper->get_phpbb_root_path();
     $this->web_root_path = $this->phpbb_path_helper->get_web_root_path();
     $options = array_merge(array('cache' => defined('IN_INSTALL') ? false : $cache_path, 'debug' => false, 'auto_reload' => (bool) $this->phpbb_config['load_tplcompile'], 'autoescape' => false), $options);
     return parent::__construct($loader, $options);
 }
Example #4
0
 /**
  * Assign global template variables
  *
  * @return null
  */
 public function assign_global_vars()
 {
     $this->generate_breadcrumbs(array('CUSTOMISATION_DATABASE' => $this->controller_helper->route('phpbb.titania.index')));
     $u_my_contribs = $u_manage = false;
     if ($this->user->data['is_registered'] && !$this->user->data['is_bot']) {
         $u_my_contribs = $this->controller_helper->route('phpbb.titania.author', array('author' => urlencode($this->user->data['username_clean']), 'page' => 'contributions'));
     }
     $manageable_types = $this->types->find_authed();
     if (!empty($manageable_types) || $this->auth->acl_get('u_titania_mod_contrib_mod') || $this->auth->acl_get('u_titania_mod_post_mod')) {
         $u_manage = $this->controller_helper->route('phpbb.titania.manage');
     }
     $web_root_path = $this->path_helper->get_web_root_path();
     $style_path = $web_root_path . 'ext/phpbb/titania/styles/' . rawurlencode($this->user->style['style_path']) . '/';
     $this->template->assign_vars(array('T_TITANIA_TEMPLATE_PATH' => $style_path . 'template', 'T_TITANIA_THEME_PATH' => $style_path . 'theme', 'T_TITANIA_IMAGES_PATH' => $web_root_path . 'images', 'T_TITANIA_ASSETS_PATH' => $web_root_path . 'ext/phpbb/titania/assets', 'TITANIA_ROOT_PATH' => $web_root_path, 'U_MANAGE' => $u_manage, 'U_MY_CONTRIBUTIONS' => $u_my_contribs, 'U_ALL_SUPPORT' => $this->controller_helper->route('phpbb.titania.support'), 'U_TITANIA_INDEX' => $this->controller_helper->route('phpbb.titania.index'), 'U_TITANIA_FAQ' => $this->controller_helper->route('phpbb.titania.faq'), 'S_IN_TITANIA' => true));
 }
Example #5
0
 /**
  * Constructor
  *
  * @param driver_interface	$cache			Cache service
  * @param config			$config			Installer config handler
  * @param path_helper		$path_helper	Path helper
  */
 public function __construct(driver_interface $cache, config $config, path_helper $path_helper)
 {
     $this->cache = $cache;
     $this->install_config = $config;
     $this->installer_modules = null;
     $this->web_root = $path_helper->get_web_root_path();
 }
Example #6
0
 /**
  * Constructor
  *
  * @param \phpbb\path_helper					$path_helper		Path helper object
  * @param \phpbb\template\template				$template			Template object
  * @param \phpbb\template\context				$template_context	Template context object
  */
 public function __construct(\phpbb\path_helper $path_helper, \phpbb\template\template $template, \phpbb\template\context $template_context)
 {
     $this->template = $template;
     $this->template_context = $template_context;
     $this->asset_path = $path_helper->get_web_root_path();
     $this->scripts = array('js' => array(), 'css' => array());
 }
Example #7
0
    /**
     * Get a list of all users on the board that can be mentioned. Keys are the usernames utf8_cleaned.
     * Data is cached after the first call.
     * 
     * @param string|bool $query_string False, if all users should be retrieved. Otherwise a string wich should be searched for.
     * @return array Array containing data of all users
     */
    public function get_userlist($query_string = false)
    {
        // If we need the complete list and it is cached, we can return it.
        if ($query_string == false && self::$user_list) {
            return self::$user_list;
        }
        $cache_time = 300;
        $sql_ary = array('SELECT' => '*', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'user_posts >= ' . $this->config['wolfsblvt.mentions.min_posts_suggest'] . '
											AND user_type <> ' . USER_IGNORE, 'ORDER_BY' => 'username');
        if ($query_string) {
            $escaped_query_string_clean = $this->db->sql_escape(utf8_clean_string($query_string));
            $query_string['WHERE'] .= ' username_clean ' . $this->db->sql_like_expression($escaped_query_string_clean . $this->db->get_any_char());
        }
        $sql = $this->db->sql_build_query('SELECT', $sql_ary);
        $result = $this->db->sql_query($sql, $cache_time);
        $user_list = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $user_data = array('name' => $row['username'], 'user_id' => $row['user_id'], 'posts' => $row['user_posts'], 'colour' => $row['user_colour'], 'avatar' => phpbb_get_user_avatar($row), 'username_full' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'username_no_profile' => get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']));
            if ($user_data['avatar'] == '') {
                $default_avatar_url = $this->path_helper->get_web_root_path() . $this->ext_root_path . '/styles/' . $this->user->style['style_path'] . '/theme' . '/images/no_avatar.gif';
                // Check if file exists, otherwise take from "/all" folder. The administrator hasn't chosen a specific no_avatar avatar for this style then
                if (!file_exists($default_avatar_url)) {
                    $default_avatar_url = $this->path_helper->get_web_root_path() . $this->ext_root_path . '/styles/all/theme' . '/images/no_avatar.gif';
                }
                $user_data['avatar'] = '<img src="' . $default_avatar_url . '" width="100" height="100" alt="' . $this->user->lang['USER_AVATAR'] . '">';
            }
            $user_list[$row['username_clean']] = $user_data;
        }
        $this->db->sql_freeresult($result);
        // If we have the complete list, we can cache it.
        if ($query_string == false) {
            self::$user_list = $user_list;
        }
        return $user_list;
    }
Example #8
0
 /**
  * Assign module's template vars
  *
  * @param array $row Database row of module
  * @param mixed $template_module Template data as returned by module
  *
  * @return null
  */
 public function assign_module_vars($row, $template_module)
 {
     if (is_array($template_module)) {
         $this->template->assign_block_vars('modules_' . $this->portal_columns->number_to_string($row['module_column']), array('TEMPLATE_FILE' => $this->parse_template_file($template_module['template']), 'IMAGE_SRC' => $this->path_helper->get_web_root_path() . ltrim($this->root_path . 'styles/all/theme/images/portal/' . $template_module['image_src'], './'), 'TITLE' => $template_module['title'], 'CODE' => $template_module['code'], 'MODULE_ID' => $row['module_id'], 'IMAGE_WIDTH' => $row['module_image_width'], 'IMAGE_HEIGHT' => $row['module_image_height']));
     } else {
         $this->template->assign_block_vars('modules_' . $this->portal_columns->number_to_string($row['module_column']), array('TEMPLATE_FILE' => $this->parse_template_file($template_module), 'IMAGE_SRC' => $this->path_helper->get_web_root_path() . ltrim($this->root_path . 'styles/all/theme/images/portal/' . $row['module_image_src'], './'), 'IMAGE_WIDTH' => $row['module_image_width'], 'IMAGE_HEIGHT' => $row['module_image_height'], 'MODULE_ID' => $row['module_id'], 'TITLE' => isset($this->user->lang[$row['module_name']]) ? $this->user->lang[$row['module_name']] : utf8_normalize_nfc($row['module_name'])));
     }
 }
Example #9
0
 /**
  * Constructor
  *
  * @param driver_interface	$cache			Cache service
  * @param config			$config			Installer config handler
  * @param path_helper		$path_helper	Path helper
  * @param container_factory	$container		Container
  */
 public function __construct(driver_interface $cache, config $config, path_helper $path_helper, container_factory $container)
 {
     $this->cache = $cache;
     $this->install_config = $config;
     $this->container_factory = $container;
     $this->installer_modules = null;
     $this->web_root = $path_helper->get_web_root_path();
     $this->purge_cache_before = false;
 }
Example #10
0
 /**
  * Set default template variables
  *
  * @param string	$page_title			Title of the page
  * @param bool		$selected_language	True to enable language selector it, false otherwise
  */
 protected function page_header($page_title, $selected_language = false)
 {
     // Path to templates
     $paths = array($this->phpbb_root_path . 'install/update/new/adm/', $this->phpbb_admin_path);
     $paths = array_filter($paths, 'is_dir');
     $path = array_shift($paths);
     $path = substr($path, strlen($this->phpbb_root_path));
     $this->template->assign_vars(array('L_CHANGE' => $this->language->lang('CHANGE'), 'L_COLON' => $this->language->lang('COLON'), 'L_INSTALL_PANEL' => $this->language->lang('INSTALL_PANEL'), 'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'), 'L_SKIP' => $this->language->lang('SKIP'), 'PAGE_TITLE' => $this->language->lang($page_title), 'T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . $path . 'images/', 'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . $path . '../assets/javascript/jquery.min.js', 'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . $path . 'style/', 'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . $path . '../assets/', 'S_CONTENT_DIRECTION' => $this->language->lang('DIRECTION'), 'S_CONTENT_FLOW_BEGIN' => $this->language->lang('DIRECTION') === 'ltr' ? 'left' : 'right', 'S_CONTENT_FLOW_END' => $this->language->lang('DIRECTION') === 'ltr' ? 'right' : 'left', 'S_CONTENT_ENCODING' => 'UTF-8', 'S_LANG_SELECT' => $selected_language, 'S_USER_LANG' => $this->language->lang('USER_LANG')));
     $this->render_navigation();
 }
Example #11
0
 /**
  * {@inheritdoc}
  */
 public function render_update_file_status($status_array)
 {
     $this->template->assign_vars(array('T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . 'adm/images/'));
     foreach ($status_array as $block => $list) {
         foreach ($list as $filename) {
             $dirname = dirname($filename);
             $this->template->assign_block_vars($block, array('STATUS' => $block, 'FILENAME' => $filename, 'DIR_PART' => !empty($dirname) && $dirname !== '.' ? dirname($filename) . '/' : false, 'FILE_PART' => basename($filename)));
         }
     }
     $this->template->set_filenames(array('file_status' => 'installer_update_file_status.html'));
     $this->file_status = $this->template->assign_display('file_status');
 }
 private function avatar_img_resize($avatar)
 {
     if (!empty($avatar['user_avatar'])) {
         if ($avatar['user_avatar_width'] >= $avatar['user_avatar_height']) {
             $avatar_width = $avatar['user_avatar_width'] > self::MAX_SIZE ? self::MAX_SIZE : $avatar['user_avatar_width'];
             if ($avatar_width == self::MAX_SIZE) {
                 $avatar['user_avatar_height'] = round(self::MAX_SIZE / $avatar['user_avatar_width'] * $avatar['user_avatar_height']);
             }
             $avatar['user_avatar_width'] = $avatar_width;
         } else {
             $avatar_height = $avatar['user_avatar_height'] > self::MAX_SIZE ? self::MAX_SIZE : $avatar['user_avatar_height'];
             if ($avatar_height == self::MAX_SIZE) {
                 $avatar['user_avatar_width'] = round(self::MAX_SIZE / $avatar['user_avatar_height'] * $avatar['user_avatar_width']);
             }
             $avatar['user_avatar_height'] = $avatar_height;
         }
     } else {
         $no_avatar = "{$this->path_helper->get_web_root_path()}styles/" . rawurlencode($this->user->style['style_path']) . '/theme/images/no_avatar.gif';
         $avatar = ['user_avatar' => $no_avatar, 'user_avatar_type' => AVATAR_REMOTE, 'user_avatar_width' => self::MAX_SIZE, 'user_avatar_height' => self::MAX_SIZE];
     }
     return $avatar;
 }
Example #13
0
 /**
  * Construct a calendar object
  *
  * @param \phpbb\config\config $config phpBB config
  * @param \board3\portal\includes\modules_helper $modules_helper Modules helper
  * @param \phpbb\template\template $template phpBB template
  * @param \phpbb\db\driver\driver_interface $db Database driver
  * @param \phpbb\request\request_interface $request phpBB request
  * @param string $phpEx php file extension
  * @param string $phpbb_root_path phpBB root path
  * @param \phpbb\user $user phpBB user object
  * @param \phpbb\path_helper $path_helper phpBB path helper
  * @param \phpbb\log\log $log phpBB log object
  */
 public function __construct($config, $modules_helper, $template, $db, $request, $phpbb_root_path, $phpEx, $user, $path_helper, $log)
 {
     $this->config = $config;
     $this->modules_helper = $modules_helper;
     $this->template = $template;
     $this->db = $db;
     $this->request = $request;
     $this->php_ext = $phpEx;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->user = $user;
     $this->path_helper = $path_helper;
     $this->log = $log;
     $this->portal_root_path = $this->path_helper->get_web_root_path() . $this->phpbb_root_path . 'ext/board3/portal/';
 }
Example #14
0
 /**
  * Return ext name
  *
  * @param	bool	$web_root_path Whether the path should be relative to web root
  * @return	string					Path to an extension
  */
 public function get_ext_name($web_root_path = false)
 {
     return ($web_root_path ? $this->path_helper->get_web_root_path() : '') . $this->extension_manager->get_extension_path($this->ext_name);
 }
Example #15
0
 /**
  * Assigns template vars
  * 
  * @param object $event The event object
  * @return void
  */
 public function assign_template_vars()
 {
     $this->template->assign_vars(array('T_EXT_AVATARSONMEMBERLIST_PATH' => $this->path_helper->get_web_root_path() . $this->ext_root_path, 'T_EXT_AVATARSONMEMBERLIST_THEME_PATH' => $this->path_helper->get_web_root_path() . $this->ext_root_path . '/styles/' . $this->user->style['style_path'] . '/theme'));
 }
Example #16
0
 /**
  * Set default template variables
  *
  * @param string	$page_title			Title of the page
  * @param bool		$selected_language	True to enable language selector it, false otherwise
  */
 protected function page_header($page_title, $selected_language = false)
 {
     $this->template->assign_vars(array('L_CHANGE' => $this->language->lang('CHANGE'), 'L_COLON' => $this->language->lang('COLON'), 'L_INSTALL_PANEL' => $this->language->lang('INSTALL_PANEL'), 'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'), 'L_SKIP' => $this->language->lang('SKIP'), 'PAGE_TITLE' => $this->language->lang($page_title), 'T_IMAGE_PATH' => htmlspecialchars($this->phpbb_admin_path) . 'images/', 'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . 'assets/javascript/jquery.min.js', 'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . 'adm/style', 'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . 'assets/', 'S_CONTENT_DIRECTION' => $this->language->lang('DIRECTION'), 'S_CONTENT_FLOW_BEGIN' => $this->language->lang('DIRECTION') === 'ltr' ? 'left' : 'right', 'S_CONTENT_FLOW_END' => $this->language->lang('DIRECTION') === 'ltr' ? 'right' : 'left', 'S_CONTENT_ENCODING' => 'UTF-8', 'S_LANG_SELECT' => $selected_language, 'S_USER_LANG' => $this->language->lang('USER_LANG')));
     $this->render_navigation();
 }
Example #17
0
 public function test_get_web_root_path()
 {
     // Symfony Request = null, so always should return phpbb_root_path
     $this->assertEquals($this->phpbb_root_path, $this->path_helper->get_web_root_path());
 }
Example #18
0
 /**
  * Assign template vars for portal
  *
  * @return null
  */
 protected function assign_template_vars()
 {
     $this->template->assign_vars(array('S_PORTAL_LEFT_COLUMN' => $this->config['board3_left_column_width'], 'S_PORTAL_RIGHT_COLUMN' => $this->config['board3_right_column_width'], 'S_LEFT_COLUMN' => $this->check_module_count('left', $this->config['board3_left_column']), 'S_CENTER_COLUMN' => $this->check_module_count('center'), 'S_RIGHT_COLUMN' => $this->check_module_count('right', $this->config['board3_right_column']), 'S_TOP_COLUMN' => $this->check_module_count('top'), 'S_BOTTOM_COLUMN' => $this->check_module_count('bottom'), 'S_DISPLAY_PHPBB_MENU' => $this->config['board3_phpbb_menu'], 'B3P_DISPLAY_JUMPBOX' => $this->config['board3_display_jumpbox'], 'T_EXT_THEME_PATH' => $this->path_helper->get_web_root_path() . ltrim($this->root_path . 'styles/' . $this->user->style['style_path'] . '/theme/', './')));
 }
Example #19
0
 /**
  * Automatically set the smilies path based on config
  *
  * @param  \phpbb\config\config $config
  * @param  \phpbb\path_helper   $path_helper
  * @return null
  */
 public function configure_smilies_path(\phpbb\config\config $config, \phpbb\path_helper $path_helper)
 {
     /**
      * @see smiley_text()
      */
     $root_path = defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH ? generate_board_url() . '/' : $path_helper->get_web_root_path();
     $this->set_smilies_path($root_path . $config['smilies_path']);
 }
Example #20
0
 /**
  * Constructor
  *
  * @param config		$config			Installer config handler
  * @param path_helper	$path_helper	Path helper
  */
 public function __construct(config $config, path_helper $path_helper)
 {
     $this->install_config = $config;
     $this->installer_modules = null;
     $this->web_root = $path_helper->get_web_root_path();
 }