PHP Code:
// MOD start: Mobile/SEO style
/**
* Check for mobile/seo, get style
*/
function check_mobile($sql, $style)
{
$browser = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
if (empty($this->data['is_bot']) && strpos($browser, 'Mobile') === false && strpos($browser, 'Symbian') === false && strpos($browser, 'Opera M') === false && strpos($browser, 'Android') === false && stripos($browser, 'HTC_') === false && strpos($browser, 'Fennec/') === false && stripos($browser, 'Blackberry') === false && strpos($browser, 'Windows Phone') === false && strpos($browser, 'WP7') === false && strpos($browser, 'WP8') === false)
{
return true;
}
define('MOBILE_DEVICE', true);
if(!empty($_REQUEST['nomobile']))
{
define('MOBILE_DEVICE_OFF', true);
return true;
}
global $db;
// Important: change number 0 below to ID of Artodia:Mobile style.
// If it is set to 0, script will automatically find style, but it will use extra time and resources.
$mobile_style_id = 13;
if($mobile_style_id)
{
$sql2 = str_replace('s.style_id = ' . $style, 's.style_id = ' . $mobile_style_id, $sql);
$result = $db->sql_query($sql2, 3600);
$this->theme = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if($this->theme !== false)
{
define('MOBILE_STYLE', true);
return false;
}
}
// try to find style
global $phpbb_root_path;
$files = scandir($phpbb_root_path . 'styles');
$base = $phpbb_root_path . 'styles/';
for($i=0; $i<count($files); $i++)
{
if($files[$i] != '.' && $files[$i] != '..' && is_dir($base . $files[$i]) && @file_exists($base . $files[$i] . '/style.cfg'))
{
// found directory with style
$data = file_get_contents($base . $files[$i] . '/style.cfg');
if(strpos($data, 'mobile = 1') !== false && ($pos = strpos($data, 'name = ')) !== false)
{
$list = explode("\n", substr($data, $pos + 7), 2);
$name = trim($list[0]);
// found style
$sql2 = str_replace('s.style_id = ' . $style, 's.style_name = \'' . $db->sql_escape($name) . '\'', $sql);
$result = $db->sql_query($sql2, 3600);
$this->theme = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if($this->theme !== false)
{
define('MOBILE_STYLE', true);
return false;
}
}
}
}
return true;
}
// MOD end: Mobile/SEO style
Un forum simplu pentru toti, si pentru ca parerea ta conteaza!

