|
From: Florin C B. <ory...@us...> - 2012-10-08 08:46:04
|
Update of /cvsroot/mxbb/core/includes
In directory vz-cvs-4.sog:/tmp/cvs-serv13344
Modified Files:
mx_functions.php
Log Message:
Index: mx_functions.php
===================================================================
RCS file: /cvsroot/mxbb/core/includes/mx_functions.php,v
retrieving revision 1.106
retrieving revision 1.107
diff -C2 -d -r1.106 -r1.107
*** mx_functions.php 6 Dec 2011 10:00:22 -0000 1.106
--- mx_functions.php 8 Oct 2012 08:46:02 -0000 1.107
***************
*** 40,44 ****
static $msg_history;
!
$default_lang = ($mx_user->lang['default_lang']) ? $mx_user->lang['default_lang'] : $board_config['default_lang'];
--- 40,44 ----
static $msg_history;
!
$default_lang = ($mx_user->lang['default_lang']) ? $mx_user->lang['default_lang'] : $board_config['default_lang'];
***************
*** 46,51 ****
{
$msg_history = array();
! }
!
$msg_history[] = array(
'msg_code' => $msg_code,
--- 46,51 ----
{
$msg_history = array();
! }
!
$msg_history[] = array(
'msg_code' => $msg_code,
***************
*** 56,63 ****
'sql' => $sql
);
-
- //
- //This will check whaever we are installing
- //
if(defined('HAS_DIED'))
--- 56,59 ----
***************
*** 76,80 ****
$custom_error_message = sprintf($custom_error_message, '', '');
}
! echo "<html>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n<body>\n<b>Critical Error!</b><br />\nmx_message_die() was called multiple times.<br /> <hr />";
for( $i = 0; $i < count($msg_history); $i++ )
{
--- 72,76 ----
$custom_error_message = sprintf($custom_error_message, '', '');
}
! echo "<html>\n<body>\n<b>Critical Error!</b><br />\nmx_message_die() was called multiple times.<br /> <hr />";
for( $i = 0; $i < count($msg_history); $i++ )
{
***************
*** 95,103 ****
echo " <hr />\n";
}
! echo $custom_error_message . '<hr /><br clear="all" />';
die("</body>\n</html>");
}
!
define('HAS_DIED', 1);
$sql_store = $sql;
--- 91,100 ----
echo " <hr />\n";
}
! echo $custom_error_message . '<hr /><br clear="all">';
die("</body>\n</html>");
}
!
define('HAS_DIED', 1);
+
$sql_store = $sql;
***************
*** 106,110 ****
// subsequent queries from overwriting the status of sql_error()
//
! if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR))
{
$sql_error = $db->sql_error();
--- 103,107 ----
// subsequent queries from overwriting the status of sql_error()
//
! if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) )
{
$sql_error = $db->sql_error();
***************
*** 467,472 ****
$session_id = $_SID;
}
! if (is_array($session_id))
{
$session_id = $mx_user->session_id;
--- 464,474 ----
$session_id = $_SID;
}
+
+ if ( !empty($url) && preg_match('#'.PORTAL_URL.'#', $url) )
+ {
+ $url = preg_replace('#' . PORTAL_URL . '#', '', $url);
+ }
! if ( is_array($session_id) )
{
$session_id = $mx_user->session_id;
***************
*** 549,552 ****
--- 551,559 ----
{
global $SID, $_SID, $mx_mod_rewrite, $userdata;
+
+ if ( !empty($url) && preg_match('#'.PORTAL_URL.'#', $url) )
+ {
+ $url = preg_replace('#' . PORTAL_URL . '#', '', $url);
+ }
// Is mod_rewrite enabled? If so, do some url rewrites...
***************
*** 639,643 ****
if ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) )
{
! header('Refresh: 0; URL=' . PORTAL_URL . $url);
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . PORTAL_URL . $url . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . PORTAL_URL . $url . '">HERE</a> to be redirected</div></body></html>';
exit;
--- 646,651 ----
if ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) )
{
! //header('Refresh: 0; URL=' . PORTAL_URL . $url);
! header('Refresh: 0; URL=' . $url);
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . PORTAL_URL . $url . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . PORTAL_URL . $url . '">HERE</a> to be redirected</div></body></html>';
exit;
***************
*** 645,711 ****
// Behave as per HTTP/1.1 spec for others
! header('Location: ' . PORTAL_URL . $url);
exit;
}
/**
- * Generate portal url (example: http://www.example.com/phpBB)
- * @param bool $without_script_path if set to true the script path gets not appended (example: http://www.example.com)
- */
- function generate_portal_url($without_script_path = false)
- {
- global $board_config, $portal_config, $mx_user;
-
- $script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($portal_config['script_path']));
- $server_name = $mx_user->host ? $mx_user->host : trim($portal_config['server_name']);
- $server_protocol = ( $portal_config['cookie_secure'] ) ? 'https://' : 'http://';
- $server_port = (($portal_config['server_port']) && ($portal_config['server_port'] <> 80)) ? ':' . trim($portal_config['server_port']) . '/' : '/';
- $server_url = $server_protocol . str_replace("//", "/", $server_name . $server_port . $script_name . '/'); //On some server the slash is not added and this trick will fix it
- $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
-
- // Forcing server vars is the only way to specify/override the protocol
- if ($board_config['force_server_vars'] || !$server_name)
- {
- $server_protocol = ($server_protocol) ? $server_protocol : (($portal_config['cookie_secure']) ? 'https://' : 'http://');
- $server_name = $portal_config['server_name'];
- $server_port = (int) $config['server_port'];
- $script_path = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($portal_config['script_path']));
-
- $url = $server_protocol . $server_name;
- $cookie_secure = $portal_config['cookie_secure'];
- }
- else
- {
- // Do not rely on cookie_secure, users seem to think that it means a secured cookie instead of an encrypted connection
- $cookie_secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0;
- $url = (($cookie_secure) ? 'https://' : 'http://') . $server_name;
-
- $script_path = $mx_user->page['root_script_path'];
- }
-
- if ($server_port && (($cookie_secure && $server_port <> 443) || (!$cookie_secure && $server_port <> 80)))
- {
- // HTTP HOST can carry a port number (we fetch $user->host, but for old versions this may be true)
- if (strpos($server_name, ':') === false)
- {
- $url .= ':' . $server_port;
- }
- }
-
- if (!$without_script_path)
- {
- $url .= $script_path;
- }
-
- // Strip / from the end
- if (substr($url, -1, 1) == '/')
- {
- $url = substr($url, 0, -1);
- }
-
- return $url;
- }
-
- /**
* Generate Pagination.
*
--- 653,662 ----
// Behave as per HTTP/1.1 spec for others
! //header('Location: ' . PORTAL_URL . $url);
! header('Location: ' . $url);
exit;
}
/**
* Generate Pagination.
*
***************
*** 1500,1508 ****
$multiple_select_option = 'multiple="multiple"';
}
! else
! {
! $multiple_select_option = '';
! }
!
$column_list = '<select name="' . $name_select . '" '.$multiple_select_option.'>';
if( $type == 'page_list' )
--- 1451,1455 ----
$multiple_select_option = 'multiple="multiple"';
}
!
$column_list = '<select name="' . $name_select . '" '.$multiple_select_option.'>';
if( $type == 'page_list' )
***************
*** 1836,1840 ****
// $do_gzip_compress = FALSE;
! if ($board_config['gzip_compress'] && !defined('MX_GZIP_DISABLED'))
{
$phpver = phpversion();
--- 1783,1787 ----
// $do_gzip_compress = FALSE;
! if ( $board_config['gzip_compress'] && !defined('MX_GZIP_DISABLED') )
{
$phpver = phpversion();
***************
*** 1842,1848 ****
$useragent = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
! if ($phpver >= '4.0.4pl1' && (strstr($useragent,'compatible') || strstr($useragent,'Gecko')))
{
! if (extension_loaded('zlib'))
{
ob_end_clean();
--- 1789,1795 ----
$useragent = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
! if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) )
{
! if ( extension_loaded('zlib') )
{
ob_end_clean();
***************
*** 1850,1858 ****
}
}
! else if ($phpver > '4.0')
{
! if (strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
{
! if (extension_loaded('zlib') )
{
$do_gzip_compress = TRUE;
--- 1797,1805 ----
}
}
! else if ( $phpver > '4.0' )
{
! if ( strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') )
{
! if ( extension_loaded('zlib') )
{
$do_gzip_compress = TRUE;
***************
*** 1869,1875 ****
// Initialize PHP session
//
! //phpinfo();
! session_start();
! //
}
--- 1816,1820 ----
// Initialize PHP session
//
! @session_start();
}
***************
*** 2106,2110 ****
$curicons = 1;
- $posticons = '';
if ( $file_posticon == 'none' || $file_posticon == 'none.gif' or empty( $file_posticon ) )
{
--- 2051,2054 ----
***************
*** 2610,2676 ****
return $message;
}
-
- function mx_clean_string($text)
- {
- global $mx_root_path, $phpEx;
-
- //Unicode control characters
- static $homographs = array();
- if (empty($homographs) && ($homographs = @include($mx_root_path . 'includes/utf/data/confusables.' . $phpEx)))
- {
- $text = @utf8_case_fold_nfkc($text);
- $text = strtr($text, $homographs);
- }
- else
- {
- // ASCI control characters
- $text = preg_replace("/[^[:space:]a-zA-Z0-9åäöÅÄÖ.,-:]/", " ", $text);
- $text = preg_replace("/[^[:space:]a-zA-Z0-9îãâºþÎêÞ.,-:]/", " ", $text);
-
- // we need to reduce multiple spaces to a single one
- $text = preg_replace('/\s+/', ' ', $text);
- }
-
- // Other control characters
- $text = preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $text);
-
- // we need to reduce multiple spaces to a single one
- $text = preg_replace('# {2,}#', ' ', $text);
-
- // we can use trim here as all the other space characters should have been turned
- // into normal ASCII spaces by now
- return trim($text);
- }
-
- /**
- * function eregi
- *
- * temp replacement for eregi()
- *
- *
- */
- if (!@function_exists('eregi'))
- {
- function eregi($find, $str)
- {
- return stristr($str, $find);
- }
- }
-
- /**
- * function ereg
- *
- * temp replacement for ereg()
- *
- *
- */
- /*
- if(!function_exists('ereg'))
- {
- function ereg($pattern, $string, &$array)
- {
- return preg_match('#'.$pattern.'#', $string, $array);
- }
- }
- */
?>
\ No newline at end of file
--- 2554,2556 ----
|