Beispiel #1
0
 /**
  * Display board announcements
  *
  * @return null
  * @access public
  */
 public function display_board_announcements()
 {
     // Do not continue if announcement has been disabled
     if (!$this->config['board_announcements_enable']) {
         return;
     }
     // Get board announcement data from the cache
     $board_announcement_data = $this->cache->get('_board_announcement_data');
     if ($board_announcement_data === false) {
         // Get board announcement data from the config_text object
         $board_announcement_data = $this->config_text->get_array(array('announcement_text', 'announcement_uid', 'announcement_bitfield', 'announcement_options', 'announcement_bgcolor', 'announcement_timestamp'));
         // Cache board announcement data
         $this->cache->put('_board_announcement_data', $board_announcement_data);
     }
     // Get announcement cookie if one exists
     $cookie = $this->request->variable($this->config['cookie_name'] . '_baid', '', true, \phpbb\request\request_interface::COOKIE);
     // Do not continue if announcement has been dismissed
     if (!$this->user->data['board_announcements_status'] || $cookie == $board_announcement_data['announcement_timestamp']) {
         return;
     }
     // Prepare board announcement message for display
     $announcement_message = generate_text_for_display($board_announcement_data['announcement_text'], $board_announcement_data['announcement_uid'], $board_announcement_data['announcement_bitfield'], $board_announcement_data['announcement_options']);
     // Add board announcements language file
     $this->user->add_lang_ext('phpbb/boardannouncements', 'boardannouncements');
     // Output board announcement to the template
     $this->template->assign_vars(array('S_BOARD_ANNOUNCEMENT' => true, 'S_BOARD_ANNOUNCEMENT_DISMISS' => (bool) $this->config['board_announcements_dismiss'], 'BOARD_ANNOUNCEMENT' => $announcement_message, 'BOARD_ANNOUNCEMENT_BGCOLOR' => $board_announcement_data['announcement_bgcolor'], 'U_BOARD_ANNOUNCEMENT_CLOSE' => $this->controller_helper->route('phpbb_boardannouncements_controller', array('hash' => generate_link_hash('close_boardannouncement')))));
 }
 /**
  * @param int $menu_id
  * @return array
  */
 private function _get_menu($menu_id)
 {
     if (($data = $this->cache->get('sitemaker_menus')) === false) {
         $data = $this->_get_all_menus();
         $this->cache->put('sitemaker_menus', $data);
     }
     return isset($data[$menu_id]) ? $data[$menu_id] : array();
 }
 /**
  * {@inheritdoc}
  */
 public function display(array $bdata, $edit_mode = false)
 {
     if (($content = $this->cache->get('pt_block_data_' . $bdata['bid'])) === false) {
         $content = '';
         if ($this->_find_birthday_users()) {
             $content = $this->ptemplate->render_view('blitze/sitemaker', 'blocks/birthday.html', 'birthday_block');
             // we only check birthdays every hour, may make this an admin choice
             $this->cache->put('pt_block_data_' . $bdata['bid'], $content, 3600);
         }
     }
     return array('title' => 'BIRTHDAYS', 'content' => $content);
 }
Beispiel #4
0
    /**
     * Creates a configuration container with a default set of values
     *
     * @param \phpbb\db\driver\driver_interface    $db    Database connection
     * @param \phpbb\cache\driver\driver_interface $cache Cache instance
     * @param string                       $table Configuration table name
     */
    public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, $table)
    {
        $this->db = $db;
        $this->cache = $cache;
        $this->table = $table;
        if (($config = $cache->get('config')) !== false) {
            $sql = 'SELECT config_name, config_value
				FROM ' . $this->table . '
				WHERE is_dynamic = 1';
            $result = $this->db->sql_query($sql);
            while ($row = $this->db->sql_fetchrow($result)) {
                $config[$row['config_name']] = $row['config_value'];
            }
            $this->db->sql_freeresult($result);
        } else {
            $config = $cached_config = array();
            $sql = 'SELECT config_name, config_value, is_dynamic
				FROM ' . $this->table;
            $result = $this->db->sql_query($sql);
            while ($row = $this->db->sql_fetchrow($result)) {
                if (!$row['is_dynamic']) {
                    $cached_config[$row['config_name']] = $row['config_value'];
                }
                $config[$row['config_name']] = $row['config_value'];
            }
            $this->db->sql_freeresult($result);
            $cache->put('config', $cached_config);
        }
        parent::__construct($config);
    }
    public function newusers()
    {
        $howmany = $this->howmany();
        $sql_where = $this->ignore_users();
        $sql_and = !empty($sql_where) ? ' AND user_inactive_reason = 0' : ' WHERE user_inactive_reason = 0';
        // newest registered users
        if (($newest_users = $this->cache->get('_top_five_newest_users')) === false) {
            $newest_users = array();
            // grab most recent registered users
            $sql = 'SELECT user_id, username, user_colour, user_regdate
				FROM ' . USERS_TABLE . '
				' . $sql_where . '
				' . $sql_and . '
				ORDER BY user_regdate DESC';
            $result = $this->db->sql_query_limit($sql, $howmany);
            while ($row = $this->db->sql_fetchrow($result)) {
                $newest_users[$row['user_id']] = array('user_id' => $row['user_id'], 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'user_regdate' => $row['user_regdate']);
            }
            $this->db->sql_freeresult($result);
            // cache this data for 5 minutes, this improves performance
            $this->cache->put('_top_five_newest_users', $newest_users, 300);
        }
        foreach ($newest_users as $row) {
            $username_string = $this->auth->acl_get('u_viewprofile') ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']);
            $this->template->assign_block_vars('top_five_newest', array('REG_DATE' => $this->user->format_date($row['user_regdate']), 'USERNAME_FULL' => $username_string));
        }
    }
Beispiel #6
0
	/**
	* Regenerate and cache a new parser and renderer
	*
	* @return array Associative array with at least two elements: "parser" and "renderer"
	*/
	public function regenerate()
	{
		$configurator = $this->get_configurator();

		// Get the censor helper and remove the Censor plugin if applicable
		if (isset($configurator->Censor))
		{
			$censor = $configurator->Censor->getHelper();
			unset($configurator->Censor);
			unset($configurator->tags['censor:tag']);
		}

		$objects  = $configurator->finalize();
		$parser   = $objects['parser'];
		$renderer = $objects['renderer'];

		// Cache the parser as-is
		$this->cache->put($this->cache_key_parser, $parser);

		// We need to cache the name of the renderer's generated class
		$renderer_data = array('class' => get_class($renderer));
		if (isset($censor))
		{
			$renderer_data['censor'] = $censor;
		}
		$this->cache->put($this->cache_key_renderer, $renderer_data);

		return array('parser' => $parser, 'renderer' => $renderer);
	}
Beispiel #7
0
    /**
     * Get the condition type id from the name
     *
     * @param string $autogroups_type_name The name of the auto group type
     *
     * @return int The condition_type_id
     * @throws \RuntimeException
     */
    public function get_autogroups_type_id($autogroups_type_name)
    {
        // Get cached auto groups ids if they exist
        $autogroups_type_ids = $this->cache->get('_autogroups_type_ids');
        // Get auto groups ids from the db if no cache data exists, cache result
        if ($autogroups_type_ids === false) {
            $autogroups_type_ids = array();
            $sql = 'SELECT autogroups_type_id, autogroups_type_name
				FROM ' . $this->autogroups_types_table;
            $result = $this->db->sql_query($sql);
            while ($row = $this->db->sql_fetchrow($result)) {
                $autogroups_type_ids[$row['autogroups_type_name']] = (int) $row['autogroups_type_id'];
            }
            $this->db->sql_freeresult($result);
            $this->cache->put('_autogroups_type_ids', $autogroups_type_ids);
        }
        // Add auto group type name to db if it exists as service but is not in db, cache result
        if (!isset($autogroups_type_ids[$autogroups_type_name])) {
            if (!isset($this->autogroups_types[$autogroups_type_name])) {
                throw new \RuntimeException($this->user->lang('AUTOGROUPS_TYPE_NOT_EXIST', $autogroups_type_name));
            }
            $autogroups_type_ids[$autogroups_type_name] = $this->add_autogroups_type($autogroups_type_name);
            $this->cache->put('_autogroups_type_ids', $autogroups_type_ids);
        }
        return $autogroups_type_ids[$autogroups_type_name];
    }
Beispiel #8
0
 /**
  * Get custom page link icons (pages_*.gif)
  * Added by the user to the core style/theme/images directores
  *
  * @return array Array of icon image paths
  * @access public
  */
 public function get_page_icons()
 {
     // For efficiency, found icons are cached
     if (($icons = $this->cache->get('_pages_icons')) === false) {
         $icons = $this->find('styles', 'pages_', '.gif');
         $this->cache->put('_pages_icons', $icons);
     }
     return $icons;
 }
 /**
  * Get image from Cache or Piwik
  *
  * @param  array    $configText  With datas from config_text
  * @param  array    $stats   With datas for piwik
  * @return string   Image as String
  * @access private
  */
 private function getImage($configText, $stats)
 {
     $cacheName = $stats['module'] . '_' . $stats['action'] . '_' . $stats['period'];
     $image = $this->cache->get($cacheName);
     if ($image === false) {
         $image = $this->getPiwikImage($configText, $stats['module'], $stats['action'], $stats['graphType'], $stats['period']);
         $this->cache->put($cacheName, $image, $configText['piwik_cache_page']);
     }
     return $image;
 }
 /**
  * @param $bid
  * @param bool $change_user
  */
 private function _save_settings($bid, $change_user)
 {
     if ($change_user && ($this->settings['rotation'] !== 'pageload' || $this->settings['qtype'] === 'featured')) {
         $settings = $this->settings;
         unset($settings['hash']);
         $sql_data = array('settings' => serialize($settings));
         $this->db->sql_query('UPDATE ' . $this->blocks_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_data) . ' WHERE bid = ' . (int) $bid);
         $this->cache->put('pt_block_data_' . $bid, $this->settings);
     }
 }
 public function forumlist_display_rating($event)
 {
     $forum_rows = $event['forum_rows'];
     $this->helper->get_max_forum_thanks();
     $forum_thanks_rating = array();
     foreach ($forum_rows as $row) {
         $forum_thanks_rating[] = $row['forum_id'];
     }
     $this->cache->put('_forum_thanks_rating', $forum_thanks_rating);
     $this->helper->get_thanks_forum_number();
     $this->cache->destroy('_forum_thanks_rating');
 }
Beispiel #12
0
 /**
  * Read the remote image and return it as local image
  */
 public function image()
 {
     $img = $this->request->variable('img', '', true);
     $cache_file = '_imageproxy_' . $img;
     $data = $this->cache->get($cache_file);
     if ($data === false) {
         $headers = @get_headers($img, true);
         if ($headers[0] != 'HTTP/1.1 200 OK') {
             // 1x1px transparent png
             $data = array('header' => 'image/png', 'content' => 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABnRSTlMAAAAAAABupgeRAAAADElEQVQImWNgYGAAAAAEAAGjChXjAAAAAElFTkSuQmCC');
         } else {
             // Create a HTTP header with user agent
             $options = array('http' => array('method' => "GET", 'header' => "Accept-language: en\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0\r\n"));
             $context = stream_context_create($options);
             // Get the remote image
             $data = array('header' => $headers['Content-Type'], 'content' => base64_encode(file_get_contents($img, false, $context)));
         }
         // Cache for 1 day
         $this->cache->put($cache_file, $data, 86400);
     }
     header('Content-type: ' . $data['header']);
     exit(base64_decode($data['content']));
 }
Beispiel #13
0
    /**
     * Obtain disallowed usernames
     */
    function obtain_disallowed_usernames()
    {
        if (($usernames = $this->driver->get('_disallowed_usernames')) === false) {
            $sql = 'SELECT disallow_username
				FROM ' . DISALLOW_TABLE;
            $result = $this->db->sql_query($sql);
            $usernames = array();
            while ($row = $this->db->sql_fetchrow($result)) {
                $usernames[] = str_replace('%', '.*?', preg_quote(utf8_clean_string($row['disallow_username']), '#'));
            }
            $this->db->sql_freeresult($result);
            $this->driver->put('_disallowed_usernames', $usernames);
        }
        return $usernames;
    }
Beispiel #14
0
 /**
  * Finds all hook files.
  *
  * @param bool $cache Whether the result should be cached
  * @return array An array of paths to found hook files
  */
 public function find($cache = true)
 {
     if (!defined('DEBUG') && $cache && $this->cache) {
         $hook_files = $this->cache->get('_hooks');
         if ($hook_files !== false) {
             return $hook_files;
         }
     }
     $hook_files = array();
     // Now search for hooks...
     $dh = @opendir($this->phpbb_root_path . 'includes/hooks/');
     if ($dh) {
         while (($file = readdir($dh)) !== false) {
             if (strpos($file, 'hook_') === 0 && substr($file, -strlen('.' . $this->php_ext)) === '.' . $this->php_ext) {
                 $hook_files[] = substr($file, 0, -(strlen($this->php_ext) + 1));
             }
         }
         closedir($dh);
     }
     if ($cache && $this->cache) {
         $this->cache->put('_hooks', $hook_files);
     }
     return $hook_files;
 }
    /**
     * @return array
     */
    private function _get_custom_blocks()
    {
        if (($cblocks = $this->cache->get('pt_cblocks')) === false) {
            $sql = 'SELECT *
				FROM ' . $this->cblocks_table;
            $result = $this->db->sql_query($sql);
            $cblocks = array();
            while ($row = $this->db->sql_fetchrow($result)) {
                $cblocks[$row['block_id']] = $row;
            }
            $this->db->sql_freeresult($result);
            $this->cache->put('pt_cblocks', $cblocks);
        }
        return $cblocks;
    }
    /**
     * Gets the first forum_id of FORUM_POST type forums
     *
     * @return array Database row of query
     */
    protected function get_first_forum_id()
    {
        $sql = 'SELECT forum_id
			FROM ' . FORUMS_TABLE . '
			WHERE forum_type = ' . FORUM_POST . '
			' . str_replace('t.', '', $this->where_string) . '
			ORDER BY forum_id';
        $result = $this->db->sql_query_limit($sql, 1);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        if (empty($this->where_string)) {
            // Cache first forum ID for one day = 86400 s
            $this->cache->put('_forum_id_first_forum_post', $row, 86400);
        }
        return $row;
    }
Beispiel #17
0
    function get_excluded_forums()
    {
        static $forum_ids;
        // Matches acp/acp_board.php
        $cache_name = 'feed_excluded_forum_ids';
        if (!isset($forum_ids) && ($forum_ids = $this->cache->get('_' . $cache_name)) === false) {
            $sql = 'SELECT forum_id
				FROM ' . FORUMS_TABLE . '
				WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_EXCLUDE, '<> 0');
            $result = $this->db->sql_query($sql);
            $forum_ids = array();
            while ($forum_id = (int) $this->db->sql_fetchfield('forum_id')) {
                $forum_ids[$forum_id] = $forum_id;
            }
            $this->db->sql_freeresult($result);
            $this->cache->put('_' . $cache_name, $forum_ids);
        }
        return $forum_ids;
    }
Beispiel #18
0
 /**
  * Get the number of shares
  *
  * @param	string	$url		The URL to get the shares for
  * @return	array
  * @access private
  */
 private function get_share_count($url)
 {
     $cache_time = isset($this->config['socialbuttons_cachetime']) ? $this->config['socialbuttons_cachetime'] : 0;
     $multiplicator = isset($this->config['socialbuttons_multiplicator']) ? $this->config['socialbuttons_multiplicator'] : 1;
     $cachetime = (int) $cache_time * (int) $multiplicator;
     $cache_file = '_socialbuttons_' . $url;
     $shares = $this->cache->get($cache_file);
     // If cache is too old or we have no cache, query the platforms
     if ($shares === false) {
         $content = $querys = array();
         // Collect the querys
         if (isset($this->config['socialbuttons_facebook']) && $this->config['socialbuttons_facebook'] == 1) {
             $querys['facebook'] = 'https://www.facebook.com/plugins/like.php?&layout=box_count&href=' . $url;
         }
         if (isset($this->config['socialbuttons_twitter']) && $this->config['socialbuttons_twitter'] == 1) {
             $querys['twitter'] = 'http://opensharecount.com/count.json?url=' . $url;
         }
         if (isset($this->config['socialbuttons_google']) && $this->config['socialbuttons_twitter'] == 1) {
             $querys['google'] = 'https://plusone.google.com/_/+1/fastbutton?url=' . $url;
         }
         if (isset($this->config['socialbuttons_linkedin']) && $this->config['socialbuttons_twitter'] == 1) {
             $querys['linkedin'] = 'https://www.linkedin.com/countserv/count/share?format=json&url=' . $url;
         }
         // Do we have curl? We can query all platforms paralel what is mutch faster
         if (function_exists('curl_multi_init') && function_exists('curl_multi_exec')) {
             // Set curl options for each URL
             $mh = curl_multi_init();
             $handle = array();
             foreach ($querys as $platform => $query_url) {
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, $query_url);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
                 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
                 curl_setopt($ch, CURLOPT_TIMEOUT, 3);
                 curl_setopt($ch, CURLOPT_NOBODY, false);
                 curl_setopt($ch, CURLOPT_HEADER, false);
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0');
                 curl_multi_add_handle($mh, $ch);
                 $handle[$platform] = $ch;
             }
             // Exec the query
             $running = 0;
             do {
                 curl_multi_exec($mh, $running);
             } while ($running > 0);
             // Get the resonse
             foreach ($handle as $platform => $ch) {
                 $handle = curl_multi_info_read($mh);
                 $content[$platform] = curl_multi_getcontent($ch);
                 curl_multi_remove_handle($mh, $handle['handle']);
             }
             curl_multi_close($mh);
         } else {
             //Set the useragent
             $options = array('http' => array('user_agent' => 'Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0'));
             $context = stream_context_create($options);
             foreach ($querys as $platform => $query_url) {
                 $content[$platform] = file_get_contents($query_url, false, $context);
             }
         }
         // Get the number of shares from response
         $matches = array();
         preg_match('#<div id="aggregateCount" class="Oy">([0-9]+)</div>#s', $content['google'], $matches);
         $shares['google'] = isset($matches[1]) ? $matches[1] : 0;
         preg_match('#<span class="pluginCountTextDisconnected">([0-9]+)</span>#s', $content['facebook'], $matches);
         $shares['facebook'] = isset($matches[1]) ? $matches[1] : 0;
         $pageinfo = json_decode($content['twitter'], true);
         $shares['twitter'] = isset($pageinfo['count']) ? $pageinfo['count'] : 0;
         $pageinfo = json_decode($content['linkedin'], true);
         $shares['linkedin'] = isset($pageinfo['count']) ? $pageinfo['count'] : 0;
         // Write data to cache
         $this->cache->put($cache_file, $shares, $cachetime);
         return $shares;
     } else {
         // return data from cache
         return $shares;
     }
 }
Beispiel #19
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     // Include diff engine
     $this->update_helper->include_file('includes/diff/diff.' . $this->php_ext);
     $this->update_helper->include_file('includes/diff/engine.' . $this->php_ext);
     // Set up basic vars
     $old_path = $this->update_helper->get_path_to_old_update_files();
     $new_path = $this->update_helper->get_path_to_new_update_files();
     $files_to_diff = $this->installer_config->get('update_files', array());
     $files_to_diff = $files_to_diff['update_with_diff'];
     // Set progress bar
     $this->iohandler->set_task_count(count($files_to_diff), true);
     $this->iohandler->set_progress('UPDATE_FILE_DIFF', 0);
     $progress_count = $this->installer_config->get('file_diff_update_count', 0);
     // Recover progress
     $progress_key = $this->installer_config->get('differ_progress_key', -1);
     $progress_recovered = $progress_key === -1;
     $merge_conflicts = $this->installer_config->get('merge_conflict_list', array());
     foreach ($files_to_diff as $key => $filename) {
         if ($progress_recovered === false) {
             if ($progress_key === $key) {
                 $progress_recovered = true;
             }
             continue;
         }
         // Read in files' content
         $file_contents = array();
         // Handle the special case when user created a file with the filename that is now new in the core
         $file_contents[0] = file_exists($old_path . $filename) ? file_get_contents($old_path . $filename) : '';
         $filenames = array($this->phpbb_root_path . $filename, $new_path . $filename);
         foreach ($filenames as $file_to_diff) {
             $file_contents[] = file_get_contents($file_to_diff);
             if ($file_contents[sizeof($file_contents) - 1] === false) {
                 $this->iohandler->add_error_message(array('FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ', $files_to_diff));
                 unset($file_contents);
                 throw new user_interaction_required_exception();
             }
         }
         $diff = new \diff3($file_contents[0], $file_contents[1], $file_contents[2]);
         unset($file_contents);
         // Handle conflicts
         if ($diff->get_num_conflicts() !== 0) {
             $merge_conflicts[] = $filename;
         }
         // Save merged output
         $this->cache->put('_file_' . md5($filename), base64_encode(implode("\n", $diff->merged_output())));
         unset($diff);
         $progress_count++;
         $this->iohandler->set_progress('UPDATE_FILE_DIFF', $progress_count);
         if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) {
             // Save differ progress
             $this->installer_config->set('differ_progress_key', $key);
             $this->installer_config->set('merge_conflict_list', $merge_conflicts);
             $this->installer_config->set('file_diff_update_count', $progress_count);
             // Request refresh
             throw new resource_limit_reached_exception();
         }
     }
     $this->iohandler->finish_progress('ALL_FILES_DIFFED');
     $this->installer_config->set('merge_conflict_list', $merge_conflicts);
 }
Beispiel #20
0
 /**
  * Fetching the user-list and putting the stuff into the template.
  */
 public function display()
 {
     $this->user->add_lang_ext('bb3mobi/washere', 'lang_wwh');
     if (!$this->prune()) {
         // Error while purging the list, database is missing :-O
         $this->user->add_lang_ext('bb3mobi/washere', 'info_acp_wwh');
         return;
     }
     /* Default count total or ids */
     $count = array('count_guests' => 0, 'count_bot' => 0, 'count_reg' => 0, 'count_hidden' => 0, 'count_total' => 0, 'ids_reg' => array(), 'ids_hidden' => array(), 'ids_bot' => array());
     $wwh_username_colour = $wwh_username = $wwh_username_full = $users_list = $bots_list = '';
     /* Load cache who_was_here */
     if (($view_state = $this->cache->get("_who_was_here")) === false) {
         $view_state = $this->view_state();
         $this->cache->put("_who_was_here", $view_state, 60 * $this->config['load_online_time']);
     }
     foreach ($view_state as $row) {
         $wwh_username_full = get_username_string($row['user_type'] == USER_IGNORE ? 'no_profile' : 'full', $row['user_id'], $row['username'], $row['user_colour']);
         $hover_time = $this->config['wwh_disp_time'] == '2' ? $this->user->lang['WHO_WAS_HERE_LATEST1'] . '&nbsp;' . $this->user->format_date($row['wwh_lastpage'], $this->config['wwh_disp_time_format']) . $this->user->lang['WHO_WAS_HERE_LATEST2'] : '';
         $hover_ip = $this->auth->acl_get('a_') && $this->config['wwh_disp_ip'] ? $this->user->lang['IP'] . ':&nbsp;' . $row['user_ip'] : '';
         $hover_info = $hover_time || $hover_ip ? ' title="' . $hover_time . ($hover_time && $hover_ip ? ' | ' : '') . $hover_ip . '"' : '';
         $disp_time = $this->config['wwh_disp_time'] == '1' ? '&nbsp;(' . $this->user->lang['WHO_WAS_HERE_LATEST1'] . '&nbsp;' . $this->user->format_date($row['wwh_lastpage'], $this->config['wwh_disp_time_format']) . $this->user->lang['WHO_WAS_HERE_LATEST2'] . ($hover_ip ? ' | ' . $hover_ip : '') . ')' : '';
         if ($row['viewonline'] || $row['user_type'] == USER_IGNORE) {
             if ($row['user_id'] != ANONYMOUS && ($this->config['wwh_disp_bots'] || $row['user_type'] != USER_IGNORE)) {
                 if ($this->config['wwh_disp_bots'] == 2 && $row['user_type'] == USER_IGNORE) {
                     $bots_list .= $this->user->lang['COMMA_SEPARATOR'] . '<span' . $hover_info . '>' . $wwh_username_full . '</span>' . $disp_time;
                 } else {
                     $users_list .= $this->user->lang['COMMA_SEPARATOR'] . '<span' . $hover_info . '>' . $wwh_username_full . '</span>' . $disp_time;
                 }
             }
         } else {
             if ($this->config['wwh_disp_hidden'] && $this->auth->acl_get('u_viewonline')) {
                 $users_list .= $this->user->lang['COMMA_SEPARATOR'] . '<em' . $hover_info . '>' . $wwh_username_full . '</em>' . $disp_time;
             }
         }
         // At the end let's count them =)
         if ($row['user_id'] == ANONYMOUS) {
             $count['count_guests']++;
         } else {
             if ($row['user_type'] == USER_IGNORE) {
                 $count['count_bot']++;
                 $count['ids_bot'][] = (int) $row['user_id'];
             } else {
                 if ($row['viewonline'] == 1) {
                     $count['count_reg']++;
                     $count['ids_reg'][] = (int) $row['user_id'];
                 } else {
                     $count['count_hidden']++;
                     $count['ids_hidden'][] = (int) $row['user_id'];
                 }
             }
         }
         $count['count_total']++;
     }
     $users_list = utf8_substr($users_list, utf8_strlen($this->user->lang['COMMA_SEPARATOR']));
     if ($users_list == '') {
         // User list is empty.
         $users_list = $this->user->lang['NO_ONLINE_USERS'];
     }
     if ($this->config['wwh_disp_bots'] == 2) {
         $bots_list = utf8_substr($bots_list, utf8_strlen($this->user->lang['COMMA_SEPARATOR']));
     }
     if (!$this->config['wwh_disp_bots']) {
         $count['count_total'] -= $count['count_bot'];
     }
     if (!$this->config['wwh_disp_guests']) {
         $count['count_total'] -= $count['count_guests'];
     }
     if (!$this->config['wwh_disp_hidden']) {
         $count['count_total'] -= $count['count_hidden'];
     }
     // Need to update the record?
     if ($this->config['wwh_record_ips'] < $count['count_total']) {
         $this->config->set('wwh_record_ips', $count['count_total'], true);
         $this->config->set('wwh_record_time', time(), true);
     }
     $this->template->assign_vars(array('WHO_WAS_HERE_LIST' => $this->user->lang['USERS'] . $this->user->lang['COLON'] . ' ' . $users_list, 'WHO_WAS_HERE_BOTS' => $bots_list ? $this->user->lang['G_BOTS'] . $this->user->lang['COLON'] . ' ' . $bots_list : '', 'WHO_WAS_HERE_TOTAL' => $this->get_total_users_string($count), 'WHO_WAS_HERE_EXP' => $this->get_explanation_string($this->config['wwh_version']), 'WHO_WAS_HERE_RECORD' => $this->get_record_string($this->config['wwh_record'], $this->config['wwh_version'])));
 }
 /**
  * @param array $blocks
  * @param bool $edit_mode
  */
 protected function _cache_block(array $blocks, $edit_mode)
 {
     if (!$edit_mode) {
         $this->cache->put('sitemaker_blocks', $blocks);
     }
 }