Codice: Seleziona tutto
phpBB Created this page in 0.040543 seconds : 11 queries executed : GZIP compression disabled : Debug Mode
Codice: Seleziona tutto
phpBB Created this page in 0.040543 seconds : 11 queries executed : GZIP compression disabled : Debug Mode
Codice: Seleziona tutto
// @define('DEBUG', true);
// @define('DEBUG_EXTRA', true);
Codice: Seleziona tutto
@define('DEBUG', true);
@define('DEBUG_EXTRA', true);
Codice: Seleziona tutto
ELIMINATO
Codice: Seleziona tutto
[phpBB Debug] PHP Notice: in file /phpbb_seo/phpbb_seo_class.php on line 123: Undefined index: file_index
Codice: Seleziona tutto
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
<head>
{SEO_BASE_HREF}
<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
<title>{PAGE_TITLE}<!-- IF S_IN_MCP --> • {L_MCP}<!-- ELSEIF S_IN_UCP --> • {L_UCP}<!-- ENDIF --></title>
<meta http-equiv="content-language" content="{S_USER_LANG}" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="google-site-verification" content="Jjce1Lqk_hH0QzPgybwMGzvtwEoRE0MvpgH9FJ1SaoY" />
{META_TAG}
{META}
<link rel="alternate" type="application/rss+xml" title="{gym_rsslinks.TITLE}" href="{gym_rsslinks.URL}" />
<!-- IF S_ENABLE_FEEDS -->
<link rel="alternate" type="application/atom+xml" title="{L_FEED} - {SITENAME}" href="{U_FEED}" />
<!-- IF S_ENABLE_FEEDS_NEWS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_NEWS}" href="{U_FEED}?mode=news" /><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_FORUMS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_ALL_FORUMS}" href="{U_FEED}?mode=forums" /><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_TOPICS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_ALL_TOPICS}" href="{U_FEED}?mode=topics" /><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_FORUM and S_FORUM_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FORUM} - {FORUM_NAME}" href="{U_FEED}?f={S_FORUM_ID}" /><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_TOPIC and S_TOPIC_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_TOPIC} - {TOPIC_TITLE}" href="{U_FEED}?f={S_FORUM_ID}&t={S_TOPIC_ID}" /><!-- ENDIF -->
<!-- ENDIF -->
<link rel="stylesheet" href="{T_STYLESHEET_LINK}" type="text/css" />
<script type="text/javascript">
// <![CDATA[
function hide(id) { document.getElementById(id).style.display="none"; }
function show(id) { document.getElementById(id).style.display="block"; }
function layerTest(id) {
if ( document.getElementById(id).style.display == 'none' ) {
show(id);
} else {
hide(id);
}
}
<!-- IF S_USER_PM_POPUP -->
if ({S_NEW_PM})
{
popup('{UA_POPUP_PM}', 480, 180, '_phpbbprivmsg');
}
<!-- ENDIF -->
function popup(url, width, height, name)
{
if (!name)
{
name = '_popup';
}
window.open(url.replace(/&/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes,width=' + width);
return false;
}
function jumpto() {
var page = prompt('{LA_JUMP_PAGE}:', '{ON_PAGE}');
var perpage = '{PER_PAGE}';
var base_url = '{A_BASE_URL}';
var seo_delim_start = '{SEO_START_DELIM}';
var seo_static_pagination = '{SEO_SATIC_PAGE}';
var seo_ext_pagination = '{SEO_EXT_PAGE}';
if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) {
var seo_page = (page - 1) * perpage;
var anchor = '';
var anchor_parts = base_url.split('#');
if ( anchor_parts[1] ) {
base_url = anchor_parts[0];
anchor = '#' + anchor_parts[1];
}
if ( base_url.indexOf('?') >= 0 ) {
document.location.href = base_url.replace(/&/g, '&') + '&start=' + seo_page + anchor;
} else if ( seo_page > 0 ) {
var seo_type1 = base_url.match(/\.[a-z0-9]+$/i);
if (seo_type1 !== null) {
document.location.href = base_url.replace(/\.[a-z0-9]+$/i, '') + seo_delim_start + seo_page + seo_type1 + anchor;
}
var seo_type2 = base_url.match(/\/$/);
if (seo_type2 !== null) {
document.location.href = base_url + seo_static_pagination + seo_page + seo_ext_pagination + anchor;
}
} else {
document.location.href = base_url + anchor;
}
}
}
var seo_external = {SEO_EXTERNAL};
var seo_external_sub = {SEO_EXTERNAL_SUB};
var seo_ext_classes = {SEO_EXT_CLASSES};
var seo_hashfix = {SEO_HASHFIX};
/**
* phpbb_seo_href()
* Fixes href="#something" links with virtual directories
* Optionally open external or marked with a css class links in a new window
* in a XHTML 1.x compliant way.
*/
function phpbb_seo_href() {
var current_domain = document.domain.toLowerCase();
if (!current_domain || !document.getElementsByTagName) return;
if (seo_external_sub && current_domain.indexOf('.') >= 0) {
current_domain = current_domain.replace(new RegExp(/^[a-z0-9_-]+\.([a-z0-9_-]+\.([a-z]{2,6}|[a-z]{2,3}\.[a-z]{2,3}))$/i), '$1');
}
if (seo_ext_classes) {
var extclass = new RegExp("(^|\s)(" + seo_ext_classes + ")(\s|$)");
}
if (seo_hashfix) {
var basehref = document.getElementsByTagName('base')[0];
if (basehref) {
basehref = basehref.href;
var hashtest = new RegExp("^(" + basehref + "|)#[a-z0-9_-]+$");
var current_href = document.location.href.replace(/#[a-z0-9_-]+$/i, "");
} else {
seo_hashfix = false;
}
}
var hrefels = document.getElementsByTagName("a");
var hrefelslen = hrefels.length;
for (var i = 0; i < hrefelslen; i++) {
var el = hrefels[i];
var hrefinner = el.innerHTML.toLowerCase();
if (el.onclick || (el.href == '') || (el.href.indexOf('javascript') >=0 ) || (el.href.indexOf('mailto') >=0 ) || (hrefinner.indexOf('<a') >= 0) ) {
continue;
}
if (seo_hashfix && el.hash && hashtest.test(el.href)) {
el.href = current_href + el.hash;
}
if (seo_external) {
if ((el.href.indexOf(current_domain) >= 0) && !(seo_ext_classes && extclass.test(el.className))) {
continue;
}
el.onclick = function () { window.open(this.href); return false; };
}
}
}
window.onload = function() {
if (seo_external || seo_hashfix) {
phpbb_seo_href();
}
// here you can add other window.onload events
}
/**
* Find a member
*/
function find_username(url)
{
popup(url, 870, 570, '_usersearch');
return false;
}
/**
* Mark/unmark checklist
* id = ID of parent container, name = name prefix, state = state [true/false]
*/
function marklist(id, name, state)
{
var parent = document.getElementById(id);
if (!parent)
{
eval('parent = document.' + id);
}
if (!parent)
{
return;
}
var rb = parent.getElementsByTagName('input');
for (var r = 0; r < rb.length; r++)
{
if (rb[r].name.substr(0, name.length) == name)
{
rb[r].checked = state;
}
}
}
<!-- IF ._file -->
/**
* Play quicktime file by determining it's width/height
* from the displayed rectangle area
*
* Only defined if there is a file block present.
*/
function play_qt_file(obj)
{
var rectangle = obj.GetRectangle();
if (rectangle)
{
rectangle = rectangle.split(',')
var x1 = parseInt(rectangle[0]);
var x2 = parseInt(rectangle[2]);
var y1 = parseInt(rectangle[1]);
var y2 = parseInt(rectangle[3]);
var width = (x1 < 0) ? (x1 * -1) + x2 : x2 - x1;
var height = (y1 < 0) ? (y1 * -1) + y2 : y2 - y1;
}
else
{
var width = 200;
var height = 0;
}
obj.width = width;
obj.height = height + 16;
obj.SetControllerVisible(true);
obj.Play();
}
<!-- ENDIF -->
function selectCode(a)
{
// Get ID of code block
var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
// Not IE
if (window.getSelection)
{
var s = window.getSelection();
// Safari
if (s.setBaseAndExtent)
{
s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
}
// Firefox and Opera
else
{
var r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}
}
// Some older browsers
else if (document.getSelection)
{
var s = document.getSelection();
var r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}
// IE
else if (document.selection)
{
var r = document.body.createTextRange();
r.moveToElementText(e);
r.select();
}
}
// ]]>
</script>
<!-- INCLUDE ads/ads.js -->
</head>
<body class="{S_CONTENT_DIRECTION}">
<!-- IF not S_USER_LOGGED_IN -->
<link rel="stylesheet" href="{T_THEME_PATH}/alertinfo.css" type="text/css">
<DIV id="info">
<DIV id="infobar">
<a href="ucp.php?mode=register"><B>Non sei registrato? Registrati subito per vedere film, telefilm, anime e porno in streaming!</A></B></DIV></DIV><BR />
<!-- ENDIF -->
<a name="top"></a>
<table class="wrap" width="100%" cellpadding="0" cellspacing="0">
<tr><td>
<div id="wrapheader">
<!-- IF ADS_1 -->{ADS_1}<br /><!-- ENDIF -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="18" height="18"><img src="{T_THEME_PATH}/images/tl.png" width="18" height="18" alt="" /></td>
<td height="18" style="background:url('{T_THEME_PATH}/images/tm.png');"></td>
<td width="18" height="18"><img src="{T_THEME_PATH}/images/tr.png" width="18" height="18" alt="" /></td>
</tr>
<tr>
<td width="18" style="background:url('{T_THEME_PATH}/images/ml.png');"></td>
<td>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="303" height="80" style="background:url('{T_THEME_PATH}/images/midl.png');"><div class="logo"><a class="headw" href="{U_INDEX}">{SITENAME}</a><br /><span class="genmedw">{SITE_DESCRIPTION}</span></div></td>
<td height="80" style="background:url('{T_THEME_PATH}/images/midm.png');"> </td>
<td width="470" height="80" align="right" valign="top" style="background:url('{T_THEME_PATH}/images/midr.png');">
<!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH -->
<div class="midlink">
<div id="search-box">
<form action="{U_SEARCH}" method="post" id="search">
<fieldset class="nb">
<input name="keywords" style="opacity:0.8;filter:alpha(opacity=80)" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.8;this.filters.alpha.opacity=80" type="text" class="inputbox search" id="keywords" title="{L_SEARCH_KEYWORDS}" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" maxlength="50" />
<input class="nb" name="submit" type="image" src="{T_THEME_PATH}/images/search.png" align="absmiddle" /><br />
<a class="genmedw" href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}">{L_SEARCH_ADV}</a> {S_SEARCH_HIDDEN_FIELDS}
</fieldset>
</form>
</div>
</div>
<!-- ENDIF -->
</td>
</tr>
</table>
<!-- IF not $S_IN_PORTAL or S_DISPLAY_PHPBB_MENU -->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="24" align="left" style="background:url('{T_THEME_PATH}/images/bottomm.png');">
<div class="buttonwrapper">
<div class="navspacel"></div>
<!-- IF S_USER_LOGGED_IN -->
<!-- ELSEIF S_REGISTER_ENABLED and not (S_SHOW_COPPA or S_REGISTRATION) -->
<a class="squarebuttonl" href="{U_REGISTER}"><span>{L_REGISTER}</span></a><div class="navspacel"></div>
<!-- ENDIF -->
<!-- IF S_USER_LOGGED_IN -->
<a class="squarebuttonl" href="{U_PROFILE}"><span>{L_PROFILE}</span></a><div class="navspacel"></div>
<!-- IF S_DISPLAY_PM -->
<a class="squarebuttonl" href="{U_PRIVATEMSGS}"><span>{PRIVATE_MESSAGE_INFO}</span></a><div class="navspacel"></div>
<!-- ENDIF -->
<!-- ENDIF -->
<!-- IF U_RESTORE_PERMISSIONS -->
<a class="squarebuttonl" href="{U_RESTORE_PERMISSIONS}"><span>{L_RESTORE_PERMISSIONS}</span></a>
<!-- ENDIF -->
</div>
</td>
<td width="431" height="24" align="right" style="background:url('{T_THEME_PATH}/images/bottomr.png');">
<div class="buttonwrapper">
<div class="navspacer"></div>
<!-- IF not S_IS_BOT -->
<a class="squarebuttonr" href="{U_LOGIN_LOGOUT}"><span>{L_LOGIN_LOGOUT}</span></a><div class="navspacer"></div>
<!-- IF S_DISPLAY_MEMBERLIST -->
<a class="squarebuttonr" href="{U_MEMBERLIST}"><span>{L_MEMBERLIST}</span></a><div class="navspacer"></div>
<!-- ENDIF -->
<!-- ENDIF -->
<a class="squarebuttonr" href="{U_FAQ}"><span>{L_FAQ}</span></a>
</div>
</td>
</tr>
</table>
<!-- ENDIF -->
</td>
<td width="18" style="background:url('{T_THEME_PATH}/images/mr.png');"></td>
</tr>
<tr>
<td width="18" height="18"><img src="{T_THEME_PATH}/images/bl.png" width="18" height="18" alt="" /></td>
<td height="18" style="background:url('{T_THEME_PATH}/images/bm.png');"></td>
<td width="18" height="18"><img src="{T_THEME_PATH}/images/br.png" width="18" height="18" alt="" /></td>
</tr>
</table>
</div>
<!-- IF not $S_IN_PORTAL or S_DISPLAY_PHPBB_MENU -->
<div id="datebar">
<table width="100%" cellspacing="0">
<!-- IF S_BOARD_DISABLED -->
<tr><td class="gensmall">
<span class="error">{L_BOARD_DISABLED}</span>
</td></tr>
<!-- ENDIF -->
<tr>
<td class="gensmall"><!-- IF S_USER_LOGGED_IN -->{LAST_VISIT_DATE}<!-- ENDIF --></td>
<td class="gensmall" align="{S_CONTENT_FLOW_END}">{CURRENT_TIME}<br /></td>
</tr>
</table>
</div>
<!-- IF ADS_2 -->{ADS_2}<br /><!-- ENDIF -->
<!-- IF S_DISPLAY_SEARCH -->
<p class="searchbar">
<span style="float: {S_CONTENT_FLOW_BEGIN};"><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a> | <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></span>
<!-- IF S_USER_LOGGED_IN -->
<span style="float: {S_CONTENT_FLOW_END};"><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a> | <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> | <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a></span>
<!-- ENDIF -->
</p>
<!-- ENDIF -->
<br style="clear: both;" />
<!-- INCLUDE breadcrumbs.html -->
<br />
<!-- ENDIF -->
<div align="center"><script type="text/javascript">
//<![CDATA[
var l='it';
document.write('<s'+'cript type="text/javascript" src="http://'+l+'.altervista.org/members_inc/cat.av?'+new Date().getTime()+'"><\/s'+'cript>');
//]]>
</script>
</div>
Codice: Seleziona tutto
[phpBB Debug] PHP Notice: in file /phpbb_seo/phpbb_seo_class.php on line 123: Undefined index: file_index
[phpBB Debug] PHP Notice: in file /phpbb_seo/phpbb_seo_class.php on line 600: Undefined index: urpost
Codice: Seleziona tutto
<?php
/**
*
* @package Ultimate SEO URL phpBB SEO
* @version $Id: phpbb_seo_class.php 236 2010-03-03 08:20:36Z 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;
}
require($phpbb_root_path . "phpbb_seo/includes/setup_phpbb_seo.$phpEx");
/**
* phpBB_SEO Class
* www.phpBB-SEO.com
* @package Ultimate SEO URL phpBB SEO
*/
class phpbb_seo extends setup_phpbb_seo {
var $version = '0.6.4';
var $modrtype = 2; // We set it to mixed as a default value
var $seo_path = array();
var $seo_url = array( 'forum' => array(), 'topic' => array(), 'user' => array(), 'username' => array(), 'group' => array(), 'file' => array() );
var $phpbb_filter = array(
'forum' => array('st' => 0, 'sk' => 't', 'sd' => 'd'),
'topic' => array('st' => 0, 'sk' => 't', 'sd' => 'a', 'hilit' => ''),
'search' => array('st' => 0, 'sk' => 't', 'sd' => 'd', 'ch' => ''),
);
var $seo_stop_files = array('posting' => 1, 'faq' => 1, 'ucp' => 1, 'swatch' => 1, 'mcp' => 1, 'style' => 1, 'cron' => 1);
var $seo_stop_vars = array('view=', 'mark=', 'watch=', 'hash=');
var $seo_stop_dirs = 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', 'urpost' => '.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', 'urpost' => 'unreadposts', 'pagination' => 'page', 'gz_ext' => '.gz' );
var $file_hbase = array();
var $get_vars = array();
var $path = '';
var $start = '';
var $filename = '';
var $file = '';
var $url_in = '';
var $url = '';
var $page_url = '';
var $seo_opt = array( 'url_rewrite' => false, 'modrtype' => 2, 'sql_rewrite' => false, 'profile_inj' => false, 'profile_vfolder' => false, 'profile_noids' => false, 'rewrite_usermsg' => false, 'rewrite_files' => false, 'rem_sid' => false, 'rem_hilit' => true, 'rem_small_words' => false, 'virtual_folder' => false, 'virtual_root' => false, 'cache_layer' => true, 'rem_ids' => false, );
var $rewrite_method = array();
var $paginate_method = array();
var $seo_cache = array();
var $cache_config = array();
var $RegEx = array();
var $sftpl = array();
var $url_replace = array();
/**
* constuctor
*/
function phpbb_seo() {
global $phpEx, $config, $phpbb_root_path;
// 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');
// Nothing should be edited here, please do your custom settings in the
// phpbb_seo/includes/phpbb_seo_modules.php instead to make your updates easier.
// reset the rewrite_method for $phpbb_root_path
$this->rewrite_method[$phpbb_root_path] = array();
// phpBB files must be treated a bit differently
$this->seo_static['file'] = array(ATTACHMENT_CATEGORY_NONE => 'file', ATTACHMENT_CATEGORY_IMAGE => 'image', ATTACHMENT_CATEGORY_WM => 'wm', ATTACHMENT_CATEGORY_RM => 'rm', ATTACHMENT_CATEGORY_THUMB => 'image', ATTACHMENT_CATEGORY_FLASH => 'flash', ATTACHMENT_CATEGORY_QUICKTIME => 'qt');
$this->seo_static['file_index'] = 'resources';
$this->seo_static['thumb'] = 'thumb';
// Options that may be bypassed by the cached settings.
$this->cache_config['dynamic_options'] = array_keys($this->seo_opt); // Do not change
// copyright notice, do not change
$this->cache_config['dynamic_options']['copyrights'] = $this->seo_opt['copyrights'] = array('img' => true, 'txt' => '', 'title' => '');
// Caching config
$this->seo_opt['cache_folder'] = 'phpbb_seo/cache/'; // Folder where the cache file is stored
define('SEO_CACHE_PATH', rtrim(phpbb_realpath($phpbb_root_path . $this->seo_opt['cache_folder']), '/') . '/'); // do not change
$this->seo_opt['topic_type'] = array(); // do not change
$this->seo_opt['topic_last_page'] = array(); // do not change
$this->cache_config['cache_enable'] = true; // do not change
$this->cache_config['rem_ids'] = $this->seo_opt['rem_ids']; // do not change, set up above
$this->cache_config['files'] = array('forum' => 'phpbb_cache.' . $phpEx, 'htaccess' => '.htaccess');
$this->cache_config['cached'] = false; // do not change
$this->cache_config['forum'] = array(); // do not change
$this->cache_config['topic'] = array(); // do not change
$this->cache_config['settings'] = array(); // do not change
// --> DOMAIN SETTING <-- //
// Path Settings, only rely on DB
$server_protocol = ($config['server_protocol']) ? $config['server_protocol'] : (($config['cookie_secure']) ? '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'] = 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['phpbb_files'] = $this->seo_path['phpbb_url'] . 'download/';
$this->seo_path['canonical'] = '';
$this->seo_static = array( 'forum' => 'forum', 'topic' => 'topic', 'post' => 'post', 'user' => 'member', 'group' => 'group', 'index' => 'forum', 'global_announce' => 'announces', 'leaders' => 'the-team', 'atopic' => 'active-topics', 'utopic' => 'unanswered', 'npost' => 'newposts', 'pagination' => 'page', 'gz_ext' => '.gz' );
// magic quotes, do it like this in case phpbb_seo class is not started in common.php
if (!defined('STRIP')) {
if (version_compare(PHP_VERSION, '6.0.0-dev', '<') ) {
if (get_magic_quotes_gpc()) {
define('SEO_STRIP', true);
}
}
} elseif (STRIP) {
define('SEO_STRIP', true);
}
// 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']))));
}
// Load settings from phpbb_seo/includes/phpbb_seo_modules.php
$this->init_phpbb_seo();
$this->seo_path['phpbb_filesR'] = $this->seo_path['phpbb_urlR'] . $this->seo_static['file_index'] . $this->seo_delim['file'];
// 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)
);
}
$this->seo_opt['topic_per_page'] = ($config['posts_per_page'] <= 0) ? 1 : $config['posts_per_page']; // do not change
// Array of the filenames that require the use of a base href tag.
$this->file_hbase = array_merge(array('viewtopic' => $this->seo_path['phpbb_url'], 'viewforum' => $this->seo_path['phpbb_url'], 'memberlist' => $this->seo_path['phpbb_url'], 'search' => $this->seo_path['phpbb_url']), $this->file_hbase);
// Stop dirs
$this->seo_stop_dirs = array_merge(array($phpbb_root_path . 'adm/' => false), $this->seo_stop_dirs);
// Rewrite functions array : array( 'path' => array('file_name' => 'function_name'));
// Warning, this way of doing things is path aware, this implies path to be properly sent to append_sid()
// Allow to add options without slowing down the URL rewriting process
$this->rewrite_method[$phpbb_root_path] = array_merge(
array(
'viewtopic' => 'viewtopic',
'viewforum' => 'viewforum',
'index' => 'index',
'memberlist' => 'memberlist',
'search' => $this->seo_opt['rewrite_usermsg'] ? 'search' : '',
),
$this->rewrite_method[$phpbb_root_path]
);
$this->rewrite_method[$phpbb_root_path . 'download/']['file'] = $this->seo_opt['rewrite_files'] ? 'phpbb_files' : '';
$this->paginate_method = array_merge(
array(
'topic' => $this->seo_ext['topic'] === '/' ? 'rewrite_pagination_page' : 'rewrite_pagination',
'forum' => $this->seo_ext['forum'] === '/' ? 'rewrite_pagination_page' : 'rewrite_pagination',
'group' => $this->seo_ext['group'] === '/' ? 'rewrite_pagination_page' : 'rewrite_pagination',
'user' => $this->seo_ext['user'] === '/' ? 'rewrite_pagination_page' : 'rewrite_pagination',
'atopic' => $this->seo_ext['atopic'] === '/' ? 'rewrite_pagination_page' : 'rewrite_pagination',
'utopic' => $this->seo_ext['utopic'] === '/' ? 'rewrite_pagination_page' : 'rewrite_pagination',
'npost' => $this->seo_ext['npost'] === '/' ? 'rewrite_pagination_page' : 'rewrite_pagination',
'urpost' => $this->seo_ext['urpost'] === '/' ? 'rewrite_pagination_page' : 'rewrite_pagination',
),
$this->paginate_method
);
$this->RegEx = array_merge(
array(
'topic' => array(
'check' => '`^' . ($this->seo_opt['virtual_folder'] ? '%1$s/' : '') . '(' . $this->seo_static['topic'] . '|[a-z0-9_-]+' . $this->seo_delim['topic'] . ')$`i',
'match' => '`^((([a-z0-9_-]+)(' . $this->seo_delim['forum'] . '([0-9]+))?/)?(' . $this->seo_static['topic'] . '(?!=' . $this->seo_delim['topic'] . ')|.+(?=' . $this->seo_delim['topic'] . '))(' . $this->seo_delim['topic'] . ')?)([0-9]+)$`i',
'parent' => 2,
'parent_id' => 5,
'title' => 6,
'id' => 8,
'url' => 1,
),
'forum' => array(
'check' => $this->modrtype >= 2 ? '`^[a-z0-9_-]+(' . $this->seo_delim['forum'] . '[0-9]+)?$`i' : '`^' . $this->seo_static['forum'] . '[0-9]+$`i',
'match' => '`^((' . $this->seo_static['forum'] . '|.+)(' . $this->seo_delim['forum'] . '([0-9]+))?)$`i',
'title' => '\2',
'id' => '\4',
),
),
$this->RegEx
);
// 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_merge(
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',
),
$this->sftpl
);
if ( $this->seo_opt['url_rewrite'] && !defined('ADMIN_START') && isset($this->file_hbase[$this->seo_opt['req_file']])) {
$this->seo_opt['seo_base_href'] = '<base href="' . $this->file_hbase[$this->seo_opt['req_file']] . '"/>';
}
return;
}
/**
* will make sure that configured options are consistent
* @access private
*/
function check_config() {
$this->modrtype = max(0, (int) $this->modrtype);
// For profiles and user messages pages, if we do not inject, we do not get rid of ids
$this->seo_opt['profile_noids'] = $this->seo_opt['profile_inj'] ? $this->seo_opt['profile_noids'] : false;
// If profile noids ...
if ($this->seo_opt['profile_noids']) {
$this->seo_ext['user'] = '/';
}
// Profile ans user messages virtual folder
if ($this->seo_opt['profile_vfolder']) {
$this->seo_ext['user'] = '/';
}
$this->seo_delim['sr'] = $this->seo_ext['user'] == '/' ? '/' : $this->seo_delim['sr'];
// If we use virtual folder, we need '/' at the end of the forum URLs
if ($this->seo_opt['virtual_folder']) {
$this->seo_ext['forum'] = $this->seo_ext['global_announce'] = '/';
}
// If the forum cache is not activated
if (!$this->seo_opt['cache_layer']) {
$this->seo_opt['rem_ids'] = false;
}
// virtual root option
if ($this->seo_opt['virtual_root'] && $this->seo_path['phpbb_script']) {
// virtual root is available and activated
$this->seo_path['phpbb_urlR'] = $this->seo_path['root_url'];
$this->file_hbase['index'] = $this->seo_path['phpbb_url'];
$this->seo_static['index'] = empty($this->seo_static['index']) ? 'forum' : $this->seo_static['index'];
} else {
// virtual root is not used or usable
$this->seo_opt['virtual_root'] = false;
}
$this->seo_ext['index'] = empty($this->seo_static['index']) ? '' : ( empty($this->seo_ext['index']) ? '.html' : $this->seo_ext['index']);
// In case url rewriting is deactivated
if (!$this->seo_opt['url_rewrite'] || $this->modrtype == 0) {
$this->seo_opt['sql_rewrite'] = false;
$this->seo_opt['zero_dupe']['on'] = false;
}
}
// --> 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];
}
/**
* get_url_info($type, $url, $info = 'title')
* Get info from url (title, id, parent etc ...)
*/
function get_url_info($type, $url, $info = 'title') {
$url = trim($url, '/ ');
if (preg_match($this->RegEx[$type]['match'], $url, $matches)) {
return !empty($matches[$this->RegEx[$type][$info]]) ? $matches[$this->RegEx[$type][$info]] : '';
}
return '';
}
/**
* check_url( $type, $url, $parent = '')
* Validate a prepared url
*/
function check_url( $type, $url, $parent = '') {
if (empty($url)) {
return false;
}
$parent = !empty($parent) ? (string) $parent : '[a-z0-9/_-]+';
return !empty($this->RegEx[$type]['check']) ? preg_match(sprintf($this->RegEx[$type]['check'], $parent), $url) : false;
}
/**
* 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('&', '%26', rawurldecode($url))))));
}
/**
* url_rewrite($url, $params = false, $is_amp = true, $session_id = false)
* builds and Rewrite URLs.
* Allow adding of many more cases than just the
* regular phpBB URL rewritting without slowing down the process.
* Mimics append_sid with some shortcuts related to how url are rewritten
*/
function url_rewrite($url, $params = false, $is_amp = true, $session_id = false) {
global $phpEx, $user, $_SID, $_EXTRA_URL, $phpbb_root_path;
$qs = $anchor = '';
$this->get_vars = array();
$amp_delim = ($is_amp) ? '&' : '&';
if (strpos($url, '#') !== false) {
list($url, $anchor) = explode('#', $url, 2);
$anchor = '#' . $anchor;
}
@list($this->path, $qs) = explode('?', $url, 2);
if (is_array($params)) {
if (!empty($params['#'])) {
$anchor = '#' . $params['#'];
unset($params['#']);
}
$qs .= ($qs ? $amp_delim : '') . $this->query_string($params, $amp_delim, '');
} elseif ($params) {
if (strpos($params, '#') !== false) {
list($params, $anchor) = explode('#', $params, 2);
$anchor = '#' . $anchor;
}
$qs .= ($qs ? $amp_delim : '') . $params;
}
// Appending custom url parameter?
if (!empty($_EXTRA_URL)) {
$qs .= ($qs ? $amp_delim : '') . implode($amp_delim, $_EXTRA_URL);
}
// Sid ?
if ($session_id === false && !empty($_SID)) {
$qs .= ($qs ? $amp_delim : '') . "sid=$_SID";
} else if ($session_id) {
$qs .= ($qs ? $amp_delim : '') . "sid=$session_id";
}
// Build vanilla URL
if (preg_match("`\.[a-z0-9]+$`i", $this->path) ) {
$this->file = basename($this->path);
$this->path = ltrim(str_replace($this->file, '', $this->path), '/');
} else {
$this->file = '';
$this->path = ltrim($this->path, '/');
}
$this->url_in = $this->file . ($qs ? '?' . $qs : '');
$url = $this->path . $this->url_in . $anchor;
if (isset($this->seo_cache[$url])) {
return $this->seo_cache[$url];
}
if ( !$this->seo_opt['url_rewrite'] || defined('ADMIN_START') || isset($this->seo_stop_dirs[$this->path]) ) {
return ($this->seo_cache[$url] = $url);
}
$this->filename = trim(str_replace(".$phpEx", '', $this->file));
if ( isset($this->seo_stop_files[$this->filename]) ) {
// add full url
$url = $this->path == $phpbb_root_path ? $this->seo_path['phpbb_url'] . preg_replace('`^' . $phpbb_root_path . '`', '', $url) : $url;
return ($this->seo_cache[$url] = $url);
}
parse_str(str_replace('&', '&', $qs), $this->get_vars);
// strp slashes if necessary
if (defined('SEO_STRIP')) {
$this->get_vars = array_map(array(&$this, 'stripslashes'), $this->get_vars);
}
if (empty($user->data['is_registered'])) {
if ( $this->seo_opt['rem_sid'] ) {
unset($this->get_vars['sid']);
}
if ( $this->seo_opt['rem_hilit'] ) {
unset($this->get_vars['hilit']);
}
}
$this->url = $this->file;
if ( !empty($this->rewrite_method[$this->path][$this->filename]) ) {
$this->{$this->rewrite_method[$this->path][$this->filename]}();
return ($this->seo_cache[$url] = $this->path . $this->url . $this->query_string($this->get_vars, $amp_delim, '?') . $anchor);
} else {
return ($this->seo_cache[$url] = $url);
}
}
/**
* URL rewritting for viewtopic.php
* With Virtual Folder Injection
* @access private
*/
function viewtopic() {
global $phpbb_root_path;
$this->filter_url($this->seo_stop_vars);
$this->path = $this->seo_path['phpbb_urlR'];
if ( !empty($this->get_vars['p']) ) {
$this->url = $this->seo_static['post'] . $this->get_vars['p'] . $this->seo_ext['post'];
unset($this->get_vars['p'], $this->get_vars['f'], $this->get_vars['t'], $this->get_vars['start']);
return;
}
if ( isset($this->get_vars['t']) && !empty($this->seo_url['topic'][$this->get_vars['t']]) ) {
// Filter default params
$this->filter_get_var($this->phpbb_filter['topic']);
$this->{$this->paginate_method['topic']}($this->seo_ext['topic']);
$this->url = $this->seo_url['topic'][$this->get_vars['t']] . $this->start;
unset($this->get_vars['t'], $this->get_vars['f'], $this->get_vars['p']);
return;
} else if (!empty($this->get_vars['t'])) {
// Filter default params
$this->filter_get_var($this->phpbb_filter['topic']);
$this->{$this->paginate_method['topic']}($this->seo_ext['topic']);
$this->url = $this->seo_static['topic'] . $this->get_vars['t'] . $this->start;
unset($this->get_vars['t'], $this->get_vars['f'], $this->get_vars['p']);
return;
}
$this->path = $this->seo_path['phpbb_url'];
return;
}
/**
* URL rewritting for viewforum.php
* @access private
*/
function viewforum() {
global $phpbb_root_path;
$this->path = $this->seo_path['phpbb_urlR'];
$this->filter_url($this->seo_stop_vars);
if ( isset($this->get_vars['f']) && !empty($this->seo_url['forum'][$this->get_vars['f']]) ) {
// Filter default params
$this->filter_get_var($this->phpbb_filter['forum']);
$this->{$this->paginate_method['forum']}($this->seo_ext['forum']);
$this->url = $this->seo_url['forum'][$this->get_vars['f']] . $this->start;
unset($this->get_vars['f']);
return;
} else if (!empty($this->get_vars['f'])) {
// Filter default params
$this->filter_get_var($this->phpbb_filter['forum']);
$this->{$this->paginate_method['forum']}($this->seo_ext['forum']);
$this->url = $this->seo_static['forum'] . $this->get_vars['f'] . $this->start;
unset($this->get_vars['f']);
return;
}
$this->path = $this->seo_path['phpbb_url'];
return;
}
/**
* URL rewritting for memberlist.php
* with nicknames and group name injection
* @access private
*/
function memberlist() {
global $phpbb_root_path;
$this->path = $this->seo_path['phpbb_urlR'];
if ( @$this->get_vars['mode'] === 'viewprofile' && !@empty($this->seo_url['user'][$this->get_vars['u']]) ) {
$this->url = $this->seo_url['user'][$this->get_vars['u']] . $this->seo_ext['user'];
unset($this->get_vars['mode'], $this->get_vars['u']);
return;
} elseif ( @$this->get_vars['mode'] === 'group' && !@empty($this->seo_url['group'][$this->get_vars['g']]) ) {
$this->{$this->paginate_method['group']}($this->seo_ext['group']);
$this->url = $this->seo_url['group'][$this->get_vars['g']] . $this->start;
unset($this->get_vars['mode'], $this->get_vars['g']);
return;
} elseif (@$this->get_vars['mode'] === 'leaders') {
$this->url = $this->seo_static['leaders'] . $this->seo_ext['leaders'];
unset($this->get_vars['mode']);
return;
}
$this->path = $this->seo_path['phpbb_url'];
return;
}
/**
* URL rewritting for search.php
* @access private
*/
function search() {
global $phpbb_root_path;
if (isset($this->get_vars['fid'])) {
$this->get_vars = array();
$this->url = $this->url_in;
return;
}
$this->path = $this->seo_path['phpbb_urlR'];
$user_id = !empty($this->get_vars['author_id']) ? $this->get_vars['author_id'] : ( isset($this->seo_url['username'][rawurldecode(@$this->get_vars['author'])]) ? $this->seo_url['username'][rawurldecode(@$this->get_vars['author'])] : 0);
if ( $user_id && isset($this->seo_url['user'][$user_id]) ) {
// Filter default params
$this->filter_get_var($this->phpbb_filter['search']);
$this->{$this->paginate_method['user']}($this->seo_ext['user']);
$sr = (@$this->get_vars['sr'] == 'topics' ) ? 'topics' : 'posts';
$this->url = $this->seo_url['user'][$user_id] . $this->seo_delim['sr'] . $sr . $this->start;
unset($this->get_vars['author_id'], $this->get_vars['author'], $this->get_vars['sr']);
return;
} elseif ( $this->seo_opt['profile_noids'] && !empty($this->get_vars['author']) ) {
// Filter default params
$this->filter_get_var($this->phpbb_filter['search']);
$this->rewrite_pagination_page();
$sr = (@$this->get_vars['sr'] == 'topics' ) ? '/topics' : '/posts';
$this->url = $this->seo_static['user'] . '/' . $this->seo_url_encode($this->get_vars['author']) . $sr . $this->start;
unset($this->get_vars['author'], $this->get_vars['author_id'], $this->get_vars['sr']);
return;
} elseif (!empty($this->get_vars['search_id'])) {
switch ($this->get_vars['search_id']) {
case 'active_topics':
$this->filter_get_var($this->phpbb_filter['search']);
$this->{$this->paginate_method['atopic']}($this->seo_ext['atopic']);
$this->url = $this->seo_static['atopic'] . $this->start;
unset($this->get_vars['search_id'], $this->get_vars['sr']);
if (@$this->get_vars['st'] == 7) {
unset($this->get_vars['st']);
}
return;
case 'unanswered':
$this->filter_get_var($this->phpbb_filter['search']);
$this->{$this->paginate_method['utopic']}($this->seo_ext['utopic']);
$this->url = $this->seo_static['utopic'] . $this->start;
unset($this->get_vars['search_id']);
if (@$this->get_vars['sr'] == 'topics') {
unset($this->get_vars['sr']);
}
return;
case 'egosearch':
global $user;
$this->set_user_url($user->data['username'], $user->data['user_id']);
$this->url = $this->seo_url['user'][$user->data['user_id']] . $this->seo_delim['sr'] . 'topics' . $this->seo_ext['user'];
unset($this->get_vars['search_id']);
return;
case 'newposts':
$this->filter_get_var($this->phpbb_filter['search']);
$this->{$this->paginate_method['npost']}($this->seo_ext['npost']);
$this->url = $this->seo_static['npost'] . $this->start;
unset($this->get_vars['search_id']);
if (@$this->get_vars['sr'] == 'topics') {
unset($this->get_vars['sr']);
}
return;
case 'unreadposts':
$this->filter_get_var($this->phpbb_filter['search']);
$this->{$this->paginate_method['urpost']}($this->seo_ext['urpost']);
$this->url = $this->seo_static['urpost'] . $this->start;
unset($this->get_vars['search_id']);
if (@$this->get_vars['sr'] == 'topics') {
unset($this->get_vars['sr']);
}
return;
}
}
$this->path = $this->seo_path['phpbb_url'];
return;
}
/**
* URL rewritting for download/file.php
* @access private
*/
function phpbb_files() {
$this->filter_url($this->seo_stop_vars);
$this->path = $this->seo_path['phpbb_filesR'];
if (isset($this->get_vars['id']) && !empty($this->seo_url['file'][$this->get_vars['id']])) {
$this->url = $this->seo_url['file'][$this->get_vars['id']];
if (!empty($this->get_vars['t'])) {
$this->url .= $this->seo_delim['file'] . $this->seo_static['thumb'];
} /*else if (@$this->get_vars['mode'] == 'view') {
$this->url .= $this->seo_delim['file'] . 'view';
}*/
$this->url .= $this->seo_delim['file'] . $this->get_vars['id'];
unset($this->get_vars['id'], $this->get_vars['t'], $this->get_vars['mode']);
return;
}
$this->path = $this->seo_path['phpbb_files'];
return;
}
/**
* URL rewritting for index.php
* @access private
*/
function index() {
$this->path = $this->seo_path['phpbb_urlR'];
if ($this->filter_url($this->seo_stop_vars)) {
$this->url = $this->seo_static['index'] . $this->seo_ext['index'];
return;
}
$this->path = $this->seo_path['phpbb_url'];
return;
}
/**
* Returns true if the user can edit urls
* @access public
*/
function url_can_edit($forum_id = 0) {
global $user, $auth;
if (empty($this->seo_opt['sql_rewrite']) || empty($user->data['is_registered'])) {
return false;
}
if ($auth->acl_get('a_')) {
return true;
}
// un comment to grant url edit perm to moderators in at least a forums
/*if ($auth->acl_getf_global('m_')) {
return true;
}*/
$forum_id = max(0, (int) $forum_id);
if ($forum_id && $auth->acl_get('m_', $forum_id)) {
return true;
}
return false;
}
/**
* Will break if a $filter pattern is foundin $url.
* Example $filter = array("view=", "mark=");
* @access private
*/
function filter_url($filter = array()) {
foreach ($filter as $patern ) {
if ( strpos($this->url_in, $patern) !== false ) {
$this->get_vars = array();
$this->url = $this->url_in;
return false;
}
}
return true;
}
/**
* Will unset all default var stored in $filter array.
* Example $filter = array('st' => 0, 'sk' => 't', 'sd' => 'a', 'hilit' => '');
* @access private
*/
function filter_get_var($filter = array()) {
if ( !empty($this->get_vars) ) {
foreach ($this->get_vars as $paramkey => $paramval) {
if ( isset($filter[$paramkey]) ) {
if ( $filter[$paramkey] == $this->get_vars[$paramkey] || !isset($this->get_vars[$paramkey])) {
unset($this->get_vars[$paramkey]);
}
}
}
}
return;
}
/**
* Appends the GET vars in the query string
* @access public
*/
function query_string($get_vars = array(), $amp_delim = '&', $url_delim = '?') {
if(empty($get_vars)) {
return '';
}
$params = array();
foreach($get_vars as $key => $value) {
if (is_array($value)) {
foreach($value as $k => $v) {
$params[] = $key . '[' . $k . ']=' . $v;
}
} else {
$params[] = $key . (!trim($value) ? '' : '=' . $value);
}
}
return $url_delim . implode($amp_delim , $params);
}
/**
* rewrite pagination, simple
* -xx.html
*/
function rewrite_pagination($suffix) {
$this->start = $this->seo_start( @$this->get_vars['start'] ) . $suffix;
unset($this->get_vars['start']);
}
/**
* rewrite pagination, virtual folder
* /pagexx.html
*/
function rewrite_pagination_page() {
$this->start = '/' . $this->seo_start_page( @$this->get_vars['start'] );
unset($this->get_vars['start']);
}
/**
* Returns usable start param
* -xx
*/
function seo_start($start) {
return ($start >= 1 ) ? $this->seo_delim['start'] . (int) $start : '';
}
/**
* Returns usable start param
* pagexx.html
* Only used in virtual folder mode
*/
function seo_start_page($start) {
return ($start >=1 ) ? $this->seo_static['pagination'] . (int) $start . $this->seo_ext['pagination'] : '';
}
/**
* 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'];
}
/**
* seo_end() : The last touch function
* Note : This mod is going to help your site a lot in Search Engines
* We request that you keep this copyright notice as specified in the licence.
* If You really cannot put this link, you should at least provide us with one visible
* (can be small but visible) link on your home page or your forum Index using this code for example :
* <a href="http://www.phpbb-seo.com/" title="Search Engine Optimization">phpBB SEO</a>
*/
function seo_end($return = false) {
global $user, $config;
if (empty($this->seo_opt['copyrights']['title'])) {
$this->seo_opt['copyrights']['title'] = strpos($config['default_lang'], 'fr') !== false ? 'Optimisation du Référencement' : 'Search Engine Optimization';
}
if (empty($this->seo_opt['copyrights']['txt'])) {
$this->seo_opt['copyrights']['txt'] = 'phpBB SEO';
}
if ($this->seo_opt['copyrights']['img']) {
$output = '<br /><a href="http://www.phpbb-seo.com/" title="' . $this->seo_opt['copyrights']['title'] . '"><img src="' . $this->seo_path['phpbb_url'] . 'images/phpbb-seo.png" alt="' . $this->seo_opt['copyrights']['txt'] . '"/></a>';
} else {
$output = '<br /><a href="http://www.phpbb-seo.com/" title="' . $this->seo_opt['copyrights']['title'] . '">' . $this->seo_opt['copyrights']['txt'] . '</a>';
}
if ($return) {
return $output;
} else {
$user->lang['TRANSLATION_INFO'] .= $output;
}
return;
}
// -> Cache functions
/**
* forum_id(&$forum_id, $forum_uri = '')
* will tell the forum id from the uri or the forum_uri GET var by checking the cache.
*/
function get_forum_id(&$forum_id, $forum_uri = '') {
if (empty($forum_uri)) {
$forum_uri = request_var('forum_uri', '');
unset($_GET['forum_uri'], $_REQUEST['forum_uri']);
}
if (empty($forum_uri)) {
return 0;
}
if ($id = @array_search($forum_uri, $this->cache_config['forum']) ) {
$forum_id = max(0, (int) $id);
} elseif ( $id = $this->get_url_info('forum', $forum_uri, 'id')) {
$forum_id = max(0, (int) $id);
}
return $forum_id;
}
/**
* check_cache() will tell if the required file exists.
* @access private
*/
function check_cache( $type = 'forum', $from_bkp = false ) {
$file = SEO_CACHE_PATH . @$this->cache_config['files'][$type];
if( !$this->cache_config['cache_enable'] || !isset($this->cache_config['files'][$type]) || !file_exists($file) ) {
$this->cache_config['cached'] = false;
return false;
}
include($file);
if (is_array($this->cache_config[$type]) ) {
$this->cache_config['cached'] = true;
return true;
} else {
if ( !$from_bkp ) {
// Try the current backup
@copy($file . '.current', $file);
$this->check_cache( $type, true );
}
$this->cache_config['cached'] = false;
return false;
}
}
/**
* 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);
}
/**
* stripslashes($value)
* Borrowed from php.net : http://www.php.net/stripslashes
*/
function stripslashes($value) {
return is_array($value) ? array_map(array(&$this, 'stripslashes'), $value) : stripslashes($value);
}
// --> Add on Functions <--
// --> Gen stats
/**
* Returns usable microtime
* Borrowed from php.net
*/
function microtime_float() {
return array_sum(explode(' ',microtime()));
}
} // End of the phpbb_seo class
?>
Codice: Seleziona tutto
$this->seo_static = array( 'forum' => 'forum', 'topic' => 'topic', 'post' => 'post', 'user' => 'member', 'group' => 'group', 'index' => 'forum', 'global_announce' => 'announces', 'leaders' => 'the-team', 'atopic' => 'active-topics', 'utopic' => 'unanswered', 'npost' => 'newposts', 'pagination' => 'page', 'gz_ext' => '.gz' );
Codice: Seleziona tutto
$this->seo_path['canonical'] = '';
Visitano il forum: Nessuno e 76 ospiti