diff options
author | forums <forums@ns38133.ovh.net> | 2011-02-12 23:34:52 +0100 |
---|---|---|
committer | forums <forums@ns38133.ovh.net> | 2011-02-12 23:36:21 +0100 |
commit | b85c3b967a7f6fa061439061076695613622960c (patch) | |
tree | 6b5d9c96fc1cc6f77810c3bbef621be677581abe /phpBB/gym_sitemaps | |
parent | 43cc2cd33c892b6dbcbed8a5ad59e52c83a6326d (diff) | |
download | forums-b85c3b967a7f6fa061439061076695613622960c.tar forums-b85c3b967a7f6fa061439061076695613622960c.tar.gz forums-b85c3b967a7f6fa061439061076695613622960c.tar.bz2 forums-b85c3b967a7f6fa061439061076695613622960c.tar.xz forums-b85c3b967a7f6fa061439061076695613622960c.zip |
Patched for SEO with phpbb-seo toolkit
Diffstat (limited to 'phpBB/gym_sitemaps')
96 files changed, 14715 insertions, 0 deletions
diff --git a/phpBB/gym_sitemaps/acp/.htaccess b/phpBB/gym_sitemaps/acp/.htaccess new file mode 100644 index 0000000000..6511d09c92 --- /dev/null +++ b/phpBB/gym_sitemaps/acp/.htaccess @@ -0,0 +1,4 @@ +<Limit GET POST PUT DELETE> +Order Allow,Deny +Deny from All +</Limit> diff --git a/phpBB/gym_sitemaps/acp/google_forum.php b/phpBB/gym_sitemaps/acp/google_forum.php new file mode 100644 index 0000000000..f59784e15c --- /dev/null +++ b/phpBB/gym_sitemaps/acp/google_forum.php @@ -0,0 +1,170 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: google_forum.php 112 2009-09-30 17:21:34Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* google_forum Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class google_forum { + var $gym_master; + var $dyn_select = array(); + /** + * constuctor + */ + function google_forum(&$gym_master) { + $this->gym_master = &$gym_master; + if (isset($this->gym_master->dyn_select) ) { + $this->dyn_select = & $this->gym_master->dyn_select; + $this->gym_master->forum_select(); + } + } + /** + * acp_module() + * retunrs the acp config, display vars + default values and select options + * @access private + */ + function acp_module() { + return array( + 'cache' => array( + 'display_vars' => array( + 'title' => 'GYM_CACHE', + 'vars' => array( + 'legend1' => 'GYM_CACHE', + 'google_forum_cache_on' => array('lang' => 'GYM_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_forum_cache_force_gzip' => array('lang' => 'GYM_CACHE_FORCE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_forum_cache_max_age' => array('lang' => 'GYM_CACHE_MAX_AGE', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'google_forum_showstats' => array('lang' => 'GYM_SHOWSTATS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_forum_cache_on' => 0, + 'google_forum_cache_force_gzip' => 0, + 'google_forum_cache_max_age' => 24, + 'google_forum_showstats' => 1, + ), + ), + 'modrewrite' => array( + 'display_vars' => array( + 'title' => 'GYM_MODREWRITE', + 'vars' => array( + 'legend1' => 'GYM_MODREWRITE', + 'google_forum_modrewrite' => array('lang' => 'GYM_MODREWRITE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_forum_modrtype' => array('lang' => 'GYM_MODRTYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_forum_modrewrite' => 0, + 'google_forum_modrtype' => 0, + ), + 'select' => array( + 'google_forum_modrtype' => @$this->dyn_select['modrtype'], + ), + ), + 'gzip' => array( + 'display_vars' => array( + 'title' => 'GYM_GZIP', + 'vars' => array( + 'legend1' => 'GYM_GZIP', + 'google_forum_gzip' => array('lang' => 'GYM_GZIP_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_forum_gzip_ext' => array('lang' => 'GYM_GZIP_EXT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_forum_gzip' => 0, + 'google_forum_gzip_ext' => 1, + ), + ), + 'limit' => array( + 'display_vars' => array( + 'title' => 'GYM_LIMIT', + 'vars' => array( + 'legend1' => 'GYM_LIMIT', + 'google_forum_url_limit' => array('lang' => 'GYM_URL_LIMIT', 'validate' => 'int:0:50000', 'type' => 'text:6:6', 'explain' => true, 'overriding' => true), + 'google_forum_sql_limit' => array('lang' => 'GYM_SQL_LIMIT', 'validate' => 'int:0:2500', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_forum_url_limit' => 2500, + 'google_forum_sql_limit' => 150, + ), + ), + 'sort' => array( + 'display_vars' => array( + 'title' => 'GYM_SORT', + 'vars' => array( + 'legend1' => 'GYM_SORT', + 'google_forum_sort' => array('lang' => 'GYM_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_forum_sort' => 'DESC', + ), + 'select' => array( + 'google_forum_sort' => @$this->dyn_select['sort'], + ), + ), + 'pagination' => array( + 'display_vars' => array( + 'title' => 'GYM_PAGINATION', + 'vars' => array( + 'legend1' => 'GYM_PAGINATION', + 'google_forum_pagination' => array('lang' => 'GYM_PAGINATION_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_forum_limitdown' => array('lang' => 'GYM_LIMITDOWN', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'google_forum_limitup' => array('lang' => 'GYM_LIMITUP', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_forum_pagination' => 1, + 'google_forum_limitdown' => 3, + 'google_forum_limitup' => 5, + ), + ), + 'main' => array( + 'display_vars' => array( + 'title' => 'GOOGLE_FORUM_SETTINGS', + 'vars' => array( + 'legend1' => 'GOOGLE_PRIORITIES', + 'google_forum_sticky_priority' => array('lang' => 'GOOGLE_FORUM_STICKY_PRIORITY', 'type' => 'custom', 'validate' => 'string', 'method' => 'validate_num', 'params' => array('{CONFIG_VALUE}', '{KEY}', 2, 0, 1), 'explain' => true,), + 'google_forum_announce_priority' => array('lang' => 'GOOGLE_FORUM_ANNOUCE_PRIORITY', 'type' => 'custom', 'validate' => 'string', 'method' => 'validate_num', 'params' => array('{CONFIG_VALUE}', '{KEY}', 2, 0, 1), 'explain' => true,), + 'google_forum_global_priority' => array('lang' => 'GOOGLE_FORUM_GLOBAL_PRIORITY', 'type' => 'custom', 'validate' => 'string', 'method' => 'validate_num', 'params' => array('{CONFIG_VALUE}', '{KEY}', 2, 0, 1), 'explain' => true,), + 'google_forum_default_priority' => array('lang' => 'GOOGLE_DEFAULT_PRIORITY', 'type' => 'custom', 'validate' => 'string', 'method' => 'validate_num', 'params' => array('{CONFIG_VALUE}', '{KEY}', 2, 0, 1), 'explain' => true, 'overriding' => true), + 'legend2' => 'GOOGLE_FORUM_EXCLUDE', + 'google_forum_exclude' => array('lang' => 'GOOGLE_FORUM_EXCLUDE', 'multiple_validate' => 'int', 'type' => 'custom', 'method' => 'select_multiple_string', 'explain' => true), + 'legend3' => 'GOOGLE_PING', + 'google_forum_ping' => array('lang' => 'GOOGLE_PING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_forum_sticky_priority' => 0.75, + 'google_forum_announce_priority' => 0.75, + 'google_forum_global_priority' => 0.75, + 'google_forum_default_priority' => 1.0, + 'google_forum_exclude' => '', + 'google_forum_ping' => 0, + ), + 'select' => array( + 'google_forum_exclude' => @$this->dyn_select['forums'], + ), + ), + 'info' => array( + 'title_lang' => 'GOOGLE_FORUM', + 'lang_file' => 'google_forum', + 'actions' => array( 'main', 'cache', 'modrewrite', 'gzip', 'limit', 'sort', 'pagination',), + 'mode' => 'google', + 'module' => 'forum' + ), + ); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/acp/google_main.php b/phpBB/gym_sitemaps/acp/google_main.php new file mode 100644 index 0000000000..07fccee743 --- /dev/null +++ b/phpBB/gym_sitemaps/acp/google_main.php @@ -0,0 +1,227 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: google_main.php 134 2009-11-02 11:13:45Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* google_main Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class google_main { + var $gym_master; + var $dyn_select = array(); + var $google_override = array(); + /** + * constuctor + */ + function google_main(&$gym_master) { + $this->gym_master = &$gym_master; + if (isset($this->gym_master->dyn_select) ) { + $this->google_override = $this->gym_master->dyn_select['override']; + unset($this->google_override[OVERRIDE_GLOBAL]); + $this->dyn_select = $this->gym_master->dyn_select; + } + } + /** + * acp_module() + * retunrs the acp config + * @access private + */ + function acp_module() { + global $phpbb_seo; + return array( + 'cache' => array( + 'display_vars' => array( + 'title' => 'GYM_CACHE', + 'vars' => array( + 'legend1' => 'GYM_CACHE', + 'google_cache_on' => array('lang' => 'GYM_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_cache_force_gzip' => array('lang' => 'GYM_CACHE_FORCE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_cache_max_age' => array('lang' => 'GYM_CACHE_MAX_AGE', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'google_cache_auto_regen' => array('lang' => 'GYM_CACHE_AUTO_REGEN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'google_showstats' => array('lang' => 'GYM_SHOWSTATS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_cache_on' => 0, + 'google_cache_force_gzip' => 0, + 'google_cache_max_age' => 24, + 'google_cache_auto_regen' => 1, + 'google_showstats' => 1, + ), + ), + 'modrewrite' => array( + 'display_vars' => array( + 'title' => 'GYM_MODREWRITE', + 'vars' => array( + 'legend1' => 'GYM_MODREWRITE', + 'google_modrewrite' => array('lang' => 'GYM_MODREWRITE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_modrtype' => array('lang' => 'GYM_MODRTYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_modrewrite' => 0, + 'google_modrtype' => 0, + ), + 'select' => array( + 'google_modrtype' => @$this->dyn_select['modrtype'], + ), + ), + 'gzip' => array( + 'display_vars' => array( + 'title' => 'GYM_GZIP', + 'vars' => array( + 'legend1' => 'GYM_GZIP', + 'google_gzip' => array('lang' => 'GYM_GZIP_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_gzip_ext' => array('lang' => 'GYM_GZIP_EXT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_gzip' => 0, + 'google_gzip_ext' => 1, + ), + ), + 'limit' => array( + 'display_vars' => array( + 'title' => 'GYM_LIMIT', + 'vars' => array( + 'legend1' => 'GYM_LIMIT', + 'google_url_limit' => array('lang' => 'GYM_URL_LIMIT', 'validate' => 'int:0:50000', 'type' => 'text:6:6', 'explain' => true, 'overriding' => true), + 'google_sql_limit' => array('lang' => 'GYM_SQL_LIMIT', 'validate' => 'int:0:2500', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_url_limit' => 2500, + 'google_sql_limit' => 150, + ), + ), + 'sort' => array( + 'display_vars' => array( + 'title' => 'GYM_SORT', + 'vars' => array( + 'legend1' => 'GYM_SORT', + 'google_sort' => array('lang' => 'GYM_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_sort' => 'DESC', + ), + 'select' => array( + 'google_sort' => @$this->dyn_select['sort'], + ), + ), + 'pagination' => array( + 'display_vars' => array( + 'title' => 'GYM_PAGINATION', + 'vars' => array( + 'legend1' => 'GYM_PAGINATION', + 'google_pagination' => array('lang' => 'GYM_PAGINATION_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_limitdown' => array('lang' => 'GYM_LIMITDOWN', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'google_limitup' => array('lang' => 'GYM_LIMITUP', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_pagination' => 1, + 'google_limitdown' => 3, + 'google_limitup' => 5, + ), + ), + 'override' => array( + 'display_vars' => array( + 'title' => 'GYM_OVERRIDE', + 'vars' => array( + 'legend1' => 'GYM_OVERRIDE', + 'google_override' => array('lang' => 'GYM_OVERRIDE_MAIN', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'google_override_cache' => array('lang' => 'GYM_OVERRIDE_CACHE','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'google_override_modrewrite' => array('lang' => 'GYM_OVERRIDE_MODREWRITE','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'google_override_gzip' => array('lang' => 'GYM_OVERRIDE_GZIP','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'google_override_limit' => array('lang' => 'GYM_OVERRIDE_LIMIT','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'google_override_sort' => array('lang' => 'GYM_OVERRIDE_SORT','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'google_override_pagination' => array('lang' => 'GYM_OVERRIDE_PAGINATION','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + + ), + ), + 'default' => array( + 'google_override' => OVERRIDE_MODULE, + 'google_override_cache' => OVERRIDE_OTYPE, + 'google_override_modrewrite' => OVERRIDE_OTYPE, + 'google_override_gzip' => OVERRIDE_GLOBAL, + 'google_override_limit' => OVERRIDE_OTYPE, + 'google_override_sort' => OVERRIDE_MODULE, + 'google_override_pagination' => OVERRIDE_OTYPE, + ), + 'select' => array( + 'google_override' => $this->google_override, + 'google_override_cache' => @$this->dyn_select['override'], + 'google_override_modrewrite' => @$this->dyn_select['override'], + 'google_override_gzip' => @$this->dyn_select['override'], + 'google_override_limit' => @$this->dyn_select['override'], + 'google_override_sort' => @$this->dyn_select['override'], + 'google_override_pagination' => @$this->dyn_select['override'], + ), + ), + 'main' => array( + 'display_vars' => array( + 'title' => 'GOOGLE_MAIN', + 'vars' => array( + // URL Settings + 'legend1' => 'GOOGLE_URL', + 'google_url' => array('lang' => 'GOOGLE_URL', 'validate' => 'string', 'type' => 'text:35:200', 'explain' => true), + // Link Settings + 'legend2' => 'GOOGLE_LINKS_ACTIVATION', + 'google_link_main' => array('lang' => 'GOOGLE_LINKS_MAIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'google_link_index' => array('lang' => 'GOOGLE_LINKS_INDEX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'google_link_cat' => array('lang' => 'GOOGLE_LINKS_CAT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + // Auth settings + 'legend3' => 'GOOGLE_AUTH_SETTINGS', + 'google_allow_auth' => array('lang' => 'GOOGLE_ALLOW_AUTH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'google_cache_auth' => array('lang' => 'GOOGLE_CACHE_AUTH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + // Ping + 'legend4' => 'GOOGLE_PING', + 'google_ping' => array('lang' => 'GOOGLE_PING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + // Styling + 'legend5' => 'GYM_STYLE', + 'google_xslt' => array('lang' => 'GOOGLE_XSLT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'google_load_phpbb_css' => array('lang' => 'GOOGLE_LOAD_PHPBB_CSS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + // Threshold + 'legend6' => 'GOOGLE_THRESHOLD', + 'google_threshold' => array('lang' => 'GOOGLE_THRESHOLD', 'validate' => 'int:1:100', 'type' => 'text:4:4', 'explain' => true), + // Priorities + 'legend7' => 'GOOGLE_PRIORITIES', + 'google_default_priority' => array('lang' => 'GOOGLE_DEFAULT_PRIORITY', 'type' => 'custom', 'validate' => 'string', 'method' => 'validate_num', 'params' => array('{CONFIG_VALUE}', '{KEY}', 2, 0, 1), 'explain' => true,), + ) + ), + 'default' => array( + 'google_url' => $phpbb_seo->seo_path['phpbb_url'], + 'google_link_main' => 1, + 'google_link_index' => 1, + 'google_link_cat' => 1, + 'google_allow_auth' => 0, + 'google_cache_auth' => 1, + 'google_ping' => 0, + 'google_xslt' => 1, + 'google_load_phpbb_css' => 0, + 'google_threshold' => 10, + 'google_default_priority' => 1.0, + ), + ), + 'info' => array( + 'title_lang' => 'GYM_GOOGLE', + 'lang_file' => 'gym_google', + 'actions' => array( 'main', 'cache', 'modrewrite', 'gzip', 'limit', 'sort', 'pagination', 'override',), + 'mode' => 'google', + 'module' => 'main' + ), + ); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/acp/google_txt.php b/phpBB/gym_sitemaps/acp/google_txt.php new file mode 100644 index 0000000000..816cb464a4 --- /dev/null +++ b/phpBB/gym_sitemaps/acp/google_txt.php @@ -0,0 +1,117 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: google_txt.php 112 2009-09-30 17:21:34Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* google_txt Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class google_txt { + var $gym_master; + var $dyn_select = array(); + /** + * constuctor + */ + function google_txt(&$gym_master) { + $this->gym_master = &$gym_master; + if (isset($this->gym_master->dyn_select) ) { + $this->dyn_select = $this->gym_master->dyn_select; + } + } + /** + * acp_module() + * retunrs the acp config, display vars + default values and select options + * @access private + */ + function acp_module() { + return array( + 'cache' => array( + 'display_vars' => array( + 'title' => 'GYM_CACHE', + 'vars' => array( + 'legend1' => 'GYM_CACHE', + 'google_txt_cache_on' => array('lang' => 'GYM_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_txt_cache_force_gzip' => array('lang' => 'GYM_CACHE_FORCE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_txt_cache_max_age' => array('lang' => 'GYM_CACHE_MAX_AGE', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'google_txt_showstats' => array('lang' => 'GYM_SHOWSTATS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_txt_cache_on' => 1, + 'google_txt_cache_force_gzip' => 0, + 'google_txt_cache_max_age' => 24, + 'google_txt_showstats' => 1, + ), + ), + 'gzip' => array( + 'display_vars' => array( + 'title' => 'GYM_GZIP', + 'vars' => array( + 'legend1' => 'GYM_GZIP', + 'google_txt_gzip' => array('lang' => 'GYM_GZIP_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_txt_gzip_ext' => array('lang' => 'GYM_GZIP_EXT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_txt_gzip' => 0, + 'google_txt_gzip_ext' => 1, + ), + ), + 'limit' => array( + 'display_vars' => array( + 'title' => 'GYM_LIMIT', + 'vars' => array( + 'legend1' => 'GYM_LIMIT', + 'google_txt_url_limit' => array('lang' => 'GYM_URL_LIMIT', 'validate' => 'int:0:5000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_txt_url_limit' => 750, + ), + ), + // We always need a main + 'main' => array( + 'display_vars' => array( + 'title' => 'GOOGLE_TXT_CONFIG', + 'vars' => array( + 'legend1' => 'GOOGLE_TXT_CONFIG', + 'google_txt_randomize' => array('lang' => 'GOOGLE_TXT_RANDOMIZE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'google_txt_unique' => array('lang' => 'GOOGLE_TXT_UNIQUE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'google_txt_check_robots' => array('lang' => 'GYM_CHECK_ROBOTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'google_txt_force_lastmod' => array('lang' => 'GOOGLE_TXT_FORCE_LASTMOD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'legend2' => 'GOOGLE_PRIORITIES', + 'google_txt_default_priority' => array('lang' => 'GOOGLE_DEFAULT_PRIORITY', 'type' => 'custom', 'validate' => 'string', 'method' => 'validate_num', 'params' => array('{CONFIG_VALUE}', '{KEY}', 2, 0, 1), 'explain' => true, 'overriding' => true), + 'legend3' => 'GOOGLE_PING', + 'google_txt_ping' => array('lang' => 'GOOGLE_PING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_txt_randomize' => 0, + 'google_txt_unique' => 0, + 'google_txt_check_robots' => 0, + 'google_txt_force_lastmod' => 0, + 'google_txt_default_priority' => 1.0, + 'google_txt_ping' => 0, + ), + ), + 'info' => array( + 'title_lang' => 'GOOGLE_TXT', + 'lang_file' => 'google_txt', + 'actions' => array( 'main', 'cache', 'gzip', 'limit'), + 'mode' => 'google', + 'module' => 'txt' + ), + ); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/acp/google_xml.php b/phpBB/gym_sitemaps/acp/google_xml.php new file mode 100644 index 0000000000..3a182f5b89 --- /dev/null +++ b/phpBB/gym_sitemaps/acp/google_xml.php @@ -0,0 +1,119 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: google_xml.php 112 2009-09-30 17:21:34Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* google_xml Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class google_xml { + var $gym_master; + var $dyn_select = array(); + /** + * constuctor + */ + function google_xml(&$gym_master) { + $this->gym_master = &$gym_master; + if (isset($this->gym_master->dyn_select) ) { + $this->dyn_select = $this->gym_master->dyn_select; + } + } + /** + * acp_module() + * retunrs the acp config, display vars + default values and select options + * @access private + */ + function acp_module() { + return array( + 'cache' => array( + 'display_vars' => array( + 'title' => 'GYM_CACHE', + 'vars' => array( + 'legend1' => 'GYM_CACHE', + 'google_xml_cache_on' => array('lang' => 'GYM_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_xml_cache_force_gzip' => array('lang' => 'GYM_CACHE_FORCE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_xml_cache_max_age' => array('lang' => 'GYM_CACHE_MAX_AGE', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'google_xml_showstats' => array('lang' => 'GYM_SHOWSTATS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_xml_cache_on' => 1, + 'google_xml_cache_force_gzip' => 0, + 'google_xml_cache_max_age' => 24, + 'google_xml_showstats' => 1, + ), + ), + 'gzip' => array( + 'display_vars' => array( + 'title' => 'GYM_GZIP', + 'vars' => array( + 'legend1' => 'GYM_GZIP', + 'google_xml_gzip' => array('lang' => 'GYM_GZIP_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'google_xml_gzip_ext' => array('lang' => 'GYM_GZIP_EXT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_xml_gzip' => 0, + 'google_xml_gzip_ext' => 1, + ), + ), + 'limit' => array( + 'display_vars' => array( + 'title' => 'GYM_LIMIT', + 'vars' => array( + 'legend1' => 'GYM_LIMIT', + 'google_xml_url_limit' => array('lang' => 'GYM_URL_LIMIT', 'validate' => 'int:0:10000', 'type' => 'text:8:8', 'explain' => true, 'overriding' => true), + 'google_xml_force_limit' => array('lang' => 'GOOGLE_XML_FORCE_LIMIT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + ), + ), + 'default' => array( + 'google_xml_url_limit' => 750, + 'google_xml_force_limit' => 0, + ), + ), + // We always need a main + 'main' => array( + 'display_vars' => array( + 'title' => 'GOOGLE_XML_CONFIG', + 'vars' => array( + 'legend1' => 'GOOGLE_XML_CONFIG', + 'google_xml_randomize' => array('lang' => 'GOOGLE_XML_RANDOMIZE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'google_xml_unique' => array('lang' => 'GOOGLE_XML_UNIQUE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'google_xml_check_robots' => array('lang' => 'GYM_CHECK_ROBOTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'google_xml_force_lastmod' => array('lang' => 'GOOGLE_XML_FORCE_LASTMOD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'legend2' => 'GOOGLE_PRIORITIES', + 'google_xml_default_priority' => array('lang' => 'GOOGLE_DEFAULT_PRIORITY', 'type' => 'custom', 'validate' => 'string', 'method' => 'validate_num', 'params' => array('{CONFIG_VALUE}', '{KEY}', 2, 0, 1), 'explain' => true, 'overriding' => true), + 'legend3' => 'GOOGLE_PING', + 'google_xml_ping' => array('lang' => 'GOOGLE_PING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'google_xml_randomize' => 0, + 'google_xml_unique' => 0, + 'google_xml_check_robots' => 0, + 'google_xml_force_lastmod' => 0, + 'google_xml_default_priority' => 1.0, + 'google_xml_ping' => 0, + ), + ), + 'info' => array( + 'title_lang' => 'GOOGLE_XML', + 'lang_file' => 'google_xml', + 'actions' => array( 'main', 'cache', 'gzip', 'limit'), + 'mode' => 'google', + 'module' => 'xml' + ), + ); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/acp/html_forum.php b/phpBB/gym_sitemaps/acp/html_forum.php new file mode 100644 index 0000000000..99a96aa21c --- /dev/null +++ b/phpBB/gym_sitemaps/acp/html_forum.php @@ -0,0 +1,303 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: html_forum.php 112 2009-09-30 17:21:34Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* html_forum Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class html_forum { + var $gym_master; + var $dyn_select = array(); + /** + * constuctor + */ + function html_forum(&$gym_master) { + global $user; + $this->gym_master = &$gym_master; + if (isset($this->gym_master->dyn_select) ) { + $this->dyn_select = &$this->gym_master->dyn_select; + $this->gym_master->forum_select(); + } + } + /** + * acp_module() + * retunrs the acp config + * @access private + */ + function acp_module() { + global $config, $phpbb_seo, $user; + $config['sitename'] = utf8_normalize_nfc($config['sitename']); + $config['site_desc'] = utf8_normalize_nfc($config['site_desc']); + return array( + 'cache' => array( + 'display_vars' => array( + 'title' => 'HTML_CACHE', + 'vars' => array( + 'legend1' => 'HTML_CACHE', + 'html_forum_main_cache_on' => array('lang' => 'HTML_MAIN_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_forum_main_cache_ttl' => array('lang' => 'HTML_MAIN_CACHE_TTL', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'html_forum_opt_cache_on' => array('lang' => 'HTML_OPT_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_forum_opt_cache_ttl' => array('lang' => 'HTML_OPT_CACHE_TTL', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'html_forum_main_cache_on' => 0, + 'html_forum_opt_cache_on' => 0, + 'html_forum_main_cache_ttl' => 6, + 'html_forum_opt_cache_ttl' => 6, + ), + ), + 'modrewrite' => array( + 'display_vars' => array( + 'title' => 'GYM_MODREWRITE', + 'vars' => array( + 'legend1' => 'GYM_MODREWRITE', + 'html_forum_modrewrite' => array('lang' => 'GYM_MODREWRITE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_forum_modrtype' => array('lang' => 'GYM_MODRTYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'html_forum_modrewrite' => 0, + 'html_forum_modrtype' => 0, + ), + 'select' => array( + 'html_forum_modrtype' => @$this->dyn_select['modrtype'], + ), + ), + 'gzip' => array( + 'display_vars' => array( + 'title' => 'GYM_GZIP', + 'vars' => array( + 'legend4' => 'GYM_GZIP', + 'html_forum_gzip' => array('lang' => 'GYM_GZIP_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'html_forum_gzip' => 0, + ), + ), + 'limit' => array( + 'display_vars' => array( + 'title' => 'GYM_LIMIT', + 'vars' => array( + 'legend1' => 'GYM_TIME_LIMIT', + 'html_forum_map_time_limit' => array('lang' => 'HTML_MAP_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'html_forum_cat_time_limit' => array('lang' => 'HTML_CAT_MAP_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'html_forum_news_time_limit' => array('lang' => 'HTML_NEWS_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'html_forum_cat_news_time_limit' => array('lang' => 'HTML_CAT_NEWS_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'html_forum_map_time_limit' => 0, + 'html_forum_cat_time_limit' => 0, + 'html_forum_news_time_limit' => 0, + 'html_forum_cat_news_time_limit' => 0, + ), + ), + 'sort' => array( + 'display_vars' => array( + 'title' => 'GYM_SORT', + 'vars' => array( + 'legend1' => 'HTML_MAP_SORT_TITLE', + 'html_forum_first' => array('lang' => 'HTML_FORUM_FIRST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'html_forum_sort' => array('lang' => 'GYM_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_cat_sort' => array('lang' => 'HTML_CAT_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'legend2' => 'HTML_NEWS_SORT_TITLE', + 'html_forum_news_first' => array('lang' => 'HTML_FORUM_NEWS_FIRST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'html_forum_news_sort' => array('lang' => 'HTML_NEWS_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_cat_news_sort' => array('lang' => 'HTML_CAT_NEWS_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'html_forum_sort' => 'DESC', + 'html_forum_cat_sort' => 'DESC', + 'html_forum_news_sort' => 'DESC', + 'html_forum_cat_news_sort' => 'DESC', + 'html_forum_first' => 0, + 'html_forum_news_first' => 1, + ), + 'select' => array( + 'html_forum_sort' => @$this->dyn_select['sort'], + 'html_forum_cat_sort' => @$this->dyn_select['sort'], + 'html_forum_news_sort' => @$this->dyn_select['sort'], + 'html_forum_cat_news_sort' => @$this->dyn_select['sort'], + ), + ), + 'pagination' => array( + 'display_vars' => array( + 'title' => 'GYM_PAGINATION', + 'vars' => array( + 'legend1' => 'HTML_PAGINATION_GEN', + 'html_forum_pagination' => array('lang' => 'HTML_FORUM_PAGINATION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_forum_pagination_limit' => array('lang' => 'HTML_FORUM_PAGINATION_LIMIT', 'validate' => 'int:0:100', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'html_forum_news_pagination' => array('lang' => 'HTML_NEWS_PAGINATION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_forum_news_pagination_limit' => array('lang' => 'HTML_NEWS_PAGINATION_LIMIT', 'validate' => 'int:0:50', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'legend2' => 'HTML_PAGINATION_SPEC', + 'html_forum_item_pagination' => array('lang' => 'HTML_ITEM_PAGINATION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_forum_ltopic_pagination' => array('lang' => 'HTML_FORUM_LTOPIC_PAGINATION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + ), + ), + 'default' => array( + 'html_forum_pagination' => 1, + 'html_forum_pagination_limit' => 50, + 'html_forum_news_pagination' => 1, + 'html_forum_news_pagination_limit' => 10, + 'html_forum_item_pagination' => 0, + 'html_forum_ltopic_pagination' => 0, + ), + ), + 'main' => array( + 'display_vars' => array( + 'title' => 'HTML_MAIN', + 'vars' => array( + // Settings + 'legend1' => 'HTML_SETTINGS', + 'html_forum_allow_map' => array('lang' => 'HTML_ALLOW_MAP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_forum_allow_cat_map' => array('lang' => 'HTML_ALLOW_CAT_MAP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_forum_sitename' => array('lang' => 'HTML_SITENAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true, 'overriding' => true), + 'html_forum_site_desc' => array('lang' => 'HTML_SITE_DESC', 'validate' => 'string', 'type' => 'textarea:6:50', 'explain' => true, 'overriding' => true), + 'html_forum_c_info' => array('lang' => 'HTML_C_INFO', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true, 'overriding' => true), + 'html_forum_logo_url' => array('lang' => 'HTML_LOGO_URL', 'validate' => 'string', 'type' => 'text:25:200', 'explain' => true, 'overriding' => true), + 'html_forum_stats_on_news' => array('lang' => 'HTML_STATS_ON_NEWS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_stats_on_map' => array('lang' => 'HTML_STATS_ON_MAP', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_birthdays_on_news' => array('lang' => 'HTML_BIRTHDAYS_ON_NEWS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_birthdays_on_map' => array('lang' => 'HTML_BIRTHDAYS_ON_MAP', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_disp_online' => array('lang' => 'HTML_DISP_ONLINE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_disp_tracking' => array('lang' => 'HTML_DISP_TRACKING', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_disp_status' => array('lang' => 'HTML_DISP_STATUS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_allow_profile' => array('lang' => 'HTML_ALLOW_PROFILE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_allow_profile_links' => array('lang' => 'HTML_ALLOW_PROFILE_LINKS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_exclude' => array('lang' => 'HTML_FORUM_EXCLUDE', 'multiple_validate' => 'int', 'type' => 'custom', 'method' => 'select_multiple_string', 'explain' => true), + // Auth settings + 'legend2' => 'HTML_AUTH_SETTINGS', + 'html_forum_allow_auth' => array('lang' => 'HTML_ALLOW_AUTH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + // Last topic list + 'legend3' => 'HTML_FORUM_LTOPIC', + 'html_forum_ltopic' => array('lang' => 'HTML_FORUM_INDEX_LTOPIC', 'validate' => 'int:0:100', 'type' => 'text:4:4', 'explain' => true), + 'html_forum_cat_ltopic' => array('lang' => 'HTML_FORUM_CAT_LTOPIC', 'validate' => 'int:0:100', 'type' => 'text:4:4', 'explain' => true), + 'html_forum_news_ltopic' => array('lang' => 'HTML_FORUM_NEWS_LTOPIC', 'validate' => 'int:0:100', 'type' => 'text:4:4', 'explain' => true), + 'html_forum_cat_news_ltopic' => array('lang' => 'HTML_FORUM_CAT_NEWS_LTOPIC', 'validate' => 'int:0:100', 'type' => 'text:4:4', 'explain' => true), + 'html_forum_ltopic_exclude' => array('lang' => 'HTML_FORUM_LTOPIC_EXCLUDE', 'multiple_validate' => 'int', 'type' => 'custom', 'method' => 'select_multiple_string', 'explain' => true), + // form specific + 'legend4' => 'HTML_FORUM_CONTENT', + 'html_forum_last_post' => array('lang' => 'HTML_FORUM_LAST_POST', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true), + 'html_forum_rules' => array('lang' => 'HTML_FORUM_RULES', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true), + 'html_forum_desc' => array('lang' => 'HTML_FORUM_DESC', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true), + ), + ), + 'default' => array( + 'html_forum_allow_map' => 1, + 'html_forum_allow_cat_map' => 1, + 'html_forum_c_info' => $config['sitename'], + 'html_forum_sitename' => $config['sitename'], + 'html_forum_site_desc' => $config['site_desc'], + 'html_forum_logo_url' => '', + 'html_forum_url' => $phpbb_seo->seo_path['phpbb_url'], + 'html_forum_disp_online' => 'globalmod', + 'html_forum_disp_tracking' => 'reg', + 'html_forum_disp_status' => 'reg', + 'html_forum_allow_auth' => 1, + 'html_forum_ltopic' => 15, + 'html_forum_cat_ltopic' => 15, + 'html_forum_news_ltopic' => 10, + 'html_forum_cat_news_ltopic' => 10, + 'html_forum_allow_profile' => 'none', + 'html_forum_allow_profile_links' => 'reg', + 'html_forum_last_post' => 'reg', + 'html_forum_rules' => 'all', + 'html_forum_desc' => 'all', + 'html_forum_stats_on_news' => 'all', + 'html_forum_stats_on_map' => 'all', + 'html_forum_birthdays_on_news' => 'reg', + 'html_forum_birthdays_on_map' => 'reg', + // Exclusions + 'html_forum_exclude' => '', + 'html_forum_ltopic_exclude' => '', + ), + 'select' => array( + 'html_forum_exclude' => @$this->dyn_select['forums'], + 'html_forum_disp_online' => @$this->dyn_select['gym_auth'], + 'html_forum_disp_tracking' => @$this->dyn_select['gym_auth'], + 'html_forum_disp_status' => @$this->dyn_select['gym_auth'], + 'html_forum_ltopic_exclude' => @$this->dyn_select['forums'], + 'html_forum_allow_profile' => @$this->dyn_select['gym_auth'], + 'html_forum_allow_profile_links' => @$this->dyn_select['gym_auth'], + 'html_forum_last_post' => @$this->dyn_select['gym_auth'], + 'html_forum_rules' => @$this->dyn_select['gym_auth'], + 'html_forum_desc' => @$this->dyn_select['gym_auth'], + 'html_forum_stats_on_news' => @$this->dyn_select['gym_auth'], + 'html_forum_stats_on_map' => @$this->dyn_select['gym_auth'], + 'html_forum_birthdays_on_news' => @$this->dyn_select['gym_auth'], + 'html_forum_birthdays_on_map' => @$this->dyn_select['gym_auth'], + ), + ), + 'content' => array( + 'display_vars' => array( + 'title' => 'HTML_NEWS', + 'vars' => array( + // news + 'legend1' => 'HTML_NEWS', + 'html_forum_allow_news' => array('lang' => 'HTML_FORUM_ALLOW_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_forum_allow_cat_news' => array('lang' => 'HTML_FORUM_ALLOW_CAT_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_forum_news_ids' => array('lang' => 'HTML_FORUM_NEWS_IDS', 'multiple_validate' => 'int', 'type' => 'custom', 'method' => 'select_multiple_string', 'explain' => true), + // News content + 'legend2' => 'HTML_NEWS_CONTENT', + 'html_forum_post_buttons' => array('lang' => 'HTML_FORUM_POST_BUTTONS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true), + 'html_forum_allow_bbcode' => array('lang' => 'HTML_ALLOW_BBCODE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_strip_bbcode' => array('lang' => 'HTML_STRIP_BBCODE', 'validate' => 'string', 'type' => 'text:25:200', 'explain' => true, 'overriding' => true), + 'html_forum_allow_links' => array('lang' => 'HTML_ALLOW_LINKS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_allow_emails' => array('lang' => 'HTML_ALLOW_EMAILS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_allow_smilies' => array('lang' => 'HTML_ALLOW_SMILIES', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_allow_sig' => array('lang' => 'HTML_ALLOW_SIG', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_forum_sumarize' => array('lang' => 'HTML_SUMARIZE', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'html_forum_sumarize_method' => array('lang' => 'HTML_SUMARIZE_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + // Content + 'html_forum_allow_news' => 1, + 'html_forum_news_ids' => '', + 'html_forum_allow_cat_news' => 1, + 'html_forum_post_buttons' => 'none', + 'html_forum_allow_bbcode' => 'all', + 'html_forum_strip_bbcode' => '', + 'html_forum_allow_links' => 'all', + 'html_forum_allow_emails' => 'none', + 'html_forum_allow_smilies' => 'none', + 'html_forum_allow_sig' => 'none', + 'html_forum_sumarize' => 75, + 'html_forum_sumarize_method' => 'words', + ), + 'select' => array( + 'html_forum_sumarize_method' => @$this->dyn_select['sumarize_method'], + 'html_forum_post_buttons' => @$this->dyn_select['gym_auth'], + 'html_forum_allow_bbcode' => @$this->dyn_select['gym_auth'], + 'html_forum_allow_links' => @$this->dyn_select['gym_auth'], + 'html_forum_allow_emails' => @$this->dyn_select['gym_auth'], + 'html_forum_allow_smilies' => @$this->dyn_select['gym_auth'], + 'html_forum_allow_sig' => @$this->dyn_select['gym_auth'], + 'html_forum_news_ids' => @$this->dyn_select['forums'], + ), + ), + 'info' => array( + 'title_lang' => 'HTML_FORUM', + 'lang_file' => 'html_forum', + 'actions' => array( 'main', 'content', 'cache', 'modrewrite', 'gzip', 'limit', 'sort', 'pagination',), + 'mode' => 'rss', + 'module' => 'forum' + ), + ); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/acp/html_main.php b/phpBB/gym_sitemaps/acp/html_main.php new file mode 100644 index 0000000000..85c0951ee2 --- /dev/null +++ b/phpBB/gym_sitemaps/acp/html_main.php @@ -0,0 +1,314 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: html_main.php 134 2009-11-02 11:13:45Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* html_main Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class html_main { + var $gym_master; + var $dyn_select = array(); + var $lang_iso639 = array(); + var $html_override = array(); + /** + * constuctor + */ + function html_main(&$gym_master) { + global $user; + $this->gym_master = &$gym_master; + if (isset($this->gym_master->dyn_select) ) { + $this->html_override = $this->gym_master->dyn_select['override']; + unset($this->html_override[OVERRIDE_GLOBAL]); + $this->dyn_select = $this->gym_master->dyn_select; + } + } + /** + * acp_module() + * retunrs the acp config + * @access private + */ + function acp_module() { + global $config, $phpbb_seo, $user, $phpEx; + $config['sitename'] = utf8_normalize_nfc($config['sitename']); + $config['site_desc'] = utf8_normalize_nfc($config['site_desc']); + return array( + 'cache' => array( + 'display_vars' => array( + 'title' => 'HTML_CACHE', + 'vars' => array( + 'legend1' => 'HTML_CACHE', + 'html_main_cache_on' => array('lang' => 'HTML_MAIN_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'html_main_cache_ttl' => array('lang' => 'HTML_MAIN_CACHE_TTL', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true), + 'html_opt_cache_on' => array('lang' => 'HTML_OPT_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'html_opt_cache_ttl' => array('lang' => 'HTML_OPT_CACHE_TTL', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true), + ), + ), + 'default' => array( + 'html_main_cache_on' => 0, + 'html_opt_cache_on' => 0, + 'html_opt_cache_ttl' => 6, + 'html_main_cache_ttl' => 6, + ), + ), + 'modrewrite' => array( + 'display_vars' => array( + 'title' => 'GYM_MODREWRITE', + 'vars' => array( + 'legend1' => 'GYM_MODREWRITE', + 'html_modrewrite' => array('lang' => 'GYM_MODREWRITE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'html_modrtype' => array('lang' => 'GYM_MODRTYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'html_modrewrite' => 0, + 'html_modrtype' => 0, + ), + 'select' => array( + 'html_modrtype' => @$this->dyn_select['modrtype'], + ), + ), + 'gzip' => array( + 'display_vars' => array( + 'title' => 'GYM_GZIP', + 'vars' => array( + 'legend4' => 'GYM_GZIP', + 'html_gzip' => array('lang' => 'GYM_GZIP_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'html_gzip' => 0, + ), + ), + 'limit' => array( + 'display_vars' => array( + 'title' => 'GYM_LIMIT', + 'vars' => array( + 'legend1' => 'GYM_URL_LIMIT', + 'html_rss_news_limit' => array('lang' => 'HTML_RSS_NEWS_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true), + 'legend2' => 'GYM_TIME_LIMIT', + 'html_map_time_limit' => array('lang' => 'HTML_MAP_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true), + 'html_cat_time_limit' => array('lang' => 'HTML_CAT_MAP_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true), + 'html_news_time_limit' => array('lang' => 'HTML_NEWS_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true), + 'html_cat_news_time_limit' => array('lang' => 'HTML_CAT_NEWS_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true), + ), + ), + 'default' => array( + 'html_rss_news_limit' => 10, + 'html_map_time_limit' => 0, + 'html_cat_time_limit' => 0, + 'html_news_time_limit' => 0, + 'html_cat_news_time_limit' => 0, + ), + ), + 'sort' => array( + 'display_vars' => array( + 'title' => 'GYM_SORT', + 'vars' => array( + 'legend1' => 'GYM_SORT', + 'html_sort' => array('lang' => 'GYM_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_cat_sort' => array('lang' => 'HTML_CAT_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_news_sort' => array('lang' => 'HTML_NEWS_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'html_cat_news_sort' => array('lang' => 'HTML_CAT_NEWS_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'html_sort' => 'DESC', + 'html_cat_sort' => 'DESC', + 'html_news_sort' => 'DESC', + 'html_cat_news_sort' => 'DESC', + ), + 'select' => array( + 'html_sort' => @$this->dyn_select['sort'], + 'html_cat_sort' => @$this->dyn_select['sort'], + 'html_news_sort' => @$this->dyn_select['sort'], + 'html_cat_news_sort' => @$this->dyn_select['sort'], + ), + ), + 'pagination' => array( + 'display_vars' => array( + 'title' => 'GYM_PAGINATION', + 'vars' => array( + 'legend1' => 'HTML_PAGINATION_GEN', + 'html_pagination' => array('lang' => 'HTML_PAGINATION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'html_pagination_limit' => array('lang' => 'HTML_PAGINATION_LIMIT', 'validate' => 'int:0:100', 'type' => 'text:4:4', 'explain' => true, ), + 'html_news_pagination' => array('lang' => 'HTML_NEWS_PAGINATION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'html_news_pagination_limit' => array('lang' => 'HTML_NEWS_PAGINATION_LIMIT', 'validate' => 'int:0:50', 'type' => 'text:4:4', 'explain' => true,), + 'legend2' => 'HTML_PAGINATION_SPEC', + 'html_item_pagination' => array('lang' => 'HTML_ITEM_PAGINATION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + ), + ), + 'default' => array( + 'html_pagination' => 1, + 'html_pagination_limit' => 25, + 'html_news_pagination' => 1, + 'html_news_pagination_limit' => 10, + 'html_item_pagination' => 0, + ), + ), + 'override' => array( + 'display_vars' => array( + 'title' => 'GYM_OVERRIDE', + 'vars' => array( + 'legend1' => 'GYM_OVERRIDE', + 'html_override' => array('lang' => 'GYM_OVERRIDE_MAIN', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_override_cache' => array('lang' => 'GYM_OVERRIDE_CACHE','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_override_modrewrite' => array('lang' => 'GYM_OVERRIDE_MODREWRITE','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_override_gzip' => array('lang' => 'GYM_OVERRIDE_GZIP','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_override_limit' => array('lang' => 'GYM_OVERRIDE_LIMIT','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_override_sort' => array('lang' => 'GYM_OVERRIDE_SORT','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_override_pagination' => array('lang' => 'GYM_OVERRIDE_PAGINATION','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + ), + ), + 'default' => array( + 'html_override' => OVERRIDE_MODULE, + 'html_override_cache' => OVERRIDE_OTYPE, + 'html_override_modrewrite' => OVERRIDE_OTYPE, + 'html_override_gzip' => OVERRIDE_GLOBAL, + 'html_override_limit' => OVERRIDE_OTYPE, + 'html_override_sort' => OVERRIDE_MODULE, + 'html_override_pagination' => OVERRIDE_OTYPE, + ), + 'select' => array( + 'html_override' => $this->html_override, + 'html_override_cache' => $this->html_override, + 'html_override_modrewrite' => @$this->dyn_select['override'], + 'html_override_gzip' => @$this->dyn_select['override'], + 'html_override_limit' => $this->html_override, + 'html_override_sort' => @$this->dyn_select['override'], + 'html_override_pagination' => $this->html_override, + ), + ), + 'main' => array( + 'display_vars' => array( + 'title' => 'HTML_MAIN', + 'vars' => array( + // URL Settings + 'legend1' => 'HTML_URL', + 'html_url' => array('lang' => 'HTML_URL', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + // Link Settings + 'legend2' => 'HTML_LINKS_ACTIVATION', + 'html_link_main' => array('lang' => 'HTML_LINKS_MAIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'html_link_index' => array('lang' => 'HTML_LINKS_INDEX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'html_link_cat' => array('lang' => 'HTML_LINKS_CAT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + // Settings + 'legend3' => 'HTML_SETTINGS', + 'html_allow_map' => array('lang' => 'HTML_ALLOW_MAP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'html_allow_cat_map' => array('lang' => 'HTML_ALLOW_CAT_MAP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'html_sitename' => array('lang' => 'HTML_SITENAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + 'html_site_desc' => array('lang' => 'HTML_SITE_DESC', 'validate' => 'string', 'type' => 'textarea:6:50', 'explain' => true), + 'html_c_info' => array('lang' => 'HTML_C_INFO', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + 'html_logo_url' => array('lang' => 'HTML_LOGO_URL', 'validate' => 'string', 'type' => 'text:25:200', 'explain' => true), + 'html_stats_on_news' => array('lang' => 'HTML_STATS_ON_NEWS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_stats_on_map' => array('lang' => 'HTML_STATS_ON_MAP', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_birthdays_on_news' => array('lang' => 'HTML_BIRTHDAYS_ON_NEWS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_birthdays_on_map' => array('lang' => 'HTML_BIRTHDAYS_ON_MAP', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_disp_online' => array('lang' => 'HTML_DISP_ONLINE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true), + 'html_disp_tracking' => array('lang' => 'HTML_DISP_TRACKING', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true), + 'html_disp_status' => array('lang' => 'HTML_DISP_STATUS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true), + 'html_allow_profile' => array('lang' => 'HTML_ALLOW_PROFILE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_allow_profile_links' => array('lang' => 'HTML_ALLOW_PROFILE_LINKS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + // Auth settings + 'legend4' => 'HTML_AUTH_SETTINGS', + 'html_allow_auth' => array('lang' => 'HTML_ALLOW_AUTH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + ), + ), + 'default' => array( + 'html_url' => $phpbb_seo->seo_path['phpbb_url'], + 'html_link_main' => 1, + 'html_link_index' => 1, + 'html_link_cat' => 1, + 'html_allow_map' => 1, + 'html_allow_cat_map' => 1, + 'html_c_info' => $config['sitename'], + 'html_sitename' => $config['sitename'], + 'html_site_desc' => $config['site_desc'], + 'html_logo_url' => '', + 'html_disp_online' => 'globalmod', + 'html_disp_tracking' => 'reg', + 'html_disp_status' => 'reg', + 'html_allow_profile' => 'none', + 'html_allow_profile_links' => 'reg', + 'html_allow_auth' => 1, + 'html_stats_on_news' => 'all', + 'html_stats_on_map' => 'all', + 'html_birthdays_on_news' => 'reg', + 'html_birthdays_on_map' => 'reg', + ), + 'select' => array( + 'html_disp_online' => @$this->dyn_select['gym_auth'], + 'html_disp_tracking' => @$this->dyn_select['gym_auth'], + 'html_disp_status' => @$this->dyn_select['gym_auth'], + 'html_allow_profile' => @$this->dyn_select['gym_auth'], + 'html_allow_profile_links' => @$this->dyn_select['gym_auth'], + 'html_stats_on_news' => @$this->dyn_select['gym_auth'], + 'html_stats_on_map' => @$this->dyn_select['gym_auth'], + 'html_birthdays_on_news' => @$this->dyn_select['gym_auth'], + 'html_birthdays_on_map' => @$this->dyn_select['gym_auth'], + ), + ), + 'content' => array( + 'display_vars' => array( + 'title' => 'HTML_NEWS', + 'vars' => array( + // News + 'legend1' => 'HTML_NEWS', + 'html_allow_news' => array('lang' => 'HTML_ALLOW_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'html_allow_cat_news' => array('lang' => 'HTML_ALLOW_CAT_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'html_rss_news_url' => array('lang' => 'HTML_RSS_NEWS_URL', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + // News content + 'legend2' => 'HTML_NEWS_CONTENT', + 'html_allow_bbcode' => array('lang' => 'HTML_ALLOW_BBCODE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_strip_bbcode' => array('lang' => 'HTML_STRIP_BBCODE', 'validate' => 'string', 'type' => 'text:30:200', 'explain' => true), + 'html_allow_links' => array('lang' => 'HTML_ALLOW_LINKS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_allow_emails' => array('lang' => 'HTML_ALLOW_EMAILS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_allow_smilies' => array('lang' => 'HTML_ALLOW_SMILIES', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_allow_sig' => array('lang' => 'HTML_ALLOW_SIG', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'html_sumarize' => array('lang' => 'HTML_SUMARIZE', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true,), + 'html_sumarize_method' => array('lang' => 'HTML_SUMARIZE_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + ), + ), + 'default' => array( + // Content + 'html_allow_news' => 1, + 'html_allow_cat_news' => 1, + 'html_rss_news_url' => (!empty($this->gym_master->gym_config['rss_url']) ? $this->gym_master->gym_config['rss_url'] : $phpbb_seo->seo_path['phpbb_url']) . "gymrss.$phpEx?news&digest", + 'html_allow_bbcode' => 'all', + 'html_strip_bbcode' => '', + 'html_allow_links' => 'all', + 'html_allow_emails' => 'none', + 'html_allow_smilies' => 'all', + 'html_allow_sig' => 'reg', + 'html_sumarize' => 75, + 'html_sumarize_method' => 'words', + ), + 'select' => array( + 'html_sumarize_method' => @$this->dyn_select['sumarize_method'], + 'html_allow_bbcode' => @$this->dyn_select['gym_auth'], + 'html_allow_links' => @$this->dyn_select['gym_auth'], + 'html_allow_emails' => @$this->dyn_select['gym_auth'], + 'html_allow_smilies' => @$this->dyn_select['gym_auth'], + 'html_allow_sig' => @$this->dyn_select['gym_auth'], + ), + ), + 'info' => array( + 'title_lang' => 'GYM_HTML', + 'lang_file' => 'gym_html', + 'actions' => array('main', 'content', 'cache', 'modrewrite', 'gzip', 'limit', 'sort', 'pagination', 'override',), + 'mode' => 'rss', + 'module' => 'main', + ), + ); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/acp/main_main.php b/phpBB/gym_sitemaps/acp/main_main.php new file mode 100644 index 0000000000..51a8606767 --- /dev/null +++ b/phpBB/gym_sitemaps/acp/main_main.php @@ -0,0 +1,216 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: main_main.php 112 2009-09-30 17:21:34Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* main_main Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class main_main { + var $gym_master; + var $dyn_select = array(); + /** + * constuctor + */ + function main_main(&$gym_master) { + $this->gym_master = &$gym_master; + if (isset($this->gym_master->dyn_select) ) { + $this->dyn_select = $this->gym_master->dyn_select; + } + } + /** + * acp_module() + * returns the acp config + * @access private + */ + function acp_module() { + return array( + 'cache' => array( + 'display_vars' => array( + 'title' => 'GYM_CACHE', + 'vars' => array( + 'legend1' => 'GYM_CACHE', + 'gym_mod_since' => array('lang' => 'GYM_MOD_SINCE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'gym_cache_on' => array('lang' => 'GYM_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'gym_cript_cache' => array('lang' => 'GYM_CRITP_CACHE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'gym_cache_force_gzip' => array('lang' => 'GYM_CACHE_FORCE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'gym_cache_max_age' => array('lang' => 'GYM_CACHE_MAX_AGE', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true,), + 'gym_cache_auto_regen' => array('lang' => 'GYM_CACHE_AUTO_REGEN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'gym_showstats' => array('lang' => 'GYM_SHOWSTATS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + ), + ), + 'default' => array( + 'gym_mod_since' => 0, + 'gym_cache_on' => 0, + 'gym_cript_cache' => 1, + 'gym_cache_force_gzip' => 0, + 'gym_cache_max_age' => 24, + 'gym_cache_auto_regen' => 1, + 'gym_showstats' => 1, + ), + ), + 'modrewrite' => array( + 'display_vars' => array( + 'title' => 'GYM_MODREWRITE', + 'vars' => array( + 'legend1' => 'GYM_MODREWRITE', + 'gym_modrewrite' => array('lang' => 'GYM_MODREWRITE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'gym_modrtype' => array('lang' => 'GYM_MODRTYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'gym_zero_dupe' => array('lang' => 'GYM_ZERO_DUPE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + ), + ), + 'default' => array( + 'gym_modrewrite' => 0, + 'gym_modrtype' => 0, + 'gym_zero_dupe' => 0, + ), + 'select' => array( + 'gym_modrtype' => @$this->dyn_select['modrtype'], + ), + ), + 'gzip' => array( + 'display_vars' => array( + 'title' => 'GYM_GZIP', + 'vars' => array( + 'legend1' => 'GYM_GZIP', + 'gym_gzip' => array('lang' => 'GYM_GZIP_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'gym_gzip_level' => array('lang' => 'GYM_GZIP_LEVEL', 'validate' => 'int:1:9', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'gym_gzip_ext' => array('lang' => 'GYM_GZIP_EXT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + ), + ), + 'default' => array( + 'gym_gzip' => 0, + 'gym_gzip_level' => 6, + 'gym_gzip_ext' => 1, + ), + 'select' => array( + 'gym_gzip_level' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9), + ), + ), + 'limit' => array( + 'display_vars' => array( + 'title' => 'GYM_LIMIT', + 'vars' => array( + 'legend1' => 'GYM_LIMIT', + 'gym_url_limit' => array('lang' => 'GYM_URL_LIMIT', 'validate' => 'int:0:5000', 'type' => 'text:4:4', 'explain' => true,), + 'gym_sql_limit' => array('lang' => 'GYM_SQL_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true,), + 'gym_time_limit' => array('lang' => 'GYM_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true,), + ), + ), + 'default' => array( + 'gym_url_limit' => 150, + 'gym_sql_limit' => 25, + 'gym_time_limit' => 60, + ), + ), + 'sort' => array( + 'display_vars' => array( + 'title' => 'GYM_SORT', + 'vars' => array( + 'legend1' => 'GYM_SORT', + 'gym_sort' => array('lang' => 'GYM_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + ), + ), + 'default' => array( + 'gym_sort' => 'DESC', + ), + 'select' => array( + 'gym_sort' => @$this->dyn_select['sort'], + ), + ), + 'pagination' => array( + 'display_vars' => array( + 'title' => 'GYM_PAGINATION', + 'vars' => array( + 'legend1' => 'GYM_PAGINATION', + 'gym_pagination' => array('lang' => 'GYM_PAGINATION_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'gym_limitdown' => array('lang' => 'GYM_LIMITDOWN', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true,), + 'gym_limitup' => array('lang' => 'GYM_LIMITUP', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true,), + ), + ), + 'default' => array( + 'gym_pagination' => 1, + 'gym_limitdown' => 3, + 'gym_limitup' => 5, + ), + ), + 'override' => array( + 'display_vars' => array( + 'title' => 'GYM_OVERRIDE', + 'vars' => array( + 'legend' => 'GYM_OVERRIDE', + 'gym_override' => array('lang' => 'GYM_OVERRIDE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'gym_override_cache' => array('lang' => 'GYM_OVERRIDE_CACHE','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'gym_override_modrewrite' => array('lang' => 'GYM_OVERRIDE_MODREWRITE','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'gym_override_gzip' => array('lang' => 'GYM_OVERRIDE_GZIP','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'gym_override_limit' => array('lang' => 'GYM_OVERRIDE_LIMIT','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'gym_override_sort' => array('lang' => 'GYM_OVERRIDE_SORT','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'gym_override_pagination' => array('lang' => 'GYM_OVERRIDE_PAGINATION','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + ), + ), + 'default' => array( + 'gym_override' => 1, + 'gym_override_cache' => OVERRIDE_OTYPE, + 'gym_override_modrewrite' => OVERRIDE_GLOBAL, + 'gym_override_gzip' => OVERRIDE_GLOBAL, + 'gym_override_limit' => OVERRIDE_OTYPE, + 'gym_override_sort' => OVERRIDE_OTYPE, + 'gym_override_pagination' => OVERRIDE_OTYPE, + ), + 'select' => array( + 'gym_override_cache' => @$this->dyn_select['override'], + 'gym_override_modrewrite' => @$this->dyn_select['override'], + 'gym_override_gzip' => @$this->dyn_select['override'], + 'gym_override_limit' => @$this->dyn_select['override'], + 'gym_override_sort' => @$this->dyn_select['override'], + 'gym_override_pagination' => @$this->dyn_select['override'], + ), + ), + 'main' => array( + 'display_vars' => array( + 'title' => 'MAIN_MAIN', + 'vars' => array( + 'legend' => 'GYM_LINKS_ACTIVATION', + 'gym_link_main' => array('lang' => 'GYM_LINKS_MAIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'gym_link_index' => array('lang' => 'GYM_LINKS_INDEX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'gym_link_cat' => array('lang' => 'GYM_LINKS_CAT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + ), + ), + 'default' => array( + 'gym_link_main' => 1, + 'gym_link_index' => 1, + 'gym_link_cat' => 1, + ), + ), + 'info' => array( + 'title_lang' => 'GYM_MAIN', + 'lang_file' => '', + 'actions' => array('main', 'cache', 'modrewrite', 'gzip', 'limit', 'sort', 'pagination', 'override'), + 'mode' => 'main', + 'module' => 'main', + 'select' => array( + 'gym_override_cache' => @$this->dyn_select['override'], + 'gym_override_modrewrite' => @$this->dyn_select['override'], + 'gym_override_gzip' => @$this->dyn_select['override'], + 'gym_override_limit' => @$this->dyn_select['override'], + 'gym_override_sort' => @$this->dyn_select['override'], + 'gym_override_pagination' => @$this->dyn_select['override'], + 'gym_sort' => @$this->dyn_select['sort'], + 'gym_modrtype' => @$this->dyn_select['modrtype'], + 'gym_gzip_level' => @$this->dyn_select['gzip_level'], + ), + ), + ); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/acp/rss_forum.php b/phpBB/gym_sitemaps/acp/rss_forum.php new file mode 100644 index 0000000000..f9c8e1cd7a --- /dev/null +++ b/phpBB/gym_sitemaps/acp/rss_forum.php @@ -0,0 +1,263 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: rss_forum.php 112 2009-09-30 17:21:34Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* rss_forum Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class rss_forum { + var $gym_master; + var $dyn_select = array(); + /** + * constuctor + */ + function rss_forum(&$gym_master) { + global $user; + $this->gym_master = &$gym_master; + if (isset($this->gym_master->dyn_select) ) { + $this->dyn_select = & $this->gym_master->dyn_select; + $this->gym_master->forum_select(); + } + // Load the language iso 639-1 code - http://www.loc.gov/standards/iso639-2/php/French_list.php + if ( !isset($user->lang['ISO_639_1'])) { + $user->add_lang('gym_sitemaps/gym_iso639'); + } + } + /** + * acp_module() + * retunrs the acp config + * @access private + */ + function acp_module() { + global $config, $phpbb_seo, $user; + $config['sitename'] = utf8_normalize_nfc($config['sitename']); + $config['site_desc'] = utf8_normalize_nfc($config['site_desc']); + return array( + 'cache' => array( + 'display_vars' => array( + 'title' => 'GYM_CACHE', + 'vars' => array( + 'legend1' => 'GYM_CACHE', + 'rss_forum_cache_on' => array('lang' => 'GYM_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_cache_force_gzip' => array('lang' => 'GYM_CACHE_FORCE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_cache_max_age' => array('lang' => 'GYM_CACHE_MAX_AGE', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_forum_showstats' => array('lang' => 'GYM_SHOWSTATS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'rss_forum_cache_on' => 0, + 'rss_forum_cache_force_gzip' => 0, + 'rss_forum_cache_max_age' => 6, + 'rss_forum_showstats' => 1, + ), + ), + 'modrewrite' => array( + 'display_vars' => array( + 'title' => 'GYM_MODREWRITE', + 'vars' => array( + 'legend1' => 'GYM_MODREWRITE', + 'rss_forum_modrewrite' => array('lang' => 'GYM_MODREWRITE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_modrtype' => array('lang' => 'GYM_MODRTYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'rss_forum_modrewrite' => 0, + 'rss_forum_modrtype' => 0, + ), + 'select' => array( + 'rss_forum_modrtype' => @$this->dyn_select['modrtype'], + ), + ), + 'gzip' => array( + 'display_vars' => array( + 'title' => 'GYM_GZIP', + 'vars' => array( + 'legend4' => 'GYM_GZIP', + 'rss_forum_gzip' => array('lang' => 'GYM_GZIP_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_gzip_ext' => array('lang' => 'GYM_GZIP_EXT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'rss_forum_gzip' => 0, + 'rss_forum_gzip_ext' => 1, + ), + ), + 'limit' => array( + 'display_vars' => array( + 'title' => 'GYM_LIMIT', + 'vars' => array( + 'legend1' => 'RSS_LIMIT_GEN', + 'rss_forum_url_limit' => array('lang' => 'GYM_URL_LIMIT', 'validate' => 'int:0:5000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_forum_sql_limit' => array('lang' => 'GYM_SQL_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_forum_time_limit' => array('lang' => 'GYM_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'legend2' => 'RSS_LIMIT_SPEC', + 'rss_forum_url_limit_long' => array('lang' => 'RSS_URL_LIMIT_LONG', 'validate' => 'int:0:5000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_forum_sql_limit_long' => array('lang' => 'RSS_SQL_LIMIT_LONG', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_forum_url_limit_short' => array('lang' => 'RSS_URL_LIMIT_SHORT', 'validate' => 'int:0:5000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_forum_sql_limit_short' => array('lang' => 'RSS_SQL_LIMIT_SHORT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_forum_url_limit_msg' => array('lang' => 'RSS_URL_LIMIT_MSG', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_forum_sql_limit_msg' => array('lang' => 'RSS_SQL_LIMIT_MSG', 'validate' => 'int:0:500', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'rss_forum_url_limit' => 50, + 'rss_forum_sql_limit' => 20, + 'rss_forum_time_limit' => 15, + 'rss_forum_url_limit_long' => 100, + 'rss_forum_sql_limit_long' => 25, + 'rss_forum_url_limit_short' => 10, + 'rss_forum_sql_limit_short' => 10, + 'rss_forum_url_limit_msg' => 15, + 'rss_forum_sql_limit_msg' => 15, + ), + ), + 'sort' => array( + 'display_vars' => array( + 'title' => 'GYM_SORT', + 'vars' => array( + 'legend1' => 'GYM_SORT', + 'rss_forum_sort' => array('lang' => 'GYM_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'rss_forum_sort' => 'DESC', + ), + 'select' => array( + 'rss_forum_sort' => @$this->dyn_select['sort'], + ), + ), + 'pagination' => array( + 'display_vars' => array( + 'title' => 'GYM_PAGINATION', + 'vars' => array( + 'legend1' => 'GYM_PAGINATION', + 'rss_forum_pagination' => array('lang' => 'GYM_PAGINATION_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_limitdown' => array('lang' => 'GYM_LIMITDOWN', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_forum_limitup' => array('lang' => 'GYM_LIMITUP', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'rss_forum_pagination' => 1, + 'rss_forum_limitdown' => 3, + 'rss_forum_limitup' => 5, + ), + ), + 'main' => array( + 'display_vars' => array( + 'title' => 'RSS_MAIN', + 'vars' => array( + // Settings + 'legend1' => 'RSS_SETTINGS', + 'rss_forum_c_info' => array('lang' => 'RSS_C_INFO', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true, 'overriding' => true), + 'rss_forum_sitename' => array('lang' => 'RSS_SITENAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true, 'overriding' => true), + 'rss_forum_site_desc' => array('lang' => 'RSS_SITE_DESC', 'validate' => 'string', 'type' => 'textarea:6:50', 'explain' => true, 'overriding' => true), + 'rss_forum_logo_url' => array('lang' => 'RSS_LOGO_URL', 'validate' => 'string', 'type' => 'text:25:200', 'explain' => true, 'overriding' => true), + 'rss_forum_image_url' => array('lang' => 'RSS_IMAGE_URL', 'validate' => 'string', 'type' => 'text:25:200', 'explain' => true, 'overriding' => true), + 'rss_forum_lang' => array('lang' => 'RSS_LANG', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'rss_forum_alternate' => array('lang' => 'RSS_FORUM_ALTERNATE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + // Auth settings + 'legend2' => 'RSS_AUTH_SETTINGS', + 'rss_forum_allow_auth' => array('lang' => 'RSS_ALLOW_AUTH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_cache_auth' => array('lang' => 'RSS_CACHE_AUTH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + // Notifications + 'legend3' => 'RSS_NOTIFY', + 'rss_forum_yahoo_notify' => array('lang' => 'RSS_YAHOO_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + // Exclusions + 'legend4' => 'RSS_FORUM_EXCLUDE', + 'rss_forum_exclude' => array('lang' => 'RSS_FORUM_EXCLUDE', 'multiple_validate' => 'int', 'type' => 'custom', 'method' => 'select_multiple_string', 'explain' => true), + ), + ), + 'default' => array( + 'rss_forum_c_info' => $config['sitename'], + 'rss_forum_sitename' => $config['sitename'], + 'rss_forum_site_desc' => $config['site_desc'], + 'rss_forum_logo_url' => 'logo.gif', + 'rss_forum_image_url' => 'rss_forum_big.gif', + 'rss_forum_lang' => $config['default_lang'], + 'rss_forum_alternate' => 1, + 'rss_forum_allow_auth' => 0, + 'rss_forum_cache_auth' => 1, + // Exclusions + 'rss_forum_exclude' => '', + // Notifications + 'rss_forum_yahoo_notify' => 0, + ), + 'select' => array( + 'rss_forum_lang' => $user->lang['ISO_639_1'], + 'rss_forum_exclude' => @$this->dyn_select['forums'], + + ), + ), + 'content' => array( + 'display_vars' => array( + 'title' => 'RSS_CONTENT', + 'vars' => array( + // Content + 'legend1' => 'RSS_CONTENT', + 'rss_forum_allow_news' => array('lang' => 'RSS_ALLOW_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_allow_short' => array('lang' => 'RSS_ALLOW_SHORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_allow_long' => array('lang' => 'RSS_ALLOW_LONG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_allow_content' => array('lang' => 'RSS_ALLOW_CONTENT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_allow_profile' => array('lang' => 'RSS_ALLOW_PROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_allow_profile_links' => array('lang' => 'RSS_ALLOW_PROFILE_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_allow_bbcode' => array('lang' => 'RSS_ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_strip_bbcode' => array('lang' => 'RSS_STRIP_BBCODE', 'validate' => 'string', 'type' => 'text:25:200', 'explain' => true, 'overriding' => true), + 'rss_forum_allow_links' => array('lang' => 'RSS_ALLOW_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_allow_emails' => array('lang' => 'RSS_ALLOW_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_allow_smilies' => array('lang' => 'RSS_ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_forum_sumarize' => array('lang' => 'RSS_SUMARIZE', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_forum_sumarize_method' => array('lang' => 'RSS_SUMARIZE_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'rss_forum_nohtml' => array('lang' => 'RSS_NOHTML', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + // form specific + 'legend2' => 'RSS_FORUM_CONTENT', + 'rss_forum_first' => array('lang' => 'RSS_FORUM_FIRST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_forum_last' => array('lang' => 'RSS_FORUM_LAST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_forum_rules' => array('lang' => 'RSS_FORUM_RULES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + ), + ), + 'default' => array( + // Content + 'rss_forum_allow_news' => 1, + 'rss_forum_allow_short' => 1, + 'rss_forum_allow_long' => 1, + 'rss_forum_allow_content' => 1, + 'rss_forum_allow_profile' => 1, + 'rss_forum_allow_profile_links' => 0, + 'rss_forum_allow_bbcode' => 1, + 'rss_forum_strip_bbcode' => '', + 'rss_forum_allow_links' => 1, + 'rss_forum_allow_emails' => 0, + 'rss_forum_allow_smilies' => 1, + 'rss_forum_sumarize' => 25, + 'rss_forum_sumarize_method' => 'words', + 'rss_forum_nohtml' => 0, + 'rss_forum_first' => 0, + 'rss_forum_last' => 1, + 'rss_forum_rules' => 0, + ), + 'select' => array( + 'rss_forum_sumarize_method' => @$this->dyn_select['sumarize_method'], + ), + ), + 'info' => array( + 'title_lang' => 'RSS_FORUM', + 'lang_file' => 'rss_forum', + 'actions' => array( 'main', 'content', 'cache', 'modrewrite', 'gzip', 'limit', 'sort', 'pagination',), + 'mode' => 'rss', + 'module' => 'forum' + ), + ); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/acp/rss_main.php b/phpBB/gym_sitemaps/acp/rss_main.php new file mode 100644 index 0000000000..5346ad9f87 --- /dev/null +++ b/phpBB/gym_sitemaps/acp/rss_main.php @@ -0,0 +1,317 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: rss_main.php 134 2009-11-02 11:13:45Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* rss_main Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class rss_main { + var $gym_master; + var $dyn_select = array(); + var $lang_iso639 = array(); + var $rss_override = array(); + /** + * constuctor + */ + function rss_main(&$gym_master) { + global $user; + $this->gym_master = &$gym_master; + // Load the language iso 639-1 code - http://www.loc.gov/standards/iso639-2/php/French_list.php + if ( !isset($user->lang['ISO_639_1'])) { + $user->add_lang('gym_sitemaps/gym_iso639'); + } + if (isset($this->gym_master->dyn_select) ) { + $this->rss_override = $this->gym_master->dyn_select['override']; + unset($this->rss_override[OVERRIDE_GLOBAL]); + $this->dyn_select = $this->gym_master->dyn_select; + } + } + /** + * acp_module() + * retunrs the acp config + * @access private + */ + function acp_module() { + global $config, $phpbb_seo, $user; + $config['sitename'] = utf8_normalize_nfc($config['sitename']); + $config['site_desc'] = utf8_normalize_nfc($config['site_desc']); + return array( + 'cache' => array( + 'display_vars' => array( + 'title' => 'GYM_CACHE', + 'vars' => array( + 'legend1' => 'GYM_CACHE', + 'rss_cache_on' => array('lang' => 'GYM_CACHE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_cache_force_gzip' => array('lang' => 'GYM_CACHE_FORCE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_cache_max_age' => array('lang' => 'GYM_CACHE_MAX_AGE', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_cache_auto_regen' => array('lang' => 'GYM_CACHE_AUTO_REGEN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'rss_showstats' => array('lang' => 'GYM_SHOWSTATS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'rss_cache_on' => 0, + 'rss_cache_force_gzip' => 0, + 'rss_cache_max_age' => 6, + 'rss_cache_auto_regen' => 1, + 'rss_showstats' => 1, + ), + ), + 'modrewrite' => array( + 'display_vars' => array( + 'title' => 'GYM_MODREWRITE', + 'vars' => array( + 'legend1' => 'GYM_MODREWRITE', + 'rss_modrewrite' => array('lang' => 'GYM_MODREWRITE_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_modrtype' => array('lang' => 'GYM_MODRTYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + 'rss_1xredir' => array('lang' => 'RSS_1XREDIR', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + ), + ), + 'default' => array( + 'rss_modrewrite' => 0, + 'rss_modrtype' => 0, + 'rss_1xredir' => 0, + ), + 'select' => array( + 'rss_modrtype' => @$this->dyn_select['modrtype'], + ), + ), + 'gzip' => array( + 'display_vars' => array( + 'title' => 'GYM_GZIP', + 'vars' => array( + 'legend4' => 'GYM_GZIP', + 'rss_gzip' => array('lang' => 'GYM_GZIP_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_gzip_ext' => array('lang' => 'GYM_GZIP_EXT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'rss_gzip' => 0, + 'rss_gzip_ext' => 1, + ), + ), + 'limit' => array( + 'display_vars' => array( + 'title' => 'GYM_LIMIT', + 'vars' => array( + 'legend1' => 'RSS_LIMIT_GEN', + 'rss_url_limit' => array('lang' => 'GYM_URL_LIMIT', 'validate' => 'int:0:5000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_sql_limit' => array('lang' => 'GYM_SQL_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_time_limit' => array('lang' => 'GYM_TIME_LIMIT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'legend2' => 'RSS_LIMIT_SPEC', + 'rss_url_limit_long' => array('lang' => 'RSS_URL_LIMIT_LONG', 'validate' => 'int:0:5000', 'type' => 'text:4:4', 'explain' => true,), + 'rss_sql_limit_long' => array('lang' => 'RSS_SQL_LIMIT_LONG', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true,), + 'rss_url_limit_short' => array('lang' => 'RSS_URL_LIMIT_SHORT', 'validate' => 'int:0:5000', 'type' => 'text:4:4', 'explain' => true,), + 'rss_sql_limit_short' => array('lang' => 'RSS_SQL_LIMIT_SHORT', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true,), + 'rss_url_limit_msg' => array('lang' => 'RSS_URL_LIMIT_MSG', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true,), + 'rss_sql_limit_msg' => array('lang' => 'RSS_SQL_LIMIT_MSG', 'validate' => 'int:0:500', 'type' => 'text:4:4', 'explain' => true,), + ), + ), + 'default' => array( + 'rss_url_limit' => 50, + 'rss_sql_limit' => 20, + 'rss_time_limit' => 15, + 'rss_url_limit_long' => 100, + 'rss_sql_limit_long' => 25, + 'rss_url_limit_short' => 10, + 'rss_sql_limit_short' => 10, + 'rss_url_limit_msg' => 15, + 'rss_sql_limit_msg' => 15, + ), + ), + 'sort' => array( + 'display_vars' => array( + 'title' => 'GYM_SORT', + 'vars' => array( + 'legend1' => 'GYM_SORT', + 'rss_sort' => array('lang' => 'GYM_SORT_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'rss_sort' => 'DESC', + ), + 'select' => array( + 'rss_sort' => @$this->dyn_select['sort'], + ), + ), + 'pagination' => array( + 'display_vars' => array( + 'title' => 'GYM_PAGINATION', + 'vars' => array( + 'legend1' => 'GYM_PAGINATION', + 'rss_pagination' => array('lang' => 'GYM_PAGINATION_ON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'overriding' => true), + 'rss_limitdown' => array('lang' => 'GYM_LIMITDOWN', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + 'rss_limitup' => array('lang' => 'GYM_LIMITUP', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true, 'overriding' => true), + ), + ), + 'default' => array( + 'rss_pagination' => 1, + 'rss_limitdown' => 3, + 'rss_limitup' => 5, + ), + ), + 'override' => array( + 'display_vars' => array( + 'title' => 'GYM_OVERRIDE', + 'vars' => array( + 'legend1' => 'GYM_OVERRIDE', + 'rss_override' => array('lang' => 'GYM_OVERRIDE_MAIN', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'rss_override_cache' => array('lang' => 'GYM_OVERRIDE_CACHE','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'rss_override_modrewrite' => array('lang' => 'GYM_OVERRIDE_MODREWRITE','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'rss_override_gzip' => array('lang' => 'GYM_OVERRIDE_GZIP','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'rss_override_limit' => array('lang' => 'GYM_OVERRIDE_LIMIT','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'rss_override_sort' => array('lang' => 'GYM_OVERRIDE_SORT','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'rss_override_pagination' => array('lang' => 'GYM_OVERRIDE_PAGINATION','validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + ), + ), + 'default' => array( + 'rss_override' => OVERRIDE_MODULE, + 'rss_override_cache' => OVERRIDE_OTYPE, + 'rss_override_modrewrite' => OVERRIDE_OTYPE, + 'rss_override_gzip' => OVERRIDE_GLOBAL, + 'rss_override_limit' => OVERRIDE_OTYPE, + 'rss_override_sort' => OVERRIDE_MODULE, + 'rss_override_pagination' => OVERRIDE_OTYPE, + ), + 'select' => array( + 'rss_override' => $this->rss_override, + 'rss_override_cache' => @$this->dyn_select['override'], + 'rss_override_modrewrite' => @$this->dyn_select['override'], + 'rss_override_gzip' => @$this->dyn_select['override'], + 'rss_override_limit' => @$this->dyn_select['override'], + 'rss_override_sort' => @$this->dyn_select['override'], + 'rss_override_pagination' => @$this->dyn_select['override'], + ), + ), + 'main' => array( + 'display_vars' => array( + 'title' => 'RSS_MAIN', + 'vars' => array( + // URL Settings + 'legend1' => 'RSS_URL', + 'rss_url' => array('lang' => 'RSS_URL', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + // Link Settings + 'legend2' => 'RSS_LINKS_ACTIVATION', + 'rss_link_main' => array('lang' => 'RSS_LINKS_MAIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'rss_link_index' => array('lang' => 'RSS_LINKS_INDEX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'rss_link_cat' => array('lang' => 'RSS_LINKS_CAT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true,), + 'rss_alternate' => array('lang' => 'RSS_ALTERNATE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_linking_type' => array('lang' => 'RSS_LINKING_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true), + // Settings + 'legend3' => 'RSS_SETTINGS', + 'rss_c_info' => array('lang' => 'RSS_C_INFO', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + 'rss_sitename' => array('lang' => 'RSS_SITENAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + 'rss_site_desc' => array('lang' => 'RSS_SITE_DESC', 'validate' => 'string', 'type' => 'textarea:6:50', 'explain' => true), + 'rss_logo_url' => array('lang' => 'RSS_LOGO_URL', 'validate' => 'string', 'type' => 'text:25:200', 'explain' => true), + 'rss_image_url' => array('lang' => 'RSS_IMAGE_URL', 'validate' => 'string', 'type' => 'text:25:200', 'explain' => true), + 'rss_lang' => array('lang' => 'RSS_LANG', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + // Auth settings + 'legend4' => 'RSS_AUTH_SETTINGS', + 'rss_allow_auth' => array('lang' => 'RSS_ALLOW_AUTH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_cache_auth' => array('lang' => 'RSS_CACHE_AUTH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + // Notifications + 'legend5' => 'RSS_NOTIFY', + 'rss_yahoo_notify' => array('lang' => 'RSS_YAHOO_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_yahoo_appid' => array('lang' => 'RSS_YAHOO_APPID', 'validate' => 'string', 'type' => 'text:25:200', 'explain' => true), + // Style + 'legend6' => 'RSS_STYLE', + 'rss_xslt' => array('lang' => 'RSS_XSLT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_force_xslt' => array('lang' => 'RSS_FORCE_XSLT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_load_phpbb_css' => array('lang' => 'RSS_LOAD_PHPBB_CSS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + ), + ), + 'default' => array( + 'rss_url' => $phpbb_seo->seo_path['phpbb_url'], + 'rss_link_main' => 1, + 'rss_link_index' => 1, + 'rss_link_cat' => 1, + 'rss_alternate' => 1, + 'rss_linking_type' => 'n', + 'rss_c_info' => $config['sitename'], + 'rss_sitename' => $config['sitename'], + 'rss_site_desc' => $config['site_desc'], + 'rss_logo_url' => 'logo.gif', + 'rss_image_url' => 'rss_forum_big.gif', + 'rss_lang' => $config['default_lang'], + 'rss_allow_auth' => 0, + 'rss_cache_auth' => 1, + // Notifications + 'rss_yahoo_notify' => 0, + 'rss_yahoo_appid' => '', + // Style + 'rss_xslt' => 1, + 'rss_force_xslt' => 1, + 'rss_load_phpbb_css' => 0, + ), + 'select' => array( + 'rss_lang' => $user->lang['ISO_639_1'], + 'rss_linking_type' => @$this->dyn_select['rss_linking_types'], + + ), + ), + 'content' => array( + 'display_vars' => array( + 'title' => 'RSS_CONTENT', + 'vars' => array( + // Content + 'legend1' => 'RSS_CONTENT', + 'rss_allow_news' => array('lang' => 'RSS_ALLOW_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_news_update' => array('lang' => 'RSS_NEWS_UPDATE', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true), + 'rss_allow_short' => array('lang' => 'RSS_ALLOW_SHORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_allow_long' => array('lang' => 'RSS_ALLOW_LONG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_allow_content' => array('lang' => 'RSS_ALLOW_CONTENT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_allow_profile' => array('lang' => 'RSS_ALLOW_PROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_allow_profile_links' => array('lang' => 'RSS_ALLOW_PROFILE_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_allow_bbcode' => array('lang' => 'RSS_ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_strip_bbcode' => array('lang' => 'RSS_STRIP_BBCODE', 'validate' => 'string', 'type' => 'text:30:200', 'explain' => true), + 'rss_allow_links' => array('lang' => 'RSS_ALLOW_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_allow_emails' => array('lang' => 'RSS_ALLOW_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_allow_smilies' => array('lang' => 'RSS_ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'rss_sumarize' => array('lang' => 'RSS_SUMARIZE', 'validate' => 'int:0:1000', 'type' => 'text:4:4', 'explain' => true,), + 'rss_sumarize_method' => array('lang' => 'RSS_SUMARIZE_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true,), + 'rss_nohtml' => array('lang' => 'RSS_NOHTML', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + ), + ), + 'default' => array( + // Content + 'rss_allow_news' => 1, + 'rss_news_update' => '', + 'rss_allow_short' => 1, + 'rss_allow_long' => 1, + 'rss_allow_content' => 1, + 'rss_allow_profile' => 1, + 'rss_allow_profile_links' => 0, + 'rss_allow_bbcode' => 1, + 'rss_strip_bbcode' => '', + 'rss_allow_links' => 1, + 'rss_allow_emails' => 0, + 'rss_allow_smilies' => 1, + 'rss_sumarize' => 50, + 'rss_sumarize_method' => 'words', + 'rss_nohtml' => 0, + ), + 'select' => array( + 'rss_sumarize_method' => @$this->dyn_select['sumarize_method'], + ), + ), + 'info' => array( + 'title_lang' => 'GYM_RSS', + 'lang_file' => 'gym_rss', + 'actions' => array('main', 'content', 'cache', 'modrewrite', 'gzip', 'limit', 'sort', 'pagination', 'override',), + 'mode' => 'rss', + 'module' => 'main', + ), + ); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/cache/.htaccess b/phpBB/gym_sitemaps/cache/.htaccess new file mode 100644 index 0000000000..6511d09c92 --- /dev/null +++ b/phpBB/gym_sitemaps/cache/.htaccess @@ -0,0 +1,4 @@ +<Limit GET POST PUT DELETE> +Order Allow,Deny +Deny from All +</Limit> diff --git a/phpBB/gym_sitemaps/display/.htaccess b/phpBB/gym_sitemaps/display/.htaccess new file mode 100644 index 0000000000..6511d09c92 --- /dev/null +++ b/phpBB/gym_sitemaps/display/.htaccess @@ -0,0 +1,4 @@ +<Limit GET POST PUT DELETE> +Order Allow,Deny +Deny from All +</Limit> diff --git a/phpBB/gym_sitemaps/display/display_forums.php b/phpBB/gym_sitemaps/display/display_forums.php new file mode 100644 index 0000000000..13ca6ca35e --- /dev/null +++ b/phpBB/gym_sitemaps/display/display_forums.php @@ -0,0 +1,343 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: display_forums.php 254 2010-03-12 15:08:58Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* display_forums Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class display_forums { + function display_forums(&$master) { + global $user, $template, $config, $phpEx, $db, $auth, $cache, $phpbb_root_path; + global $phpbb_seo; + static $tpl = array( + 'link' => '<a href="%1$s" title="%3$s">%2$s</a>', + 'img' => '<img src="%1$s" alt="%2$s"/>' + ); + // Usefull for multi bb topic & forum tracking + // Leave default for single forum eg : '_track' + $tracking_cookie_name = (defined('XLANG_AKEY') ? XLANG_AKEY : '') . '_track'; + // Specific options + $display_file = &$master->call['display_file']; + $display_user_info = &$master->call['display_user_info']; + $display_link = &$master->call['display_link']; + $display_pagination = &$master->call['display_pagination']; + $display_tracking = &$master->call['display_tracking']; + $display_topic_status = &$master->call['display_topic_status']; + $display_user_link = !empty($master->call['display_user_link']) ? true : false; + $display_user_link_key = $display_user_link ? 'full' : 'no_profile'; + $display_last_post = &$master->call['display_last_post']; + $forum_sql = &$master->call['forum_sql']; + $forum_read_auth = & $master->actions['auth_view_read']; + $forum_list_auth = & $master->actions['auth_view_list']; + if (!$display_tracking) { + $load_db_lastread = $load_anon_lastread = false; + } else { + $load_db_lastread = (boolean) ($config['load_db_lastread'] && $user->data['is_registered']); + $load_anon_lastread = (boolean) ($config['load_anon_lastread'] || $user->data['is_registered']); + } + // Do some reset + $forum_datas = $forum_ids = $sub_forums = array(); + $sql_array = array( + 'SELECT' => 'f.*', + 'FROM' => array( + FORUMS_TABLE => 'f', + ), + 'LEFT_JOIN' => array(), + 'WHERE' => $forum_sql, + 'ORDER_BY' => 'f.left_id ASC', + ); + // www.phpBB-SEO.com SEO TOOLKIT BEGIN -> no dupe + if (!empty($phpbb_seo->seo_opt['no_dupe']['on'])) { + $sql_array['SELECT'] .= ', t.topic_id, t.topic_title, t.topic_replies, t.topic_replies_real, t.topic_status, t.topic_type, t.topic_moved_id' . (!empty($phpbb_seo->seo_opt['sql_rewrite']) ? ', t.topic_url ' : ' '); + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => "t.topic_last_post_id = f.forum_last_post_id" + ); + } + // www.phpBB-SEO.com SEO TOOLKIT END -> no dupe + if ($load_db_lastread) { + $sql_array['SELECT'] .= ', ft.mark_time as forum_mark_time'; + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id' + ); + } elseif ($load_anon_lastread && empty($master->tracking_topics)) { + $master->tracking_topics = (isset($_COOKIE[$config['cookie_name'] . $tracking_cookie_name])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) : $_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) : ''; + $master->tracking_topics = ($master->tracking_topics) ? tracking_unserialize($master->tracking_topics) : array(); + if (!$user->data['is_registered']) { + $user->data['user_lastmark'] = (isset($master->tracking_topics['l'])) ? (int) (base_convert($master->tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + } + $right = 0; + $level_store = array(0 => 0); + $processed = array(); + $level = $last_level = 0; + $html = $html_before = $html_after = ''; + $separator = ' '; + $news_img = sprintf($tpl['img'], $master->gym_master->path_config['gym_img_url'] . 'html_news.gif', $user->lang['HTML_NEWS']); + $map_img = sprintf($tpl['img'], $master->gym_master->path_config['gym_img_url'] . 'maps-icon.gif', $user->lang['HTML_MAP']); + $subf_img = $user->img('subforum_read', 'NO_NEW_POSTS'); + $sql = $db->sql_build_query('SELECT', $sql_array); + unset($sql_array); + $result = $db->sql_query_limit($sql, 600); + while ($row = $db->sql_fetchrow($result)) { + $forum_id = (int) $row['forum_id']; + //@TODO Find why in hell the above query could return more than one row per forum + if (isset($processed[$forum_id])) { + continue; + } + $processed[$forum_id] = $forum_id; + $is_cat = $row['parent_id'] == 0 ? true : false; + if (empty($master->forum_datas[$forum_id])) { + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($row['forum_name'], $forum_id, 'forum'); + // www.phpBB-SEO.com SEO TOOLKIT END + $master->forum_datas[$forum_id] = array_merge($row, + array( + 'm_approve' => $auth->acl_get('m_approve', $forum_id), + 'forum_name' => !empty($row['forum_name']) ? $row['forum_name'] : '', + 'forum_status' => !empty($row['forum_status']) ? $row['forum_status'] : '', + 'forum_last_post_time' => !empty($row['forum_last_post_time']) ? $row['forum_last_post_time'] : 0, + 'enable_icons' => !empty($row['enable_icons']) ? $row['enable_icons'] : 0, + 'forum_url' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), + ) + ); + if ($load_db_lastread) { + $master->forum_tracking_info[$forum_id] = !empty($row['forum_mark_time']) ? $row['forum_mark_time'] : $user->data['user_lastmark']; + } elseif ($load_anon_lastread) { + $master->forum_tracking_info[$forum_id] = isset($master->tracking_topics['f'][$forum_id]) ? (int) (base_convert($master->tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + } + } + $master->forum_datas[$forum_id]['forum_news_url'] = $master->forum_datas[$forum_id]['forum_map_url'] = ''; + if (!isset($root_forum_id)) { + $root_forum_id = $forum_id; + $sub_forums[$root_forum_id] = ''; + } + $parent_id = (int) $row['parent_id']; + if ($row['left_id'] < $right) { + $level++; + $level_store[$parent_id] = $level; + } else if ($row['left_id'] > $right + 1) { + if (isset($level_store[$parent_id])) { + $level = $level_store[$parent_id]; + } else { + $level = 0; + } + } + $right = (int) $row['right_id']; + if ($level > 1) { // sub forums + if ($level > $last_level) { // going one or several level down + $diff = $level - $last_level; + $html_before = str_repeat("\n<ul><li>", $diff ); + $html_after = ""; + } + if ($level < $last_level) { // Going one or several level up + $diff = $last_level - $level; + $html_before = str_repeat("</li></ul>\n", $diff ) . "</li>\n<li>"; + $html_after = ""; + } + if ($level == $last_level) { // Adding a link at the same level + $html_before = isset($forum_list_auth[$forum_id]) ? "</li>\n<li>" : ''; + $html_after = ""; + } + if ($display_tracking) { + $forum_unread = (isset($master->forum_tracking_info[$forum_id]) && $master->forum_datas[$forum_id]['forum_last_post_time'] > $master->forum_tracking_info[$forum_id]) ? true : false; + if ($forum_unread) { + $folder_image = 'subforum_unread'; + $folder_alt = 'NEW_POSTS'; + } else { + $folder_image = 'subforum_read'; + $folder_alt = 'NO_NEW_POSTS'; + } + $subf_img = $user->img($folder_image, $folder_alt); + } + $link = ''; + if (isset($forum_list_auth[$forum_id])) { + if (!empty($row['forum_topics']) && (isset($forum_read_auth[$forum_id]) || $is_cat)) { + if ($master->module_config['html_allow_cat_news']) { + $title = sprintf($user->lang['HTML_NEWS_OF'], $row['forum_name']); + $link = isset($forum_read_auth[$forum_id]) ? sprintf($tpl['link'], append_sid($master->module_config['html_url'] . $master->gym_master->html_build_url('html_forum_cat_news', $phpbb_seo->seo_url['forum'][$forum_id], $forum_id)), $news_img . ' ' . $title, $title) : $title; + } + if ($master->module_config['html_allow_cat_map']) { + $title = sprintf($user->lang['HTML_MAP_OF'], $row['forum_name']); + $link .= $separator . (isset($forum_read_auth[$forum_id]) ? sprintf($tpl['link'], append_sid($master->module_config['html_url'] . $master->gym_master->html_build_url('html_forum_cat_map', $phpbb_seo->seo_url['forum'][$forum_id], $forum_id)), $map_img . ' ' . $title, $title) : $title); + } + } else { + $title = $link = '<b>' . $row['forum_name'] . '</b>'; + } + } + $sub_forums[$root_forum_id] .= $html_before . $link . $html_after; + + } else { + $forum_datas[$forum_id] = array_merge(array('level' => $level), $row); + $forum_ids[$forum_id] = $forum_id; + if (($level < $last_level)) { // We went up in this root forum + $_level = $level > 0 ? 0 : 1; + $sub_forums[$root_forum_id] .= str_repeat("</li></ul>\n", ($last_level - $level - $_level)); + } + if ($level == 1) { // next root forum + $root_forum_id = $forum_id; + $sub_forums[$root_forum_id] = ''; + } + } + $last_level = $level; + } + unset($processed); + if (!empty($sub_forums[$root_forum_id]) && ($last_level > 1)) { // In case we need to close the last sub forum tag + $sub_forums[$root_forum_id] .= str_repeat("</li></ul>\n", ($last_level - 1)); + } + $db->sql_freeresult($result); + // Let's go + $has_result = false; + if (!empty($forum_datas)) { + $has_result = true; + // Grab icons + if (empty($master->icons)) { + $master->icons = $cache->obtain_icons(); + } + $s_type_switch = 0; + $last_catless = true; + $root_data = array('forum_id' => 0); + $s_is_cat = true; + $level = 0; + $folder_alt = 'NO_NEW_POSTS'; + $folder_image = 'forum_read'; + $forum_folder_img = $user->img($folder_image, $folder_alt); + $forum_folder_img_src = $user->img($folder_image, $folder_alt, false, '', 'src'); + // Let's go + foreach($forum_ids as $forum_id) { + $row = &$forum_datas[$forum_id]; + $catless = $row['level'] == 0 ? true : false; + $is_cat = $row['parent_id'] == 0 ? true : false; + if (!isset($forum_list_auth[$forum_id]) || $row['forum_type'] == FORUM_LINK) { + continue; + } + $forum_map_link = $forum_news_link = $forum_map_title = $forum_news_title = ''; + if (!empty($row['forum_topics']) && (isset($forum_read_auth[$forum_id]) || $is_cat)) { + if ($master->module_config['html_allow_cat_map']) { + $forum_map_title = sprintf($user->lang['HTML_MAP_OF'], $row['forum_name']); + $forum_map_link = sprintf($tpl['link'], append_sid($master->module_config['html_url'] . $master->gym_master->html_build_url('html_forum_cat_map', $phpbb_seo->seo_url['forum'][$forum_id], $forum_id)), $map_img . ' ' . $forum_map_title, $forum_map_title); + } + if ($master->module_config['html_allow_cat_news']) { + $forum_news_title = sprintf($user->lang['HTML_NEWS_OF'], $row['forum_name']); + $forum_news_link = sprintf($tpl['link'], append_sid($master->module_config['html_url'] . $master->gym_master->html_build_url('html_forum_cat_news', $phpbb_seo->seo_url['forum'][$forum_id], $forum_id)), $news_img . ' ' . $forum_news_title, $forum_news_title); + } + } else { + $forum_news_title = $forum_news_link = '<b>' . $row['forum_name'] . '</b>'; + $forum_news_link .= '<br/>'; + } + $forum_unread = (isset($master->forum_tracking_info[$forum_id]) && $master->forum_datas[$forum_id]['forum_last_post_time'] > $master->forum_tracking_info[$forum_id]) ? true : false; + if ($display_topic_status) { + // Which folder should we display? + $folder_alt = ($forum_unread) ? 'NEW_POSTS' : 'NO_NEW_POSTS'; + if (!empty($sub_forums[$forum_id])) { + $folder_image = ($forum_unread) ? 'forum_unread_subforum' : 'forum_read_subforum'; + } else { + if ($row['forum_status'] == ITEM_LOCKED) { + $folder_image = ($forum_unread) ? 'forum_unread_locked' : 'forum_read_locked'; + $folder_alt = 'FORUM_LOCKED'; + } else if ($row['forum_type'] == FORUM_POST) { + $folder_image = ($forum_unread) ? 'forum_unread' : 'forum_read'; + } else { + $folder_image = 'forum_link'; + } + + } + $forum_folder_img = $user->img($folder_image, $folder_alt); + $forum_folder_img_src = $user->img($folder_image, $folder_alt, false, '', 'src'); + } + $tpl_data = array( + 'S_IS_CAT' => $is_cat, + 'S_NO_CAT' => $catless && !$last_catless ? true : false, + 'FORUM_ID' => $forum_id, + 'FORUM_NAME' => $forum_map_title, + 'FORUM_NEWS' => $forum_news_title, + 'FORUM_MAP_LINK' => $forum_map_link, + 'FORUM_NEWS_LINK' => $forum_news_link, + ); + if (!$is_cat) { + $tpl_data += array( + 'FORUM_DESC' => ($master->call['display_desc'] && !$is_cat) ? $master->generate_forum_info($row) : '', + 'FORUM_FOLDER_IMG' => $forum_folder_img, + 'FORUM_FOLDER_IMG_SRC' => $forum_folder_img_src, + 'FORUM_FOLDER_IMG_ALT' => $user->lang[$folder_alt], + 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', + 'SUBFORUMS' => !empty($sub_forums[$forum_id]) ? $sub_forums[$forum_id] : '', + ); + if ($display_last_post) { + // Create last post link information, if appropriate + if ($row['forum_last_post_id']) { + $last_post_subject = $row['forum_last_post_subject']; + $last_post_time = $user->format_date($row['forum_last_post_time']); + if (!empty($phpbb_seo->seo_opt['no_dupe']['on']) && !empty($row['topic_id']) && !$row['forum_password']) { + if ($row['topic_status'] == ITEM_MOVED) { + $row['topic_id'] = $row['topic_moved_id']; + } + $topic_id = (int) $row['topic_id']; + $row['topic_title'] = censor_text($row['topic_title']); + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + $phpbb_seo->prepare_iurl($row, 'topic', $row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$forum_id]); + // www.phpBB-SEO.com SEO TOOLKIT END + $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=" . @intval($phpbb_seo->seo_opt['topic_last_page'][$topic_id]) ) . '#p' . $row['forum_last_post_id']; + $last_post_link = '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") . '" title="' . $row['topic_title'] . ' : ' . $row['forum_name'] . '">' . $row['topic_title'] . '</a>'; + } else { + $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=" . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; + $last_post_link = ''; + } + } else { + $last_post_subject = $last_post_time = $last_post_url = $last_post_link = ''; + } + $tpl_data += array( + 'LAST_POST_SUBJECT' => censor_text($last_post_subject), + 'LAST_POST_TIME' => $last_post_time, + 'LAST_POST_LINK' => $last_post_link, + 'U_LAST_POST' => $last_post_url, + ); + if ($display_user_info) { + $tpl_data += array( + 'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'LAST_POSTER_FULL' => get_username_string($display_user_link_key, $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + ); + } + } + } + $template->assign_block_vars('forumrow', $tpl_data); + $last_catless = $catless; + unset($forum_datas[$forum_id]); + } + } + $map_desc = false; + if ($master->call['display_desc']) { + $map_desc = !empty($master->module_config['html_site_desc']) ? $master->module_config['html_site_desc'] : ''; + } + $template->assign_vars(array( + 'H1_FORUMS' => $master->module_config['html_sitename'], + 'DISPLAY_FORUMS_H1' => $display_link, + 'U_FORUMS' => $display_link ? append_sid("{$phpbb_root_path}index.$phpEx") : false, + 'FORUM_MAP_URL' => $master->module_config['html_allow_map'] ? append_sid($master->module_config['html_url'] . $master->url_settings['html_forum_map']) : '', + 'FORUM_NEWS' => sprintf($user->lang['HTML_NEWS_OF'], $master->module_config['html_sitename']), + 'NEWS_IMG_SRC' => $master->gym_master->path_config['gym_img_url'] . 'html_news.gif', + 'FORUM_NEWS_URL' => $master->module_config['html_allow_news'] ? append_sid($master->module_config['html_url'] . $master->url_settings['html_forum_news']) : '', + 'DISPLAY_FORUMS' => $has_result, + 'DISPLAY_USER_INFO' => $display_user_info, + 'DISPLAY_LAST_POST' => $display_last_post, + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'MAP_DESC' => $map_desc, + )); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/display/display_posts.php b/phpBB/gym_sitemaps/display/display_posts.php new file mode 100644 index 0000000000..62b358f2a2 --- /dev/null +++ b/phpBB/gym_sitemaps/display/display_posts.php @@ -0,0 +1,656 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: display_posts.php 254 2010-03-12 15:08:58Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* display_posts Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class display_posts { + function display_posts(&$master) { + global $user, $template, $config, $phpEx, $db, $auth, $phpbb_root_path, $cache; + static $bbcode; + static $display_orders = array('first' => 't.topic_id', 'last' => 't.topic_last_post_time'); + global $phpbb_seo; + // Usefull for multi bb topic & forum tracking + // Leave default for single forum eg : '_track' + $tracking_cookie_name = (defined('XLANG_AKEY') ? XLANG_AKEY : '') . '_track'; + $forum_read_auth = & $master->actions['auth_view_read']; + // Specific options + $display_file = &$master->call['display_file']; + $display_user_info = &$master->call['display_user_info']; + $display_user_link = !empty($master->call['display_user_link']) ? true : false; + $display_user_link_key = $display_user_link ? 'full' : 'no_profile'; + $display_link = &$master->call['display_link']; + $display_pagination = &$master->call['display_pagination']; + $display_tracking = &$master->call['display_tracking']; + $display_sig = !empty($master->call['display_sig']) ? (boolean) ($config['allow_sig'] && $user->optionget('viewsigs')) : false; + $display_order = isset($display_orders[$master->call['display_order']]) ? $display_orders[$master->call['display_order']] : $display_orders['first']; + $display_post_buttons = &$master->call['display_post_buttons']; + $display_sumarize = &$master->call['display_sumarize']; + $limit_time_sql = !empty($master->call['limit_time']) ? ' AND t.topic_last_post_time > ' . ($user->time_now - $master->call['limit_time']) : ''; + $order_sql = @$master->call['sort'] == 'ASC' ? ' ASC' : ' DESC'; + if (!$display_tracking) { + $load_db_lastread = $load_anon_lastread = false; + } else { + $load_db_lastread = (boolean) ($config['load_db_lastread'] && $user->data['is_registered']); + $load_anon_lastread = (boolean) ($config['load_anon_lastread'] || $user->data['is_registered']); + } + // hanlde options + $limit = $master->call['limit'] >= 1 ? (int) $master->call['limit'] : 5; + $start = &$master->start; + if (!$display_pagination || empty($display_file)) { + $start = 0; + $display_pagination = false; + } + $total_topics = 0; + $topic_sql = $master->call['topic_sql']; + $forum_sql = $master->call['forum_sql']; + $s_global = $master->call['s_global']; + $bbcode_bitfield = ''; + // Do some reset + $topic_datas = $topic_ids = $forum_ids = $user_cache = $id_cache = $post_datas = $forum_datas = array(); + $forum_id = $master->call['forum_id']; + $now = getdate(time() + $user->timezone + $user->dst - date('Z')); + // Get The Data, first forums + if ((!$s_global && !$master->call['single_forum']) || ($master->call['single_forum'] && empty($master->forum_datas[$master->call['forum_id']])) ) { + $sql_array = array( + 'SELECT' => 'f.*', + 'FROM' => array( + FORUMS_TABLE => 'f', + ), + 'LEFT_JOIN' => array(), + ); + if ($load_db_lastread) { + $sql_array['SELECT'] .= ', ft.mark_time as forum_mark_time'; + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id' + ); + } + $sql_array['WHERE'] = $forum_sql ? str_replace('t.forum_id', 'f.forum_id', $forum_sql) : ''; + $sql = $db->sql_build_query('SELECT', $sql_array); + unset($sql_array); + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { + $forum_id = (int) $row['forum_id']; + $forum_datas[$forum_id] = $row; + } + $db->sql_freeresult($result); + } + // Now the topics + $sql_array = array( + 'SELECT' => 't.*', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'LEFT_JOIN' => array(), + ); + if ($load_db_lastread) { + $sql_array['SELECT'] .= ', tt.mark_time'; + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), + 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND tt.topic_id = t.topic_id' + ); + } elseif ($load_anon_lastread && empty($master->tracking_topics)) { + $master->tracking_topics = (isset($_COOKIE[$config['cookie_name'] . $tracking_cookie_name])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) : $_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) : ''; + $master->tracking_topics = ($master->tracking_topics) ? tracking_unserialize($master->tracking_topics) : array(); + if (!$user->data['is_registered']) { + $user->data['user_lastmark'] = (isset($master->tracking_topics['l'])) ? (int) (base_convert($master->tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + } + $sql_where = ($forum_sql ? $forum_sql : '') . $limit_time_sql; + $sql_where .= $topic_sql ? ($sql_where ? ' AND ' : '') . $topic_sql : ''; + $sql_where .= ($sql_where ? ' AND ' : '') . 't.topic_status <> ' . ITEM_MOVED; + if ($master->call['single_forum']) { + $sql_where .= $auth->acl_get('m_approve', $master->call['forum_id']) ? '' : ' AND t.topic_approved = 1'; + } else { + // only admins and global moderators will see un-approved topics + // in the forum they have access to. + $sql_where .= ($auth->acl_gets('a_') || $auth->acl_getf_global('m_')) ? '' : ' AND t.topic_approved = 1'; + } + // obtain correct topic count if we display pagination + if ($display_pagination) { + $sql = "SELECT COUNT(t.topic_id) AS num_topics + FROM " . TOPICS_TABLE . " t + WHERE $sql_where"; + $result = $db->sql_query($sql); + $total_topics = (int) $db->sql_fetchfield('num_topics'); + $db->sql_freeresult($result); + // Make sure $start is set to the last page if it exceeds the amount + if ($start < 0 || $start > $total_topics) { + $start = ($start < 0) ? 0 : floor(($total_topics - 1) / $limit) * $limit; + // Since we've reached here, $start is not set proper, kill the dupe! + $url = $display_file . $master->gym_master->html_add_start($start); + $master->gym_master->seo_kill_dupes($url); + } + } + $sql_array['WHERE'] = $sql_where; + $sql_array['ORDER_BY'] = $display_order . $order_sql; + $sql = $db->sql_build_query('SELECT', $sql_array); + unset($sql_array); + $result = $db->sql_query_limit($sql, $limit, $start); + // First we parse the basic data + while ($row = $db->sql_fetchrow($result)) { + $forum_id = (int) $row['forum_id']; + $topic_id = (int) $row['topic_id']; + // Start with the forum + if (!$s_global && empty($master->forum_datas[$forum_id])) { + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + $phpbb_seo->set_url($forum_datas[$forum_id]['forum_name'], $forum_id, 'forum'); + // www.phpBB-SEO.com SEO TOOLKIT END + $master->forum_datas[$forum_id] = array_merge($forum_datas[$forum_id], array( + 'forum_url' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), + 'm_approve' => $auth->acl_get('m_approve', $forum_id), + )); + if ($load_db_lastread) { + $master->forum_tracking_info[$forum_id] = !empty($forum_datas[$forum_id]['forum_mark_time']) ? $forum_datas[$forum_id]['forum_mark_time'] : $user->data['user_lastmark']; + } elseif ($load_anon_lastread) { + $master->forum_tracking_info[$forum_id] = isset($master->tracking_topics['f'][$forum_id]) ? (int) (base_convert($master->tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + } + } + if (empty($master->forum_tracking_info[$forum_id])) { + if ($load_db_lastread) { + $master->topic_tracking_info[$topic_id] = !empty($row['mark_time']) ? $row['mark_time'] : $user->data['user_lastmark']; + } else if ($load_anon_lastread) { + $topic_id36 = base_convert($topic_id, 10, 36); + if (isset($master->tracking_topics['t'][$topic_id36])) { + $master->tracking_topics['t'][$topic_id] = base_convert($master->tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate']; + } + $master->topic_tracking_info[$topic_id] = isset($master->tracking_topics['t'][$topic_id]) ? $master->tracking_topics['t'][$topic_id] : $user->data['user_lastmark']; + } + } else { + $master->topic_tracking_info[$topic_id] = $master->forum_tracking_info[$forum_id]; + } + // Topic post count + $row['replies'] = !empty($master->forum_datas[$forum_id]['m_approve']) ? $row['topic_replies_real'] : $row['topic_replies']; + $row['enable_icons'] = !empty($master->forum_datas[$forum_id]['enable_icons']); + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + $phpbb_seo->prepare_iurl($row, 'topic', $row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$forum_id]); + // www.phpBB-SEO.com SEO TOOLKIT END + $topic_datas[$forum_id][$topic_id] = $row; + // @TODO deal with last post case ? + $topic_ids[$topic_id] = /*$master->call['display_order'] == 'first' ?*/ $row['topic_first_post_id'] /*: $row['topic_last_post_id']*/; + $forum_ids[$topic_id] = $forum_id; + } + $db->sql_freeresult($result); + unset($forum_datas); + // Let's go + $has_result = false; + if (!empty($topic_datas)) { + $has_result = true; + $bbcode_filter = false; + if (!class_exists('bbcode')) { + global $phpbb_root_path, $phpEx; + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + } + $patterns = $replaces = array(); + if ( !empty($master->module_config['html_msg_filters']['pattern']) ) { + $patterns = $master->module_config['html_msg_filters']['pattern']; + $replaces = $master->module_config['html_msg_filters']['replace']; + $bbcode_filter = true; + } + // Grab ranks + $ranks = $cache->obtain_ranks(); + // Grab icons + if (empty($master->icons)) { + $master->icons = $cache->obtain_icons(); + } + // Go ahead and pull all data for these topics + $sql_array = array(); + $sql_array['SELECT'] = $sql_array['WHERE'] = ''; + if ($display_user_info) { + $sql_array['SELECT'] = 'u.*, z.friend, z.foe, '; + $sql_array['FROM'] = array(USERS_TABLE => 'u'); + $sql_array['LEFT_JOIN'] = array( + array( + 'FROM' => array(ZEBRA_TABLE => 'z'), + 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id' + ) + ); + $sql_array['WHERE'] = 'AND u.user_id = p.poster_id'; + } + $sql_array['SELECT'] .= 'p.*'; + $sql_array['FROM'][POSTS_TABLE] = 'p'; + $sql_array['WHERE'] = $db->sql_in_set('p.post_id', $topic_ids) . $sql_array['WHERE']; + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { + $forum_id = (int) $row['forum_id']; + $topic_id = (int) $row['topic_id']; + // Define the global bbcode bitfield, will be used to load bbcodes + $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); + // Only compute profile data if required + if ($display_user_info) { + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + $phpbb_seo->set_user_url( $row['username'], $row['poster_id'] ); + // www.phpBB-SEO.com SEO TOOLKIT END + // Is a signature attached? Are we going to display it? + if ($display_sig && $row['enable_sig']) { + $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['user_sig_bbcode_bitfield']); + } + } else { + // @TODO deal with last post case ? + $row['user_id'] = $row['poster_id']; + $row['username'] = $topic_datas[$forum_id][$topic_id]['topic_first_poster_name']; + $row['user_colour'] = $topic_datas[$forum_id][$topic_id]['topic_first_poster_colour']; + } + $poster_id = (int) $row['poster_id']; + $post_datas[$forum_id][$topic_id] = array( + 'hide_post' => false, + 'post_id' => $row['post_id'], + 'post_time' => $row['post_time'], + 'user_id' => $row['user_id'], + 'username' => $row['username'], + 'user_colour' => $row['user_colour'], + 'topic_id' => $row['topic_id'], + 'forum_id' => $row['forum_id'], + 'post_subject' => $row['post_subject'], + 'post_edit_count' => $row['post_edit_count'], + 'post_edit_time' => $row['post_edit_time'], + 'post_edit_reason' => $row['post_edit_reason'], + 'post_edit_user' => $row['post_edit_user'], + // Make sure the icon actually exists + 'icon_id' => (isset($master->icons[$row['icon_id']]['img'], $master->icons[$row['icon_id']]['height'], $master->icons[$row['icon_id']]['width'])) ? $row['icon_id'] : 0, + 'post_attachment' => $row['post_attachment'], + 'post_approved' => $row['post_approved'], + 'post_reported' => $row['post_reported'], + 'post_username' => $row['post_username'], + 'post_text' => $row['post_text'], + 'bbcode_uid' => $row['bbcode_uid'], + 'bbcode_bitfield' => $row['bbcode_bitfield'], + 'enable_smilies' => $row['enable_smilies'], + 'enable_sig' => $row['enable_sig'], + 'friend' => false, + 'foe' => false, + ); + // Cache various user specific data ... so we don't have to recompute + // this each time the same user appears on this page + if (!isset($user_cache[$poster_id])) { + if ($poster_id == ANONYMOUS || !$display_user_info) { + $user_cache[$poster_id] = array( + 'joined' => '', + 'posts' => '', + 'from' => '', + 'sig' => '', + 'sig_bbcode_uid' => '', + 'sig_bbcode_bitfield' => '', + 'online' => false, + 'avatar' => '', + 'rank_title' => '', + 'rank_image' => '', + 'rank_image_src' => '', + 'profile' => '', + 'pm' => '', + 'email' => '', + 'www' => '', + 'icq_status_img' => '', + 'icq' => '', + 'aim' => '', + 'msn' => '', + 'yim' => '', + 'jabber' => '', + 'search' => '', + 'age' => '', + 'username' => $row['username'], + 'user_colour' => $row['user_colour'], + 'warnings' => 0, + 'allow_pm' => 0, + ); + } else { + $user_sig = ''; + // We add the signature to every posters entry because enable_sig is post dependant + if ($display_sig && $row['user_sig'] ) { + $user_sig = $row['user_sig']; + } + $id_cache[] = $poster_id; + $user_cache[$poster_id] = array( + 'joined' => $user->format_date($row['user_regdate']), + 'posts' => $row['user_posts'], + 'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0, + 'from' => (!empty($row['user_from'])) ? $row['user_from'] : '', + 'sig' => $user_sig, + 'sig_bbcode_uid' => (!empty($row['user_sig_bbcode_uid'])) ? $row['user_sig_bbcode_uid'] : '', + 'sig_bbcode_bitfield' => (!empty($row['user_sig_bbcode_bitfield'])) ? $row['user_sig_bbcode_bitfield'] : '', + 'viewonline' => $row['user_allow_viewonline'], + 'allow_pm' => $row['user_allow_pm'], + 'avatar' => ($user->optionget('viewavatars')) ? $master->gym_master->get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', + 'age' => '', + 'rank_title' => '', + 'rank_image' => '', + 'rank_image_src' => '', + 'username' => $row['username'], + 'user_colour' => $row['user_colour'], + 'online' => false, + 'profile' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$poster_id"), + 'www' => $row['user_website'], + 'aim' => ($row['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=aim&u=$poster_id") : '', + 'msn' => ($row['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=msnm&u=$poster_id") : '', + 'yim' => ($row['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '', + 'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', + 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '', + ); + $master->gym_master->get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); + if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email')) { + $user_cache[$poster_id]['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$poster_id") : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); + } else { + $user_cache[$poster_id]['email'] = ''; + } + if (!empty($row['user_icq'])) { + $user_cache[$poster_id]['icq'] = 'http://www.icq.com/people/webmsg.php?to=' . $row['user_icq']; + $user_cache[$poster_id]['icq_status_img'] = '<img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" alt="" />'; + } else { + $user_cache[$poster_id]['icq_status_img'] = ''; + $user_cache[$poster_id]['icq'] = ''; + } + if ($config['allow_birthdays'] && !empty($row['user_birthday'])) { + list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday'])); + if ($bday_year) { + $diff = $now['mon'] - $bday_month; + if ($diff == 0) { + $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; + } else { + $diff = ($diff < 0) ? 1 : 0; + } + $user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff); + } + } + } + $user_cache[$poster_id]['post_author_full'] = get_username_string($display_user_link_key, $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + $user_cache[$poster_id]['post_author_colour'] = get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + $user_cache[$poster_id]['post_author'] = get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + $user_cache[$poster_id]['u_post_author'] = $display_user_link ? get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']) : ''; + } + } + $db->sql_freeresult($result); + // Load custom profile fields + if ($display_user_info && $config['load_cpf_viewtopic']) { + include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); + $cp = new custom_profile(); + // Grab all profile fields from users in id cache for later use - similar to the poster cache + $profile_fields_cache = $cp->generate_profile_fields_template('grab', $id_cache); + } + // Generate online information for user + if (@$master->call['display_online'] && sizeof($id_cache)) { + $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline + FROM ' . SESSIONS_TABLE . ' + WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . ' + GROUP BY session_user_id'; + $result = $db->sql_query($sql); + $update_time = $config['load_online_time'] * 60; + while ($row = $db->sql_fetchrow($result)) { + $user_cache[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; + } + $db->sql_freeresult($result); + } + unset($id_cache); + // Instantiate BBCode + if (empty($bbcode)) { + $bbcode = new bbcode(base64_encode($bbcode_bitfield)); + } else { + $bbcode->bbcode(base64_encode($bbcode_bitfield)); + } + $prev_post_id = ''; + // Parse messages + foreach ($forum_ids as $topic_id => $forum_id) { + if (!isset($post_datas[$forum_id][$topic_id])) { + continue; + } + $row =& $post_datas[$forum_id][$topic_id]; + $topic_data =& $topic_datas[$forum_id][$topic_id]; + $poster_id = (int) $row['user_id']; + $l_edited_by = $l_bumped_by = ''; + $s_first_unread = false; + // End signature parsing, only if needed + if (@$user_cache[$poster_id]['sig'] && $row['enable_sig'] && empty($user_cache[$poster_id]['sig_parsed'])) { + $user_cache[$poster_id]['sig'] = censor_text($user_cache[$poster_id]['sig']); + if ($user_cache[$poster_id]['sig_bbcode_bitfield']) { + if ( $bbcode_filter ) { + $user_cache[$poster_id]['sig'] = preg_replace($patterns, $replaces, $user_cache[$poster_id]['sig']); + } + $bbcode->bbcode_second_pass($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield']); + } + $user_cache[$poster_id]['sig'] = bbcode_nl2br($user_cache[$poster_id]['sig']); + $user_cache[$poster_id]['sig'] = $master->gym_master->smiley_text($user_cache[$poster_id]['sig'], !$master->module_config['html_allow_smilies']); + $user_cache[$poster_id]['sig_parsed'] = true; + } else { // Remove sig + $user_cache[$poster_id]['sig'] = ''; + } + // Parse the message and subject + $message = &$row['post_text']; + if ( $bbcode_filter ) { + $message = preg_replace($patterns, $replaces, $message); + } + if ($display_sumarize > 0 ) { + $message = $master->gym_master->summarize( $message, $display_sumarize, $master->call['display_sumarize_method'] ); + // Clean broken tag at the end of the message + $message = preg_replace('`\<[^\<\>]*$`i', ' ...', $message); + // Close broken bbcode tags requiring it, only quotes for now + $master->gym_master->close_bbcode_tags($message, $row['bbcode_uid']); + } + // Parse the message and subject + $message = censor_text($message); + // Second parse bbcode here + if ($row['bbcode_bitfield']) { + $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); + } + $message = bbcode_nl2br($message); + $message = $master->gym_master->smiley_text($message, !$master->module_config['html_allow_smilies']); + if ($display_sumarize > 0 ) { // Clean up + static $find = array('`\<\!--[^\<\>]+--\>`Ui', '`\[\/?[^\]\[]*\]`Ui'); + $message = preg_replace($find, '', $message); + } + // Replace naughty words such as farty pants + $row['post_subject'] = censor_text(!empty($row['post_subject']) ? $row['post_subject'] : $topic_data['topic_title']); + // custom profile fields + $cp_row = array(); + if ($display_user_info && $config['load_cpf_viewtopic']) { + $cp_row = (isset($profile_fields_cache[$poster_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$poster_id]) : array(); + } + $post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false; + // Generate all the URIs ... + if (!$s_global && !isset($master->module_config['global_exclude_list'][$forum_id])) { + $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") . '#p' . $row['post_id']; + $view_forum_url = $master->forum_datas[$forum_id]['forum_url']; + } else { + $view_topic_url = $view_forum_url = ''; + } + $postrow = array( + 'FORUM_NAME' => !$s_global ? $master->forum_datas[$forum_id]['forum_name'] : '', + 'U_VIEW_FORUM' => $view_forum_url, + 'VIEWS' => $topic_data['topic_views'], + 'POST_DATE' => $user->format_date($row['post_time']), + 'POST_SUBJECT' => $row['post_subject'], + 'MESSAGE' => $message, + 'EDITED_MESSAGE' => $l_edited_by, + 'EDIT_REASON' => $row['post_edit_reason'], + 'BUMPED_MESSAGE' => $l_bumped_by, + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'POST_ICON_IMG' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $master->icons[$row['icon_id']]['img'] : '', + 'POST_ICON_IMG_WIDTH' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $master->icons[$row['icon_id']]['width'] : '', + 'POST_ICON_IMG_HEIGHT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $master->icons[$row['icon_id']]['height'] : '', + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + 'U_MINI_POST' => $view_topic_url, + 'U_NEWEST_POST' => $post_unread ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&t=' . $topic_id . '&view=unread#unread') : '', + // www.phpBB-SEO.com SEO TOOLKIT END + //'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '', + //'U_PREV_POST_ID' => $prev_post_id, + + 'POST_ID' => $row['post_id'], + 'POSTER_ID' => $poster_id, + 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, + 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, + 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false, + 'S_DISPLAY_NOTICE' => 0 /*$display_notice && $row['post_attachment']*/, + 'S_FRIEND' => ($row['friend']) ? true : false, + 'S_UNREAD_POST' => $post_unread, + //'S_FIRST_UNREAD' => $s_first_unread, + 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, + 'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false, + 'S_IGNORE_POST' => ($row['hide_post']) ? true : false, + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$row['post_id']}&view=show") . '#p' . $row['post_id'] . '">', '</a>') : '', + // www.phpBB-SEO.com SEO TOOLKIT END + 'REPLIES' => $topic_datas[$forum_id][$topic_id]['replies'], + ); + if ($display_user_info) { + $postrow += array( + 'POST_AUTHOR_FULL' => $user_cache[$poster_id]['post_author_full'], + 'POST_AUTHOR_COLOUR' => $user_cache[$poster_id]['post_author_colour'], + 'POST_AUTHOR' => $user_cache[$poster_id]['post_author'], + 'U_POST_AUTHOR' => $user_cache[$poster_id]['u_post_author'], + 'SIGNATURE' => $user_cache[$poster_id]['sig'], + 'RANK_TITLE' => $user_cache[$poster_id]['rank_title'], + 'RANK_IMG' => $user_cache[$poster_id]['rank_image'], + 'RANK_IMG_SRC' => $user_cache[$poster_id]['rank_image_src'], + 'POSTER_JOINED' => $user_cache[$poster_id]['joined'], + 'POSTER_POSTS' => $user_cache[$poster_id]['posts'], + 'POSTER_FROM' => $user_cache[$poster_id]['from'], + 'POSTER_AVATAR' => $user_cache[$poster_id]['avatar'], + 'POSTER_WARNINGS' => $user_cache[$poster_id]['warnings'], + 'POSTER_AGE' => $user_cache[$poster_id]['age'], + 'ICQ_STATUS_IMG' => $user_cache[$poster_id]['icq_status_img'], + 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), + 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), + 'U_PROFILE' => $user_cache[$poster_id]['profile'], + 'U_SEARCH' => $user_cache[$poster_id]['search'], + 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '', + 'U_EMAIL' => $user_cache[$poster_id]['email'], + 'U_WWW' => $user_cache[$poster_id]['www'], + 'U_ICQ' => $user_cache[$poster_id]['icq'], + 'U_AIM' => $user_cache[$poster_id]['aim'], + 'U_MSN' => $user_cache[$poster_id]['msn'], + 'U_YIM' => $user_cache[$poster_id]['yim'], + 'U_JABBER' => $user_cache[$poster_id]['jabber'], + + ); + } + if ($display_post_buttons) { + $postrow += array( + 'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : ''), + 'U_QUOTE' => ($auth->acl_get('f_reply', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f=$forum_id&p={$row['post_id']}") : '', + 'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '', + 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), + 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '', + 'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $poster_id, true, $user->session_id) : '', + 'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + ); + } + if (isset($cp_row['row']) && sizeof($cp_row['row'])) { + $postrow = array_merge($postrow, $cp_row['row']); + } + // Dump vars into template + $template->assign_block_vars('postrow', $postrow); + if (!empty($cp_row['blockrow'])) { + foreach ($cp_row['blockrow'] as $field_data) { + $template->assign_block_vars('postrow.custom_fields', $field_data); + } + } + // Display not already displayed Attachments for this post, we already parsed them. ;) + if (!empty($attachments[$row['post_id']])) { + foreach ($attachments[$row['post_id']] as $attachment) { + $template->assign_block_vars('postrow.attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + } + $prev_post_id = $row['post_id']; + unset($topic_datas[$forum_id][$topic_id]); + } + unset($topic_datas, $user_cache); + } + $news_desc = false; + $rules_info = array('forum_rules' => false, 'forum_rules_link' => false); + // In case we are listing category's children + if ($master->call['cat_forum']) { + $forum_id = $master->call['cat_forum']; + } + if ($master->call['display_desc']) { + $news_desc = !empty($master->module_config['html_site_desc']) ? $master->module_config['html_site_desc'] : ''; + if ($master->call['single_forum'] || $master->call['cat_forum']) { + $news_desc = $master->generate_forum_info($master->forum_datas[$forum_id]); + } + } + if ($master->call['display_rules'] && ($master->call['single_forum'] || $master->call['cat_forum']) ) { + $rules_info = $master->generate_forum_info($master->forum_datas[$forum_id], 'rules'); + } + $tpl_vars = array( + 'H1_POSTS' => $master->outputs['page_title'], + 'DISPLAY_POSTS_H1' => $display_link, + 'U_POSTS' => $display_link ? append_sid($display_file) : false, + 'DISPLAY_USER_INFO' => $display_user_info, + 'DISPLAY_POSTS' => $has_result, + 'DISPLAY_POST_BUTTONS' => $display_post_buttons, + 'NEWS_DESC' => $news_desc, + 'NEWS_RULES' => $rules_info['forum_rules'], + 'NEWS_RULES_LINK' => $rules_info['forum_rules_link'], + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), + 'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/", + 'NEWS_IMG_SRC' => $master->gym_master->path_config['gym_img_url'] . 'html_news.gif', + ); + if ($master->call['single_forum'] || $master->call['cat_forum']) { + $tpl_vars += array( + 'FORUM_MAP_URL' => $master->module_config['html_allow_cat_map'] ? append_sid($master->gym_master->html_build_url('html_forum_cat_map', $phpbb_seo->seo_url['forum'][$forum_id], $forum_id)) : '', + 'FORUM_MAP' => sprintf($user->lang['HTML_MAP_OF'], $master->forum_datas[$forum_id]['forum_name']), + 'FORUM_URL' => $master->forum_datas[$forum_id]['forum_url'], + 'FORUM_NAME' => $master->forum_datas[$forum_id]['forum_name'], + 'S_SINGLE_FORUM' => $master->call['cat_forum'] ? false : true, + ); + } else { + $tpl_vars += array( + 'FORUM_MAP' => sprintf($user->lang['HTML_MAP_OF'], $master->module_config['html_sitename']), + 'FORUM_MAP_URL' => $master->module_config['html_allow_map'] ? append_sid($master->module_config['html_url'] . $master->url_settings['html_forum_map']) : '', + 'FORUM_URL' => append_sid("{$phpbb_root_path}index.$phpEx"), + 'FORUM_NAME' => $master->module_config['html_sitename'], + ); + } + if ($display_user_info) { + $tpl_vars += array( + 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'), + 'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'), + 'PM_IMG' => $user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), + 'EMAIL_IMG' => $user->img('icon_contact_email', 'SEND_EMAIL'), + 'WWW_IMG' => $user->img('icon_contact_www', 'VISIT_WEBSITE'), + 'ICQ_IMG' => $user->img('icon_contact_icq', 'ICQ'), + 'AIM_IMG' => $user->img('icon_contact_aim', 'AIM'), + 'MSN_IMG' => $user->img('icon_contact_msnm', 'MSNM'), + 'YIM_IMG' => $user->img('icon_contact_yahoo', 'YIM'), + 'JABBER_IMG' => $user->img('icon_contact_jabber', 'JABBER'), + ); + } + if ($display_post_buttons) { + $tpl_vars += array( + 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), + 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'), + 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'), + 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'), + 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'), + 'WARN_IMG' => $user->img('icon_user_warn', 'WARN_USER'), + ); + } + if ($display_pagination) { + $l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER'; + $tpl_vars += array( + 'DISPLAY_PAGINATION' => generate_pagination(append_sid($display_file), $total_topics, $limit, $start), + 'DISPLAY_PAGE_NUMBER' => on_page($total_topics, $limit, $start), + 'DISPLAY_TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics), + ); + } + $template->assign_vars($tpl_vars); + unset($tpl_vars); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/display/display_topics.php b/phpBB/gym_sitemaps/display/display_topics.php new file mode 100644 index 0000000000..5de64c8dcb --- /dev/null +++ b/phpBB/gym_sitemaps/display/display_topics.php @@ -0,0 +1,342 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: display_topics.php 254 2010-03-12 15:08:58Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* display_topics Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class display_topics { + function display_topics(&$master) { + global $user, $template, $config, $phpEx, $db, $auth, $cache, $phpbb_root_path; + static $display_orders = array('first' => 't.topic_id', 'last' => 't.topic_last_post_time'); + global $phpbb_seo; + // Usefull for multi bb topic & forum tracking + // Leave default for single forum eg : '_track' + $tracking_cookie_name = (defined('XLANG_AKEY') ? XLANG_AKEY : '') . '_track'; + // Specific options + $display_file = &$master->call['display_file']; + $display_user_info = &$master->call['display_user_info']; + $display_link = &$master->call['display_link']; + $display_pagination = &$master->call['display_pagination']; + $display_tracking = &$master->call['display_tracking']; + $display_topic_status = &$master->call['display_topic_status']; + $display_user_link = !empty($master->call['display_user_link']) ? true : false; + $display_user_link_key = $display_user_link ? 'full' : 'no_profile'; + $display_last_post = &$master->call['display_last_post']; + $display_order = isset($display_orders[$master->call['display_order']]) ? $display_orders[$master->call['display_order']] : $display_orders['first']; + $limit_time_sql = !empty($master->call['limit_time']) ? ' AND t.topic_last_post_time > ' . ($user->time_now - $master->call['limit_time']) : ''; + $order_sql = @$master->call['sort'] == 'ASC' ? ' ASC' : ' DESC'; + if (!$display_tracking) { + $load_db_lastread = $load_anon_lastread = false; + } else { + $load_db_lastread = (boolean) ($config['load_db_lastread'] && $user->data['is_registered']); + $load_anon_lastread = (boolean) ($config['load_anon_lastread'] || $user->data['is_registered']); + } + // hanlde options + $limit = $master->call['limit'] >= 1 ? (int) $master->call['limit'] : 5; + $start = &$master->start; + if (!$display_pagination || empty($display_file)) { + $start = 0; + $display_pagination = false; + } + $total_topics = 0; + $topic_sql = $master->call['topic_sql']; + $forum_sql = $master->call['forum_sql']; + $s_global = $master->call['s_global']; + // Do some reset + $topic_datas = $topic_ids = $forum_ids = $user_cache = $id_cache = $post_datas = $forum_datas = array(); + $forum_id = $master->call['forum_id']; + // Get The Data, first forums + if ((!$s_global && !$master->call['single_forum']) || ($master->call['single_forum'] && empty($master->forum_datas[$master->call['forum_id']])) ) { + $sql_array = array( + 'SELECT' => 'f.*', + 'FROM' => array( + FORUMS_TABLE => 'f', + ), + 'LEFT_JOIN' => array(), + ); + if ($load_db_lastread) { + $sql_array['SELECT'] .= ', ft.mark_time as forum_mark_time'; + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id' + ); + } + $sql_array['WHERE'] = $forum_sql ? str_replace('t.forum_id', 'f.forum_id', $forum_sql) : ''; + $sql = $db->sql_build_query('SELECT', $sql_array); + unset($sql_array); + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { + $forum_id = (int) $row['forum_id']; + $forum_datas[$forum_id] = $row; + } + $db->sql_freeresult($result); + } + // Now the topics + $sql_array = array( + 'SELECT' => 't.*', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'LEFT_JOIN' => array(), + ); + if ($load_db_lastread) { + $sql_array['SELECT'] .= ', tt.mark_time'; + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), + 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND tt.topic_id = t.topic_id' + ); + } elseif ($load_anon_lastread && empty($master->tracking_topics)) { + $master->tracking_topics = (isset($_COOKIE[$config['cookie_name'] . $tracking_cookie_name])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) : $_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) : ''; + $master->tracking_topics = ($master->tracking_topics) ? tracking_unserialize($master->tracking_topics) : array(); + if (!$user->data['is_registered']) { + $user->data['user_lastmark'] = (isset($master->tracking_topics['l'])) ? (int) (base_convert($master->tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + } + $sql_where = ($forum_sql ? $forum_sql : '') . $limit_time_sql; + $sql_where .= $topic_sql ? ($sql_where ? ' AND ' : '') . $topic_sql : ''; + $sql_where .= ($sql_where ? ' AND ' : '') . 't.topic_status <> ' . ITEM_MOVED; + if ($master->call['single_forum']) { + $sql_where .= $auth->acl_get('m_approve', $master->call['forum_id']) ? '' : ' AND t.topic_approved = 1'; + } else { + // only admins and global moderators will see un-approved topics + // in the forum they have access to. + $sql_where .= ($auth->acl_gets('a_') || $auth->acl_getf_global('m_')) ? '' : ' AND t.topic_approved = 1'; + } + // obtain correct topic count if we display pagination + if ($display_pagination) { + $sql = "SELECT COUNT(t.topic_id) AS num_topics + FROM " . TOPICS_TABLE . " t + WHERE $sql_where"; + $result = $db->sql_query($sql); + $total_topics = (int) $db->sql_fetchfield('num_topics'); + $db->sql_freeresult($result); + // Make sure $start is set to the last page if it exceeds the amount + if ($start < 0 || $start > $total_topics) { + $start = ($start < 0) ? 0 : floor(($total_topics - 1) / $limit) * $limit; + // Since we've reached here, $start is not set proper, kill the dupe! + $url = $display_file . $master->gym_master->html_add_start($start); + $master->gym_master->seo_kill_dupes($url); + } + } + $sql_array['WHERE'] = $sql_where; + $sql_array['ORDER_BY'] = $display_order . $order_sql; + $sql = $db->sql_build_query('SELECT', $sql_array); + unset($sql_array); + $result = $db->sql_query_limit($sql, $limit, $start); + while ($row = $db->sql_fetchrow($result)) { + $topic_id = (int) $row['topic_id']; + $forum_id = (int) $row['forum_id']; + // Start with the forum + if (!$s_global && empty($master->forum_datas[$forum_id])) { + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + $phpbb_seo->set_url($forum_datas[$forum_id]['forum_name'], $forum_id, 'forum'); + // www.phpBB-SEO.com SEO TOOLKIT END + $master->forum_datas[$forum_id] = array_merge($forum_datas[$forum_id], array( + 'forum_url' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), + 'm_approve' => $auth->acl_get('m_approve', $forum_id), + )); + if ($load_db_lastread) { + $master->forum_tracking_info[$forum_id] = !empty($forum_datas[$forum_id]['forum_mark_time']) ? $forum_datas[$forum_id]['forum_mark_time'] : $user->data['user_lastmark']; + } elseif ($load_anon_lastread) { + $master->forum_tracking_info[$forum_id] = isset($master->tracking_topics['f'][$forum_id]) ? (int) (base_convert($master->tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + } + } + $topic_datas[$topic_id] = $row; + $topic_ids[$topic_id] = $topic_id; + } + $db->sql_freeresult($result); + // Let's go + $has_result = false; + if (!empty($topic_datas)) { + $has_result = true; + // Grab icons + if (empty($master->icons)) { + $master->icons = $cache->obtain_icons(); + } + $s_type_switch = 0; + $folder_alt = 'NO_NEW_POSTS'; + $topic_type = ''; + $folder_img = 'topic_read'; + $topic_folder_img = $user->img($folder_img, $folder_alt); + $topic_folder_img_src = $user->img($folder_img, $folder_alt, false, '', 'src'); + foreach ($topic_ids as $topic_id) { + $topic_id = (int) $topic_id; + $row = &$topic_datas[$topic_id]; + $forum_id = (int) $row['forum_id']; + if (empty($master->forum_tracking_info[$forum_id])) { + if ($load_db_lastread) { + $master->topic_tracking_info[$topic_id] = !empty($row['mark_time']) ? $row['mark_time'] : $user->data['user_lastmark']; + } else if ($load_anon_lastread) { + $topic_id36 = base_convert($topic_id, 10, 36); + if (isset($master->tracking_topics['t'][$topic_id36])) { + $master->tracking_topics['t'][$topic_id] = base_convert($master->tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate']; + } + $master->topic_tracking_info[$topic_id] = isset($master->tracking_topics['t'][$topic_id]) ? $master->tracking_topics['t'][$topic_id] : $user->data['user_lastmark']; + } + } else { + $master->topic_tracking_info[$topic_id] = $master->forum_tracking_info[$forum_id]; + } + $row['topic_title'] = censor_text($row['topic_title']); + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + $phpbb_seo->prepare_iurl($row, 'topic', $row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$forum_id]); + // www.phpBB-SEO.com SEO TOOLKIT END + // This will allow the style designer to output a different header + // or even separate the list of announcements from sticky and normal topics + $s_type_switch_test = /*($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 :*/ 0; + // Replies + $replies = !empty($master->forum_datas[$forum_id]['m_approve']) ? $row['topic_replies_real'] : $row['topic_replies']; + $unread_topic = (isset($master->topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $master->topic_tracking_info[$topic_id]) ? true : false; + // Get folder img, topic status/type related information + if ($display_topic_status) { + $master->gym_master->topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type); + $topic_folder_img = $user->img($folder_img, $folder_alt); + $topic_folder_img_src = $user->img($folder_img, $folder_alt, false, '', 'src'); + } + // Generate all the URIs ... + $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); + $view_forum_url = !$s_global ? $master->forum_datas[$forum_id]['forum_url'] : ''; + $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$topic_id", true, $user->session_id) : ''; + // www.phpBB-SEO.com SEO TOOLKIT BEGIN -> no dupe + if (!empty($phpbb_seo->seo_opt['no_dupe']['on'])) { + if (($replies + 1) > $phpbb_seo->seo_opt['topic_per_page']) { + $phpbb_seo->seo_opt['topic_last_page'][$topic_id] = floor($replies / $phpbb_seo->seo_opt['topic_per_page']) * $phpbb_seo->seo_opt['topic_per_page']; + } + } + // www.phpBB-SEO.com SEO TOOLKIT END -> no dupe + $tpl_data = array( + 'FORUM_ID' => $forum_id, + 'TOPIC_ID' => $topic_id, + 'PAGINATION' => $master->call['display_topic_pagination'] ? $master->gym_master->topic_generate_pagination($replies, $view_topic_url) : '', + 'REPLIES' => $replies, + 'VIEWS' => $row['topic_views'], + 'TOPIC_TITLE' => $row['topic_title'], + 'FORUM_NAME' => !$s_global ? $master->forum_datas[$forum_id]['forum_name'] : '', + 'TOPIC_TYPE' => $topic_type, + 'TOPIC_FOLDER_IMG' => $topic_folder_img, + 'TOPIC_FOLDER_IMG_SRC' => $topic_folder_img_src, + 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], + 'TOPIC_ICON_IMG' => (!empty($master->icons[$row['icon_id']])) ? $master->icons[$row['icon_id']]['img'] : '', + 'TOPIC_ICON_IMG_WIDTH' => (!empty($master->icons[$row['icon_id']])) ? $master->icons[$row['icon_id']]['width'] : '', + 'TOPIC_ICON_IMG_HEIGHT' => (!empty($master->icons[$row['icon_id']])) ? $master->icons[$row['icon_id']]['height'] : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'S_TOPIC_TYPE' => $row['topic_type'], + 'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false, + 'S_UNREAD_TOPIC' => $unread_topic, + 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false, + 'S_TOPIC_UNAPPROVED' => $topic_unapproved, + 'S_POSTS_UNAPPROVED' => $posts_unapproved, + 'S_HAS_POLL' => ($row['poll_start']) ? true : false, + 'S_POST_ANNOUNCE' => ($row['topic_type'] == POST_ANNOUNCE) ? true : false, + 'S_POST_GLOBAL' => ($row['topic_type'] == POST_GLOBAL) ? true : false, + 'S_POST_STICKY' => ($row['topic_type'] == POST_STICKY) ? true : false, + 'S_TOPIC_LOCKED' => ($row['topic_status'] == ITEM_LOCKED) ? true : false, + 'S_TOPIC_MOVED' => ($row['topic_status'] == ITEM_MOVED) ? true : false, + 'U_NEWEST_POST' => $unread_topic ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&t=' . $topic_id . '&view=unread#unread') : '', + + 'U_VIEW_TOPIC' => $view_topic_url, + 'U_VIEW_FORUM' => $view_forum_url, + 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $forum_id . '&t=' . $topic_id, true, $user->session_id), + 'U_MCP_QUEUE' => $u_mcp_queue, + 'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test, + ); + if ($display_last_post) { + $tpl_data += array( + 'TOPIC_LAST_POST_TITLE' => !empty($row['topic_last_post_subject']) ? censor_text($row['topic_last_post_subject']) : $row['topic_title'], + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + 'U_MINI_POST' => !empty($phpbb_seo->seo_opt['no_dupe']['on']) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=" . @intval($phpbb_seo->seo_opt['topic_last_page'][$topic_id]) ) . '#p' . $row['topic_last_post_id'] : append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['topic_last_post_id'] . (($row['topic_type'] == POST_GLOBAL) ? '&f=' . $forum_id : '')) . '#p' . $row['topic_last_post_id'], + // www.phpBB-SEO.com SEO TOOLKIT END + ); + } + if ($display_user_info) { + $tpl_data += array( + 'TOPIC_AUTHOR_FULL' => get_username_string($display_user_link_key, $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']), + 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string($display_user_link_key, $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'U_LAST_POST_AUTHOR' => $display_user_link ? get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']) : '', + 'U_TOPIC_AUTHOR' => $display_user_link ? get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']) : '', + ); + } + $template->assign_block_vars('topicrow', $tpl_data); + unset($tpl_data); + $s_type_switch = /*($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 :*/ 0; + } + unset($topic_datas); + } + $map_desc = false; + $rules_info = array('forum_rules' => false, 'forum_rules_link' => false); + // In case we are listing category's children + if ($master->call['cat_forum']) { + $forum_id = $master->call['cat_forum']; + } + if ($master->call['display_desc']) { + $map_desc = !empty($master->module_config['html_site_desc']) ? $master->module_config['html_site_desc'] : ''; + if ($master->call['single_forum'] || $master->call['cat_forum']) { + $map_desc = $master->generate_forum_info($master->forum_datas[$forum_id]); + } + } + if ($master->call['display_rules'] && ($master->call['single_forum'] || $master->call['cat_forum']) ) { + $rules_info = $master->generate_forum_info($master->forum_datas[$forum_id], 'rules'); + } + $tpl_data = array( + 'H1_TOPICS' => $master->outputs['page_title'], + 'DISPLAY_TOPICS_H1' => $display_link, + 'U_TOPICS' => $display_link ? append_sid($display_file) : false, + 'DISPLAY_TOPICS' => $has_result, + 'DISPLAY_LAST_POST' => $display_last_post, + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'MAP_DESC' => $map_desc, + 'MAP_RULES' => $rules_info['forum_rules'], + 'MAP_RULES_LINK' => $rules_info['forum_rules_link'], + 'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/", + 'NEWS_IMG_SRC' => $master->gym_master->path_config['gym_img_url'] . 'html_news.gif', + ); + if ($master->call['single_forum'] || $master->call['cat_forum']) { + $tpl_data += array( + 'FORUM_NEWS' => sprintf($user->lang['HTML_NEWS_OF'], $master->forum_datas[$forum_id]['forum_name']), + 'FORUM_NEWS_URL' => $master->module_config['html_allow_cat_news'] ? append_sid($master->gym_master->html_build_url('html_forum_cat_news', $phpbb_seo->seo_url['forum'][$forum_id], $forum_id)) : '', + 'FORUM_URL' => $master->forum_datas[$forum_id]['forum_url'], + 'FORUM_NAME' => $master->forum_datas[$forum_id]['forum_name'], + 'S_SINGLE_FORUM' => $master->call['cat_forum'] ? false : true, + ); + } else { + $tpl_data += array( + 'FORUM_NEWS' => sprintf($user->lang['HTML_NEWS_OF'], $master->module_config['html_sitename']), + 'FORUM_NEWS_URL' => $master->module_config['html_allow_news'] ? append_sid($master->module_config['html_url'] . $master->url_settings['html_forum_news']) : '', + 'FORUM_URL' => append_sid("{$phpbb_root_path}index.$phpEx"), + 'FORUM_NAME' => $master->module_config['html_sitename'], + ); + } + $template->assign_vars($tpl_data); + unset($tpl_data); + if ($display_pagination) { + $l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER'; + $template->assign_vars(array( + 'DISPLAY_PAGINATION' => generate_pagination(append_sid($display_file), $total_topics, $limit, $start), + 'DISPLAY_PAGE_NUMBER' => on_page($total_topics, $limit, $start), + 'DISPLAY_TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics), + )); + } + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/docs/COPYING b/phpBB/gym_sitemaps/docs/COPYING new file mode 100644 index 0000000000..4bcc85125b --- /dev/null +++ b/phpBB/gym_sitemaps/docs/COPYING @@ -0,0 +1,65 @@ +GNU LESSER GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. +0. Additional Definitions. + +As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. + +"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. + +An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. + +A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". + +The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. + +The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. +1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. +2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: + + * a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or + * b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. + +3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: + + * a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. + * b) Accompany the object code with a copy of the GNU GPL and this license document. + +4. Combined Works. + +You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: + + * a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. + * b) Accompany the Combined Work with a copy of the GNU GPL and this license document. + * c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. + * d) Do one of the following: + o 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. + o 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. + * e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) + +5. Combined Libraries. + +You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: + + * a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. + * b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. + +6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. diff --git a/phpBB/gym_sitemaps/docs/update_from_last.txt b/phpBB/gym_sitemaps/docs/update_from_last.txt new file mode 100644 index 0000000000..ad49a15afe --- /dev/null +++ b/phpBB/gym_sitemaps/docs/update_from_last.txt @@ -0,0 +1,54 @@ +############################################################## +## MOD Title: phpBB SEO GYM SItemaps & RSS 2.0.1 => 2.0.2 update +## MOD Author: dcz <n/a> http://www.phpbb-seo.com/ +## MOD Description: This are the update steps for the phpBB SEO GYM SItemaps & RSS 2.0.1 => 2.0.2 update. +## Check http://www.phpbb-seo.com/en/gym-sitemaps-rss/google-yahoo-msn-sitemaps-rss-t2734.html +## for the latest version or to get help with this MOD +## +## MOD Version: 1.0 +## +## Installation Level: (Eazy) +## Installation Time: 1 Minute +## Files To Edit: (0) +## +## +## Included Files: n/a +############################################################## +## Author Notes: +## _____________ +## +## This are the update steps for the phpBB3 SEO GYM SItemaps & RSS 2.0.1 => 2.0.2 update. +## +############################################################## +## MOD History: +## +## 2010-11-20 - 1.0 +## - First version released +## +############################################################## +## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD +############################################################## + + +# +#-----[ DIY INSTRUCTIONS ]-------------------------------------------------- +# + +_________________________________________ +>>>> INSTALLATION INSTRUCTIONS <<<<< +_________________________________________ + +To update from all 2.0.x (phpBB3) versions you will have to upload all files in the root/ directory of the archive to your phpBB/ ftp directory, after you will have taken care manually of the eventual code change you would have implemented in the template files (directory phpBB/styles/, .html, .js and .xsl) added by the module. +Once done, just lunch the update script (example.com/phpBB/gym_sitemaps/gym_install.php). +Your settings will be kept during the update process. + +Once you will have updated, you will have to refresh your theme's cache as well as phpBB's cache (ACP => STYLE, Themes => Refresh). + +These code changes are the code changes to implement in the phpBB3 files that are modified when first installing this module. + +NO code changes required for this update. + +# +#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ +# +# EoM diff --git a/phpBB/gym_sitemaps/docs/update_from_lastFR.txt b/phpBB/gym_sitemaps/docs/update_from_lastFR.txt new file mode 100644 index 0000000000..3d39eb46cf --- /dev/null +++ b/phpBB/gym_sitemaps/docs/update_from_lastFR.txt @@ -0,0 +1,54 @@ +############################################################## +## MOD Title: phpBB SEO GYM SItemaps & RSS MAJ 2.0.1 => 2.0.2 +## MOD Author: dcz <n/a> http://www.phpbb-seo.com/ +## MOD Description: Ceci est la procédure de mise à jour du MOD GYM SItemaps & RSS pour la transition version 2.0.1 => 2.0.2 +## Rendez-vous sur http://www.phpbb-seo.com/fr/gym-sitemaps-rss/sitemaps-rss-google-yahoo-msn-t3136.html +## pour toujours obtenir la dernière version ou de l'aide pour ce MOD. +## +## MOD Version: 1.0 +## +## Installation Level: (Eazy) +## Installation Time: 1 Minute +## Files To Edit: (0) +## +## +## Included Files: n/a +############################################################## +## Author Notes: +## _____________ +## +## Voici les instructions de mise à jour : phpBB3 SEO GYM SItemaps & RSS 2.0.1 => 2.0.2 +## +############################################################## +## MOD History: +## +## 2010-11-20 - 1.0 +## - First version released +## +############################################################## +## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD +############################################################## + + +# +#-----[ DIY INSTRUCTIONS ]-------------------------------------------------- +# + +_____________________________________________ +>>>> INSTALLATION POUR VOTRE FORUM <<<<< +_____________________________________________ + +Pour mettre à jour depuis n'importe quelle version 2.0.x (phpBB3), vous devrez tout d'abord uploader tous les fichiers contenus dans le dossier root/ de l'archive dans le dossier ftp de phpBB, en prenant soin de conserver vos éventuelles modification des fichiers de template (dossier phpBB/styles/, .html, .js et .xsl) ajoutés par le module. +Une fois les fichiers en place, lancez simplement le script de mise à jour (example.com/phpBB/gym_sitemaps/gym_install.php). +Vos réglages seront conservés lors de la mise à jour. + +Une fois les nouveaux fichiers en place, il vous faudra vider le cache de phpBB et rafraichir vos thèmes (ACP => STYLE => Thèmes => Rafraichir). + +Les modifications de ce fichier concernent les fichier de phpBB3 qui ont été modifiés lors de l'installation du module. + +Aucune modification requise pour cette mise à jour. + +# +#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ +# +# EoM diff --git a/phpBB/gym_sitemaps/gym_install.php b/phpBB/gym_sitemaps/gym_install.php new file mode 100644 index 0000000000..84e070ec63 --- /dev/null +++ b/phpBB/gym_sitemaps/gym_install.php @@ -0,0 +1,937 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: gym_install.php 271 2010-11-20 20:53:59Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +/* + * Based on the phpBB3 install package / www.phpBB.com + */ +define('IN_PHPBB', true); +define('IN_INSTALL', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +@define('GYM_VERSION', '2.0.2'); +// Try to override some limits - maybe it helps some... +@set_time_limit(0); +$mem_limit = @ini_get('memory_limit'); +if (!empty($mem_limit)) { + $unit = strtolower(substr($mem_limit, -1, 1)); + $mem_limit = (int) $mem_limit; + if ($unit == 'k') { + $mem_limit = floor($mem_limit / 1024); + } else if ($unit == 'g') { + $mem_limit *= 1024; + } else if (is_numeric($unit)) { + $mem_limit = floor((int) ($mem_limit . $unit) / 1048576); + } + $mem_limit = max(128, $mem_limit) . 'M'; +} else { + $mem_limit = '128M'; +} +@ini_set('memory_limit', $mem_limit); +include($phpbb_root_path . 'common.' . $phpEx); +// Include essential scripts +require($phpbb_root_path . 'includes/functions_install.' . $phpEx); +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('gym_sitemaps/install'); +// Security check +// Circumvent a potential phpbb bug with paths +$redirect = append_sid(generate_board_url() . "/gym_sitemaps/gym_install.$phpEx"); +if (!$user->data['is_registered']) { + login_box($redirect, $user->lang['SEO_LOGIN'],'', false, false); +} +if (!$auth->acl_get('a_')) { + $user->session_kill(true); + login_box($redirect, $user->lang['SEO_LOGIN_ADMIN'],'', false, false); +} +if ($user->data['user_type'] != USER_FOUNDER) { + login_box($redirect, $user->lang['SEO_LOGIN_FOUNDER'],'', false, false); +} +$user->add_lang(array('acp/common', 'acp/board', 'install', 'posting', 'acp/modules')); +$mode = request_var('mode', 'overview'); +$sub = request_var('sub', ''); +// Set some standard variables we want to force +$config['load_tplcompile'] = '1'; +$template->set_custom_template('../adm/style', '../admin'); +$template->assign_var('T_TEMPLATE_PATH', '../adm/style'); +// the acp template is never stored in the database +$user->theme['template_storedb'] = false; +// Start the installer +$install = new module(); +$install->create('install', "gym_install.$phpEx", $mode, $sub); +$install->load(); +// Generate the page +$install->page_header(); +$install->generate_navigation(); +$template->set_filenames(array( + 'body' => $install->get_tpl_name()) +); +$install->page_footer(); +/** +* @package install +*/ +class module { + var $id = 0; + var $type = 'install'; + var $module_ary = array(); + var $filename; + var $module_url = ''; + var $tpl_name = ''; + var $mode; + var $sub; + /** + * Private methods, should not be overwritten + */ + function create($module_type, $module_url, $selected_mod = false, $selected_submod = false) { + global $db, $config, $phpEx, $phpbb_root_path, $user; + $module = array( + array( + 'module_type' => 'install', + 'module_title' => 'OVERVIEW', + 'module_filename' => 'overview_gym_sitemaps', + 'module_order' => 0, + 'module_subs' => array('INTRO', 'LICENSE', 'SUPPORT'), + 'module_stages' => '', + 'module_reqs' => '' + ), + array( + 'module_type' => 'install', + 'module_title' => 'INSTALL_GYM_SITEMAPS', + 'module_filename' => 'install_gym_sitemaps', + 'module_order' => 1, + 'module_subs' => '', + 'module_stages' => array('INTRO', 'FINAL'), + 'module_reqs' => '' + ), + array( + 'module_type' => 'uninstall', + 'module_title' => 'UNINSTALL_GYM_SITEMAPS', + 'module_filename' => 'install_gym_sitemaps', + 'module_order' => 2, + 'module_subs' => '', + 'module_stages' => array('INTRO', 'FINAL'), + 'module_reqs' => '' + ), + array( + 'module_type' => 'update', + 'module_title' => 'UPDATE_GYM_SITEMAPS', + 'module_filename' => 'install_gym_sitemaps', + 'module_order' => 3, + 'module_subs' => '', + 'module_stages' => array('INTRO', 'FINAL'), + 'module_reqs' => '' + ), + ); + // Order to use and count further if modules get assigned to the same position or not having an order + $max_module_order = 1000; + foreach ($module as $row) { + // Module order not specified or module already assigned at this position? + if (!isset($row['module_order']) || isset($this->module_ary[$row['module_order']])) { + $row['module_order'] = $max_module_order; + $max_module_order++; + } + $this->module_ary[$row['module_order']]['name'] = $row['module_title']; + $this->module_ary[$row['module_order']]['filename'] = $row['module_filename']; + $this->module_ary[$row['module_order']]['subs'] = $row['module_subs']; + $this->module_ary[$row['module_order']]['stages'] = $row['module_stages']; + if (strtolower($selected_mod) == strtolower($row['module_title'])) { + $this->id = (int) $row['module_order']; + $this->filename = (string) $row['module_filename']; + $this->module_url = (string) $module_url; + $this->mode = (string) $selected_mod; + // Check that the sub-mode specified is valid or set a default if not + if (is_array($row['module_subs'])) { + $this->sub = strtolower((in_array(strtoupper($selected_submod), $row['module_subs'])) ? $selected_submod : $row['module_subs'][0]); + } else if (is_array($row['module_stages'])) { + $this->sub = strtolower((in_array(strtoupper($selected_submod), $row['module_stages'])) ? $selected_submod : $row['module_stages'][0]); + } else { + $this->sub = ''; + } + } + } // END foreach + } // END create + /** + * Load and run the relevant module if applicable + */ + function load($mode = false, $run = true) { + global $phpbb_root_path, $phpEx; + if ($run) { + if (!empty($mode)) { + $this->mode = $mode; + } + $module = $this->filename; + if (!class_exists($module)) { + $this->error('Module "' . htmlspecialchars($module) . '" not accessible.', __LINE__, __FILE__); + } + $this->module = new $module($this); + if (method_exists($this->module, 'main')) { + $this->module->main($this->mode, $this->sub); + } + } + } + /** + * Output the standard page header + */ + function page_header() { + if (defined('HEADER_INC')) { + return; + } + define('HEADER_INC', true); + global $template, $user, $stage, $phpbb_root_path; + $template->assign_vars(array( + 'L_INSTALL_PANEL' => $user->lang['SEO_INSTALL_PANEL'], + 'L_SKIP' => $user->lang['SKIP'], + 'PAGE_TITLE' => $this->get_page_title(), + 'T_IMAGE_PATH' => $phpbb_root_path . 'adm/images/', + 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_USER_LANG' => $user->lang['USER_LANG'], + ) + ); + header('Content-type: text/html; charset=UTF-8'); + header('Cache-Control: private, no-cache="set-cookie"'); + header('Expires: 0'); + header('Pragma: no-cache'); + return; + } + /** + * Output the standard page footer + */ + function page_footer() { + global $db, $template, $phpbb_seo; + $template->display('body'); + // Close our DB connection. + if (!empty($db) && is_object($db)) { + $db->sql_close(); + } + exit; + } + /** + * Returns desired template name + */ + function get_tpl_name() { + return $this->module->tpl_name . '.html'; + } + /** + * Returns the desired page title + */ + function get_page_title() { + global $user; + if (!isset($this->module->page_title)) { + return ''; + } + return (isset($user->lang[$this->module->page_title])) ? $user->lang[$this->module->page_title] : $this->module->page_title; + } + /** + * Generate an HTTP/1.1 header to redirect the user to another page + * This is used during the installation when we do not have a database available to call the normal redirect function + * @param string $page The page to redirect to relative to the installer root path + */ + function redirect($page) { + $server_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'); + $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'); + $secure = (bool) ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] === true)) || (isset($_SERVER['SERVER_PORT']) && (int) $_SERVER['SERVER_PORT'] === 443)); + + $script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF'); + if (!$script_name) { + $script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI'); + } + // Replace backslashes and doubled slashes (could happen on some proxy setups) + $script_name = str_replace(array('\\', '//'), '/', $script_name); + $script_path = trim(dirname($script_name)); + $url = (($secure) ? 'https://' : 'http://') . $server_name; + if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80))) { + $url .= ':' . $server_port; + } + $url .= $script_path . '/' . $page; + header('Location: ' . $url); + exit; + } + /** + * Generate the navigation tabs + */ + function generate_navigation() { + global $user, $template, $phpEx; + if (is_array($this->module_ary)) { + @ksort($this->module_ary); + foreach ($this->module_ary as $cat_ary) { + $cat = $cat_ary['name']; + $l_cat = (!empty($user->lang['CAT_' . $cat])) ? $user->lang['CAT_' . $cat] : preg_replace('#_#', ' ', $cat); + $cat = strtolower($cat); + $url = $this->module_url . "?mode=$cat"; + if ($this->mode == $cat) { + $template->assign_block_vars('t_block1', array( + 'L_TITLE' => $l_cat, + 'S_SELECTED' => true, + 'U_TITLE' => $url, + )); + if (is_array($this->module_ary[$this->id]['subs'])) { + $subs = $this->module_ary[$this->id]['subs']; + foreach ($subs as $option) { + $l_option = (!empty($user->lang['SUB_' . $option])) ? $user->lang['SUB_' . $option] : preg_replace('#_#', ' ', $option); + $option = strtolower($option); + $url = $this->module_url . '?mode=' . $this->mode . "&sub=$option"; + $template->assign_block_vars('l_block1', array( + 'L_TITLE' => $l_option, + 'S_SELECTED' => ($this->sub == $option), + 'U_TITLE' => $url, + )); + } + } + if (is_array($this->module_ary[$this->id]['stages'])) { + $subs = $this->module_ary[$this->id]['stages']; + $matched = false; + foreach ($subs as $option) { + $l_option = (!empty($user->lang['STAGE_' . $option])) ? $user->lang['STAGE_' . $option] : preg_replace('#_#', ' ', $option); + $option = strtolower($option); + $matched = ($this->sub == $option) ? true : $matched; + + $template->assign_block_vars('l_block2', array( + 'L_TITLE' => $l_option, + 'S_SELECTED' => ($this->sub == $option), + 'S_COMPLETE' => !$matched, + )); + } + } + } else { + $template->assign_block_vars('t_block1', array( + 'L_TITLE' => $l_cat, + 'S_SELECTED' => false, + 'U_TITLE' => $url, + )); + } + } + } + } + /** + * Output an error message + * If skip is true, return and continue execution, else exit + */ + function error($error, $line = '', $file = '', $skip = false, $title = '') { + global $user, $db, $template, $phpbb_seo; + $title = !empty($title) ? $title : $user->lang['INST_ERR_FATAL']; + $file = !empty($file) ? basename($file) . ' [ ' . $line . ' ]' : ''; + if ($skip) { + $template->assign_block_vars('checks', array( + 'S_LEGEND' => true, + 'LEGEND' => $user->lang['INST_ERR'], + )); + $template->assign_block_vars('checks', array( + 'TITLE' => basename($file) . ' [ ' . $line . ' ]', + 'RESULT' => '<b style="color:red">' . $error . '</b>', + )); + return; + } + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; + echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">'; + echo '<head>'; + echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'; + echo '<title>' . $title . '</title>'; + echo '<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />'; + echo '</head>'; + echo '<body id="errorpage">'; + echo '<div id="wrap">'; + echo ' <div id="page-header">'; + echo ' </div>'; + echo ' <div id="page-body">'; + echo ' <div id="acp">'; + echo ' <div class="panel">'; + echo ' <span class="corners-top"><span></span></span>'; + echo ' <div id="content">'; + echo ' <h1>' . $title . '</h1>'; + echo ' <p>' . $file . '</p>' . "\n"; + echo ' <p><b>' . $error . "</b></p>\n"; + echo ' </div>'; + echo ' <span class="corners-bottom"><span></span></span>'; + echo ' </div>'; + echo ' </div>'; + echo ' </div>'; + echo ' <div id="page-footer">'; + echo ' Powered by phpBB © 2000, 2002, 2005, 2007, 2008 <a href="http://www.phpbb.com/">phpBB Group</a>'; + echo ' </div>'; + echo '</div>'; + echo '</body>'; + echo '</html>'; + if (!empty($db) && is_object($db)) { + $db->sql_close(); + } + exit; + } + /** + * Output an error message for a database related problem + * If skip is true, return and continue execution, else exit + */ + function db_error($error, $sql, $line, $file, $skip = false) { + global $user, $db, $template; + if ($skip) { + $template->assign_block_vars('checks', array( + 'S_LEGEND' => true, + 'LEGEND' => $user->lang['INST_ERR_FATAL'], + )); + $template->assign_block_vars('checks', array( + 'TITLE' => basename($file) . ' [ ' . $line . ' ]', + 'RESULT' => '<b style="color:red">' . $error . '</b><br />» SQL:' . $sql, + )); + return; + } + $template->set_filenames(array( + 'body' => 'install_error.html') + ); + $this->page_header(); + $this->generate_navigation(); + $template->assign_vars(array( + 'MESSAGE_TITLE' => $user->lang['INST_ERR_FATAL_DB'], + 'MESSAGE_TEXT' => '<p>' . basename($file) . ' [ ' . $line . ' ]</p><p>SQL : ' . $sql . '</p><p><b>' . $error . '</b></p>', + )); + // Rollback if in transaction + if ($db->transaction) { + $db->sql_transaction('rollback'); + } + $this->page_footer(); + } +} +/** +* Installation Tabs +*/ +class install_gym_sitemaps extends module { + var $errors = array(); + var $uninst_prefix = ''; + var $modrtype_lang = array(); + var $action_types = array(); + var $version = '(not set)'; + var $old_config = array(); + var $config_report = array(); + function install_gym_sitemaps(&$p_master) { + global $user, $phpbb_seo, $config, $phpbb_root_path, $phpEx, $_action_types; + $this->p_master = &$p_master; + $this->version = GYM_VERSION; + require_once($phpbb_root_path . 'gym_sitemaps/includes/gym_common.' . $phpEx); + // For Compatibility with the phpBB SEO mod rewrites + if (empty($phpbb_seo)) { + require_once($phpbb_root_path . 'gym_sitemaps/includes/phpbb_seo_class_light.' . $phpEx); + $phpbb_seo = new phpbb_seo(); + define('STARTED_LIGHT', true); + } + $this->action_types = $_action_types; + $this->modrtype_lang = set_phpbb_seo_links(); + } + function main($mode, $sub) { + global $user, $template, $phpbb_root_path, $phpbb_seo, $phpEx, $cache, $db; + switch ($mode) { + case 'install_gym_sitemaps': + $this->uninst_prefix = ''; + break; + case 'update_gym_sitemaps': + obtain_gym_config('main', $this->old_config); + if (!empty($this->old_config)) { + $this->uninst_prefix = 'UPDATE_'; + } else { + $this->p_master->error($user->lang['SEO_ERROR_NOTINSTALLED']. '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->p_master->module_url . '">', '</a>'), '', '', false, $user->lang['SEO_ERROR_INFO']); + exit; + } + break; + case 'uninstall_gym_sitemaps': + $this->uninst_prefix = 'UN_'; + break; + } + switch ($sub) { + case 'intro': + $this->page_title = $user->lang['SUB_INTRO']; + $template->assign_vars(array( + 'TITLE' => $user->lang[$this->uninst_prefix . 'SEO_INSTALL_INTRO'], + 'BODY' => sprintf($user->lang[$this->uninst_prefix . 'SEO_INSTALL_INTRO_BODY'], @$this->modrtype_lang['link'], $this->version), + 'L_SUBMIT' => $user->lang[$this->uninst_prefix . 'SEO_INSTALL'], + 'S_LANG_SELECT' => '', + 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=final", + )); + break; + case 'final': + if ($mode != 'uninstall_gym_sitemaps') { + $update = $mode == 'update_gym_sitemaps' ? true : false; + if(!$update) { + $this->add_modules($mode, $sub); + $this->install_tables($mode); + } + $gym_modules = $gym_modules_acp = array(); + foreach ($this->action_types as $otype) { // List all output types (sitemaps, rss, html, yahoo ...) + $dir = opendir( $phpbb_root_path . 'gym_sitemaps/acp' ); + while( ($file = readdir($dir)) !== FALSE ) { // Look for available mocules + if(preg_match('`^' . $otype . '_([a-z0-9_-]+)\.' . $phpEx . '$`i', $file, $matches)) { + $type_module = trim(str_replace('.' . $phpEx , '' ,$file), "/"); + $_module = str_replace($otype . '_', '', $type_module); + if ($matches[1] === 'main' || (file_exists($phpbb_root_path . 'gym_sitemaps/modules/' . $file) ) ) { + $gym_modules[$otype][$_module] = $type_module; + } + } + } + closedir($dir); + foreach ($gym_modules[$otype] as $_module => $type_module) { // List all available modules + $module_file = $phpbb_root_path . 'gym_sitemaps/acp/' . $type_module . '.' . $phpEx; + + if ( file_exists($module_file) ) { + include_once($module_file); + if (class_exists($type_module)) { + $gym_module = new $type_module($this); + if ( method_exists($gym_module, 'acp_module')) { // Looks like we match + $gym_modules_acp[$otype][$_module] = $gym_module->acp_module(); + foreach ($gym_modules_acp[$otype][$_module]['info']['actions'] as $module_action) { // list the module's options sets + foreach ($gym_modules_acp[$otype][$_module][$module_action]['default'] as $module_config => $default_value ) { // In the end list possible options for this module for this module's options set + if (!isset($this->old_config[$module_config])) { + // Update config + set_gym_config($module_config, $default_value, $otype, $this->old_config); + $this->config_report[] = "SET <b>$module_config</b> to $default_value"; + } + } + } + if (!isset($this->old_config[$type_module . '_installed'])) { + // Set the module as installed + set_gym_config($type_module . '_installed', 1, 'main', $this->old_config); + $this->config_report[] = "ACTIVATED <b>$type_module module</b>"; + } + } + } + } + } + } + } else { + $this->remove_modules($mode, $sub); + $this->install_tables($mode); + } + if (@method_exists($cache, 'purge')) { + $cache->purge(); + } + $this->final_stage($mode, $sub); + break; + } + $this->tpl_name = 'install_install'; + } + /** + * Populate the module tables + */ + function add_modules($mode, $sub) { + global $db, $user, $phpbb_root_path, $phpEx; + include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); + $_module = new acp_modules(); + if ( $this->get_module_id('ACP_GYM_SITEMAPS') > 0 ) { + $url_mod = !empty($sub) ? '?mode=' . $mode : ''; + + $this->p_master->error(sprintf($user->lang['SEO_ERROR_INSTALLED'], $user->lang['ACP_CAT_PHPBB_SEO'] ) . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->p_master->module_url . $url_mod . '">', '</a>'), '', '', false, $user->lang['SEO_ERROR_INFO']); + } + $module_classes = array('acp'); + // Add categories + foreach ($module_classes as $module_class) { + $categories = array(); + // Set the module class + $_module->module_class = $module_class; + foreach ($this->module_categories[$module_class] as $cat_name => $subs) { + $module_data = array( + 'module_basename' => '', + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => 0, + 'module_class' => $module_class, + 'module_langname' => $cat_name, + 'module_mode' => '', + 'module_auth' => '', + ); + if ( $this->get_module_id('ACP_CAT_PHPBB_SEO') < 1 ) { + // Add category + $_module->update_module_data($module_data, true); + } else { + $module_data['module_id'] = $this->check_module_id('ACP_CAT_PHPBB_SEO'); + } + // Check for last sql error happened + if ($db->sql_error_triggered) { + $error = $db->sql_error($db->sql_error_sql); + $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + } + $categories[$cat_name]['id'] = (int) $module_data['module_id']; + $categories[$cat_name]['parent_id'] = 0; + // Create sub-categories... + if (is_array($subs)) { + foreach ($subs as $level2_name) { + $module_data = array( + 'module_basename' => '', + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => (int) $categories[$cat_name]['id'], + 'module_class' => $module_class, + 'module_langname' => $level2_name, + 'module_mode' => '', + 'module_auth' => '', + ); + $_module->update_module_data($module_data, true); + // Check for last sql error happened + if ($db->sql_error_triggered) { + $error = $db->sql_error($db->sql_error_sql); + $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + } + $categories[$level2_name]['id'] = (int) $module_data['module_id']; + $categories[$level2_name]['parent_id'] = (int) $categories[$cat_name]['id']; + } + } + } + // Get the modules we want to add... returned sorted by name + $module_info = $_module->get_module_infos('gym_sitemaps', $module_class); + foreach ($module_info as $module_basename => $fileinfo) { + foreach ($fileinfo['modes'] as $module_mode => $row) { + foreach ($row['cat'] as $cat_name) { + if (!isset($categories[$cat_name])) { + continue; + } + $module_data = array( + 'module_basename' => $module_basename, + 'module_enabled' => 1, + 'module_display' => (isset($row['display'])) ? (int) $row['display'] : 1, + 'parent_id' => (int) $categories[$cat_name]['id'], + 'module_class' => $module_class, + 'module_langname' => $row['title'], + 'module_mode' => $module_mode, + 'module_auth' => $row['auth'], + ); + $_module->update_module_data($module_data, true); + // Check for last sql error happened + if ($db->sql_error_triggered) { + $error = $db->sql_error($db->sql_error_sql); + $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + } + } + } + } + } + } + /** + * remove_modules + */ + function remove_modules($mode, $sub) { + global $db, $user, $phpbb_root_path, $phpEx; + include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); + $_module = new acp_modules(); + // Set the module class + $module_classes = array_keys($this->module_categories); + $_module->u_action = "phpbb_seo_install.$phpEx"; + $cat_module_data = array(); + $module_data = array(); + $delete_module_data = array(); + foreach ($module_classes as $module_class) { + $_module->module_class = $module_class; + foreach ($this->module_categories[$module_class] as $cat_name => $subs) { + // If the cat is already uninstalled break for now + if ( $this->get_module_id($cat_name) < 1 ) { + $url_mod = !empty($this->sub) ? '?mode=' . $this->mode : ''; + $this->p_master->error(sprintf($user->lang['SEO_ERROR_UNINSTALLED'], $user->lang[$cat_name] ). '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->p_master->module_url . $url_mod . '">', '</a>'), '', '', false, $user->lang['SEO_ERROR_INFO']); + } + $cat_module_data[$cat_name] = array( + 'module_id' => $this->check_module_id($cat_name), + 'module_basename' => '', + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => 0, + 'module_class' => $module_class, + 'module_langname' => $cat_name, + 'module_mode' => '', + 'module_auth' => '', + ); + if (is_array($subs)) { + foreach ($subs as $sub_cat) { + $sub_cat_module_data[$sub_cat] = array( + 'module_id' => $this->check_module_id($sub_cat), + 'module_basename' => '', + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => (int) $cat_module_data[$cat_name]['module_id'], + 'module_class' => $module_class, + 'module_langname' => $sub_cat, + 'module_mode' => '', + 'module_auth' => '', + ); + $branch = $_module->get_module_branch($sub_cat_module_data[$sub_cat]['module_id'],'children', 'descending', false); + if (sizeof($branch)) { + foreach ($branch as $module) { + $error = $_module->delete_module($module['module_id']); + if (!sizeof($error)) { + $_module->remove_cache_file(); + $delete_module_data[$module['module_id']] = $module['module_langname'] . ' - id : ' . $module['module_id']; + } else { + $this->errors[] = implode(' ', $error); + } + } // End modules + } + if (!sizeof($this->errors)) { + $error = $_module->delete_module($sub_cat_module_data[$sub_cat]['module_id']); + if (!sizeof($error)) { + $_module->remove_cache_file(); + $delete_module_data[$sub_cat_module_data[$sub_cat]['module_id']] = $sub_cat_module_data[$sub_cat]['module_langname'] . ' - id : ' . $sub_cat_module_data[$sub_cat]['module_id']; + } else { + $this->errors[] = implode(' ', $error); + } + } + } + } // End sub categories + if (!sizeof($this->errors)) { + $branch = $_module->get_module_branch($cat_module_data[$cat_name]['module_id'],'children', 'descending', false); + if (empty($branch)) { + $error = $_module->delete_module($cat_module_data[$cat_name]['module_id']); + } + if (!sizeof($error)) { + $_module->remove_cache_file(); + $delete_module_data[$cat_module_data[$cat_name]['module_id']] = $cat_module_data[$cat_name]['module_langname'] . ' - id : ' . $cat_module_data[$cat_name]['module_id']; + } else { + $this->errors[] = implode(' ', $error); + } + } + } // End categories + } // End classes + return; + } + /** + * install_tables + */ + function install_tables($mode) { + global $db; + if ( $mode === 'install_gym_sitemaps') { + //$sql = "DROP TABLE IF EXISTS " . GYM_CONFIG_TABLE; + //$db->sql_query($sql); + $sql = array(); + switch( $db->sql_layer ) { + case 'oracle': + $sql[] = "CREATE TABLE " . GYM_CONFIG_TABLE . " ( + config_name varchar(255) DEFAULT '', + config_value varchar(255) DEFAULT '', + config_type varchar(10) DEFAULT 'gym' NOT NULL, + CONSTRAINT pk_gym_config PRIMARY KEY (config_name) + )"; + $sql[] = "CREATE INDEX gym_config_type ON " . GYM_CONFIG_TABLE . " (config_type)"; + break; + case 'firebird': + $sql[] = "CREATE TABLE " . GYM_CONFIG_TABLE . " ( + config_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + config_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + config_type VARCHAR(10) DEFAULT 'gym' NOT NULL + )"; + $sql[] = "ALTER TABLE " . GYM_CONFIG_TABLE . " ADD PRIMARY KEY (config_name)"; + $sql[] = "CREATE INDEX gym_config_type ON " . GYM_CONFIG_TABLE . "(config_type)"; + break; + case 'sqlite': + $sql[] = "CREATE TABLE " . GYM_CONFIG_TABLE . " ( + config_name varchar(255) DEFAULT '', + config_value varchar(255) DEFAULT '', + config_type varchar(10) DEFAULT 'gym', + PRIMARY KEY (config_name) + )"; + $sql[] = "CREATE INDEX gym_config_type ON " . GYM_CONFIG_TABLE . " (config_type)"; + break; + case 'postgres': + $sql[] = "CREATE TABLE " . GYM_CONFIG_TABLE . " ( + config_name varchar(255) DEFAULT '' NOT NULL, + config_value varchar(255) DEFAULT '' NOT NULL, + config_type varchar(10) DEFAULT 'gym' NOT NULL, + PRIMARY KEY (config_name) + )"; + $sql[] = "CREATE INDEX gym_config_type ON " . GYM_CONFIG_TABLE . " (config_type)"; + break; + case 'mssql': + case 'mssqlnative': + case 'mssql_odbc': + $sql[] = "CREATE TABLE [" . GYM_CONFIG_TABLE . "] ( + [config_name] [varchar] (255) DEFAULT ('') NOT NULL , + [config_value] [varchar] (255) DEFAULT ('') NOT NULL , + [config_type] [varchar] (10) DEFAULT ('') NOT NULL + ) ON [PRIMARY] "; + $sql[] = "ALTER TABLE [" . GYM_CONFIG_TABLE . "] WITH NOCHECK ADD + CONSTRAINT [PK_gym_config] PRIMARY KEY CLUSTERED + ( + [config_name] + ) ON [PRIMARY] "; + $sql[] = "CREATE INDEX [config_type] ON [" . GYM_CONFIG_TABLE . "]([config_type]) ON [PRIMARY] "; + break; + case 'mysql': + case 'mysql4': + case 'mysqli': + default: + $sqlt = "CREATE TABLE " . GYM_CONFIG_TABLE . " ( + config_name varchar(255) DEFAULT '' NOT NULL, + config_value varchar(255) DEFAULT '' NOT NULL, + config_type varchar(10) DEFAULT 'gym' NOT NULL, + PRIMARY KEY (config_name), + KEY config_type (config_type) + )"; + if ($db->sql_layer == 'mysqli' || version_compare($db->sql_server_info(true), '4.1.3', '>=')) { + $sqlt .= ' CHARACTER SET `utf8` COLLATE `utf8_bin`'; + } + $sql[] = $sqlt; + break; + } + foreach ($sql as $query ) { + $db->sql_query($query); + } + } else { + $sql = "DROP TABLE IF EXISTS " . GYM_CONFIG_TABLE; + $db->sql_query($sql); + } + } + /** + * check_module_id by title + */ + function check_module_id($title) { + global $user; + if ( $module_id = $this->get_module_id($title)) { + return $module_id; + } else { + $url_mod = !empty($this->sub) ? '?mode=' . $this->mode : ''; + $this->p_master->error(sprintf($user->lang['SEO_ERROR_ID'], $title ) . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->p_master->module_url . $url_mod . '">', '</a>'), '', '', false, $user->lang['SEO_ERROR_INFO']); + } + } + /** + * get_module_id by title + */ + function get_module_id($title) { + global $db, $user, $phpEx; + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $db->sql_escape($title) . "'"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + if ($row['module_id'] > 1) { + return intval($row['module_id']); + } + return 0; + } + /** + * Sends an email to the board administrator with their password and some useful links + */ + function final_stage($mode, $sub) { + global $auth, $config, $db, $user, $template, $user, $phpbb_root_path, $phpEx, $phpbb_seo, $cache; + $update_info = ''; + if (!sizeof($this->errors) ) { + if ($mode != 'uninstall_gym_sitemaps') { + set_gym_config('gym_version', $this->version, 'main', $this->old_config); + $this->config_report[] = "SET <b>gym_version</b> to $this->version"; + set_config('gym_installed', 1); + } else { + set_config('gym_installed', 0); + } + add_log('admin', 'SEO_LOG_' . strtoupper($mode), $this->version ); + } else { + set_config('gym_installed', 0); + add_log('admin', 'SEO_LOG_' . strtoupper($mode) . '_FAIL', $this->errors); + $cache->purge(); + $this->p_master->error($user->lang['SEO_ERROR_INSTALL'] . '<br/><pre>' . implode('<br/>', $this->errors) . '</pre>', __LINE__, __FILE__); + } + $cache->purge(); + $this->page_title = $user->lang['STAGE_FINAL']; + if ( $mode != 'uninstall_gym_sitemaps' ) { + if ($mode == 'update_gym_sitemaps') { + $key = 'UPDATE'; + $lang_key = strpos($user->lang_name, 'fr') !== false ? 'FR' : ''; + if ($update_infos = @file("./docs/update_from_last$lang_key.txt")) { + foreach ($update_infos as $line) { + $line = str_replace(array("\r", "\n"), '', utf8_htmlspecialchars(is_utf8($line) ? $line : utf8_recode($line, 'iso-8859-1'))); + $update_info .= (preg_match('`^#`', $line) ? "<b style=\"color:blue;\">$line</b>" : $line) . '<br/>'; + } + } + } else { + $key = 'INSTALL'; + } + $submit_action = append_sid($phpbb_root_path . 'adm/index.' . $phpEx . '?sid=' . $user->session_id); + $title = $user->lang['SEO_INSTALL_CONGRATS']; + $body = sprintf($user->lang["SEO_{$key}_CONGRATS_EXPLAIN"], $this->modrtype_lang['link'], $this->version) . '<br/>' . implode('<br/>', $this->config_report) . "<br/><br/><hr/><pre>$update_info</pre>"; + } else { + $submit_action = append_sid($phpbb_root_path . 'index.' . $phpEx); + $title = $user->lang['UN_SEO_INSTALL_CONGRATS']; + $body = sprintf($user->lang['UN_SEO_INSTALL_CONGRATS_EXPLAIN'], $this->modrtype_lang['link'], $this->version); + } + $template->assign_vars(array( + 'TITLE' => $title, + 'BODY' => $body, + 'L_SUBMIT' => $user->lang['SEO_FINAL_' . strtoupper($mode)], + 'U_ACTION' => $submit_action, + )); + } + var $module_categories = array( + 'acp' => array( + 'ACP_CAT_PHPBB_SEO' => array( + 'ACP_GYM_SITEMAPS', + ), + ), + ); +} +/** +* is_utf8($string) +* Borrowed from php.net : http://www.php.net/mb_detect_encoding (detectUTF8) +*/ +function is_utf8($string) { + // non-overlong 2-byte|excluding overlongs|straight 3-byte|excluding surrogates|planes 1-3|planes 4-15|plane 16 + return preg_match('%(?:[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF] |\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+%xs', $string); +} +function set_phpbb_seo_links() { + global $user, $config; + $modinfo_lang = array(); + $modinfo_lang['title'] = $user->lang['CAT_SEO_PREMOD']; + $modinfo_lang['modlinks_en'] = 'http://www.phpbb-seo.com/en/gym-sitemaps-rss/google-yahoo-msn-sitemaps-rss-t2734.html'; + $modinfo_lang['modlinks_fr'] = 'http://www.phpbb-seo.com/fr/gym-sitemaps-rss/sitemaps-rss-google-yahoo-msn-t3136.html'; + $modinfo_lang['modforumlinks_en'] = 'http://www.phpbb-seo.com/en/gym-sitemaps-rss/'; + $modinfo_lang['modforumlinks_fr'] = 'http://www.phpbb-seo.com/fr/gym-sitemaps-rss/'; + if (strpos($config['default_lang'], 'fr') !== false ) { + $modinfo_lang['linkurl'] = $modinfo_lang['modlinks_fr']; + $modinfo_lang['link'] = '<a href="' . $modinfo_lang['modlinks_fr'] . '" title="' . $modinfo_lang['title'] . '" target="_phpBBSEO"><b>' . $modinfo_lang['title'] . '</b></a>'; + $modinfo_lang['forumlinkurl'] = $modinfo_lang['modforumlinks_fr']; + } else { + $modinfo_lang['linkurl'] = $modinfo_lang['modlinks_en']; + $modinfo_lang['link'] = '<a href="' . $modinfo_lang['modlinks_en'] . '" title="' . $modinfo_lang['title'] . '" target="_phpBBSEO"><b>' . $modinfo_lang['title'] . '</b></a>'; + $modinfo_lang['forumlinkurl'] = $modinfo_lang['modforumlinks_en']; + } + return $modinfo_lang; +} +/** +* Main Tab - Overview +*/ +class overview_gym_sitemaps extends module { + var $modrtype_lang = array(); + var $version = '(not set)'; + function overview_gym_sitemaps(&$p_master) { + $this->modrtype_lang = set_phpbb_seo_links(); + $this->p_master = &$p_master; + $this->version = GYM_VERSION; + } + function main($mode, $sub) { + global $lang, $template, $language, $user, $phpbb_seo; + switch ($sub) { + case 'intro' : + $title = $user->lang['SEO_OVERVIEW_TITLE']; + $body = sprintf($user->lang['SEO_OVERVIEW_BODY'], $this->version, @$this->modrtype_lang['linkurl'], @$this->modrtype_lang['forumlinkurl']); + break; + case 'license' : + $title = $user->lang['SEO_LICENCE_TITLE']; + $body = '<p>' . $user->lang['SEO_LICENCE_BODY'] . '</p><br/><hr/>' . implode("<br/>\n", file('./docs/COPYING')); + break; + case 'support' : + $title = $user->lang['SEO_SUPPORT_TITLE']; + $body = sprintf($user->lang['SEO_SUPPORT_BODY'],$this->modrtype_lang['forumlinkurl'], $this->modrtype_lang['title'], @$this->modrtype_lang['linkurl'] ); + break; + } + $this->tpl_name = 'install_main'; + $this->page_title = $title; + $template->assign_vars(array( + 'TITLE' => $title, + 'BODY' => $body, + + 'S_LANG_SELECT' => '', + )); + } +} +/** +* Quick fix for using the module class outside ACP. +*/ +function adm_back_link($u_action) { + global $user, $install; + $url_mod = !empty($install->sub) ? '?mode=' . $install->mode : ''; + return '<br /><br /><a href="' . $install->module_url . $url_mod . '">« ' . $user->lang['BACK_TO_PREV'] . '</a>'; +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/gym_style.php b/phpBB/gym_sitemaps/gym_style.php new file mode 100644 index 0000000000..261661b8fc --- /dev/null +++ b/phpBB/gym_sitemaps/gym_style.php @@ -0,0 +1,286 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: gym_style.php 278 2010-11-25 15:28:16Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ + + +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +$gym_cache_path = $phpbb_root_path . 'gym_sitemaps/cache/'; + +// Report all errors, except notices and deprecation messages +if (!defined('E_DEPRECATED')) +{ + define('E_DEPRECATED', 8192); +} +error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED); + +if (version_compare(PHP_VERSION, '6.0.0-dev', '<')) { + @set_magic_quotes_runtime(0); +} +// Load Extensions +if (!empty($load_extensions) && function_exists('dl')) { + $load_extensions = explode(',', $load_extensions); + foreach ($load_extensions as $extension) { + @dl(trim($extension)); + } +} +// Option, strip the white spaces in the output, saves a bit of bandwidth. +$strip_spaces = true; +// Option, grabb phpBB stylesheet if using prosilver, will adapt the styling +$load_phpbb_css = false; +// Will automatically update the cache in case the original files are modified. +// Rss or google output +$action_expected = array('rss', 'google'); +// CSS or XSLT stylsheet +$type_expected = array('css', 'xsl'); + +// Language +$language = (isset($_GET['lang']) && !is_array($_GET['lang'])) ? htmlspecialchars(basename((string) $_GET['lang'])) : ''; +$action = isset($_GET['action']) && @in_array($_GET['action'], $action_expected) ? trim($_GET['action']) : ''; +$gym_style_type = isset($_GET['type']) && @in_array($_GET['type'], $type_expected) ? $_GET['type'] : ''; +$theme_id = isset($_GET['theme_id']) ? @intval($_GET['theme_id']) : ''; + +if (empty($language) && empty($action) && empty($gym_style_type) && empty($theme_id)) { + // grabb vars like this because browser are not aggreeing on how to handle & in xml. FF only accpet & where IE and opera only accept & + $qs = isset($_SERVER['QUERY_STRING']) ? trim($_SERVER['QUERY_STRING']) : ''; + if ($qs && preg_match('`action-(rss|google),type-(xsl),lang-([a-z_]+),theme_id-([0-9]+)`i', $qs, $matches )) { + $language = $matches[3]; + $action = in_array($matches[1], $action_expected) ? $matches[1] : ''; + $gym_style_type = in_array($matches[2], $type_expected) ? $matches[2] : ''; + $theme_id = intval($matches[4]); + } +} +$content_type = $gym_style_type == 'css' ? 'text/css' : 'text/xml'; +// Expire time of 15 days if not recached +$cache_ttl = 15*86400; +$recache = false; +$theme = false; +// Let's go +if (!empty($action) && !empty($gym_style_type) && !empty($language) && !empty($theme_id)) { + // detect ssl + $ssl_requested = (bool) ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] === true)) || (isset($_SERVER['SERVER_PORT']) && (int) $_SERVER['SERVER_PORT'] === 443)); + $ssl_bit = $ssl_requested ? 'ssl_' : ''; + // build cache file name + $cached_file = "{$gym_cache_path}style_{$action}_{$ssl_bit}{$language}_$theme_id.$gym_style_type"; + if (file_exists($cached_file)) { + $cached_time = filemtime($cached_file); + $expire_time = $cached_time + $cache_ttl; + $recache = $expire_time < time() ? true : /*(filemtime($style_file) > $cached_time ? true :*/ false/*)*/; + } else { + $recache = true; + $expire_time = time() + $cache_ttl; + } + if (!$recache) { + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', $expire_time)); + header('Content-type: ' . $content_type . '; charset=UTF-8'); + readfile($cached_file); + // We are done with this call + exit; + } else { + // Include files + require($phpbb_root_path . 'config.' . $phpEx); + if (empty($acm_type) || empty($dbms)) { + exit; + } + require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx); + require($phpbb_root_path . 'includes/cache.' . $phpEx); + require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); + require($phpbb_root_path . 'includes/constants.' . $phpEx); + require_once($phpbb_root_path . 'gym_sitemaps/includes/gym_common.' . $phpEx); + $db = new $sql_db(); + $cache = new cache(); + // Connect to DB + if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false)) { + exit; + } + unset($dbhost, $dbuser, $dbpasswd, $dbname, $dbport); + $config = $cache->obtain_config(); + $gym_config = array(); + obtain_gym_config($action, $gym_config); + // Do we load phpbb css ? + $load_phpbb_css = isset($gym_config[$action . '_load_phpbb_css']) ? $gym_config[$action . '_load_phpbb_css'] : $load_phpbb_css; + + // Check if requested style does exists + if ($theme_id > 0) { + $sql = 'SELECT s.style_id, c.theme_path, c.theme_name, t.template_path + FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c + WHERE s.style_id = ' . $theme_id . ' + AND t.template_id = s.template_id + AND c.theme_id = s.theme_id'; + $result = $db->sql_query($sql, 300); + $theme = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + // Grabb the default one data instead + if (!$theme) { + // grabb the first available one + $theme_id = (int) $config['default_style']; + $sql = 'SELECT s.style_id, c.theme_path, c.theme_name, t.template_path + FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c + WHERE s.style_id = ' . $theme_id . ' + AND t.template_id = s.template_id + AND c.theme_id = s.theme_id'; + $result = $db->sql_query($sql, 300); + $theme = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + $db->sql_close(); + if (!empty($cache)) { + $cache->unload(); + } + // Determine style file name + $tpath = $gym_style_type == 'xsl' ? $theme['template_path'] . '/template/gym_sitemaps' : $theme['theme_path'] . '/theme'; + $style_file = $phpbb_root_path . "styles/$tpath/gym_{$action}.$gym_style_type"; + if (!file_exists($style_file)) { + // Degrade to default styling + $style_file = $phpbb_root_path . "gym_sitemaps/style/gym_{$action}.$gym_style_type"; + $load_phpbb_css = false; + } + // Load the language file + if (file_exists($phpbb_root_path . 'language/' . $language . '/gym_sitemaps/gym_common.' . $phpEx)) { + require($phpbb_root_path . 'language/' . $language . '/gym_sitemaps/gym_common.' . $phpEx); + require($phpbb_root_path . 'language/' . $language . '/common.' . $phpEx); + } else { // Try with the default language + $language = $config['default_lang']; + require($phpbb_root_path . 'language/' . $language . '/gym_sitemaps/gym_common.' . $phpEx); + require($phpbb_root_path . 'language/' . $language . '/common.' . $phpEx); + } + // Do not recache if up to date, recompile only if the source stylesheet was updated + $cached_file = "{$gym_cache_path}style_{$action}_{$ssl_bit}{$language}_$theme_id.$gym_style_type"; + if (file_exists($cached_file)) { + $cached_time = filemtime($cached_file); + $expire_time = $cached_time + $cache_ttl; + $recache = $expire_time < time() ? true : (@filemtime($style_file) > $cached_time ? true : false); + } else { + $recache = true; + $expire_time = time() + $cache_ttl; + } + if (!$recache) { + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', $expire_time)); + header('Content-type: ' . $content_type . '; charset=UTF-8'); + readfile($cached_file); + exit; + } + // No available style + if (!$theme) { + exit; + } + + + // Path Settings + $ssl_forced = (bool) (($config['server_protocol'] === 'https//')); + $ssl_use = (bool) ($ssl_requested || $ssl_forced); + $server_protocol = $ssl_use ? 'https://' : 'http://'; + $server_name = trim($config['server_name'], '/ '); + $server_port = max(0, (int) $config['server_port']); + $server_port = ($server_port && $server_port <> 80) ? ':' . $server_port . '/' : '/'; + $script_path = trim($config['script_path'], '/ '); + $script_path = (empty($script_path) ) ? '' : $script_path . '/'; + $root_url = strtolower($server_protocol . $server_name . $server_port); + // First grabb the online style + $phpbb_url = $root_url . $script_path; + // Parse Theme Data + $replace = array( + '{T_IMAGE_PATH}' => "{$phpbb_url}gym_sitemaps/images/", + '{T_STYLE_PATH}' => "{$phpbb_url}gym_sitemaps/style/", + '{S_CONTENT_DIRECTION}' => $lang['DIRECTION'], + '{S_USER_LANG}' => $language + ); + if ($gym_style_type == 'xsl') { + $replace = array_merge($replace, array( + '{T_CSS_PATH}' => "{$phpbb_url}gym_sitemaps/gym_style.$phpEx?action=$action&type=css&lang={$language}&theme_id={$theme_id}", + '{L_HOME}' => $lang['GYM_HOME'], + '{L_FORUM_INDEX}' => $lang['GYM_FORUM_INDEX'], + '{L_LINK}' => $lang['GYM_LINK'], + '{L_LASTMOD_DATE}' => $lang['GYM_LASTMOD_DATE'], + '{ROOT_URL}' => $root_url, + '{HTTP_PROTO_REQUEST}' => $server_protocol, + '{PHPBB_URL}' => $phpbb_url, + // Do not remove ! + '{L_COPY}' => '<a href="http://www.phpbb-seo.com/" title="GYM Sitemaps & RSS © 2006, ' . date('Y') . ' phpBB SEO" class="copyright"><img src="' . $phpbb_url . 'gym_sitemaps/images/phpbb-seo.png" alt="' . $lang['GYM_SEO'] . '"/></a>', + '{L_SEARCH_ADV_EXPLAIN}' => $lang['SEARCH_ADV_EXPLAIN'], + '{L_CHANGE_FONT_SIZE}' => $lang['CHANGE_FONT_SIZE'], + '{L_SEARCH_ADV}' => $lang['SEARCH_ADV'], + '{L_SEARCH}' => $lang['SEARCH'], + '{L_BACK_TO_TOP}' => $lang['BACK_TO_TOP'], + '{L_FAQ}' => $lang['FAQ'], + '{L_FAQ_EXPLAIN}' => $lang['FAQ_EXPLAIN'], + '{L_REGISTER}' => $lang['REGISTER'], + '{L_SKIP}' => $lang['SKIP'], + '{L_BOOKMARK_THIS}' => $lang['GYM_BOOKMARK_THIS'], + '{SITENAME}' => htmlspecialchars($config['sitename']), + '{SITE_DESCRIPTION}' => $config['site_desc'], + + )); + if ($action == 'google') { + $replace = array_merge($replace, array( + '{L_SITEMAP}' => $lang['GOOGLE_SITEMAP'], + '{L_SITEMAP_OF}' => $lang['GOOGLE_SITEMAP_OF'], + '{L_SITEMAPINDEX}' => $lang['GOOGLE_SITEMAPINDEX'], + '{L_NUMBER_OF_SITEMAP}' => $lang['GOOGLE_NUMBER_OF_SITEMAP'], + '{L_SITEMAP_URL}' => $lang['GOOGLE_SITEMAP_URL'], + '{L_NUMBER_OF_URL}' => $lang['GOOGLE_NUMBER_OF_URL'], + '{L_CHANGEFREQ}' => $lang['GOOGLE_CHANGEFREQ'], + '{L_PRIORITY}' => $lang['GOOGLE_PRIORITY'], + )); + } elseif ($action == 'rss') { + $replace = array_merge($replace, array( + '{L_UPDATE}' => $lang['RSS_UPDATE'], + '{L_LAST_UPDATE}' => $lang['RSS_LAST_UPDATE'], + '{L_MINUTES}' => $lang['GYM_MINUTES'], + '{L_SOURCE}' => $lang['GYM_SOURCE'], + '{L_SUBSCRIBE_POD}' => $lang['RSS_SUBSCRIBE_POD'], + '{L_SUBSCRIBE}' => $lang['RSS_SUBSCRIBE'], + '{L_2_LINK}' => $lang['RSS_2_LINK'], + '{L_FEED}' => $lang['RSS_FEED'], + '{L_ITEM_LISTED}' => $lang['RSS_ITEM_LISTED'], + '{L_ITEMS_LISTED}' => $lang['RSS_ITEMS_LISTED'], + '{L_RSS_VALID}' => $lang['RSS_VALID'], + )); + } + } + // Load the required stylsheet template + if ( $load_phpbb_css && $gym_style_type == 'css' ) { + @ini_set('user_agent','GYM Sitemaps & RSS / www.phpBB-SEO.com'); + @ini_set('default_socket_timeout', 10); + $phpbb_css = @file_get_contents("{$phpbb_url}style.php?id={$theme_id}&lang={$language}"); + if ($phpbb_css) { + $output = str_replace('./styles/', "{$phpbb_url}styles/", $phpbb_css); + } else { + $style_tpl = @file_get_contents($style_file); + $output = str_replace(array_keys($replace), array_values($replace), $style_tpl); + } + unset($phpbb_css); + } else { + $style_tpl = @file_get_contents($style_file); + $output = str_replace(array_keys($replace), array_map('numeric_entify_utf8', array_values($replace)), $style_tpl); + } + if ($strip_spaces) { + if ($gym_style_type === 'xsl') { + $output = preg_replace(array('`<\!--.*-->`Us', '`[\s]+`'), ' ', $output); + } else { + $output = preg_replace(array('`/\*.*\*/`Us', '`[\s]+`'), ' ', $output); + } + } + $handle = @fopen($cached_file, 'wb'); + @flock($handle, LOCK_EX); + @fwrite($handle, $output); + @flock($handle, LOCK_UN); + @fclose ($handle); + @chmod($cached_file, 0666); + + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', $expire_time)); + header('Content-type: ' . $content_type . '; charset=UTF-8'); + echo $output; + exit; + } +} +exit; +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/images/MyMSN.gif b/phpBB/gym_sitemaps/images/MyMSN.gif Binary files differnew file mode 100644 index 0000000000..36d8fb6e39 --- /dev/null +++ b/phpBB/gym_sitemaps/images/MyMSN.gif diff --git a/phpBB/gym_sitemaps/images/add2netvibes.gif b/phpBB/gym_sitemaps/images/add2netvibes.gif Binary files differnew file mode 100644 index 0000000000..61595860f3 --- /dev/null +++ b/phpBB/gym_sitemaps/images/add2netvibes.gif diff --git a/phpBB/gym_sitemaps/images/addGoogle.gif b/phpBB/gym_sitemaps/images/addGoogle.gif Binary files differnew file mode 100644 index 0000000000..f4ca726997 --- /dev/null +++ b/phpBB/gym_sitemaps/images/addGoogle.gif diff --git a/phpBB/gym_sitemaps/images/addthis.gif b/phpBB/gym_sitemaps/images/addthis.gif Binary files differnew file mode 100644 index 0000000000..016baf3edc --- /dev/null +++ b/phpBB/gym_sitemaps/images/addthis.gif diff --git a/phpBB/gym_sitemaps/images/addtomyyahoo.gif b/phpBB/gym_sitemaps/images/addtomyyahoo.gif Binary files differnew file mode 100644 index 0000000000..b6f80471db --- /dev/null +++ b/phpBB/gym_sitemaps/images/addtomyyahoo.gif diff --git a/phpBB/gym_sitemaps/images/arrow_down.gif b/phpBB/gym_sitemaps/images/arrow_down.gif Binary files differnew file mode 100644 index 0000000000..e45c365ecc --- /dev/null +++ b/phpBB/gym_sitemaps/images/arrow_down.gif diff --git a/phpBB/gym_sitemaps/images/arrow_left.gif b/phpBB/gym_sitemaps/images/arrow_left.gif Binary files differnew file mode 100644 index 0000000000..076a5596f1 --- /dev/null +++ b/phpBB/gym_sitemaps/images/arrow_left.gif diff --git a/phpBB/gym_sitemaps/images/arrow_right.gif b/phpBB/gym_sitemaps/images/arrow_right.gif Binary files differnew file mode 100644 index 0000000000..c5827a401f --- /dev/null +++ b/phpBB/gym_sitemaps/images/arrow_right.gif diff --git a/phpBB/gym_sitemaps/images/arrow_up.gif b/phpBB/gym_sitemaps/images/arrow_up.gif Binary files differnew file mode 100644 index 0000000000..38b5a62c17 --- /dev/null +++ b/phpBB/gym_sitemaps/images/arrow_up.gif diff --git a/phpBB/gym_sitemaps/images/bg_body.gif b/phpBB/gym_sitemaps/images/bg_body.gif Binary files differnew file mode 100644 index 0000000000..e3803a51fd --- /dev/null +++ b/phpBB/gym_sitemaps/images/bg_body.gif diff --git a/phpBB/gym_sitemaps/images/bg_button.gif b/phpBB/gym_sitemaps/images/bg_button.gif Binary files differnew file mode 100644 index 0000000000..03172ff5c6 --- /dev/null +++ b/phpBB/gym_sitemaps/images/bg_button.gif diff --git a/phpBB/gym_sitemaps/images/bg_footers.gif b/phpBB/gym_sitemaps/images/bg_footers.gif Binary files differnew file mode 100644 index 0000000000..be998899a0 --- /dev/null +++ b/phpBB/gym_sitemaps/images/bg_footers.gif diff --git a/phpBB/gym_sitemaps/images/bg_header.gif b/phpBB/gym_sitemaps/images/bg_header.gif Binary files differnew file mode 100644 index 0000000000..351de9f46a --- /dev/null +++ b/phpBB/gym_sitemaps/images/bg_header.gif diff --git a/phpBB/gym_sitemaps/images/bg_headers.gif b/phpBB/gym_sitemaps/images/bg_headers.gif Binary files differnew file mode 100644 index 0000000000..c2dece8ac5 --- /dev/null +++ b/phpBB/gym_sitemaps/images/bg_headers.gif diff --git a/phpBB/gym_sitemaps/images/bg_list.gif b/phpBB/gym_sitemaps/images/bg_list.gif Binary files differnew file mode 100644 index 0000000000..89f8963fde --- /dev/null +++ b/phpBB/gym_sitemaps/images/bg_list.gif diff --git a/phpBB/gym_sitemaps/images/corners_left.png b/phpBB/gym_sitemaps/images/corners_left.png Binary files differnew file mode 100644 index 0000000000..256bde3daa --- /dev/null +++ b/phpBB/gym_sitemaps/images/corners_left.png diff --git a/phpBB/gym_sitemaps/images/corners_right.png b/phpBB/gym_sitemaps/images/corners_right.png Binary files differnew file mode 100644 index 0000000000..df41823b4c --- /dev/null +++ b/phpBB/gym_sitemaps/images/corners_right.png diff --git a/phpBB/gym_sitemaps/images/digg.png b/phpBB/gym_sitemaps/images/digg.png Binary files differnew file mode 100644 index 0000000000..5f112a0507 --- /dev/null +++ b/phpBB/gym_sitemaps/images/digg.png diff --git a/phpBB/gym_sitemaps/images/feed-icon.png b/phpBB/gym_sitemaps/images/feed-icon.png Binary files differnew file mode 100644 index 0000000000..b3c949d224 --- /dev/null +++ b/phpBB/gym_sitemaps/images/feed-icon.png diff --git a/phpBB/gym_sitemaps/images/forum_read.gif b/phpBB/gym_sitemaps/images/forum_read.gif Binary files differnew file mode 100644 index 0000000000..82ceee0784 --- /dev/null +++ b/phpBB/gym_sitemaps/images/forum_read.gif diff --git a/phpBB/gym_sitemaps/images/fuzz.png b/phpBB/gym_sitemaps/images/fuzz.png Binary files differnew file mode 100644 index 0000000000..6b70175ca1 --- /dev/null +++ b/phpBB/gym_sitemaps/images/fuzz.png diff --git a/phpBB/gym_sitemaps/images/gradient.gif b/phpBB/gym_sitemaps/images/gradient.gif Binary files differnew file mode 100644 index 0000000000..21dc11f13b --- /dev/null +++ b/phpBB/gym_sitemaps/images/gradient.gif diff --git a/phpBB/gym_sitemaps/images/html_news.gif b/phpBB/gym_sitemaps/images/html_news.gif Binary files differnew file mode 100644 index 0000000000..fa41fc3ff9 --- /dev/null +++ b/phpBB/gym_sitemaps/images/html_news.gif diff --git a/phpBB/gym_sitemaps/images/icon_back_top.gif b/phpBB/gym_sitemaps/images/icon_back_top.gif Binary files differnew file mode 100644 index 0000000000..4d2b8f3822 --- /dev/null +++ b/phpBB/gym_sitemaps/images/icon_back_top.gif diff --git a/phpBB/gym_sitemaps/images/icon_faq.gif b/phpBB/gym_sitemaps/images/icon_faq.gif Binary files differnew file mode 100644 index 0000000000..4e26460629 --- /dev/null +++ b/phpBB/gym_sitemaps/images/icon_faq.gif diff --git a/phpBB/gym_sitemaps/images/icon_fontsize.gif b/phpBB/gym_sitemaps/images/icon_fontsize.gif Binary files differnew file mode 100644 index 0000000000..1c7d83527c --- /dev/null +++ b/phpBB/gym_sitemaps/images/icon_fontsize.gif diff --git a/phpBB/gym_sitemaps/images/icon_home.gif b/phpBB/gym_sitemaps/images/icon_home.gif Binary files differnew file mode 100644 index 0000000000..8ae9004534 --- /dev/null +++ b/phpBB/gym_sitemaps/images/icon_home.gif diff --git a/phpBB/gym_sitemaps/images/icon_print.gif b/phpBB/gym_sitemaps/images/icon_print.gif Binary files differnew file mode 100644 index 0000000000..a71dfdde70 --- /dev/null +++ b/phpBB/gym_sitemaps/images/icon_print.gif diff --git a/phpBB/gym_sitemaps/images/icon_register.gif b/phpBB/gym_sitemaps/images/icon_register.gif Binary files differnew file mode 100644 index 0000000000..9ecf126c4f --- /dev/null +++ b/phpBB/gym_sitemaps/images/icon_register.gif diff --git a/phpBB/gym_sitemaps/images/icon_textbox_search.gif b/phpBB/gym_sitemaps/images/icon_textbox_search.gif Binary files differnew file mode 100644 index 0000000000..b3b51d8425 --- /dev/null +++ b/phpBB/gym_sitemaps/images/icon_textbox_search.gif diff --git a/phpBB/gym_sitemaps/images/logo.gif b/phpBB/gym_sitemaps/images/logo.gif Binary files differnew file mode 100644 index 0000000000..18aa0aa350 --- /dev/null +++ b/phpBB/gym_sitemaps/images/logo.gif diff --git a/phpBB/gym_sitemaps/images/logo_phpBB.gif b/phpBB/gym_sitemaps/images/logo_phpBB.gif Binary files differnew file mode 100644 index 0000000000..18aa0aa350 --- /dev/null +++ b/phpBB/gym_sitemaps/images/logo_phpBB.gif diff --git a/phpBB/gym_sitemaps/images/maps-icon.gif b/phpBB/gym_sitemaps/images/maps-icon.gif Binary files differnew file mode 100644 index 0000000000..8a62e05ea2 --- /dev/null +++ b/phpBB/gym_sitemaps/images/maps-icon.gif diff --git a/phpBB/gym_sitemaps/images/myaol.gif b/phpBB/gym_sitemaps/images/myaol.gif Binary files differnew file mode 100644 index 0000000000..447606bc02 --- /dev/null +++ b/phpBB/gym_sitemaps/images/myaol.gif diff --git a/phpBB/gym_sitemaps/images/newsgator.gif b/phpBB/gym_sitemaps/images/newsgator.gif Binary files differnew file mode 100644 index 0000000000..6d9bdef64b --- /dev/null +++ b/phpBB/gym_sitemaps/images/newsgator.gif diff --git a/phpBB/gym_sitemaps/images/nuouz.png b/phpBB/gym_sitemaps/images/nuouz.png Binary files differnew file mode 100644 index 0000000000..b6dd46d475 --- /dev/null +++ b/phpBB/gym_sitemaps/images/nuouz.png diff --git a/phpBB/gym_sitemaps/images/pageflakes.gif b/phpBB/gym_sitemaps/images/pageflakes.gif Binary files differnew file mode 100644 index 0000000000..5603d1ed85 --- /dev/null +++ b/phpBB/gym_sitemaps/images/pageflakes.gif diff --git a/phpBB/gym_sitemaps/images/phpbb-seo.png b/phpBB/gym_sitemaps/images/phpbb-seo.png Binary files differnew file mode 100644 index 0000000000..2aaf19a372 --- /dev/null +++ b/phpBB/gym_sitemaps/images/phpbb-seo.png diff --git a/phpBB/gym_sitemaps/images/quote.gif b/phpBB/gym_sitemaps/images/quote.gif Binary files differnew file mode 100644 index 0000000000..d1992273e6 --- /dev/null +++ b/phpBB/gym_sitemaps/images/quote.gif diff --git a/phpBB/gym_sitemaps/images/reddit.png b/phpBB/gym_sitemaps/images/reddit.png Binary files differnew file mode 100644 index 0000000000..9b67b8d841 --- /dev/null +++ b/phpBB/gym_sitemaps/images/reddit.png diff --git a/phpBB/gym_sitemaps/images/rss-valid.gif b/phpBB/gym_sitemaps/images/rss-valid.gif Binary files differnew file mode 100644 index 0000000000..3f48786840 --- /dev/null +++ b/phpBB/gym_sitemaps/images/rss-valid.gif diff --git a/phpBB/gym_sitemaps/images/rss_board_big.gif b/phpBB/gym_sitemaps/images/rss_board_big.gif Binary files differnew file mode 100644 index 0000000000..9092e2d12c --- /dev/null +++ b/phpBB/gym_sitemaps/images/rss_board_big.gif diff --git a/phpBB/gym_sitemaps/images/rss_forum_big.gif b/phpBB/gym_sitemaps/images/rss_forum_big.gif Binary files differnew file mode 100644 index 0000000000..ccd24fd4fc --- /dev/null +++ b/phpBB/gym_sitemaps/images/rss_forum_big.gif diff --git a/phpBB/gym_sitemaps/images/scoopeo.png b/phpBB/gym_sitemaps/images/scoopeo.png Binary files differnew file mode 100644 index 0000000000..1d9c49a2eb --- /dev/null +++ b/phpBB/gym_sitemaps/images/scoopeo.png diff --git a/phpBB/gym_sitemaps/images/site_logo.gif b/phpBB/gym_sitemaps/images/site_logo.gif Binary files differnew file mode 100644 index 0000000000..909114c377 --- /dev/null +++ b/phpBB/gym_sitemaps/images/site_logo.gif diff --git a/phpBB/gym_sitemaps/images/sitemap-icon.gif b/phpBB/gym_sitemaps/images/sitemap-icon.gif Binary files differnew file mode 100644 index 0000000000..92c9d0265f --- /dev/null +++ b/phpBB/gym_sitemaps/images/sitemap-icon.gif diff --git a/phpBB/gym_sitemaps/images/topic_read.gif b/phpBB/gym_sitemaps/images/topic_read.gif Binary files differnew file mode 100644 index 0000000000..0347ffc1e9 --- /dev/null +++ b/phpBB/gym_sitemaps/images/topic_read.gif diff --git a/phpBB/gym_sitemaps/images/wikio.gif b/phpBB/gym_sitemaps/images/wikio.gif Binary files differnew file mode 100644 index 0000000000..4dcc05614b --- /dev/null +++ b/phpBB/gym_sitemaps/images/wikio.gif diff --git a/phpBB/gym_sitemaps/includes/.htaccess b/phpBB/gym_sitemaps/includes/.htaccess new file mode 100644 index 0000000000..6511d09c92 --- /dev/null +++ b/phpBB/gym_sitemaps/includes/.htaccess @@ -0,0 +1,4 @@ +<Limit GET POST PUT DELETE> +Order Allow,Deny +Deny from All +</Limit> diff --git a/phpBB/gym_sitemaps/includes/gym_common.php b/phpBB/gym_sitemaps/includes/gym_common.php new file mode 100644 index 0000000000..0c6cda42a1 --- /dev/null +++ b/phpBB/gym_sitemaps/includes/gym_common.php @@ -0,0 +1,367 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: gym_common.php 264 2010-06-02 07:13:08Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +global $table_prefix; +// Table +define('GYM_CONFIG_TABLE', $table_prefix . 'gym_config'); +// Overrides (must be numbers, and OVERRIDE_GLOBAL > OVERRIDE_OTYPE > OVERRIDE_MODULE > 0) +define('OVERRIDE_GLOBAL', 3); +define('OVERRIDE_OTYPE', 2); +define('OVERRIDE_MODULE', 1); + +// Some set up +$_action_types = array('google' => 'google', 'rss' => 'rss', 'html' => 'html', /*'yahoo' => 'yahoo'*/); +if (defined('ADMIN_START') || defined('IN_INSTALL')) { + $_action_types['main'] = 'main'; +} +$_override_types = array('cache', 'gzip', 'modrewrite', 'limit', 'pagination', 'sort'); + +/** +* obtain_gym_config ($mode, &$cfg_array). +* Get the required config datas +*/ +function obtain_gym_config($mode, &$cfg_array) { + global $db, $cache; + $sql_config = ''; + $cache_file = '_gym_config'; + $mode = empty($mode) ? 'main' : $mode; + if ($mode != 'main') { + $sql_config = "WHERE config_type = 'main' OR config_type = '" . $db->sql_escape($mode). "'"; + $cache_file .= '_' . $mode; + } else { + $cache_file .= '_main'; + } + if (($cfg_array = $cache->get($cache_file)) === false) { + $cfg_array = array(); + $sql = "SELECT * + FROM " . GYM_CONFIG_TABLE . " + $sql_config"; + $db->sql_return_on_error(true); + $result = $db->sql_query($sql); + $db->sql_return_on_error(false); + while ($row = $db->sql_fetchrow($result)) { + $cfg_array[$row['config_name']] = $row['config_value']; + } + $db->sql_freeresult($result); + $cache->put($cache_file, $cfg_array); + } + return; +} +/** +* set_gym_config($config_name, $config_value, $mode, &$cfg_array) +* Set gym_config value. Creates missing config entry if needed. +*/ +function set_gym_config($config_name, $config_value, $mode, &$cfg_array) { + global $db, $_action_types; + if (!in_array($mode, $_action_types) ) { + trigger_error('GYM_ERROR_MODULE_TYPE', E_USER_ERROR); + } + $sql = 'UPDATE ' . GYM_CONFIG_TABLE . " + SET config_value = '" . $db->sql_escape($config_value) . "' + WHERE config_name = '" . $db->sql_escape($config_name) . "'"; + $db->sql_query($sql); + if (!$db->sql_affectedrows() && !isset($cfg_array[$config_name])) { + $sql = 'INSERT INTO ' . GYM_CONFIG_TABLE . ' '; + $sql .= $db->sql_build_array('INSERT', array( + 'config_name' => (string) $config_name, + 'config_value' => (string) $config_value, + 'config_type' => (string) $mode, + ) + ); + $db->sql_query($sql); + } + $cfg_array[$config_name] = $config_value; + return; +} +/** +* rem_gym_config($config_name, &$cfg_array) +* Delete rem_gym_config value. +*/ +function rem_gym_config($config_name, &$cfg_array) { + global $db; + $sql = 'DELETE FROM ' . GYM_CONFIG_TABLE . " + WHERE config_name = '" . $db->sql_escape($config_name) . "'"; + $db->sql_query($sql); + unset($cfg_array[$config_name]); + return; +} +/** +* obtain_gym_links(). +* Builds the rss and sitemaps links +*/ +function obtain_gym_links($gym_links = array()) { + global $phpbb_root_path, $template, $cache, $config, $phpEx, $user, $phpbb_seo, $auth; + if (empty($config['gym_installed'])) { + return; + } + $_phpbb_seo = !empty($phpbb_seo); + $board_url = $_phpbb_seo ? $phpbb_seo->seo_path['phpbb_url'] : generate_board_url() . '/'; + $gym_config = array(); + $ssl_bit = $phpbb_seo->ssl['use'] ? 'ssl_' : ''; + $cache_file = '_gym_links_' . $ssl_bit . $user->data['user_lang']; + $gym_link_tpl = '<a href="%1$s" title="%3$s" class="gym"><img src="' . $board_url . 'gym_sitemaps/images/%2$s" alt="%3$s" width="14", height="14"/> %4$s</a> '; + if (($links = $cache->get($cache_file)) === false) { + obtain_gym_config('main', $gym_config); + $user->add_lang('gym_sitemaps/gym_common'); + if (!defined('GYM_RSS_FUNC_INC')) { + require($phpbb_root_path . 'gym_sitemaps/includes/gym_rss_functions.' . $phpEx); + } + $links = get_gym_links($gym_config); + $cache->put($cache_file, $links); + } + // In case one would want to manually fil the array in some file, like viewforum + // Would be passed here from page_header() where $gym_links is global + if (!empty($gym_links['main'])) { + $links = array_merge($links['main'], $gym_links['main']); + } + // A bit dirty but lazy way to add forum maps and news pages everywhere ;-) + $html_setup = & $links['setup']['html']; + $rss_setup = & $links['setup']['rss']; + $google_setup = & $links['setup']['google']; + if (!empty($html_setup['forum_allow_cat_news']) || !empty($html_setup['forum_allow_cat_map']) || !empty($rss_setup['forum_rss']) || !empty($google_setup['forum_google'])) { + $_f_sep = $_phpbb_seo ? $phpbb_seo->seo_delim['forum'] : ''; + $display_main_index = !empty($links['setup']['main']['link_index']); + if ($display_main_index && !empty($template->_tpldata['forumrow'])) { + foreach ($template->_tpldata['forumrow'] as $k => $v) { + $num_topics = !empty($v['TOPICS']) ? max(0, (int) $v['TOPICS']) : 0; + if ($num_topics && empty($v['S_IS_LINK']) && empty($v['S_IS_CAT'])) { + $link = ''; + $forum_id = (int) $v['FORUM_ID']; + $forum_name = $v['FORUM_NAME']; + if (!empty($html_setup['link_index']) && (isset($html_setup['auth_guest'][$forum_id]) || (!empty($html_setup['forum_allow_auth']) && !isset($html_setup['forum_exclude'][$forum_id])))) { + if ($html_setup['forum_allow_cat_news']) { + $url = sprintf($html_setup['forum_cat_news'], $_phpbb_seo ? $phpbb_seo->seo_url['forum'][$forum_id] : '', $forum_id ); + $link .= sprintf($gym_link_tpl, $url, 'html_news.gif', sprintf($html_setup['l_html_news_of'], $forum_name), $html_setup['l_html_news']); + } + if ($html_setup['forum_allow_cat_map']) { + $url = sprintf($html_setup['forum_cat_map'], $_phpbb_seo ? $phpbb_seo->seo_url['forum'][$forum_id] : '', $forum_id ); + $link .= ' ' . sprintf($gym_link_tpl, $url, 'maps-icon.gif', sprintf($html_setup['l_html_map_of'], $forum_name), $html_setup['l_html_map']); + } + } + if (!empty($rss_setup['link_index']) && (isset($rss_setup['auth_guest'][$forum_id]) || ($rss_setup['forum_allow_auth'] && !isset($rss_setup['forum_exclude'][$forum_id])))) { + $url = sprintf($rss_setup['forum_cat_rss'], $_phpbb_seo ? $phpbb_seo->seo_url['forum'][$forum_id] : '', $forum_id ); + $link .= ' ' . sprintf($gym_link_tpl, $url, 'feed-icon.png', sprintf($rss_setup['l_rss_feed_of'], $forum_name), $rss_setup['l_rss_feed']); + } + if (!empty($google_setup['link_index']) && isset($google_setup['auth_guest'][$forum_id]) && ($num_topics >= $google_setup['threshold'])) { + $url = sprintf($google_setup['forum_cat_google'], $_phpbb_seo ? str_replace($_f_sep . $forum_id, '', $phpbb_seo->seo_url['forum'][$forum_id]) . $_f_sep . $forum_id : '', $forum_id ); + $link .= ' ' . sprintf($gym_link_tpl, $url, 'sitemap-icon.gif', sprintf($google_setup['l_google_sitemap_of'], $forum_name), $google_setup['l_google_sitemap']); + } + if ($link) { + $template->_tpldata['forumrow'][$k]['FORUM_DESC'] .= "<br/>$link"; + } + } + } + } + $display_main_cat = !empty($links['setup']['main']['link_cat']); + if ($display_main_cat && !empty($template->_rootref['FORUM_NAME']) && !empty($template->_rootref['FORUM_ID'])) { + $forum_id = (int) $template->_rootref['FORUM_ID']; + $forum_name = $template->_rootref['FORUM_NAME']; + $do_display = false; + if (!empty($template->_tpldata['navlinks'])) { + $forum_data = $template->_tpldata['navlinks'][count($template->_tpldata['navlinks']) - 1]; + } + if (!empty($forum_data) ) { + if ($_phpbb_seo && empty($phpbb_seo->seo_url['forum'][$forum_id])) { + $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($forum_name, $forum_id, 'forum'); + } + if (!empty($html_setup['link_cat']) && (isset($html_setup['auth_guest'][$forum_id]) || (!empty($html_setup['forum_allow_auth']) && !isset($html_setup['forum_exclude'][$forum_id]))) ) { + if ($html_setup['forum_allow_cat_news']) { + $url = sprintf($html_setup['forum_cat_news'], $_phpbb_seo ? $phpbb_seo->seo_url['forum'][$forum_id] : '', $forum_id); + $title = sprintf($html_setup['l_html_news_of'], $forum_name); + $links['main']['GYM_HTML_FORUM_NEWS_LINK'] = sprintf($gym_link_tpl, $url, 'html_news.gif', $title, $html_setup['l_html_news']); + $do_display = true; + } + if ($html_setup['forum_allow_cat_map']) { + $url = sprintf($html_setup['forum_cat_map'], $_phpbb_seo ? $phpbb_seo->seo_url['forum'][$forum_id] : '', $forum_id ); + $title = sprintf($html_setup['l_html_map_of'], $forum_name); + $links['main']['GYM_HTML_FORUM_MAP_LINK'] = sprintf($gym_link_tpl, $url, 'maps-icon.gif', $title, $html_setup['l_html_map']); + $do_display = true; + } + } + } + if (!empty($forum_data['S_IS_POST'])) { + if (!empty($rss_setup['link_cat']) && (isset($rss_setup['auth_guest'][$forum_id]) || ($rss_setup['forum_allow_auth'] && !isset($rss_setup['forum_exclude'][$forum_id])) )) { + $url = sprintf($rss_setup['forum_cat_rss'], $_phpbb_seo ? $phpbb_seo->seo_url['forum'][$forum_id] : '', $forum_id ); + $title = sprintf($rss_setup['l_rss_feed_of'], $forum_name); + $links['main']['GYM_RSS_FORUM_LINK'] = sprintf($gym_link_tpl, $url, 'feed-icon.png', $title, $rss_setup['l_rss_feed']); + if (!empty($links['setup']['rss']['display_forum_alternate'])) { + $links['alternate'][] = array( + 'TITLE' => $title, + 'URL' => $url + ); + } + $do_display = true; + } + if (!empty($google_setup['link_cat']) && isset($google_setup['auth_guest'][$forum_id])) { + $url = sprintf($google_setup['forum_cat_google'], $_phpbb_seo ? str_replace($_f_sep . $forum_id, '', $phpbb_seo->seo_url['forum'][$forum_id]) . $_f_sep . $forum_id : '', $forum_id ); + $title = sprintf($google_setup['l_google_sitemap_of'], $forum_name); + $links['main']['GYM_GOOGLE_FORUM_LINK'] = sprintf($gym_link_tpl, $url, 'sitemap-icon.gif', $title, $google_setup['l_google_sitemap']); + $do_display = true; + } + } + $links['main']['GYM_LINKS_CAT'] = $do_display; + } + } + if (!empty($links['main'])) { + $template->assign_vars($links['main']); + } + if (!empty($links['alternate'])) { + foreach ($links['alternate'] as $alternate) { + $template->assign_block_vars('gym_rsslinks', $alternate); + } + } + return $links['setup']; +} +/** +* display_feed($params, $tpl_prefix = '') +* $params : array of params or string feed URL for defaults +* tpl_prefix is for using different link blocks on one page +* Use display_feed('http://www.example.com/rss/rss.xml') to use default settings. +* */ +function display_feed($params, $tpl_prefix = '') { + global $cache, $user, $config, $template, $phpbb_root_path, $phpEx; + if (is_string($params)) { + $params = array('url' => $params); + } + $_params = array( + 'url' => trim(str_replace('&', '&', $params['url'])), + 'slide' => !empty($params['slide']), + 'speed' => !empty($params['speed']) ? max((int) $params['speed'], 1) : 30, + 'ttl' => !empty($params['ttl']) ? max((int) $params['ttl'], 0) : 3600, + 'limit' => !empty($params['limit']) ? max((int) $params['limit'], 1) : 5, + 'desc' => !empty($params['desc']), + 'html' => !empty($params['html']), + 'striptags' => !empty($params['striptags']), + ); + if (empty($_params['url'])) { + return false; + } + $cache_file = '_gym_links_' . md5($user->data['user_lang'] . $_params['url']); + if (($feed_data = $cache->get($cache_file)) === false) { + if (!defined('GYM_RSS_FUNC_INC')) { + require($phpbb_root_path . 'gym_sitemaps/includes/gym_rss_functions.' . $phpEx); + } + $feed_data = get_feed_data($_params); + $cache->put($cache_file, $feed_data, $_params['ttl']); + } + if (!empty($feed_data['items'])) { + $template->assign_vars(array($tpl_prefix . 'GYM_RSS_AGREGATED' => true, + $tpl_prefix . 'GYM_CHAN_TITLE' => $feed_data['setup']['chantitle'], + $tpl_prefix . 'GYM_CHAN_LINK' => $feed_data['setup']['chanlink'], + $tpl_prefix . 'GYM_CHAN_SOURCE' => $_params['url'], + $tpl_prefix . 'GYM_RSS_AUTHOR' => false, + $tpl_prefix . 'GYM_RSS_DATE' => $feed_data['setup']['date'], + $tpl_prefix . 'GYM_RSS_DESC' => $_params['desc'], + $tpl_prefix . 'GYM_RSS_SLIDE' => $_params['slide'], + $tpl_prefix . 'GYM_RSS_SLIDE_SP' => 'height:' . ($_params['desc'] ? $_params['limit']*45: $_params['limit']*20) . 'px;', + $tpl_prefix . 'GYM_RSS_SLIDE_SP_JS' => $_params['desc'] ? $_params['limit']*45 : $_params['limit']*20, + $tpl_prefix . 'GYM_RSS_SLIDE_EP' => $_params['desc'] ? (int) ($_params['limit']*$feed_data['setup']['desclen']/(count($feed_data['items'])*2.67)) : $_params['limit']*45, + $tpl_prefix . 'GYM_RSS_CSSID' => $tpl_prefix . 'gnews', + $tpl_prefix . 'GYM_RSS_SCRSPEED' => $_params['speed'], + )); + $i = 1; + foreach ($feed_data['items'] as $item) { + if ($i > $_params['limit']) { + break; + } + $template->assign_block_vars(strtolower($tpl_prefix) . 'gym_link_list', $item); + $i++; + } + unset($feed_data); + return true; + } + return false; +} +/** +* get_override($mode, $key, $gym_config) +* +*/ +function get_override($mode, $key, $gym_config) { + return $gym_config['gym_override_' . $key] != OVERRIDE_GLOBAL ? ($gym_config[$mode . '_override_' . $key] != OVERRIDE_GLOBAL ? $gym_config[$mode . '_override_' . $key] : $gym_config['gym_override_' . $key] ) : OVERRIDE_GLOBAL; +} +/** +* get_gym_option($mode, $type, $gym_config) +* Same effect as gym_sitemaps::set_module_option() but with all params and usable outisde the class +*/ +function get_gym_option($mode, $module, $key, $override, &$gym_config) { + return ($override == OVERRIDE_MODULE && @isset($gym_config[$mode . '_' . $module . '_' . $key])) ? $gym_config[$mode . '_' . $module . '_' . $key] : ( ($override != OVERRIDE_GLOBAL && @isset($gym_config[$mode . '_' . $key])) ? $gym_config[$mode . '_' . $key] : ( isset($gym_config['gym_' . $key]) ? $gym_config['gym_' . $key] : ( @isset($gym_config[$mode . '_' . $key]) ? $gym_config[$mode . '_' . $key] : ( @isset($gym_config[$mode . '_' . $module . '_' . $key]) ? $gym_config[$mode . '_' . $module . '_' . $key] : null ) ) ) ); +} +/** +* get_date_from_header($response_header_array) +*/ +function get_date_from_header($response_header_array) { + if (is_array($response_header_array)) { + foreach ($response_header_array as $header_line) { + if (preg_match('`Date:(.+)`i', $header_line, $match)) { + return (int) strtotime(trim($match[1])); + } + } + } + return 0; +} +/** +* numeric_entify_utf8() +* borrowed from php.net : http://www.php.net/utf8_decode +*/ +function numeric_entify_utf8($utf8_string) { + $out = ""; + $ns = strlen ($utf8_string); + for ($nn = 0; $nn < $ns; $nn ++) { + $ch = $utf8_string[$nn]; + $ii = ord ($ch); + if ($ii < 128) { //1 7 0bbbbbbb (127) + $out .= $ch; + } elseif ($ii >> 5 == 6) { //2 11 110bbbbb 10bbbbbb (2047) + $b1 = ($ii & 31); + $nn ++; + $ch = $utf8_string[$nn]; + $ii = ord ($ch); + $b2 = ($ii & 63); + $ii = ($b1 * 64) + $b2; + $ent = sprintf ("&#%d;", $ii); + $out .= $ent; + } elseif ($ii >> 4 == 14) { //3 16 1110bbbb 10bbbbbb 10bbbbbb + $b1 = ($ii & 31); + $nn ++; + $ch = $utf8_string[$nn]; + $ii = ord ($ch); + $b2 = ($ii & 63); + $nn ++; + $ch = $utf8_string[$nn]; + $ii = ord ($ch); + $b3 = ($ii & 63); + $ii = ((($b1 * 64) + $b2) * 64) + $b3; + $ent = sprintf ("&#%d;", $ii); + $out .= $ent; + } elseif ($ii >> 3 == 30) { //4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb + $b1 = ($ii & 31); + $nn ++; + $ch = $utf8_string[$nn]; + $ii = ord ($ch); + $b2 = ($ii & 63); + $nn ++; + $ch = $utf8_string[$nn]; + $ii = ord ($ch); + $b3 = ($ii & 63); + $nn ++; + $ch = $utf8_string[$nn]; + $ii = ord ($ch); + $b4 = ($ii & 63); + $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; + $ent = sprintf ("&#%d;", $ii); + $out .= $ent; + } + } + return $out; +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/includes/gym_common_admin.php b/phpBB/gym_sitemaps/includes/gym_common_admin.php new file mode 100644 index 0000000000..71996db438 --- /dev/null +++ b/phpBB/gym_sitemaps/includes/gym_common_admin.php @@ -0,0 +1,15 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: gym_common_admin.php 112 2009-09-30 17:21:34Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} + +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/includes/gym_google.php b/phpBB/gym_sitemaps/includes/gym_google.php new file mode 100644 index 0000000000..3aea9134a2 --- /dev/null +++ b/phpBB/gym_sitemaps/includes/gym_google.php @@ -0,0 +1,302 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: gym_google.php 272 2010-11-21 13:56:31Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +require_once($phpbb_root_path . 'gym_sitemaps/includes/gym_sitemaps.' . $phpEx); +/** +* gym_google Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class gym_google extends gym_sitemaps { + var $google_config = array(); + // changefreq values, set to null to deactivate a value + var $freq_values = array('always' => 1, 'hourly' => 1, 'daily' => 1, 'weekly' => 1, 'monthly' => 1, 'yearly' => 1, 'never' => 1); + /** + * constuctor + */ + function gym_google() { + global $phpbb_seo, $phpEx, $config; + global $db, $auth, $user; + $this->gym_sitemaps('google'); + // init output + $this->output_data['showstats'] = $this->gym_config['gym_showstats'] && $this->gym_config['google_showstats']; + // Check the main vars + $this->init_get_vars(); + if (empty($this->actions['action_modules'])) { + $this->gym_error(404, '', __FILE__, __LINE__); + } + // Set last mod time from DB, will only be used as his for sitempaindex + // put it into phpbb config for the dynamic property. + $config_name = $this->actions['action_type'] . '_' . (!empty($this->actions['module_main']) ? $this->actions['module_main'] . '_' : '') . 'last_mod_time'; + if (@$config[$config_name] < $config['board_startdate']) { + set_config($config_name, $this->output_data['time'], 1); + } + $this->output_data['last_mod_time'] = intval($config[$config_name]); + // Init the output class + $this->gym_init_output(); + // Setup the output + $this->cache_config = array_merge( + // Global + $this->cache_config, + // Other stuff required here + array( + 'cache_enable' => (boolean) $this->set_module_option('cache_on', $this->override['cache']), + 'cache_auto_regen' => (boolean) $this->set_module_option('cache_auto_regen', $this->override['cache']), + 'cache_force_gzip' => (boolean) $this->set_module_option('cache_force_gzip', $this->override['cache']), + 'cache_born' => $this->output_data['last_mod_time'], + 'cache_max_age' => round($this->set_module_option('cache_max_age', $this->override['cache']),2) * 3600, + 'cache_file_ext' => ( $this->gym_output->gzip_config['gzip'] || $this->set_module_option('cache_force_gzip', $this->override['cache']) ) ? '.xml.gz' : '.xml', + ) + ); + // Can you believe it, sprintf is faster than straight parsing. + $this->style_config = array('Sitemap_tpl' => "\n\t" . '<url>' . "\n\t\t" . '<loc>%1$s</loc>%2$s%3$s%4$s' . "\n\t" . '</url>', + 'SitmIndex_tpl' => "\n\t" . '<sitemap>' . "\n\t\t" . '<loc>%s</loc>%s' . "\n\t" . '</sitemap>', + 'lastmod_tpl' => "\n\t\t" . '<lastmod>%s</lastmod>', + 'changefreq_tpl' => "\n\t\t" . '<changefreq>%s</changefreq>', + 'priority_tpl' => "\n\t\t" . '<priority>%.1f</priority>', + 'xslt_style' => '', + 'stats_genlist' => "\n" . '<!-- URL list generated in %s s %s - %s sql - %s URLs listed -->', + 'stats_start' => "\n" . '<!-- Output started from cache after %s s - %s sql -->', + 'stats_nocache' => "\n" . '<!-- Output ended after %s s %s -->', + 'stats_end' => "\n" . '<!-- Output from cache ended up after %s s - %s sql -->', + ); + $this->google_config = array( + 'google_default_priority' => $this->set_module_option('default_priority', $this->gym_config['google_override']), + // in sitemaps we only want to issue https urls if ssl is actually forced + // otherwise, http links are considered as canonical + // If ssl is not forced, then the links in sitemaps won't be https, but + // the xsl transform template will show https urls upon request. + 'google_url' => $phpbb_seo->sslify($this->gym_config['google_url'], $phpbb_seo->ssl['forced']), + // module specific settings we should often need in module + 'google_modrewrite' => (int) $this->set_module_option('modrewrite', $this->override['modrewrite']), + 'google_modrtype' => (int) $this->set_module_option('modrtype', $this->override['modrewrite']), + 'google_pagination' => $this->set_module_option('pagination', $this->override['pagination']), + 'google_limitdown' => (int) $this->set_module_option('limitdown', $this->override['pagination']), + 'google_limitup'=> (int) $this->set_module_option('limitup', $this->override['pagination']), + 'google_sql_limit' => (int) $this->set_module_option('sql_limit', $this->override['limit']), + 'google_url_limit' => (int) $this->set_module_option('url_limit', $this->override['limit']), + 'google_sort' => ($this->set_module_option('sort', $this->override['sort']) === 'DESC') ? 'DESC' : 'ASC', + 'google_ping' => $this->set_module_option('ping', $this->gym_config['google_override']), + // display threshold + 'google_threshold' => max(1, (int) $this->gym_config['google_threshold']), + 'google_allow_auth' => (int) $this->set_module_option('allow_auth', $this->gym_config['google_override']), + 'google_cache_auth' => (int) $this->set_module_option('cache_auth', $this->gym_config['google_override']), + ); + // SSL + // in sitemaps we only want to issue https urls if ssl is actually forced + // otherwise, http links are considered as canonical + foreach ($phpbb_seo->seo_path as $k => $v) { + $phpbb_seo->seo_path[$k] = $phpbb_seo->sslify($v, $phpbb_seo->ssl['forced']); + } + $this->google_config['google_auth_guest'] = ($this->google_config['google_allow_auth'] && ($user->data['is_bot'] || $user->data['is_registered'])) ? false : true; + $this->cache_config['do_cache'] = $this->google_config['google_auth_guest'] ? true : $this->google_config['google_cache_auth']; + if ($this->gym_config['google_xslt']) { + $this->style_config['xslt_style'] = "\n" . '<?xml-stylesheet type="text/xsl" href="' . $phpbb_seo->sslify($phpbb_seo->seo_path['phpbb_url'], $phpbb_seo->ssl['use']) . 'gym_sitemaps/gym_style.' . $phpEx . '?action-google,type-xsl,lang-' . $config['default_lang'] . ',theme_id-' . $config['default_style'] . '" ?'.'>'; + } + // Take care about module categorie urls, assuming that they are of the proper form + // title-sepXX.xml + // assuming that phpbb_seo seo_delim array is properly set. + if (empty($this->actions['module_main']) && empty($this->actions['module_sub']) && !empty($_REQUEST['module_sep']) && !empty($_REQUEST['module_sub'])) { + if ($module = @array_search('-' . $_REQUEST['module_sep'], $phpbb_seo->seo_delim)) { + $this->actions['module_main'] = $module; + $this->actions['module_sub'] = (int) $_REQUEST['module_sub']; + } + } + // Are we going to explain ? + $do_explain = false; + if (!empty($_REQUEST['explain']) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report')) { + $do_explain = true; + $this->cache_config['do_cache'] = false; + } + if ( empty($this->actions['module_main']) ) { // SitemapIndex + $this->google_sitemapindex(); + } else { // Sitemap + $this->google_sitemap(); + } + if ($do_explain) { + $db->sql_report('display'); + } else { + $this->gym_output->do_output(); + } + return; + } + /** + * GGs_sitemapindex() will build our sitemapIndex + * Listing all available sitemaps + * @access private + */ + function google_sitemapindex() { + global $phpEx, $phpbb_seo, $db; + $sitemapindex_url = $this->google_config['google_url'] . ( $this->google_config['google_modrewrite'] ? 'sitemapindex.xml' . $this->url_config['gzip_ext_out'] : 'sitemap.'.$phpEx); + $this->seo_kill_dupes($sitemapindex_url); + $this->output_data['data'] = '<'.'?xml version="1.0" encoding="UTF-8"?'.'>' . $this->style_config['xslt_style'] . "\n" . '<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n\t" . 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n\t" . 'http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd"' . "\n\t" . 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" . '<!-- Generated by Google Yahoo MSN Sitemaps and RSS ' . $this->gym_config['gym_version'] . ' - © 2006, ' . date('Y') . ' www.phpBB-SEO.com -->' . "\n"; + // start the modules + $this->load_modules('sitemapindex'); + // Grabb the total + $this->output_data['url_sofar'] = $this->output_data['url_sofar_total']; + if ( empty($this->output_data['url_sofar']) ) { + $this->gym_error(404, 'GYM_TOO_FEW_ITEMS', __FILE__, __LINE__); + } + $this->output_data['data'] .= "\n" . '</sitemapindex>'; + if ( $this->google_config['google_ping'] && ($this->output_data['time'] >= ($this->cache_config['cache_born'] + $this->cache_config['cache_max_age'])) ) { + $this->google_ping($sitemapindex_url); + } + return; + } + /** + * GGs_sitemap() will build the actual Google sitemaps, all cases + * @access private + */ + function google_sitemap() { + global $phpEx, $phpbb_seo, $db; + // Initialize SQL cycling : do not query for more than required + $this->gym_config['google_sql_limit'] = ($this->gym_config['google_sql_limit'] > $this->gym_config['google_url_limit']) ? $this->gym_config['google_url_limit'] : $this->gym_config['google_sql_limit']; + $this->output_data['data'] = '<'.'?xml version="1.0" encoding="UTF-8"?'.'>' . $this->style_config['xslt_style'] . "\n" . '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n\t" . 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n\t" . 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"' . "\n\t" . 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" . '<!-- Generated by Google Yahoo MSN Sitemaps and RSS ' . $this->gym_config['gym_version'] . ' - © 2006, ' . date('Y') . ' www.phpBB-SEO.com -->' . "\n"; + // start the module + $module_class = $this->actions['action_type'] . '_' . $this->actions['module_main']; + $this->load_module($module_class, 'sitemap'); + if (empty($this->output_data['url_sofar']) ) { + $this->gym_error(404, 'GYM_TOO_FEW_ITEMS', __FILE__, __LINE__); + } + $this->output_data['data'] .= "\n" . '</urlset>'; + if ( $this->google_config['google_ping'] && ($this->output_data['time'] >= ($this->cache_config['cache_born'] + $this->cache_config['cache_max_age'])) ) { + $this->google_ping(); + } + return; + } + /** + * parse_sitemap($url, $lastmodtime = 0) + * adds the module sitemaps to the sitemapindex + */ + function parse_sitemap($url, $lastmodtime = 0) { + global $config, $user; + if ($lastmodtime > $config['board_startdate']) { + $lastmodtime = sprintf($this->style_config['lastmod_tpl'], gmdate('Y-m-d\TH:i:s'.'+00:00', intval($lastmodtime))); + } else { + $lastmodtime = ''; + } + $this->output_data['data'] .= sprintf($this->style_config['SitmIndex_tpl'], $url, $lastmodtime); + $this->output_data['url_sofar']++; + } + /** + * parse_item() adds the item info to the output + */ + function parse_item($url, $priority = 1.0, $changefreq = 'always', $lastmodtime = 0) { + global $config, $user; + $changefreq = isset($this->freq_values[$changefreq]) ? sprintf($this->style_config['changefreq_tpl'], $changefreq) : ''; + $priority = $priority <= 1 && $priority > 0 ? str_replace(',', '.', sprintf($this->style_config['priority_tpl'], $priority)) : ''; + $lastmodtime = $lastmodtime > $config['board_startdate'] ? sprintf($this->style_config['lastmod_tpl'], gmdate('Y-m-d\TH:i:s'.'+00:00', intval($lastmodtime))) : ''; + $this->output_data['data'] .= sprintf($this->style_config['Sitemap_tpl'], $url, $lastmodtime, $changefreq, $priority); + $this->output_data['url_sofar']++; + } + /** + * get_priority() computes the priority, bases on last mod time and page number + * Freshest items with most pages gets the highest priority + * 42 is the answer to the most important question in the universe ;-) + */ + function get_priority($lastmodtime, $pages = 1) { + global $user; + return $user->time_now / ($user->time_now + ((($user->time_now - $lastmodtime)* 42) / $pages)); + } + /** + * get_changefreq($lastmodtime) computes the changefreq, based on lastmodtime + */ + function get_changefreq($lastmodtime) { + global $user; + $dt = $user->time_now - $lastmodtime; + // 42 weeks ~ 10 month | 8 weeks | 15 days | 2 days | 12 hours + return $dt > 25401600 ? 'yearly' : ( $dt > 4838400 ? 'monthly' : ( $dt > 1296000 ? 'weekly' : ( $dt > 172800 ? 'daily' : ( $dt > 43200 ? 'hourly' : 'always' ) ) ) ); + } + /** + * google_ping($url = '') + * ping google + */ + function google_ping($url = '') { + global $config, $phpbb_seo; + $url = !empty($url) ? str_replace('&', '&', $url) : (!empty($this->url_config['current']) ? $this->url_config['current'] : ''); + $url = trim($url); + if (empty($url)) { + return; + } + // No more than 200 pings a day! + if (@$config['gym_pinged_today'] > 200) { + // @TODO add logs about this ? + return; + } + $skip = array('://localhost', '://127.0.0.1', '://192.168.', '://169.254.'); + foreach ($skip as $_skip) { + if (utf8_strpos($url, $_skip) !== false) { + // @TODO add logs about this ? + return; + } + } + // If ssl is not forced, always ping with http urls + $url = $phpbb_seo->sslify($url, $phpbb_seo->ssl['forced']); + $se_urls = array('http://www.google.com/', /*'http://www.yahoo.com/', 'http://www.live.com/'*/); + $timout = 3; + $time = time(); + $pinged = 0; + foreach ($se_urls as $se_url) { + if (time() - $time >= $timout) { + return; + } + $request = $se_url . 'ping?sitemap=' . urlencode($url); + if ( function_exists('file_get_contents') ) { + // Make the request + @ini_set('user_agent','GYM Sitemaps & RSS / www.phpBB-SEO.com'); + @ini_set('default_socket_timeout', $timout); + $status_code = false; + if (@file_get_contents($request)) { + // Retrieve HTTP status code + @list($version,$status_code,$msg) = @explode(' ',$http_response_header[0], 3); + } + if (@$status_code != 200) { + // @TODO add logs about this ? + } else { + $pinged++; + $this->style_config['stats_genlist'] .= "\n<!-- Pinged $se_url - $url -->"; + } + } else if (function_exists('curl_exec')) { + // Initialize the session + $session = curl_init($request); + // Set curl options + curl_setopt($session, CURLOPT_HEADER, false); + curl_setopt($session, CURLOPT_USERAGENT, 'GYM Sitemaps & RSS / www.phpBB-SEO.com'); + curl_setopt($session, CURLOPT_TIMEOUT, $timout); + curl_setopt($session, CURLOPT_RETURNTRANSFER, true); + // Make the request + $response = curl_exec($session); + // Close the curl session + curl_close($session); + // Get HTTP Status code from the response + $status_codes = array(); + preg_match('/\d\d\d/', $response, $status_code); + $status_code = @$status_codes[0]; + // Get the the response, bypassing the header + if ($status_code != 200) { + // @TODO add logs about this ? + } else { + $pinged++; + $this->style_config['stats_genlist'] .= "\n<!-- Pinged $se_url - $url -->"; + } + } else { + // @TODO add logs about this ? + } + } + if ($pinged) { + set_config('gym_pinged_today', @$config['gym_pinged_today'] + $pinged, 1); + } + return; + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/includes/gym_html.php b/phpBB/gym_sitemaps/includes/gym_html.php new file mode 100644 index 0000000000..74b1ce6076 --- /dev/null +++ b/phpBB/gym_sitemaps/includes/gym_html.php @@ -0,0 +1,833 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: gym_html.php 262 2010-04-20 11:06:58Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +require_once($phpbb_root_path . 'gym_sitemaps/includes/gym_sitemaps.' . $phpEx); +/** +* gym_html Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class gym_html extends gym_sitemaps { + var $html_config = array(); + var $start = 0; + /** + * constuctor + */ + function gym_html($standalone = false) { + global $phpbb_seo, $config; + $this->gym_sitemaps('html'); + // Check the main vars + $this->init_get_vars(); + if (empty($this->actions['action_modules'])) { + $this->gym_error(404, '', __FILE__, __LINE__); + } + $this->output_data['tpl'] = $this->output_data['page_title'] = ''; + // Used to store module data upon index calls + $this->output_data['module_data'] = array(); + $this->actions['pagination_limit'] = 0; + // Setup the output + $this->cache_config = array_merge( + // Global + $this->cache_config, + // Other stuff required here + array( + 'main_cache_on' => (boolean) $this->set_module_option('main_cache_on', $this->override['cache']), + 'opt_cache_on' => (boolean) $this->set_module_option('opt_cache_on', $this->override['cache']), + 'main_cache_ttl' => round($this->set_module_option('main_cache_ttl', $this->override['cache']),2) * 3600, + 'opt_cache_ttl' => round($this->set_module_option('opt_cache_ttl', $this->override['cache']),2) * 3600, + ) + ); + $this->html_config = array( + 'html_c_info' => $this->gym_config['html_c_info'], + 'html_url' => $phpbb_seo->sslify($this->gym_config['html_url'], $phpbb_seo->ssl['use'], false), + 'html_pagination' => (int) $this->set_module_option('pagination', $this->override['pagination']), + 'html_item_pagination' => (int) $this->set_module_option('item_pagination', $this->override['pagination']), + 'html_pagination_limit' => (int) max(1, $this->set_module_option('pagination_limit', $this->override['pagination'])), + 'html_news_pagination' => $this->set_module_option('news_pagination', $this->override['pagination']), + 'html_news_pagination_limit' => (int) max(1, $this->set_module_option('news_pagination_limit', $this->override['pagination'])), + 'html_map_time_limit' => (int) max(0, $this->set_module_option('map_time_limit', $this->override['limit'])*3600*24), + 'html_cat_time_limit' => (int) max(0, $this->set_module_option('cat_time_limit', $this->override['limit'])*3600*24), + 'html_news_time_limit' => (int) max(0, $this->set_module_option('news_time_limit', $this->override['limit'])*3600*24), + 'html_cat_news_time_limit' => (int) max(0, $this->set_module_option('cat_news_time_limit', $this->override['limit'])*3600*24), + 'html_modrewrite' => (boolean) $this->set_module_option('modrewrite', $this->override['modrewrite']), + 'html_modrtype' => (int) $this->set_module_option('modrtype', $this->override['modrewrite']), + 'html_stats_on_news' => (boolean) $this->gym_auth_value($this->set_module_option('stats_on_news', $this->gym_config['html_override'])), + 'html_stats_on_map' => (boolean) $this->gym_auth_value($this->set_module_option('stats_on_map', $this->gym_config['html_override'])), + 'html_birthdays_on_news' => (boolean) $this->gym_auth_value($this->set_module_option('birthdays_on_news', $this->gym_config['html_override'])), + 'html_birthdays_on_map' => (boolean) $this->gym_auth_value($this->set_module_option('html_birthdays_on_map', $this->gym_config['html_override'])), + 'html_sitename' => $this->set_module_option('sitename'), + 'html_site_desc' => $this->set_module_option('site_desc'), + 'html_logo_url' => trim($this->set_module_option('logo_url'), '/'), + 'html_sort' => $this->set_module_option('sort', $this->override['sort']), + 'html_cat_sort' => $this->set_module_option('cat_sort', $this->override['sort']), + 'html_news_sort' => $this->set_module_option('news_sort', $this->override['sort']), + 'html_cat_news_sort' => $this->set_module_option('cat_news_sort', $this->override['sort']), + 'html_allow_auth' => (boolean) $this->set_module_option('allow_auth', $this->gym_config['html_override']), + 'html_disp_online' => (boolean) $this->gym_auth_value($this->set_module_option('disp_online', $this->gym_config['html_override'])), + 'html_disp_tracking' => (boolean) $this->gym_auth_value($this->set_module_option('disp_tracking', $this->gym_config['html_override'])), + 'html_disp_status' => (boolean) $this->gym_auth_value($this->set_module_option('disp_status', $this->gym_config['html_override'])), + 'html_allow_profile' => (boolean) $this->gym_auth_value($this->set_module_option('allow_profile', $this->gym_config['html_override'])), + 'html_allow_profile_links' => (boolean) $this->gym_auth_value($this->set_module_option('allow_profile_links', $this->gym_config['html_override'])), + 'html_allow_map' => (boolean) $this->set_module_option('allow_map', $this->gym_config['html_override']), + 'html_allow_cat_map' => (boolean) $this->set_module_option('allow_cat_map', $this->gym_config['html_override']), + 'html_allow_news' => (boolean) $this->set_module_option('allow_news', $this->gym_config['html_override']), + 'html_allow_cat_news' => (boolean) $this->set_module_option('allow_cat_news', $this->gym_config['html_override']), + 'html_sumarize' => (int) $this->set_module_option('sumarize', $this->gym_config['html_override']), + 'html_sumarize_method' => trim($this->set_module_option('sumarize_method', $this->gym_config['html_override'])), + 'html_allow_bbcode' => (boolean) $this->gym_auth_value($this->set_module_option('allow_bbcode', $this->gym_config['html_override'])), + 'html_strip_bbcode' => trim($this->set_module_option('strip_bbcode', $this->gym_config['html_override'])), + 'html_allow_links' => (boolean) $this->gym_auth_value($this->set_module_option('allow_links', $this->gym_config['html_override'])), + 'html_allow_emails' => (boolean) $this->set_module_option('allow_emails', $this->gym_config['html_override']), + 'html_allow_smilies' => (boolean) $this->gym_auth_value($this->set_module_option('allow_smilies', $this->gym_config['html_override'])), + 'html_allow_sig' => (boolean) $this->gym_auth_value($this->set_module_option('allow_sig', $this->gym_config['html_override'])), + 'html_msg_filters' => array(), + 'html_auth_msg' => '', + 'html_do_explain' => false, + ); + $config['gzip_compress'] = $config['gzip_compress'] ? 1 : (boolean) $this->set_module_option('gzip', $this->override['gzip']); + $this->html_config['html_auth_guest'] = ($this->html_config['html_allow_auth'] && $this->gym_auth['reg']) ? false : true; + $this->cache_config['do_cache_main'] = (boolean) ($this->html_config['html_auth_guest'] && $this->cache_config['main_cache_on']); + $this->cache_config['do_cache_opt'] = (boolean) ($this->html_config['html_auth_guest'] && $this->cache_config['opt_cache_on']); + $this->output_data['left_col_cache_file'] = $this->output_data['right_col_cache_file'] = ''; + $this->actions['is_auth'] = $this->actions['is_active'] = $this->actions['is_public'] = false; + + if (!$standalone) { + // Check the rss specific vars and do basic set_up for msg output + $this->init_html_vars(); + $this->html_output(); + } + return; + } + /** + * init_html_vars() + * Set up the specific rss modules GET vars. + * @access private + */ + function init_html_vars() { + global $user, $phpEx, $phpbb_seo; + // Take care about module categorie urls, assuming that they are of the proper form + // news|map/module_main/module_sub/ + // this code will filter in between special map|news and categroy map and news + // assuming that the cat urls will be of the following form title-sepXX (forum-title-fxx.html or /) + // or without ID, if the phpbb_seo cache array is properly set. + if (!empty($this->actions['module_main']) && !empty($this->actions['module_sub']) && $this->actions['module_sub'] != 'map' && $this->actions['module_sub'] != 'news') { + if (preg_match('`^[a-z0-9_-]*-[a-z]{1}+([0-9]+)`', $this->actions['module_sub'], $match)) { + $this->actions['module_sub'] = $match[1]; + } else if ($id = @array_search($this->actions['module_sub'], $phpbb_seo->cache_config[$this->actions['module_main']]) ) { + $this->actions['module_sub'] = (int) $id; + } + } + $this->start = max(0, request_var('start', 0)); + $this->actions['html_news_list'] = $this->actions['html_map_list'] = false; + $this->html_config['extra_title'] = $this->url_config['extra_params_full'] = $this->url_config['extra_params'] = ''; + if ( isset($_GET['news']) && ($this->html_config['html_allow_cat_news'] || $this->html_config['html_allow_news'])) { + $this->actions['html_news_list'] = true; + if (empty($this->actions['module_sub']) && $this->html_config['html_allow_news']) { + $this->actions['module_sub'] = 'news'; + } + } else if (@$this->actions['module_sub'] == 'news' && $this->html_config['html_allow_news']) { + $this->actions['html_news_list'] = true; + } else if (!empty($this->actions['module_sub']) && $this->html_config['html_allow_cat_map']) { + $this->actions['html_map_list'] = true; + } else if (!empty($this->actions['module_main']) && (empty($this->actions['module_sub']) || $this->actions['module_sub'] == 'map' ) && $this->html_config['html_allow_map']) { + $this->actions['html_map_list'] = true; + } + if ($this->actions['html_news_list']) { + $this->actions['html_type'] = 'news'; + $this->actions['display_stats'] = $this->html_config['html_stats_on_news']; + $this->actions['display_birthdays'] = $this->html_config['html_birthdays_on_news']; + + } else { + $this->actions['html_type'] = 'map'; + $this->actions['display_stats'] = $this->html_config['html_stats_on_map']; + $this->actions['display_birthdays'] = $this->html_config['html_birthdays_on_map']; + } + // Adjust variable a bit + if ($this->actions['html_news_list']) { // requested and auth + $this->html_config['html_msg_filters'] = $this->set_msg_strip($this->html_config['html_strip_bbcode']); + } + // Set up module's urls : Pagination + $this->url_config['html_start_ext'] = ''; + if ($this->html_config['html_modrewrite']) { + $page = !empty($phpbb_seo->seo_static['page']) ? $phpbb_seo->seo_static['page'] : 'page'; + $html = !empty($phpbb_seo->seo_ext['page']) ? $phpbb_seo->seo_ext['page'] : '.html'; + $this->url_config['html_start'] = "$page%1\$s$html"; + $this->url_config['html_default'] = 'maps/'; + $this->url_config['html_news_default'] = 'news/'; + } else { + $this->url_config['html_start'] = '&start=%1$s'; + $this->url_config['html_news_default'] = $this->url_config['html_default'] . '?news'; + } + } + /** + * html_add_start($start, $tpl_start_key) builds the pagination bit + * @access private + */ + function html_add_start($start, $tpl_start_key = 'html_start') { + return $start > 0 ? sprintf($this->url_config[$tpl_start_key], $start) : @$this->url_config[$tpl_start_key . '_ext']; + } + /** + * html_build_url($tpl_key, $title, $id, $start = 0, $tpl_start_key) builds the url + * $title must be properly formated prior to injection + * @access private + */ + function html_build_url($tpl_key, $title = '', $id = 0, $start = 0, $tpl_start_key = 'html_start') { + return sprintf($this->url_config[$tpl_key], $title, $id) . $this->html_add_start($start, $tpl_start_key); + } + /** + * html_output() will build all html output + * @access private + */ + function html_output() { + global $phpEx, $db, $config, $phpbb_root_path, $user, $template, $cache, $phpbb_seo; + $module_obj = null; + $left_col = $right_col = false; + // Set up the base href tag, could be done better but saves a file edit this way ( and works too ;-) ) + // Assuming that map.php is either in phpBB's dir or above (not under). + $bhref_ulr = ($phpbb_root_path === './') ? $phpbb_seo->seo_path['phpbb_url'] : str_replace(ltrim($phpbb_root_path, './'), '', $phpbb_seo->seo_path['phpbb_url']); + $template->assign_vars(array( + 'META' => '<base href="' . $bhref_ulr . '"/>' . "\n", + 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], + 'S_CONTENT_FLOW_BEGIN' => ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + )); + // module action + if (in_array($this->actions['module_main'], $this->actions['action_modules'])) { // List item from the module + // Add index page in navigation links + $template->assign_block_vars('navlinks', array( + 'FORUM_NAME' => $user->lang['HTML_MAP'], + 'U_VIEW_FORUM' => append_sid($this->html_config['html_url']. $this->url_config['html_default'])) + ); + $module_class = $this->actions['action_type'] . '_' . $this->actions['module_main']; + $module_obj = $this->load_module($module_class, 'html_init', true); + } else { // sitemap index + // We are working on all available modules + $left_col = $this->html_index(); + } + $page_title = (!empty($this->output_data['page_title']) ? $this->output_data['page_title'] : $user->lang['HTML_' . strtoupper($this->actions['html_type'])]) . $this->html_config['extra_title']; + // Add current page in navigation links + $template->assign_block_vars('navlinks', array( + 'FORUM_NAME' => $page_title, + 'U_VIEW_FORUM' => append_sid($this->url_config['current'])) + ); + if (!$this->actions['is_active']) { + header('HTTP/1.1 404 Not Found'); + global $msg_title; + $msg_title = $user->lang['GYM_ERROR_404']; + trigger_error('GYM_ERROR_404_EXPLAIN'); + } + if (!$this->actions['is_auth']) { + header('HTTP/1.1 401 Unauthorized'); + if ($user->data['user_id'] != ANONYMOUS) { + trigger_error('GYM_ERROR_401'); + } + login_box('', $user->lang['GYM_LOGIN']); + } + // Let's kill duplicate now ! + if (!empty($this->url_config['current'])) { + $this->seo_kill_dupes(append_sid($this->url_config['current'])); + } + $template->set_filenames(array('body' => 'gym_sitemaps/index_body.html')); + $this->cache_config['do_cache_main'] = (boolean) ($this->cache_config['do_cache_main'] && $this->actions['is_public']); + $this->cache_config['do_cache_opt'] = (boolean) ($this->cache_config['do_cache_opt'] && $this->actions['is_public']); + $cache_find = array('`(\?|&|&)sid\=[a-z0-9]+`i', '`[\s]+`'); + $cache_replace = array('',' '); + $ssl_bit = $phpbb_seo->ssl['use'] ? 'ssl_' : ''; + // Main output + if (!empty($this->output_data['left_col_tpl'])) { + $template->set_filenames(array('left_col' => $this->output_data['left_col_tpl'])); + if ($this->cache_config['do_cache_main'] && !empty($this->output_data['left_col_cache_file'])) { + $cache_file = '_gym_html_' . $this->output_data['left_col_cache_file'] . '_' . $ssl_bit . $user->data['user_lang'] . '_' . $this->start; + if (($left_col = $cache->get($cache_file)) === false) { + $module_obj->html_main(); + $left_col = $template->assign_display('left_col', '', true); + // Strip whitespaces and sids + $left_col = preg_replace($cache_find, $cache_replace, $left_col ); + $cache->put($cache_file, $left_col, $this->cache_config['main_cache_ttl']); + } + } + if (!$left_col) { + $module_obj->html_main(); + $left_col = $template->assign_display('left_col', '', true); + } + } + // Optional output + if (!empty($this->output_data['right_col'])) { + if ($this->cache_config['do_cache_opt'] && !empty($this->output_data['right_col_cache_file'])) { + $cache_file = '_gym_html_' . $this->output_data['right_col_cache_file'] . '_' . $ssl_bit . $user->data['user_lang']; + if (($right_col = $cache->get($cache_file)) === false) { + $module_obj->html_module(); + $template->set_filenames(array('right_col' => $this->output_data['right_col_tpl'])); + $right_col = $template->assign_display('right_col', '', true); + // Strip whitespaces and sids + $right_col = preg_replace($cache_find, $cache_replace, $right_col ); + $cache->put($cache_file, $right_col, $this->cache_config['opt_cache_ttl']); + } + } + if (!$right_col) { + $module_obj->html_module(); + $template->set_filenames(array('right_col' => $this->output_data['right_col_tpl'])); + $right_col = $template->assign_display('right_col', '', true); + } + } + unset($module_obj); + $tpl_data = array(); + if ($this->actions['display_stats']) { + // Set some stats, get posts count from forums data if we... hum... retrieve all forums data + $total_posts = $config['num_posts']; + $total_topics = $config['num_topics']; + $total_users = $config['num_users']; + $l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER'; + $l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER'; + $l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER'; + $tpl_data += array( + 'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts), + 'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics), + 'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users), + ); + if ($this->html_config['html_allow_profile']) { + $tpl_data += array( + 'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string( $this->html_config['html_allow_profile_links'] ? 'full' : 'no_profile', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])), + ); + } + } + // Generate birthday list if required ... + if ($this->actions['display_birthdays']) { + $birthday_list = ''; + $now = getdate(time() + $user->timezone + $user->dst - date('Z')); + $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday + FROM ' . USERS_TABLE . ' u + LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid) + WHERE (b.ban_id IS NULL + OR b.ban_exclude = 1) + AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' + AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { + $birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); + if ($age = (int) substr($row['user_birthday'], -4)) { + $birthday_list .= ' (' . ($now['year'] - $age) . ')'; + } + } + $db->sql_freeresult($result); + $tpl_data += array( + 'BIRTHDAY_LIST' => $birthday_list, + 'S_DISPLAY_BIRTHDAY_LIST' => !empty($birthday_list), + ); + } + $template->assign_vars($tpl_data + array( + 'S_SINGLE_TRAKING' => !empty($this->output_data['single_traking']) ? true : false, + 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), + 'S_SEO_FORUM' => strpos($config['default_lang'], 'fr') !== false ? 'fr/' : 'en/', + 'LEFT_COL' => $left_col, + 'RIGHT_COL' => $right_col, + ) + ); + if ($this->actions['pagination_limit'] > 0) { // Add page number to title + $page_title .= $this->start > 0 ? ' - ' . $user->lang['HTML_PAGE'] . ' ' . ( floor( $this->start / $this->actions['pagination_limit'] ) + 1 ) : ''; + } + page_header($page_title, $this->html_config['html_disp_online']); + if (!empty($this->html_config['html_logo_url'])) { + $template->assign_vars(array( + 'SITE_LOGO_IMG' => '<img src="' . $this->path_config['gym_img_url'] . $this->html_config['html_logo_url'] . '" alt="' . $this->output_data['page_title'] . '" />', + ) + ); + } + page_footer(); + return; + } + /** + * html_index() + * Builds the site map index + * @access private + */ + function html_index() { + global $phpEx, $phpbb_root_path, $user, $template, $cache, $phpbb_seo, $config; + if ($this->actions['html_news_list']) { + // Add index page in navigation links + $template->assign_block_vars('navlinks', array( + 'FORUM_NAME' => $user->lang['HTML_MAP'], + 'U_VIEW_FORUM' => append_sid($this->html_config['html_url']. $this->url_config['html_default']), + )); + $this->url_config['current'] = $this->html_config['html_url'] . $this->url_config['html_news_default']; + $this->actions['is_auth'] = true; + $src_url = $this->gym_config['html_rss_news_url']; + // if the source is set on the same domain, hanlde ssl properly + if (strpos($src_url, $config['server_name']) !== false) { + $src_url = $phpbb_seo->sslify($src_url, $phpbb_seo->ssl['use']); + } + $this->actions['is_active'] = $src_url ? 1 : 0; + $params = array( + // Full URL to the RSS 2.0 feed + 'url' => str_replace('&', '&', $src_url), + 'desc' => true, + 'html' => true, + 'limit' => (int) $this->gym_config['html_rss_news_limit'], + ); + display_feed($params); + $template->assign_vars(array('GYM_RSS_SLIDE_SP' => false)); + $template->set_filenames(array('index_data' => 'gym_sitemaps/gym_link_body.html')); + } else { + $ssl_bit = $phpbb_seo->ssl['use'] ? 'ssl_' : ''; + $cache_file = '_gym_html_map_' . $ssl_bit . $user->data['user_lang']; + if (($this->output_data['module_data'] = $cache->get($cache_file)) === false) { + $this->load_modules('html_index'); + $cache->put($cache_file, $this->output_data['module_data']); + } + $this->output_data['page_title'] = sprintf($user->lang['HTML_MAP_OF'], $this->html_config['html_sitename']); + $this->actions['is_active'] = $this->actions['is_auth'] = true; + $this->url_config['current'] = $this->html_config['html_url'] . $this->url_config['html_default']; + $template->set_filenames(array('index_data' => 'gym_sitemaps/index_list.html')); + if (!empty($this->output_data['module_data'])) { + foreach ($this->output_data['module_data'] as $module_name => $module_data) { + // First modules + $template->assign_block_vars('module', array( + 'TITLE' => $module_data['title'], + 'NEWS_TITLE' => sprintf($user->lang['HTML_NEWS_OF'], $module_data['title']), + 'MAP_TITLE' => sprintf($user->lang['HTML_MAP_OF'], $module_data['title']), + 'DESC' => $module_data['desc'], + 'IMG' => $module_data['img'], + 'MAP_URL' => append_sid($module_data['map_url']), + 'NEWS_URL' => append_sid($module_data['news_url']), + )); + // Then the module maps & news pages + foreach ($module_data['links'] as $data) { + $template->assign_block_vars('module.links', array( + 'MAP_TITLE' => $data['map_title'], + 'MAP_URL' => append_sid($data['map_url']), + 'NEWS_TITLE' => $data['news_title'], + 'NEWS_URL' => append_sid($data['news_url']), + )); + } + } + } + } + $template->assign_vars(array( + 'HTML_SITENAME' => $this->html_config['html_sitename'], + 'HTML_SITEDESC' => $this->html_config['html_site_desc'], + 'HTML_URL' => $this->html_config['html_allow_map'] ? append_sid($this->html_config['html_url'] . $this->url_config['html_default']) : '', + 'HTML_NEWS_TITLE' => sprintf($user->lang['HTML_NEWS_OF'], $this->html_config['html_sitename']), + 'HTML_NEWS_URL' => $this->html_config['html_allow_news'] ? append_sid($this->html_config['html_url'] . $this->url_config['html_news_default']) : '', + 'NEWS_IMG_SRC' => $this->path_config['gym_img_url'] . 'html_news.gif', + 'ROOT_PATH' => $phpbb_root_path, + )); + $return = $template->assign_display('index_data', '', true); + return $return; + } + /** + * prepare_message($message, $bbcode_uid, $bbcode_bitfield, $patterns = array(), $replaces = array()) + * will put together BBcodes and smilies before the output + * @access private + */ + function prepare_message(&$message, $bbcode_uid, $bitfield, $patterns = array(), $replaces = array()) { + global $config, $user, $phpbb_root_path; + static $bbcode; + if (!empty($patterns)) { + $message = preg_replace($patterns, $replaces, $message); + } + if ($this->html_config['html_sumarize'] > 0 ) { + $message = $this->summarize( $message, $this->html_config['html_sumarize'], $this->html_config['html_sumarize_method'] ); + // Clean broken tag at the end of the message + $message = preg_replace('`\<[^\<\>]*$`i', ' ...', $message); + // Close broken bbcode tags requiring it, only quotes for now + $this->close_bbcode_tags($message, $bbcode_uid); + } + $message = censor_text($message); + if ($bitfield && $this->html_config['html_allow_bbcode']) { + if (!class_exists('bbcode')) { + global $phpbb_root_path, $phpEx; + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + } + if (empty($bbcode)) { + $bbcode = new bbcode($bitfield); + } else { + $bbcode->bbcode($bitfield); + } + $bbcode->bbcode_second_pass($message, $bbcode_uid); + } + $message = bbcode_nl2br($message); + // Parse smilies + $message = $this->smiley_text($message, !$this->html_config['html_allow_smilies']); + if ($this->html_config['html_sumarize'] > 0 ) { + // last clean up + static $_find = array('`\<\!--[^\<\>]+--\>`Ui', '`\[\/?[^\]\[]*\]`Ui'); + $message = preg_replace($_find, '', $message); + } + return true; + } + /** + * close_bbcode_tags(&$message, $uid, $bbcodelist) + * will tend to do it nicely ;-) + * Will close the bbcode tags requiring it in the list (quote|b|u|i|color|*|list) + * Beware, bo not reduce $bbcodelist without knowing what you are doing + */ + function close_bbcode_tags(&$message, $uid, $bbcodelist = 'quote|b|u|i|color|*|list') { + global $config, $user, $phpbb_seo; + $open_lists = $close_lists = array(); + $bbcodelist = str_replace('|*', '|\*', $bbcodelist); + $open_count = preg_match_all('`\[(' . $bbcodelist . ')(\=([a-z0-9]{1}))?[^\]\[]*\:' . $uid . '\]`i', $message, $open_matches); + $close_count = preg_match_all('`\[/(' . $bbcodelist . ')(\:([a-z]{1}))?[^\]\[]*\:' . $uid . '\]`i', $message, $close_matches); + if ($open_count == $close_count) { // No need to go further + return; + } + if (!empty($open_matches[1])) { + $open_list = array_count_values($open_matches[1]); + $close_list = !empty($close_matches[1]) ? array_count_values($close_matches[1]) : array(); + $list_to_close = array(); + if (isset($open_list['list'])) { + foreach ($open_matches[1] as $k => $v) { + if ($v == 'list') { + $open_lists[] = !empty($open_matches[3][$k]) ? 'o' : 'u'; + } + } + if (!empty($close_matches[1])) { + foreach ($close_matches[1] as $k => $v) { + if ($v == 'list') { + $close_lists[] = !empty($close_matches[3][$k]) ? 'o' : 'u'; + } + } + } + $list_to_close = array_reverse(array_diff_assoc($open_lists, $close_lists)); + } + unset($open_list['*'], $open_list['list'], $open_matches, $close_matches); + foreach ($open_list as $bbcode => $total) { + if (empty($close_list[$bbcode]) || $close_list[$bbcode] < $total) { + // close the tags + $diff = empty($close_list[$bbcode]) ? $total : $total - $close_list[$bbcode]; + $message .= str_repeat("[/$bbcode:$uid]", $diff); + } + } + // Close the lists if required + foreach ($list_to_close as $ltype) { + $message .= "[/*:m:$uid][/list:$ltype:$uid]"; + } + } + return; + } + /** + * set_msg_strip($bbcode_list) will build up the unauthed bbcode list + * $bbcode_list = 'code:0,img:1,quote'; + * $bbcode_list = 'all'; + * 1 means the bbcode and it's content will be striped. + * all means all bbcodes. + * $returned_list = array('patern' => $matching_patterns, 'replace' => $replace_patterns); + * @access private + */ + function set_msg_strip($bbcode_list) { + $patterns = $replaces = array(); + // Now the bbcodes + if (!$this->html_config['html_allow_bbcode'] || preg_match('`all\:?([0-1]*)`i', $bbcode_list, $matches)) { + if ( (@$matches[1] != 1 ) ) { + $patterns[] = '`\[\/?[a-z0-9\*\+\-]+(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:[0-9a-z]{5,})\]`i'; + $replaces[] = ''; + } else { + $patterns[] = '`\[([a-z0-9\*\+\-]+)((=|:)[^\:\]]*)?\:[0-9a-z]{5,}\].*\[/(?1)(:?[^\:\]]*)?\:[0-9a-z]{5,}\]`Usi'; + $replaces[] = "{ \\1 }"; + } + $patterns[] = '`<[^>]*>(.*<[^>]*>)?`Usi'; // All html + $replaces[] = ''; + } else { + // Take care about links & emails + if ( !$this->html_config['html_allow_links'] ) { + if ( !$this->html_config['html_allow_emails'] ) { // Saves couple RegEx + $email_find = '[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*[a-z]+'; + $email_replace = 'str_replace(array("@", "."), array(" AT ", " DOT "),"\\1")'; + $email_option = 'e'; + } else { + $email_find = '.*?'; + $email_replace = "\\1"; + $email_option = ''; + } + $patterns[] = '`<!\-\- ([lmw]+) \-\-><a (?:class="[\w-]+" )?href="(.*?)">.*?</a><!\-\- \1 \-\->`i'; + $replaces[] = "\\2"; + $patterns[] = '`\[/?url[^\]\[]*\]`i'; + $replaces[] = ''; + $patterns[] = '`<!\-\- e \-\-><a href="mailto:(' . $email_find . ')">.*?</a><!\-\- e \-\->`i' . $email_option; + $replaces[] = $email_replace; + } + if ( !$this->html_config['html_allow_emails'] && $this->html_config['html_allow_links'] ) { + $patterns[] = '`<!\-\- e \-\-><a href="mailto:([a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*[a-z]+)">.*?</a><!\-\- e \-\->`ei'; + $replaces[] = 'str_replace(array("@", "."), array(" AT ", " DOT "),"\\1")'; + } + $exclude_list = ( empty($bbcode_list) ? array() : explode(',', trim($bbcode_list, ', ')) ); + $RegEx_unset = $RegEx_remove = ''; + foreach ($exclude_list as $key => $value ) { // Group the RegEx + $value = trim($value, ', '); + if (preg_match("`[a-z0-9]+(\:([0-1]*))?`i", $value, $matches) ) { + $values = (strpos($value, ':') !== false) ? explode(':', $value) : array($value); + if ( (@$matches[2] != 1 ) ) { + $RegEx_unset .= (!empty($RegEx_unset) ? '|' : '' ) . $values[0]; + } else { + $RegEx_remove .= (!empty($RegEx_remove) ? '|' : '' ) . $values[0]; + } + } + } + if (!empty($RegEx_remove) ) { + $patterns[] = '`\[(' . $RegEx_remove . ')((=|:)[^\:\]]*)?\:[0-9a-z]{5,}\].*\[/(?1)(:?[^\:\]]*)?\:[0-9a-z]{5,}\]`Usi'; + $replaces[] = "{ \\1 }"; + } + if (!empty($RegEx_unset) ) { + $patterns[] = '`\[/?(' . $RegEx_unset . ')(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:[0-9a-z]{5,})?\]`i'; + $replaces[] = ''; + } + } + return array('pattern' => $patterns, 'replace' => $replaces); + } + /** + * Summarize method selector + * @access private + */ + function summarize($string, $limit, $method = 'lines') { + switch ($method) { + case 'words': + return $this->word_limit($string, $limit); + break; + case 'chars': + return $this->char_limit($string, $limit); + break; + case 'lines': + default: + return $this->line_limit($string, $limit); + break; + } + } + /** + * Cut the text by lines + * @access private + */ + function line_limit($string, $limit = 10, $ellipsis = ' ...') { + return count($lines = preg_split("`[\n\r]+`", ltrim($string), $limit + 1)) > $limit ? rtrim(utf8_substr($string, 0, utf8_strlen($string) - utf8_strlen(end($lines)))) . $ellipsis : $string; + } + /** + * Cut the text according to the number of words. + * Borrowed from www.php.net http://www.php.net/preg_replace + * @access private + */ + function word_limit($string, $limit = 50, $ellipsis = ' ...') { + return count($words = preg_split('`\s+`', ltrim($string), $limit + 1)) > $limit ? rtrim(utf8_substr($string, 0, utf8_strlen($string) - utf8_strlen(end($words)))) . $ellipsis : $string; + } + /** + * Cut the text according to the number of characters. + * Borrowed from www.php.net http://www.php.net/preg_replace + * @access private + */ + function char_limit($string, $limit = 100, $ellipsis = ' ...') { + return utf8_strlen($fragment = utf8_substr($string, 0, $limit + 1 - utf8_strlen($ellipsis))) < utf8_strlen($string) + 1 ? preg_replace('`\s*\S*$`', '', $fragment) . $ellipsis : $string; + } + /** + * Get forum children (one level or all, with or without info) + * @access private + */ + function get_forum_children($forum_id, $skip_pass = true, $only_post = true, $ids_only = true, $one_lvl = true) { + global $db, $auth; + $rows = array(); + $_sql_pre = $one_lvl ? 'f1' : 'f2'; + $sql_sel = $ids_only ? "$_sql_pre.forum_id, $_sql_pre.forum_type, $_sql_pre.forum_password" : "$_sql_pre.*"; + $sql_where = $only_post ? " AND $_sql_pre.forum_type = " . FORUM_POST : ''; + if (!$one_lvl) { + $sql = "SELECT $sql_sel + FROM " . FORUMS_TABLE . " f1 + LEFT JOIN " . FORUMS_TABLE . " f2 ON (f2.left_id BETWEEN f1.left_id AND f1.right_id) + WHERE f1.forum_id = $forum_id + $sql_where + ORDER BY f2.left_id ASC"; + } else { + $sql = "SELECT $sql_sel + FROM " . FORUMS_TABLE . " f1 + WHERE f1.parent_id = $forum_id + $sql_where + ORDER BY f1.left_id ASC"; + } + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { + if ($skip_pass && $row['forum_password']) { + continue; + } + $rows[$row['forum_id']] = $row; + } + + $db->sql_freeresult($result); + // Do not return this forum info + if (!$one_lvl) { + unset($rows[$forum_id]); + } + // only keep authed forum + foreach ($rows as $_forum_id => $null) { + if (!$auth->acl_get('f_read', $_forum_id)) { + unset($rows[$_forum_id]); + } + } + return !empty($rows) ? $rows : false; + } + /** + * Generate topic status + */ + function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$folder_alt, &$topic_type) { + global $user, $config; + $folder = $folder_new = ''; + if ($topic_row['topic_status'] == ITEM_MOVED) { + $topic_type = $user->lang['VIEW_TOPIC_MOVED']; + $folder_img = 'topic_moved'; + $folder_alt = 'TOPIC_MOVED'; + } else { + switch ($topic_row['topic_type']) { + case POST_GLOBAL: + $topic_type = $user->lang['VIEW_TOPIC_GLOBAL']; + $folder = 'global_read'; + $folder_new = 'global_unread'; + break; + case POST_ANNOUNCE: + $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT']; + $folder = 'announce_read'; + $folder_new = 'announce_unread'; + break; + case POST_STICKY: + $topic_type = $user->lang['VIEW_TOPIC_STICKY']; + $folder = 'sticky_read'; + $folder_new = 'sticky_unread'; + break; + default: + $topic_type = ''; + $folder = 'topic_read'; + $folder_new = 'topic_unread'; + if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $topic_row['topic_status'] != ITEM_LOCKED) { + $folder .= '_hot'; + $folder_new .= '_hot'; + } + break; + } + if ($topic_row['topic_status'] == ITEM_LOCKED) { + $topic_type = $user->lang['VIEW_TOPIC_LOCKED']; + $folder .= '_locked'; + $folder_new .= '_locked'; + } + $folder_img = ($unread_topic) ? $folder_new : $folder; + $folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS'); + // Posted image? + if (!empty($topic_row['topic_posted']) && $topic_row['topic_posted']) { + $folder_img .= '_mine'; + } + } + if ($topic_row['poll_start'] && $topic_row['topic_status'] != ITEM_MOVED) { + $topic_type = $user->lang['VIEW_TOPIC_POLL']; + } + } + /** + * Generate topic pagination + * Duplicated here to prevent from including functions_display.php + */ + function topic_generate_pagination($replies, $url) { + global $config, $user; + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + global $phpbb_seo, $phpEx; + // www.phpBB-SEO.com SEO TOOLKIT END + // Make sure $per_page is a valid value + $per_page = ($config['posts_per_page'] <= 0) ? 1 : $config['posts_per_page']; + if (($replies + 1) > $per_page) { + $total_pages = ceil(($replies + 1) / $per_page); + $pagination = ''; + $times = 1; + for ($j = 0; $j < $replies + 1; $j += $per_page) { + $pagination .= '<a href="' . $url . '&start=' . $j . '">' . $times . '</a>'; + if ($times == 1 && $total_pages > 5) { + $pagination .= ' ... '; + // Display the last three pages + $times = $total_pages - 3; + $j += ($total_pages - 4) * $per_page; + } else if ($times < $total_pages) { + $pagination .= '<span class="page-sep">' . $user->lang['COMMA_SEPARATOR'] . '</span>'; + } + $times++; + } + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + if (!empty($phpbb_seo->seo_opt['url_rewrite'])) { + static $pagin_find = array(); + static $pagin_replace = array(); + if (empty($pagin_find)) { + $pagin_find = array( '`(\.(?!' . $phpEx . ')[a-z0-9]+)([\w\#$%&~\-;:=,?@+]*)&start=([0-9]+)`i', '`/([\w\#$%&~\-;:=,?@+]*)&start=([0-9]+)`i' ); + $pagin_replace = array( $phpbb_seo->seo_delim['start'] . '\\3\\1\\2', '/' . $phpbb_seo->seo_static['pagination'] . '\\2' . $phpbb_seo->seo_ext['pagination'] .'\\1' ); + } + $pagination = str_replace( '&start=0', '', $pagination ); + $pagination = preg_replace( $pagin_find, $pagin_replace, $pagination ); + } + // www.phpBB-SEO.com SEO TOOLKIT END + } else { + $pagination = ''; + } + return $pagination; + } + /** + * Get user rank title and image + * + * @param int $user_rank the current stored users rank id + * @param int $user_posts the users number of posts + * @param string &$rank_title the rank title will be stored here after execution + * @param string &$rank_img the rank image as full img tag is stored here after execution + * @param string &$rank_img_src the rank image source is stored here after execution + * + */ + function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src) { + global $ranks, $config, $phpbb_root_path; + if (empty($ranks)) { + global $cache; + $ranks = $cache->obtain_ranks(); + } + if (!empty($user_rank)) { + $rank_title = (isset($ranks['special'][$user_rank]['rank_title'])) ? $ranks['special'][$user_rank]['rank_title'] : ''; + $rank_img = (!empty($ranks['special'][$user_rank]['rank_image'])) ? '<img src="' . $phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] . '" alt="' . $ranks['special'][$user_rank]['rank_title'] . '" title="' . $ranks['special'][$user_rank]['rank_title'] . '" />' : ''; + $rank_img_src = (!empty($ranks['special'][$user_rank]['rank_image'])) ? $phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] : ''; + } else { + if (!empty($ranks['normal'])) { + foreach ($ranks['normal'] as $rank) { + if ($user_posts >= $rank['rank_min']) { + $rank_title = $rank['rank_title']; + $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . $phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; + $rank_img_src = (!empty($rank['rank_image'])) ? $phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image'] : ''; + break; + } + } + } + } + } + /** + * Get user avatar + * + * @param string $avatar Users assigned avatar name + * @param int $avatar_type Type of avatar + * @param string $avatar_width Width of users avatar + * @param string $avatar_height Height of users avatar + * @param string $alt Optional language string for alt tag within image, can be a language key or text + * + * @return string Avatar image + */ + function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR') { + global $user, $config, $phpbb_root_path, $phpEx; + if (empty($avatar) || !$avatar_type) { + return ''; + } + $avatar_img = ''; + switch ($avatar_type) { + case AVATAR_UPLOAD: + $avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar="; + break; + case AVATAR_GALLERY: + $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/'; + break; + } + $avatar_img .= $avatar; + return '<img src="' . $avatar_img . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />'; + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/includes/gym_output.php b/phpBB/gym_sitemaps/includes/gym_output.php new file mode 100644 index 0000000000..3f92db47b5 --- /dev/null +++ b/phpBB/gym_sitemaps/includes/gym_output.php @@ -0,0 +1,374 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: gym_output.php 262 2010-04-20 11:06:58Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +/** +* gym_sitemaps Class +* www.phpBB-SEO.com +* @package GYM Sitemaps & RSS +*/ +class gym_output { + var $options = array(); + var $outputs = array(); + var $cache = array(); + var $gzip_config = array(); + /** + * constuctor + */ + function gym_output(&$gym_master) { + $this->gym_master = &$gym_master; + $this->options = &$this->gym_master->actions; + $this->outputs = &$this->gym_master->output_data; + $this->cache = &$this->gym_master->cache_config; + // Set up and check gzip handling + $this->init_gzip(); + if ($this->outputs['showstats']) { + if ( @function_exists('memory_get_usage') ) { + $this->outputs['mem_usage'] = memory_get_usage(); + } + } + // used to skip cache when auth items are not cached + // initialized after thanks to the & + $this->cache['do_cache'] = true; + } + /** + * do_output() is called when no cache file is available for the request + * Will filter cases, call function to build output and cache on the fly + * @access private + */ + function do_output() { + global $config, $phpEx, $phpbb_seo, $db; + if ($this->outputs['showstats']) { + $this->outputs['gen_data'] = sprintf('%.5f', $phpbb_seo->microtime_float() - $this->outputs['microtime']); + $mem_stats = $this->mem_usage(); + $this->outputs['data'] .= "\n" . sprintf($this->gym_master->style_config['stats_genlist'], $this->outputs['gen_data'], $mem_stats, $db->sql_num_queries(), $this->outputs['url_sofar']); + } + if ($this->cache['cache_enable']) { + $this->write_cache(); + if ($this->check_cache($this->cache['file'])) { + $this->cache_output(); + } else { + $this->otf_output(); + } + } else { + $this->otf_output(); + } + return; + } + /** + * cache_output() is called to output from a cached file + * Build the last stats, send the header and output the cached file + * @access private + */ + function cache_output() { + global $phpbb_seo, $db; + if ($this->outputs['showstats']) { + $this->outputs['gen_out'] = sprintf('%.5f', $phpbb_seo->microtime_float() - $this->outputs['microtime']); + $genstats = sprintf($this->gym_master->style_config['stats_start'], $this->outputs['gen_out'], $db->sql_num_queries()); + } else { + $genstats = ''; + } + if ($this->gzip_config['gzip']) { + $this->send_header(); + readfile($this->cache['file']); + } else { + $this->send_header(); + if ($this->cache['cache_force_gzip']) { + readgzfile($this->cache['file']); + if ($this->outputs['showstats']) { + $this->outputs['gen_out'] = sprintf('%.5f', $phpbb_seo->microtime_float() - $this->outputs['microtime']); + $genstat2 = sprintf($this->gym_master->style_config['stats_end'], $this->outputs['gen_out'], $db->sql_num_queries()); + echo $genstats . $genstat2; + } + } else { + readfile($this->cache['file']); + if ($this->outputs['showstats']) { + $this->outputs['gen_out'] = sprintf('%.5f', $phpbb_seo->microtime_float() - $this->outputs['microtime']); + $genstat2 = sprintf($this->gym_master->style_config['stats_end'], $this->outputs['gen_out'], $db->sql_num_queries()); + echo $genstats . $genstat2; + } + } + } + $this->gym_master->safe_exit(); + return; + } + /** + * otf_output() will do the output on the fly + * when cache disabled or caching failed + * @access private + */ + function otf_output() { + global $lang,$phpbb_seo; + // Unset lang array before output + unset($lang); + if ($this->gzip_config['gzip']) { + $this->outputs['data'] = gzencode($this->outputs['data'], $this->gym_master->gzip_config['gzip_level']); + $this->send_header(); + echo $this->outputs['data']; + unset($this->outputs['data']); + + } else { + $this->send_header(); + echo $this->outputs['data']; + if ($this->outputs['showstats']) { + $mem_stats = $this->mem_usage(); + $this->outputs['gen_out'] = sprintf('%.5f', $phpbb_seo->microtime_float() - $this->outputs['microtime']); + $genstats = sprintf($this->gym_master->style_config['stats_nocache'], $this->outputs['gen_out'], $mem_stats); + echo $genstats; + } + unset($this->outputs['data']); + } + $this->gym_master->safe_exit(); + return; + } + /** + * send_header() takes care about headers + * @access private + */ + function send_header() { + global $user; + if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2')) { + header ('Cache-Control: no-cache, pre-check=0, post-check=0, max-age=0'); + } else { + header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0'); + } + $content_types = array('rss' => 'application/rss+xml', 'google' => 'text/xml', 'yahoo' => 'text/plain'); + if (stripos($user->browser, 'YahooFeedSeeker') === false) { + if ($this->gym_master->actions['action_type'] === 'rss' && ( $this->gym_master->gym_config['rss_xslt'] && $this->gym_master->gym_config['rss_force_xslt'] ) ) { + $content_types['rss'] = 'text/xml'; + } + } + header('Expires: '. $this->outputs['expires_time']); + header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', $this->outputs['last_mod_time'])); + if (!empty($this->outputs['etag'])) { + header('Etag: ' . $this->outputs['etag']); + } + header('Accept-Ranges: bytes'); + header('Content-type: ' . $content_types[$this->gym_master->actions['action_type']] . '; charset=UTF-8'); + if ($this->gzip_config['gzip']) { + header('Content-Encoding: ' . $this->check_gzip_type()); + } + return; + } + + // --> RSS functions <-- + + // --> Cache function <-- + /** + * setup_cache Check and cache set up + * @access private + */ + function setup_cache() { + global $phpbb_seo; + // For module inclusion in ACP : No cache + if ( defined('ADMIN_START') ) { + return; + } + // build cache file name + $ssl_bit = $phpbb_seo->ssl['use'] ? 'ssl_' : ''; + $file_name = ( !empty($this->options['module_sub']) ? $this->options['module_sub'] : '' ) . trim(str_replace(array('&', '/'), '-', $this->options['extra_params_full']),'-') . '-a' . $this->options['auth_param']; + if ($this->gym_master->gym_config['gym_cript_cache']) { + $file_name = md5( $file_name ); + } + $file_name = $this->gym_master->actions['action_type'] . '_' . ( ( !empty($this->options['module_main']) ) ? $this->options['module_main'] . '_' : 'main_' ) . $ssl_bit . $file_name . $this->cache['cache_file_ext']; + $this->cache['file'] = $this->gym_master->path_config['gym_path'] . 'cache/' . $file_name; + // Output, first check cache + if ($this->cache['do_cache'] && $this->check_cache($this->cache['file'])) { + // Check expiration + $this->cache['cache_born'] = filemtime($this->cache['file']); + $this->cache['cache_too_old'] = ($this->cache['cache_born'] + $this->cache['cache_max_age']) <= $this->outputs['time'] ? true : false; + if ($this->cache['cache_too_old'] && $this->cache['cache_auto_regen']) { + @unlink($this->cache['file']); + $this->cache['cached'] = false; + } + } + // Expiration time & Etags + if (!$this->cache['cached'] || !$this->cache['do_cache']) { + // Take care about lastmod when not cached + if (($this->outputs['last_mod_time'] + $this->cache['cache_max_age']) <= $this->outputs['time']) { + $this->outputs['last_mod_time'] = $this->outputs['time']; + $this->outputs['expires_time'] = gmdate('D, d M Y H:i:s \G\M\T', ($this->outputs['time'] + $this->cache['cache_max_age'])); + $this->outputs['etag'] = md5($this->outputs['expires_time'] . $this->cache['file']); + $this->update_lastmod(); + } else { + $this->outputs['expires_time'] = gmdate('D, d M Y H:i:s \G\M\T', ($this->outputs['last_mod_time'] + $this->cache['cache_max_age'])); + $this->outputs['etag'] = md5($this->outputs['expires_time'] . $this->cache['file']); + } + $this->check_mod_since(); + } else { + $this->outputs['last_mod_time'] = $this->cache['cache_born']; + $this->outputs['expires_time'] = gmdate('D, d M Y H:i:s \G\M\T', ($this->outputs['last_mod_time'] + $this->cache['cache_max_age'])); + $this->outputs['etag'] = md5($this->outputs['expires_time'] . $this->cache['file']); + $this->check_mod_since(); + $this->cache_output(); + } + + return; + } + /** + * update_lastmod Update the lastmod date, used when cache is not actvated. + * @access private + */ + function update_lastmod() { + global $config; + $config_name = $this->options['action_type'] . '_' . (!empty($this->options['module_main']) ? $this->options['module_main'] . '_' : '') . 'last_mod_time'; + $config_value = $this->outputs['last_mod_time'] > $config['board_startdate'] ? $this->outputs['last_mod_time'] : $this->outputs['time']; + set_config($config_name, $config_value, 1); + + return; + } + /** + * mem_usage() + * @access private + */ + function mem_usage() { + if (function_exists('memory_get_usage')) { + if ($memory_usage = memory_get_usage()) { + $memory_usage -= $this->outputs['mem_usage']; + $memory_usage = ($memory_usage >= 1048576) ? round((round($memory_usage / 1048576 * 100) / 100), 2) . ' MB' : (($memory_usage >= 1024) ? round((round($memory_usage / 1024 * 100) / 100), 2) . ' Kb' : $memory_usage . ' b'); + return "( Mem Usage : $memory_usage )"; + } + } + return ''; + } + /** + * check_mod_since() will exit with 304 Not Modified header + * and exit upon HTTP_IF_MODIFIED_SINCE or HTTP_IF_NONE_MATCH Checks + * @access private + */ + function check_mod_since() { + if ($this->cache['mod_since']) { + $http = 'HTTP/1.1 '; + if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { + if ($_SERVER['HTTP_IF_NONE_MATCH'] == $this->outputs['etag']) { + header($http . ' 304 Not Modified'); + $this->gym_master->safe_exit(); + } + } + if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { + if (strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $this->outputs['last_mod_time']) { + header($http . ' 304 Not Modified'); + $this->gym_master->safe_exit(); + } + } + } + return; + } + /** + * check_cache($file) will tell if the required file exists. + * @access private + */ + function check_cache($file) { + if(!$this->cache['cache_enable']) { + $this->cache['cached'] = false; + return false; + } + if(!@file_exists($file)) { + $this->cache['cached'] = false; + return false; + } + $this->cache['cached'] = true; + return true; + } + /** + * write_cache( $action, $id = 0 ) will write the cached file. + * @access private + */ + function write_cache() { + if(!$this->cache['cache_enable'] or !$this->cache['do_cache']) { + return false; + } + $file = $this->cache['file']; + if ($this->gzip_config['gzip'] || $this->cache['cache_force_gzip']) { + $handle = @gzopen($file, 'wb'); + @flock($handle, LOCK_EX); + @gzwrite($handle, $this->outputs['data']); + @flock($handle, LOCK_UN); + @gzclose ($handle); + } else { + $handle = @fopen($file, 'wb'); + @flock($handle, LOCK_EX); + @fwrite($handle, $this->outputs['data']); + @flock($handle, LOCK_UN); + @fclose ($handle); + } + $this->update_lastmod(); + @umask(0000); + @chmod($file, 0666); + return true; + } + // --> Gun-Zip handeling <-- + /** + * init_gzip (). + * Check if gzip is available and set proper values for this event + * if phpBB gun-zip is acvtivated, then it must be in the module + * @access private + */ + function init_gzip() { + global $config; + $this->gzip_config['gzip'] = $config['gzip_compress'] ? 1 : intval($this->gym_master->set_module_option('gzip', $this->gym_master->override['gzip'])); + // if gunzip is only activated for GYM, we turn it on for phpBB also + if ($this->gzip_config['gzip'] && !$config['gzip_compress']) { + $config['gzip_compress'] = 1; + } + if (!$this->check_gzip() && $this->gzip_config['gzip']) { + $this->gzip_config['gzip'] = false; + } + $this->gym_master->url_config['gzip_ext_out'] = $this->gzip_config['gzip'] ? '.gz' : ''; + $this->gym_master->url_config['gzip_ext_out'] = (intval($this->gym_master->set_module_option('gzip_ext', $this->gym_master->override['gzip'])) > 0) ? $this->gym_master->url_config['gzip_ext_out'] : ''; + $this->check_requested_ext(); + return; + } + /** + * check_gzip() tells is Gun-Zip is available + * @access private + */ + function check_gzip() { + if (headers_sent()) { + return false; + } + if (!empty($_SERVER['HTTP_ACCEPT_ENCODING']) && ( (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !==false ) || strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !==false ) ) { + return true; + } else { + return false; + } + return; + } + /** + * check_gzip_type() return the user's Gun-Zip type + * @access private + */ + function check_gzip_type() { + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip') !==false ) { + return 'gzip'; + } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !==false ) { + return 'x-gzip'; + } + return 'gzip'; + } + /** + * check_requested_ext($uri) will force the .gz extention if required + * @access private + */ + function check_requested_ext() { + global $phpbb_seo, $phpEx; + return; + $uri = $phpbb_seo->seo_path['uri']; + if ( ( strpos($phpbb_seo->seo_path['uri'], '.gz') !== false ) && ($this->ext_config['gzip_ext_out'] == '') && !strpos($uri, $phpEx)) { + $uri = str_replace ('.gz', "", $uri); + $url= $this->path_config['root_url'] . ltrim($uri, '/'); + $this->gym_master->gym_redirect($url); + } elseif ( ( strpos($uri, '.gz') === false ) && ($this->ext_config['gzip_ext_out'] != '') && !strpos($uri, $phpEx)) { + $uri = $uri . '.gz'; + $url= $this->path_config['root_url'] . ltrim($uri, '/'); + $this->gym_master->gym_redirect($url); + } + return; + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/includes/gym_rss.php b/phpBB/gym_sitemaps/includes/gym_rss.php new file mode 100644 index 0000000000..853f585b33 --- /dev/null +++ b/phpBB/gym_sitemaps/includes/gym_rss.php @@ -0,0 +1,715 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: gym_rss.php 272 2010-11-21 13:56:31Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +require_once($phpbb_root_path . 'gym_sitemaps/includes/gym_sitemaps.' . $phpEx); +/** +* gym_rss Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class gym_rss extends gym_sitemaps { + var $rss_config = array(); + /** + * constuctor + */ + function gym_rss() { + global $phpbb_seo, $phpEx, $config, $user; + global $db, $auth; + $this->gym_sitemaps('rss'); + // init output + $this->output_data['showstats'] = (boolean) ($this->gym_config['gym_showstats'] || $this->gym_config['rss_showstats']); + // Check the main vars + $this->init_get_vars(); + // url without IDs like forum feed url in case the phpBB SEO mod are used and set so + // and basic parameter for url such as blabla/news/digest/long/module-rss.xml => gymrss.php?module=blabla&news&digest&long + if ( isset($_GET['nametoid']) && !empty($_GET['nametoid']) && isset($_GET['modulename']) && !empty($_GET['modulename']) && empty($this->actions['module_main']) && empty($this->actions['module_sub']) ) { + $module_name = trim(strtolower($_GET['modulename'])); + // is the module available ? + if (in_array($module_name, $this->actions['action_modules'])) { + $this->actions['module_main'] = $module_name; + // Do we get an id (?module=id) + if ($id = @array_search(trim($_GET['nametoid']), $phpbb_seo->cache_config[$module_name]) ) { + $this->actions['module_sub'] = intval($id); + } else { // Pass the variable to the script ?module_name=$_GET['nametoid'] + $this->actions['module_sub'] = trim(utf8_htmlspecialchars(str_replace(array("\n", "\r"), '', $_GET['nametoid']))); + } + } + + } + if (empty($this->actions['action_modules'])) { + $this->gym_error(404, '', __FILE__, __LINE__); + } + // Set last mod time from DB, will only be used as his for general feeds and channel lists + // put it into phpbb config for the dynamic property. + $config_name = $this->actions['action_type'] . '_' . (!empty($this->actions['module_main']) ? $this->actions['module_main'] . '_' : '') . 'last_mod_time'; + if (@$config[$config_name] < $config['board_startdate']) { + set_config($config_name, $user->time_now, 1); + } + $this->output_data['last_mod_time'] = intval($config[$config_name]); + // Init the output class + $this->gym_init_output(); + // Setup the output + $this->cache_config = array_merge( + // Global + $this->cache_config, + // Other stuff required here + array( + 'cache_enable' => (boolean) $this->set_module_option('cache_on', $this->override['cache']), + 'cache_auto_regen' => (boolean) $this->set_module_option('cache_auto_regen', $this->override['cache']), + 'cache_force_gzip' => (boolean) $this->set_module_option('cache_force_gzip', $this->override['cache']), + 'cache_born' => $this->output_data['last_mod_time'], + 'cache_max_age' => round($this->set_module_option('cache_max_age', $this->override['cache']),2) * 3600, + 'cache_file_ext' => ( $this->gym_output->gzip_config['gzip'] || $this->gym_config['rss_cache_force_gzip'] ) ? '.xml.gz' : '.xml', + ) + ); + // Can you believe it, sprintf is faster than straight parsing. + $this->style_config = array( + 'rss_header' => '<'.'?xml version="1.0" encoding="utf-8"?'.'>%s' . "\n" . '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"' . "\n\t" . 'xmlns:content="http://purl.org/rss/1.0/modules/content/"' . "\n\t" . 'xmlns:atom="http://www.w3.org/2005/Atom">' . "\n" . '<!-- Generated by Google Yahoo MSN Sitemaps and RSS %s - © 2006, ' . date('Y') . ' www.phpBB-SEO.com -->', + 'rss_footer' => "\n\t" . '</channel>' . "\n" . '</rss>', + 'rss_item_tpl' => "\n\t\t" . '<item>' . "\n\t\t\t" . '<title>%1$s</title>'. "\n\t\t\t" . '<link>%2$s</link>%3$s' . "\n\t\t\t" . '<description>%4$s</description>%8$s' . "\n\t\t\t" . '<source url="%5$s">%6$s</source>' . "\n\t\t\t" . '<guid isPermaLink="true">%7$s</guid>' . "\n\t\t" . '</item>', + 'rsschan_tpl' => "\n\t" . '<channel>' . "\n\t\t" . '<title>%1$s</title>' . "\n\t\t" . '<link>%2$s</link>' . "\n\t\t" . '<description>%3$s</description>%4$s' . "\n\t\t" . '%5$s' . "\n\t\t" . '<docs>http://blogs.law.harvard.edu/tech/rss</docs>' . "\n\t\t" . '<generator>Google Yahoo MSN Sitemaps and RSS ' . $this->gym_config['gym_version'] . ' - © 2006, ' . date('Y') . ' www.phpBB-SEO.com</generator>%6$s' . "\n\t\t" . '<atom:link href="%7$s" rel="self" type="application/rss+xml" />%8$s', + 'rsschan_input_tpl' => "\n\t\t" . '<textInput>' . "\n\t\t\t" . '<title>%1$s</title>' . "\n\t\t\t" . '<description>%2$s</description>' . "\n\t\t\t" . '<link>%3$s</link>' . "\n\t\t\t" . '<name>%4$s</name>' . "\n\t\t" . '</textInput>' . "\n", + 'rsschan_img_tpl' => '<image>' . "\n\t\t\t" . '<title>%1$s</title>' . "\n\t\t\t" . '<url>%2$s</url>' . "\n\t\t\t" . '<link>%3$s</link>' . "\n\t\t" . '</image>', + 'chan_lastbuildate_tpl' => "\n\t\t" . '<lastBuildDate>%1$s</lastBuildDate>', + 'chan_ttl_tpl' => "\n\t\t" . '<ttl>%1$s</ttl>', + 'item_pubdate_tpl' => "\n\t\t\t" . '<pubDate>%1$s</pubDate>', + 'item_creator_tpl' => "\n\t\t\t" . '<dc:creator>%1$s</dc:creator>', + 'xslt_style' => '', + 'stats_genlist' => "\n" . '<!-- URL list generated in %s s %s - %s sql - %s URLs listed -->', + 'stats_start' => "\n" . '<!-- Output started from cache after %s s - %s sql -->', + 'stats_nocache' => "\n" . '<!-- Output ended after %s s %s -->', + 'stats_end' => "\n" . '<!-- Output from cache ended up after %s s - %s sql -->', + ); + $rss_limit_time = (int) $this->set_module_option('limit_time', $this->override['limit']); + $rss_lang = trim($this->set_module_option('lang', $this->gym_config['rss_override'])); + $this->rss_config = array( 'rss_c_info' => ( !empty($this->gym_config['rss_c_info'])) ? "\n\t\t" . '<copyright>' . $this->xml_encode($this->gym_config['rss_c_info']) . '</copyright>' : '', + 'rss_xslt' => ( $this->gym_config['rss_xslt'] ) ? true : false, + 'rss_force_xslt' => ( $this->gym_config['rss_xslt'] && $this->gym_config['rss_force_xslt'] ) ? true : false, + 'rss_lang' => ( !empty($rss_lang) ) ? "\n\t\t" . '<language>' . $this->xml_encode($rss_lang) . '</language>' : '', + 'rss_url' => $phpbb_seo->sslify($this->gym_config['rss_url'], $phpbb_seo->ssl['use'], false), + 'rss_yahoo_appid' => ( !empty($this->gym_config['rss_yahoo_appid']) ) ? trim($this->gym_config['rss_yahoo_appid']) : '', + // module specific settings we should often need in module + // Some are used here to filter the allowed actions, will go to main default if unset in the module + 'rss_url_limit' => (int) $this->set_module_option('url_limit', $this->override['limit']), + 'rss_sql_limit' => (int) $this->set_module_option('sql_limit', $this->override['limit']), + 'rss_limit_time' => ( $rss_limit_time >= 0 ) ? $rss_limit_time*3600*24 : 0, + 'rss_modrewrite' => (int) $this->set_module_option('modrewrite', $this->override['modrewrite']), + 'rss_modrtype' => (int) $this->set_module_option('modrtype', $this->override['modrewrite']), + 'rss_sitename' => $this->set_module_option('sitename'), + 'rss_site_desc' => $this->set_module_option('site_desc'), + 'rss_logo_url' => $this->path_config['gym_img_url'] . trim($this->set_module_option('logo_url'), '/'), + 'rss_image_url' => $this->path_config['gym_img_url'] . trim($this->set_module_option('image_url'), '/'), + 'rss_sort' => $this->set_module_option('sort', $this->override['sort']), + 'rss_allow_auth' => (boolean) $this->set_module_option('allow_auth', $this->gym_config['rss_override']), + 'rss_cache_auth' => (boolean) $this->set_module_option('cache_auth', $this->gym_config['rss_override']), + 'rss_allow_content' => (boolean) $this->set_module_option('allow_content', $this->gym_config['rss_override']), + 'rss_allow_news' => (boolean) $this->set_module_option('allow_news', $this->gym_config['rss_override']), + 'rss_news_update' => round($this->set_module_option('news_update', $this->gym_config['rss_override']), 2) * 3600, + 'rss_allow_profile' => (boolean) $this->set_module_option('allow_profile', $this->gym_config['rss_override']), + 'rss_allow_profile_links' => (boolean) $this->set_module_option('allow_profile_links', $this->gym_config['rss_override']), + 'rss_sumarize' => (int) $this->set_module_option('sumarize', $this->gym_config['rss_override']), + 'rss_sumarize_method' => trim($this->set_module_option('sumarize_method', $this->gym_config['rss_override'])), + 'rss_allow_short' => (boolean) $this->set_module_option('allow_short', $this->gym_config['rss_override']), + 'rss_allow_long' => (boolean) $this->set_module_option('allow_long', $this->gym_config['rss_override']), + 'rss_allow_bbcode' => (boolean) $this->set_module_option('allow_bbcode', $this->gym_config['rss_override']), + 'rss_strip_bbcode' => trim($this->set_module_option('strip_bbcode', $this->gym_config['rss_override'])), + 'rss_allow_links' => (boolean) $this->set_module_option('allow_links', $this->gym_config['rss_override']), + 'rss_allow_emails' => (boolean) $this->set_module_option('allow_emails', $this->gym_config['rss_override']), + 'rss_allow_smilies' => (boolean) $this->set_module_option('allow_smilies', $this->gym_config['rss_override']), + 'rss_yahoo_notify' => (boolean) $this->set_module_option('yahoo_notify', $this->gym_config['rss_override']), + 'rss_nohtml' => (boolean) $this->set_module_option('nohtml', $this->gym_config['rss_override']), + //@TODO add acp option for this ? + 'rss_display_author' => /*(boolean) $this->set_module_option('display_author', $this->gym_config['rss_override'])*/ true, + 'rss_yahoo_notify_url' => '', + 'rss_msg_filters' => array(), + 'rss_auth_msg' => '', + 'rss_do_explain' => false, + ); + $this->rss_config['rss_auth_guest'] = ($this->rss_config['rss_allow_auth'] && $user->data['is_registered']) ? false : true; + $this->cache_config['do_cache'] = $this->rss_config['rss_auth_guest'] ? true : $this->rss_config['rss_cache_auth']; + // remind for later + $this->rss_config['rss_profile_mode'] = $this->rss_config['rss_allow_profile_links'] ? 'full' : 'no_profile'; + // Check the rss specific vars and do basic set_up for msg output + $this->init_rss_vars(); + + if (!$this->rss_config['rss_auth_guest']) { + $this->rss_config['rss_auth_msg'] = "\n" . ( ($this->actions['rss_channel_list'] || empty($this->actions['module_sub']) || $this->actions['module_sub'] == 'channels') ? sprintf($user->lang['RSS_AUTH_SOME_USER'], $user->data['username'] ) : sprintf($user->lang['RSS_AUTH_THIS_USER'], $user->data['username'] ) ) . "\n"; + } + // Are we going to explain ? + if (!empty($_REQUEST['explain']) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report')) { + $this->rss_config['rss_do_explain'] = true; + $this->cache_config['do_cache'] = false; + } + $this->rss_output(); + if ($this->rss_config['rss_do_explain']) { + $db->sql_report('display'); + } else { + $this->gym_output->do_output(); + } + return; + } + /** + * init_rss_vars() + * Set up the specific rss modules GET vars. + * @access private + */ + function init_rss_vars() { + global $user, $phpEx, $phpbb_seo; + // Let's now check out if it's a GYM 1.x URL + if ($this->gym_config['rss_1xredir'] && !empty($_GET['gym1x'])) { + $this->actions['gym1x_newurl'] = '/' . (isset($_GET['m']) ? 'digest/' : '' ) . (isset($_GET['l']) ? 'long/' : (isset($_GET['s']) ? 'short/' : '' ) ); + $this->actions['gym1x_newurl'] = empty($this->actions['module_main']) ? 'rss' . $this->actions['gym1x_newurl'] . 'rss.xml' : (empty($_GET['gymtitle']) ? 'rss' . $this->actions['gym1x_newurl'] . (!empty($this->actions['module_sub']) ? $this->actions['module_sub'] . '/' : '' ) . $this->actions['module_main'] . '.xml' : $phpbb_seo->set_url($_GET['gymtitle'], (int) $this->actions['module_sub'], 'forum') . $this->actions['gym1x_newurl'] . $this->actions['module_main'] . '.xml'); + // nothing else needed for this + return; + + } + $this->actions['rss_content'] = $this->actions['rss_short_list'] = $this->actions['rss_long_list'] = $this->actions['rss_channel_list'] = $this->actions['rss_news_list'] = false; + $this->rss_config['extra_title'] = $this->url_config['extra_params_full'] = $this->url_config['extra_params'] = ''; + $this->url_config['rss_announces_path'] = $phpbb_seo->seo_static['global_announce'] . '/'; + // Channel list + if ( ( $module_sub_chan = ($this->actions['module_sub'] === 'channels' ? true : false) ) || (isset($_GET['channels']) && empty($this->actions['module_main']) ) ) { + $this->actions['rss_channel_list'] = true; + $this->rss_config['extra_title'] = ' - ' . $user->lang['RSS_CHAN_LIST_TITLE']; + if ($this->rss_config['rss_modrewrite'] || !$module_sub_chan) { + $this->url_config['extra_params_full'] .= 'channels/'; + } + } + // News = first message only + if ( isset($_GET['news']) && $this->rss_config['rss_allow_news']) { + $this->actions['rss_news_list'] = true; + $this->rss_config['extra_title'] .= ' - ' . $user->lang['RSS_NEWS']; + $this->url_config['extra_params_full'] .= 'news/'; + $this->url_config['extra_params'] .= 'news/'; + if (!empty($this->rss_config['rss_news_update'])) { + $this->cache_config['cache_max_age'] = $this->rss_config['rss_news_update']; + } + unset($_GET['channels']); // no channel listing + } + // Do we output text ? + if ( isset($_GET['digest']) && $this->rss_config['rss_allow_content'] ) { + $this->actions['rss_content'] = true; + $this->rss_config['extra_title'] .= ' - ' . $user->lang['RSS_CONTENT']; + $this->url_config['extra_params_full'] .= 'digest/'; + $this->url_config['extra_params'] .= 'digest/'; + $this->rss_config['rss_url_limit'] = intval($this->set_module_option('url_limit_msg', $this->gym_config['rss_override'])); + $this->rss_config['rss_sql_limit'] = intval($this->set_module_option('sql_limit_msg', $this->gym_config['rss_override'])); + } + // Custom limits short + if ( isset($_GET['short']) && $this->rss_config['rss_allow_short'] ) { + $this->actions['rss_short_list'] = true; + $this->rss_config['extra_title'] .= ' - ' . $user->lang['RSS_SHORT']; + $this->url_config['extra_params_full'] .= 'short/'; + $this->url_config['extra_params'] .= 'short/'; + $this->rss_config['rss_url_limit'] = $this->actions['rss_content'] ? intval($this->rss_config['rss_url_limit']/3) : intval($this->set_module_option('url_limit_short', $this->gym_config['rss_override'])); + $this->rss_config['rss_sql_limit'] = $this->actions['rss_content'] ? intval($this->rss_config['rss_url_limit']/2) : intval($this->set_module_option('sql_limit_short', $this->gym_config['rss_override'])); + } + // Custom limits long + if ( isset($_GET['long']) && !$this->actions['rss_short_list'] && $this->rss_config['rss_allow_long'] ) { + $this->actions['rss_long_list'] = true; + $this->rss_config['extra_title'] .= ' - ' . $user->lang['RSS_LONG']; + $this->url_config['extra_params_full'] .= 'long/'; + $this->url_config['extra_params'] .= 'long/'; + $this->rss_config['rss_url_limit'] = $this->actions['rss_content'] ? intval($this->rss_config['rss_url_limit']*3) : intval($this->set_module_option('url_limit_long', $this->gym_config['rss_override'])); + $this->rss_config['rss_sql_limit'] = $this->actions['rss_content'] ? intval($this->rss_config['rss_url_limit']*2) : intval($this->set_module_option('sql_limit_long', $this->gym_config['rss_override'])); + } + // Adjust variable a bit + if ($this->actions['rss_content'] ) { // requested and auth + $this->rss_config['rss_msg_filters'] = $this->set_msg_strip($this->rss_config['rss_strip_bbcode']); + } + $this->url_config['extra_params_delimE'] = $this->url_config['extra_paramsE'] = ''; + $this->url_config['extra_params_delimQ'] = $this->url_config['extra_paramsQ'] = ''; + $this->url_config['rss_vpath'] = ''; + if ($this->rss_config['rss_modrewrite']) { + $this->actions['extra_params'] = $this->url_config['extra_params']; + $this->actions['extra_params_full'] = $this->url_config['extra_params_full']; + $this->url_config['extra_params_delimE'] = '/'; + $this->url_config['extra_params_delimQ'] = '?'; + $this->url_config['rss_vpath'] = 'rss/'; // virtual rss path for forum RSS feed URLs etc ... + $this->url_config['rss_default'] = 'rss.xml' . $this->url_config['gzip_ext_out'] ; + if (!empty($this->url_config['extra_params'])) { + $this->url_config['extra_paramsE'] = $this->url_config['extra_params']; + $this->url_config['extra_paramsQ'] = $this->url_config['extra_params_delimQ'] . $this->url_config['extra_params']; + } + } else { + $this->url_config['extra_params'] = str_replace('/', '&', trim($this->url_config['extra_params'], '/')); + $this->actions['extra_params_full'] = str_replace('/', '&', trim($this->url_config['extra_params_full'], '/')); + $this->url_config['extra_params_delimE'] = '&'; + $this->url_config['extra_params_delimQ'] = '?'; + if (!empty($this->url_config['extra_params'])) { + $this->url_config['extra_paramsE'] = $this->url_config['extra_params_delimE'] . $this->url_config['extra_params']; + $this->url_config['extra_paramsQ'] = $this->url_config['extra_params_delimQ'] . $this->url_config['extra_params']; + } + } + } + /** + * forum_rss_url() builds rss forum url with proper options + * Suffixe is not added here, to properly deal with pagination + */ + function forum_rss_url($forum_name, $forum_id) { + global $phpbb_seo; + return !empty($phpbb_seo->cache_config['forum'][$forum_id]) ? $phpbb_seo->cache_config['forum'][$forum_id] : $phpbb_seo->format_url( $forum_name, 'forum' ) . $this->url_config['rss_forum_delim'] . $forum_id; + } + /** + * rss_output() will build all rss output + * @access private + */ + function rss_output() { + global $phpEx, $db, $config, $phpbb_root_path, $user, $phpbb_seo; + // Initialize SQL cycling : do not query for more than required + $this->rss_config['rss_sql_limit'] = ($this->rss_config['rss_sql_limit'] > $this->rss_config['rss_url_limit']) ? $this->rss_config['rss_url_limit'] : $this->rss_config['rss_sql_limit']; + // XSLT styling + if ($this->rss_config['rss_xslt']) { + // here we could go further and allow user style to be used, would need to parse the cache a bit, + // but, unlike Google sitemaps, RSS feeds are decently small for that. + $this->style_config['xslt_style'] = "\n" . '<'.'?xml-stylesheet type="text/xsl" href="' . $phpbb_seo->seo_path['phpbb_url'] . 'gym_sitemaps/gym_style.' . $phpEx . '?action-rss,type-xsl,lang-' . $config['default_lang'] . ',theme_id-' . $config['default_style'] . '" media="screen, projection" ?'.'>'; + $blanc_fix = ''; + if ($this->rss_config['rss_force_xslt']) { + // FF 2 and IE7 only look for the first 500 chars to decide if it's rss or not + // and impose their private styling + for ($i=0; $i<550; $i++) { + $blanc_fix .= ' '; + } + $blanc_fix = "\n" . '<!-- Some spaces ' . $blanc_fix . ' to force xlst -->'; + } + $this->style_config['xslt_style'] .= $blanc_fix; + } + // Remove guid for channels + if ($this->actions['rss_channel_list']) { + $this->style_config['rss_item_tpl'] = str_replace("\n\t\t\t" . '<guid isPermaLink="true">%s</guid>', '', $this->style_config['rss_item_tpl']); + } + // custom url transition message + if (!empty($this->actions['gym1x_newurl'])) { + $chan_title = $user->lang['RSS_1XREDIR'] . ' - ' . $this->gym_config['rss_sitename']; + $chan_desc = $user->lang['RSS_1XREDIR_MSG'] . ' : ' . $this->parse_link($this->actions['gym1x_newurl']) . "\n" . $this->gym_config['rss_site_desc']; + $rss_new_url = $this->rss_config['rss_url'] . $this->actions['gym1x_newurl']; + $this->output_data['data'] = sprintf($this->style_config['rss_header'], $this->style_config['xslt_style'], $this->gym_config['gym_version'] ); + $this->parse_channel($chan_title, $chan_desc, $rss_new_url, $this->output_data['last_mod_time'], $this->rss_config['rss_image_url'], $rss_new_url); + $this->parse_item($chan_title, $chan_desc, $rss_new_url, $rss_new_url, '', $this->output_data['last_mod_time']); + $this->output_data['data'] .= $this->style_config['rss_footer']; + return; + } + // module action + if (in_array($this->actions['module_main'], $this->actions['action_modules'])) { // List item from the module + $module_class = $this->actions['action_type'] . '_' . $this->actions['module_main']; + $this->load_module($module_class, 'rss_module'); + if ( empty($this->output_data['url_sofar']) ) { + $this->gym_error(404, 'GYM_TOO_FEW_ITEMS', __FILE__, __LINE__); + } + $this->output_data['data'] = sprintf($this->style_config['rss_header'], $this->style_config['xslt_style'], $this->gym_config['gym_version'] ) . $this->output_data['data'] . $this->style_config['rss_footer']; + } else { // Add items from installed modules + $site_title = $this->gym_config['rss_sitename']; + $site_desc = $this->gym_config['rss_site_desc'] . "\n"; + if ($this->actions['rss_channel_list']) { + $chan_source = $this->rss_config['rss_url'] . $this->url_config['rss_vpath'] . (($this->rss_config['rss_modrewrite']) ? (!empty($this->url_config['extra_params']) ? $this->url_config['extra_params'] : '') : $this->url_config['rss_default'] . $this->url_config['extra_params_delimQ'] . $this->actions['extra_params_full']); + $site_title_full = $site_title . $this->rss_config['extra_title']; + $site_desc .= $user->lang['RSS_CHAN_LIST_DESC'] . "\n"; + } else { + $chan_source = $this->rss_config['rss_url'] . $this->url_config['rss_vpath'] . (($this->rss_config['rss_modrewrite']) ? (!empty($this->url_config['extra_params']) ? $this->url_config['extra_params'] : '') . $this->url_config['rss_default'] : $this->url_config['rss_default'] . $this->url_config['extra_paramsQ']); + $site_title_full = $site_title . $this->rss_config['extra_title']; + } + $this->seo_kill_dupes($chan_source); + $this->parse_channel($site_title_full, $site_desc, $this->rss_config['rss_url'], $this->output_data['last_mod_time'], $this->rss_config['rss_image_url'], $chan_source); + // Since we are going to cycle through modules, we need to ajust URL limit and counting a bit + // URL limit, we take the last xx items from each feed + // where xx is the URL limit divided by the number of feeds + $this->rss_config['rss_url_limit'] = !empty($this->actions['action_modules']) ? intval($this->rss_config['rss_url_limit'] / count($this->actions['action_modules'])) : 0; + if ( empty($this->rss_config['rss_url_limit']) ) { + $this->gym_error(404, 'GYM_TOO_FEW_ITEMS', __FILE__, __LINE__); + } + // start the modules + // We are working on all available modules + $this->load_modules('rss_main'); + $this->output_data['url_sofar'] = $this->output_data['url_sofar_total']; + if ( empty($this->output_data['url_sofar']) ) { + $this->gym_error(404, 'GYM_TOO_FEW_ITEMS', __FILE__, __LINE__); + } + $this->output_data['data'] = sprintf($this->style_config['rss_header'], $this->style_config['xslt_style'], $this->gym_config['gym_version'] ) . $this->output_data['data'] . $this->style_config['rss_footer']; + } + if ( $this->rss_config['rss_yahoo_notify'] && ($this->output_data['time'] >= ($this->cache_config['cache_born'] + $this->cache_config['cache_max_age'])) ) { + $this->rss_yahoo_notify(); + } + return; + } + /** + * parse_channel() adds the channel info to the output + */ + function parse_channel($chan_title, $chan_desc, $chan_link, $lastBuildDate = 0, $chan_image = '', $chan_source = '') { + global $config, $user; + // Misc SQL Explain + global $auth; + if ( !empty($chan_source) && $auth->acl_get('a_') && defined('DEBUG_EXTRA')) { + if (!empty($_REQUEST['explain'])) { + return; + } + if (empty($user->lang['GYM_SQLEXPLAIN_MSG'])) { + $user->add_lang('gym_sitemaps/gym_common'); + } + $report_url = $chan_source . (strpos($chan_source, '?') !== false ? '&' : '?') . 'explain=1'; + $this->actions['sql_report_msg'] = "\n<i style=\"color:#CC0000\">" . sprintf($user->lang['GYM_SQLEXPLAIN_MSG'], $this->parse_link($report_url , $user->lang['GYM_SQLEXPLAIN'])) . '</i>'; + } + $lastBuildDate = intval($lastBuildDate); + if ( $lastBuildDate > $config['board_startdate']) { + $this->output_data['last_mod_time'] = $lastBuildDate; + if (( $this->cache_config['cache_max_age'] + $lastBuildDate) <= $this->output_data['time']) { + $ttl_time = (int) ($this->cache_config['cache_max_age'] / 60); + } else { + $ttl_time = ( $this->cache_config['cache_max_age'] + $lastBuildDate) - $this->output_data['time']; + } + $ttl = sprintf($this->style_config['chan_ttl_tpl'], intval( ( $ttl_time / 60)) ); + $lastBuildDate = sprintf($this->style_config['chan_lastbuildate_tpl'], gmdate('D, d M Y H:i:s \G\M\T', intval($lastBuildDate))); + } else { + $lastBuildDate = ''; + $ttl = ''; + } + $chan_image = !empty($chan_image) ? sprintf($this->style_config['rsschan_img_tpl'], $this->xml_encode($chan_title), $chan_image, $chan_link) : ''; + $input = !empty($chan_source) ? sprintf($this->style_config['rsschan_input_tpl'], $this->xml_encode($user->lang['RSS_2_LINK'] . ' : ' . $chan_title), $this->xml_encode($chan_desc . $user->lang['RSS_2_LINK']), $chan_source, 'gym_sitemaps') : ''; + + $this->output_data['data'] .= sprintf($this->style_config['rsschan_tpl'], $this->xml_encode($chan_title), $chan_link, $this->xml_encode($chan_desc . $this->rss_config['rss_auth_msg'] . $this->actions['sql_report_msg']), $lastBuildDate, $chan_image, $ttl, $chan_source, $input); + } + /** + * parse_item() adds the item info to the output + */ + function parse_item($item_title, $item_desc, $item_link, $item_source, $item_source_title = '', $pubDate = 0, $author = false) { + global $config; + $pubDate = $pubDate > $config['board_startdate'] ? sprintf($this->style_config['item_pubdate_tpl'], gmdate('D, d M Y H:i:s \G\M\T', intval($pubDate))) : ''; + $item_desc = $this->rss_config['rss_nohtml'] ? strip_tags($item_desc) : $item_desc; + $item_source_title = !empty($item_source_title) ? $item_source_title : $item_title; + $author = $author ? sprintf($this->style_config['item_creator_tpl'], $this->xml_encode($author)) : ''; + $this->output_data['data'] .= sprintf($this->style_config['rss_item_tpl'], $this->xml_encode($item_title), $item_link, $pubDate, $this->xml_encode($item_desc . $this->rss_config['rss_auth_msg']), $item_source, $this->xml_encode($item_source_title), $item_link, $author); + $this->output_data['url_sofar']++; + } + /** + * prepare_for_output($topic, $key = '') + * will put together BBcodes and smilies before the output + * @param array $topic + * @access private + */ + function prepare_for_output($topic, $key = '') { + global $config, $user, $phpbb_seo; + static $bbcode; + static $patterns; + static $replaces; + $bbcode_uid = $topic['bbcode_uid' . $key]; + $bitfield = $topic['bbcode_bitfield' . $key]; + $message_title = !empty($topic['post_subject' . $key]) ? $topic['post_subject' . $key] : $topic['topic_title']; + $message_title = censor_text($message_title); + $message = '<b>' . $message_title . '</b>' . "\n\n" . $topic['post_text' . $key]; + if (!isset($patterns)) { + if ( !empty($this->rss_config['rss_msg_filters']['pattern']) ) { + $patterns = $this->rss_config['rss_msg_filters']['pattern']; + $replaces = $this->rss_config['rss_msg_filters']['replace']; + } else { + $patterns = $replaces = array(); + } + } + if (!empty($patterns)) { + $message = preg_replace($patterns, $replaces, $message); + } + if ($this->rss_config['rss_sumarize'] > 0 ) { + $message = $this->summarize( $message, $this->rss_config['rss_sumarize'], $this->rss_config['rss_sumarize_method'] ); + // Clean broken tag at the end of the message + $message = preg_replace('`\<[^\<\>]*$`i', ' ...', $message); + // Close broken bbcode tags requiring it + $this->close_bbcode_tags($message, $bbcode_uid); + } + $message = censor_text($message); + if (!$this->rss_config['rss_nohtml']) { + if ($bitfield && $this->rss_config['rss_allow_bbcode']) { + if (!class_exists('bbcode')) { + global $phpbb_root_path, $phpEx; + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + } + if (empty($bbcode)) { + $bbcode = new bbcode($bitfield); + } else { + $bbcode->bbcode($bitfield); + } + if ( !$this->rss_config['rss_allow_links'] ) { + $message = preg_replace("`\[/?url(=.*)?\]`i", "", $message); + } + $bbcode->bbcode_second_pass($message, $bbcode_uid); + } + // Parse smilies + $message = $this->smiley_text($message, !($this->rss_config['rss_allow_smilies'] && $topic['enable_smilies' . $key])); + if ($this->rss_config['rss_sumarize'] > 0 ) { + // last clean up + static $_find = array('`\<\!--[^\<\>]+--\>`Ui', '`\[\/?[^\]\[]*\]`Ui'); + $message = preg_replace($_find, '', $message); + $message .= "\n\n" . '<a href="' . $topic['topic_url' . $key] . '"><b>' . $user->lang['RSS_MORE'] . ' ...</b></a>'. "\n\n"; + } + } else { + $message = strip_tags(preg_replace('`\[\/?[^\]\[]*\]`Ui', '', $message)); + } + return "\n" . $message; + } + /** + * close_bbcode_tags(&$message, $uid, $bbcodelist) + * will tend to do it nicely ;-) + * Will close the bbcode tags requiring it in the list (quote|b|u|i|color|*|list) + * Beware, bo not reduce $bbcodelist without knowing what you are doing + */ + function close_bbcode_tags(&$message, $uid, $bbcodelist = 'quote|b|u|i|color|*|list') { + global $config, $user, $phpbb_seo; + $open_lists = $close_lists = array(); + $bbcodelist = str_replace('|*', '|\*', $bbcodelist); + $open_count = preg_match_all('`\[(' . $bbcodelist . ')(\=([a-z0-9]{1}))?[^\]\[]*\:' . $uid . '\]`i', $message, $open_matches); + $close_count = preg_match_all('`\[/(' . $bbcodelist . ')(\:([a-z]{1}))?[^\]\[]*\:' . $uid . '\]`i', $message, $close_matches); + if ($open_count == $close_count) { // No need to go further + return; + } + if (!empty($open_matches[1])) { + $open_list = array_count_values($open_matches[1]); + $close_list = !empty($close_matches[1]) ? array_count_values($close_matches[1]) : array(); + $list_to_close = array(); + if (isset($open_list['list'])) { + foreach ($open_matches[1] as $k => $v) { + if ($v == 'list') { + $open_lists[] = !empty($open_matches[3][$k]) ? 'o' : 'u'; + } + } + if (!empty($close_matches[1])) { + foreach ($close_matches[1] as $k => $v) { + if ($v == 'list') { + $close_lists[] = !empty($close_matches[3][$k]) ? 'o' : 'u'; + } + } + } + $list_to_close = array_reverse(array_diff_assoc($open_lists, $close_lists)); + } + unset($open_list['*'], $open_list['list']); + foreach ($open_list as $bbcode => $total) { + if (empty($close_list[$bbcode]) || $close_list[$bbcode] < $total) { + // close the tags + $diff = empty($close_list[$bbcode]) ? $total : $total - $close_list[$bbcode]; + $message .= str_repeat("[/$bbcode:$uid]", $diff); + } + } + // Close the lists if required + foreach ($list_to_close as $ltype) { + $message .= "[/*:m:$uid][/list:$ltype:$uid]"; + } + } + return; + } + /** + * set_msg_strip($bbcode_list) will build up the unauthed bbcode list + * $bbcode_list = 'code:0,img:1,quote'; + * $bbcode_list = 'all'; + * 1 means the bbcode and it's content will be striped. + * all means all bbcodes. + * $returned_list = array('patern' => $matching_patterns, 'replace' => $replace_patterns); + * @access private + */ + function set_msg_strip($bbcode_list) { + $patterns = $replaces = array(); + // Now the bbcodes + if (!$this->rss_config['rss_allow_bbcode'] || preg_match('`all\:?([0-1]*)`i', $bbcode_list, $matches)) { + if ( (@$matches[1] != 1 ) ) { + $patterns[] = '`\[\/?[a-z0-9\*\+\-]+(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:[0-9a-z]{5,})\]`i'; + $replaces[] = ''; + } else { + $patterns[] = '`\[([a-z0-9\*\+\-]+)((=|:)[^\:\]]*)?\:[0-9a-z]{5,}\].*\[/(?1)(:?[^\:\]]*)?\:[0-9a-z]{5,}\]`Usi'; + $replaces[] = "{ \\1 }"; + } + $patterns[] = '`<[^>]*>(.*<[^>]*>)?`Usi'; // All html + $replaces[] = ''; + } else { + // Take care about links & emails + if ( !$this->rss_config['rss_allow_links'] ) { + if ( !$this->rss_config['rss_allow_emails'] ) { // Saves couple RegEx + $email_find = '[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*[a-z]+'; + $email_replace = 'str_replace(array("@", "."), array(" AT ", " DOT "),"\\1")'; + $email_option = 'e'; + } else { + $email_find = '.*?'; + $email_replace = "\\1"; + $email_option = ''; + } + $patterns[] = '`<!\-\- ([lmw]+) \-\-><a (?:class="[\w-]+" )?href="(.*?)">.*?</a><!\-\- \1 \-\->`i'; + $replaces[] = "\\2"; + $patterns[] = '`\[/?url[^\]\[]*\]`i'; + $replaces[] = ''; + $patterns[] = '`<!\-\- e \-\-><a href="mailto:(' . $email_find . ')">.*?</a><!\-\- e \-\->`i' . $email_option; + $replaces[] = $email_replace; + } + if ( !$this->rss_config['rss_allow_emails'] && $this->rss_config['rss_allow_links'] ) { + $patterns[] = '`<!\-\- e \-\-><a href="mailto:([a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*[a-z]+)">.*?</a><!\-\- e \-\->`ei'; + $replaces[] = 'str_replace(array("@", "."), array(" AT ", " DOT "),"\\1")'; + } + $exclude_list = ( empty($bbcode_list) ? array() : explode(',', $bbcode_list) ); + $RegEx_unset = $RegEx_remove = ''; + foreach ($exclude_list as $key => $value ) { // Group the RegEx + $value = trim($value); + if (preg_match("`[a-z0-9]+(\:([0-1]*))?`i", $value, $matches) ) { + $values = (strpos($value, ':') !== false) ? explode(':', $value) : array($value); + if ( (@$matches[2] != 1 ) ) { + $RegEx_unset .= (!empty($RegEx_unset) ? '|' : '' ) . $values[0]; + } else { + $RegEx_remove .= (!empty($RegEx_remove) ? '|' : '' ) . $values[0]; + } + } + } + if (!empty($RegEx_remove) ) { + $patterns[] = '`\[(' . $RegEx_remove . ')((=|:)[^\:\]]*)?\:[0-9a-z]{5,}\].*\[/(?1)(:?[^\:\]]*)?\:[0-9a-z]{5,}\]`Usi'; + $replaces[] = "{ \\1 }"; + } + if (!empty($RegEx_unset) ) { + $patterns[] = '`\[/?(' . $RegEx_unset . ')(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:[0-9a-z]{5,})\]`i'; + $replaces[] = ''; + } + } + return array('pattern' => $patterns, 'replace' => $replaces); + } + /** + * Some text formating functions for text output + * un_htmlspecialchars() + * @access private + */ + function un_htmlspecialchars($text) { + return preg_replace(array('#>#', '#<#', '#"#', '#&#'), array('>', '<', '"', '&'), $text); + } + /** + * Summarize method selector + * @access private + */ + function summarize($string, $limit, $method = 'lines') { + switch ($method) { + case 'words': + return $this->word_limit($string, $limit); + break; + case 'chars': + return $this->char_limit($string, $limit); + break; + case 'lines': + default: + return $this->line_limit($string, $limit); + break; + } + } + /** + * Cut the text by lines + * @access private + */ + function line_limit($string, $limit = 10, $ellipsis = ' ...') { + return count($lines = preg_split("`[\n\r]+`", ltrim($string), $limit + 1)) > $limit ? rtrim(utf8_substr($string, 0, utf8_strlen($string) - utf8_strlen(end($lines)))) . $ellipsis : $string; + } + /** + * Cut the text according to the number of words. + * Borrowed from www.php.net http://www.php.net/preg_replace + * @access private + */ + function word_limit($string, $limit = 50, $ellipsis = ' ...') { + return count($words = preg_split('`\s+`', ltrim($string), $limit + 1)) > $limit ? rtrim(utf8_substr($string, 0, utf8_strlen($string) - utf8_strlen(end($words)))) . $ellipsis : $string; + } + /** + * Cut the text according to the number of characters. + * Borrowed from www.php.net http://www.php.net/preg_replace + * @access private + */ + function char_limit($string, $limit = 100, $ellipsis = ' ...') { + return utf8_strlen($fragment = utf8_substr($string, 0, $limit + 1 - utf8_strlen($ellipsis))) < utf8_strlen($string) + 1 ? preg_replace('`\s*\S*$`', '', $fragment) . $ellipsis : $string; + } + + // --> Yahoo! Notification functions <-- + /** + * rss_yahoo_notify($url) will handle yahoo notification of new content + * @access private + */ + function rss_yahoo_notify($url = '') { + global $user, $config, $phpbb_seo; + $url = !empty($url) ? str_replace('&', '&', $url) : (!empty($this->url_config['rss_yahoo_notify_url']) ? $this->url_config['rss_yahoo_notify_url'] : ''); + $url = trim($url); + if (empty($url) || !$this->rss_config['rss_yahoo_notify'] || empty($this->rss_config['yahoo_appid'])) { + return; + } + // No more than 200 pings a day! + if (@$config['gym_pinged_today'] > 200) { + // @TODO add logs about this ? + return; + } + $skip = array('://localhost', '://127.0.0.1', '://192.168.', '://169.254.'); + foreach ($skip as $_skip) { + if (utf8_strpos($url, $_skip) !== false) { + // @TODO add logs about this ? + return; + } + } + // If ssl is not forced, always ping with http urls + $url = $phpbb_seo->sslify($url, $phpbb_seo->ssl['forced']); + $not_curl= true; + $timout = 3; + // The Yahoo! Web Services request + // Based on the Yahoo! developper hints : http://developer.yahoo.com/php/ + $request = "http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=" . urlencode($this->rss_config['yahoo_appid']) . '&url=' . urlencode($url); + if (function_exists('curl_exec')) { + $not_curl= false; + // Initialize the session + $session = curl_init($request); + // Set curl options + curl_setopt($session, CURLOPT_HEADER, false); + curl_setopt($session, CURLOPT_USERAGENT, 'GYM Sitemaps & RSS / www.phpBB-SEO.com'); + curl_setopt($session, CURLOPT_TIMEOUT, $timout); + curl_setopt($session, CURLOPT_RETURNTRANSFER, true); + // Make the request + $response = curl_exec($session); + // Close the curl session + curl_close($session); + // Get HTTP Status code from the response + $status_codes = array(); + preg_match('/\d\d\d/', $response, $status_code); + $status_code = $status_codes[0]; + // Get the XML from the response, bypassing the header + if (!($xml = strstr($response, '<?xml'))) { + $xml = null; + $not_curl= true; + } + } else if ( $not_curl && function_exists('file_get_contents') ) { + ini_set('user_agent','GYM Sitemaps & RSS / www.phpBB-SEO.com'); + ini_set('default_socket_timeout', $timout); + // Make the request + if ($xml = file_get_contents($request)) { + // Retrieve HTTP status code + list($version,$status_code,$msg) = explode(' ',$http_response_header[0], 3); + } else { + // $user->lang['RSS_YAHOO_NO_METHOD'] = sprintf($user->lang['RSS_YAHOO_NO_METHOD'], $request, $xml); + $this->gym_error(503, 'RSS_YAHOO_NO_METHOD', __FILE__, __LINE__); + } + } + // Check the XML return message + // Do it this way here in case curl actually returned no header + // but did get the proper answer. + if (!strpos($xml, 'success')) { + // Check the HTTP Status code + switch( $status_code ) { + case 200: // Success + set_config('gym_pinged_today', @$config['gym_pinged_today'] + 1, 1); + break; + case 503: + $this->gym_error(500, 'RSS_YAHOO_503', __FILE__, __LINE__); + break; + case 403: + $this->gym_error(500, 'RSS_YAHOO_403', __FILE__, __LINE__); + break; + case 400: + // $user->lang['RSS_YAHOO_400_MSG'] = sprintf($user->lang['RSS_YAHOO_400_MSG'], $request, $xml); + $this->gym_error(500,'RSS_YAHOO_400', __FILE__, __LINE__); + break; + default: + // $user->lang['RSS_YAHOO_ERROR_MSG'] = sprintf($user->lang['RSS_YAHOO_400_MSG'], $status_code, $request, $xml); + $this->gym_error(500, 'RSS_YAHOO_500', __FILE__, __LINE__); + } + } + return; + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/includes/gym_rss_functions.php b/phpBB/gym_sitemaps/includes/gym_rss_functions.php new file mode 100644 index 0000000000..2c566e806a --- /dev/null +++ b/phpBB/gym_sitemaps/includes/gym_rss_functions.php @@ -0,0 +1,435 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: gym_rss_functions.php 275 2010-11-21 17:48:06Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +define('GYM_RSS_FUNC_INC', true); +/** +* get_gym_links($gym_config). +* retunrs the link array +*/ +function get_gym_links($gym_config) { + global $phpbb_root_path, $config, $phpEx, $user, $cache, $db, $phpbb_seo; + $links = array(); + $_phpbb_seo = !empty($phpbb_seo); + $board_url = $_phpbb_seo ? $phpbb_seo->seo_path['phpbb_url'] : generate_board_url() . '/'; + $gym_link_tpl = '<a href="%1$s" title="%3$s" class="gym"><img src="' . $board_url . 'gym_sitemaps/images/%2$s" alt="%3$s" width="14", height="14"/> %3$s</a>'; + $google_threshold = max(1, (int) $gym_config['google_threshold']); + //compute guest auth + $cache_file = '_gym_auth_guests_forum'; + if (($auth_guest_list = $cache->get($cache_file)) === false) { + $auth_guest_list = array('list' => array(), 'read' => array(), 'list_post' => array(), 'read_post' => array(), 'skip_pass' => array(), 'skip_cat' => array(), 'skip_all' => array(), 'skip_link' => array(), 'thresholded' => array(), 'empty' => array()); + $guest_data = array('user_id' => ANONYMOUS, + 'user_type' => USER_IGNORE, + 'user_permissions' . (defined('XLANG_AKEY') ? XLANG_AKEY : '') => '', + ); + $g_auth = new auth(); + $g_auth->acl($guest_data); + // the forum id array + $forum_list_ary = $g_auth->acl_getf('f_list', true); + foreach ($forum_list_ary as $forum_id => $null) { + $auth_guest_list['list'][$forum_id] = (int) $forum_id; + } + $forum_read_ary = $g_auth->acl_getf('f_read', true); + foreach ($forum_read_ary as $forum_id => $null) { + $auth_guest_list['read'][$forum_id] = (int) $forum_id; + } + ksort($auth_guest_list['list']); + ksort($auth_guest_list['read']); + $sql = "SELECT forum_id, forum_type, forum_password + FROM " . FORUMS_TABLE . " + WHERE forum_type <> " . FORUM_POST . " OR forum_password <> ''"; + $result = $db->sql_query($sql); + while ( $row = $db->sql_fetchrow($result) ) { + $forum_id = (int) $row['forum_id']; + if ($row['forum_password']) { + $auth_guest_list['skip_pass'][$forum_id] = $forum_id; + } + if ($row['forum_type'] == FORUM_CAT) { + $auth_guest_list['skip_cat'][$forum_id] = $forum_id; + } else if ($row['forum_type'] == FORUM_LINK) { + $auth_guest_list['skip_link'][$forum_id] = $forum_id; + } + $auth_guest_list['skip_all'][$forum_id] = $forum_id; + } + $db->sql_freeresult($result); + // Now let's grabb the list of forum with not enough topics to have a sitemap + // Only care about postable forum ;-) + $sql = "SELECT forum_id, forum_topics + FROM " . FORUMS_TABLE . " + WHERE forum_type = " . FORUM_POST . " + AND forum_topics < $google_threshold"; + $result = $db->sql_query($sql); + while ( $row = $db->sql_fetchrow($result) ) { + $forum_id = (int) $row['forum_id']; + $auth_guest_list['thresholded'][$forum_id] = $forum_id; + if (empty($row['forum_topics'])) { + $auth_guest_list['empty'][$forum_id] = $forum_id; + } + } + ksort($auth_guest_list['skip_pass']); + ksort($auth_guest_list['skip_all']); + ksort($auth_guest_list['skip_link']); + ksort($auth_guest_list['skip_cat']); + // Never mind about forum links + $auth_guest_list['read'] = array_diff_assoc($auth_guest_list['read'], $auth_guest_list['skip_link']); + $auth_guest_list['list'] = array_diff_assoc($auth_guest_list['list'], $auth_guest_list['skip_link']); + ksort($auth_guest_list['read']); + ksort($auth_guest_list['list']); + $auth_guest_list['list_post'] = array_diff_assoc($auth_guest_list['list'], $auth_guest_list['skip_all']); + $auth_guest_list['read_post'] = array_diff_assoc($auth_guest_list['read'], $auth_guest_list['skip_all']); + $cache->put($cache_file, $auth_guest_list); + } + $links = array(); + $links['main'] = $links['setup']['google'] = $links['setup']['rss'] = $links['setup']['html'] = array(); + // Find out about active modes + $google_active = $rss_active = $html_active = false; + $gym_modules = array( + 'google' => array('forum', 'xml', 'txt'), + 'rss' => array('forum'), + 'html' => array('forum'), + ); + foreach ($gym_modules as $type => $modules) { + foreach ($modules as $module) { + if (!empty($gym_config[$type . '_' . $module . '_installed'])) { + ${$type . '_active'} = true; + break; + } + } + } + $do_display_cat = $do_display_main = $do_display_index = false; + // Google sitemaps + if ($google_active) { + $display_google_main_links = (boolean) get_gym_option('google', 'gym', 'link_main', OVERRIDE_MODULE, $gym_config); + $display_google_index_links = (boolean) get_gym_option('google', 'gym', 'link_index', OVERRIDE_MODULE, $gym_config); + $display_google_cat_links = (boolean) get_gym_option('google', 'gym', 'link_cat', OVERRIDE_MODULE, $gym_config); + $override_google_mod_rewrite = get_override('google', 'modrewrite', $gym_config); + $google_mod_rewrite = (boolean) get_gym_option('google', 'gym', 'modrewrite', $override_google_mod_rewrite, $gym_config); + $override_google_gzip = get_override('google', 'gzip', $gym_config); + $google_gzip = (boolean) get_gym_option('google', 'forum', 'gzip', $override_google_gzip, $gym_config); + $google_gzip_ext = ($google_gzip || $config['gzip_compress']) ? (get_gym_option('google', 'forum', 'gzip_ext', $override_google_gzip, $gym_config) ? '.gz' : '') : ''; + $google_url = $_phpbb_seo ? $phpbb_seo->sslify($gym_config['google_url'], $phpbb_seo->ssl['use'], false) : $gym_config['google_url']; + $sitemap_url = $google_url . ($google_mod_rewrite ? 'sitemapindex.xml' . $google_gzip_ext : "sitemap.$phpEx"); + $links['setup']['google'] = array( + 'override_mod_rewrite' => $override_google_mod_rewrite, + 'mod_rewrite' => $google_mod_rewrite, + 'override_gzip' => $override_google_gzip, + 'link_main' => $display_google_main_links, + 'link_index' => $display_google_index_links, + 'link_cat' => $display_google_cat_links, + 'gzip' => $google_gzip, + 'gzip_ext' => $google_gzip_ext, + 'google_url' => $google_url, + 'threshold' => max(1, (int) $gym_config['google_threshold']), + 'l_google_sitemap' => $user->lang['GOOGLE_SITEMAP'], + 'l_google_sitemap_of' => $user->lang['GOOGLE_MAP_OF'], + ); + // only publicly readable and not thresholded forums will be listed + if (!empty($gym_config['google_forum_installed'])) { + $google_forum_mod_rewrite = (boolean) get_gym_option('google', 'forum', 'modrewrite', $override_google_mod_rewrite, $gym_config); + $google_auth_guest = array_diff_assoc($auth_guest_list['read_post'], set_exclude_list($gym_config['google_forum_exclude']), $auth_guest_list['thresholded']); + $google_forum_exclude = set_exclude_list($gym_config['google_forum_exclude']) + $auth_guest_list['skip_all']; + $links['setup']['google'] = array_merge( $links['setup']['google'], + array( + 'forum_google' => true, + 'forum_cat_google' => $google_url . ($google_forum_mod_rewrite && $_phpbb_seo ? "%1\$s.xml$google_gzip_ext" : "sitemap.$phpEx?forum=%2\$s"), + 'auth_guest' => $google_auth_guest, + 'forum_exclude' => $google_forum_exclude, + )); + } + $links['main'] = array_merge( $links['main'], + array( + 'GYM_GOOGLE_TITLE' => $user->lang['GOOGLE_SITEMAPINDEX'], + 'GYM_GOOGLE_URL' => $sitemap_url, + 'GYM_GOOGLE_LINK' => $display_google_main_links ? sprintf($gym_link_tpl, $sitemap_url, 'sitemap-icon.gif', $user->lang['GOOGLE_SITEMAPINDEX']) : '', + 'GYM_GOOGLE_THRESOLD' => (int) $links['setup']['google']['threshold'], + )); + $do_display_main = $display_google_main_links ? true : $do_display_main; + $do_display_index = $display_google_index_links ? true : $do_display_index; + $do_display_cat = $display_google_cat_links ? true : $do_display_cat; + } + // RSS + if ($rss_active) { + $display_rss_main_links = (boolean) get_gym_option('rss', 'gym', 'link_main', OVERRIDE_MODULE, $gym_config); + $display_rss_index_links = (boolean) get_gym_option('rss', 'gym', 'link_index', OVERRIDE_MODULE, $gym_config); + $display_rss_cat_links = (boolean) get_gym_option('rss', 'gym', 'link_cat', OVERRIDE_MODULE, $gym_config); + $override_rss_mod_rewrite = get_override('rss', 'modrewrite', $gym_config); + $rss_mod_rewrite = (boolean) get_gym_option('rss', 'gym', 'modrewrite', $override_rss_mod_rewrite, $gym_config); + $rss_modrtype = max(0, (int) get_gym_option('rss', 'gym', 'modrtype', $override_rss_mod_rewrite, $gym_config)); + $override_rss_gzip = get_override('rss', 'gzip', $gym_config); + $rss_gzip = (boolean) get_gym_option('rss', 'forum', 'gzip', $override_rss_gzip, $gym_config); + $rss_gzip_ext = ($rss_gzip || $config['gzip_compress']) ? (get_gym_option('rss', 'forum', 'gzip_ext', $override_rss_gzip, $gym_config) ? '.gz' : '') : ''; + // Take car of linking type + $link_type_sep = $rss_mod_rewrite ? '/' : '&'; + $link_type_to_options = array('n' => 'news', 'nd' => 'news'. $link_type_sep . 'digest', 'r' => '', 'rd' => 'digest'); + $link_type_bit = isset($link_type_to_options[$gym_config['rss_linking_type']]) ? $link_type_to_options[$gym_config['rss_linking_type']] : ''; + $rss_url = $_phpbb_seo ? $phpbb_seo->sslify($gym_config['rss_url'], $phpbb_seo->ssl['use'], false) : $gym_config['rss_url']; + $rss_main_url = $rss_url . ($rss_mod_rewrite ? 'rss/' . ($link_type_bit ? $link_type_bit . '/' : '') . 'rss.xml' . $rss_gzip_ext : "gymrss.$phpEx" . ($link_type_bit ? '?' . $link_type_bit : '')); + $rss_chan_url = $rss_url . ($rss_mod_rewrite ? 'rss/' . ($link_type_bit ? $link_type_bit . '/' : '') : "gymrss.$phpEx?channels" . ($link_type_bit ? '&' . $link_type_bit : '')); + $links['setup']['rss'] = array( + 'display_alternate' => (int) $gym_config['rss_alternate'], + 'link_main' => $display_rss_main_links, + 'link_index' => $display_rss_index_links, + 'link_cat' => $display_rss_cat_links, + 'override_mod_rewrite' => $override_rss_mod_rewrite, + 'mod_rewrite' => $rss_mod_rewrite, + 'override_gzip' => $override_rss_gzip, + 'gzip' => $rss_gzip, + 'gzip_ext' => $rss_gzip_ext, + 'rss_url' => $rss_url, + 'l_rss_feed' => $user->lang['RSS_FEED'], + 'l_rss_feed_of' => $user->lang['RSS_FEED_OF'], + ); + if (!empty($gym_config['rss_forum_installed'])) { + $rss_forum_allow_auth = (boolean) get_gym_option('rss', 'forum', 'allow_auth', $gym_config['rss_override'], $gym_config); + // only readable forums can be listed + $rss_auth_guest = array_diff_assoc($auth_guest_list['read_post'], set_exclude_list($gym_config['rss_forum_exclude']), $auth_guest_list['empty']); + $rss_forum_exclude = set_exclude_list($gym_config['rss_forum_exclude']) + $auth_guest_list['skip_all'] + $auth_guest_list['empty']; + $rss_forum_mod_rewrite = (boolean) get_gym_option('rss', 'forum', 'modrewrite', $override_rss_mod_rewrite, $gym_config); + $rss_forum_modrtype = max(0, (int) get_gym_option('rss', 'forum', 'modrtype', $override_rss_mod_rewrite, $gym_config)); + + $links['setup']['rss'] = array_merge( $links['setup']['rss'], + array( + 'display_forum_alternate' => (int) $gym_config['rss_forum_alternate'], + 'forum_rss' => !empty($gym_config['rss_forum_installed']), + 'forum_cat_rss' => $rss_url . ($rss_forum_mod_rewrite && $_phpbb_seo ? ($rss_forum_modrtype > 1 ? "%1\$s/" . ($link_type_bit ? $link_type_bit . '/' : '') . "forum.xml$rss_gzip_ext" : "forum" . $phpbb_seo->seo_delim['forum'] . "%2\$s/" . ($link_type_bit ? $link_type_bit . '/' : '') . "forum.xml$rss_gzip_ext") : "gymrss.$phpEx?forum=%2\$s" . ($link_type_bit ? '&' . $link_type_bit : '')), + 'auth_guest' => $rss_auth_guest, + 'forum_exclude' => $rss_forum_exclude, + 'forum_allow_auth' => $rss_forum_allow_auth, + )); + } + $links['main'] = array_merge( $links['main'], + array( + 'GYM_RSS_TITLE' => $user->lang['RSS_FEED'], + 'GYM_RSS_URL' => $rss_main_url, + 'GYM_RSS_LINK' => $display_rss_main_links ? sprintf($gym_link_tpl, $rss_main_url, 'feed-icon.png', $user->lang['RSS_FEED']) : '', + 'GYM_RSS_CHAN_TITLE' => $user->lang['RSS_CHAN_LIST_TITLE'], + 'GYM_RSS_CHAN_URL' => $rss_chan_url, + 'GYM_RSS_CHAN_LINK' => $display_rss_main_links ? sprintf($gym_link_tpl, $rss_chan_url, 'feed-icon.png', $user->lang['RSS_CHAN_LIST_TITLE']) : '', + )); + $do_display_main = $display_rss_main_links ? true : $do_display_main; + $do_display_index = $display_rss_index_links ? true : $do_display_index; + $do_display_cat = $display_rss_cat_links ? true : $do_display_cat; + } + // HTML + if ($html_active) { + $display_html_main_links = (boolean) get_gym_option('html', 'gym', 'link_main', OVERRIDE_MODULE, $gym_config); + $display_html_index_links = (boolean) get_gym_option('html', 'gym', 'link_index', OVERRIDE_MODULE, $gym_config); + $display_html_cat_links = (boolean) get_gym_option('html', 'gym', 'link_cat', OVERRIDE_MODULE, $gym_config); + $override_html_mod_rewrite = get_override('html', 'modrewrite', $gym_config); + $html_mod_rewrite = (boolean) get_gym_option('html', 'gym', 'modrewrite', $override_html_mod_rewrite, $gym_config); + $html_allow_map = (boolean) $gym_config['html_allow_map']; + $html_allow_cat_map = (boolean) $gym_config['html_allow_cat_map']; + $html_allow_news = (boolean) $gym_config['html_allow_news']; + $html_allow_cat_news = (boolean) $gym_config['html_allow_cat_news']; + $html_url = $_phpbb_seo ? $phpbb_seo->sslify($gym_config['html_url'], $phpbb_seo->ssl['use'], false) : $gym_config['html_url']; + $html_map_url = $gym_config['html_allow_map'] ? $html_url . ($html_mod_rewrite ? 'maps/' : "map.$phpEx") : ''; + $html_news_url = $gym_config['html_allow_news'] ? $html_url . ($html_mod_rewrite ? 'news/' : "map.$phpEx?news") : ''; + $links['setup']['html'] = array( + 'link_main' => $display_html_main_links, + 'link_index' => $display_html_index_links, + 'link_cat' => $display_html_cat_links, + 'override_mod_rewrite' => $override_html_mod_rewrite, + 'mod_rewrite' => $html_mod_rewrite, + 'html_url' => $html_url, + 'allow_map' => $html_allow_map, + 'allow_news' => $html_allow_news, + 'allow_cat_map' => $html_allow_cat_map, + 'allow_cat_news' => $html_allow_cat_news, + 'l_html_news' => $user->lang['HTML_NEWS'], + 'l_html_map' => $user->lang['HTML_MAP'], + 'l_html_news_of' => $user->lang['HTML_NEWS_OF'], + 'l_html_map_of' => $user->lang['HTML_MAP_OF'], + ); + if (!empty($gym_config['html_forum_installed'])) { + $html_forum_mod_rewrite = (boolean) get_gym_option('html', 'forum', 'modrewrite', $override_html_mod_rewrite, $gym_config); + $html_forum_allow_map = (boolean) get_gym_option('html', 'forum', 'allow_map', $gym_config['html_override'], $gym_config); + $html_forum_allow_cat_map = (boolean) get_gym_option('html', 'forum', 'allow_cat_map', $gym_config['html_override'], $gym_config); + $html_forum_allow_news = (boolean) get_gym_option('html', 'forum', 'allow_news', $gym_config['html_override'], $gym_config); + $html_forum_allow_cat_news = (boolean) get_gym_option('html', 'forum', 'allow_cat_news', $gym_config['html_override'], $gym_config); + $html_auth_guest = array_diff_assoc($auth_guest_list['list'], set_exclude_list($gym_config['html_forum_exclude']), $auth_guest_list['empty']); + $html_forum_allow_auth = (boolean) get_gym_option('html', 'forum', 'allow_auth', $gym_config['html_override'], $gym_config); + $html_forum_exclude = set_exclude_list($gym_config['html_forum_exclude']) + $auth_guest_list['skip_link'] + $auth_guest_list['empty']; + $links['setup']['html'] = array_merge( $links['setup']['html'], + array( + 'forum_allow_map' => $html_forum_allow_map, + 'forum_map_url' => $html_allow_map ? $html_url . ($html_forum_mod_rewrite ? 'maps/forum/' : "map.$phpEx?forum") : '', + 'forum_allow_news' => $html_forum_allow_news, + 'forum_news_url' => $html_allow_news ? $html_url . ($html_forum_mod_rewrite ? 'news/forum/' : "map.$phpEx?forum=news") : '', + 'forum_allow_cat_map' => $html_forum_allow_cat_map, + 'forum_cat_map' => $html_url . ($html_forum_mod_rewrite && $_phpbb_seo ? 'maps/forum/%1$s/' : "map.$phpEx?forum=%2\$s"), + 'forum_allow_cat_news' => $html_forum_allow_cat_news, + 'forum_cat_news' => $html_url . ($html_forum_mod_rewrite && $_phpbb_seo ? 'news/forum/%1$s/' : "map.$phpEx?forum=%2\$s&news"), + 'auth_guest' => $html_auth_guest, + 'forum_exclude' => $html_forum_exclude, + 'forum_allow_auth' => $html_forum_allow_auth, + )); + } + $links['main'] = array_merge( $links['main'], + array( + 'GYM_HTML_NEWS_TITLE' => $user->lang['HTML_NEWS'], + 'GYM_HTML_NEWS_URL' => $html_news_url, + 'GYM_HTML_NEWS_LINK' => $display_html_main_links ? sprintf($gym_link_tpl, $html_news_url, 'html_news.gif', $user->lang['HTML_NEWS']) : '', + 'GYM_HTML_MAP_TITLE' => $user->lang['HTML_MAP'], + 'GYM_HTML_MAP_URL' => $html_map_url, + 'GYM_HTML_MAP_LINK' => $display_html_main_links ? sprintf($gym_link_tpl, $html_map_url, 'maps-icon.gif', $user->lang['HTML_MAP']) : '', + 'GYM_HTML_THEFORUM_NEWS_TITLE' => $user->lang['HTML_FORUM_NEWS'], + 'GYM_HTML_THEFORUM_NEWS_URL' => $links['setup']['html']['forum_news_url'], + 'GYM_HTML_THEFORUM_NEWS_LINK' => sprintf($gym_link_tpl, $links['setup']['html']['forum_news_url'], 'html_news.gif', $user->lang['HTML_FORUM_NEWS']), + 'GYM_HTML_THEFORUM_MAP_TITLE' => $user->lang['HTML_FORUM_MAP'], + 'GYM_HTML_THEFORUM_MAP_URL' => $links['setup']['html']['forum_map_url'], + 'GYM_HTML_THEFORUM_MAP_LINK' => sprintf($gym_link_tpl, $links['setup']['html']['forum_map_url'], 'maps-icon.gif', $user->lang['HTML_FORUM_MAP']), + )); + $do_display_main = $display_html_main_links ? true : $do_display_main; + $do_display_index = $display_html_index_links ? true : $do_display_index; + $do_display_cat = $display_html_cat_links ? true : $do_display_cat; + } + $links['setup']['main'] = array( + 'link_main' => ($gym_config['gym_link_main'] && $do_display_main) ? 1 : 0, + 'link_index' => ($gym_config['gym_link_index'] && $do_display_index) ? 1 : 0, + 'link_cat' => ($gym_config['gym_link_cat'] && $do_display_cat) ? 1 : 0, + 'f_public_read' => array_diff_assoc($auth_guest_list['read'], $auth_guest_list['skip_pass']) + array_intersect_assoc($auth_guest_list['skip_cat'], $auth_guest_list['list']), + ); + $links['main'] = array_merge( $links['main'], + array( + 'GYM_LINKS' => $links['setup']['main']['link_main'], + 'GYM_LINKS_CAT' => $links['setup']['main']['link_cat'], + )); + $links['alternate'] = array(); + if (!empty($links['setup']['rss']['display_alternate'])) { + $links['alternate'] = array( + array( + 'TITLE' => $user->lang['RSS_FEED'], + 'URL' => $rss_main_url + ), + array( + 'TITLE' => $user->lang['RSS_CHAN_LIST_TITLE'], + 'URL' => $rss_chan_url + ), + ); + } + return $links; +} +/** +* get_feed_data($_params) +* returns the parsed feed. +* */ +function get_feed_data($_params) { + global $user, $config; + $feed_data = array( + 'items' => array(), + 'setup' => array('date' => false, 'author' => false, 'desclen' => 0, 'chantitle' => '', 'chanlink' => ''), + ); + @ini_set('user_agent','GYM Sitemaps & RSS / www.phpBB-SEO.com'); + @ini_set('default_socket_timeout', 5); + $xml = @file_get_contents($_params['url']); + if ($xml) { + // Get encoding + $encoding = get_match('`encoding=[\'"]([a-z0-9_-]+)[\'"]`Usi', $xml); + $encoding = !empty($encoding) ? strtolower($encoding) : detect_encoding($xml); + if(preg_match('`<item>(.*)</item>`si', $xml, $matches)){ + // Get chan info + $feed_data['setup']['chantitle'] = get_match('`<title>(.*)</title>`Usi', $xml, $encoding); + $feed_data['setup']['chanlink'] = get_match('`<link>(.*)</link>`Usi', $xml, $encoding); + $xml = trim($matches[0]); + unset($matches); + preg_match_all('`<item>(.*)</item>`Usi', $xml, $matches); + unset($matches[0]); + if (!empty($matches[1]) && is_array($matches[1])) { + $i = 1; + foreach($matches[1] as $key => $item) { + if ($i > $_params['limit']) { + break; + } + if ($title = get_match('`<title>(.*)</title>`Usi', $item, $encoding)) { + if ($link = get_match('`<link>(.*)</link>`Usi', $item, $encoding)) { + $feed_data['items'][$i]['PUBDATE'] = false; + if ($pubdate = get_match('`<pubDate>(.*)</pubDate>`Usi', $item, $encoding)) { + if (($pubdate = strtotime($pubdate, $user->time_now)) > 0) { + $feed_data['items'][$i]['PUBDATE'] = $user->format_date($pubdate, $config['default_dateformat']); + $feed_data['setup']['date'] = true; + } + } + $feed_data['items'][$i]['DESC'] = false; + if ($_params['desc'] && $description = get_match('`<description>(.*)</description>`Usi', $item, $encoding)) { + if (empty($_params['html'])) { + $description = htmlspecialchars($_params['striptags'] ? strip_tags($description) : $description, ENT_COMPAT, 'UTF-8'); + } + $feed_data['items'][$i]['DESC'] = str_replace(array("\r", "\n"), '<br />', $description); + $feed_data['setup']['desclen'] += utf8_strlen($feed_data['items'][$i]['DESC']); + } + $feed_data['items'][$i]['SOURCE'] = false; + if ($source = get_match('`<source[\s]+url="(.*)">(.*)</source>`Usi', $item, $encoding)) { + $feed_data['items'][$i]['SOURCE'] = htmlspecialchars($source, ENT_COMPAT, 'UTF-8'); + } + $feed_data['items'][$i]['TITLE'] = htmlspecialchars($title, ENT_COMPAT, 'UTF-8'); + $feed_data['items'][$i]['LINK'] = htmlspecialchars($link, ENT_COMPAT, 'UTF-8'); + $feed_data['items'][$i]['IMG'] = $user->img('topic_read', $feed_data['items'][$i]['TITLE'], false, '', 'src'); + $i++; + } + } + unset($matches[1][$key]); + } + } + unset($matches); + } + } + unset($xml); + return $feed_data; +} +/** +* detect_encoding($string) +* Inspired from php.net : http://www.php.net/mb_detect_encoding +*/ +function detect_encoding($string) { + if (function_exists('mb_detect_encoding')) { + if ($encoding = @mb_detect_encoding($string . 'a')) { + return strtolower($encoding); + } + } + // Else at least try to see if utf-8, otherwise fall back to iso-8859-1 + // non-overlong 2-byte|excluding overlongs|straight 3-byte|excluding surrogates|planes 1-3|planes 4-15|plane 16 + return preg_match('%(?:[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF] |\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+%xs', $string) ? 'utf-8' : 'iso-8859-1'; +} +/** +* get_match($pattern, $string, $encoding) +* returns properly encoded match from feed +*/ +function get_match($pattern, $string, $encoding = 'utf-8') { + static $filters = array('<![CDATA['=>'', ']]>'=>''); + $string = strtr($string, $filters); + preg_match($pattern, $string, $out); + if(!empty($out[1])) { + // cdata + $out[1] = strtr($out[1], $filters); + if( strtolower($encoding) != 'utf-8') { + $out[1] = utf8_recode($out[1], $encoding); + } + return @html_entity_decode(trim($out[1]), ENT_COMPAT, 'UTF-8'); + } else { + return ''; + } +} +/** +* set_exclude_list($id_list) will build up the public unauthed ids +*/ +function set_exclude_list($id_list) { + $exclude_list = empty($id_list) ? array() : explode(',', $id_list); + $ret = array(); + foreach ($exclude_list as $value ) { + $value = (int) trim($value); + if (!empty($value)) { + $ret[$value] = $value; + } + } + return $ret; +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/includes/gym_sitemaps.php b/phpBB/gym_sitemaps/includes/gym_sitemaps.php new file mode 100644 index 0000000000..b749bc5847 --- /dev/null +++ b/phpBB/gym_sitemaps/includes/gym_sitemaps.php @@ -0,0 +1,659 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: gym_sitemaps.php 272 2010-11-21 13:56:31Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +require_once($phpbb_root_path . 'gym_sitemaps/includes/gym_common.' . $phpEx); +// For Compatibility with the phpBB SEO mod rewrites +if (empty($phpbb_seo)) { + require_once($phpbb_root_path . 'gym_sitemaps/includes/phpbb_seo_class_light.' . $phpEx); + $phpbb_seo = new phpbb_seo(); + define('STARTED_LIGHT', true); +} +/** +* gym_sitemaps Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class gym_sitemaps { + // $_GET vars + var $actions = array(); + // Working vars + var $gym_config = array(); + var $override = array(); + var $override_type = array(); + var $gym_output; + var $output_data = array(); + var $cache_config = array(); + var $yahoo_config = array(); + var $ext_config = array(); + var $gzip_config = array(); + var $style_config = array(); + var $gym_auth = array(); + var $module_auth = array(); + /** + * constuctor + */ + function gym_sitemaps($action_type = '') { + global $phpEx, $phpbb_seo, $user, $config, $phpbb_root_path, $_action_types, $_override_types, $auth; + $start_time = $phpbb_seo->microtime_float(); + // Set default values + $this->gym_config = $this->actions = array(); + $this->override_type = $_override_types; + $this->actions['action_types'] = $_action_types; + $this->actions['action_type'] = in_array($action_type, $this->actions['action_types']) ? $action_type : ''; + $this->actions['extra_params'] = $this->actions['extra_params_full'] = $this->actions['auth_param'] = $this->actions['sql_report_msg'] = ''; + $this->actions['auth_guest_list'] = $this->actions['auth_guest_read'] = $this->actions['auth_view_list'] = $this->actions['auth_read_list'] = array(); + $this->actions['robots_patterns'] = array(); + if (empty($this->actions['action_type']) ) { + $this->gym_error(403, '', __FILE__, __LINE__); + } + // Grab required config + obtain_gym_config($this->actions['action_type'], $this->gym_config); + if (empty($this->gym_config) ) { + $this->gym_error(404, '', __FILE__, __LINE__); + } + // Set the overidding options + $this->set_override(); + $this->path_config = array('gym_path' => $phpbb_root_path . 'gym_sitemaps/', + 'gym_img_url' => $phpbb_seo->seo_path['phpbb_url'] . 'gym_sitemaps/images/'); + // The main array + $this->output_data = array('microtime'=> $start_time, + 'time' => time(), + 'mem_usage' => 0, + 'gen_data' => '', + 'gen_out' => '', + 'url_sofar' => 0, + 'url_sofar_total' => 0, + 'showstats' => 0, + 'data' => '', + 'expires_time' => 0, + ); + // Ceck the day interval and reset pinged + if (@$config['gym_today'] < $this->output_data['time']) { + set_config('gym_today', $this->output_data['time'] + 3600*24, 1); + set_config('gym_pinged_today', 0, 1); + } + $this->url_config = array( 'start_default' => '&start=', + 'google_default' => "sitemap.$phpEx", + 'html_default' => "map.$phpEx", + 'rss_default' => "gymrss.$phpEx", + 'gzip_ext_out' => '', + 'zero_dupe' => (boolean) $this->gym_config['gym_zero_dupe'], + 'uri' => $phpbb_seo->seo_path['uri'], + 'current' => '', + 'modrewrite' => false, + ); + $this->gzip_config = array('gzip_level' => (int) $this->gym_config['gym_gzip_level']); + $this->cache_config = array( + 'do_cache' => true, // this is used when preventing the caching of private content. + 'cached' => 'false', + 'mod_since' => (boolean) $this->gym_config['gym_mod_since'], + ); + // init $gym_auth + $this->gym_auth = array( + 'admin' => $auth->acl_gets('a_') ? true : false, + 'globalmod' => $auth->acl_getf_global('m_') ? true : false, + 'reg' => $user->data['is_registered'] ? true : false, + 'guest' => $user->data['is_registered'] ? false : true, + 'all' => true, + 'none' => false, + ); + // Workaround for error message handling + $phpbb_seo->file_hbase['map'] = $phpbb_seo->file_hbase['gymrss'] = $phpbb_seo->file_hbase['sitemap'] = $phpbb_seo->seo_path['phpbb_url']; + // Clear buffer, just in case it was started elswhere + while (@ob_end_clean()); + return; + } + /** + * init_get_vars (). + * Get and check the basic get vars + * @access private + */ + function init_get_vars() { + // Builds the action_modules array + $this->init_action_modules(); + // Basic options : gymfile.php?var(=value) + $this->actions['module_main'] = $this->actions['module_sub'] = ''; + foreach ($this->actions['action_modules'] as $module) { + if (isset($_GET[$module])) { + $this->actions['module_main'] = $module; + $this->actions['module_sub'] = !empty($_GET[$module]) ? trim(utf8_htmlspecialchars(str_replace(array("\n", "\r", "\0"), '', $_GET[$module]))) : ''; + unset($_GET[$module]); + } + } + return; + } + /** + * init_action_modules (). + * Build the autogenerated array of all expected actions + * @access private + */ + function init_action_modules() { + global $cache, $phpEx; + if (($this->actions['action_modules'] = $cache->get('_gym_action_' . $this->actions['action_type'])) === false) { + $this->actions['action_modules'] = array(); + $dir = @opendir( $this->path_config['gym_path'] . 'modules' ); + $action_from_file = ''; + while( ($file = @readdir($dir)) !== FALSE ) { + if(preg_match('`^' . $this->actions['action_type'] . '_[a-z0-9_-]+\.' . $phpEx . '$`i', $file)) { + $action_from_file = trim(str_replace( $this->actions['action_type'] . '_', '' , str_replace('.' . $phpEx , '' ,$file)), "/"); + if (@$this->gym_config[$this->actions['action_type'] . '_' . $action_from_file . '_installed']) { + $this->actions['action_modules'][$action_from_file] = $action_from_file; + } + } + } + @closedir($dir); + $cache->put('_gym_action_' . $this->actions['action_type'], $this->actions['action_modules']); + } + } + /** + * load_modules ( $module_type, $method = '' ). + * loads all modules for a given action_type + * Optional, starts a method + * @access private + */ + function load_modules( $method = '' ) { + foreach ( $this->actions['action_modules'] as $module ) { + $this->load_module( $this->actions['action_type'] . "_$module", $method); + } + } + /** + * load_module ( $module_class, $method = '' ). + * loads a module for a given action + * Optional, starts a method + * @access private + */ + function load_module( $module_class, $method = '', $return = false ) { + global $phpEx; + $module_file = $this->path_config['gym_path'] . 'modules/' . $module_class . '.' . $phpEx; + if ( !empty($this->gym_config[$module_class . '_installed']) && file_exists($module_file) ) { + include_once($module_file); + if (class_exists($module_class)) { + $gym_module = new $module_class($this); + if ( !empty($method) && method_exists($gym_module, $method)) { + $gym_module->$method(); + } + if ($return) { + return $gym_module; + } + } + } else { + $this->gym_error(500, '', __FILE__, __LINE__); + } + } + /** + * gym_init_output () + * In case we need to hanlde the output + * @access private + */ + function gym_init_output() { + global $phpEx; + include_once($this->path_config['gym_path'] . 'includes/gym_output.' . $phpEx); + $this->gym_output = new gym_output($this); + } + /** + * gym_auth_value() + * @access private + */ + function gym_auth_value($value) { + return !empty($this->gym_auth[$value]); + } + /** + * set_module_option($config_key, $override ='') + * will check if a module config value is available + * Set it or use the main type default value or the main global value + * Globale module value is used when cyclying through modules ( $this->actions['module_main'] = '' ) + * $override = global => global config + * $override = output_type => module config + * $override = module => sub module config + * degrades to the global config in case there is no better otpion + * @access private + */ + function set_module_option($config_key, $override = OVERRIDE_MODULE) { + $cond = ''; + // Check if we have a sub module option + if ( ($override == OVERRIDE_MODULE) && @isset($this->gym_config[$this->actions['action_type'] . '_' . $this->actions['module_main'] . "_$config_key"]) ) { + return $this->gym_config[$this->actions['action_type'] . '_' . $this->actions['module_main'] . "_$config_key"]; + } + // Else look for an output type option + if ( ($override != OVERRIDE_GLOBAL) && @isset($this->gym_config[$this->actions['action_type'] . "_$config_key"]) ) { + return $this->gym_config[$this->actions['action_type'] . "_$config_key"]; + + } + // Else return the global config value or the next available valid option from the output type to the module level or null + return isset($this->gym_config["gym_$config_key"]) ? $this->gym_config["gym_$config_key"] : ( @isset($this->gym_config[$this->actions['action_type'] . "_$config_key"]) ? $this->gym_config[$this->actions['action_type'] . "_$config_key"] : ( @isset($this->gym_config[$this->actions['action_type'] . '_' . $this->actions['module_main'] . "_$config_key"]) ? $this->gym_config[$this->actions['action_type'] . '_' . $this->actions['module_main'] . "_$config_key"] : null) ); + } + /** + * set_override() + * Will set the three levels of overriding + */ + function set_override() { + foreach ($this->override_type as $type) { + $this->override[$type] = $this->_set_override($type); + } + $this->override[$this->actions['action_type']] = $this->gym_config[$this->actions['action_type'] . '_override']; + return; + } + /** + * _set_override() + * helper for set_override() + */ + function _set_override($type) { + $main_key = 'gym_override_' . $type; + $mode_key = $this->actions['action_type'] . '_override_' . $type; + // $module_key = !empty($this->actions['module_main']) ? $this->actions['action_type'] . '_' . $this->actions['module_main'] . '_override_' . $type : 0; + if ($this->gym_config['gym_override']) { // if top level overrinding is activated + return ($this->gym_config[$main_key] != OVERRIDE_GLOBAL) ? ($this->gym_config[$mode_key] != OVERRIDE_GLOBAL ? $this->gym_config[$mode_key] : $this->gym_config[$main_key]) : OVERRIDE_GLOBAL; + } else { + return $this->gym_config[$mode_key]; + } + } + /** + * xml_encode() + * helper + */ + function xml_encode($utf8_string) { + static $find = array('&', '<', '>'); + static $replace = array('&', '<', '>'); + return numeric_entify_utf8(str_replace($find, $replace, $utf8_string)); + } + /** + * check_forum_auth() + * Returns various forum auth and properties + */ + function check_forum_auth($guest_auth = true) { + global $auth, $db, $user, $cache; + $forum_auth_list = array('list' => array(), 'read' => array(), 'list_post' => array(), 'read_post' => array(), 'public_list' => array(), 'public_read' => array(), 'skip_pass' => array(), 'skip_cat' => array(), 'skip_all' => array(), 'skip_link' => array()); + $need_cache = false; + $cache_file = '_gym_auth_forum_guest'; + // First check the public forum list + if (($forum_auth_list = $cache->get($cache_file)) === false) { + $forum_auth_list = array('list' => array(), 'read' => array(), 'list_post' => array(), 'read_post' => array(), 'public_list' => array(), 'public_read' => array(), 'skip_pass' => array(), 'skip_cat' => array(), 'skip_all' => array(), 'skip_link' => array()); + $guest_data = array('user_id' => ANONYMOUS, + 'user_type' => USER_IGNORE, + 'user_permissions' . (defined('XLANG_AKEY') ? XLANG_AKEY : '') => '', + ); + $g_auth = new auth(); + $g_auth->acl($guest_data); + // the forum id array + $forum_list_ary = $g_auth->acl_getf('f_list', true); + foreach ($forum_list_ary as $forum_id => $null) { + $forum_auth_list['list'][$forum_id] = (int) $forum_id; + } + $forum_read_ary = $g_auth->acl_getf('f_read', true); + foreach ($forum_read_ary as $forum_id => $null) { + $forum_auth_list['read'][$forum_id] = (int) $forum_id; + } + ksort($forum_auth_list['list']); + ksort($forum_auth_list['read']); + $sql = "SELECT forum_id, forum_type, forum_password + FROM " . FORUMS_TABLE . " + WHERE forum_type <> " . FORUM_POST . " OR forum_password <> ''"; + $result = $db->sql_query($sql); + while ( $row = $db->sql_fetchrow($result) ) { + $forum_id = (int) $row['forum_id']; + if ($row['forum_password']) { + $forum_auth_list['skip_pass'][$forum_id] = $forum_id; + } + if ($row['forum_type'] == FORUM_CAT) { + $forum_auth_list['skip_cat'][$forum_id] = $forum_id; + } else if ($row['forum_type'] == FORUM_LINK) { + $forum_auth_list['skip_link'][$forum_id] = $forum_id; + } + $forum_auth_list['skip_all'][$forum_id] = $forum_id; + } + $db->sql_freeresult($result); + ksort($forum_auth_list['skip_pass']); + ksort($forum_auth_list['skip_all']); + ksort($forum_auth_list['skip_link']); + ksort($forum_auth_list['skip_cat']); + // Never mind about fourm links + $forum_auth_list['read'] = array_diff_assoc($forum_auth_list['read'], $forum_auth_list['skip_link']); + $forum_auth_list['list'] = array_diff_assoc($forum_auth_list['list'], $forum_auth_list['skip_link']); + ksort($forum_auth_list['read']); + ksort($forum_auth_list['list']); + $forum_auth_list['list_post'] = array_diff_assoc($forum_auth_list['list'], $forum_auth_list['skip_all']); + $forum_auth_list['read_post'] = array_diff_assoc($forum_auth_list['read'], $forum_auth_list['skip_all']); + $forum_auth_list['public_list'] = array_diff_assoc($forum_auth_list['list'], $forum_auth_list['skip_pass']); + $forum_auth_list['public_read'] = array_diff_assoc($forum_auth_list['read'], $forum_auth_list['skip_pass']); + $cache->put($cache_file, $forum_auth_list); + } + + $this->module_auth['forum'] = & $forum_auth_list; + if ($guest_auth) { // sometime, we need to only check guest auths, even if user is registered + $this->actions['auth_param'] = implode('-', $forum_auth_list['read_post']); + return $forum_auth_list['read_post']; + } + // else handle the real auth + $forum_auth_list['read'] = $forum_auth_list['list'] = array(); + $forum_list_ary = $auth->acl_getf('f_list', true); + foreach ($forum_list_ary as $forum_id => $null) { + $forum_auth_list['list'][$forum_id] = (int) $forum_id; + } + $forum_read_ary = $auth->acl_getf('f_read', true); + foreach ($forum_read_ary as $forum_id => $null) { + $forum_auth_list['read'][$forum_id] = (int) $forum_id; + } + ksort($forum_auth_list['list']); + ksort($forum_auth_list['read']); + $forum_auth_list['list'] = array_diff_assoc($forum_auth_list['list'], $forum_auth_list['skip_link']); + $forum_auth_list['read'] = array_diff_assoc($forum_auth_list['read'], $forum_auth_list['skip_link']); + $forum_auth_list['list_post'] = array_diff_assoc($forum_auth_list['list'], $forum_auth_list['skip_all']); + $forum_auth_list['read_post'] = array_diff_assoc($forum_auth_list['read'], $forum_auth_list['skip_all']); + + $this->actions['auth_param'] = implode('-', $forum_auth_list['read_post']); + return $forum_auth_list['read_post']; + } + /** + * Smiley processing, the phpBB3 function, but, with absolute linking + * a little optimization and regular config bypass. + */ + function smiley_text($text, $force_option = false) { + global $config, $user, $phpbb_seo; + static $viewsmilies; + if (!isset($viewsmilies)) { // Costs less than optionget ;-) + $viewsmilies = $user->optionget('viewsmilies'); + } + if ($force_option || !$viewsmilies) { + return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text); + } else { + return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . $phpbb_seo->seo_path['phpbb_url'] . $config['smilies_path'] . '/\2 />', $text); + } + } + /** + * obtain_robots_disallows() + * obtain the eventual robots.txt exclusions + * and parse them into a patern array for later use + * @access private + */ + function obtain_robots_disallows() { + global $phpbb_root_path, $phpbb_seo, $cache, $phpEx; + if (function_exists('file_get_contents')) { + // Build the domain root path + $phpbb_real_path = trim(phpbb_realpath($phpbb_root_path), '/'); + $root_real_path = str_replace(trim($phpbb_seo->seo_path['phpbb_script'], '/'), '', $phpbb_real_path); + if (file_exists($root_real_path . '/robots.txt')) { + $time_created = filemtime($root_real_path . '/robots.txt'); + if (($this->actions['robots_patterns'] = $cache->get('_gym_config_robots_regex' )) === false) { + $robots = file_get_contents($root_real_path . '/robots.txt'); + preg_match_all('`^Disallow[\s]*:[\s]*([a-z0-9_\.&;\?,:/-]+)[\s]*$`im', $robots, $matches,PREG_SET_ORDER); + if (!empty($matches[0][1])) { + foreach ($matches as $match) { + if (!empty($match[1])) { + $this->actions['robots_patterns'][] = $phpbb_seo->seo_path['root_url'] . trim($match[1], '/'); + } + } + } + $this->actions['robots_patterns']['date'] = $time_created; + $cache->put('_gym_config_robots_regex' , $this->actions['robots_patterns']); + } elseif ($this->actions['robots_patterns']['date'] < $time_created) { // robots.tx was updated + $cache->destroy('_gym_config_robots_regex'); + $this->obtain_robots_disallows(); + } + + } + } + return; + } + /** + * is_robots_disallowed() + * checks if an url is disallowed by the robots.txt patterns + * @access private + */ + function is_robots_disallowed($url) { + if (!empty($this->actions['robots_patterns'])) { + foreach($this->actions['robots_patterns'] as $pattern) { + if (stripos( $url, $pattern) !== false) { + return true; + } + } + } + return false; + } + /** + * set_exclude_list($id_list) will build up the public unauthed ids + * @access private + */ + function set_exclude_list($id_list) { + $exclude_list = empty($id_list) ? array() : explode(',', $id_list); + $ret = array(); + foreach ($exclude_list as $value ) { + $value = (int) trim($value); + if (!empty($value)) { + $ret[$value] = $value; + } + } + return $ret; + } + /** + * set_exclude_list($id_list) will build up the public unauthed ids + * This method is deprecated since 2.0.RC2 + * @access private + */ + function set_not_in_list($id_list = array(), $field = '', $and = '') { + if ( !empty($id_list) && is_array($id_list) ) { + $not_in_id_sql = " $field NOT IN (" . implode(",", array_map('intval', $id_list)) . ") $and "; + } else { + $not_in_id_sql = ''; + } + return $not_in_id_sql; + } + /** + * is_forum_public($forum_id) Will tell if a forum is publicly viewable or listable (auth guest) + * @access private + */ + function is_forum_public($forum_id, $type = 'read') { + $type = $type === 'list' ? 'list' : 'read'; + return (boolean) isset($this->actions["auth_guest_$type"][$forum_id]); + } + + // --> Others <-- + /** + * init_url_rewrite() + */ + function init_url_rewrite($modr = false, $type = 0) { + global $phpbb_seo, $phpEx; + $this->url_config['modrewrite'] = $modr ? true : false; + // Mod rewrite type auto detection + $this->url_config['modrtype'] = !empty($phpbb_seo->modrtype) ? max(0, (int) $phpbb_seo->modrtype) : max(0, (int) $type); + if (!@isset($phpbb_seo->seo_opt['url_rewrite'])) { + $phpbb_seo->seo_opt['url_rewrite'] = $this->url_config['modrtype'] > 0 ? true : false; + } + // make sure virtual_folder uses the proper value + $phpbb_seo->seo_opt['virtual_folder'] = $this->url_config['modrtype'] ? $phpbb_seo->seo_opt['virtual_folder'] : false; + $this->url_config['forum_start_tpl'] = $this->url_config['start_default'] . '%1$d'; + $this->url_config['topic_start_tpl'] = $this->url_config['start_default'] . '%1$d'; + $this->url_config['forum_tpl'] = "viewforum.$phpEx?f=%1\$d"; + $this->url_config['topic_tpl'] = "viewtopic.$phpEx?f=%1\$d&t=%2\$d"; + if (!$phpbb_seo->seo_opt['url_rewrite']) { + $this->url_config['forum_index'] = "index.$phpEx"; + $phpbb_seo->seo_opt['virtual_folder'] = false; + $this->url_config['forum_ext'] = ''; + $this->url_config['topic_ext'] = ''; + } else { + $this->url_config['forum_index'] = !empty($phpbb_seo->seo_static['index']) ? $phpbb_seo->seo_static['index'] . $phpbb_seo->seo_ext['index'] : ''; + if ($this->url_config['modrtype'] >= 1) { // Simple mod rewrite, default is none (0) + $this->url_config['forum_ext'] = $phpbb_seo->seo_ext['forum']; + $this->url_config['topic_ext'] = $phpbb_seo->seo_ext['topic']; + $this->url_config['forum_start_tpl'] = $phpbb_seo->seo_opt['virtual_folder'] ? '/' . $phpbb_seo->seo_static['pagination'] . '%1$d' . $phpbb_seo->seo_ext['pagination'] : $phpbb_seo->seo_delim['start'] . '%1$d' . $this->url_config['forum_ext']; + $this->url_config['topic_start_tpl'] = $this->url_config['topic_ext'] == '/' ? '/' . $phpbb_seo->seo_static['pagination'] . '%1$d' . $phpbb_seo->seo_ext['pagination'] : $phpbb_seo->seo_delim['start'] . '%1$d' . $this->url_config['topic_ext']; + } + if ($this->url_config['modrtype'] >= 2) { // +Mixed + } + if ($this->url_config['modrtype'] >= 3) { // +Advanced + } + } + } + /** + * forum_url() builds forum url with proper options + * Suffixe is not added here, to properly deal with pagination + */ + function forum_url($forum_name, $forum_id) { + global $phpbb_seo; + return $phpbb_seo->seo_opt['url_rewrite'] ? $phpbb_seo->set_url($forum_name, $forum_id, 'forum') : sprintf($this->url_config['forum_tpl'], $forum_id); + } + /** + * topic_url($topic_title, $topic_id, $forum_url, $forum_id) builds forum url with proper options + * Suffixe is not added here, to properly deal with pagination + */ + function topic_url($topic_data, $forum_id, $forum_url = '') { + global $phpbb_seo; + return $phpbb_seo->seo_opt['url_rewrite'] ? $phpbb_seo->prepare_iurl($topic_data, 'topic', trim($forum_url, '/')) : sprintf($this->url_config['topic_tpl'], $forum_id, (int) $topic_data['topic_id']); + } + /** + * Returns usable start param + * -xx | /pagexx.html + */ + function set_start($type, $start) { + global $phpbb_seo; + return $start > 0 ? sprintf($this->url_config[$type . '_start_tpl'], (int) $start) : $this->url_config[$type . '_ext']; + } + /** + * check start var consistency + * and return our best guess for $start, eg the first valid page + * parameter according to pagination settings being lower + * than the one sent. + */ + function chk_start($start = 0, $limit = 0) { + if ($limit > 0) { + $start = is_int($start/$limit) ? $start : intval($start/$limit)*$limit; + } + return (int) $start; + } + /** + * parse_link() builds an html link + */ + function parse_link($url, $title = '', $tag_arround = '') { + global $config; + static $linktpl = '%4$s<a href="%1$s" %2$s>%3$s</a>%5$s'; + $title_tag = $tag1 = $tag2 = ''; + if (empty($title) ) { + $title = $url; + } else { + $title_tag = 'title="' . $title . '"'; + } + if (!empty($tag_arround)) { + $tag1 = "<$tag_arround>"; + $tag2 = "</$tag_arround>"; + } + return sprintf($linktpl, $url, $title_tag, $title, $tag1, $tag2); + } + /** + * seo_kill_dupes($url) will kill duplicates when pages are not cached + * @access private + */ + function seo_kill_dupes($url) { + global $user, $auth, $_SID, $phpbb_seo; + $url = str_replace('&', '&', $url); + // if an https request lead us here or if it is forced, then use it as a reference + $url = $phpbb_seo->sslify($url, $phpbb_seo->ssl['use']); + if ($this->url_config['zero_dupe']) { + $requested_url = $this->url_config['uri']; + if (!empty($_REQUEST['explain']) && (boolean) ($auth->acl_get('a_') && defined('DEBUG_EXTRA'))) { + if ($_REQUEST['explain'] == 1) { + return; + } + } + $url = $phpbb_seo->drop_sid($url); + if (!empty($_GET['sid']) && !empty($_SID)) { + $url .= (utf8_strpos( $url, '?' ) !== false ? '&' : '?') . 'sid=' . $user->session_id; + } + if ( $requested_url !== $url ) { + $this->gym_redirect($url); + } + } + $this->url_config['current'] = $url; + return; + } + /** + * Custom HTTP 301 redirections. + * To kill duplicates + */ + function gym_redirect($url, $header = "301 Moved Permanently", $code = 301, $replace = true) { + if (headers_sent()) { + return false; + } + if (strstr(urldecode($url), "\n") || strstr(urldecode($url), "\r") || strstr(urldecode($url), ';url')) { + $this->gym_error(400, '', __FILE__, __LINE__); + } + $http = "HTTP/1.1 "; + header($http . $header, $replace, $code); + header("Location:" . $url); + $this->safe_exit(); + } + /** + * gym_error(($errno, $msg_text, $errfile, $errline) + * Will properly handle error for all cases, admin always get full debug + * Partly based on msg_handler() + * @access private + */ + function gym_error($errno = 0, $msg_key = '', $errfile = '', $errline = '', $sql = '') { + global $user, $phpbb_seo, $auth, $phpbb_root_path, $phpEx, $msg_title; + $http_codes = array ( + 204 => 'HTTP/1.1 204 No Content', + 400 => 'HTTP/1.1 400 Bad Request', + 401 => 'HTTP/1.1 401 Unauthorized', + 403 => 'HTTP/1.1 403 Forbidden', + 404 => 'HTTP/1.1 404 Not Found', + 405 => 'HTTP/1.1 405 Method Not Allowed', + 406 => 'HTTP/1.1 406 Not Acceptable', + 410 => 'HTTP/1.1 410 Gone', + 500 => 'HTTP/1.1 500 Internal Server Error', + 503 => 'HTTP/1.1 503 Service Unavailable', + ); + $header = isset($http_codes[$errno]) ? $http_codes[$errno] : ''; + $return_url = append_sid("{$phpbb_root_path}index.$phpEx"); + if (!empty($user) && !empty($user->lang)) { + $msg_title = (empty($msg_key)) ? ( !empty($user->lang['GYM_ERROR_' . $errno]) ? $user->lang['GYM_ERROR_' . $errno] : ( !empty($header) ? $header : $user->lang['GENERAL_ERROR']) ) : ((!empty($user->lang[$msg_key])) ? $user->lang[$msg_key] : $msg_key); + $msg_text = !empty($user->lang[$msg_key . '_EXPLAIN']) ? $user->lang[$msg_key . '_EXPLAIN'] : (!empty($user->lang['GYM_ERROR_' . $errno . '_EXPLAIN']) ? $user->lang['GYM_ERROR_' . $errno . '_EXPLAIN'] : ( (!empty($msg_key) ? $msg_key : (!empty($header) ? $header : $msg_title) ) ) ); + $l_return_index = sprintf($user->lang['RETURN_INDEX'], '<a href="' . $return_url . '">', '</a>'); + if ( ( $errno == 500 || $errno == 503 ) && !empty($config['board_contact'])) { + $msg_text .= '<p>' . sprintf($user->lang['NOTIFY_ADMIN_EMAIL'], $config['board_contact']) . '</p>'; + } + } else { + $msg_title = 'GYM Sitemaps General Error'; + $l_return_index = '<a href="' . $return_url . '">Return to index page</a>'; + if ( ( $errno == 500 || $errno == 503 ) && !empty($config['board_contact'])) { + $msg_text .= '<p>Please notify the board administrator or webmaster: <a href="mailto:' . $config['board_contact'] . '">' . $config['board_contact'] . '</a></p>'; + } + } + $msg_text .= '<br/><br/>' . $l_return_index; + if (@$auth->acl_get('a_')) { + if (!empty($user->lang[$msg_key . '_EXPLAIN_ADMIN'])) { + $msg_text .= '<br/><br/>' . $user->lang[$msg_key . '_EXPLAIN_ADMIN']; + } + if (defined('DEBUG')) { + $msg_text .= '</p><br/><h2>Debug :</h2><p>' . (!empty($errfile) ? "<br/><b>File :</b> " . utf8_htmlspecialchars($errfile) . "<br/>" : ''); + $msg_text .= !empty($errline) ? "<br/><b>Line :</b> " . utf8_htmlspecialchars($errline) . "<br/>" : ''; + $msg_text .= !empty($sql) ? "<br/><b>Sql :</b> " . utf8_htmlspecialchars($sql) . "<br/>" : ''; + $msg_text .= '</p><div style="font-size:12px">' . get_backtrace() . '</div><p>'; + } + } + if ( !empty($header) ) { + header($header); + } + meta_refresh(5, $return_url); + trigger_error($msg_text); + $this->safe_exit(); + return; + } + /** + * For a safe exit + * @access private + */ + function safe_exit() { + garbage_collection(); + exit_handler(); + exit; + } +} +?> diff --git a/phpBB/gym_sitemaps/includes/index.htm b/phpBB/gym_sitemaps/includes/index.htm new file mode 100644 index 0000000000..e0cc5f36e6 --- /dev/null +++ b/phpBB/gym_sitemaps/includes/index.htm @@ -0,0 +1,10 @@ +<html>
+<head>
+<title></title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+
+</body>
+</html>
diff --git a/phpBB/gym_sitemaps/includes/phpbb_seo_class_light.php b/phpBB/gym_sitemaps/includes/phpbb_seo_class_light.php new file mode 100644 index 0000000000..251e1d84fc --- /dev/null +++ b/phpBB/gym_sitemaps/includes/phpbb_seo_class_light.php @@ -0,0 +1,252 @@ +<?php +/** +* +* @package Ultimate SEO URL phpBB SEO +* @version $Id: phpbb_seo_class_light.php 264 2010-06-02 07:13:08Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://www.opensource.org/licenses/rpl1.5.txt Reciprocal Public License 1.5 +* +*/ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) { + exit; +} +/** +* phpBB_SEO Class lite +* For Compatibility with the phpBB SEO mod rewrites +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +// + +class phpbb_seo { + var $modrtype = -1; + var $seo_path = array(); + var $seo_url = array( 'forum' => array(), 'topic' => array(), 'user' => array(), 'username' => array(), 'group' => array(), 'file' => array() ); + var $seo_delim = array( 'forum' => '-f', 'topic' => '-t', 'user' => '-u', 'group' => '-g', 'start' => '-', 'sr' => '-', 'file' => '/'); + var $seo_ext = array( 'forum' => '.html', 'topic' => '.html', 'post' => '.html', 'user' => '.html', 'group' => '.html', 'index' => '', 'global_announce' => '/', 'leaders' => '.html', 'atopic' => '.html', 'utopic' => '.html', 'npost' => '.html', 'pagination' => '.html', 'gz_ext' => ''); + var $seo_static = array( 'forum' => 'forum', 'topic' => 'topic', 'post' => 'post', 'user' => 'member', 'group' => 'group', 'index' => '', 'global_announce' => 'announces', 'leaders' => 'the-team', 'atopic' => 'active-topics', 'utopic' => 'unanswered', 'npost' => 'newposts', 'pagination' => 'page', 'gz_ext' => '.gz' ); + var $seo_opt = array(); + var $seo_cache = array(); + var $RegEx = array(); + var $sftpl = array(); + var $url_replace = array(); + var $ssl = array('requested' => false, 'forced' => false); + var $light = true; + /** + * constuctor + */ + function phpbb_seo() { + global $config, $phpEx; + // fix for an interesting bug with parse_str http://bugs.php.net/bug.php?id=48697 + // and apparently, the bug is still here in php5.3 + @ini_set("mbstring.internal_encoding", 'UTF-8'); + // URL Settings + $this->seo_opt = array( + 'profile_inj' => false, + 'rem_small_words' => false, + 'virtual_folder' => false, + 'virtual_root' => false, + ); + // --> DOMAIN SETTING <-- // + // SSL, beware with cookie secure, it won't force ssl here, + // so you will need to switch to ssl for your user to use cookie based session (no sid) + // could be done by using an https link to login form (or within the redirect after login) + $this->ssl['requested'] = (bool) ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] === true)) || (isset($_SERVER['SERVER_PORT']) && (int) $_SERVER['SERVER_PORT'] === 443)); + $this->ssl['forced'] = (bool) (($config['server_protocol'] === 'https//')); + $this->ssl['use'] = (bool) ($this->ssl['requested'] || $this->ssl['forced']); + // Server Settings, rely on DB + $server_protocol = $this->ssl['use'] ? 'https://' : 'http://'; + $server_name = trim($config['server_name'], '/ '); + $server_port = max(0, (int) $config['server_port']); + $server_port = ($server_port && $server_port <> 80) ? ':' . $server_port : ''; + $script_path = trim($config['script_path'], '/ '); + $script_path = (empty($script_path) ) ? '' : $script_path . '/'; + $this->seo_path['root_url'] = utf8_strtolower($server_protocol . $server_name . $server_port . '/'); + $this->seo_path['phpbb_urlR'] = $this->seo_path['phpbb_url'] = $this->seo_path['root_url'] . $script_path; + $this->seo_path['phpbb_script'] = $script_path; + $this->seo_path['canonical'] = ''; + // File setting + $this->seo_req_uri(); + $this->seo_opt['seo_base_href'] = $this->seo_opt['req_file'] = $this->seo_opt['req_self'] = ''; + if ($script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF')) { + // From session.php + // Replace backslashes and doubled slashes (could happen on some proxy setups) + $this->seo_opt['req_self'] = str_replace(array('\\', '//'), '/', $script_name); + // basenamed page name (for example: index) + $this->seo_opt['req_file'] = urlencode(htmlspecialchars(str_replace(".$phpEx", '', basename($this->seo_opt['req_self'])))); + } + // see if we have some custom replacement + if (!empty($this->url_replace)) { + $this->url_replace = array( + 'find' => array_keys($this->url_replace), + 'replace' => array_values($this->url_replace) + ); + } + // preg_replace() patterns for format_url() + // One could want to add |th|horn after |slash, but I'm not sure that Þ should be replaced with t and Ð with e + $this->RegEx['url_find'] = array('`&([a-z]+)(acute|grave|circ|cedil|tilde|uml|lig|ring|caron|slash);`i', '`&(amp;)?[^;]+;`i', '`[^a-z0-9]`i'); // Do not remove : deaccentuation, html/xml entities & non a-z chars + $this->RegEx['url_replace'] = array('\1', '-', '-'); + if ($this->seo_opt['rem_small_words']) { + $this->RegEx['url_find'][] = '`(^|-)[a-z0-9]{1,2}(?=-|$)`i'; + $this->RegEx['url_replace'][] = '-'; + } + $this->RegEx['url_find'][] ='`[-]+`'; // Do not remove : multi hyphen reduction + $this->RegEx['url_replace'][] = '-'; + // $1 parent : string/ + // $2 title / url : topic-title / forum-url-fxx + // $3 id + $this->sftpl = array( + 'topic' => ($this->seo_opt['virtual_folder'] ? '%1$s/' : '') . '%2$s' . $this->seo_delim['topic'] . '%3$s', + 'topic_smpl' => ($this->seo_opt['virtual_folder'] ? '%1$s/' : '') . $this->seo_static['topic'] . '%3$s', + 'forum' => $this->modrtype >= 2 ? '%2$s' : $this->seo_static['forum'] . '%3$s', + 'group' => $this->seo_opt['profile_inj'] ? '%2$s' . $this->seo_delim['group'] . '%3$s' : $this->seo_static['group'] . '%3$s', + ); + return; + } + // --> Gen stats + /** + * Returns microtime + * Borrowed from php.net + */ + function microtime_float() { + return array_sum(explode(' ', microtime())); + } + // --> URL rewriting functions <-- + /** + * format_url( $url, $type = 'topic' ) + * Prepare Titles for URL injection + */ + function format_url( $url, $type = 'topic' ) { + $url = preg_replace('`\[.*\]`U','',$url); + if (isset($this->url_replace['find'])) { + $url = str_replace($this->url_replace['find'], $this->url_replace['replace'], $url); + } + $url = htmlentities($url, ENT_COMPAT, 'UTF-8'); + $url = preg_replace($this->RegEx['url_find'] , $this->RegEx['url_replace'], $url); + $url = strtolower(trim($url, '-')); + return empty($url) ? $type : $url; + } + /** + * set_url( $url, $id = 0, $type = 'forum', $parent = '' ) + * Prepare url first part and checks cache + */ + function set_url( $url, $id = 0, $type = 'forum', $parent = '') { + if ( empty($this->seo_url[$type][$id]) ) { + return ( $this->seo_url[$type][$id] = !empty($this->cache_config[$type][$id]) ? $this->cache_config[$type][$id] : sprintf($this->sftpl[$type], $parent, $this->format_url($url, $this->seo_static[$type]) . $this->seo_delim[$type] . $id, $id) ); + } + return $this->seo_url[$type][$id]; + } + /** + * prepare_url( $type, $title, $id, $parent = '', $smpl = false ) + * Prepare url first part + */ + function prepare_url( $type, $title, $id, $parent = '', $smpl = false ) { + return empty($this->seo_url[$type][$id]) ? ($this->seo_url[$type][$id] = sprintf($this->sftpl[$type . ($smpl ? '_smpl' : '')], $parent, !$smpl ? $this->format_url($title, $this->seo_static[$type]) : '', $id)) : $this->seo_url[$type][$id]; + } + /** + * set_title( $type, $title, $id, $parent = '' ) + * Set title for url injection + */ + function set_title( $type, $title, $id, $parent = '' ) { + return empty($this->seo_url[$type][$id]) ? ($this->seo_url[$type][$id] = ($parent ? $parent . '/' : '') . $this->format_url($title, $this->seo_static[$type])) : $this->seo_url[$type][$id]; + } + /** + * prepare_iurl( $data, $type, $parent = '' ) + * Prepare url first part (not for forums) with SQL based URL rewriting + */ + function prepare_iurl( $data, $type, $parent = '' ) { + $id = max(0, (int) $data[$type . '_id']); + if ( empty($this->seo_url[$type][$id]) ) { + if (!empty($data[$type . '_url'])) { + return ($this->seo_url[$type][$id] = $data[$type . '_url'] . $id); + } else { + return ($this->seo_url[$type][$id] = sprintf($this->sftpl[$type . ($this->modrtype > 2 ? '' : '_smpl')], $parent, $this->modrtype > 2 ? $this->format_url($data[$type . '_title'], $this->seo_static[$type]) : '', $id)); + } + } + return $this->seo_url[$type][$id]; + } + /** + * drop_sid( $url ) + * drop the sid's in url + */ + function drop_sid( $url ) { + return (strpos($url, 'sid=') !== false) ? trim(preg_replace(array('`&(amp;)?sid=[a-z0-9]*(&|&)?`', '`(\?)sid=[a-z0-9]*`'), array('\2', '\1'), $url), '?') : $url; + } + /** + * set_user_url( $username, $user_id = 0 ) + * Prepare profile url + */ + function set_user_url( $username, $user_id = 0 ) { + if (empty($this->seo_url['user'][$user_id])) { + $username = strip_tags($username); + $this->seo_url['username'][$username] = $user_id; + if ( $this->seo_opt['profile_inj'] ) { + if ( $this->seo_opt['profile_noids'] ) { + $this->seo_url['user'][$user_id] = $this->seo_static['user'] . '/' . $this->seo_url_encode($username); + } else { + $this->seo_url['user'][$user_id] = $this->format_url($username, $this->seo_delim['user']) . $this->seo_delim['user'] . $user_id; + } + } else { + $this->seo_url['user'][$user_id] = $this->seo_static['user'] . $user_id; + } + } + } + /** + * seo_url_encode( $url ) + * custom urlencoding + */ + function seo_url_encode( $url ) { + // can be faster to return $url directly if you do not allow more chars than + // [a-zA-Z0-9_\.-] in your usernames + // return $url; + // Here we hanlde the "&", "/", "+" and "#" case proper ( http://www.php.net/urlencode => http://issues.apache.org/bugzilla/show_bug.cgi?id=34602 ) + static $find = array('&', '/', '#', '+'); + static $replace = array('%26', '%2F', '%23', '%2b'); + return rawurlencode(str_replace( $find, $replace, utf8_normalize_nfc(htmlspecialchars_decode(str_replace('&amp;', '%26', rawurldecode($url)))))); + } + /** + * Returns the full REQUEST_URI + */ + function seo_req_uri() { + if ( !empty($_SERVER['HTTP_X_REWRITE_URL']) ) { // IIS isapi_rewrite + $this->seo_path['uri'] = ltrim($_SERVER['HTTP_X_REWRITE_URL'], '/'); + } elseif ( !empty($_SERVER['REQUEST_URI']) ) { // Apache mod_rewrite + $this->seo_path['uri'] = ltrim($_SERVER['REQUEST_URI'], '/'); + } else { // no mod rewrite + $this->seo_path['uri'] = ltrim($_SERVER['SCRIPT_NAME'], '/') . ( ( !empty($_SERVER['QUERY_STRING']) ) ? '?'.$_SERVER['QUERY_STRING'] : '' ); + } + $this->seo_path['uri'] = str_replace( '%26', '&', rawurldecode($this->seo_path['uri'])); + // workaround for FF default iso encoding + if (!$this->is_utf8($this->seo_path['uri'])) { + $this->seo_path['uri'] = utf8_normalize_nfc(utf8_recode($this->seo_path['uri'], 'iso-8859-1')); + } + $this->seo_path['uri'] = $this->seo_path['root_url'] . $this->seo_path['uri']; + return $this->seo_path['uri']; + } + /** + * sslify($url, $ssl = true, $proto_check = true) + * properly set http protocol (eg http or https) + * if no protocol is specified, will return false with $proto_check set to true + */ + function sslify($url, $ssl = true, $proto_check = true) { + static $mask = '`^https?://`i'; + $url = trim($url); + if ($url && preg_match($mask, $url)) { + $replace = $ssl ? 'https://' : 'http://'; + return preg_replace($mask, $replace, $url); + } + return $proto_check ? false : $url; + } + /** + * is_utf8($string) + * Borrowed from php.net : http://www.php.net/mb_detect_encoding (detectUTF8) + */ + function is_utf8($string) { + // non-overlong 2-byte|excluding overlongs|straight 3-byte|excluding surrogates|planes 1-3|planes 4-15|plane 16 + return preg_match('%(?:[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF] |\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+%xs', $string); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/modules/.htaccess b/phpBB/gym_sitemaps/modules/.htaccess new file mode 100644 index 0000000000..6511d09c92 --- /dev/null +++ b/phpBB/gym_sitemaps/modules/.htaccess @@ -0,0 +1,4 @@ +<Limit GET POST PUT DELETE> +Order Allow,Deny +Deny from All +</Limit> diff --git a/phpBB/gym_sitemaps/modules/google_forum.php b/phpBB/gym_sitemaps/modules/google_forum.php new file mode 100644 index 0000000000..3bf26d4491 --- /dev/null +++ b/phpBB/gym_sitemaps/modules/google_forum.php @@ -0,0 +1,342 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: google_forum.php 254 2010-03-12 15:08:58Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* google_forum Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class google_forum { + var $url_config = array(); + var $actions = array(); + var $module_auth = array(); + var $module_config = array(); + var $output_data = array(); + /** + * constuctor + */ + function google_forum(&$gym_master) { + $this->gym_master = &$gym_master; + $this->actions = &$this->gym_master->actions; + $this->module_auth = &$this->gym_master->module_auth; + $this->output_data = &$this->gym_master->output_data; + $this->url_config = &$this->gym_master->url_config; + $this->module_config = array_merge( + // Global + $this->gym_master->google_config, + // Other stuff required here + array( + 'google_sticky_priority' => $this->gym_master->gym_config['google_forum_sticky_priority'], + 'google_announce_priority' => $this->gym_master->gym_config['google_forum_announce_priority'], + 'google_exclude' => trim($this->gym_master->gym_config['google_forum_exclude'], ','), + ) + ); + // Build exclude_list array + $this->module_config['exclude_list'] = $this->gym_master->set_exclude_list($this->module_config['google_exclude']); + // Wee need to check auth here (Only public and postable forums for sitemaps) + $this->gym_master->check_forum_auth($this->module_config['google_auth_guest']); + // Wee need to check auth here + $this->actions['auth_guest_read'] = array_diff_assoc($this->module_auth['forum']['public_read'], $this->module_config['exclude_list'], $this->module_auth['forum']['skip_all']); + $this->actions['auth_view_read'] = array_diff_assoc($this->module_auth['forum']['read_post'], $this->module_config['exclude_list']); + if (empty($this->actions['auth_view_read'])) { + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + // Check cache + $this->gym_master->gym_output->setup_cache(); // Will exit if the cache is sent + $this->init_url_settings(); + } + /** + * Initialize mod rewrite to handle multiple URL standards. + * Only one 'if' is required after this in THE loop to properly switch + * between the four types (none, advanced, mixed and simple). + * @access private + */ + function init_url_settings() { + global $phpbb_seo, $phpEx; + // vars will fell like rain in the code ;) + $this->gym_master->init_url_rewrite($this->module_config['google_modrewrite'], $this->module_config['google_modrtype']); + $this->url_config['google_forum_tpl'] = $this->module_config['google_url'] . $this->url_config['google_default'] . '?forum=%1$s'; + $this->url_config['google_forum_default'] = $this->url_config['google_default'] . '?forum'; + $this->url_config['google_annouces_default'] = sprintf($this->url_config['google_forum_tpl'], 'announces'); + $this->url_config['google_forum_ext'] = ''; + $this->url_config['google_forum_delim'] = !empty($phpbb_seo->seo_delim['forum']) ? $phpbb_seo->seo_delim['forum'] : '-f'; + $this->url_config['google_forum_static'] = !empty($phpbb_seo->seo_static['forum']) ? $phpbb_seo->seo_static['forum'] : 'forum'; + if ($this->url_config['modrewrite']) { // Module links + $this->url_config['google_forum_ext'] = '.xml' . $this->url_config['gzip_ext_out']; + $this->url_config['google_forum_tpl'] = $this->module_config['google_url'] . ($this->url_config['modrtype'] >= 2 ? '%2$s' . $this->url_config['google_forum_delim'] . '%1$s' . $this->url_config['google_forum_ext'] : $this->url_config['google_forum_static'] . $this->url_config['google_forum_delim'] . '%1$s' . $this->url_config['google_forum_ext']); + $this->url_config['google_forum_default'] = 'forum-sitemap' . $this->url_config['google_forum_ext']; + $this->url_config['google_annouces_default'] = $this->module_config['google_url'] . 'forum-announces' . $this->url_config['google_forum_ext']; + } + return; + } + /** + * sitemap, builds the sitemap + * @access private + */ + function sitemap() { + global $config, $phpbb_seo, $db, $user, $auth; + $approve_sql = ' AND topic_approved = 1'; + if ($this->actions['module_sub'] === 'announces') { + // Start with forums info + $forum_data = array(); + $forum_data['replies_key'] = 'topic_replies'; + $forum_data['forum_url'] = $phpbb_seo->seo_opt['virtual_folder'] ? $phpbb_seo->seo_static['global_announce'] . $phpbb_seo->seo_ext['global_announce'] : '' ; + // Do we want to list all the global announces from the forum + // Count items + $sql = "SELECT COUNT(topic_id) AS topic + FROM " . TOPICS_TABLE . " + WHERE forum_id = 0 + AND topic_type = " . POST_GLOBAL . $approve_sql; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + if(empty($row['topic'])) { + $this->gym_master->gym_error(404, 'GYM_TOO_FEW_ITEMS', __FILE__, __LINE__); + exit; + } else { + $forum_data['topic_count'] = (int) $row['topic']; + unset($row); + } + // it's the announces sitemap + $announces_sitemap_url = $this->url_config['google_annouces_default']; + $this->gym_master->seo_kill_dupes($announces_sitemap_url); + // Forum index location + $this->gym_master->parse_item($phpbb_seo->seo_path['phpbb_urlR'] . $this->url_config['forum_index'], 1, 'always', time()); + $forum_sql = ' forum_id = 0 AND topic_type = ' . POST_GLOBAL . ' AND '; + $this->list_topics($forum_sql, $forum_data, $approve_sql); + } else { + // Filter $this->actions['module_sub'] var type + $this->actions['module_sub'] = intval($this->actions['module_sub']); + if ($this->actions['module_sub'] > 0) { + // then It's a forum sitemap + // Check forum auth and grab necessary infos + $sql = "SELECT * + FROM ". FORUMS_TABLE ." f + WHERE forum_id = " . $this->actions['module_sub']; + $result = $db->sql_query($sql); + $forum_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + if ( empty($forum_data) ) { + $this->gym_master->gym_error(404, '', __FILE__, __LINE__, $sql); + } + $forum_id = (int) $forum_data['forum_id']; + if ( $forum_data['forum_type'] != FORUM_POST || !isset($this->actions['auth_view_read'][$forum_id]) ) { + $this->gym_master->gym_error(401, '', __FILE__, __LINE__); + } + // This forum is allowed, so let's start + $forum_sitemap_url = sprintf($this->url_config['google_forum_tpl'], $forum_id, str_replace($phpbb_seo->seo_delim['forum'] . $forum_id, '', $phpbb_seo->set_url($forum_data['forum_name'], $forum_id, 'forum'))); + // Approval and pagination + $paginated = $config['posts_per_page']; + $forum_data['topic_count'] = (int) $forum_data['forum_topics']; + $forum_data['replies_key'] = 'topic_replies'; + // Do not serve content if there is no topic in the forum + if ( $forum_data['topic_count'] < $this->module_config['google_threshold'] ) { + $this->gym_master->gym_error(404, 'GYM_TOO_FEW_ITEMS', __FILE__, __LINE__, $sql); + } + $this->gym_master->seo_kill_dupes($forum_sitemap_url); + $forum_data['forum_url'] = $this->gym_master->forum_url($forum_data['forum_name'], $forum_id) . $this->url_config['forum_ext']; + $this->gym_master->parse_item($phpbb_seo->seo_path['phpbb_urlR'] . $forum_data['forum_url'], 1.0, 'always', $forum_data['forum_last_post_time']); + $forum_sql = ' forum_id = ' . $forum_id . ' AND topic_type <> ' . POST_GLOBAL . ' AND '; + $this->list_topics($forum_sql, $forum_data, $approve_sql); + } else { + // it's the forums sitemap + $forum_sitemap_url = $this->module_config['google_url'] . $this->url_config['google_forum_default']; + $this->gym_master->seo_kill_dupes($forum_sitemap_url); + // Forum index location + $this->gym_master->parse_item($phpbb_seo->seo_path['phpbb_urlR'] . $this->url_config['forum_index'], 1, 'always', time()); + $sql = "SELECT * + FROM ". FORUMS_TABLE . " WHERE " . $db->sql_in_set('forum_id' , $this->actions['auth_view_read'], false, true) . " + ORDER BY forum_last_post_id " . $this->module_config['google_sort']; + $result = $db->sql_query($sql); + // Forums loop + while( $forum_data = $db->sql_fetchrow($result) ) { + $forum_id = (int) $forum_data['forum_id']; + // Make sure that the forum is auth + if (!isset($this->actions['auth_view_read'][$forum_id])) { + continue; + } + $topics_count = $forum_data['forum_topics']; + // Not enough topics in this forum, skip + if ($topics_count < $this->module_config['google_threshold']) { + continue; + } + $paginated = $forum_data['forum_topics_per_page'] ? $forum_data['forum_topics_per_page'] : $config['topics_per_page']; + $pages = ceil( ($topics_count + 1) / $paginated); + $forum_url = $phpbb_seo->seo_path['phpbb_urlR'] . $this->gym_master->forum_url($forum_data['forum_name'], $forum_id); + $forum_priority = $this->gym_master->get_priority($forum_data['forum_last_post_time'], $pages); + $forum_change = $this->gym_master->get_changefreq($forum_data['forum_last_post_time']); + $this->gym_master->parse_item( $forum_url . $this->url_config['forum_ext'], $forum_priority, $forum_change, $forum_data['forum_last_post_time']); + if ($pages > 1 && $this->module_config['google_pagination']) { + // Reset Pages limits for this topic + $pag_limit1 = $this->module_config['google_limitdown']; + $pag_limit2 = $this->module_config['google_limitup']; + // If $pag_limit2 too big for this topic, lets output all pages + $pag_limit2 = ( $pages < $pag_limit2 ) ? ($pages - 1) : $pag_limit2; + $i=1; + while ( ($i < $pages) ) { + if ( ( $i <= $pag_limit1 ) || ( $i > ($pages - $pag_limit2 ) ) ) { + $forum_priority *= 0.95; + $url = $forum_url . sprintf($this->url_config['forum_start_tpl'], $paginated * $i); + $this->gym_master->parse_item( $url, $forum_priority, $forum_change, $forum_data['forum_last_post_time']); + $i++; + } else { + $i++; + } + } + } + } // End Forum map loop + $db->sql_freeresult($result); + unset ($forum_data); + } + } + return; + } + /** + * sitemapindex, builds the sitemapindex + * @access private + */ + function sitemapindex() { + global $phpbb_seo, $db, $config, $user, $auth; + $approve_sql = ' AND topic_approved = 1'; + // It's global list call, add module sitemaps + // Reset the local counting, since we are cycling through modules + $this->output_data['url_sofar'] = 0; + // Announces map location ? + // Count items + $sql = "SELECT COUNT(topic_id) AS topic + FROM " . TOPICS_TABLE . " + WHERE forum_id = 0 + AND topic_type = " . POST_GLOBAL . $approve_sql; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + if (!empty($row['topic'])) { + unset($row); + $announces_sitemap_url = $this->url_config['google_annouces_default']; + $this->gym_master->parse_sitemap($announces_sitemap_url, $user->time_now - rand(1,150)); + } + $sql = "SELECT * + FROM ". FORUMS_TABLE . " + WHERE " . $db->sql_in_set('forum_id', $this->actions['auth_view_read'], false, true) . " + ORDER BY forum_last_post_id " . $this->module_config['google_sort']; + $result = $db->sql_query($sql); + // Reset vars + $forum_sitemap_urls = ''; + $sitemap_data = array(); + $last_ever = 0; + $num_sitemaps = 0; + while( $forum_data = $db->sql_fetchrow($result) ) { + $forum_id = (int) $forum_data['forum_id']; + // Make sure that the forum is auth + if (!isset($this->actions['auth_view_read'][$forum_id])) { + continue; + } + // Only car about approved topics + $topics_count = (int) $forum_data['forum_topics']; + // Not enough topics in this forum, skip + if ($topics_count < $this->module_config['google_threshold']) { + continue; + } + // Let's count accurately + if ($this->module_config['google_pagination']) { + $paginated = $forum_data['forum_topics_per_page'] ? $forum_data['forum_topics_per_page'] : $config['topics_per_page']; + $pages = ceil( ($topics_count + 1) / $paginated); + $num_sitemaps += min($this->module_config['google_limitdown'] + $this->module_config['google_limitup'], $pages); + } else { + $num_sitemaps++; + } + // Build sitemap url + $sitemap_data[$forum_id]['url'] = sprintf($this->url_config['google_forum_tpl'], $forum_id, str_replace($phpbb_seo->seo_delim['forum'] . $forum_id, '', $phpbb_seo->set_url($forum_data['forum_name'], $forum_id, 'forum'))); + $sitemap_data[$forum_id]['lastmod'] = $forum_data['forum_last_post_time'] > $config['board_startdate'] ? $forum_data['forum_last_post_time'] : $config['board_startdate']; + }// End Forum map loop + $db->sql_freeresult($result); + unset ($forum_data); + if (!empty($sitemap_data)) { + // only add the Forum map location if showing enough forums + if ( $num_sitemaps >= $this->module_config['google_threshold'] ) { + // Forum map location + $forum_sitemap_url = $this->module_config['google_url'] . $this->url_config['google_forum_default']; + $this->gym_master->parse_sitemap($forum_sitemap_url, $user->time_now); + } + foreach ($sitemap_data as $data) { + $this->gym_master->parse_sitemap($data['url'], $data['lastmod']); + } + unset ($sitemap_data); + } + // Add the local counting, since we are cycling through modules + $this->output_data['url_sofar_total'] = $this->output_data['url_sofar_total'] + $this->output_data['url_sofar']; + return; + } + /** + * list_topics($forum_sql, $forum_data, $approve_sql = '') builds the output for topic listing + * From a forum and from all forums + * @access private + */ + function list_topics($forum_sql, $forum_data, $approve_sql = '') { + global $db, $phpbb_seo, $auth, $config, $user; + // initial setup + $topic_sofar = 0; + $topics = array(); + $sql_first = "SELECT * + FROM " . TOPICS_TABLE . " + WHERE $forum_sql + topic_status <> " . ITEM_MOVED . " + $approve_sql + ORDER BY topic_last_post_id " . $this->module_config['google_sort']; + $paginated = $config['posts_per_page']; + while( ( $topic_sofar < $forum_data['topic_count'] ) && ($this->output_data['url_sofar'] < $this->module_config['google_url_limit']) ) { + $result = $db->sql_query_limit($sql_first, $this->module_config['google_sql_limit'], $topic_sofar); + while ($topic = $db->sql_fetchrow($result)) { + $forum_id = (int) $topic['forum_id']; + // Make sure that the forum is auth + if ((!isset($this->actions['auth_view_read'][$forum_id]) && $this->actions['module_sub'] !== 'announces') || $topic['topic_reported']) { // Skip for now if reported, approved are checked above when required + continue; + } + $pages = ceil( ($topic[$forum_data['replies_key']] + 1) / $paginated); + $topic['topic_title'] = censor_text($topic['topic_title']); + $topic_url = $phpbb_seo->seo_path['phpbb_urlR'] . $this->gym_master->topic_url($topic, $forum_id, $forum_data['forum_url']); + if ($topic['topic_type'] == POST_NORMAL ) { + $topic_priority = $this->gym_master->get_priority($topic['topic_last_post_time'], $pages); + } else { + $topic_priority = $topic['topic_type'] == POST_STICKY ? $this->module_config['google_sticky_priority'] : $this->module_config['google_announce_priority']; + } + $topic_change = ($topic['topic_status'] == ITEM_LOCKED) ? 'never' : $this->gym_master->get_changefreq($topic['topic_last_post_time']); + $topic_time = gmdate('Y-m-d\TH:i:s'.'+00:00', $topic['topic_last_post_time']); + $this->gym_master->parse_item($topic_url . $this->url_config['topic_ext'], $topic_priority, $topic_change, $topic['topic_last_post_time']); + if ($pages > 1 && $this->module_config['google_pagination']) { + // Reset Pages limits for this topic + $pag_limit1 = $this->module_config['google_limitdown']; + $pag_limit2 = $this->module_config['google_limitup']; + // If $pag_limit2 too big for this topic, lets output all pages + $pag_limit2 = ( $pages < $pag_limit2 ) ? ($pages - 1) : $pag_limit2; + $i=1; + while ( ($i < $pages) ) { + if ( ( $i <= $pag_limit1 ) || ( $i > ($pages - $pag_limit2 ) ) ) { + $topic_priority *= 0.95; + $url = $topic_url . sprintf($this->url_config['topic_start_tpl'], $paginated * $i); + $this->gym_master->parse_item($url, $topic_priority, $topic_change, $topic['topic_last_post_time']); + $i++; + } else { + $i++; + } + } + } + }// End topic loop + // Used to separate query + $topic_sofar = $topic_sofar + $this->module_config['google_sql_limit']; + $db->sql_freeresult($result); + unset($topic); + }// End Query limit loop + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/modules/google_txt.php b/phpBB/gym_sitemaps/modules/google_txt.php new file mode 100644 index 0000000000..5b75c09647 --- /dev/null +++ b/phpBB/gym_sitemaps/modules/google_txt.php @@ -0,0 +1,179 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: google_txt.php 148 2009-11-07 14:50:54Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* google_txt Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class google_txt { + var $url_settings = array(); + var $options = array(); + var $module_config = array(); + var $outputs = array(); + var $txt_files = array(); + /** + * constuctor + */ + function google_txt(&$gym_master) { + $this->gym_master = &$gym_master; + $this->options = &$this->gym_master->actions; + $this->outputs = &$this->gym_master->output_data; + $this->url_settings = &$this->gym_master->url_config; + $this->module_config = array_merge( + // Global + $this->gym_master->google_config, + // Other stuff required here + array( + 'google_sources' => $this->gym_master->path_config['gym_path'] . 'sources/', + 'google_randomize' => (boolean) $this->gym_master->gym_config['google_txt_randomize'], + 'google_unique' => (boolean) $this->gym_master->gym_config['google_txt_unique'], + 'google_check_robots' => (boolean) $this->gym_master->gym_config['google_txt_check_robots'], + 'google_force_lastmod' => (boolean) $this->gym_master->gym_config['google_txt_force_lastmod'], + ) + ); + // Check cache + $this->gym_master->gym_output->setup_cache(); // Will exit if the cache is sent + // List available files + $this->get_source_list(); + // Init url settngs + $this->init_url_settings(); + } + /** + * Initialize mod rewrite to handle multiple URL standards. + * Only one 'if' is required after this in THE loop to properly switch + * between the four types (none, advanced, mixed and simple). + * @access private + */ + function init_url_settings() { + global $phpbb_seo; + // vars will fell like rain in the code ;) + $this->url_settings['google_txt_delim'] = !empty($phpbb_seo->seo_delim['google_txt']) ? $phpbb_seo->seo_delim['google_txt'] : '-'; + $this->url_settings['google_txt_static'] = !empty($phpbb_seo->seo_static['google_txt']) ? $phpbb_seo->seo_static['google_txt'] : 'txt'; + $this->url_settings['modrewrite'] = $this->module_config['google_modrewrite']; + + if ($this->url_settings['modrewrite']) { // Module links + $this->url_settings['google_txt_tpl'] = $this->module_config['google_url'] . 'txt' . $this->url_settings['google_txt_delim'] . '%1$s.xml' . $this->url_settings['gzip_ext_out']; + } else { + $this->url_settings['google_txt_tpl'] = $this->module_config['google_url'] . $this->url_settings['google_default'] . '?txt=%1$s'; + } + return; + } + /** + * sitemap, builds the sitemap + * @access private + */ + function sitemap() { + global $cache, $phpEx, $config; + if (!empty($this->txt_files[$this->options['module_sub']])) { + // Check robots.txt ? + if ($this->module_config['google_check_robots']) { + $this->gym_master->obtain_robots_disallows(); + } + $sitemap_txt_url = sprintf( $this->url_settings['google_txt_tpl'], $this->options['module_sub'] ); + $this->gym_master->seo_kill_dupes($sitemap_txt_url); + $txt_file = $this->txt_files[$this->options['module_sub']]; + // Grab data + if (($txt_data = @file($txt_file)) && is_array($txt_data)) { + $last_mod = (int) @filemtime($txt_file); + $url_count = count($txt_data); + $this->outputs['last_mod_time'] = $last_mod > $config['board_startdate'] ? $last_mod : (time() - rand(500, 10000)); + // Randomize ? + if ($this->module_config['google_randomize']) { + shuffle($txt_data); + } + // Limit ? + if ($this->module_config['google_url_limit'] > 0 && $this->module_config['google_url_limit'] < $url_count) { + $txt_data = array_slice($txt_data, 0, $this->module_config['google_url_limit']); + } + // Force last mod ? + $last_mod = $this->module_config['google_force_lastmod'] ? $this->outputs['last_mod_time'] : 0; + // Parse URLs + $dt = rand(0, 3600); + $url_check = array(); + foreach ($txt_data as $key => $url) { + $url = trim($url); + if (empty($url) || ($this->module_config['google_check_robots'] && $this->gym_master->is_robots_disallowed($url))) { + continue; + } + // Check unique ? + if ($this->module_config['google_unique']) { + if (isset($url_check[$url])) { + continue; + } + $url_check[$url] = 1; + } + if ($this->module_config['google_force_lastmod']) { + $_last_mod = $last_mod - $dt; + $priority = $this->gym_master->get_priority($_last_mod); + $changefreq = $this->gym_master->get_changefreq($_last_mod); + } else { + $_last_mod = $priority = $changefreq = 0; + } + $this->gym_master->parse_item(utf8_htmlspecialchars($url), $priority, $changefreq, $_last_mod); + $dt += rand(30, 3600*12); + unset($txt_data[$key]); + } + } else { + // Clear the cache to make sure the guilty url is not shown in the sitemapIndex + $cache->destroy('_gym_config_google_txt'); + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + } else { + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + return; + } + /** + * sitemapindex, builds the sitemapindex + * @access private + */ + function sitemapindex() { + global $config; + // It's global list call, add module sitemaps + // Reset the local counting, since we are cycling through modules + $this->outputs['url_sofar'] = 0; + foreach ($this->txt_files as $txt_action => $source) { + $sitemap_txt_url = sprintf( $this->url_settings['google_txt_tpl'], $txt_action );; + $last_mod = (int) @filemtime($txt_file); + $last_mod = ($last_mod > $config['board_startdate'] && !$this->module_config['google_force_lastmod']) ? $last_mod : (time() - rand(500, 10000)); + $this->gym_master->parse_sitemap($sitemap_txt_url, $last_mod); + } + // Add the local counting, since we are cycling through modules + $this->outputs['url_sofar_total'] = $this->outputs['url_sofar_total'] + $this->outputs['url_sofar']; + return; + } + /** + * get_source_list, builds the available sitemap list + * @access private + */ + function get_source_list() { + global $cache; + if (($this->txt_files = $cache->get('_gym_config_google_txt')) === false) { + $this->txt_files = array(); + $RegEx = '`^google_([a-z0-9_-]+)\.txt`i'; + $txt_dir = @opendir( $this->module_config['google_sources'] ); + while( ($txt_file = @readdir($txt_dir)) !== false ) { + if(preg_match($RegEx, $txt_file, $matches)) { + if (!empty($matches[1])) { + $this->txt_files[$matches[1]] = $this->module_config['google_sources'] . 'google_' . $matches[1] . '.txt'; + } + } + } + @closedir($txt_dir); + $cache->put('_gym_config_google_txt', $this->txt_files); + } + return; + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/modules/google_xml.php b/phpBB/gym_sitemaps/modules/google_xml.php new file mode 100644 index 0000000000..a41882e60f --- /dev/null +++ b/phpBB/gym_sitemaps/modules/google_xml.php @@ -0,0 +1,247 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: google_xml.php 148 2009-11-07 14:50:54Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* google_xml Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class google_xml { + var $url_settings = array(); + var $options = array(); + var $module_config = array(); + var $outputs = array(); + var $xml_files = array(); + /** + * constuctor + */ + function google_xml(&$gym_master) { + $this->gym_master = &$gym_master; + $this->options = &$this->gym_master->actions; + $this->outputs = &$this->gym_master->output_data; + $this->url_settings = &$this->gym_master->url_config; + $this->module_config = array_merge( + // Global + $this->gym_master->google_config, + // Other stuff required here + array( + 'google_sources' => $this->gym_master->path_config['gym_path'] . 'sources/', + 'google_randomize' => (boolean) $this->gym_master->gym_config['google_xml_randomize'], + 'google_unique' => (boolean) $this->gym_master->gym_config['google_xml_unique'], + 'google_check_robots' => (boolean) $this->gym_master->gym_config['google_xml_check_robots'], + 'google_force_limit' => (boolean) $this->gym_master->gym_config['google_xml_force_limit'], + 'google_force_lastmod' => (boolean) $this->gym_master->gym_config['google_xml_force_lastmod'], + ) + ); + $this->module_config['xml_parse'] = (boolean) ($this->module_config['google_randomize'] || $this->module_config['google_unique'] || $this->module_config['google_force_limit'] || $this->module_config['google_force_lastmod']|| $this->module_config['google_check_robots']); + // Check cache + $this->gym_master->gym_output->setup_cache(); // Will exit if the cache is sent + // List available files + $this->get_source_list(); + // Init url settngs + $this->init_url_settings(); + } + /** + * Initialize mod rewrite to handle multiple URL standards. + * Only one 'if' is required after this in THE loop to properly switch + * between the four types (none, advanced, mixed and simple). + * @access private + */ + function init_url_settings() { + global $phpbb_seo; + // vars will fell like rain in the code ;) + $this->url_settings['google_xml_delim'] = !empty($phpbb_seo->seo_delim['google_xml']) ? $phpbb_seo->seo_delim['google_xml'] : '-'; + $this->url_settings['google_xml_static'] = !empty($phpbb_seo->seo_static['google_xml']) ? $phpbb_seo->seo_static['google_xml'] : 'xml'; + $this->url_settings['modrewrite'] = $this->module_config['google_modrewrite']; + + if ($this->url_settings['modrewrite']) { // Module links + $this->url_settings['google_xml_tpl'] = $this->module_config['google_url'] . 'xml' . $this->url_settings['google_xml_delim'] . '%1$s.xml' . $this->url_settings['gzip_ext_out']; + } else { + $this->url_settings['google_xml_tpl'] = $this->module_config['google_url'] . $this->url_settings['google_default'] . '?xml=%1$s'; + } + return; + } + /** + * sitemap, builds the sitemap + * @access private + */ + function sitemap() { + global $cache, $phpEx, $config, $user; + if (!empty($this->xml_files[$this->options['module_sub']])) { + // Check robots.txt ? + if ($this->module_config['google_check_robots']) { + $this->gym_master->obtain_robots_disallows(); + } + $sitemap_xml_url = sprintf( $this->url_settings['google_xml_tpl'], $this->options['module_sub'] ); + $this->gym_master->seo_kill_dupes($sitemap_xml_url); + $xml_file = $this->xml_files[$this->options['module_sub']]; + // Grab data + if (strpos($xml_file, 'http://') !== false) { + @ini_set('user_agent','GYM Sitemaps & RSS / www.phpBB-SEO.com'); + // You may want to use a higher value for the timout in case you use slow external sitemaps + @ini_set('default_socket_timeout', 5); + } + if ($xml_data = @file_get_contents($xml_file)) { + if (!empty($http_response_header)) { + $_last_mod = get_date_from_header($http_response_header); + } else { + $_last_mod = (int) @filemtime($xml_file); + } + $this->outputs['last_mod_time'] = $_last_mod > $config['board_startdate'] ? $_last_mod : ($user->time_now - rand(500, 10000)); + if (($url_tag_pos = utf8_strpos($xml_data, '<url>')) === false) { + // this basic test failed + // @TODO add loggs about this ? + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + if (!$this->module_config['xml_parse']) { + // use our hown headers + $xml_data = str_replace('</urlset>', '', trim($xml_data) ); + // Add to the output variable + $this->outputs['data'] .= substr($xml_data, $url_tag_pos); + // Link count + $this->outputs['url_sofar'] = preg_match_all('`\<loc\>[^<>]+\</loc\>`Ui', $xml_data, $matches); + // free memory + unset($xml_data, $matches); + } else { + $total_matches = preg_match_all('`\<url\>.+\</url\>`Usi', $xml_data, $matches, PREG_SET_ORDER); + // free memory + unset($xml_data); + if (!empty($matches)) { + // Randomize ? + if ($this->module_config['google_randomize']) { + shuffle($matches); + } + // Limit ? + if ($this->module_config['google_url_limit'] > 0 && $this->module_config['google_url_limit'] < $total_matches) { + $matches = array_slice($matches, 0, $this->module_config['google_url_limit']); + } + // Force last mod ? + $_last_mod = $this->module_config['google_force_lastmod'] ? $this->outputs['last_mod_time'] : 0; + // Parse URLs + $dt = rand(0, 3600); + $url_check = array(); + foreach ($matches as $key => $data) { + preg_match_all('`\<(loc|lastmod|changefreq|priority)\>([^<>]+)\</\1\>`Ui', $data[0], $url_tags, PREG_SET_ORDER); + $loc = $priority = $changefreq = $lastmod = ''; + foreach ($url_tags as $url_tag) { + if (empty($url_tag[1]) || empty($url_tag[2])) { + continue; + } + $url_tag[1] = strtolower($url_tag[1]); + ${$url_tag[1]} = trim($url_tag[2]); + } + if (empty($loc)) { + continue; + } + // Check unique ? + if ($this->module_config['google_unique']) { + if (isset($url_check[$loc])) { + continue; + } + $url_check[$loc] = 1; + } + if ($this->module_config['google_check_robots'] && $this->gym_master->is_robots_disallowed($loc)) { + continue; + } + if ($this->module_config['google_force_lastmod']) { + $last_mod = $_last_mod - $dt; + $priority = $this->gym_master->get_priority($last_mod); + $changefreq = $this->gym_master->get_changefreq($last_mod); + $lastmod = gmdate('Y-m-d\TH:i:s'.'+00:00', $last_mod); + } else { + $lastmod = !empty($lastmod) ? $lastmod : 0; + $priority = !empty($priority) ? $priority : 0; + $changefreq = !empty($changefreq) ? $changefreq : 0; + } + $this->parse_item($loc, $priority, $changefreq, $lastmod); + unset($matches[$key]); + $dt += rand(30, 3600*12); + } + unset($url_check); + } else { + // Clear the cache to make sure the guilty url is not shown in the sitemapIndex + $cache->destroy('_gym_config_google_xml'); + $this->gym_master->gym_error(500, '', __FILE__, __LINE__); + } + + } + } else { + // Clear the cache to make sure the guilty url is not shown in the sitemapIndex + $cache->destroy('_gym_config_google_xml'); + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + } else { + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + return; + } + /** + * sitemapindex, builds the sitemapindex + * @access private + */ + function sitemapindex() { + global $config; + // It's global list call, add module sitemaps + // Reset the local counting, since we are cycling through modules + $this->outputs['url_sofar'] = 0; + foreach ($this->xml_files as $xml_action => $source) { + $sitemap_xml_url = sprintf( $this->url_settings['google_xml_tpl'], $xml_action ); + $last_mod = (int) @filemtime($xml_file); + $last_mod = ($last_mod > $config['board_startdate'] && !$this->module_config['google_force_lastmod']) ? $last_mod : (time() - rand(500, 10000)); + $this->gym_master->parse_sitemap($sitemap_xml_url, $last_mod); + } + // Add the local counting, since we are cycling through modules + $this->outputs['url_sofar_total'] = $this->outputs['url_sofar_total'] + $this->outputs['url_sofar']; + return; + } + /** + * get_source_list, builds the available sitemap list + * @access private + */ + function get_source_list() { + global $cache, $phpEx; + if (($this->xml_files = $cache->get('_gym_config_google_xml')) === false) { + $this->xml_files = array(); + // Check the eventual external url config + if (file_exists($this->module_config['google_sources'] . "xml_google_external.$phpEx")) { + include($this->module_config['google_sources'] . "xml_google_external.$phpEx"); + // Duplicated keys will be overriden bellow + $this->xml_files = array_merge($this->xml_files, $external_setup); + } + $RegEx = '`^google_([a-z0-9_-]+)\.xml$`i'; + $xml_dir = @opendir( $this->module_config['google_sources'] ); + while( ($xml_file = @readdir($xml_dir)) !== false ) { + if(preg_match($RegEx, $xml_file, $matches)) { + if (!empty($matches[1])) { + $this->xml_files[$matches[1]] = $this->module_config['google_sources'] . 'google_' . $matches[1] . '.xml'; + } + } + } + @closedir($xml_dir); + $cache->put('_gym_config_google_xml', $this->xml_files); + } + return; + } + /** + * parse_item() adds the item info to the output + */ + function parse_item($url, $priority = 1.0, $changefreq = 'always', $lastmodtime = 0) { + global $config, $user; + $changefreq = isset($this->gym_master->freq_values[$changefreq]) ? sprintf($this->gym_master->style_config['changefreq_tpl'], $changefreq) : ''; + $priority = $priority <= 1 && $priority > 0 ? sprintf($this->gym_master->style_config['priority_tpl'], $priority) : ''; + $lastmodtime = $lastmodtime > $config['board_startdate'] ? sprintf($this->gym_master->style_config['lastmod_tpl'], $lastmodtime) : ''; + $this->gym_master->output_data['data'] .= sprintf($this->gym_master->style_config['Sitemap_tpl'], $url, $lastmodtime, $changefreq, $priority); + $this->gym_master->output_data['url_sofar']++; + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/modules/html_forum.php b/phpBB/gym_sitemaps/modules/html_forum.php new file mode 100644 index 0000000000..5c8441474c --- /dev/null +++ b/phpBB/gym_sitemaps/modules/html_forum.php @@ -0,0 +1,665 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: html_forum.php 262 2010-04-20 11:06:58Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* html_forum Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class html_forum { + var $url_settings = array(); + var $options = array(); + var $module_config = array(); + var $outputs = array(); + var $forum_cache = array(); + var $call = array(); + var $topic_tracking_info = array(); + var $tracking_topics = array(); + var $forum_tracking_info = array(); + var $forum_datas = array(); + var $icons = array(); + var $html_switch = array(); + var $start = 0; + var $module_auth = array(); + var $actions = array(); + /** + * constuctor + */ + function html_forum(&$gym_master) { + global $phpbb_seo; + $this->gym_master = &$gym_master; + $this->actions = &$this->gym_master->actions; + $this->outputs = &$this->gym_master->output_data; + $this->module_config = &$this->gym_master->html_config; + $this->url_settings = &$this->gym_master->url_config; + $this->start = &$this->gym_master->start; + $this->html_switch = &$this->gym_master->html_switch; + $this->module_auth = &$this->gym_master->module_auth; + $this->module_config['html_last_topics_exclude_list'] = ''; + $this->module_config = array_merge( + // Global + $this->module_config, + // Other stuff required here + array( + 'html_forum_news_ids' => trim($this->gym_master->gym_config['html_forum_news_ids'], ','), + 'html_forum_ltopic' => (int) $this->gym_master->gym_config['html_forum_ltopic'], + 'html_forum_ltopic_pagination' => (int) $this->gym_master->gym_config['html_forum_ltopic_pagination'], + 'html_forum_cat_ltopic' => (int) $this->gym_master->gym_config['html_forum_cat_ltopic'], + 'html_forum_news_ltopic' => (int) $this->gym_master->gym_config['html_forum_news_ltopic'], + 'html_forum_cat_news_ltopic' => (int) $this->gym_master->gym_config['html_forum_cat_news_ltopic'], + 'html_forum_last_post' => (boolean) $this->gym_master->gym_auth_value($this->gym_master->gym_config['html_forum_last_post']), + 'html_forum_first' => ((int) $this->gym_master->gym_config['html_forum_first']) ? 'first' : 'last', + 'html_forum_news_first' => ((int) $this->gym_master->gym_config['html_forum_news_first']) ? 'first' : 'last', + 'html_forum_post_buttons' => (boolean) $this->gym_master->gym_auth_value($this->gym_master->gym_config['html_forum_post_buttons']), + 'html_exclude_list' => trim($this->gym_master->gym_config['html_forum_exclude'], ','), + 'html_ltopic_exclude' => trim($this->gym_master->gym_config['html_forum_ltopic_exclude'], ','), + 'html_forum_desc' => (boolean) $this->gym_master->gym_auth_value($this->gym_master->gym_config['html_forum_desc']), + 'html_forum_rules' => (boolean) $this->gym_master->gym_auth_value($this->gym_master->gym_config['html_forum_rules']), + ) + ); + // Build unauthed arrays + $this->module_config['exclude_list'] = $this->gym_master->set_exclude_list($this->module_config['html_exclude_list']); + // Wee need to check auth here + $this->gym_master->check_forum_auth($this->module_config['html_auth_guest']); + $this->actions['auth_guest_list'] = array_diff_assoc($this->module_auth['forum']['public_list'], $this->module_config['exclude_list']); + $this->actions['auth_guest_read'] = array_diff_assoc($this->module_auth['forum']['public_read'], $this->module_config['exclude_list']); + $this->actions['auth_view_list'] = array_diff_assoc($this->module_auth['forum']['list'], $this->module_config['exclude_list']); + $this->actions['auth_view_read'] = array_diff_assoc($this->module_auth['forum']['read'], $this->module_config['exclude_list']); + // Mod rewrite type auto detection + $this->url_settings['modrtype'] = ($phpbb_seo->modrtype >= 0) ? intval($phpbb_seo->modrtype) : intval($this->module_config['html_modrtype']); + // make sure virtual_folder uses the proper value + // Set up urls + $html_def = $this->url_settings['html_default']; + if ($this->module_config['html_modrewrite']) { + $html_news_def = $this->url_settings['html_news_default']; + $this->url_settings['html_forum_map'] = $html_def . 'forum/'; + $this->url_settings['html_forum_cat_map'] = $html_def . 'forum/%1$s/'; + $this->url_settings['html_forum_news'] = $html_news_def . 'forum/'; + $this->url_settings['html_forum_cat_news'] = $html_news_def . 'forum/%1$s/'; + $this->url_settings['html_forum_global_map'] = $html_def . 'forum/global/'; + $this->url_settings['html_forum_global_news'] = $html_news_def . 'forum/global/'; + $this->url_settings['html_forum_announce_map'] = $html_def . 'forum/announce/'; + $this->url_settings['html_forum_announce_news'] = $html_news_def . 'forum/announce/'; + $this->url_settings['html_forum_sticky_map'] = $html_def . 'forum/sticky/'; + $this->url_settings['html_forum_sticky_news'] = $html_news_def . 'forum/sticky/'; + } else { + $this->url_settings['html_forum_map'] = $html_def . '?forum'; + $this->url_settings['html_forum_cat_map'] = $html_def . '?forum=%2$s'; + $this->url_settings['html_forum_news'] = $html_def . '?forum=news'; + $this->url_settings['html_forum_cat_news'] = $html_def . '?forum=%2$s&news'; + $this->url_settings['html_forum_global_map'] = $html_def . '?forum=global'; + $this->url_settings['html_forum_global_news'] = $html_def . '?forum=global&news'; + $this->url_settings['html_forum_announce_map'] = $html_def . '?forum=announce'; + $this->url_settings['html_forum_announce_news'] = $html_def . '?forum=announce&news'; + $this->url_settings['html_forum_sticky_map'] = $html_def . '?forum=sticky'; + $this->url_settings['html_forum_sticky_news'] = $html_def . '?forum=sticky&news'; + } + } + /** + * Initialize forum output. + * Will as well compute all required info to be able to : + * - Know what url should be used + * - Know if the call is active and auth + * - Set up all params for the up comming call if necessary (when not caching) + * Please note : + * This method must exist in other modules, called by html_output in gym_html.php through load_module + * @access private + */ + function html_init() { + global $user, $db, $phpbb_seo, $auth, $config, $phpEx, $phpbb_root_path; + $nav_url = $nav_title = false; + $this->url_settings['current'] = $this->module_config['html_url']; + + $this->outputs['right_col_cache_file'] = $this->actions['html_news_list'] ? 'forum_ltopics_news' : 'forum_ltopics_map'; + // will pass variables to the render class + $this->call = array( + 'forum_id' => 0, + 'topic_id' => 0, + 'limit' => 0, + 'limit_time' => 0, + 'sort' => 'DESC', + 'display_user_info' => $this->module_config['html_allow_profile'], + 'display_user_link' => $this->module_config['html_allow_profile_links'], + 'display_link' => true, + 'display_online' => $this->module_config['html_disp_online'], + 'display_post_buttons' => $this->module_config['html_forum_post_buttons'], + 'display_pagination' => 0, + 'display_last_post' => $this->module_config['html_forum_last_post'], + 'display_file' => $this->url_settings['html_default'], + 'display_tracking' => $this->module_config['html_disp_tracking'], + 'display_topic_status' => $this->module_config['html_disp_status'], + 'display_sig' => $this->module_config['html_allow_sig'], + 'display_order' => 'first', + 'display_desc' => $this->module_config['html_forum_desc'], + 'display_rules' => $this->module_config['html_forum_rules'], + 'display_sumarize' => $this->module_config['html_sumarize'], + 'display_sumarize_method' => $this->module_config['html_sumarize_method'], + 'display_topic_pagination' => $this->module_config['html_item_pagination'], + 'function' => false, + 'method' => false, + 'file' => false, + 's_global' => false, + 'forum_sql' => '', + 'topic_sql' => '', + 'single_forum' => false, + 'cat_forum' => false, + 'display_last_topic' => 0, + 'last_topic_pagination' => $this->module_config['html_forum_ltopic_pagination'], + ); + //$this->module_config['exclude_list'] = $this->module_config['exclude_list'] + $this->module_config['global_exclude_list']; + $pre_set = false; + $type_key = $_key = ''; + switch ($this->actions['module_sub']) { + case 'global': + $this->actions['is_auth'] = $this->actions['is_active'] = true; + $this->call['s_global'] = $this->actions['is_public'] = true; + $this->call['forum_sql'] = "t.forum_id = 0"; + $this->call['topic_sql'] = "t.topic_type = " . POST_GLOBAL; + $type_key = 'forum_global'; + $pre_set = true; + case 'announce': + if (!$pre_set) { + $this->actions['is_public'] = $this->actions['is_auth'] = $this->actions['is_active'] = !empty($this->module_auth['forum']['read_post']); + if (empty($this->actions['auth_view_read'])) { + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + $this->call['forum_sql'] = $db->sql_in_set('t.forum_id', $this->actions['auth_view_read'], false, true); + $this->call['topic_sql'] = "t.topic_type = " . POST_ANNOUNCE; + $type_key = 'forum_announce'; + $pre_set = true; + } + case 'sticky': + if (!$pre_set) { + $this->actions['is_public'] = $this->actions['is_auth'] = $this->actions['is_active'] = !empty($this->module_auth['forum']['read_post']); + if (empty($this->actions['auth_view_read'])) { + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + $this->call['forum_sql'] = $db->sql_in_set('t.forum_id', $this->actions['auth_view_read'], false, true); + $this->call['topic_sql'] = "t.topic_type = " . POST_STICKY; + $type_key = 'forum_sticky'; + $pre_set = true; + } + if ($this->module_config['html_allow_news'] || $this->module_config['html_allow_map']) { + if ($this->actions['html_news_list'] && $this->module_config['html_allow_news']) { + $_key = 'news'; + $this->outputs['left_col_tpl'] = 'gym_sitemaps/display_posts_list.html'; + $this->outputs['right_col'] = $this->call['display_last_topic'] = $this->module_config['html_forum_news_ltopic']; + $this->actions['pagination_limit'] = $this->call['limit'] = $this->module_config['html_news_pagination_limit']; + $this->call['method'] = 'display_posts'; + $this->call['display_pagination'] = $this->module_config['html_news_pagination']; + $this->call['limit_time'] = $this->module_config['html_news_time_limit']; + $this->call['sort'] = $this->module_config['html_news_sort']; + $this->call['display_pagination'] = $this->module_config['html_news_pagination']; + $this->call['display_order'] = $this->module_config['html_forum_news_first']; + $this->call['file'] = 'display_posts.' . $phpEx; + } else if ($this->actions['html_map_list'] && $this->module_config['html_allow_map']) { + $_key = 'map'; + $this->outputs['left_col_tpl'] = 'gym_sitemaps/display_topics_list.html'; + $this->outputs['right_col'] = $this->call['display_last_topic'] = $this->module_config['html_forum_ltopic']; + $this->actions['pagination_limit'] = $this->call['limit'] = $this->module_config['html_pagination_limit']; + $this->call['method'] = 'display_topics'; + $this->call['display_pagination'] = $this->module_config['html_pagination']; + $this->call['limit_time'] = $this->module_config['html_map_time_limit']; + $this->call['sort'] = $this->module_config['html_sort']; + $this->call['display_pagination'] = $this->module_config['html_pagination']; + $this->call['display_order'] = $this->module_config['html_forum_first']; + $this->call['file'] = 'display_topics.' . $phpEx; + } + if (!empty($_key)) { + $this->outputs['page_title'] = $user->lang['HTML_' . strtoupper($type_key) . '_' . strtoupper($_key)]; + $this->outputs['left_col_cache_file'] = $type_key . '_' . $_key; + $this->url_settings['current'] .= $this->gym_master->html_build_url('html_' . $type_key . '_' . $_key); + } + $this->start = $this->call['display_pagination'] ? $this->gym_master->chk_start($this->start, $this->call['limit']) : 0; + } + // current url + $this->call['display_file'] = $this->url_settings['current']; + $this->url_settings['current'] .= $this->gym_master->html_add_start($this->start); + break; + case 'news': + if ($this->actions['html_news_list']) { + $this->outputs['left_col_tpl'] = 'gym_sitemaps/display_posts_list.html'; + $this->outputs['left_col_cache_file'] = "forum_news"; + $this->outputs['page_title'] = sprintf($user->lang['HTML_NEWS_OF'], $this->module_config['html_sitename']); + // Auth and active switches + $this->actions['is_auth'] = $this->actions['is_active'] = $this->actions['is_public'] = true; + $this->outputs['right_col'] = $this->call['display_last_topic'] = $this->module_config['html_forum_news_ltopic']; + $this->actions['pagination_limit'] = $this->call['limit'] = $this->module_config['html_news_pagination_limit']; + $this->module_config['html_forum_news_ids'] = $this->gym_master->set_exclude_list($this->module_config['html_forum_news_ids']); + if (empty($this->module_config['html_forum_news_ids'])) { + $this->actions['auth_view_read'] = array_diff_assoc($this->module_auth['forum']['read_post'], $this->module_config['exclude_list']); + $this->actions['is_auth'] = $this->actions['is_active'] = !empty($this->actions['auth_view_read']); + $this->call['single_forum'] = sizeof($this->actions['auth_view_read']) > 1 ? false : true; + if (empty($this->actions['auth_view_read'])) { + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + // Output news from all authed forums + $this->call['forum_sql'] = $db->sql_in_set('t.forum_id', $this->actions['auth_view_read'], false, true); + } else { + $this->call['single_forum'] = sizeof($this->module_config['html_forum_news_ids']) > 1 ? false : true; + // No exclude list here ! + $this->call['forum_sql'] = $db->sql_in_set('t.forum_id', $this->module_config['html_forum_news_ids'], false, true); + } + $this->call['method'] = 'display_posts'; + $this->call['display_pagination'] = $this->module_config['html_news_pagination']; + $this->call['limit_time'] = $this->module_config['html_news_time_limit']; + $this->call['sort'] = $this->module_config['html_news_sort']; + $this->call['display_pagination'] = $this->module_config['html_news_pagination']; + $this->call['display_order'] = $this->module_config['html_forum_news_first']; + $this->call['file'] = 'display_posts.' . $phpEx; + // current url + $this->start = $this->call['display_pagination'] ? $this->gym_master->chk_start($this->start, $this->call['limit']) : 0; + $this->url_settings['current'] .= $this->gym_master->html_build_url('html_forum_news'); + $this->call['display_file'] = $this->url_settings['current']; + $this->url_settings['current'] .= $this->gym_master->html_add_start($this->start); + } + break; + default: + if ($this->actions['html_map_list'] && (empty($this->actions['module_sub']) || $this->actions['module_sub'] == 'map')) { + // Expected URL + $this->url_settings['current'] .= $this->url_settings['html_forum_map']; + $this->call['display_file'] = $this->url_settings['current']; + $this->outputs['left_col_tpl'] = 'gym_sitemaps/display_forums_list.html'; + $this->outputs['left_col_cache_file'] = "forum_map"; + $this->actions['is_public'] = $this->actions['is_auth'] = true; + $this->actions['is_active'] = (boolean) ($this->module_config['html_allow_cat_news'] || $this->module_config['html_allow_cat_map'] ); + $this->outputs['right_col'] = $this->call['display_last_topic'] = $this->module_config['html_forum_ltopic']; + $this->outputs['page_title'] = sprintf($user->lang['HTML_MAP_OF'], $this->module_config['html_sitename']); + $this->call['file'] = 'display_forums.' . $phpEx; + $this->call['method'] = 'display_forums'; + // Here we need to be able to list categories as well as forums + // List all listable forums except excluded and links + if (empty($this->actions['auth_view_list'])) { + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + $this->call['forum_sql'] = $db->sql_in_set('f.forum_id', $this->actions['auth_view_list'], false, true); + } else if ($this->actions['html_news_list'] || $this->actions['html_map_list']) { + // Filter $this->actions['module_sub'] var type + $this->actions['module_sub'] = (int) $this->actions['module_sub']; + if ($this->actions['module_sub'] > 0) { // Forum map or news + $forum_id = $this->call['forum_id'] = $this->actions['module_sub']; + + // Here we need to be able to list categories as well as forums + // A forum news or map is viewable when is a readable postable forum or a listable forum cat + // (with authed children see below) + $this->actions['is_auth'] = (boolean) ( isset($this->actions['auth_view_read'][$forum_id]) || (isset($this->module_auth['forum']['skip_cat'][$forum_id]) && isset($this->actions['auth_view_list'][$forum_id])) ); + $this->actions['is_public'] = (boolean) isset($this->actions['auth_guest_list'][$forum_id]); + $this->call['single_forum'] = true; + if ($this->actions['html_news_list'] ) { + $this->actions['is_active'] = true; + $key = 'news'; + $this->actions['pagination_limit'] = $this->call['limit'] = $this->module_config['html_news_pagination_limit']; + $this->outputs['right_col'] = $this->call['display_last_topic'] = $this->module_config['html_forum_cat_news_ltopic']; + $this->outputs['left_col_tpl'] = 'gym_sitemaps/display_posts_list.html'; + $this->call['file'] = 'display_posts.' . $phpEx; + $this->call['display_pagination'] = $this->module_config['html_news_pagination']; + $this->call['limit_time'] = $this->module_config['html_cat_news_time_limit']; + $this->call['display_order'] = $this->module_config['html_forum_news_first']; + $this->call['sort'] = $this->module_config['html_cat_news_sort']; + $this->call['method'] = 'display_posts'; + } else if ($this->actions['html_map_list']) { + $this->actions['is_active'] = true; + $key = 'map'; + $this->actions['pagination_limit'] = $this->call['limit'] = $this->module_config['html_pagination_limit']; + $this->outputs['right_col'] = $this->call['display_last_topic'] = $this->module_config['html_forum_cat_ltopic']; + $this->outputs['left_col_tpl'] = 'gym_sitemaps/display_topics_list.html'; + $this->call['file'] = 'display_topics.' . $phpEx; + $this->call['display_pagination'] = $this->module_config['html_pagination']; + $this->call['limit_time'] = $this->module_config['html_cat_time_limit']; + $this->call['sort'] = $this->module_config['html_cat_sort']; + $this->call['display_order'] = $this->module_config['html_forum_first']; + $this->call['method'] = 'display_topics'; + } + // Upon single forum calls, grabb forum data separatelly to allow access to forum data when there is no topic to list + // As well prevent topic row from listing repeated forum data + if ($this->actions['is_active']) { + $sql = "SELECT * + FROM " . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + if ($row = $db->sql_fetchrow($result)) { + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + $phpbb_seo->set_url($row['forum_name'], $forum_id, 'forum'); + // www.phpBB-SEO.com SEO TOOLKIT END + $this->forum_datas[$forum_id] = array_merge($row, array( + 'forum_url' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), + 'm_approve' => $auth->acl_get('m_approve', $forum_id), + )); + if ($row['forum_password']) { + login_forum_box($row); + } + } else { // Forum does not exist + $this->actions['is_active'] = false; + } + } + if ($this->actions['is_active']) { + $this->call['forum_sql'] = "t.forum_id = $forum_id"; + if ($this->forum_datas[$forum_id]['forum_type'] == FORUM_CAT) { + $this->call['cat_forum'] = $forum_id; + // lets check childrens + if ($f_ids = $this->gym_master->get_forum_children($forum_id)) { + $this->call['forum_sql'] = $db->sql_in_set('t.forum_id', array_keys($f_ids), false, true); + $this->call['single_forum'] = false; + } else { + // Cat with no readable sub forums + $this->actions['is_active'] = false; + } + } + $this->start = $this->call['display_pagination'] ? $this->gym_master->chk_start($this->start, $this->call['limit']) : 0; + $this->url_settings['current'] .= $this->gym_master->html_build_url('html_forum_cat_' . $key, $phpbb_seo->seo_url['forum'][$forum_id], $forum_id); + $this->call['display_file'] = $this->url_settings['current']; + $this->url_settings['current'] .= $this->gym_master->html_add_start($this->start); + $this->outputs['page_title'] = sprintf($user->lang['HTML_' . strtoupper($key) . '_OF'], $this->forum_datas[$forum_id]['forum_name']); + if ($this->module_config['html_allow_' . $key]) { + $nav_url = $this->url_settings['html_forum_' . $key]; + $nav_title = sprintf($user->lang['HTML_' . strtoupper($key) . '_OF'], $this->module_config['html_sitename']); + } + $this->outputs['left_col_cache_file'] = "forum_$key" . "_$forum_id"; + // Enable forum tracking + $_REQUEST['f'] = $this->call['forum_id']; + // Track user viewing this forum + $this->outputs['single_traking'] = true; + } + } + } + break; + } + if ($nav_url) { + global $template; + // Add Module page in navigation links + $template->assign_block_vars('navlinks', array( + 'FORUM_NAME' => $nav_title, + 'U_VIEW_FORUM' => append_sid($this->module_config['html_url'] . $nav_url)) + ); + } + return; + } + /** + * html_main() will build the module's main output + * @access private + */ + function html_main() { + if (!empty($this->call['file'])) { + require_once($this->gym_master->path_config['gym_path'] . 'display/' . $this->call['file']); + } + if (!empty($this->call['method'])) { + $output = new $this->call['method']($this); + } + return; + } + /** + * html_module() + * Add local optional module content to the main output, last_topics in our case + * @access private + */ + function html_module() { + if (!empty($this->call['display_last_topic'])) { + $this->last_topics($this->call['display_last_topic']); + } + return; + } + /** + * html_index() + * Add local links to the main site map + * @access private + */ + function html_index() { + global $user; + // We need to take care about overrides + $override = $this->gym_master->gym_config['html_override']; + $forum_allow_cat_map = (boolean) get_gym_option('html', 'forum', 'allow_cat_map', $override, $this->gym_master->gym_config); + $forum_allow_cat_news = (boolean) get_gym_option('html', 'forum', 'allow_cat_news', $override, $this->gym_master->gym_config); + $forum_allow_map = (boolean) get_gym_option('html', 'forum', 'allow_map', $override, $this->gym_master->gym_config); + $forum_allow_news = (boolean) get_gym_option('html', 'forum', 'allow_news', $override, $this->gym_master->gym_config); + if (!$forum_allow_cat_map && !$forum_allow_cat_news && !$forum_allow_map && !$forum_allow_news) { + return; + } + $this->outputs['module_data']['forum'] = array( + 'title' => $this->gym_master->gym_config['html_forum_sitename'], + 'desc' => $this->gym_master->gym_config['html_forum_site_desc'], + 'img' => '', + 'map_url' => $forum_allow_map && ($forum_allow_cat_map || $forum_allow_cat_news) ? $this->module_config['html_url'] . $this->url_settings['html_forum_map'] : false, + 'news_url' => $forum_allow_news ? $this->module_config['html_url'] . $this->url_settings['html_forum_news'] : false, + 'links' => array(), + ); + // Add other supported links such as global annoucements etc ... + if ( $forum_allow_map || $forum_allow_news ) { + $links = &$this->outputs['module_data']['forum']['links']; + $linkables = array( 'html_forum', 'html_forum_global', 'html_forum_announce', 'html_forum_sticky'); + foreach ($linkables as $type) { + $links[$type] = array( + 'map_title' => $forum_allow_news ? $user->lang[strtoupper($type . '_map')] : '', + 'map_url' => $forum_allow_news ? $this->url_settings[$type . '_map'] : '', + 'news_title' => $forum_allow_map ? $user->lang[strtoupper($type . '_news')] : '', + 'news_url' => $forum_allow_map ? $this->url_settings[$type . '_news'] : '', + ); + } + } + return; + } + function last_topics($limit = 10) { + global $db, $template, $user, $config, $phpEx, $phpbb_root_path, $phpbb_seo, $auth, $cache; + // Usefull for multi bb topic & forum tracking + // Leave default for single forum eg : '_track' + $tracking_cookie_name = (defined('XLANG_AKEY') ? XLANG_AKEY : '') . '_track'; + $this->outputs['right_col_tpl'] = 'gym_sitemaps/last_topics_list.html'; + // wa can use start here since there are always more topics overall than in a single forum + $start = $this->start ? $this->gym_master->chk_start($this->start, $limit) : 0; + $template->assign_vars(array('LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'))); + // Wee need to check auth here + $this->module_config['last_topics_exclude_list'] = $this->gym_master->set_exclude_list($this->module_config['html_ltopic_exclude']); + $forum_auth_ids = array_diff_assoc($this->module_auth['forum']['read_post'], $this->module_config['last_topics_exclude_list']); + $all_forum_datas = $forum_datas = array(); + if (!empty($forum_auth_ids)) { + $topic_sql_auth = $db->sql_in_set('t.forum_id', $forum_auth_ids, false, true); + $template->assign_vars(array( + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + )); + $display_tracking = &$this->call['display_tracking']; + $display_user_info = &$this->call['display_user_info']; + $display_topic_status = &$this->call['display_topic_status']; + if (!$display_tracking) { + $load_db_lastread = $load_anon_lastread = false; + } else { + $load_db_lastread = (boolean) ($config['load_db_lastread'] && $user->data['is_registered']); + $load_anon_lastread = (boolean) ($config['load_anon_lastread'] || $user->data['is_registered']); + } + $template->assign_vars(array( + 'LASTX_TOPICS_TITLE' => sprintf($user->lang['HTML_LASTX_TOPICS_TITLE'], $limit) + ) + ); + // Get The Data, first forums + if (!empty($this->forum_datas)) { + $f_id_done = array_keys($this->forum_datas); + $f_id_done = array_combine($f_id_done, $f_id_done); + unset($f_id_done[0]); + $forum_query_ids = array_diff_assoc($forum_auth_ids, $f_id_done); + } else { + $forum_query_ids = $forum_auth_ids; + } + // Only get the required forums data + if (!empty($forum_query_ids)) { + $forum_sql_auth = $db->sql_in_set('f.forum_id', $forum_query_ids, false, true); + $sql_array = array( + 'SELECT' => 'f.*', + 'FROM' => array( + FORUMS_TABLE => 'f', + ), + 'LEFT_JOIN' => array(), + ); + if ($load_db_lastread) { + $sql_array['SELECT'] .= ', ft.mark_time as forum_mark_time'; + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id' + ); + } + $sql_array['WHERE'] = $forum_sql_auth; + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_array)); + while ($row = $db->sql_fetchrow($result)) { + $forum_id = (int) $row['forum_id']; + $forum_datas[$forum_id] = $row; + } + $db->sql_freeresult($result); + } + // Now the topics + $sql_array = array( + 'SELECT' => 't.*', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'LEFT_JOIN' => array(), + ); + if ($display_user_info && $display_topic_status && $user->data['is_registered']) { + $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . $user->data['user_id']); + $sql_array['SELECT'] .= ', tp.topic_posted'; + } + if ($load_db_lastread) { + $sql_array['SELECT'] .= ', tt.mark_time'; + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), + 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND tt.topic_id = t.topic_id' + ); + } elseif ($load_anon_lastread && empty($this->tracking_topics)) { + $this->tracking_topics = (isset($_COOKIE[$config['cookie_name'] . $tracking_cookie_name])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) : $_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) : ''; + $this->tracking_topics = ($this->tracking_topics) ? tracking_unserialize($this->tracking_topics) : array(); + if (!$user->data['is_registered']) { + $user->data['user_lastmark'] = (isset($this->tracking_topics['l'])) ? (int) (base_convert($this->tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + } + $sql_array['WHERE'] = "$topic_sql_auth + AND t.topic_status <> " . ITEM_MOVED . ' AND t.topic_approved = 1'; + $sql_array['ORDER_BY'] = 'topic_last_post_time DESC'; + $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_array), $limit, $start); + while ($row = $db->sql_fetchrow($result)) { + $topic_id = (int) $row['topic_id']; + $forum_id = (int) $row['forum_id']; + $all_forum_datas[$forum_id][$topic_id] = $row; + } + $db->sql_freeresult($result); + // Grab icons + if (empty($this->icons)) { + $this->icons = $cache->obtain_icons(); + } + $folder_alt = 'NO_NEW_POSTS'; + $topic_type = ''; + $folder_img = 'topic_read'; + $topic_folder_img = $user->img($folder_img, $folder_alt); + $topic_folder_img_src = $user->img($folder_img, $folder_alt, false, '', 'src'); + foreach ($all_forum_datas as $forum_id => $topic_datas) { + // Start with the forum + $forum_id = (int) $forum_id; + if (empty($this->forum_datas[$forum_id])) { + $row = & $forum_datas[$forum_id]; + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + $phpbb_seo->set_url($row['forum_name'], $forum_id, 'forum'); + // www.phpBB-SEO.com SEO TOOLKIT END + $this->forum_datas[$forum_id] = array_merge($row, array( + 'forum_url' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), + 'm_approve' => $auth->acl_get('m_approve', $forum_id), + )); + if ($load_db_lastread) { + $this->forum_tracking_info[$forum_id] = !empty($row['forum_mark_time']) ? $row['forum_mark_time'] : $user->data['user_lastmark']; + } elseif ($load_anon_lastread) { + $this->forum_tracking_info[$forum_id] = isset($this->tracking_topics['f'][$forum_id]) ? (int) (base_convert($this->tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + } + } + $forum_unread = (isset($this->forum_tracking_info[$forum_id]) && $this->forum_datas[$forum_id]['forum_last_post_time'] > $this->forum_tracking_info[$forum_id]) ? true : false; + $folder_image = $folder_alt = ''; + $folder_image = ($forum_unread) ? 'forum_unread' : 'forum_read'; + // Which folder should we display? + if ($this->forum_datas[$forum_id]['forum_status'] == ITEM_LOCKED) { + $folder_image = ($forum_unread) ? 'forum_unread_locked' : 'forum_read_locked'; + $folder_alt = 'FORUM_LOCKED'; + } else { + $folder_alt = ($forum_unread) ? 'NEW_POSTS' : 'NO_NEW_POSTS'; + } + $template->assign_block_vars('last_forums', array( + 'FORUM_NAME' => $this->forum_datas[$forum_id]['forum_name'], + 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), + 'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'), + 'FORUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '', + 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), + ) + ); + // Now the topics + foreach ($topic_datas as $topic_id => $topic_data) { + $topic_id = (int) $topic_id; + if ($load_db_lastread) { + $this->topic_tracking_info[$topic_id] = !empty($topic_data['mark_time']) ? $topic_data['mark_time'] : $user->data['user_lastmark']; + } else if ($load_anon_lastread) { + $topic_id36 = base_convert($topic_id, 10, 36); + if (isset($this->tracking_topics['t'][$topic_id36])) { + $this->tracking_topics['t'][$topic_id] = base_convert($this->tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate']; + } + $this->topic_tracking_info[$topic_id] = isset($this->tracking_topics['t'][$topic_id]) ? $this->tracking_topics['t'][$topic_id] : $user->data['user_lastmark']; + } + if (!empty($this->forum_tracking_info[$forum_id])) { + $this->topic_tracking_info[$topic_id] = $this->topic_tracking_info[$topic_id] > $this->forum_tracking_info[$forum_id] ? $this->topic_tracking_info[$topic_id] : $this->forum_tracking_info[$forum_id]; + } + $topic_data['topic_title'] = censor_text($topic_data['topic_title']); + // www.phpBB-SEO.com SEO TOOLKIT BEGIN + $phpbb_seo->prepare_iurl($topic_data, 'topic', $topic_data['topic_type'] == POST_GLOBAL ? $this->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$forum_id]); + // www.phpBB-SEO.com SEO TOOLKIT END + // Replies + $replies = $this->forum_datas[$forum_id]['m_approve'] ? $topic_data['topic_replies_real'] : $topic_data['topic_replies']; + $last_page = (($replies + 1) > $config['posts_per_page']) ? floor($replies / $config['posts_per_page']) * $config['posts_per_page'] : 0; + $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ($last_page ? "&start=$last_page" : '')) . '#p' . $topic_data['topic_last_post_id']; + $unread_topic = (isset($this->topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $this->topic_tracking_info[$topic_id]) ? true : false; + // Get folder img, topic status/type related information + if ($display_topic_status) { + $this->gym_master->topic_status($topic_data, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type); + $topic_folder_img = $user->img($folder_img, $folder_alt); + $topic_folder_img_src = $user->img($folder_img, $folder_alt, false, '', 'src'); + } + $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); + $template->assign_block_vars('last_forums.last_topics', array( + 'TOPIC_TITLE' => $topic_data['topic_title'], + 'PAGINATION' => $this->call['last_topic_pagination'] ? $this->gym_master->topic_generate_pagination($replies, $view_topic_url) : '', + 'TOPIC_TYPE' => $topic_type, + 'TOPIC_FOLDER_IMG' => $topic_folder_img, + 'TOPIC_FOLDER_IMG_SRC' => $topic_folder_img_src, + 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], + 'TOPIC_ICON_IMG' => (!empty($this->icons[$topic_data['icon_id']])) ? $this->icons[$topic_data['icon_id']]['img'] : '', + 'TOPIC_ICON_IMG_WIDTH' => (!empty($this->icons[$topic_data['icon_id']])) ? $this->icons[$topic_data['icon_id']]['width'] : '', + 'TOPIC_ICON_IMG_HEIGHT' => (!empty($this->icons[$topic_data['icon_id']])) ? $this->icons[$topic_data['icon_id']]['height'] : '', + 'U_NEWEST_POST' => $unread_topic ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&t=' . $topic_id . '&view=unread#unread') : '', + 'U_VIEW_TOPIC' => $view_topic_url, + 'U_LAST_POST' => $last_post_url, + 'S_UNREAD_TOPIC' => $unread_topic, + ) + ); + } + } + unset($forum_datas, $all_forum_datas); + } + } + /** + * Generates forum rules / desc for given forum + */ + function generate_forum_info($forum_data, $type = 'desc') { + static $types = array('desc' => 1, 'rules' => 1); + if (!isset($types[$type])) { + return ''; + } + $forum_info = array('forum_desc' => false, 'forum_rules' => false, 'forum_rules_link' => false); + if (!empty($forum_data["forum_$type"])) { + $forum_info["forum_$type"] = generate_text_for_display($forum_data["forum_$type"], $forum_data["forum_{$type}_uid"], $forum_data["forum_{$type}_bitfield"], $forum_data["forum_{$type}_options"]); + } else if (isset($forum_data["forum_{$type}_link"])) { + $forum_info['forum_rules_link'] = $forum_data['forum_rules_link']; + } + return $type == 'rules' ? $forum_info : $forum_info["forum_$type"]; + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/modules/index.htm b/phpBB/gym_sitemaps/modules/index.htm new file mode 100644 index 0000000000..e0cc5f36e6 --- /dev/null +++ b/phpBB/gym_sitemaps/modules/index.htm @@ -0,0 +1,10 @@ +<html>
+<head>
+<title></title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+
+</body>
+</html>
diff --git a/phpBB/gym_sitemaps/modules/rss_forum.php b/phpBB/gym_sitemaps/modules/rss_forum.php new file mode 100644 index 0000000000..04f31a6604 --- /dev/null +++ b/phpBB/gym_sitemaps/modules/rss_forum.php @@ -0,0 +1,608 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: rss_forum.php 262 2010-04-20 11:06:58Z dcz $ +* @copyright (c) 2006 - 2010 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** +* google_forum Class +* www.phpBB-SEO.com +* @package phpBB SEO +*/ +class rss_forum { + var $url_config = array(); + var $actions = array(); + var $module_auth = array(); + var $module_config = array(); + var $output_data = array(); + var $forum_cache = array(); + /** + * constuctor + */ + function rss_forum(&$gym_master) { + global $user, $db; + $this->gym_master = &$gym_master; + $this->actions = &$this->gym_master->actions; + $this->module_auth = &$this->gym_master->module_auth; + $this->output_data = &$this->gym_master->output_data; + $this->module_config = &$this->gym_master->rss_config; + $this->url_config = &$this->gym_master->url_config; + $this->module_config = array_merge( + // Global + $this->module_config, + // Other stuff required here + array( + 'rss_first' => ( $this->gym_master->gym_config['rss_forum_first'] ) ? TRUE : FALSE, + 'rss_last' => ( $this->gym_master->gym_config['rss_forum_last'] ) ? TRUE : FALSE, + 'rss_forum_rules' => ( $this->gym_master->gym_config['rss_forum_rules'] ) ? TRUE : FALSE, + 'rss_exclude_list' => trim($this->gym_master->gym_config['rss_forum_exclude'], ','), + ) + ); + // Set up msg outpout + if ($this->actions['rss_news_list'] || $this->actions['module_sub'] === 'announces' ) { + $this->module_config['rss_first'] = true; + $this->module_config['rss_last'] = false; + $this->module_config['rss_sort'] = 'DESC'; + } else { + $this->module_config['rss_last'] = ($this->module_config['rss_first']) ? $this->module_config['rss_last'] : true; + } + // Build unauthed array + $this->module_config['exclude_list'] = $this->gym_master->set_exclude_list($this->module_config['rss_exclude_list']); + // Wee need to check auth here + $this->gym_master->check_forum_auth($this->module_config['rss_auth_guest']); + $this->actions['auth_guest_read'] = array_diff_assoc($this->module_auth['forum']['public_read'], $this->module_config['exclude_list'], $this->module_auth['forum']['skip_all']); + $this->actions['auth_view_read'] = array_diff_assoc($this->module_auth['forum']['read_post'], $this->module_config['exclude_list']); + if (empty($this->actions['auth_view_read'])) { + $this->gym_master->gym_error(404, '', __FILE__, __LINE__); + } + $this->actions['in_id_sql'] = $db->sql_in_set('forum_id', $this->actions['auth_view_read'], false, true); + $this->gym_master->gym_output->setup_cache(); // Will exit if the cache is sent + + $this->init_url_settings(); + } + /** + * Initialize mod rewrite to handle multiple URL standards. + * Only one 'if' is required after this in THE loop to properly switch + * between the four types (none, advanced, mixed and simple). + * @access private + */ + function init_url_settings() { + global $phpbb_seo, $phpEx; + // vars will fell like rain in the code ;) + $this->gym_master->init_url_rewrite($this->module_config['rss_modrewrite'], $this->module_config['rss_modrtype']); + + $this->url_config['rss_forum_pre'] = $this->url_config['rss_default'] . '?forum='; + $this->url_config['rss_forum_default'] = $this->url_config['rss_default'] . '?forum'; + $this->url_config['rss_forum_news_default'] = $this->url_config['rss_forum_default'] . '&news'; + $this->url_config['rss_forum_news'] = '&news'; + $this->url_config['rss_forum_channel_default'] = $this->url_config['rss_forum_pre'] . 'channels'; + $this->url_config['rss_forum_channel'] = ''; + $this->url_config['rss_forum_announces_default'] = $this->url_config['rss_forum_pre'] . 'announces'; + $this->url_config['rss_forum_announces'] = ''; + $this->url_config['rss_forum_file'] = ''; + $this->url_config['rss_forum_delim'] = !empty($phpbb_seo->seo_delim['forum']) ? $phpbb_seo->seo_delim['forum'] : '-f'; + $this->url_config['rss_forum_static'] = 'forum'; + + if ($this->module_config['rss_modrewrite']) { // Module links + $this->url_config['rss_forum_pre'] = ($this->url_config['modrtype'] >= 2) ? '' : $this->url_config['rss_forum_static'] . $this->url_config['rss_forum_delim']; + $this->url_config['rss_forum_file'] = ($this->url_config['modrtype'] > 0 ? '' : '/' ) . 'forum.xml' . $this->url_config['gzip_ext_out']; + $this->url_config['rss_forum_default'] = ''; + $this->url_config['rss_forum_announces_default'] = $this->url_config['rss_forum_news_default'] = $this->url_config['rss_forum_channel_default'] = ''; + $this->url_config['rss_forum_news'] = 'news/'; + $this->url_config['rss_forum_channel'] = 'channels/'; + $this->url_config['rss_forum_announces'] = 'announces/'; + } + return; + } + /** + * rss_main() + * Add content to the main listing (channel list and rss feed) + * @access private + */ + function rss_main() { + global $config, $db, $phpbb_seo, $user, $phpEx; + // It's global channel list call, add static channels + // Reset the local counting, since we are cycling through modules + $this->output_data['url_sofar'] = 0; + $time_limit = ''; + $approve_sql = ' AND topic_approved = 1'; + $approve_sqlt = ' AND t.topic_approved = 1'; + if ( $this->actions['rss_channel_list'] ) { // Channel lists + // Add the forum channel + $chan_source = $this->module_config['rss_url'] . $this->url_config['rss_vpath'] . $this->url_config['rss_forum_channel_default'] . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_channel'] . $this->url_config['rss_forum_file']; + $chan_link = $phpbb_seo->seo_path['phpbb_urlR'] . $this->url_config['forum_index']; + $item_tile = !empty($this->gym_master->gym_config['rss_forum_sitename']) ? $this->gym_master->gym_config['rss_forum_sitename'] : $config['sitename']; + $item_desc = (!empty($this->gym_master->gym_config['rss_forum_site_desc']) ? $this->gym_master->gym_config['rss_forum_site_desc'] : $config['site_desc']) . "\n\n"; + $this->gym_master->parse_item($item_tile . ' - ' . $user->lang['RSS_CHAN_LIST_TITLE'], $item_desc . $user->lang['RSS_CHAN_LIST_DESC'], $chan_link, $chan_source, $item_tile . ' - ' . $user->lang['RSS_CHAN_LIST_TITLE'], $this->output_data['last_mod_time']); + // add the main news forum feed + if ($this->module_config['rss_allow_news']) { + $chan_source = $this->module_config['rss_url'] . $this->url_config['rss_vpath'] . $this->url_config['rss_forum_default'] . ($this->actions['rss_news_list'] ? '' : $this->url_config['rss_forum_news']) . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_file']; + $this->gym_master->parse_item($item_tile . ' - ' . $user->lang['RSS_NEWS'], $user->lang['RSS_NEWS_DESC'] . ' ' . $item_tile . "\n\n" . $this->module_config['rss_site_desc'], $chan_link, $chan_source, $item_tile . ' - ' . $user->lang['RSS_NEWS'], $this->output_data['last_mod_time']); + } + // Add announces feed to the list ? + // Count items + $sql = "SELECT COUNT(topic_id) AS topic + FROM " . TOPICS_TABLE . " + WHERE forum_id = 0 + AND topic_type = " . POST_GLOBAL . $approve_sql; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + if (!empty($row['topic'])) { + unset($row); + $forum_announces_url = $this->module_config['rss_url'] . $this->url_config['rss_vpath'] . $this->url_config['rss_forum_announces_default'] . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_announces'] . $this->url_config['rss_forum_file']; + $this->gym_master->parse_item(sprintf($user->lang['RSS_ANNOUNCES_TITLE'], $this->module_config['rss_sitename']), sprintf($user->lang['RSS_ANNOUCES_DESC'], $this->module_config['rss_sitename']) . "\n\n" . $this->module_config['rss_site_desc'], $chan_link, $forum_announces_url, '', $this->output_data['last_mod_time']); + } + // add the main forum feed + $chan_source = $this->module_config['rss_url'] . $this->url_config['rss_vpath'] . $this->url_config['rss_forum_default'] . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_file']; + + // Forum stats + $forum_stats = '<b>' . $user->lang['STATISTICS'] . '</b> : ' . sprintf($user->lang['TOTAL_USERS_OTHER'], $config['num_users']) . ' || ' . "\n"; + $forum_stats .= sprintf($user->lang['TOTAL_TOPICS_OTHER'], $config['num_topics']) . ' || '; + $forum_stats .= sprintf($user->lang['TOTAL_POSTS_OTHER'], $config['num_posts']) . "\n"; + $forum_stats .= ($this->module_config['rss_allow_profile'] ? "\n" . sprintf($user->lang['NEWEST_USER'], get_username_string($this->module_config['rss_profile_mode'], $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour']) ) : '') . "\n\n"; + $item_desc .= $forum_stats; + $this->gym_master->parse_item($item_tile, $item_desc, $chan_link, $chan_source, $item_tile, $this->output_data['last_mod_time']); + // Grabb the forum data + $this->list_forums(); + } else { // Main feeds + // Grabb forums info + $forum_data = array(); + $sql = "SELECT * + FROM " . FORUMS_TABLE . " + WHERE " . $this->actions['in_id_sql'] . " + ORDER BY forum_last_post_id " . $this->module_config['rss_sort']; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { + $forum_data[$row['forum_id']] = $row; + } + $db->sql_freeresult($result); + unset($row); + // Build sql components + $topic_forum_sql = ''; + if ($this->module_config['rss_limit_time'] > 0 ) { + $time_limit = ($this->output_data['time'] - $this->module_config['rss_limit_time']); + $time_limit_sql = "topic_last_post_time > $time_limit AND "; + } else { + $time_limit_sql = ''; + } + // Count topics + $sql = "SELECT COUNT(topic_id) AS topic + FROM " . TOPICS_TABLE . " + WHERE $time_limit_sql + " . $this->actions['in_id_sql'] . " + AND topic_status <> " . ITEM_MOVED . $approve_sql; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $forum_data['topic_count'] = ( $row['topic'] ) ? $row['topic'] : 1; + $db->sql_freeresult($result); + unset($row); + $forum_sql = 't.' . $this->actions['in_id_sql'] . ' AND '; + $this->list_topics($forum_sql, $forum_data, $time_limit, $approve_sqlt); + } + // Add the local counting, since we are cycling through modules + $this->output_data['url_sofar_total'] = $this->output_data['url_sofar_total'] + $this->output_data['url_sofar']; + return; + } + /** + * rss_module() will build the module's specific sub feeds, + * @access private + */ + function rss_module() { + global $user, $db, $phpbb_seo, $auth, $config; + $forum_sql = ''; + $time_limit = ''; + $approve_sql = ' AND topic_approved = 1'; + $approve_sqlt = ' AND t.topic_approved = 1'; + $forum_data = array('topic_count' => 0); + if ($this->actions['module_sub'] === 'channels') { // Module channel list + //If so check for dupes and build channel header + $chan_source = $this->module_config['rss_url'] . $this->url_config['rss_vpath'] . $this->url_config['rss_forum_channel_default'] . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_channel'] . $this->url_config['rss_forum_file']; + // Kill dupes + $this->gym_master->seo_kill_dupes($chan_source); + $chan_title = $this->module_config['rss_sitename']; + $chan_link = $phpbb_seo->seo_path['phpbb_urlR'] . $this->url_config['forum_index']; + $chan_desc = sprintf($user->lang['RSS_CHAN_LIST_DESC_MODULE'], $this->module_config['rss_sitename']) . "\n\n" . $this->module_config['rss_site_desc'] . "\n\n"; + + // Forum stats + $site_stats = '<b>' . $user->lang['STATISTICS'] . '</b> : ' . sprintf($user->lang['TOTAL_USERS_OTHER'], $config['num_users']) . ' || '; + $site_stats .= sprintf($user->lang['TOTAL_TOPICS_OTHER'], $config['num_topics']) . ' || '; + $site_stats .= sprintf($user->lang['TOTAL_POSTS_OTHER'], $config['num_posts']); + + $site_stats .= ($this->module_config['rss_allow_profile'] ? "\n" . sprintf($user->lang['NEWEST_USER'], get_username_string($this->module_config['rss_profile_mode'], $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour']) ) : '') . "\n"; + $chan_title_full = $chan_title . ' ' . $user->lang['RSS_CHAN_LIST_TITLE']; + $this->gym_master->parse_channel($chan_title_full, $chan_desc, $chan_link, $this->output_data['last_mod_time'], $this->module_config['rss_image_url'], $chan_source); + // Add main forum feed to the list only when not requesting a news channel list + if (!$this->actions['rss_news_list']) { + $forum_feed_url = $this->module_config['rss_url'] . $this->url_config['rss_vpath'] . $this->url_config['rss_forum_default'] . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_file']; + $this->gym_master->parse_item($chan_title, $this->module_config['rss_site_desc'] . "\n\n" . $site_stats, $chan_link, $forum_feed_url, '', $this->output_data['last_mod_time']); + } + // add the main news forum feed + if ($this->module_config['rss_allow_news']) { + $news_chan = $this->module_config['rss_url'] . $this->url_config['rss_vpath'] . $this->url_config['rss_forum_default'] . ($this->actions['rss_news_list'] ? '' : $this->url_config['rss_forum_news']) . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_file']; + $this->gym_master->parse_item($chan_title . ' - ' . $user->lang['RSS_NEWS'], $user->lang['RSS_NEWS_DESC'] . ' ' . $chan_title . "\n\n" . $this->module_config['rss_site_desc'], $chan_link, $news_chan, $chan_title . ' - ' . $user->lang['RSS_NEWS'], $this->output_data['last_mod_time']); + } + // Add announces feed to the list ? + // Count items + $sql = "SELECT COUNT(topic_id) AS topic + FROM " . TOPICS_TABLE . " + WHERE forum_id = 0 + AND topic_type = " . POST_GLOBAL . $approve_sql; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + if (!empty($row['topic'])) { + unset($row); + $forum_announces_url = $this->module_config['rss_url'] . $this->url_config['rss_vpath'] . $this->url_config['rss_forum_announces_default'] . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_announces'] . $this->url_config['rss_forum_file']; + $this->gym_master->parse_item(sprintf($user->lang['RSS_ANNOUNCES_TITLE'], $this->module_config['rss_sitename']), sprintf($user->lang['RSS_ANNOUCES_DESC'], $this->module_config['rss_sitename']) . "\n\n" . $this->module_config['rss_site_desc'], $chan_link, $forum_announces_url, '', $this->output_data['last_mod_time']); + } + $this->list_forums(); + return; + + } elseif ($this->actions['module_sub'] === 'announces') { // Global annnounces list + + // it's the announces sitemap + // We want to list all the global announces from the forum + $forum_sql = ' t.forum_id = 0 AND t.topic_type = ' . POST_GLOBAL; + // Count items + $sql = "SELECT COUNT(topic_id) AS topic + FROM " . TOPICS_TABLE . " t + WHERE $forum_sql $approve_sql"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + if(empty($row['topic'])) { + $this->gym_master->gym_error(404, 'GYM_TOO_FEW_ITEMS', __FILE__, __LINE__); + exit; + } else { + $forum_data['topic_count'] = (int) $row['topic']; + unset($row); + } + $chan_source = $this->module_config['rss_url'] . $this->url_config['rss_vpath'] . $this->url_config['rss_forum_announces_default'] . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_announces'] . $this->url_config['rss_forum_file']; + // Kill dupes + $this->gym_master->seo_kill_dupes($chan_source); + $chan_title = sprintf($user->lang['RSS_ANNOUNCES_TITLE'], $this->module_config['rss_sitename']); + $chan_link = $phpbb_seo->seo_path['phpbb_urlR'] . $this->url_config['forum_index']; + $chan_desc = sprintf($user->lang['RSS_ANNOUCES_DESC'], $this->module_config['rss_sitename']) . "\n\n" . $this->module_config['rss_site_desc']; + // Forum announces location + $this->gym_master->parse_channel($chan_title . $this->module_config['extra_title'], $chan_desc . "\n", $chan_link, $this->output_data['last_mod_time'], $this->module_config['rss_image_url'], $chan_source); + // Dirty but efficient workarround for announces + $this->forum_cache[0]['forum_url'] = $phpbb_seo->seo_opt['virtual_folder'] ? $phpbb_seo->seo_static['global_announce'] . $phpbb_seo->seo_ext['global_announce'] : ''; + $this->forum_cache[0]['forum_url_full'] = $this->forum_cache[0]['forum_name'] = $chan_title; + $this->forum_cache[0]['replies_key'] = 'topic_replies'; + $this->forum_cache[0]['approve'] = 0; + $this->forum_cache[0]['forum_rss_url'] = $chan_source; + $this->actions['auth_view_read'][0] = 0; + $this->list_topics($forum_sql . ' AND ' , $forum_data); + + } else { // Module feeds + + // Filter $this->actions['module_sub'] var type + $this->actions['module_sub'] = intval($this->actions['module_sub']); + if ($this->actions['module_sub'] > 0) { // Forum Feed + $forum_sql = ' t.forum_id = ' . $this->actions['module_sub'] . ' AND '; + // Check forum auth and grab necessary infos + $sql = "SELECT * + FROM ". FORUMS_TABLE ." f + WHERE forum_id = " . $this->actions['module_sub']; + $result = $db->sql_query($sql); + $forum_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + if ( empty($forum_data) ) { + $this->gym_master->gym_error(404, '', __FILE__, __LINE__, $sql); + } + $forum_id = (int) $forum_data['forum_id']; + if ( $forum_data['forum_type'] != FORUM_POST || !isset($this->actions['auth_view_read'][$forum_id]) ) { + $this->gym_master->gym_error(401, '', __FILE__, __LINE__); + } + // This forum is allowed, so let's start + $forum_rss_url = $this->module_config['rss_url'] . ($this->module_config['rss_modrewrite'] ? $phpbb_seo->set_url($forum_data['forum_name'], $forum_id, 'forum') . '/' : $this->url_config['rss_forum_pre'] . $forum_id); + // Build Yahoo notify URL + // If the URL is not rewritten, we cannot use "&", get rid of options in such cases. + if ($this->module_config['rss_yahoo_notify']) { + if ( $this->url_config['modrewrite'] ) { + $this->url_config['rss_yahoo_notify_url'] = $forum_rss_url . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_file']; + } else { + $this->url_config['rss_yahoo_notify_url'] = $forum_rss_url; + } + } + $forum_rss_url .= $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_file']; + // Kill dupes + $this->gym_master->seo_kill_dupes($forum_rss_url); + + // Properly set the limits + $this->forum_cache[$forum_id]['approve'] = 0; + $forum_data['topic_count'] = $forum_data['forum_topics']; + $this->forum_cache[$forum_id]['replies_key'] = 'topic_replies'; + // In case the forum called for a feed is really big, apply time limit + if ( $this->module_config['rss_limit_time'] > 0 && $forum_data['topic_count'] > 500) { + $time_limit = ($this->output_data['time'] - $this->module_config['rss_limit_time']); + // So let's count topic in this forum + $sql = "SELECT COUNT(topic_id) AS forum_topics + FROM " . TOPICS_TABLE . " + WHERE forum_id = $forum_id + AND topic_last_post_time > $time_limit + AND topic_status <> " . ITEM_MOVED . " + $approve_sql"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $forum_data['topic_count'] = ( $row['forum_topics'] ) ? $row['forum_topics'] : 1; + $db->sql_freeresult($result); + unset($row); + // now check if we've got still enough topic to ouptut + if ( $forum_data['topic_count'] <= $this->module_config['rss_url_limit'] ) { + $time_limit = 0; + } + } + $this->forum_cache[$forum_id]['forum_rss_url'] = $forum_rss_url; + $chan_title = $this->forum_cache[$forum_id]['forum_name'] = $forum_data['forum_name']; + $this->forum_cache[$forum_id]['forum_url'] = $this->gym_master->forum_url($forum_data['forum_name'], $forum_id); + $this->forum_cache[$forum_id]['forum_url_full'] = $this->gym_master->parse_link($phpbb_seo->seo_path['phpbb_urlR'] . $this->forum_cache[$forum_id]['forum_url'] . $this->url_config['forum_ext'], $this->forum_cache[$forum_id]['forum_name'], 'h5'); + // Build Chan info + // Forum stats + $forum_stats = "\n" . '<b>' . $user->lang['STATISTICS'] . '</b> : ' . $forum_data['topic_count'] . ' ' . (($forum_data['forum_topics'] >= 0) ? $user->lang['TOPICS'] : $user->lang['TOPIC'] ); + $forum_stats .= ' || ' . $forum_data['forum_posts'] . ' ' . (($forum_data['forum_posts'] >= 0) ? $user->lang['POSTS'] : $user->lang['POST'] ); + // Forum rules ? + $forum_rules = ($this->module_config['rss_forum_rules'] && $forum_data['forum_rules']) ? generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']) : ''; + $forum_desc = generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']); + // Is this item public ? + $this->module_config['rss_auth_msg'] = ($this->gym_master->is_forum_public($forum_id) ? '' : "\n\n" . $user->lang['RSS_AUTH_THIS'] . "\n" ); + // Profiles + $lastposter = ''; + if ($this->module_config['rss_allow_profile'] ) { + $lastposter = "\n" . $user->lang['GYM_LAST_POST_BY'] . get_username_string($this->module_config['rss_profile_mode'], $forum_data['forum_last_poster_id'], $forum_data['forum_last_poster_name'], $forum_data['forum_last_poster_colour']); + } + $chan_desc = $forum_desc . $forum_rules . "\n" . $forum_stats . $lastposter; + $chan_image = !empty($forum_data['forum_image']) ? $phpbb_seo->seo_path['phpbb_url'] . trim($forum_data['forum_image'], '/') : $this->module_config['rss_image_url']; + $this->gym_master->parse_channel($chan_title . $this->module_config['extra_title'], $chan_desc, $phpbb_seo->seo_path['phpbb_urlR'] . $this->forum_cache[$forum_id]['forum_url'] . $this->url_config['forum_ext'], $forum_data['forum_last_post_time'], $chan_image, $forum_rss_url); + + } else { // module Rss + + $forum_sql = ' t.' . $this->actions['in_id_sql'] . ' AND '; + $chan_source = $this->module_config['rss_url'] . $this->url_config['rss_forum_default'] . $this->url_config['rss_vpath'] . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_file']; + $this->gym_master->seo_kill_dupes($chan_source); + + // Forum stats + $forum_stats = '<b>' . $user->lang['STATISTICS'] . '</b> : ' . sprintf($user->lang['TOTAL_USERS_OTHER'], $config['num_users']) . ' || '; + $forum_stats .= sprintf($user->lang['TOTAL_TOPICS_OTHER'], $config['num_topics']) . ' || '; + $forum_stats .= sprintf($user->lang['TOTAL_POSTS_OTHER'], $config['num_posts']); + + $forum_stats .= ($this->module_config['rss_allow_profile'] ? "\n" . sprintf($user->lang['NEWEST_USER'], get_username_string($this->module_config['rss_profile_mode'], $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])) : '') . "\n"; + // Chan info + $chan_title = $this->module_config['rss_sitename']; + $chan_link = $phpbb_seo->seo_path['phpbb_urlR'] . $this->url_config['forum_index']; + $chan_desc = $this->module_config['rss_site_desc'] . "\n\n"; + $forum_image = sprintf($this->gym_master->style_config['rsschan_img_tpl'], $chan_title, $this->module_config['rss_image_url'], $chan_link); + $chan_time = gmdate('D, d M Y H:i:s \G\M\T', $this->output_data['last_mod_time']); + $chan_title_full = $chan_title . $this->module_config['extra_title']; + $this->gym_master->parse_channel($chan_title_full, $chan_desc . $forum_stats, $chan_link, $this->output_data['last_mod_time'], $this->module_config['rss_image_url'], $chan_source); + // Grabb forums info + $forum_data = array(); + $sql = "SELECT * + FROM " . FORUMS_TABLE . " + WHERE " . $this->actions['in_id_sql'] . " + ORDER BY forum_last_post_id " . $this->module_config['rss_sort']; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { + $forum_data[$row['forum_id']] = $row; + } + $db->sql_freeresult($result); + unset($row); + // Build sql components + $time_limit_sql = ''; + if ($this->module_config['rss_limit_time'] > 0 ) { + $time_limit = ($this->output_data['time'] - $this->module_config['rss_limit_time']); + $time_limit_sql = "t.topic_last_post_time > $time_limit AND "; + } else { + $time_limit_sql = ''; + } + $sql = "SELECT COUNT(topic_id) AS topic + FROM " . TOPICS_TABLE . " t + WHERE $time_limit_sql " . $this->actions['in_id_sql'] . " + AND topic_status <> " . ITEM_MOVED . $approve_sql; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $forum_data['topic_count'] = !empty( $row['topic'] ) ? $row['topic'] : 1; + $db->sql_freeresult($result); + unset($row); + } + $this->list_topics($forum_sql, $forum_data, $time_limit, $approve_sqlt); + } + + } + /** + * list_forums() builds the output for forum listing + * From a forum and from all forums + * @access private + */ + function list_forums() { + global $db, $user, $phpbb_seo, $auth; + $sql = "SELECT * + FROM " . FORUMS_TABLE . " + WHERE " . $this->actions['in_id_sql'] . " + ORDER BY forum_last_post_id " . $this->module_config['rss_sort']; + $result = $db->sql_query($sql); + while( $forum_data = $db->sql_fetchrow($result) ) { + $forum_id = (int) $forum_data['forum_id']; + // Make sure that the forum is auth + if (!isset($this->actions['auth_view_read'][$forum_id])) { + continue; + } + $topics_count = $forum_data['forum_topics']; + // Build Chan info + $forum_stats = '<b>' . $user->lang['STATISTICS'] . '</b> : ' . $topics_count . ' ' . (($forum_data['forum_topics'] >= 0) ? $user->lang['TOPICS'] : $user->lang['TOPIC'] ); + $forum_stats .= ' || ' . $forum_data['forum_posts'] . ' ' . (($forum_data['forum_posts'] >= 0) ? $user->lang['POSTS'] : $user->lang['POST'] ); + // Forum rules ? + $forum_rules = ($this->module_config['rss_forum_rules'] && $forum_data['forum_rules']) ? generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']) . "\n" : ''; + $forum_desc = generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']) ; + $forum_desc .= !empty($forum_desc) ? "\n\n" : ''; + // Is this item public ? + $this->module_config['rss_auth_msg'] = ($this->gym_master->is_forum_public($forum_id)) ? '' : "\n" . $user->lang['RSS_AUTH_THIS']; + $item_title = $forum_data['forum_name']; + // Profiles + $lastposter = ''; + if ($this->module_config['rss_allow_profile'] && !empty($forum_data['forum_last_poster_id'])) { + $lastposter = "\n" . $user->lang['GYM_LAST_POST_BY'] . get_username_string($this->module_config['rss_profile_mode'], $forum_data['forum_last_poster_id'], $forum_data['forum_last_poster_name'], $forum_data['forum_last_poster_colour']) . "\n"; + } + // Build URLs + $forum_rss_url = $this->module_config['rss_url'] . ( !empty($this->url_config['rss_forum_pre']) ? $this->url_config['rss_forum_pre'] . $forum_id : $this->gym_master->forum_rss_url( $forum_data['forum_name'] , $forum_id) . '/' ) . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_file']; + $forum_url = $phpbb_seo->seo_path['phpbb_urlR'] . $this->gym_master->forum_url($forum_data['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']) . $this->url_config['forum_ext']; + $item_desc = $forum_desc . $forum_rules . $forum_stats . $lastposter; + $this->gym_master->parse_item($item_title, $item_desc, $forum_url, $forum_rss_url, $item_title . $this->module_config['extra_title'], $forum_data['forum_last_post_time']); + } // End forum list loop + $db->sql_freeresult($result); + unset ($forum_data); + } + /** + * list_topics($forum_sql, $forum_data, $time_limit = 0, $approve_sql = '') builds the output for topic listing + * From a forum and from all forums + * @access private + */ + function list_topics($forum_sql, $forum_data, $time_limit = 0, $approve_sql = '') { + global $config, $db, $phpbb_seo, $auth, $user; + // Build sql components all remaining cases + $msg_sql1 = $msg_sql2 = $msg_sql3 = ''; + // DBK if news list, use topic start time + $time_key = $this->actions['rss_news_list'] ? 't.topic_time' : 't.topic_last_post_time'; + $order_key = $this->actions['rss_news_list'] ? 't.topic_id' : 't.topic_last_post_id'; + $time_limit = $time_limit > 0 ? "$time_key > $time_limit AND " : ''; + if ( $this->actions['rss_content'] ) { + if($this->module_config['rss_last'] || !$this->module_config['rss_first']) { // Go for last post content + $msg_sql1 = ", p.post_id, p.post_approved, p.post_reported, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.enable_sig, p.post_subject, p.post_text, p.post_attachment, p.bbcode_bitfield, p.bbcode_uid, p.post_edit_time"; + $msg_sql2 = ", " . POSTS_TABLE . " p "; + $msg_sql3 = " AND p.post_id = t.topic_last_post_id AND p.post_approved = 1 AND p.post_reported = 0 "; + } + if($this->module_config['rss_first']) { // First post as well ? + $msg_sql1 .= " , pF.post_id as post_idF, pF.post_approved as post_approvedF, pF.post_reported as post_reportedF, pF.enable_bbcode as enable_bbcodeF, pF.enable_smilies as enable_smiliesF, pF.enable_magic_url as enable_magic_urlF, pF.enable_sig as enable_sigF, pF.post_subject as post_subjectF, pF.post_text as post_textF, pF.post_attachment as post_attachmentF, pF.bbcode_bitfield as bbcode_bitfieldF, pF.bbcode_uid as bbcode_uidF, pF.post_edit_time as post_edit_timeF "; + $msg_sql2 .= ", " . POSTS_TABLE . " pF "; + $msg_sql3 .= " AND pF.post_id = t.topic_first_post_id AND pF.post_approved = 1 AND pF.post_reported = 0 "; + } + } + $sql_first = "SELECT t.* $msg_sql1 + FROM " . TOPICS_TABLE . " t $msg_sql2 + WHERE $forum_sql $time_limit + t.topic_status <> " . ITEM_MOVED . " + $approve_sql + $msg_sql3 + ORDER BY $order_key " . $this->module_config['rss_sort']; + // Absolute limit + $topic_sofar = 0; + $topics = array(); + $paginated = $config['posts_per_page']; + // Do the loop + while( ( $topic_sofar < $forum_data['topic_count'] ) && ($this->output_data['url_sofar'] < $this->module_config['rss_url_limit']) ) { + $result = $db->sql_query_limit($sql_first, $this->module_config['rss_sql_limit'], $topic_sofar); + while ($topic = $db->sql_fetchrow($result)) { + // In case we are looking for more than one forum + $forum_id = (int) $topic['forum_id']; + // Make sure that the forum is auth + if (!isset($this->actions['auth_view_read'][$forum_id])) { + continue; + } + // In case we are going to output forum data many times, let's build this once + if (empty($this->forum_cache[$forum_id])) { + // Set mod rewrite & type + $this->forum_cache[$forum_id]['forum_rss_url'] = $this->module_config['rss_url'] . ($this->module_config['rss_modrewrite'] ? $phpbb_seo->set_url($forum_data[$forum_id]['forum_name'], $forum_id, 'forum') . '/' : $this->url_config['rss_forum_pre'] . $forum_id) . $this->url_config['extra_paramsE'] . $this->url_config['rss_forum_file']; + $this->forum_cache[$forum_id]['forum_url'] = $this->gym_master->forum_url($forum_data[$forum_id]['forum_name'], $forum_id); + $this->forum_cache[$forum_id]['forum_name'] = $forum_data[$forum_id]['forum_name']; + $this->forum_cache[$forum_id]['approve'] = 0; + $this->forum_cache[$forum_id]['replies_key'] = 'topic_replies'; + $this->forum_cache[$forum_id]['forum_url_full'] = $this->gym_master->parse_link($phpbb_seo->seo_path['phpbb_urlR'] . $this->forum_cache[$forum_id]['forum_url'] . $this->url_config['forum_ext'], $this->forum_cache[$forum_id]['forum_name'], 'h5'); + } + if ( $topic['topic_reported'] || !$topic['topic_approved'] ) { // Skip for now if reported or unapproved + + continue; + } + $pages = ceil( ($topic[$this->forum_cache[$forum_id]['replies_key']] + 1) / $paginated); + $topic['topic_title'] = censor_text($topic['topic_title']); + $topic['topic_replies'] = $topic[$this->forum_cache[$forum_id]['replies_key']]; + $topic_stats = '<b>' . $user->lang['STATISTICS'] . '</b> : ' . ($topic['topic_replies'] + 1) . ' ' . (($topic['topic_replies'] > 1) ? $user->lang['REPLIES'] : $user->lang['POST'] ); + $topic_stats .= ' || ' . ($topic['topic_views'] + 1) . ' ' . $user->lang['VIEWS']; + $topic['topic_url'] = $phpbb_seo->seo_path['phpbb_urlR'] . $this->gym_master->topic_url($topic, $forum_id, $this->forum_cache[$forum_id]['forum_url']); + $has_reply = ($topic['topic_last_post_id'] > $topic['topic_first_post_id']) ? true : false; + + // Is this item public ? + $this->module_config['rss_auth_msg'] = ($this->gym_master->is_forum_public($forum_id) ? '' : "\n\n" . $user->lang['RSS_AUTH_THIS'] ) . "\n\n"; + + // Do we output the topic URL + if( $has_reply && $this->module_config['rss_first']) { + $topic['topic_urlF'] = $topic['topic_url'] . $this->url_config['topic_ext']; + $first_message = ''; + // With the msg content + if ($this->actions['rss_content'] && @$topic['post_idF'] ) { + if ($topic['post_reportedF'] == 1 || !$topic['post_approvedF']) { + $first_message = $user->lang['RSS_REPORTED_UNAPPROVED']; + } else { + $first_message = $this->gym_master->prepare_for_output( $topic, 'F' ); + } + } + // Profiles + $lastposter = $author = ''; + if ($this->module_config['rss_allow_profile'] && !empty($topic['topic_poster'])) { + if ($this->module_config['rss_display_author']) { + $author = $topic['topic_first_poster_name']; + } + $lastposter = "\n" . $user->lang['GYM_FIRST_POST_BY'] . get_username_string($this->module_config['rss_profile_mode'], $topic['topic_poster'], $topic['topic_first_poster_name'], $topic['topic_first_poster_colour']) . "\n\n"; + } + $item_desc = $this->forum_cache[$forum_id]['forum_url_full'] . "\n\n" . $first_message. "\n" . $topic_stats . $lastposter; + // DBK use topic time if news + $time_key = $this->actions['rss_news_list'] ? 'topic_time' : 'topic_last_post_time'; + $this->gym_master->parse_item($topic['topic_title'], $item_desc, $topic['topic_urlF'], $this->forum_cache[$forum_id]['forum_rss_url'], $this->forum_cache[$forum_id]['forum_name'] . $this->module_config['extra_title'], $topic[$time_key], $author); + } + // Do we output the last post URL + if ( $this->module_config['rss_last'] || !$has_reply) { + $start = ($pages > 1) ? $paginated * ($pages-1) : 0; + $post_num = ''; + $item_title = $topic['topic_title']; + $profile_key = 'first'; + $user_id_key = 'topic_poster'; + // For news and annoucements + $first_last = ($this->module_config['rss_first'] && !$this->module_config['rss_last']) ? 'F' : ''; + if ( $has_reply ) { + $item_title = !empty($topic['post_subject']) ? $topic['post_subject'] : $topic['topic_title']; + + $post_num = '#p' . $topic['topic_last_post_id']; + $profile_key = 'last'; + $user_id_key = 'topic_last_poster_id'; + } + $topic['topic_url' . $first_last] = $topic['topic_url']; + $topic['topic_url' . $first_last] .= $this->gym_master->set_start('topic', $start) . $post_num; + // With the msg content + $last_message = ''; + if ($this->actions['rss_content'] && @$topic['post_id' . $first_last]) { + if ($topic['post_reported' . $first_last] == 1 || ! $topic['post_approved' . $first_last]) { + $last_message = $user->lang['RSS_REPORTED_UNAPPROVED']; + } else { + $last_message = $this->gym_master->prepare_for_output( $topic, $first_last); + } + } + // Profiles + $lastposter = $author = ''; + if ($this->module_config['rss_allow_profile'] && !empty($topic[$user_id_key]) ) { + if ($this->module_config['rss_display_author']) { + $author = $topic['topic_' . $profile_key . '_poster_name']; + } + $lastposter = "\n" . $user->lang['GYM_' . strtoupper($profile_key) . '_POST_BY'] . get_username_string($this->module_config['rss_profile_mode'], $topic[$user_id_key], $topic['topic_' . $profile_key . '_poster_name'], $topic['topic_' . $profile_key . '_poster_colour']); + } + $item_desc = $this->forum_cache[$forum_id]['forum_url_full'] . $last_message . "\n" . $topic_stats . $lastposter; + // DBK use topic time if news + $time_key = $this->actions['rss_news_list'] ? 'topic_time' : 'topic_last_post_time'; + $this->gym_master->parse_item($item_title, $item_desc, $topic['topic_url' . $first_last], $this->forum_cache[$forum_id]['forum_rss_url'], $this->forum_cache[$forum_id]['forum_name'] . $this->module_config['extra_title'], $topic[$time_key], $author); + } + }// End topic loop + // Used to separate query + $topic_sofar = $topic_sofar + $this->module_config['rss_sql_limit']; + $db->sql_freeresult($result); + unset($topic); + }// End Query limit loop + unset($forum_data, $this->forum_cache); + } +} +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/sources/.htaccess b/phpBB/gym_sitemaps/sources/.htaccess new file mode 100644 index 0000000000..6511d09c92 --- /dev/null +++ b/phpBB/gym_sitemaps/sources/.htaccess @@ -0,0 +1,4 @@ +<Limit GET POST PUT DELETE> +Order Allow,Deny +Deny from All +</Limit> diff --git a/phpBB/gym_sitemaps/sources/xml_google_external.php b/phpBB/gym_sitemaps/sources/xml_google_external.php new file mode 100644 index 0000000000..dcbfa6fde9 --- /dev/null +++ b/phpBB/gym_sitemaps/sources/xml_google_external.php @@ -0,0 +1,40 @@ +<?php +/** +* +* @package phpBB SEO GYM Sitemaps +* @version $Id: xml_google_external.php 112 2009-09-30 17:21:34Z dcz $ +* @copyright (c) 2006 - 2009 www.phpbb-seo.com +* @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License +* +*/ +// First basic security +if ( !defined('IN_PHPBB') ) { + exit; +} +/** + * Please note : + * + * If you want to include here sitemaps from a different domain than + * the one used by GYM, you will have to declare it in the source domain's + * robots.txt. + * + * Example : + * + * www.host1.com with Sitemap file sitemap-host1.xml + * To include the sitemaps in GYM's one (http://www.sitemaphost.com/sitemap-host1.xml) + * you need to add : + * + * Sitemap: http://www.sitemaphost.com/sitemap-host1.xml + * + * In www.host1.com's robots.txt. + * + * Otherwise, the sitemap will be refused. + * + * http://www.sitemaps.org/protocol.php#sitemaps_cross_submits + */ +$external_setup = array( + // Pattern : name => url + // Each name must be unique and must not match an .xml file name (google_(name).xml) + // 'site-map_name' => 'http://www.example.com/sitemap.xml', +); +?>
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/style/gym_google.css b/phpBB/gym_sitemaps/style/gym_google.css new file mode 100644 index 0000000000..80a32391a1 --- /dev/null +++ b/phpBB/gym_sitemaps/style/gym_google.css @@ -0,0 +1,1547 @@ +/* phpBB 3.0 Style Sheet + -------------------------------------------------------------- + Style name: proSilver + Based on style: proSilver (this is the default phpBB 3 style) + Original author: subBlue ( http://www.subBlue.com/ ) + Modified by: dcz phpBB SEO ( www.phpbb-seo.com ) + + Copyright 2006 phpBB Group ( http://www.phpbb.com/ ) + -------------------------------------------------------------- +*/ + +/* General proSilver Markup Styles +---------------------------------------- */ + +* {/* Reset browsers default margin, padding and font sizes */ + margin: 0; + padding: 0; +} +html { font-size: 100%; + /* Always show a scrollbar for short pages - stops the jump when the scrollbar appears. non-IE browsers */ + height: 100%; + margin-bottom: 1px; +} +body { /* Text-Sizing with ems: http://www.clagnut.com/blog/348/ */ + font-family: Verdana, Helvetica, Arial, sans-serif; + color: #828282; + background-color: #FFFFFF; + /*font-size: 62.5%; This sets the default font size to be equivalent to 10px */ + font-size: 10px; + margin: 10px; + padding: 12px 0; +} +h1 { /* Forum name */ + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + margin-right: 200px; + color: #FFFFFF; + margin-top: 15px; + font-weight: bold; + font-size: 2em; +} +h2 { /* Forum header titles */ + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + font-weight: normal; + color: #3f3f3f; + font-size: 2em; + margin: 0.8em 0 0.2em 0; +} +h2.solo { margin-bottom: 1em; } + +h3 { /* Sub-headers (also used as post headers, but defined later) */ + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + text-transform: uppercase; + border-bottom: 1px solid #CCCCCC; + margin-bottom: 3px; + padding-bottom: 2px; + font-size: 1.05em; + color: #989898; + margin-top: 20px; +} +h4 { /* Forum and topic list titles */ + font-family: "Trebuchet MS", Verdana, Helvetica, Arial, Sans-serif; + font-size: 1.3em; +} +h5 { font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; + float: right; + font-weight:bold; + font-size:16px; + color:#707070; + margin-top:1px; +} +p { line-height: 1.3em; + font-size: 1.1em; + margin-bottom: 1.5em; +} + +img { + border-width: 0; +} + +hr { /* Also see tweaks.css */ + border: 0 none #FFFFFF; + border-top: 1px solid #CCCCCC; + height: 1px; + margin: 5px 0; + display: block; + clear: both; +} +hr.dashed { border-top: 1px dashed #CCCCCC; + margin: 10px 0; +} +hr.divider { display: none;} +p.right { text-align: right;} + +/* Main blocks +---------------------------------------- */ +#simple-wrap { padding: 6px 10px; } +#page-body { margin: 4px 0; + clear: both; +} +#page-footer { clear: both; +} +#page-footer h3 { margin-top: 20px; +} +#logo { float: left; + width: auto; + padding: 10px 13px 0 10px; +} +a#logo:hover { text-decoration: none;} +/* Search box +--------------------------------------------- */ +#search-box { color: #FFFFFF; + position: relative; + margin-top: 30px; + margin-right: 5px; + display: block; + float: right; + text-align: right; + white-space: nowrap; /* For Opera */ +} +#search-box #keywords { width: 95px; + background-color: #FFF; +} +#search-box input { border: 1px solid #b0b0b0; +} +/* .button1 style defined later, just a few tweaks for the search button version */ +#search-box input.button1 { padding: 1px 5px;} +#search-box li { text-align: right; + margin-top: 4px; +} +#search-box img { + vertical-align: middle; + margin-right: 3px; +} +/* Site description and logo */ +#site-description { float: left; + width: 70%; +} + +#site-description h1 { margin-right: 0;} + +/* Round cornered boxes and backgrounds +---------------------------------------- */ +.headerbar { background: #ebebeb none repeat-x 0 0; + color: #FFFFFF; + margin-bottom: 4px; + padding: 0 5px; +} +.navbar { background-color: #ebebeb; + padding: 0 10px; +} +.forabg { background: #b1b1b1 none repeat-x 0 0; + margin-bottom: 4px; + padding: 0 5px; + clear: both; +} +.forumbg { background: #ebebeb none repeat-x 0 0; + margin-bottom: 4px; + padding: 0 5px; + clear: both; +} +.panel { margin-bottom: 4px; + padding: 0 10px; + background-color: #f3f3f3; + color: #3f3f3f; +} +.post { padding: 0 10px; + margin-bottom: 4px; + background-repeat: no-repeat; + background-position: 100% 0; +} +.post:target .content { color: #000000;} +.post:target h3 a { color: #000000;} +.bg1 { background-color: #f7f7f7;} +.bg2 { background-color: #f2f2f2; } +.bg3 { background-color: #ebebeb; } +.rowbg { margin: 5px 5px 2px 5px;} +.ucprowbg { background-color: #e2e2e2; } +.fieldsbg { /*border: 1px #DBDEE2 solid;*/ + background-color: #eaeaea; +} +span.corners-top, span.corners-bottom, span.corners-top span, span.corners-bottom span { + font-size: 1px; + line-height: 1px; + display: block; + height: 5px; + background-repeat: no-repeat; +} +span.corners-top { background-image: none; + background-position: 0 0; + margin: 0 -5px; +} +span.corners-top span { background-image: none; + background-position: 100% 0; +} +span.corners-bottom { background-image: none; + background-position: 0 100%; + margin: 0 -5px; + clear: both; +} +span.corners-bottom span { background-image: none;; + background-position: 100% 100%; +} +.headbg span.corners-bottom { margin-bottom: -1px; } +.post span.corners-top, .post span.corners-bottom, .panel span.corners-top, .panel span.corners-bottom, .navbar span.corners-top, .navbar span.corners-bottom { margin: 0 -10px; } +.rules span.corners-top { margin: 0 -10px 5px -10px;} +.rules span.corners-bottom { margin: 5px -10px 0 -10px;} +/* Horizontal lists +----------------------------------------*/ +ul.linklist { display: block; + margin: 0; +} +ul.linklist li { display: block; + list-style-type: none; + float: left; + width: auto; + margin-right: 5px; + font-size: 1.1em; + line-height: 2.2em; +} +ul.linklist li.rightside, p.rightside { float: right; + margin-right: 0; + margin-left: 5px; + text-align: right; +} +ul.navlinks { padding-bottom: 1px; + margin-bottom: 1px; + border-bottom: 1px solid #FFFFFF; + font-weight: bold; +} +ul.leftside { float: left; + margin-left: 0; + margin-right: 5px; + text-align: left; +} +ul.rightside { float: right; + margin-left: 5px; + margin-right: -5px; + text-align: right; +} +/* Misc layout styles +---------------------------------------- */ +dl.details { + /*font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;*/ + font-size: 1.1em; +} +dl.details dt { + float: left; + clear: left; + width: 15em; + text-align: right; + color: #000000; + display: block; +} +dl.details dd { + margin-left: 0; + padding-left: 5px; + margin-bottom: 5px; + color: #828282; + float: left; +} +/* Miscellaneous styles +---------------------------------------- */ +.copyright { padding: 5px; + text-align: center; + color: #555555; +} +div.rules { + background-color: #ececec; + color: #bcbcbc; + padding: 0 10px; + margin: 10px 0; + font-size: 1.1em; +} +div.rules ul { margin-left: 20px; } +p.rules { background-color: #ececec; + background-image: none; + padding: 5px; +} +p.rules img { vertical-align: middle; } +p.rules a { vertical-align: middle; + clear: both; +} +#top { position: absolute; + top: -20px; +} +/* proSilver Link Styles +---------------------------------------- */ +a:link { color: #898989; text-decoration: none; } +a:visited { color: #898989; text-decoration: none; } +a:hover { color: #d3d3d3; text-decoration: underline; } +a:active { color: #d2d2d2; text-decoration: none; } +/* Links on gradient backgrounds */ +#search-box a:link, .navbg a:link, .forumbg .header a:link, .forabg .header a:link, th a:link { + color: #FFFFFF; + text-decoration: none; +} +#search-box a:visited, .navbg a:visited, .forumbg .header a:visited, .forabg .header a:visited, th a:visited { + color: #FFFFFF; + text-decoration: none; +} +#search-box a:hover, .navbg a:hover, .forumbg .header a:hover, .forabg .header a:hover, th a:hover { + color: #ffffff; + text-decoration: underline; +} +#search-box a:active, .navbg a:active, .forumbg .header a:active, .forabg .header a:active, th a:active { + color: #ffffff; + text-decoration: none; +} +/* Links for forum/topic lists */ +a.forumtitle { font-family: "Trebuchet MS", Helvetica, Arial, Sans-serif; + font-size: 1.2em; + font-weight: bold; + color: #898989; + text-decoration: none; +} +/* a.forumtitle:visited { color: #898989; } */ +a.forumtitle:hover { color: #bcbcbc; + text-decoration: underline; +} +a.forumtitle:active { color: #898989; } +a.topictitle { font-family: "Trebuchet MS", Helvetica, Arial, Sans-serif; + font-size: 1.2em; + font-weight: bold; + color: #898989; + text-decoration: none; +} +/* a.topictitle:visited { color: #d2d2d2; } */ +a.topictitle:hover { color: #bcbcbc; + text-decoration: underline; +} +a.topictitle:active { + color: #898989; +} +/* Post body links */ +.postlink { text-decoration: none; + color: #d2d2d2; + border-bottom: 1px solid #d2d2d2; + padding-bottom: 0; +} +.postlink:visited { color: #bdbdbd; + border-bottom-style: dotted; + border-bottom-color: #666666; +} +.postlink:active { color: #d2d2d2; } +.postlink:hover { background-color: #f6f6f6; + text-decoration: none; + color: #404040; +} +.signature a, .signature a:visited, .signature a:active, .signature a:hover { + border: none; + text-decoration: underline; + background-color: transparent; +} +/* Profile links */ +.postprofile a:link, .postprofile a:active, .postprofile a:visited, .postprofile dt.author a { font-weight: bold; + color: #898989; + text-decoration: none; +} +.postprofile a:hover, .postprofile dt.author a:hover { text-decoration: underline; + color: #d3d3d3; +} +/* Profile searchresults */ +.search .postprofile a { color: #898989; + text-decoration: none; + font-weight: normal; +} +.search .postprofile a:hover { color: #d3d3d3; + text-decoration: underline; +} +/* Back to top of page */ +.back2top { clear: both; + height: 11px; + text-align: right; +} +a.top { background: none no-repeat top left; + text-decoration: none; + width: 11px; + height: 11px; + display: block; + float: right; + overflow: hidden; + letter-spacing: 1000px; + text-indent: 11px; +} +a.top2 { + background: none no-repeat 0 50%; + text-decoration: none; + padding-left: 15px; +} +/* Arrow links */ +a.up { background: none no-repeat left center; } +a.down { background: none no-repeat right center; } +a.left { background: none no-repeat 3px 60%; } +a.right { background: none no-repeat 95% 60%; } +a.up, a.up:link, a.up:active, a.up:visited { padding-left: 10px; + text-decoration: none; + border-bottom-width: 0; +} +a.up:hover { background-position: left top; + background-color: transparent; +} +a.down, a.down:link, a.down:active, a.down:visited { padding-right: 10px; } +a.down:hover { background-position: right bottom; + text-decoration: none; +} +a.left, a.left:active, a.left:visited { padding-left: 12px; } +a.left:hover { color: #d2d2d2; + text-decoration: none; + background-position: 0 60%; +} +a.right, a.right:active, a.right:visited { padding-right: 12px;} +a.right:hover { color: #d2d2d2; + text-decoration: none; + background-position: 100% 60%; +} +/* proSilver Content Styles +---------------------------------------- */ +ul.topiclist { display: block; + list-style-type: none; + margin: 0; +} +ul.forums { background: #f9f9f9 none repeat-x 0 0; +} +ul.topiclist li { display: block; + list-style-type: none; + color: #777777; + margin: 0; +} +ul.topiclist dl { position: relative;} +ul.topiclist li.row dl {padding: 2px 0;} +ul.topiclist dt {display: block; + float: left; + width: 50%; + font-size: 1.1em; + padding-left: 5px; + padding-right: 5px; +} +ul.topiclist dd { display: block; + float: left; + border-left: 1px solid #FFFFFF; + padding: 4px 0; +} +ul.topiclist dfn { /* Labels for post/view counts */ + display: none; +} + +ul.topiclist li.row dt a.subforum { background-image: none; + background-position: 0 50%; + background-repeat: no-repeat; + position: relative; + white-space: nowrap; + padding: 0 0 0 12px; +} +.forum-image { float: left; + padding-top: 5px; + margin-right: 5px; +} +li.row { border-top: 1px solid #FFFFFF; + border-bottom: 1px solid #8f8f8f; +} +li.row strong { font-weight: normal; + color: #000000; +} +li.row:hover { background-color: #f6f6f6; +} +li.row:hover dd { border-left-color: #CCCCCC; +} +li.header dt, li.header dd { line-height: 1em; + border-left-width: 0; + margin: 2px 0 4px 0; + color: #FFFFFF; + padding-top: 2px; + padding-bottom: 2px; + font-size: 1em; + font-family: Arial, Helvetica, sans-serif; + text-transform: uppercase; +} +li.header dt { font-weight: bold;} +li.header dd { margin-left: 1px;} +li.header dl.icon { min-height: 0;} +li.header dl.icon dt { /* Tweak for headers alignment when folder icon used */ + padding-left: 0; + padding-right: 44px; +} +/* Forum list column styles */ +dl.icon { min-height: 35px; + background-position: 10px 50%; /* Position of folder icon */ + background-repeat: no-repeat; +} +dl.icon dt { padding-left: 45px; /* Space for folder icon */ + background-repeat: no-repeat; + background-position: 5px 95%; /* Position of topic icon */ +} +dd.posts, dd.topics, dd.views { width: 8%; + text-align: center; + line-height: 2.2em; + font-size: 1.2em; +} +dd.lastpost { width: 25%; + font-size: 1.1em; +} +dd.redirect { font-size: 1.1em; + line-height: 2.5em; +} +dd.moderation { font-size: 1.1em; } +dd.lastpost span, ul.topiclist dd.searchby span, ul.topiclist dd.info span, ul.topiclist dd.time span, dd.redirect span, dd.moderation span { display: block; + padding-left: 5px; +} +dd.time { width: auto; + line-height: 200%; + font-size: 1.1em; +} +dd.extra { width: 65px; + line-height: 200%; + text-align: center; + font-size: 1.1em; +} +dd.mark { float: right !important; + width: 9%; + text-align: center; + line-height: 200%; + font-size: 1.2em; +} +dd.info { width: 30%; } +dd.option { width: 15%; + line-height: 200%; + text-align: center; + font-size: 1.1em; +} +dd.searchby { width: 47%; + font-size: 1.1em; + line-height: 1em; +} +ul.topiclist dd.searchextra { margin-left: 5px; + padding: 0.2em 0; + font-size: 1.1em; + color: #333333; + border-left: none; + clear: both; + width: 98%; + overflow: hidden; +} +/* Container for post/reply buttons and pagination */ +.topic-actions { margin-bottom: 3px; + font-size: 1.1em; + height: 28px; + min-height: 28px; +} +div[class].topic-actions { height: auto; } +/* Post body styles +----------------------------------------*/ +.postbody { padding: 0; + line-height: 1.48em; + color: #333333; + width: 76%; + float: left; + clear: both; +} +.postbody .ignore { font-size: 1.1em; } +.postbody h3.first { /* The first post on the page uses this */ + font-size: 1.7em; +} +.postbody h3 { /* Postbody requires a different h3 format - so change it here */ + font-size: 1.5em; + padding: 2px 0 0 0; + margin: 0 0 0.3em 0 !important; + text-transform: none; + border: none; + font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; + line-height: 125%; +} +.postbody h3 img { /* Also see tweaks.css */ + vertical-align: bottom; +} +.postbody .content { font-size: 1.3em; } +.search .postbody { width: 68% } +/* Content container styles +----------------------------------------*/ +.content { min-height: 3em; + overflow: hidden; + line-height: 1.4em; + font-family: "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; + font-size: 1em; + color: #333333; +} +.content h2, .panel h2 { font-weight: normal; + color: #989898; + border-bottom: 1px solid #CCCCCC; + font-size: 1.6em; + margin-top: 0.5em; + margin-bottom: 0.5em; + padding-bottom: 0.5em; +} +.panel h3 { margin: 0.5em 0; } +.panel p { font-size: 1.2em; + margin-bottom: 1em; + line-height: 1.4em; +} +.content p { font-family: "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; + font-size: 1.2em; + margin-bottom: 1em; + line-height: 1.4em; +} +dl.faq { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + font-size: 1.1em; + margin-top: 1em; + margin-bottom: 2em; + line-height: 1.4em; +} +dl.faq dt { font-weight: bold; + color: #333333; +} +.content dl.faq { font-size: 1.2em; + margin-bottom: 0.5em; +} +.content li { list-style-type: inherit; } +.content ul, .content ol { margin-bottom: 1em; + margin-left: 3em; +} +.announce, .unreadpost { + /* Highlight the announcements & unread posts box */ + border-left-color: #BCBCBC; + border-right-color: #BCBCBC; +} +/* Post author */ +p.author { margin: 0 15em 0.6em 0; + padding: 0 0 5px 0; + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 1em; + line-height: 1.2em; +} +/* Post signature */ +.signature { margin-top: 1.5em; + padding-top: 0.2em; + font-size: 1.1em; + border-top: 1px solid #CCCCCC; + clear: left; + line-height: 140%; + overflow: hidden; + width: 100%; +} +dd .signature { margin: 0; + padding: 0; + clear: none; + border: none; +} +/* Post noticies */ +.notice { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + width: auto; + margin-top: 1.5em; + padding-top: 0.2em; + font-size: 1em; + border-top: 1px dashed #CCCCCC; + clear: left; + line-height: 130%; +} +/* Jump to post link for now */ +ul.searchresults { + list-style: none; + text-align: right; + clear: both; +} +/* BB Code styles +----------------------------------------*/ +/* Quote block */ +blockquote { + background: #ebebeb none 6px 8px no-repeat; + border: 1px solid #dbdbdb; + font-size: 0.95em; + margin: 0.5em 1px 0 25px; + overflow: hidden; + padding: 5px; +} +blockquote blockquote { /* Nested quotes */ + background-color: #bababa; + font-size: 1em; + margin: 0.5em 1px 0 15px; +} +blockquote blockquote blockquote { /* Nested quotes */ + background-color: #e4e4e4; +} +blockquote cite { /* Username/source of quoter */ + font-style: normal; + font-weight: bold; + margin-left: 20px; + display: block; + font-size: 0.9em; +} +blockquote cite cite { font-size: 1em; } +blockquote.uncited { padding-top: 25px; } +/* Code block */ +dl.codebox { + padding: 3px; + background-color: #FFFFFF; + border: 1px solid #d8d8d8; + font-size: 1em; +} +dl.codebox dt { text-transform: uppercase; + border-bottom: 1px solid #CCCCCC; + margin-bottom: 3px; + font-size: 0.8em; + font-weight: bold; + display: block; +} +blockquote dl.codebox { margin-left: 0; } +dl.codebox code { /* Also see tweaks.css */ + overflow: auto; + display: block; + height: auto; + max-height: 200px; + white-space: normal; + padding-top: 5px; + font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono; + line-height: 1.3em; + color: #8b8b8b; + margin: 2px 0; +} +.syntaxbg { color: #FFFFFF; } +.syntaxcomment { color: #000000; } +.syntaxdefault { color: #bcbcbc; } +.syntaxhtml { color: #000000; } +.syntaxkeyword { color: #585858; } +.syntaxstring { color: #a7a7a7; } +/* Attachments +----------------------------------------*/ +.attachbox { float: left; + width: auto; + margin: 5px 5px 5px 0; + padding: 6px; + background-color: #FFFFFF; + border: 1px dashed #d8d8d8; + clear: left; +} +.pm-message .attachbox { background-color: #f3f3f3; } +.attachbox dt { font-family: Arial, Helvetica, sans-serif; + text-transform: uppercase; +} +.attachbox dd { margin-top: 4px; + padding-top: 4px; + clear: left; + border-top: 1px solid #d8d8d8; +} +.attachbox dd dd { border: none; } +.attachbox p { line-height: 110%; + color: #666666; + font-weight: normal; + clear: left; +} +.attachbox p.stats { line-height: 110%; + color: #666666; + font-weight: normal; + clear: left; +} +.attach-image { margin: 3px 0; + width: 100%; + max-height: 350px; + overflow: auto; +} +.attach-image img { border: 1px solid #999999; +/* cursor: move; */ + cursor: default; +} +/* Inline image thumbnails */ +div.inline-attachment dl.thumbnail, div.inline-attachment dl.file { display: block; + margin-bottom: 4px; +} +div.inline-attachment p { font-size: 100%; } +dl.file { font-family: Verdana, Arial, Helvetica, sans-serif; + display: block; +} +dl.file dt { text-transform: none; + margin: 0; + padding: 0; + font-weight: bold; + font-family: Verdana, Arial, Helvetica, sans-serif; +} +dl.file dd { color: #666666; + margin: 0; + padding: 0; +} +dl.thumbnail img { padding: 3px; + border: 1px solid #666666; + display: block; + background-color: #FFF; +} +dl.thumbnail dd { color: #666666; + font-style: italic; + font-family: Verdana, Arial, Helvetica, sans-serif; +} +.attachbox dl.thumbnail dd { font-size: 100%; } +dl.thumbnail dt a:hover { background-color: #EEEEEE;} +dl.thumbnail dt a:hover img { border: 1px solid #d2d2d2; } +/* Post poll styles +----------------------------------------*/ +fieldset.polls { font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; } +fieldset.polls dl { margin-top: 5px; + border-top: 1px solid #e2e2e2; + padding: 5px 0 0 0; + line-height: 120%; + color: #666666; +} +fieldset.polls dl.voted { font-weight: bold; + color: #000000; +} +fieldset.polls dt { text-align: left; + float: left; + display: block; + width: 30%; + border-right: none; + padding: 0; + margin: 0; + font-size: 1.1em; +} +fieldset.polls dd { float: left; + width: 10%; + border-left: none; + padding: 0 5px; + margin-left: 0; + font-size: 1.1em; +} +fieldset.polls dd.resultbar { width: 50%;} +fieldset.polls dd input { margin: 2px 0; } +fieldset.polls dd div { text-align: right; + font-family: Arial, Helvetica, sans-serif; + color: #FFFFFF; + font-weight: bold; + padding: 0 2px; + overflow: visible; + min-width: 2%; +} +.pollbar1 { background-color: #aaaaaa; + border-bottom: 1px solid #747474; + border-right: 1px solid #747474; +} +.pollbar2 { background-color: #bebebe; + border-bottom: 1px solid #8c8c8c; + border-right: 1px solid #8c8c8c; +} +.pollbar3 { background-color: #D1D1D1; + border-bottom: 1px solid #aaaaaa; + border-right: 1px solid #aaaaaa; +} +.pollbar4 { background-color: #e4e4e4; + border-bottom: 1px solid #bebebe; + border-right: 1px solid #bebebe; +} +.pollbar5 { background-color: #f8f8f8; + border-bottom: 1px solid #D1D1D1; + border-right: 1px solid #D1D1D1; +} +/* Poster profile block +----------------------------------------*/ +.postprofile { /* Also see tweaks.css */ + margin: 5px 0 10px 0; + min-height: 80px; + color: #666666; + border-left: 1px solid #FFFFFF; + width: 22%; + float: right; + display: inline; +} +.pm .postprofile { border-left: 1px solid #DDDDDD; } +.postprofile dd, .postprofile dt { line-height: 1.2em; + margin-left: 8px; +} +.postprofile strong {font-weight: normal; + color: #000000; +} +.avatar { border: none; + margin-bottom: 3px; +} +.online { background-image: none; + background-position: 100% 0; + background-repeat: no-repeat; +} +/* Poster profile used by search*/ +.search .postprofile { width: 30%;} +/* pm list in compose message if mass pm is enabled */ +dl.pmlist dt { width: 60% !important;} +dl.pmlist dt textarea { width: 95%;} +dl.pmlist dd { margin-left: 61% !important; + margin-bottom: 2px; +} +/* proSilver Button Styles +---------------------------------------- */ +/* Rollover buttons + Based on: http://wellstyled.com/css-nopreload-rollovers.html +----------------------------------------*/ +.buttons { float: left; + width: auto; + height: auto; +} +/* Rollover state */ +.buttons div { float: left; + margin: 0 5px 0 0; + background-position: 0 100%; +} +/* Rolloff state */ +.buttons div a { display: block; + width: 100%; + height: 100%; + background-position: 0 0; +} +/* Hide <a> text and hide off-state image when rolling over (prevents flicker in IE) */ +.buttons div span { display: none; } +.buttons div a:hover { background-image: none; } +/* Big button images */ +.reply-icon, .reply-icon a { background: transparent none 0 0 no-repeat; } +.post-icon, .post-icon a { background: transparent none 0 0 no-repeat; } +.locked-icon, .locked-icon a { background: transparent none 0 0 no-repeat; } +.pmreply-icon, .pmreply-icon a { background: none 0 0 no-repeat; } +.newpm-icon, .newpm-icon a { background: none 0 0 no-repeat; } +.forwardpm-icon, .forwardpm-icon a { background: none 0 0 no-repeat; } +/* Set big button dimensions */ +.buttons div.reply-icon { width: 96px; height: 25px; } +.buttons div.post-icon { width: 96px; height: 25px; } +.buttons div.locked-icon { width: 96px; height: 25px; } +.buttons div.pmreply-icon { width: 96px; height: 25px; } +.buttons div.newpm-icon { width: 96px; height: 25px; } +.buttons div.forwardpm-icon { width: 110px; height: 25px; } +/* Sub-header (navigation bar) +--------------------------------------------- */ +a.print, a.sendemail, a.fontsize { display: block; + overflow: hidden; + height: 18px; + text-indent: -5000px; + text-align: left; + background-repeat: no-repeat; +} +a.fontsize { background-image: none; + background-position: 0 -1px; + width: 29px; +} +a.fontsize:hover { background-position: 0 -20px; + text-decoration: none; +} +/* Icon images +---------------------------------------- */ +.sitehome, .icon-faq, .icon-members, .icon-home, .icon-ucp, .icon-register, .icon-logout, +.icon-bookmark, .icon-bump, .icon-subscribe, .icon-unsubscribe, .icon-pages, .icon-search { + background-position: 0 50%; + background-repeat: no-repeat; + background-image: none; + padding: 1px 0 0 17px; +} +/* Poster profile icons +----------------------------------------*/ +ul.profile-icons { padding-top: 10px; + list-style: none; +} +/* Rollover state */ +ul.profile-icons li { float: left; + margin: 0 6px 3px 0; + background-position: 0 100%; +} +/* Rolloff state */ +ul.profile-icons li a { display: block; + width: 100%; + height: 100%; + background-position: 0 0; +} +/* Hide <a> text and hide off-state image when rolling over (prevents flicker in IE) */ +ul.profile-icons li span { display:none; } +ul.profile-icons li a:hover { background: none; } +/* Positioning of moderator icons */ +.postbody ul.profile-icons { float: right; + width: auto; + padding: 0; +} +.postbody ul.profile-icons li { margin: 0 3px;} +/* Profile & navigation icons */ +.email-icon, .email-icon a { background: none top left no-repeat; } +.aim-icon, .aim-icon a { background: none top left no-repeat; } +.yahoo-icon, .yahoo-icon a { background: none top left no-repeat; } +.web-icon, .web-icon a { background: none top left no-repeat; } +.msnm-icon, .msnm-icon a { background: none top left no-repeat; } +.icq-icon, .icq-icon a { background: none top left no-repeat; } +.jabber-icon, .jabber-icon a { background: none top left no-repeat; } +.pm-icon, .pm-icon a { background: none top left no-repeat; } +.quote-icon, .quote-icon a { background: none top left no-repeat; } +/* Moderator icons */ +.report-icon, .report-icon a { background: none top left no-repeat; } +.warn-icon, .warn-icon a { background: none top left no-repeat; } +.edit-icon, .edit-icon a { background: none top left no-repeat; } +.delete-icon, .delete-icon a { background: none top left no-repeat; } +.info-icon, .info-icon a { background: none top left no-repeat; } +/* Set profile icon dimensions */ +ul.profile-icons li.email-icon { width: 20px; height: 20px; } +ul.profile-icons li.aim-icon { width: 20px; height: 20px; } +ul.profile-icons li.yahoo-icon { width: 20px; height: 20px; } +ul.profile-icons li.web-icon { width: 20px; height: 20px; } +ul.profile-icons li.msnm-icon { width: 20px; height: 20px; } +ul.profile-icons li.icq-icon { width: 20px; height: 20px; } +ul.profile-icons li.jabber-icon { width: 20px; height: 20px; } +ul.profile-icons li.pm-icon { width: 28px; height: 20px; } +ul.profile-icons li.quote-icon { width: 54px; height: 20px; } +ul.profile-icons li.report-icon { width: 20px; height: 20px; } +ul.profile-icons li.edit-icon { width: 58px; height: 20px; } +ul.profile-icons li.delete-icon { width: 20px; height: 20px; } +ul.profile-icons li.info-icon { width: 20px; height: 20px; } +ul.profile-icons li.warn-icon { width: 20px; height: 20px; } +/* Fix profile icon default margins */ +ul.profile-icons li.edit-icon { margin: 0 0 0 3px; } +ul.profile-icons li.quote-icon { margin: 0 0 0 10px; } +ul.profile-icons li.info-icon, ul.profile-icons li.report-icon { margin: 0 3px 0 0; } +/* proSilver Form Styles +---------------------------------------- */ +/* General form styles +----------------------------------------*/ +fieldset { border-width: 0; + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 1.1em; +} +input { font-weight: normal; + cursor: pointer; + vertical-align: middle; + padding: 0 3px; + font-size: 1em; + font-family: Verdana, Helvetica, Arial, sans-serif; +} +select {font-family: Verdana, Helvetica, Arial, sans-serif; + font-weight: normal; + cursor: pointer; + vertical-align: middle; + border: 1px solid #666666; + padding: 1px; + background-color: #FAFAFA; +} +option { padding-right: 1em; } +option.disabled-option { color: graytext; } +textarea { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + width: 60%; + padding: 2px; + font-size: 1em; + line-height: 1.4em; +} +label { cursor: default; + padding-right: 5px; + color: #676767; +} +label input { vertical-align: middle;} +label img { vertical-align: middle;} +/* Definition list layout for forms +---------------------------------------- */ +fieldset dl { padding: 4px 0;} +fieldset dt { float: left; + width: 40%; + text-align: left; + display: block; +} +fieldset dd { margin-left: 41%; + vertical-align: top; + margin-bottom: 3px; +} +/* Specific layout 1 */ +fieldset.fields1 dt { width: 15em; + border-right-width: 0; +} +fieldset.fields1 dd { margin-left: 15em; + border-left-width: 0; +} +fieldset.fields1 { background-color: transparent; } +fieldset.fields1 div { margin-bottom: 3px; } +/* Specific layout 2 */ +fieldset.fields2 dt { width: 15em; + border-right-width: 0; +} +fieldset.fields2 dd { margin-left: 16em; + border-left-width: 0; +} +/* Form elements */ +dt label { font-weight: bold; + text-align: left; +} +dd label { white-space: nowrap; + color: #333; +} +dd input, dd textarea { margin-right: 3px; } +dd select { width: auto; } +dd textarea { width: 85%; } +/* Hover effects */ +fieldset dl:hover dt label {color: #000000;} +fieldset.fields2 dl:hover dt label { color: inherit;} +/* Submit button fieldset */ +fieldset.submit-buttons { text-align: center; + vertical-align: middle; + margin: 5px 0; +} +fieldset.submit-buttons input { vertical-align: middle; + padding-top: 3px; + padding-bottom: 3px; +} +/* Input field styles +---------------------------------------- */ +.inputbox { background-color: #FFFFFF; + border: 1px solid #c0c0c0; + color: #333333; + padding: 2px; + cursor: text; +} +.inputbox:hover { border: 1px solid #eaeaea;} +.inputbox:focus { border: 1px solid #eaeaea; + color: #4b4b4b; +} +input.inputbox { width: 85%; } +input.medium { width: 50%; } +input.narrow { width: 25%; } +input.tiny { width: 125px; } +textarea.inputbox { width: 85%; } +.autowidth {width: auto !important;} +/* Form button styles +---------------------------------------- */ +input.button1, input.button2 {font-size: 1em;} +a.button1, input.button1, input.button3, a.button2, input.button2 { + width: auto !important; + padding-top: 1px; + padding-bottom: 1px; + font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + color: #000; + background: #FAFAFA none repeat-x top; +} +a.button1, input.button1 {font-weight: bold; + border: 1px solid #666666; +} +input.button3 {padding: 0; + margin: 0; + line-height: 5px; + height: 12px; + background-image: none; + font-variant: small-caps; +} +/* Alternative button */ +a.button2, input.button2, input.button3 {border: 1px solid #666666;} +/* <a> button in the style of the form buttons */ +a.button1, a.button1:link, a.button1:visited, a.button1:active, a.button2, a.button2:link, a.button2:visited, a.button2:active { + text-decoration: none; + color: #000000; + padding: 2px 8px; + line-height: 250%; + vertical-align: text-bottom; + background-position: 0 1px; +} +/* Hover states */ +a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover { + border: 1px solid #BCBCBC; + background-position: 0 100%; + color: #BCBCBC; +} + +/* Topic and forum Search */ +.search-box {margin-top: 3px; + margin-left: 5px; + float: left; +} +.search-box input { +} +input.search {background-image: none; + background-repeat: no-repeat; + background-position: left 1px; + padding-left: 17px; +} +/* proSilver Style Sheet Tweaks +These style definitions are mainly IE specific +tweaks required due to its poor CSS support. +-------------------------------------------------*/ +* html table, * html select, * html input { font-size: 100%; } +* html hr { margin: 0; } +* html span.corners-top, * html span.corners-bottom { background-image: url("{T_IMAGE_PATH}corners_left.gif"); } +* html span.corners-top span, * html span.corners-bottom span { background-image: url("{T_IMAGE_PATH}corners_right.gif"); } +table.table1 {width: 99%; /* IE < 6 browsers */ + /* Tantek hack */ + voice-family: "\"}\""; + voice-family: inherit; + width: 100%; +} +html>body table.table1 { width: 100%; } /* Reset 100% for opera */ +* html ul.topiclist li { position: relative; } +* html .postbody h3 img { vertical-align: middle; } +/* Form styles */ +html>body dd label input { vertical-align: text-bottom; } /* Align checkboxes/radio buttons nicely */ +* html input.button1, * html input.button2 { + padding-bottom: 0; + margin-bottom: 1px; +} +/* Misc layout styles */ +* html .column1, * html .column2 { width: 45%; } +/* Nice method for clearing floated blocks without having to insert any extra markup (like spacer above) + From http://www.positioniseverything.net/easyclearing.html +#tabs:after, #minitabs:after, .post:after, .navbar:after, fieldset dl:after, ul.topiclist dl:after, ul.linklist:after, dl.polls:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +}*/ +.clearfix, #tabs, #minitabs, .post, .navbar, fieldset dl, ul.topiclist dl, ul.linklist, dl.polls { + height: 1%; + overflow: hidden; +} +/* Simple fix so forum and topic lists always have a min-height set, even in IE6 + From http://www.dustindiaz.com/min-height-fast-hack */ +dl.icon { min-height: 35px; + height: auto !important; + height: 35px; +} +* html #search-box { + margin-right: 35px; +} +/* Correctly clear floating for details on profile view */ +*:first-child+html dl.details dd { margin-left: 15em; + float: none; +} +* html dl.details dd { margin-left: 15em; + float: none; +} +/* +-------------------------------------------------------------- +Colours and backgrounds for common.css +-------------------------------------------------------------- */ +html, body { color: #536482; + background-color: #FFFFFF; +} +h1 { color: #FFFFFF;} +h2 {color: #28313F;} +h3 {border-bottom-color: #CCCCCC; + color: #115098; +} +hr {border-color: #FFFFFF; + border-top-color: #CCCCCC; +} +hr.dashed {border-top-color: #CCCCCC;} +/* Search box +--------------------------------------------- */ +#search-box {color: #FFFFFF;} +#search-box #keywords {background-color: #FFF;} +#search-box input {border-color: #0075B0;} +/* Round cornered boxes and backgrounds +---------------------------------------- */ +.headerbar {background-color: #12A3EB; + background-image: url("{T_IMAGE_PATH}bg_header.gif"); + color: #FFFFFF; +} +.navbar {background-color: #cadceb;} +.forabg {background-color: #0076b1; + background-image: url("{T_IMAGE_PATH}bg_list.gif"); +} +.forumbg {background-color: #12A3EB; + background-image: url("{T_IMAGE_PATH}bg_header.gif"); +} +.panel {background-color: #ECF1F3; + color: #28313F; +} +.post:target .content {color: #000000;} +.post:target h3 a {color: #000000;} +.bg1 { background-color: #ECF3F7; } +.bg2 { background-color: #e1ebf2; } +.bg3 { background-color: #cadceb; } +.ucprowbg {background-color: #DCDEE2;} +.fieldsbg {background-color: #E7E8EA;} +span.corners-top {background-image: url("{T_IMAGE_PATH}corners_left.png");} +span.corners-top span {background-image: url("{T_IMAGE_PATH}corners_right.png");} +span.corners-bottom {background-image: url("{T_IMAGE_PATH}corners_left.png");} +span.corners-bottom span {background-image: url("{T_IMAGE_PATH}corners_right.png");} +/* Horizontal lists +----------------------------------------*/ +ul.navlinks {border-bottom-color: #FFFFFF;} +/* Misc layout styles +---------------------------------------- */ +dl.details dt { + color: #000000; +} + +dl.details dd { + color: #536482; +} + +.sep { + color: #1198D9; +} +/* Miscellaneous styles +---------------------------------------- */ +.copyright {color: #555555;} +.error {color: #BC2A4D;} +.reported {background-color: #F7ECEF;} +li.reported:hover {background-color: #ECD5D8 !important;} +.sticky, .announce {/* you can add a background for stickies and announcements*/} +div.rules {background-color: #ECD5D8; + color: #BC2A4D; +} +p.rules {background-color: #ECD5D8; + background-image: none; +} +/* +-------------------------------------------------------------- +Colours and backgrounds for links.css +-------------------------------------------------------------- */ +a:link { color: #105289; } +a:visited { color: #105289; } +a:hover { color: #D31141; } +a:active { color: #368AD2; } +/* Links on gradient backgrounds */ +#search-box a:link, .navbg a:link, .forumbg .header a:link, .forabg .header a:link, th a:link {color: #FFFFFF;} +#search-box a:visited, .navbg a:visited, .forumbg .header a:visited, .forabg .header a:visited, th a:visited {color: #FFFFFF;} +#search-box a:hover, .navbg a:hover, .forumbg .header a:hover, .forabg .header a:hover, th a:hover {color: #A8D8FF;} +#search-box a:active, .navbg a:active, .forumbg .header a:active, .forabg .header a:active, th a:active {color: #C8E6FF;} +/* Links for forum/topic lists */ +a.forumtitle {color: #105289;} +/* a.forumtitle:visited { color: #105289; } */ +a.forumtitle:hover {color: #BC2A4D;} +a.forumtitle:active {color: #105289;} +a.topictitle {color: #105289;} +/* a.topictitle:visited { color: #368AD2; } */ +a.topictitle:hover {color: #BC2A4D;} +a.topictitle:active {color: #105289;} +/* Post body links */ +.postlink {color: #368AD2; + border-bottom-color: #368AD2; +} +.postlink:visited {color: #5D8FBD; + border-bottom-color: #666666; +} +.postlink:active {color: #368AD2;} +.postlink:hover {background-color: #D0E4F6; + color: #0D4473; +} +.signature a, .signature a:visited, .signature a:active, .signature a:hover {background-color: transparent;} +/* Profile links */ +.postprofile a:link, .postprofile a:active, .postprofile a:visited, .postprofile dt.author a {color: #105289;} +.postprofile a:hover, .postprofile dt.author a:hover {color: #D31141;} +/* Profile searchresults */ +.search .postprofile a {color: #105289;} +.search .postprofile a:hover {color: #D31141;} +/* Back to top of page */ +a.top {background-image: url("{T_IMAGE_PATH}icon_back_top.gif");} +a.top2 {background-image: url("{T_IMAGE_PATH}icon_back_top.gif");} +/* Arrow links */ +a.up { background-image: url("{T_IMAGE_PATH}arrow_up.gif") } +a.down { background-image: url("{T_IMAGE_PATH}arrow_down.gif") } +a.left { background-image: url("{T_IMAGE_PATH}arrow_left.gif") } +a.right { background-image: url("{T_IMAGE_PATH}arrow_right.gif") } +a.up:hover {background-color: transparent;} +a.left:hover {color: #368AD2;} +a.right:hover {color: #368AD2;} +/* +-------------------------------------------------------------- +Colours and backgrounds for content.css +-------------------------------------------------------------- */ +ul.forums {background-color: #eef5f9; + background-image: url("{T_IMAGE_PATH}gradient.gif"); +} +ul.topiclist li {color: #4C5D77;} +ul.topiclist dd {border-left-color: #FFFFFF;} +.rtl ul.topiclist dd {border-right-color: #fff; + border-left-color: transparent; +} +ul.topiclist li.row dt a.subforum.read {background-image: url("{T_IMAGE_PATH}subforum_read.gif");} +ul.topiclist li.row dt a.subforum.unread {background-image: url("{T_IMAGE_PATH}subforum_unread.gif");} +li.row {border-top-color: #FFFFFF; + border-bottom-color: #00608F; +} +li.row strong {color: #000000;} +li.row:hover {background-color: #F6F4D0;} +li.row:hover dd {border-left-color: #CCCCCC;} +.rtl li.row:hover dd {border-right-color: #CCCCCC; + border-left-color: transparent; +} +li.header dt, li.header dd {color: #FFFFFF;} +/* Forum list column styles */ +ul.topiclist dd.searchextra {color: #333333;} +/* Post body styles +----------------------------------------*/ +.postbody {color: #333333;} +/* Content container styles +----------------------------------------*/ +.content {color: #333333;} +.content h2, .panel h2 {color: #115098; + border-bottom-color: #CCCCCC; +} +dl.faq dt {color: #333333;} +.posthilit {background-color: #F3BFCC; + color: #BC2A4D; +} +/* Post signature */ +.signature {border-top-color: #CCCCCC;} +/* Post noticies */ +.notice {border-top-color: #CCCCCC;} +/* BB Code styles +----------------------------------------*/ +/* Quote block */ +blockquote {background-color: #EBEADD; + background-image: url("{T_IMAGE_PATH}quote.gif"); + border-color:#DBDBCE; +} +blockquote blockquote {/* Nested quotes */ + background-color:#EFEED9; +} +blockquote blockquote blockquote {/* Nested quotes */ + background-color: #EBEADD; +} +/* Code block */ +dl.codebox {background-color: #FFFFFF; + border-color: #C9D2D8; +} +dl.codebox dt {border-bottom-color: #CCCCCC; +} +dl.codebox code {color: #2E8B57;} +.syntaxbg { color: #FFFFFF; } +.syntaxcomment { color: #FF8000; } +.syntaxdefault { color: #0000BB; } +.syntaxhtml { color: #000000; } +.syntaxkeyword { color: #007700; } +.syntaxstring { color: #DD0000; } +/* Attachments +----------------------------------------*/ +.attachbox {background-color: #FFFFFF; + border-color: #C9D2D8; +} +.pm-message .attachbox {background-color: #F2F3F3;} +.attachbox dd {border-top-color: #C9D2D8;} +.attachbox p {color: #666666;} +.attachbox p.stats {color: #666666;} +.attach-image img {border-color: #999999;} +/* Inline image thumbnails */ +dl.file dd {color: #666666;} +dl.thumbnail img {border-color: #666666; + background-color: #FFFFFF; +} +dl.thumbnail dd {color: #666666;} +dl.thumbnail dt a:hover {background-color: #EEEEEE;} +dl.thumbnail dt a:hover img {border-color: #368AD2;} +/* Post poll styles +----------------------------------------*/ +fieldset.polls dl {border-top-color: #DCDEE2; + color: #666666; +} +fieldset.polls dl.voted {color: #000000; +} +fieldset.polls dd div {color: #FFFFFF; +} +.rtl .pollbar1, .rtl .pollbar2, .rtl .pollbar3, .rtl .pollbar4, .rtl .pollbar5 {border-right-color: transparent; +} +.pollbar1 {background-color: #AA2346; + border-bottom-color: #74162C; + border-right-color: #74162C; +} +.rtl .pollbar1 {border-left-color: #74162C;} +.pollbar2 {background-color: #BE1E4A; + border-bottom-color: #8C1C38; + border-right-color: #8C1C38; +} +.rtl .pollbar2 {border-left-color: #8C1C38;} +.pollbar3 {background-color: #D11A4E; + border-bottom-color: #AA2346; + border-right-color: #AA2346; +} +.rtl .pollbar3 {border-left-color: #AA2346;} +.pollbar4 {background-color: #E41653; + border-bottom-color: #BE1E4A; + border-right-color: #BE1E4A; +} +.rtl .pollbar4 {border-left-color: #BE1E4A;} +.pollbar5 {background-color: #F81157; + border-bottom-color: #D11A4E; + border-right-color: #D11A4E; +} +.rtl .pollbar5 {border-left-color: #D11A4E;} +/* Poster profile block +----------------------------------------*/ +.postprofile {color: #666666; + border-left-color: #FFFFFF; +} +.rtl .postprofile {border-right-color: #FFFFFF; + border-left-color: transparent; +} +.pm .postprofile {border-left-color: #DDDDDD;} +.rtl .pm .postprofile {border-right-color: #DDDDDD; + border-left-color: transparent; +} +.postprofile strong {color: #000000;} +.online {background-image: url("./styles/prosilver/imageset/fr/icon_user_online.gif");} +/* +-------------------------------------------------------------- +Colours and backgrounds for buttons.css +-------------------------------------------------------------- */ +a.fontsize {background-image: url("{T_IMAGE_PATH}icon_fontsize.gif");} +/* Icon images +---------------------------------------- */ +.sitehome { background-image: url("{T_IMAGE_PATH}icon_home.gif"); } +.icon-faq { background-image: url("{T_IMAGE_PATH}icon_faq.gif"); } +.icon-ucp { background-image: url("{T_IMAGE_PATH}sitemap-icon.gif"); } +.icon-members { background-image: url("{T_IMAGE_PATH}icon_members.gif"); } +.icon-home { background-image: url("{T_IMAGE_PATH}icon_home.gif"); } +.icon-register { background-image: url("{T_IMAGE_PATH}icon_register.gif"); } +.icon-logout { background-image: url("{T_IMAGE_PATH}icon_logout.gif"); } +.icon-bookmark { background-image: url("{T_IMAGE_PATH}icon_bookmark.gif"); } +.icon-subscribe { background-image: url("{T_IMAGE_PATH}icon_subscribe.gif"); } +.icon-search { background-image: url("{T_IMAGE_PATH}icon_search.gif"); } +/* +-------------------------------------------------------------- +Colours and backgrounds for forms.css +-------------------------------------------------------------- */ +/* General form styles +----------------------------------------*/ +select {border-color: #666666; + background-color: #FAFAFA; +} +label {color: #425067;} +option.disabled-option {color: graytext;} +/* Definition list layout for forms +---------------------------------------- */ +dd label {color: #333;} +/* Hover effects */ +fieldset dl:hover dt label {color: #000000;} +fieldset.fields2 dl:hover dt label {color: inherit;} +/* Quick-login on index page */ +fieldset.quick-login input.inputbox {background-color: #F2F3F3;} +/* Input field styles +---------------------------------------- */ +.inputbox {background-color: #FFFFFF; + border-color: #B4BAC0; + color: #333333; +} +.inputbox:hover {border-color: #11A3EA;} +.inputbox:focus {border-color: #11A3EA; + color: #0F4987; +} +/* Form button styles +---------------------------------------- */ +a.button1, input.button1, input.button3, a.button2, input.button2 {color: #000; + background-color: #FAFAFA; + background-image: url("{T_IMAGE_PATH}bg_button.gif"); +} +a.button1, input.button1 {border-color: #666666;} +input.button3 {background-image: none;} +/* Alternative button */ +a.button2, input.button2, input.button3 {border-color: #666666;} +/* <a> button in the style of the form buttons */ +a.button1, a.button1:link, a.button1:visited, a.button1:active, a.button2, a.button2:link, a.button2:visited, a.button2:active {color: #000000;} +/* Hover states */ +a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover {border-color: #BC2A4D; + color: #BC2A4D; +} +input.search {background-image: url("{T_IMAGE_PATH}icon_textbox_search.gif");} +#wrap { + padding: 0 20px; +} diff --git a/phpBB/gym_sitemaps/style/gym_google.xsl b/phpBB/gym_sitemaps/style/gym_google.xsl new file mode 100644 index 0000000000..c453ca3d65 --- /dev/null +++ b/phpBB/gym_sitemaps/style/gym_google.xsl @@ -0,0 +1,238 @@ +<xsl:stylesheet version="2.0" + xmlns:html="http://www.w3.org/TR/REC-html40" + xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:output + method="html" + version="1.0" + encoding="utf-8" + omit-xml-declaration="yes" + doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" + doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" + indent="yes" /> + +<!-- Root template --> +<xsl:template match="/"> + <!-- Store in $fileType if we are in a sitemap or in a SitemapIndex --> + <xsl:variable name="fileType"> + <xsl:choose> + <xsl:when test="//sitemap:url">Sitemap</xsl:when> + <xsl:otherwise>SitemapIndex</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="browser"> + <xsl:choose><xsl:when test="system-property('xsl:vendor')='Transformiix'">mozilla</xsl:when> + <xsl:otherwise>other</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="sorting"> + <xsl:choose><xsl:when test="$browser='mozilla'">descending</xsl:when> + <xsl:otherwise>ascending</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="home_link">{ROOT_URL}</xsl:variable> + + <xsl:variable name="sitemap_url"> + <xsl:choose> + <xsl:when test="$fileType='Sitemap'"><xsl:call-template name="http"><xsl:with-param name="input" select="sitemap:urlset/sitemap:url/sitemap:loc" /></xsl:call-template></xsl:when> + <xsl:otherwise></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="sitemap_title"> + <xsl:choose> + <xsl:when test="$fileType='Sitemap'"><xsl:value-of select="substring-after($sitemap_url, '{ROOT_URL}')"/></xsl:when> + <xsl:otherwise></xsl:otherwise> + </xsl:choose> + </xsl:variable> +<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}"> +<head> + <base href="{PHPBB_URL}"/> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <title><xsl:choose> + <xsl:when test="$fileType='Sitemap'">{L_SITEMAP} : <xsl:value-of select="$sitemap_title"/></xsl:when> + <xsl:otherwise>{L_SITEMAPINDEX}</xsl:otherwise> + </xsl:choose></title> + <link rel="stylesheet" href="{T_CSS_PATH}" type="text/css" media="screen, projection"/> + <link href="{T_STYLE_PATH}normal.css" rel="stylesheet" type="text/css" title="A" /> + <link href="{T_STYLE_PATH}medium.css" rel="alternate stylesheet" type="text/css" title="A+" /> + <link href="{T_STYLE_PATH}large.css" rel="alternate stylesheet" type="text/css" title="A++" /> + <script type="text/javascript" src="{T_STYLE_PATH}gym_js.js"></script> +</head> + <!-- Body --> +<body id="phpbb"> +<!-- + GYM Sitemaps and RSS XSLTransform + (C) phpBB SEO - http://www.phpbb-seo.com/ +--> + <div id="wrap"> + <a id="top" name="top" accesskey="t"></a> + <div id="page-header"> + <div class="headerbar"> + <div class="inner"><span class="corners-top"><span></span></span> + <div id="site-description"><a href="{$home_link}" title="{L_HOME}" id="logo"><img src="{T_IMAGE_PATH}site_logo.gif" alt="{SITENAME}" /></a> + <h1>{SITENAME}</h1> + <p>{SITE_DESCRIPTION}</p> + <p style="display: none;"><a href="#start_here">{L_SKIP}</a></p> + </div> + <div id="search-box"> + <form action="{PHPBB_URL}search.php" method="post" id="search"> + <fieldset> + <input name="keywords" id="keywords" type="text" maxlength="128" title="" class="inputbox search" value="" /> + <input class="button2" value="{L_SEARCH}" type="submit" /><br /> + <a href="{PHPBB_URL}search.php" title="{L_SEARCH_ADV_EXPLAIN}">{L_SEARCH_ADV}</a> + </fieldset> + </form> + </div> + <span class="corners-bottom"><span></span></span> + </div> + </div> + <div class="navbar"> + <div class="inner"><span class="corners-top"><span></span></span> + <ul class="linklist navlinks"> + <li class="icon-home"> + <a href="{$home_link}" accesskey="h">{L_HOME}</a> + <xsl:if test="$home_link != '{PHPBB_URL}'"> <strong>‹</strong> <a href="{PHPBB_URL}">{L_FORUM_INDEX}</a></xsl:if> + <xsl:if test="$fileType='Sitemap'"> + <xsl:if test="'{PHPBB_URL}' != $sitemap_url"> <strong>‹</strong> <a href="{$sitemap_url}"><xsl:value-of select="$sitemap_title"/></a></xsl:if> + </xsl:if> + </li> + <li class="rightside"><a href="#" onclick="fontsizeup(); return false;" class="fontsize" title="{L_CHANGE_FONT_SIZE}">{L_CHANGE_FONT_SIZE}</a></li> + </ul> + <ul class="linklist leftside"> + <li class="icon-ucp"> + <xsl:choose> + <xsl:when test="$fileType='Sitemap'">{L_SITEMAP_OF} : <a href="{$sitemap_url}"><xsl:value-of select="$sitemap_title"/></a></xsl:when> + <xsl:otherwise>{L_SITEMAPINDEX}</xsl:otherwise> + </xsl:choose> + </li> + </ul> + <ul class="linklist rightside"> + <li class="icon-faq"><a href="{PHPBB_URL}faq.php" title="{L_FAQ_EXPLAIN}">{L_FAQ}</a></li> + <li class="icon-register"><a href="{PHPBB_URL}ucp.php?mode=register">{L_REGISTER}</a></li> + </ul> + <span class="corners-bottom"><span></span></span> + </div> + </div> + </div> + <a name="start_here"></a> + <div id="page-body"><br /> + <div class="clear"></div> + <div class="post bg3"> + <div class="inner"><span class="corners-top"><span></span></span> + <xsl:choose> + <xsl:when test="$fileType='Sitemap'"><h2><a href="{$sitemap_url}">{L_SITEMAP_OF} : <xsl:value-of select="$sitemap_title"/></a></h2><h4>{L_NUMBER_OF_URL} : <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/></h4></xsl:when> + <xsl:otherwise><h2>{L_SITEMAPINDEX}</h2><h4>{L_NUMBER_OF_SITEMAP} : <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/></h4></xsl:otherwise> + </xsl:choose> + <br /> + <span class="corners-bottom"><span></span></span> + </div> + </div><br /> + <xsl:choose> + <xsl:when test="$fileType='Sitemap'"><xsl:call-template name="sitemapTable"/></xsl:when> + <xsl:otherwise><xsl:call-template name="siteindexTable"/></xsl:otherwise> + </xsl:choose> + </div> +</div> +<div class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a> © 2000 - 2010 phpBB Group</div> +<!-- + We request you retain the full copyright notice below, as well as in all templates you may use, + including the link to www.phpbb-seo.com. + This not only gives respect to the large amount of time given freely by the developers + but also helps build interest, traffic and use of www.phpBB-SEO.com + If you cannot (for good reason) retain the full copyright we request you at least leave in place the + "Copyright phpBB SEO" line, with "phpBB SEO" linked to www.phpbb-seo.com. + If you refuse to include even this, then support and further development on our forums may be affected. + The phpBB SEO Team. +--> +<div class="copyright">{L_COPY}</div> +</body> +</html> +</xsl:template> + +<!-- siteindexTable template --> +<xsl:template name="siteindexTable"> + <div class="forumbg"> + <div class="inner"><span class="corners-top"><span></span></span> + <ul class="topiclist"> + <li class="header"> + <dl class="icon"> + <dt>{L_SITEMAP_URL}</dt> + <dd class="lastpost"><span>{L_LASTMOD_DATE}</span></dd> + </dl> + </li> + </ul> + <xsl:apply-templates select="sitemap:sitemapindex/sitemap:sitemap"></xsl:apply-templates> + <span class="corners-bottom"><span></span></span></div> + </div> +</xsl:template> +<!-- sitemapTable template --> +<xsl:template name="sitemapTable"> + <div class="forumbg"> + <div class="inner"><span class="corners-top"><span></span></span> + <ul class="topiclist"> + <li class="header"> + <dl class="icon"> + <dt>{L_LINK}</dt> + <dd class="topics">{L_PRIORITY}</dd> + <dd class="posts">{L_CHANGEFREQ}</dd> + <dd class="lastpost"><span>{L_LASTMOD_DATE}</span></dd> + </dl> + </li> + </ul> + <xsl:apply-templates select="sitemap:urlset/sitemap:url"></xsl:apply-templates> + <span class="corners-bottom"><span></span></span></div> + </div> +</xsl:template> +<!-- sitemap:url template --> +<xsl:template match="sitemap:url"> + <ul class="topiclist forums"> + <li class="row"> + <dl class="icon" style="background-image: url({T_IMAGE_PATH}forum_read.gif); background-repeat: no-repeat;"> + <dt style="overflow:hidden"> + <xsl:variable name="sitemapURL"><xsl:call-template name="http"><xsl:with-param name="input" select="sitemap:loc" /></xsl:call-template></xsl:variable> + <a href="{$sitemapURL}" class="topictitle"><span><xsl:call-template name="hreftitle"><xsl:with-param name="input" select="$sitemapURL" /></xsl:call-template></span></a> + </dt> + <dd class="topics"><span><xsl:value-of select="sitemap:priority"/></span></dd> + <dd class="posts"><span><xsl:value-of select="sitemap:changefreq"/></span></dd> + <dd class="lastpost"><span><xsl:value-of select="sitemap:lastmod" /></span></dd> + </dl> + </li> + </ul> +</xsl:template> +<!-- sitemap:sitemap template --> +<xsl:template match="sitemap:sitemap"> + <ul class="topiclist forums"> + <li class="row"> + <dl class="icon" style="background-image: url({T_IMAGE_PATH}topic_read.gif); background-repeat: no-repeat;"> + <dt style="overflow:hidden"> + <xsl:variable name="sitemapURL"><xsl:call-template name="http"><xsl:with-param name="input" select="sitemap:loc" /></xsl:call-template></xsl:variable> + <a href="{$sitemapURL}" class="forumtitle"><span><xsl:call-template name="hreftitle"><xsl:with-param name="input" select="$sitemapURL" /></xsl:call-template></span></a> + </dt> + <dd class="lastpost"><span><xsl:value-of select="sitemap:lastmod" /></span></dd> + </dl> + </li> + </ul> +</xsl:template> +<!-- http template to preserve SSL navigation when ssl is not forced (if so, the xml source only uses http) --> +<xsl:template name="http"> + <xsl:param name="input" /> + <xsl:choose> + <xsl:when test="contains($input, '{HTTP_PROTO_REQUEST}')"><xsl:value-of select="$input"/></xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="contains($input, 'http://')"><xsl:value-of select="concat('{HTTP_PROTO_REQUEST}', substring-after($input, 'http://'))"/></xsl:when> + <xsl:otherwise><xsl:value-of select="concat('{HTTP_PROTO_REQUEST}', substring-after($input, 'https://'))"/></xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> +</xsl:template> +<!-- title template : use nicer titles in href links ! --> +<xsl:template name="hreftitle"> + <xsl:param name="input" /> + <xsl:choose> + <xsl:when test="contains($input, '{ROOT_URL}')"><xsl:value-of select="substring-after($input, '{ROOT_URL}')"/></xsl:when> + <xsl:otherwise><xsl:value-of select="substring-after($input, '{HTTP_PROTO_REQUEST}')"/></xsl:otherwise> + </xsl:choose> +</xsl:template> +</xsl:stylesheet> diff --git a/phpBB/gym_sitemaps/style/gym_js.js b/phpBB/gym_sitemaps/style/gym_js.js new file mode 100644 index 0000000000..a8c6f0e53e --- /dev/null +++ b/phpBB/gym_sitemaps/style/gym_js.js @@ -0,0 +1,317 @@ +/* +* New function for handling multiple calls to window.onload and window.unload by pentapenguin ( phpBB3 ) +*/ +var onload_functions = new Array(); +var onunload_functions = new Array(); +window.onload = function() { + BrowserDetect.init(); + if (BrowserDetect.browser == 'Firefox') { + var elements = document.getElementsByTagName('span'); + for (var i = 0; i < elements.length; i++) { + var el = elements[i]; + if (el.className == 'html') { + el.innerHTML = el.firstChild.data; + } + } + } + for (i = 0; i <= onload_functions.length; i++) { + eval(onload_functions[i]); + } +} +window.onunload = function() { + for (i = 0; i <= onunload_functions.length; i++) { + eval(onunload_functions[i]); + } +} +// phpBB3 bbcodes +function selectCode(a) { + // Get ID of code block + var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0]; + if (window.getSelection) { // Not IE + var s = window.getSelection(); + if (s.setBaseAndExtent) { // Safari + s.setBaseAndExtent(e, 0, e, e.innerText.length - 1); + } else { // Firefox and Opera + var r = document.createRange(); + r.selectNodeContents(e); + s.removeAllRanges(); + s.addRange(r); + } + } else if (document.getSelection) { // Some older browsers + var s = document.getSelection(); + var r = document.createRange(); + r.selectNodeContents(e); + s.removeAllRanges(); + s.addRange(r); + } else if (document.selection) { // IE + var r = document.body.createTextRange(); + r.moveToElementText(e); + r.select(); + } +} +// phpBB3 styleswitcher.js +function fontsizeup() +{ + var active = getActiveStyleSheet(); + + switch (active) + { + case 'A--': + setActiveStyleSheet('A-'); + break; + + case 'A-': + setActiveStyleSheet('A'); + break; + + case 'A': + setActiveStyleSheet('A+'); + break; + + case 'A+': + setActiveStyleSheet('A++'); + break; + + case 'A++': + setActiveStyleSheet('A'); + break; + + default: + setActiveStyleSheet('A'); + break; + } +} + +function fontsizedown() +{ + active = getActiveStyleSheet(); + + switch (active) + { + case 'A++' : + setActiveStyleSheet('A+'); + break; + + case 'A+' : + setActiveStyleSheet('A'); + break; + + case 'A' : + setActiveStyleSheet('A-'); + break; + + case 'A-' : + setActiveStyleSheet('A--'); + break; + + case 'A--' : + break; + + default : + setActiveStyleSheet('A--'); + break; + } +} + +function setActiveStyleSheet(title) +{ + var i, a, main; + + for (i = 0; (a = document.getElementsByTagName('link')[i]); i++) + { + if (a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title')) + { + a.disabled = true; + if (a.getAttribute('title') == title) + { + a.disabled = false; + } + } + } +} + +function getActiveStyleSheet() +{ + var i, a; + + for (i = 0; (a = document.getElementsByTagName('link')[i]); i++) + { + if (a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title') && !a.disabled) + { + return a.getAttribute('title'); + } + } + + return null; +} + +function getPreferredStyleSheet() +{ + return ('A-'); +} + +function createCookie(name, value, days) +{ + if (days) + { + var date = new Date(); + date.setTime(date.getTime() + (days*24*60*60*1000)); + var expires = '; expires=' + date.toGMTString(); + } + else + { + expires = ''; + } + + document.cookie = name + '=' + value + expires + '; path=/'; +} + +function readCookie(name) +{ + var nameEQ = name + '='; + var ca = document.cookie.split(';'); + + for (var i = 0; i < ca.length; i++) + { + var c = ca[i]; + + while (c.charAt(0) == ' ') + { + c = c.substring(1, c.length); + } + + if (c.indexOf(nameEQ) == 0) + { + return c.substring(nameEQ.length, c.length); + } + } + + return null; +} + +function load_cookie() +{ + var cookie = readCookie('style_cookie'); + var title = cookie ? cookie : getPreferredStyleSheet(); + setActiveStyleSheet(title); +} + +function unload_cookie() +{ + var title = getActiveStyleSheet(); + createCookie('style_cookie', title, 365); +} +// Browser detect http://www.quirksmode.org/js/detect.html +var BrowserDetect = { + init: function () { + this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; + this.version = this.searchVersion(navigator.userAgent) + || this.searchVersion(navigator.appVersion) + || "an unknown version"; + this.OS = this.searchString(this.dataOS) || "an unknown OS"; + }, + searchString: function (data) { + for (var i=0;i<data.length;i++) { + var dataString = data[i].string; + var dataProp = data[i].prop; + this.versionSearchString = data[i].versionSearch || data[i].identity; + if (dataString) { + if (dataString.indexOf(data[i].subString) != -1) + return data[i].identity; + } + else if (dataProp) + return data[i].identity; + } + }, + searchVersion: function (dataString) { + var index = dataString.indexOf(this.versionSearchString); + if (index == -1) return; + return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); + }, + dataBrowser: [ + { string: navigator.userAgent, + subString: "OmniWeb", + versionSearch: "OmniWeb/", + identity: "OmniWeb" + }, + { + string: navigator.vendor, + subString: "Apple", + identity: "Safari" + }, + { + prop: window.opera, + identity: "Opera" + }, + { + string: navigator.vendor, + subString: "iCab", + identity: "iCab" + }, + { + string: navigator.vendor, + subString: "KDE", + identity: "Konqueror" + }, + { + string: navigator.userAgent, + subString: "Firefox", + identity: "Firefox" + }, + { + string: navigator.vendor, + subString: "Camino", + identity: "Camino" + }, + { // for newer Netscapes (6+) + string: navigator.userAgent, + subString: "Netscape", + identity: "Netscape" + }, + { + string: navigator.userAgent, + subString: "MSIE", + identity: "Explorer", + versionSearch: "MSIE" + }, + { + string: navigator.userAgent, + subString: "Gecko", + identity: "Mozilla", + versionSearch: "rv" + }, + { // for older Netscapes (4-) + string: navigator.userAgent, + subString: "Mozilla", + identity: "Netscape", + versionSearch: "Mozilla" + } + ], + dataOS : [ + { + string: navigator.platform, + subString: "Win", + identity: "Windows" + }, + { + string: navigator.platform, + subString: "Mac", + identity: "Mac" + }, + { + string: navigator.platform, + subString: "Linux", + identity: "Linux" + } + ] + +}; +// Browser detect http://www.quirksmode.org/js/detect.html +onload_functions.push('load_cookie()'); +onunload_functions.push('unload_cookie()'); + + +var cookie = readCookie("style"); +var title = cookie ? cookie : getPreferredStyleSheet(); +setActiveStyleSheet(title); + diff --git a/phpBB/gym_sitemaps/style/gym_rss.css b/phpBB/gym_sitemaps/style/gym_rss.css new file mode 100644 index 0000000000..4b64128e83 --- /dev/null +++ b/phpBB/gym_sitemaps/style/gym_rss.css @@ -0,0 +1,1547 @@ +/* phpBB 3.0 Style Sheet
+ --------------------------------------------------------------
+ Style name: proSilver
+ Based on style: proSilver (this is the default phpBB 3 style)
+ Original author: subBlue ( http://www.subBlue.com/ )
+ Modified by: dcz phpBB SEO ( www.phpbb-seo.com )
+
+ Copyright 2006 phpBB Group ( http://www.phpbb.com/ )
+ --------------------------------------------------------------
+*/
+
+/* General proSilver Markup Styles
+---------------------------------------- */
+
+* {/* Reset browsers default margin, padding and font sizes */
+ margin: 0;
+ padding: 0;
+}
+html { font-size: 100%;
+ /* Always show a scrollbar for short pages - stops the jump when the scrollbar appears. non-IE browsers */
+ height: 100%;
+ margin-bottom: 1px;
+}
+body { /* Text-Sizing with ems: http://www.clagnut.com/blog/348/ */
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+ color: #828282;
+ background-color: #FFFFFF;
+ /*font-size: 62.5%; This sets the default font size to be equivalent to 10px */
+ font-size: 10px;
+ margin: 10px;
+ padding: 12px 0;
+}
+h1 { /* Forum name */
+ font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
+ margin-right: 200px;
+ color: #FFFFFF;
+ margin-top: 15px;
+ font-weight: bold;
+ font-size: 2em;
+}
+h2 { /* Forum header titles */
+ font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
+ font-weight: normal;
+ color: #3f3f3f;
+ font-size: 2em;
+ margin: 0.8em 0 0.2em 0;
+}
+h2.solo { margin-bottom: 1em; }
+
+h3 { /* Sub-headers (also used as post headers, but defined later) */
+ font-family: Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ text-transform: uppercase;
+ border-bottom: 1px solid #CCCCCC;
+ margin-bottom: 3px;
+ padding-bottom: 2px;
+ font-size: 1.05em;
+ color: #989898;
+ margin-top: 20px;
+}
+h4 { /* Forum and topic list titles */
+ font-family: "Trebuchet MS", Verdana, Helvetica, Arial, Sans-serif;
+ font-size: 1.3em;
+}
+h5 { font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif;
+ float: right;
+ font-weight:bold;
+ font-size:16px;
+ color:#707070;
+ margin-top:1px;
+}
+p { line-height: 1.3em;
+ font-size: 1.1em;
+ margin-bottom: 1.5em;
+}
+
+img {
+ border-width: 0;
+}
+
+hr { /* Also see tweaks.css */
+ border: 0 none #FFFFFF;
+ border-top: 1px solid #CCCCCC;
+ height: 1px;
+ margin: 5px 0;
+ display: block;
+ clear: both;
+}
+hr.dashed { border-top: 1px dashed #CCCCCC;
+ margin: 10px 0;
+}
+hr.divider { display: none;}
+p.right { text-align: right;}
+
+/* Main blocks
+---------------------------------------- */
+#simple-wrap { padding: 6px 10px; }
+#page-body { margin: 4px 0;
+ clear: both;
+}
+#page-footer { clear: both;
+}
+#page-footer h3 { margin-top: 20px;
+}
+#logo { float: left;
+ width: auto;
+ padding: 10px 13px 0 10px;
+}
+a#logo:hover { text-decoration: none;}
+/* Search box
+--------------------------------------------- */
+#search-box { color: #FFFFFF;
+ position: relative;
+ margin-top: 30px;
+ margin-right: 5px;
+ display: block;
+ float: right;
+ text-align: right;
+ white-space: nowrap; /* For Opera */
+}
+#search-box #keywords { width: 95px;
+ background-color: #FFF;
+}
+#search-box input { border: 1px solid #b0b0b0;
+}
+/* .button1 style defined later, just a few tweaks for the search button version */
+#search-box input.button1 { padding: 1px 5px;}
+#search-box li { text-align: right;
+ margin-top: 4px;
+}
+#search-box img {
+ vertical-align: middle;
+ margin-right: 3px;
+}
+/* Site description and logo */
+#site-description { float: left;
+ width: 70%;
+}
+
+#site-description h1 { margin-right: 0;}
+
+/* Round cornered boxes and backgrounds
+---------------------------------------- */
+.headerbar { background: #ebebeb none repeat-x 0 0;
+ color: #FFFFFF;
+ margin-bottom: 4px;
+ padding: 0 5px;
+}
+.navbar { background-color: #ebebeb;
+ padding: 0 10px;
+}
+.forabg { background: #b1b1b1 none repeat-x 0 0;
+ margin-bottom: 4px;
+ padding: 0 5px;
+ clear: both;
+}
+.forumbg { background: #ebebeb none repeat-x 0 0;
+ margin-bottom: 4px;
+ padding: 0 5px;
+ clear: both;
+}
+.panel { margin-bottom: 4px;
+ padding: 0 10px;
+ background-color: #f3f3f3;
+ color: #3f3f3f;
+}
+.post { padding: 0 10px;
+ margin-bottom: 4px;
+ background-repeat: no-repeat;
+ background-position: 100% 0;
+}
+.post:target .content { color: #000000;}
+.post:target h3 a { color: #000000;}
+.bg1 { background-color: #f7f7f7;}
+.bg2 { background-color: #f2f2f2; }
+.bg3 { background-color: #ebebeb; }
+.rowbg { margin: 5px 5px 2px 5px;}
+.ucprowbg { background-color: #e2e2e2; }
+.fieldsbg { /*border: 1px #DBDEE2 solid;*/
+ background-color: #eaeaea;
+}
+span.corners-top, span.corners-bottom, span.corners-top span, span.corners-bottom span {
+ font-size: 1px;
+ line-height: 1px;
+ display: block;
+ height: 5px;
+ background-repeat: no-repeat;
+}
+span.corners-top { background-image: none;
+ background-position: 0 0;
+ margin: 0 -5px;
+}
+span.corners-top span { background-image: none;
+ background-position: 100% 0;
+}
+span.corners-bottom { background-image: none;
+ background-position: 0 100%;
+ margin: 0 -5px;
+ clear: both;
+}
+span.corners-bottom span { background-image: none;;
+ background-position: 100% 100%;
+}
+.headbg span.corners-bottom { margin-bottom: -1px; }
+.post span.corners-top, .post span.corners-bottom, .panel span.corners-top, .panel span.corners-bottom, .navbar span.corners-top, .navbar span.corners-bottom { margin: 0 -10px; }
+.rules span.corners-top { margin: 0 -10px 5px -10px;}
+.rules span.corners-bottom { margin: 5px -10px 0 -10px;}
+/* Horizontal lists
+----------------------------------------*/
+ul.linklist { display: block;
+ margin: 0;
+}
+ul.linklist li { display: block;
+ list-style-type: none;
+ float: left;
+ width: auto;
+ margin-right: 5px;
+ font-size: 1.1em;
+ line-height: 2.2em;
+}
+ul.linklist li.rightside, p.rightside { float: right;
+ margin-right: 0;
+ margin-left: 5px;
+ text-align: right;
+}
+ul.navlinks { padding-bottom: 1px;
+ margin-bottom: 1px;
+ border-bottom: 1px solid #FFFFFF;
+ font-weight: bold;
+}
+ul.leftside { float: left;
+ margin-left: 0;
+ margin-right: 5px;
+ text-align: left;
+}
+ul.rightside { float: right;
+ margin-left: 5px;
+ margin-right: -5px;
+ text-align: right;
+}
+/* Misc layout styles
+---------------------------------------- */
+dl.details {
+ /*font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;*/
+ font-size: 1.1em;
+}
+dl.details dt {
+ float: left;
+ clear: left;
+ width: 15em;
+ text-align: right;
+ color: #000000;
+ display: block;
+}
+dl.details dd {
+ margin-left: 0;
+ padding-left: 5px;
+ margin-bottom: 5px;
+ color: #828282;
+ float: left;
+}
+/* Miscellaneous styles
+---------------------------------------- */
+.copyright { padding: 5px;
+ text-align: center;
+ color: #555555;
+}
+div.rules {
+ background-color: #ececec;
+ color: #bcbcbc;
+ padding: 0 10px;
+ margin: 10px 0;
+ font-size: 1.1em;
+}
+div.rules ul { margin-left: 20px; }
+p.rules { background-color: #ececec;
+ background-image: none;
+ padding: 5px;
+}
+p.rules img { vertical-align: middle; }
+p.rules a { vertical-align: middle;
+ clear: both;
+}
+#top { position: absolute;
+ top: -20px;
+}
+/* proSilver Link Styles
+---------------------------------------- */
+a:link { color: #898989; text-decoration: none; }
+a:visited { color: #898989; text-decoration: none; }
+a:hover { color: #d3d3d3; text-decoration: underline; }
+a:active { color: #d2d2d2; text-decoration: none; }
+/* Links on gradient backgrounds */
+#search-box a:link, .navbg a:link, .forumbg .header a:link, .forabg .header a:link, th a:link {
+ color: #FFFFFF;
+ text-decoration: none;
+}
+#search-box a:visited, .navbg a:visited, .forumbg .header a:visited, .forabg .header a:visited, th a:visited {
+ color: #FFFFFF;
+ text-decoration: none;
+}
+#search-box a:hover, .navbg a:hover, .forumbg .header a:hover, .forabg .header a:hover, th a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+#search-box a:active, .navbg a:active, .forumbg .header a:active, .forabg .header a:active, th a:active {
+ color: #ffffff;
+ text-decoration: none;
+}
+/* Links for forum/topic lists */
+a.forumtitle { font-family: "Trebuchet MS", Helvetica, Arial, Sans-serif;
+ font-size: 1.2em;
+ font-weight: bold;
+ color: #898989;
+ text-decoration: none;
+}
+/* a.forumtitle:visited { color: #898989; } */
+a.forumtitle:hover { color: #bcbcbc;
+ text-decoration: underline;
+}
+a.forumtitle:active { color: #898989; }
+a.topictitle { font-family: "Trebuchet MS", Helvetica, Arial, Sans-serif;
+ font-size: 1.2em;
+ font-weight: bold;
+ color: #898989;
+ text-decoration: none;
+}
+/* a.topictitle:visited { color: #d2d2d2; } */
+a.topictitle:hover { color: #bcbcbc;
+ text-decoration: underline;
+}
+a.topictitle:active {
+ color: #898989;
+}
+/* Post body links */
+.postlink { text-decoration: none;
+ color: #d2d2d2;
+ border-bottom: 1px solid #d2d2d2;
+ padding-bottom: 0;
+}
+.postlink:visited { color: #bdbdbd;
+ border-bottom-style: dotted;
+ border-bottom-color: #666666;
+}
+.postlink:active { color: #d2d2d2; }
+.postlink:hover { background-color: #f6f6f6;
+ text-decoration: none;
+ color: #404040;
+}
+.signature a, .signature a:visited, .signature a:active, .signature a:hover {
+ border: none;
+ text-decoration: underline;
+ background-color: transparent;
+}
+/* Profile links */
+.postprofile a:link, .postprofile a:active, .postprofile a:visited, .postprofile dt.author a { font-weight: bold;
+ color: #898989;
+ text-decoration: none;
+}
+.postprofile a:hover, .postprofile dt.author a:hover { text-decoration: underline;
+ color: #d3d3d3;
+}
+/* Profile searchresults */
+.search .postprofile a { color: #898989;
+ text-decoration: none;
+ font-weight: normal;
+}
+.search .postprofile a:hover { color: #d3d3d3;
+ text-decoration: underline;
+}
+/* Back to top of page */
+.back2top { clear: both;
+ height: 11px;
+ text-align: right;
+}
+a.top { background: none no-repeat top left;
+ text-decoration: none;
+ width: 11px;
+ height: 11px;
+ display: block;
+ float: right;
+ overflow: hidden;
+ letter-spacing: 1000px;
+ text-indent: 11px;
+}
+a.top2 {
+ background: none no-repeat 0 50%;
+ text-decoration: none;
+ padding-left: 15px;
+}
+/* Arrow links */
+a.up { background: none no-repeat left center; }
+a.down { background: none no-repeat right center; }
+a.left { background: none no-repeat 3px 60%; }
+a.right { background: none no-repeat 95% 60%; }
+a.up, a.up:link, a.up:active, a.up:visited { padding-left: 10px;
+ text-decoration: none;
+ border-bottom-width: 0;
+}
+a.up:hover { background-position: left top;
+ background-color: transparent;
+}
+a.down, a.down:link, a.down:active, a.down:visited { padding-right: 10px; }
+a.down:hover { background-position: right bottom;
+ text-decoration: none;
+}
+a.left, a.left:active, a.left:visited { padding-left: 12px; }
+a.left:hover { color: #d2d2d2;
+ text-decoration: none;
+ background-position: 0 60%;
+}
+a.right, a.right:active, a.right:visited { padding-right: 12px;}
+a.right:hover { color: #d2d2d2;
+ text-decoration: none;
+ background-position: 100% 60%;
+}
+/* proSilver Content Styles
+---------------------------------------- */
+ul.topiclist { display: block;
+ list-style-type: none;
+ margin: 0;
+}
+ul.forums { background: #f9f9f9 none repeat-x 0 0;
+}
+ul.topiclist li { display: block;
+ list-style-type: none;
+ color: #777777;
+ margin: 0;
+}
+ul.topiclist dl { position: relative;}
+ul.topiclist li.row dl {padding: 2px 0;}
+ul.topiclist dt {display: block;
+ float: left;
+ width: 50%;
+ font-size: 1.1em;
+ padding-left: 5px;
+ padding-right: 5px;
+}
+ul.topiclist dd { display: block;
+ float: left;
+ border-left: 1px solid #FFFFFF;
+ padding: 4px 0;
+}
+ul.topiclist dfn { /* Labels for post/view counts */
+ display: none;
+}
+
+ul.topiclist li.row dt a.subforum { background-image: none;
+ background-position: 0 50%;
+ background-repeat: no-repeat;
+ position: relative;
+ white-space: nowrap;
+ padding: 0 0 0 12px;
+}
+.forum-image { float: left;
+ padding-top: 5px;
+ margin-right: 5px;
+}
+li.row { border-top: 1px solid #FFFFFF;
+ border-bottom: 1px solid #8f8f8f;
+}
+li.row strong { font-weight: normal;
+ color: #000000;
+}
+li.row:hover { background-color: #f6f6f6;
+}
+li.row:hover dd { border-left-color: #CCCCCC;
+}
+li.header dt, li.header dd { line-height: 1em;
+ border-left-width: 0;
+ margin: 2px 0 4px 0;
+ color: #FFFFFF;
+ padding-top: 2px;
+ padding-bottom: 2px;
+ font-size: 1em;
+ font-family: Arial, Helvetica, sans-serif;
+ text-transform: uppercase;
+}
+li.header dt { font-weight: bold;}
+li.header dd { margin-left: 1px;}
+li.header dl.icon { min-height: 0;}
+li.header dl.icon dt { /* Tweak for headers alignment when folder icon used */
+ padding-left: 0;
+ padding-right: 44px;
+}
+/* Forum list column styles */
+dl.icon { min-height: 35px;
+ background-position: 10px 50%; /* Position of folder icon */
+ background-repeat: no-repeat;
+}
+dl.icon dt { padding-left: 45px; /* Space for folder icon */
+ background-repeat: no-repeat;
+ background-position: 5px 95%; /* Position of topic icon */
+}
+dd.posts, dd.topics, dd.views { width: 8%;
+ text-align: center;
+ line-height: 2.2em;
+ font-size: 1.2em;
+}
+dd.lastpost { width: 25%;
+ font-size: 1.1em;
+}
+dd.redirect { font-size: 1.1em;
+ line-height: 2.5em;
+}
+dd.moderation { font-size: 1.1em; }
+dd.lastpost span, ul.topiclist dd.searchby span, ul.topiclist dd.info span, ul.topiclist dd.time span, dd.redirect span, dd.moderation span { display: block;
+ padding-left: 5px;
+}
+dd.time { width: auto;
+ line-height: 200%;
+ font-size: 1.1em;
+}
+dd.extra { width: 65px;
+ line-height: 200%;
+ text-align: center;
+ font-size: 1.1em;
+}
+dd.mark { float: right !important;
+ width: 9%;
+ text-align: center;
+ line-height: 200%;
+ font-size: 1.2em;
+}
+dd.info { width: 30%; }
+dd.option { width: 15%;
+ line-height: 200%;
+ text-align: center;
+ font-size: 1.1em;
+}
+dd.searchby { width: 47%;
+ font-size: 1.1em;
+ line-height: 1em;
+}
+ul.topiclist dd.searchextra { margin-left: 5px;
+ padding: 0.2em 0;
+ font-size: 1.1em;
+ color: #333333;
+ border-left: none;
+ clear: both;
+ width: 98%;
+ overflow: hidden;
+}
+/* Container for post/reply buttons and pagination */
+.topic-actions { margin-bottom: 3px;
+ font-size: 1.1em;
+ height: 28px;
+ min-height: 28px;
+}
+div[class].topic-actions { height: auto; }
+/* Post body styles
+----------------------------------------*/
+.postbody { padding: 0;
+ line-height: 1.48em;
+ color: #333333;
+ width: 76%;
+ float: left;
+ clear: both;
+}
+.postbody .ignore { font-size: 1.1em; }
+.postbody h3.first { /* The first post on the page uses this */
+ font-size: 1.7em;
+}
+.postbody h3 { /* Postbody requires a different h3 format - so change it here */
+ font-size: 1.5em;
+ padding: 2px 0 0 0;
+ margin: 0 0 0.3em 0 !important;
+ text-transform: none;
+ border: none;
+ font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
+ line-height: 125%;
+}
+.postbody h3 img { /* Also see tweaks.css */
+ vertical-align: bottom;
+}
+.postbody .content { font-size: 1.3em; }
+.search .postbody { width: 68% }
+/* Content container styles
+----------------------------------------*/
+.content { min-height: 3em;
+ overflow: hidden;
+ line-height: 1.4em;
+ font-family: "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
+ font-size: 1em;
+ color: #333333;
+}
+.content h2, .panel h2 { font-weight: normal;
+ color: #989898;
+ border-bottom: 1px solid #CCCCCC;
+ font-size: 1.6em;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ padding-bottom: 0.5em;
+}
+.panel h3 { margin: 0.5em 0; }
+.panel p { font-size: 1.2em;
+ margin-bottom: 1em;
+ line-height: 1.4em;
+}
+.content p { font-family: "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
+ font-size: 1.2em;
+ margin-bottom: 1em;
+ line-height: 1.4em;
+}
+dl.faq { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
+ font-size: 1.1em;
+ margin-top: 1em;
+ margin-bottom: 2em;
+ line-height: 1.4em;
+}
+dl.faq dt { font-weight: bold;
+ color: #333333;
+}
+.content dl.faq { font-size: 1.2em;
+ margin-bottom: 0.5em;
+}
+.content li { list-style-type: inherit; }
+.content ul, .content ol { margin-bottom: 1em;
+ margin-left: 3em;
+}
+.announce, .unreadpost {
+ /* Highlight the announcements & unread posts box */
+ border-left-color: #BCBCBC;
+ border-right-color: #BCBCBC;
+}
+/* Post author */
+p.author { margin: 0 15em 0.6em 0;
+ padding: 0 0 5px 0;
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+ font-size: 1em;
+ line-height: 1.2em;
+}
+/* Post signature */
+.signature { margin-top: 1.5em;
+ padding-top: 0.2em;
+ font-size: 1.1em;
+ border-top: 1px solid #CCCCCC;
+ clear: left;
+ line-height: 140%;
+ overflow: hidden;
+ width: 100%;
+}
+dd .signature { margin: 0;
+ padding: 0;
+ clear: none;
+ border: none;
+}
+/* Post noticies */
+.notice { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
+ width: auto;
+ margin-top: 1.5em;
+ padding-top: 0.2em;
+ font-size: 1em;
+ border-top: 1px dashed #CCCCCC;
+ clear: left;
+ line-height: 130%;
+}
+/* Jump to post link for now */
+ul.searchresults {
+ list-style: none;
+ text-align: right;
+ clear: both;
+}
+/* BB Code styles
+----------------------------------------*/
+/* Quote block */
+blockquote {
+ background: #ebebeb none 6px 8px no-repeat;
+ border: 1px solid #dbdbdb;
+ font-size: 0.95em;
+ margin: 0.5em 1px 0 25px;
+ overflow: hidden;
+ padding: 5px;
+}
+blockquote blockquote { /* Nested quotes */
+ background-color: #bababa;
+ font-size: 1em;
+ margin: 0.5em 1px 0 15px;
+}
+blockquote blockquote blockquote { /* Nested quotes */
+ background-color: #e4e4e4;
+}
+blockquote cite { /* Username/source of quoter */
+ font-style: normal;
+ font-weight: bold;
+ margin-left: 20px;
+ display: block;
+ font-size: 0.9em;
+}
+blockquote cite cite { font-size: 1em; }
+blockquote.uncited { padding-top: 25px; }
+/* Code block */
+dl.codebox {
+ padding: 3px;
+ background-color: #FFFFFF;
+ border: 1px solid #d8d8d8;
+ font-size: 1em;
+}
+dl.codebox dt { text-transform: uppercase;
+ border-bottom: 1px solid #CCCCCC;
+ margin-bottom: 3px;
+ font-size: 0.8em;
+ font-weight: bold;
+ display: block;
+}
+blockquote dl.codebox { margin-left: 0; }
+dl.codebox code { /* Also see tweaks.css */
+ overflow: auto;
+ display: block;
+ height: auto;
+ max-height: 200px;
+ white-space: normal;
+ padding-top: 5px;
+ font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono;
+ line-height: 1.3em;
+ color: #8b8b8b;
+ margin: 2px 0;
+}
+.syntaxbg { color: #FFFFFF; }
+.syntaxcomment { color: #000000; }
+.syntaxdefault { color: #bcbcbc; }
+.syntaxhtml { color: #000000; }
+.syntaxkeyword { color: #585858; }
+.syntaxstring { color: #a7a7a7; }
+/* Attachments
+----------------------------------------*/
+.attachbox { float: left;
+ width: auto;
+ margin: 5px 5px 5px 0;
+ padding: 6px;
+ background-color: #FFFFFF;
+ border: 1px dashed #d8d8d8;
+ clear: left;
+}
+.pm-message .attachbox { background-color: #f3f3f3; }
+.attachbox dt { font-family: Arial, Helvetica, sans-serif;
+ text-transform: uppercase;
+}
+.attachbox dd { margin-top: 4px;
+ padding-top: 4px;
+ clear: left;
+ border-top: 1px solid #d8d8d8;
+}
+.attachbox dd dd { border: none; }
+.attachbox p { line-height: 110%;
+ color: #666666;
+ font-weight: normal;
+ clear: left;
+}
+.attachbox p.stats { line-height: 110%;
+ color: #666666;
+ font-weight: normal;
+ clear: left;
+}
+.attach-image { margin: 3px 0;
+ width: 100%;
+ max-height: 350px;
+ overflow: auto;
+}
+.attach-image img { border: 1px solid #999999;
+/* cursor: move; */
+ cursor: default;
+}
+/* Inline image thumbnails */
+div.inline-attachment dl.thumbnail, div.inline-attachment dl.file { display: block;
+ margin-bottom: 4px;
+}
+div.inline-attachment p { font-size: 100%; }
+dl.file { font-family: Verdana, Arial, Helvetica, sans-serif;
+ display: block;
+}
+dl.file dt { text-transform: none;
+ margin: 0;
+ padding: 0;
+ font-weight: bold;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+}
+dl.file dd { color: #666666;
+ margin: 0;
+ padding: 0;
+}
+dl.thumbnail img { padding: 3px;
+ border: 1px solid #666666;
+ display: block;
+ background-color: #FFF;
+}
+dl.thumbnail dd { color: #666666;
+ font-style: italic;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+}
+.attachbox dl.thumbnail dd { font-size: 100%; }
+dl.thumbnail dt a:hover { background-color: #EEEEEE;}
+dl.thumbnail dt a:hover img { border: 1px solid #d2d2d2; }
+/* Post poll styles
+----------------------------------------*/
+fieldset.polls { font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; }
+fieldset.polls dl { margin-top: 5px;
+ border-top: 1px solid #e2e2e2;
+ padding: 5px 0 0 0;
+ line-height: 120%;
+ color: #666666;
+}
+fieldset.polls dl.voted { font-weight: bold;
+ color: #000000;
+}
+fieldset.polls dt { text-align: left;
+ float: left;
+ display: block;
+ width: 30%;
+ border-right: none;
+ padding: 0;
+ margin: 0;
+ font-size: 1.1em;
+}
+fieldset.polls dd { float: left;
+ width: 10%;
+ border-left: none;
+ padding: 0 5px;
+ margin-left: 0;
+ font-size: 1.1em;
+}
+fieldset.polls dd.resultbar { width: 50%;}
+fieldset.polls dd input { margin: 2px 0; }
+fieldset.polls dd div { text-align: right;
+ font-family: Arial, Helvetica, sans-serif;
+ color: #FFFFFF;
+ font-weight: bold;
+ padding: 0 2px;
+ overflow: visible;
+ min-width: 2%;
+}
+.pollbar1 { background-color: #aaaaaa;
+ border-bottom: 1px solid #747474;
+ border-right: 1px solid #747474;
+}
+.pollbar2 { background-color: #bebebe;
+ border-bottom: 1px solid #8c8c8c;
+ border-right: 1px solid #8c8c8c;
+}
+.pollbar3 { background-color: #D1D1D1;
+ border-bottom: 1px solid #aaaaaa;
+ border-right: 1px solid #aaaaaa;
+}
+.pollbar4 { background-color: #e4e4e4;
+ border-bottom: 1px solid #bebebe;
+ border-right: 1px solid #bebebe;
+}
+.pollbar5 { background-color: #f8f8f8;
+ border-bottom: 1px solid #D1D1D1;
+ border-right: 1px solid #D1D1D1;
+}
+/* Poster profile block
+----------------------------------------*/
+.postprofile { /* Also see tweaks.css */
+ margin: 5px 0 10px 0;
+ min-height: 80px;
+ color: #666666;
+ border-left: 1px solid #FFFFFF;
+ width: 22%;
+ float: right;
+ display: inline;
+}
+.pm .postprofile { border-left: 1px solid #DDDDDD; }
+.postprofile dd, .postprofile dt { line-height: 1.2em;
+ margin-left: 8px;
+}
+.postprofile strong {font-weight: normal;
+ color: #000000;
+}
+.avatar { border: none;
+ margin-bottom: 3px;
+}
+.online { background-image: none;
+ background-position: 100% 0;
+ background-repeat: no-repeat;
+}
+/* Poster profile used by search*/
+.search .postprofile { width: 30%;}
+/* pm list in compose message if mass pm is enabled */
+dl.pmlist dt { width: 60% !important;}
+dl.pmlist dt textarea { width: 95%;}
+dl.pmlist dd { margin-left: 61% !important;
+ margin-bottom: 2px;
+}
+/* proSilver Button Styles
+---------------------------------------- */
+/* Rollover buttons
+ Based on: http://wellstyled.com/css-nopreload-rollovers.html
+----------------------------------------*/
+.buttons { float: left;
+ width: auto;
+ height: auto;
+}
+/* Rollover state */
+.buttons div { float: left;
+ margin: 0 5px 0 0;
+ background-position: 0 100%;
+}
+/* Rolloff state */
+.buttons div a { display: block;
+ width: 100%;
+ height: 100%;
+ background-position: 0 0;
+}
+/* Hide <a> text and hide off-state image when rolling over (prevents flicker in IE) */
+.buttons div span { display: none; }
+.buttons div a:hover { background-image: none; }
+/* Big button images */
+.reply-icon, .reply-icon a { background: transparent none 0 0 no-repeat; }
+.post-icon, .post-icon a { background: transparent none 0 0 no-repeat; }
+.locked-icon, .locked-icon a { background: transparent none 0 0 no-repeat; }
+.pmreply-icon, .pmreply-icon a { background: none 0 0 no-repeat; }
+.newpm-icon, .newpm-icon a { background: none 0 0 no-repeat; }
+.forwardpm-icon, .forwardpm-icon a { background: none 0 0 no-repeat; }
+/* Set big button dimensions */
+.buttons div.reply-icon { width: 96px; height: 25px; }
+.buttons div.post-icon { width: 96px; height: 25px; }
+.buttons div.locked-icon { width: 96px; height: 25px; }
+.buttons div.pmreply-icon { width: 96px; height: 25px; }
+.buttons div.newpm-icon { width: 96px; height: 25px; }
+.buttons div.forwardpm-icon { width: 110px; height: 25px; }
+/* Sub-header (navigation bar)
+--------------------------------------------- */
+a.print, a.sendemail, a.fontsize { display: block;
+ overflow: hidden;
+ height: 18px;
+ text-indent: -5000px;
+ text-align: left;
+ background-repeat: no-repeat;
+}
+a.fontsize { background-image: none;
+ background-position: 0 -1px;
+ width: 29px;
+}
+a.fontsize:hover { background-position: 0 -20px;
+ text-decoration: none;
+}
+/* Icon images
+---------------------------------------- */
+.sitehome, .icon-faq, .icon-members, .icon-home, .icon-ucp, .icon-register, .icon-logout,
+.icon-bookmark, .icon-bump, .icon-subscribe, .icon-unsubscribe, .icon-pages, .icon-search {
+ background-position: 0 50%;
+ background-repeat: no-repeat;
+ background-image: none;
+ padding: 1px 0 0 17px;
+}
+/* Poster profile icons
+----------------------------------------*/
+ul.profile-icons { padding-top: 10px;
+ list-style: none;
+}
+/* Rollover state */
+ul.profile-icons li { float: left;
+ margin: 0 6px 3px 0;
+ background-position: 0 100%;
+}
+/* Rolloff state */
+ul.profile-icons li a { display: block;
+ width: 100%;
+ height: 100%;
+ background-position: 0 0;
+}
+/* Hide <a> text and hide off-state image when rolling over (prevents flicker in IE) */
+ul.profile-icons li span { display:none; }
+ul.profile-icons li a:hover { background: none; }
+/* Positioning of moderator icons */
+.postbody ul.profile-icons { float: right;
+ width: auto;
+ padding: 0;
+}
+.postbody ul.profile-icons li { margin: 0 3px;}
+/* Profile & navigation icons */
+.email-icon, .email-icon a { background: none top left no-repeat; }
+.aim-icon, .aim-icon a { background: none top left no-repeat; }
+.yahoo-icon, .yahoo-icon a { background: none top left no-repeat; }
+.web-icon, .web-icon a { background: none top left no-repeat; }
+.msnm-icon, .msnm-icon a { background: none top left no-repeat; }
+.icq-icon, .icq-icon a { background: none top left no-repeat; }
+.jabber-icon, .jabber-icon a { background: none top left no-repeat; }
+.pm-icon, .pm-icon a { background: none top left no-repeat; }
+.quote-icon, .quote-icon a { background: none top left no-repeat; }
+/* Moderator icons */
+.report-icon, .report-icon a { background: none top left no-repeat; }
+.warn-icon, .warn-icon a { background: none top left no-repeat; }
+.edit-icon, .edit-icon a { background: none top left no-repeat; }
+.delete-icon, .delete-icon a { background: none top left no-repeat; }
+.info-icon, .info-icon a { background: none top left no-repeat; }
+/* Set profile icon dimensions */
+ul.profile-icons li.email-icon { width: 20px; height: 20px; }
+ul.profile-icons li.aim-icon { width: 20px; height: 20px; }
+ul.profile-icons li.yahoo-icon { width: 20px; height: 20px; }
+ul.profile-icons li.web-icon { width: 20px; height: 20px; }
+ul.profile-icons li.msnm-icon { width: 20px; height: 20px; }
+ul.profile-icons li.icq-icon { width: 20px; height: 20px; }
+ul.profile-icons li.jabber-icon { width: 20px; height: 20px; }
+ul.profile-icons li.pm-icon { width: 28px; height: 20px; }
+ul.profile-icons li.quote-icon { width: 54px; height: 20px; }
+ul.profile-icons li.report-icon { width: 20px; height: 20px; }
+ul.profile-icons li.edit-icon { width: 58px; height: 20px; }
+ul.profile-icons li.delete-icon { width: 20px; height: 20px; }
+ul.profile-icons li.info-icon { width: 20px; height: 20px; }
+ul.profile-icons li.warn-icon { width: 20px; height: 20px; }
+/* Fix profile icon default margins */
+ul.profile-icons li.edit-icon { margin: 0 0 0 3px; }
+ul.profile-icons li.quote-icon { margin: 0 0 0 10px; }
+ul.profile-icons li.info-icon, ul.profile-icons li.report-icon { margin: 0 3px 0 0; }
+/* proSilver Form Styles
+---------------------------------------- */
+/* General form styles
+----------------------------------------*/
+fieldset { border-width: 0;
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+ font-size: 1.1em;
+}
+input { font-weight: normal;
+ cursor: pointer;
+ vertical-align: middle;
+ padding: 0 3px;
+ font-size: 1em;
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+}
+select {font-family: Verdana, Helvetica, Arial, sans-serif;
+ font-weight: normal;
+ cursor: pointer;
+ vertical-align: middle;
+ border: 1px solid #666666;
+ padding: 1px;
+ background-color: #FAFAFA;
+}
+option { padding-right: 1em; }
+option.disabled-option { color: graytext; }
+textarea { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
+ width: 60%;
+ padding: 2px;
+ font-size: 1em;
+ line-height: 1.4em;
+}
+label { cursor: default;
+ padding-right: 5px;
+ color: #676767;
+}
+label input { vertical-align: middle;}
+label img { vertical-align: middle;}
+/* Definition list layout for forms
+---------------------------------------- */
+fieldset dl { padding: 4px 0;}
+fieldset dt { float: left;
+ width: 40%;
+ text-align: left;
+ display: block;
+}
+fieldset dd { margin-left: 41%;
+ vertical-align: top;
+ margin-bottom: 3px;
+}
+/* Specific layout 1 */
+fieldset.fields1 dt { width: 15em;
+ border-right-width: 0;
+}
+fieldset.fields1 dd { margin-left: 15em;
+ border-left-width: 0;
+}
+fieldset.fields1 { background-color: transparent; }
+fieldset.fields1 div { margin-bottom: 3px; }
+/* Specific layout 2 */
+fieldset.fields2 dt { width: 15em;
+ border-right-width: 0;
+}
+fieldset.fields2 dd { margin-left: 16em;
+ border-left-width: 0;
+}
+/* Form elements */
+dt label { font-weight: bold;
+ text-align: left;
+}
+dd label { white-space: nowrap;
+ color: #333;
+}
+dd input, dd textarea { margin-right: 3px; }
+dd select { width: auto; }
+dd textarea { width: 85%; }
+/* Hover effects */
+fieldset dl:hover dt label {color: #000000;}
+fieldset.fields2 dl:hover dt label { color: inherit;}
+/* Submit button fieldset */
+fieldset.submit-buttons { text-align: center;
+ vertical-align: middle;
+ margin: 5px 0;
+}
+fieldset.submit-buttons input { vertical-align: middle;
+ padding-top: 3px;
+ padding-bottom: 3px;
+}
+/* Input field styles
+---------------------------------------- */
+.inputbox { background-color: #FFFFFF;
+ border: 1px solid #c0c0c0;
+ color: #333333;
+ padding: 2px;
+ cursor: text;
+}
+.inputbox:hover { border: 1px solid #eaeaea;}
+.inputbox:focus { border: 1px solid #eaeaea;
+ color: #4b4b4b;
+}
+input.inputbox { width: 85%; }
+input.medium { width: 50%; }
+input.narrow { width: 25%; }
+input.tiny { width: 125px; }
+textarea.inputbox { width: 85%; }
+.autowidth {width: auto !important;}
+/* Form button styles
+---------------------------------------- */
+input.button1, input.button2 {font-size: 1em;}
+a.button1, input.button1, input.button3, a.button2, input.button2 {
+ width: auto !important;
+ padding-top: 1px;
+ padding-bottom: 1px;
+ font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
+ color: #000;
+ background: #FAFAFA none repeat-x top;
+}
+a.button1, input.button1 {font-weight: bold;
+ border: 1px solid #666666;
+}
+input.button3 {padding: 0;
+ margin: 0;
+ line-height: 5px;
+ height: 12px;
+ background-image: none;
+ font-variant: small-caps;
+}
+/* Alternative button */
+a.button2, input.button2, input.button3 {border: 1px solid #666666;}
+/* <a> button in the style of the form buttons */
+a.button1, a.button1:link, a.button1:visited, a.button1:active, a.button2, a.button2:link, a.button2:visited, a.button2:active {
+ text-decoration: none;
+ color: #000000;
+ padding: 2px 8px;
+ line-height: 250%;
+ vertical-align: text-bottom;
+ background-position: 0 1px;
+}
+/* Hover states */
+a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover {
+ border: 1px solid #BCBCBC;
+ background-position: 0 100%;
+ color: #BCBCBC;
+}
+
+/* Topic and forum Search */
+.search-box {margin-top: 3px;
+ margin-left: 5px;
+ float: left;
+}
+.search-box input {
+}
+input.search {background-image: none;
+ background-repeat: no-repeat;
+ background-position: left 1px;
+ padding-left: 17px;
+}
+/* proSilver Style Sheet Tweaks
+These style definitions are mainly IE specific
+tweaks required due to its poor CSS support.
+-------------------------------------------------*/
+* html table, * html select, * html input { font-size: 100%; }
+* html hr { margin: 0; }
+* html span.corners-top, * html span.corners-bottom { background-image: url("{T_IMAGE_PATH}corners_left.gif"); }
+* html span.corners-top span, * html span.corners-bottom span { background-image: url("{T_IMAGE_PATH}corners_right.gif"); }
+table.table1 {width: 99%; /* IE < 6 browsers */
+ /* Tantek hack */
+ voice-family: "\"}\"";
+ voice-family: inherit;
+ width: 100%;
+}
+html>body table.table1 { width: 100%; } /* Reset 100% for opera */
+* html ul.topiclist li { position: relative; }
+* html .postbody h3 img { vertical-align: middle; }
+/* Form styles */
+html>body dd label input { vertical-align: text-bottom; } /* Align checkboxes/radio buttons nicely */
+* html input.button1, * html input.button2 {
+ padding-bottom: 0;
+ margin-bottom: 1px;
+}
+/* Misc layout styles */
+* html .column1, * html .column2 { width: 45%; }
+/* Nice method for clearing floated blocks without having to insert any extra markup (like spacer above)
+ From http://www.positioniseverything.net/easyclearing.html
+#tabs:after, #minitabs:after, .post:after, .navbar:after, fieldset dl:after, ul.topiclist dl:after, ul.linklist:after, dl.polls:after {
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}*/
+.clearfix, #tabs, #minitabs, .post, .navbar, fieldset dl, ul.topiclist dl, ul.linklist, dl.polls {
+ height: 1%;
+ overflow: hidden;
+}
+/* Simple fix so forum and topic lists always have a min-height set, even in IE6
+ From http://www.dustindiaz.com/min-height-fast-hack */
+dl.icon { min-height: 35px;
+ height: auto !important;
+ height: 35px;
+}
+* html #search-box {
+ margin-right: 35px;
+}
+/* Correctly clear floating for details on profile view */
+*:first-child+html dl.details dd { margin-left: 15em;
+ float: none;
+}
+* html dl.details dd { margin-left: 15em;
+ float: none;
+}
+/*
+--------------------------------------------------------------
+Colours and backgrounds for common.css
+-------------------------------------------------------------- */
+html, body { color: #536482;
+ background-color: #FFFFFF;
+}
+h1 { color: #FFFFFF;}
+h2 {color: #28313F;}
+h3 {border-bottom-color: #CCCCCC;
+ color: #115098;
+}
+hr {border-color: #FFFFFF;
+ border-top-color: #CCCCCC;
+}
+hr.dashed {border-top-color: #CCCCCC;}
+/* Search box
+--------------------------------------------- */
+#search-box {color: #FFFFFF;}
+#search-box #keywords {background-color: #FFF;}
+#search-box input {border-color: #0075B0;}
+/* Round cornered boxes and backgrounds
+---------------------------------------- */
+.headerbar {background-color: #12A3EB;
+ background-image: url("{T_IMAGE_PATH}bg_header.gif");
+ color: #FFFFFF;
+}
+.navbar {background-color: #cadceb;}
+.forabg {background-color: #0076b1;
+ background-image: url("{T_IMAGE_PATH}bg_list.gif");
+}
+.forumbg {background-color: #12A3EB;
+ background-image: url("{T_IMAGE_PATH}bg_header.gif");
+}
+.panel {background-color: #ECF1F3;
+ color: #28313F;
+}
+.post:target .content {color: #000000;}
+.post:target h3 a {color: #000000;}
+.bg1 { background-color: #ECF3F7; }
+.bg2 { background-color: #e1ebf2; }
+.bg3 { background-color: #cadceb; }
+.ucprowbg {background-color: #DCDEE2;}
+.fieldsbg {background-color: #E7E8EA;}
+span.corners-top {background-image: url("{T_IMAGE_PATH}corners_left.png");}
+span.corners-top span {background-image: url("{T_IMAGE_PATH}corners_right.png");}
+span.corners-bottom {background-image: url("{T_IMAGE_PATH}corners_left.png");}
+span.corners-bottom span {background-image: url("{T_IMAGE_PATH}corners_right.png");}
+/* Horizontal lists
+----------------------------------------*/
+ul.navlinks {border-bottom-color: #FFFFFF;}
+/* Misc layout styles
+---------------------------------------- */
+dl.details dt {
+ color: #000000;
+}
+
+dl.details dd {
+ color: #536482;
+}
+
+.sep {
+ color: #1198D9;
+}
+/* Miscellaneous styles
+---------------------------------------- */
+.copyright {color: #555555;}
+.error {color: #BC2A4D;}
+.reported {background-color: #F7ECEF;}
+li.reported:hover {background-color: #ECD5D8 !important;}
+.sticky, .announce {/* you can add a background for stickies and announcements*/}
+div.rules {background-color: #ECD5D8;
+ color: #BC2A4D;
+}
+p.rules {background-color: #ECD5D8;
+ background-image: none;
+}
+/*
+--------------------------------------------------------------
+Colours and backgrounds for links.css
+-------------------------------------------------------------- */
+a:link { color: #105289; }
+a:visited { color: #105289; }
+a:hover { color: #D31141; }
+a:active { color: #368AD2; }
+/* Links on gradient backgrounds */
+#search-box a:link, .navbg a:link, .forumbg .header a:link, .forabg .header a:link, th a:link {color: #FFFFFF;}
+#search-box a:visited, .navbg a:visited, .forumbg .header a:visited, .forabg .header a:visited, th a:visited {color: #FFFFFF;}
+#search-box a:hover, .navbg a:hover, .forumbg .header a:hover, .forabg .header a:hover, th a:hover {color: #A8D8FF;}
+#search-box a:active, .navbg a:active, .forumbg .header a:active, .forabg .header a:active, th a:active {color: #C8E6FF;}
+/* Links for forum/topic lists */
+a.forumtitle {color: #105289;}
+/* a.forumtitle:visited { color: #105289; } */
+a.forumtitle:hover {color: #BC2A4D;}
+a.forumtitle:active {color: #105289;}
+a.topictitle {color: #105289;}
+/* a.topictitle:visited { color: #368AD2; } */
+a.topictitle:hover {color: #BC2A4D;}
+a.topictitle:active {color: #105289;}
+/* Post body links */
+.postlink {color: #368AD2;
+ border-bottom-color: #368AD2;
+}
+.postlink:visited {color: #5D8FBD;
+ border-bottom-color: #666666;
+}
+.postlink:active {color: #368AD2;}
+.postlink:hover {background-color: #D0E4F6;
+ color: #0D4473;
+}
+.signature a, .signature a:visited, .signature a:active, .signature a:hover {background-color: transparent;}
+/* Profile links */
+.postprofile a:link, .postprofile a:active, .postprofile a:visited, .postprofile dt.author a {color: #105289;}
+.postprofile a:hover, .postprofile dt.author a:hover {color: #D31141;}
+/* Profile searchresults */
+.search .postprofile a {color: #105289;}
+.search .postprofile a:hover {color: #D31141;}
+/* Back to top of page */
+a.top {background-image: url("{T_IMAGE_PATH}icon_back_top.gif");}
+a.top2 {background-image: url("{T_IMAGE_PATH}icon_back_top.gif");}
+/* Arrow links */
+a.up { background-image: url("{T_IMAGE_PATH}arrow_up.gif") }
+a.down { background-image: url("{T_IMAGE_PATH}arrow_down.gif") }
+a.left { background-image: url("{T_IMAGE_PATH}arrow_left.gif") }
+a.right { background-image: url("{T_IMAGE_PATH}arrow_right.gif") }
+a.up:hover {background-color: transparent;}
+a.left:hover {color: #368AD2;}
+a.right:hover {color: #368AD2;}
+/*
+--------------------------------------------------------------
+Colours and backgrounds for content.css
+-------------------------------------------------------------- */
+ul.forums {background-color: #eef5f9;
+ background-image: url("{T_IMAGE_PATH}gradient.gif");
+}
+ul.topiclist li {color: #4C5D77;}
+ul.topiclist dd {border-left-color: #FFFFFF;}
+.rtl ul.topiclist dd {border-right-color: #fff;
+ border-left-color: transparent;
+}
+ul.topiclist li.row dt a.subforum.read {background-image: url("{T_IMAGE_PATH}subforum_read.gif");}
+ul.topiclist li.row dt a.subforum.unread {background-image: url("{T_IMAGE_PATH}subforum_unread.gif");}
+li.row {border-top-color: #FFFFFF;
+ border-bottom-color: #00608F;
+}
+li.row strong {color: #000000;}
+li.row:hover {background-color: #F6F4D0;}
+li.row:hover dd {border-left-color: #CCCCCC;}
+.rtl li.row:hover dd {border-right-color: #CCCCCC;
+ border-left-color: transparent;
+}
+li.header dt, li.header dd {color: #FFFFFF;}
+/* Forum list column styles */
+ul.topiclist dd.searchextra {color: #333333;}
+/* Post body styles
+----------------------------------------*/
+.postbody {color: #333333;}
+/* Content container styles
+----------------------------------------*/
+.content {color: #333333;}
+.content h2, .panel h2 {color: #115098;
+ border-bottom-color: #CCCCCC;
+}
+dl.faq dt {color: #333333;}
+.posthilit {background-color: #F3BFCC;
+ color: #BC2A4D;
+}
+/* Post signature */
+.signature {border-top-color: #CCCCCC;}
+/* Post noticies */
+.notice {border-top-color: #CCCCCC;}
+/* BB Code styles
+----------------------------------------*/
+/* Quote block */
+blockquote {background-color: #EBEADD;
+ background-image: url("{T_IMAGE_PATH}quote.gif");
+ border-color:#DBDBCE;
+}
+blockquote blockquote {/* Nested quotes */
+ background-color:#EFEED9;
+}
+blockquote blockquote blockquote {/* Nested quotes */
+ background-color: #EBEADD;
+}
+/* Code block */
+dl.codebox {background-color: #FFFFFF;
+ border-color: #C9D2D8;
+}
+dl.codebox dt {border-bottom-color: #CCCCCC;
+}
+dl.codebox code {color: #2E8B57;}
+.syntaxbg { color: #FFFFFF; }
+.syntaxcomment { color: #FF8000; }
+.syntaxdefault { color: #0000BB; }
+.syntaxhtml { color: #000000; }
+.syntaxkeyword { color: #007700; }
+.syntaxstring { color: #DD0000; }
+/* Attachments
+----------------------------------------*/
+.attachbox {background-color: #FFFFFF;
+ border-color: #C9D2D8;
+}
+.pm-message .attachbox {background-color: #F2F3F3;}
+.attachbox dd {border-top-color: #C9D2D8;}
+.attachbox p {color: #666666;}
+.attachbox p.stats {color: #666666;}
+.attach-image img {border-color: #999999;}
+/* Inline image thumbnails */
+dl.file dd {color: #666666;}
+dl.thumbnail img {border-color: #666666;
+ background-color: #FFFFFF;
+}
+dl.thumbnail dd {color: #666666;}
+dl.thumbnail dt a:hover {background-color: #EEEEEE;}
+dl.thumbnail dt a:hover img {border-color: #368AD2;}
+/* Post poll styles
+----------------------------------------*/
+fieldset.polls dl {border-top-color: #DCDEE2;
+ color: #666666;
+}
+fieldset.polls dl.voted {color: #000000;
+}
+fieldset.polls dd div {color: #FFFFFF;
+}
+.rtl .pollbar1, .rtl .pollbar2, .rtl .pollbar3, .rtl .pollbar4, .rtl .pollbar5 {border-right-color: transparent;
+}
+.pollbar1 {background-color: #AA2346;
+ border-bottom-color: #74162C;
+ border-right-color: #74162C;
+}
+.rtl .pollbar1 {border-left-color: #74162C;}
+.pollbar2 {background-color: #BE1E4A;
+ border-bottom-color: #8C1C38;
+ border-right-color: #8C1C38;
+}
+.rtl .pollbar2 {border-left-color: #8C1C38;}
+.pollbar3 {background-color: #D11A4E;
+ border-bottom-color: #AA2346;
+ border-right-color: #AA2346;
+}
+.rtl .pollbar3 {border-left-color: #AA2346;}
+.pollbar4 {background-color: #E41653;
+ border-bottom-color: #BE1E4A;
+ border-right-color: #BE1E4A;
+}
+.rtl .pollbar4 {border-left-color: #BE1E4A;}
+.pollbar5 {background-color: #F81157;
+ border-bottom-color: #D11A4E;
+ border-right-color: #D11A4E;
+}
+.rtl .pollbar5 {border-left-color: #D11A4E;}
+/* Poster profile block
+----------------------------------------*/
+.postprofile {color: #666666;
+ border-left-color: #FFFFFF;
+}
+.rtl .postprofile {border-right-color: #FFFFFF;
+ border-left-color: transparent;
+}
+.pm .postprofile {border-left-color: #DDDDDD;}
+.rtl .pm .postprofile {border-right-color: #DDDDDD;
+ border-left-color: transparent;
+}
+.postprofile strong {color: #000000;}
+.online {background-image: url("./styles/prosilver/imageset/fr/icon_user_online.gif");}
+/*
+--------------------------------------------------------------
+Colours and backgrounds for buttons.css
+-------------------------------------------------------------- */
+a.fontsize {background-image: url("{T_IMAGE_PATH}icon_fontsize.gif");}
+/* Icon images
+---------------------------------------- */
+.sitehome { background-image: url("{T_IMAGE_PATH}icon_home.gif"); }
+.icon-faq { background-image: url("{T_IMAGE_PATH}icon_faq.gif"); }
+.icon-ucp { background-image: url("{T_IMAGE_PATH}feed-icon.png"); }
+.icon-members { background-image: url("{T_IMAGE_PATH}icon_members.gif"); }
+.icon-home { background-image: url("{T_IMAGE_PATH}icon_home.gif"); }
+.icon-register { background-image: url("{T_IMAGE_PATH}icon_register.gif"); }
+.icon-logout { background-image: url("{T_IMAGE_PATH}icon_logout.gif"); }
+.icon-bookmark { background-image: url("{T_IMAGE_PATH}icon_bookmark.gif"); }
+.icon-subscribe { background-image: url("{T_IMAGE_PATH}icon_subscribe.gif"); }
+.icon-search { background-image: url("{T_IMAGE_PATH}icon_search.gif"); }
+/*
+--------------------------------------------------------------
+Colours and backgrounds for forms.css
+-------------------------------------------------------------- */
+/* General form styles
+----------------------------------------*/
+select {border-color: #666666;
+ background-color: #FAFAFA;
+}
+label {color: #425067;}
+option.disabled-option {color: graytext;}
+/* Definition list layout for forms
+---------------------------------------- */
+dd label {color: #333;}
+/* Hover effects */
+fieldset dl:hover dt label {color: #000000;}
+fieldset.fields2 dl:hover dt label {color: inherit;}
+/* Quick-login on index page */
+fieldset.quick-login input.inputbox {background-color: #F2F3F3;}
+/* Input field styles
+---------------------------------------- */
+.inputbox {background-color: #FFFFFF;
+ border-color: #B4BAC0;
+ color: #333333;
+}
+.inputbox:hover {border-color: #11A3EA;}
+.inputbox:focus {border-color: #11A3EA;
+ color: #0F4987;
+}
+/* Form button styles
+---------------------------------------- */
+a.button1, input.button1, input.button3, a.button2, input.button2 {color: #000;
+ background-color: #FAFAFA;
+ background-image: url("{T_IMAGE_PATH}bg_button.gif");
+}
+a.button1, input.button1 {border-color: #666666;}
+input.button3 {background-image: none;}
+/* Alternative button */
+a.button2, input.button2, input.button3 {border-color: #666666;}
+/* <a> button in the style of the form buttons */
+a.button1, a.button1:link, a.button1:visited, a.button1:active, a.button2, a.button2:link, a.button2:visited, a.button2:active {color: #000000;}
+/* Hover states */
+a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover {border-color: #BC2A4D;
+ color: #BC2A4D;
+}
+input.search {background-image: url("{T_IMAGE_PATH}icon_textbox_search.gif");}
+#wrap {
+ padding: 0 20px;
+}
diff --git a/phpBB/gym_sitemaps/style/gym_rss.xsl b/phpBB/gym_sitemaps/style/gym_rss.xsl new file mode 100644 index 0000000000..7f09c89684 --- /dev/null +++ b/phpBB/gym_sitemaps/style/gym_rss.xsl @@ -0,0 +1,197 @@ +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:output + method="html" + version="1.0" + encoding="utf-8" + omit-xml-declaration="yes" + doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" + doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" + indent="yes" /> +<xsl:template match="/rss" > + +<xsl:variable name="rss_link"> + <xsl:value-of select="channel/textInput/link" /> +</xsl:variable> +<xsl:variable name="home_link">{ROOT_URL}</xsl:variable> +<xsl:variable name="browser"> + <xsl:choose><xsl:when test="system-property('xsl:vendor')='Transformiix'">mozilla</xsl:when> + <xsl:otherwise>other</xsl:otherwise> + </xsl:choose> +</xsl:variable> +<xsl:variable name="sorting"> + <xsl:choose><xsl:when test="$browser='mozilla'">descending</xsl:when> + <xsl:otherwise>ascending</xsl:otherwise> + </xsl:choose> +</xsl:variable> +<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}"> +<head> + <base href="{PHPBB_URL}"/> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <title><xsl:value-of select="channel/title" /> - {L_FEED}</title> + <link rel="alternate" type="application/rss+xml" title="{channel/title}" href="{$rss_link}" /> + <link rel="stylesheet" href="{T_CSS_PATH}" type="text/css" media="screen, projection"/> + <link href="{T_STYLE_PATH}normal.css" rel="stylesheet" type="text/css" title="A" /> + <link href="{T_STYLE_PATH}medium.css" rel="alternate stylesheet" type="text/css" title="A+" /> + <link href="{T_STYLE_PATH}large.css" rel="alternate stylesheet" type="text/css" title="A++" /> + <script type="text/javascript" src="{T_STYLE_PATH}gym_js.js"></script> +</head> +<body id="phpbb"> +<!-- + GYM Sitemaps and RSS XSLTransform + (C) phpBB SEO - http://www.phpbb-seo.com/ +--> + <div id="wrap"> + <a id="top" name="top" accesskey="t"></a> + <div id="page-header"> + <div class="headerbar"> + <div class="inner"><span class="corners-top"><span></span></span> + <div id="site-description"><a href="{$home_link}" title="{L_HOME}" id="logo"><img src="{channel/image/url}" alt="{channel/image/title}" /></a> + <h1>{SITENAME}</h1> + <p>{SITE_DESCRIPTION}</p> + <p style="display: none;"><a href="#start_here">{L_SKIP}</a></p> + </div> + <div id="search-box"> + <form action="{PHPBB_URL}search.php" method="post" id="search"> + <fieldset> + <input name="keywords" id="keywords" type="text" maxlength="128" title="" class="inputbox search" value="" /> + <input class="button2" value="{L_SEARCH}" type="submit" /><br /> + <a href="{PHPBB_URL}search.php" title="{L_SEARCH_ADV_EXPLAIN}">{L_SEARCH_ADV}</a> + </fieldset> + </form> + </div> + <span class="corners-bottom"><span></span></span> + </div> + </div> + <div class="navbar"> + <div class="inner"><span class="corners-top"><span></span></span> + <ul class="linklist navlinks"> + <li class="icon-home"> + <a href="{$home_link}" accesskey="h">{L_HOME}</a> <strong>‹</strong>  + <xsl:if test="$home_link != '{PHPBB_URL}'"> + <xsl:if test="'{PHPBB_URL}' != channel/link"> + <a href="{PHPBB_URL}">{L_FORUM_INDEX}</a> <strong>‹</strong>  + </xsl:if> + </xsl:if> + <a href="{channel/link}" title="{channel/title}"><span class="html"><xsl:value-of select="channel/title" /></span></a> <strong>‹</strong> <a href="{$rss_link}">{L_SOURCE}</a></li> + <li class="rightside"><a href="#" onclick="fontsizeup(); return false;" class="fontsize" title="{L_CHANGE_FONT_SIZE}">{L_CHANGE_FONT_SIZE}</a></li> + </ul> + <ul class="linklist leftside"> + <li class="icon-ucp"> + <a href="{$rss_link}" title="{channel/title}" accesskey="u"><span class="html"><xsl:value-of select="channel/title" /> - {L_FEED}</span></a> + </li> + </ul> + <ul class="linklist rightside"> + <li class="icon-faq"><a href="{PHPBB_URL}faq.php" title="{L_FAQ_EXPLAIN}">{L_FAQ}</a></li> + <li class="icon-register"><a href="{PHPBB_URL}ucp.php?mode=register">{L_REGISTER}</a></li> + </ul> + <span class="corners-bottom"><span></span></span> + </div> + </div> + </div> + <a name="start_here"></a> + <div id="page-body"><br/> + <div class="clear"></div> + <xsl:for-each select="channel"> + <div class="post bg3"> + <div class="inner"><span class="corners-top"><span></span></span> + <div class="postbody"><div class="html"><p><h2><a href="{link}" title="{title}"><span class="html"><xsl:value-of select="title" disable-output-escaping="yes"/></span></a></h2></p><hr/> + + <p><span class="html"><xsl:call-template name="nl2br"><xsl:with-param name="input" select="description" /></xsl:call-template></span><br/><br/> +{L_SUBSCRIBE} + <form action="" method="POST" > + <fieldset > + <label><a href="{$rss_link}" title="{title}"><img src="{T_IMAGE_PATH}feed-icon.png" alt="{L_2_LINK}" align="middle"/></a> {L_2_LINK}</label> + <input name="urlrss" type="text" value="{$rss_link}" size="80" maxlength="500"/> + </fieldset> + </form> + <br/> +{L_LAST_UPDATE} : <xsl:value-of select="lastBuildDate"/><br/> +{L_UPDATE} : <xsl:value-of select="ttl"/> {L_MINUTES}.<br/><br/> + <xsl:choose> + <xsl:when test="count(item) = 1"> <b>{L_ITEM_LISTED}</b> + </xsl:when> + <xsl:otherwise> + <b><xsl:value-of select="count(item)"/> {L_ITEMS_LISTED}</b> + </xsl:otherwise> + </xsl:choose></p></div></div> + <dl class="postprofile"> + <dt>{L_SUBSCRIBE_POD}<br/><br/> + <a href="http://fusion.google.com/add?feedurl={$rss_link}" target="_google"><img src="{T_IMAGE_PATH}addGoogle.gif" border="0" alt="Add to Google" title="Add to Google"/></a><br/> + <a href="http://add.my.yahoo.com/rss?url={$rss_link}" target="_yahoo"><img src="{T_IMAGE_PATH}addtomyyahoo.gif" border="0" alt="Add to My Yahoo" title="Add to My Yahoo"/></a><br/> + <a href="http://my.msn.com/addtomymsn.armx?id=rss&ut={$rss_link}&ru={$rss_link}" target="_msn"><img src="{T_IMAGE_PATH}MyMSN.gif" alt="Add to My MSN" title="Add to My MSN"/></a><br/> + <a href="http://feeds.my.aol.com/index.jsp?url={$rss_link}" target="_aol"><img alt="Add to MY AOL" src="{T_IMAGE_PATH}myaol.gif" title="Add to My AOL" border="0"/></a><br/> + <a href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url={$rss_link}" target="_newsgator"><img src="{T_IMAGE_PATH}newsgator.gif" alt="Subscribe in NewsGator Online" title="Subscribe in NewsGator Online" border="0"/></a><br/> + <a href="http://www.netvibes.com/subscribe.php?url={$rss_link}" target="_netvibes"><img src="{T_IMAGE_PATH}add2netvibes.gif" border="0" alt="Add to Netvibes" title="Add to Netvibes"/></a><br/> + <a href="http://www.pageflakes.com/subscribe.aspx?url={$rss_link}" target="_pageflakes"><img src="{T_IMAGE_PATH}pageflakes.gif" border="0" alt="Add to Page Flakes" title="Add to Page Flakes"/></a><br/> + </dt> + </dl> + + <span class="corners-bottom"><span></span></span> + </div> + </div> + <br/><br/> + <xsl:for-each select="item"> + <xsl:sort select="substring(pubDate,12,string-length(pubDate))" order="{$sorting}" data-type="number"/> + <div class="post bg2"> + <div class="inner"><span class="corners-top"><span></span></span> + <div class="postbody"> + <div class="content"><p><h2><a href="{link}" title="{title}"><span class="html"><xsl:value-of select="title" disable-output-escaping="yes"/></span></a></h2></p> + <span class="html"><xsl:call-template name="nl2br"><xsl:with-param name="input" select="description" /></xsl:call-template></span> + <div class="signature"> + <b>{L_BOOKMARK_THIS}</b>  + <a href="http://www.scoopeo.com/scoop/new?newurl={link}&title={title}" title="Scoopeo : {title}"><img src="{T_IMAGE_PATH}scoopeo.png" alt="Scoopeo" /></a>  + <a href="http://www.wikio.fr/publish?url={link}&title={title}" title="Wikio : {title}"><img src="{T_IMAGE_PATH}wikio.gif" alt="Wikio" /></a>  + <a href="http://digg.com/submit?phase=2&url={link}&title={title}" title="Digg : {title}"><img src="{T_IMAGE_PATH}digg.png" alt="Digg" /></a>  + <a href="http://www.fuzz.fr/submit?url={link}&title={title}" title="Fuzz : {title}"><img src="{T_IMAGE_PATH}fuzz.png" alt="Fuzz" /></a>  + <a href="http://www.nuouz.com/addNews.aspx?url={link}&title={title}" title="Nuouz : {title}"><img src="{T_IMAGE_PATH}nuouz.png" alt="Nuouz" /></a>  + <a href="http://reddit.com/submit?url={link}&title={title}" title="Reddit : {title}"><img src="{T_IMAGE_PATH}reddit.png" alt="Reddit" /></a>  + <a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?wt=nw&url={link}&title={title}', 'addthis', 'scrollbars=yes,menubar=no,resizable=yes,toolbar=no,location=no,status=no,width=620,height=560,left=200,top=100'); return false;" title="addThis : {title}"><img src="{T_IMAGE_PATH}addthis.gif" alt="addThis" /></a> + </div> + </div> + </div> + <dl class="postprofile"> + <dt><b>{L_LINK} :</b><br/> <a href="{link}" title="{title}" ><span class="html"><xsl:value-of select="title" disable-output-escaping="yes"/></span></a><br/> + <b>{L_SOURCE} :</b><br/> <a href="{source/@url}" title="{source}"><img src="{T_IMAGE_PATH}feed-icon.png" alt="{L_2_LINK}" align="middle"/> <span class="html"><xsl:value-of select="source" disable-output-escaping="yes"/></span></a><br/> + <b>{L_LASTMOD_DATE} :</b><br/> <xsl:value-of select="pubDate" /> + </dt> + <dd> </dd> + </dl> + <div class="back2top"><a href="{$rss_link}#wrap" class="top" title="{L_BACK_TO_TOP}"></a>{L_BACK_TO_TOP} </div> + <span class="corners-bottom"><span></span></span> + </div> + </div> + <br/><hr class="divider" /> + </xsl:for-each> + </xsl:for-each> + </div> + </div> + +<div class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a> © 2000 - 2008 phpBB Group</div> +<!-- + We request you retain the full copyright notice below, as well as in all templates you may use, + including the link to www.phpbb-seo.com. + This not only gives respect to the large amount of time given freely by the developers + but also helps build interest, traffic and use of www.phpBB-SEO.com + If you cannot (for good reason) retain the full copyright we request you at least leave in place the + "Copyright phpBB SEO" line, with "phpBB SEO" linked to www.phpbb-seo.com. + If you refuse to include even this, then support and further development on our forums may be affected. + The phpBB SEO Team. +--> +<div class="copyright">{L_COPY} <a href="http://feedvalidator.org/check.cgi?url={$rss_link}"><img src="{T_IMAGE_PATH}rss-valid.gif" alt="{L_RSS_VALID}" title="{L_RSS_VALID}" /></a></div> +</body> +</html> +</xsl:template> +<!-- nl2br template for cleaner output, no brs in xml ! --> +<xsl:template name="nl2br"> + <xsl:param name="input" /> + <xsl:choose> + <xsl:when test="contains($input,'
')"> + <xsl:call-template name="nl2br"><xsl:with-param name="input" select="concat(substring-before($input,'
'), '<br>',substring-after($input,'
'))" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of disable-output-escaping="yes" select="$input" /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> +</xsl:stylesheet> diff --git a/phpBB/gym_sitemaps/style/large.css b/phpBB/gym_sitemaps/style/large.css new file mode 100644 index 0000000000..dfb1d2c2e6 --- /dev/null +++ b/phpBB/gym_sitemaps/style/large.css @@ -0,0 +1,3 @@ +body { + font-size: 12px; +}
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/style/medium.css b/phpBB/gym_sitemaps/style/medium.css new file mode 100644 index 0000000000..4c992f9fd8 --- /dev/null +++ b/phpBB/gym_sitemaps/style/medium.css @@ -0,0 +1,3 @@ +body { + font-size: 11px; +}
\ No newline at end of file diff --git a/phpBB/gym_sitemaps/style/normal.css b/phpBB/gym_sitemaps/style/normal.css new file mode 100644 index 0000000000..d0783d1882 --- /dev/null +++ b/phpBB/gym_sitemaps/style/normal.css @@ -0,0 +1,3 @@ +body { + font-size: 10px; +}
\ No newline at end of file |