Beispiel #1
0
 /**
  * Titania page_footer
  *
  * @param cron $run_cron
  * @param bool|string $template_body For those lazy like me, send the template body name you want to load (or leave default to ignore and assign it yourself)
  */
 public static function page_footer($run_cron = true, $template_body = false)
 {
     // Because I am lazy most of the time...
     if ($template_body !== false) {
         phpbb::$template->set_filenames(array('body' => $template_body));
     }
     if (!empty(titania::$hook) && titania::$hook->call_hook(array(__CLASS__, __FUNCTION__), $run_cron)) {
         if (titania::$hook->hook_return(array(__CLASS__, __FUNCTION__))) {
             return titania::$hook->hook_return_result(array(__CLASS__, __FUNCTION__));
         }
     }
     // Output page creation time (can not move phpBB side because of a hack we do in here)
     if (defined('DEBUG')) {
         global $starttime;
         $mtime = explode(' ', microtime());
         $totaltime = $mtime[0] + $mtime[1] - $starttime;
         if (!empty($_REQUEST['explain']) && phpbb::$auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists(phpbb::$db, 'sql_report')) {
             // gotta do a rather nasty hack here, but it works and the page is killed after the display output, so no harm to anything else
             $GLOBALS['phpbb_root_path'] = self::$absolute_board;
             phpbb::$db->sql_report('display');
         }
         $debug_output = sprintf('Time : %.3fs | ' . phpbb::$db->sql_num_queries() . ' Queries | GZIP : ' . (phpbb::$config['gzip_compress'] && @extension_loaded('zlib') ? 'On' : 'Off') . (phpbb::$user->load ? ' | Load : ' . phpbb::$user->load : ''), $totaltime);
         if (phpbb::$auth->acl_get('a_') && defined('DEBUG_EXTRA')) {
             if (function_exists('memory_get_usage')) {
                 if ($memory_usage = memory_get_usage()) {
                     global $base_memory_usage;
                     $memory_usage -= $base_memory_usage;
                     $memory_usage = get_formatted_filesize($memory_usage);
                     $debug_output .= ' | Memory Usage: ' . $memory_usage;
                 }
             }
             $debug_output .= ' | <a href="' . titania_url::append_url(titania_url::$current_page, array_merge(titania_url::$params, array('explain' => 1))) . '">Explain</a>';
         }
     }
     phpbb::$template->assign_vars(array('DEBUG_OUTPUT' => defined('DEBUG') ? $debug_output : '', 'U_PURGE_CACHE' => phpbb::$auth->acl_get('a_') ? titania_url::append_url(titania_url::$current_page, array_merge(titania_url::$params, array('cache' => 'purge'))) : ''));
     // Footer hook
     self::$hook->call_hook('titania_page_footer', $run_cron, $template_body);
     // Call the phpBB footer function
     phpbb::page_footer($run_cron);
 }
/**
 * Register all hooks
 * @param	phpbb_hook	$phpbb_hook	The phpBB hook object
 * @return	void
 */
function phpbb_blog_register_hooks(&$phpbb_hook)
{
    $phpbb_hook->register('phpbb_user_session_handler', 'initialise_phpbb_blog');
    $phpbb_hook->register(array('template', 'display'), 'phpbb_blog_pre_display');
}
 /**
  * Register all subject prefix hooks
  * @param	phpbb_hook	$phpbb_hook	The phpBB hook object
  * @return	void
  */
 public static function register(&$phpbb_hook)
 {
     $phpbb_hook->register('phpbb_user_session_handler', 'sp_hook::subject_prefix_init');
     $phpbb_hook->register(array('template', 'display'), 'sp_hook::add_subject_prefix_to_page');
     $phpbb_hook->register(array('template', 'display'), 'sp_hook::subject_prefix_template_hook');
 }