MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Revised BSD License for more details.
- Copyright 2004-2011 iDB Support - http://idb.berlios.de/
- Copyright 2004-2011 Game Maker 2k - http://gamemaker2k.org/
+ Copyright 2004-2019 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
+ Copyright 2004-2019 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
- $FileInfo: sql.php - Last Update: 09/29/2011 SVN 760 - Author: cooldude2k $
+ $FileInfo: sql.php - Last Update: 4/8/2022 SVN 947 - Author: cooldude2k $
*/
/* Some ini setting changes uncomment if you need them.
Display PHP Errors */
//@ini_set("log_errors","On");
@ini_set("docref_ext", "");
@ini_set("docref_root", "http://php.net/"); }
-@error_reporting(E_ALL ^ E_NOTICE);
+if(!defined("E_DEPRECATED")) { define("E_DEPRECATED", 0); }
+@error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
/* Get rid of session id in urls */
if(!in_array("ini_set", $disfunc)) {
-@ini_set("date.timezone","UTC");
@ini_set("default_mimetype","text/html");
@ini_set("zlib.output_compression", false);
@ini_set("zlib.output_compression_level", -1);
ini_set("arg_separator.output",htmlentities($Settings['qstr'], ENT_QUOTES, $Settings['charset']));
ini_set("arg_separator.input",$Settings['qstr']); } }
if(!isset($Settings['idburl'])) { $Settings['idburl'] = null; }
+if(isset($Settings['BoardUUID'])) { $Settings['BoardUUID'] = base64_decode($Settings['BoardUUID']);
+header("Board-Unique-ID: ".$Settings['BoardUUID']); }
+function unparse_url($parsed_url) {
+ $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
+ $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
+ $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
+ $user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
+ $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
+ $pass = ($user || $pass) ? "$pass@" : '';
+ $path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
+ $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
+ $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
+ return $scheme.$user.$pass.$host.$port.$path.$query.$fragment;
+}
+$OrgBoardURL = $Settings['idburl'];
+if(isset($Settings['idburl'])) {
+$PreBestURL = parse_url($Settings['idburl']); }
+$PreServURL = parse_url((isset($_SERVER['HTTPS']) ? "https" : "http") . "://".$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1));
+if(isset($PreBestURL['host'])&&$PreBestURL['host']=="localhost.url"&&str_replace("/", "", $PreBestURL['path'])=="localpath") {
+ $PreBestURL['host'] = "localhost";
+ $PreBestURL['path'] = $PreServURL['path'];
+ $Settings['idburl'] = unparse_url($PreBestURL); }
+if(isset($PreBestURL['host'])&&$PreBestURL['host']=="localhost.url"&&str_replace("/", "", $PreBestURL['path'])!="localpath") {
+ $PreBestURL['host'] = $PreServURL['host'];
+ $Settings['idburl'] = unparse_url($PreBestURL); }
+if(isset($PreBestURL['host'])&&$PreBestURL['host']!="localhost.url"&&str_replace("/", "", $PreBestURL['path'])=="localpath") {
+ $PreBestURL['path'] = $PreServURL['path'];
+ $Settings['idburl'] = unparse_url($PreBestURL); }
+$OrgWebSiteURL = $Settings['weburl'];
+if(isset($Settings['idburl'])) {
+$PreWestURL = parse_url($Settings['weburl']); }
+if(isset($PreWestURL['host'])&&$PreWestURL['host']=="localhost.url"&&str_replace("/", "", $PreWestURL['path'])=="localpath") {
+ $PreWestURL['host'] = $PreServURL['host'];
+ $PreWestURL['path'] = $PreServURL['path'];
+ $Settings['weburl'] = unparse_url($PreWestURL); }
+if(isset($PreWestURL['host'])&&$PreWestURL['host']=="localhost.url"&&str_replace("/", "", $PreWestURL['path'])!="localpath") {
+ $PreWestURL['host'] = $PreServURL['host'];
+ $Settings['weburl'] = unparse_url($PreWestURL); }
+if(isset($PreWestURL['host'])&&$PreWestURL['host']!="localhost.url"&&str_replace("/", "", $PreWestURL['path'])=="localpath") {
+ $PreWestURL['path'] = $PreServURL['path'];
+ $Settings['weburl'] = unparse_url($PreWestURL); }
if(!isset($Settings['fixbasedir'])) { $Settings['fixbasedir'] = null; }
if(!isset($Settings['fixpathinfo'])) { $Settings['fixpathinfo'] = null; }
if(!isset($Settings['fixcookiedir'])) { $Settings['fixcookiedir'] = null; }
$Settings['showverinfo'] = "on"; }
if(!isset($Settings['sqldb'])) {
header("Content-Type: text/plain; charset=UTF-8");
-header('Location: install.php'); }
+header('Location: install.php?act=Part1'); }
if(!isset($Settings['fixpathinfo'])) {
$Settings['fixpathinfo'] = "off"; }
if($Settings['fixpathinfo']=="off") {
@ini_set('default_charset', $Settings['charset']); }
//session_save_path($SettDir['inc']."temp/");
if(!isset($Settings['sqldb'])) {
-if(file_exists("install.php")) { header('Location: install.php'); die(); }
+if(file_exists("install.php")) { header('Location: install.php?act=Part1'); die(); }
if(!file_exists("install.php")) { header("Content-Type: text/plain; charset=UTF-8");
echo "403 Error: Sorry could not find install.php\nTry uploading files again and if that dose not work try download iDB again."; die(); } }
-if(isset($Settings['sqldb'])&&
- function_exists("date_default_timezone_set")) {
- @date_default_timezone_set("UTC"); }
+if(isset($Settings['sqldb'])) {
+ $deftz = new DateTimeZone(date_default_timezone_get());
+ $defcurtime = new DateTime();
+ $defcurtime->setTimezone($deftz);
+ $utctz = new DateTimeZone("UTC");
+ $utccurtime = new DateTime();
+ $utccurtime->setTimestamp($defcurtime->getTimestamp());
+ $utccurtime->setTimezone($utctz);
+ $servtz = new DateTimeZone($Settings['DefaultTimeZone']);
+ $servcurtime = new DateTime();
+ $servcurtime->setTimestamp($defcurtime->getTimestamp());
+ $servcurtime->setTimezone($servtz);
+ $usercurtime = new DateTime();
+ $usercurtime->setTimestamp($defcurtime->getTimestamp()); }
if(!isset($Settings['sqlhost'])) { $Settings['sqlhost'] = "localhost"; }
if($Settings['fixpathinfo']=="on") {
$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
if(!isset($SettDir['admin'])) { $SettDir['admin'] = "inc/admin/"; }
if(!isset($SettDir['sqldumper'])) { $SettDir['sqldumper'] = "inc/admin/sqldumper/"; }
if(!isset($SettDir['mod'])) { $SettDir['mod'] = "inc/mod/"; }
+if(!isset($SettDir['mplayer'])) { $SettDir['mplayer'] = "inc/mplayer/"; }
if(!isset($SettDir['themes'])) { $SettDir['themes'] = "themes/"; }
if(!isset($SettDir['maindir'])||!file_exists($SettDir['maindir'])||!is_dir($SettDir['maindir'])) {
$SettDir['maindir'] = addslashes(str_replace("\\","/",dirname(__FILE__)."/")); }
$Settings['use_hashtype'] = "sha1"; }
if(!function_exists('hash')||!function_exists('hash_algos')) {
if($Settings['use_hashtype']!="md5"&&
- $Settings['use_hashtype']!="sha1") {
+ $Settings['use_hashtype']!="sha1"&&
+ $Settings['use_hashtype']!="bcrypt") {
$Settings['use_hashtype'] = "sha1"; } }
-if(function_exists('hash')&&function_exists('hash_algos')) {
-if(!in_array($Settings['use_hashtype'],hash_algos())) {
+if((function_exists('hash')&&function_exists('hash_algos'))||function_exists('password_hash')) {
+if(!in_array($Settings['use_hashtype'],hash_algos())&&$Settings['use_hashtype']!="bcrypt") {
$Settings['use_hashtype'] = "sha1"; }
if($Settings['use_hashtype']!="md2"&&
$Settings['use_hashtype']!="md4"&&
$Settings['use_hashtype']!="sha256"&&
$Settings['use_hashtype']!="sha384"&&
$Settings['use_hashtype']!="sha512"&&
+ $Settings['use_hashtype']!="sha3-224"&&
+ $Settings['use_hashtype']!="sha3-256"&&
+ $Settings['use_hashtype']!="sha3-384"&&
+ $Settings['use_hashtype']!="sha3-512"&&
$Settings['use_hashtype']!="ripemd128"&&
$Settings['use_hashtype']!="ripemd160"&&
$Settings['use_hashtype']!="ripemd256"&&
$Settings['use_hashtype']!="ripemd320"&&
- $Settings['use_hashtype']!="salsa10"&&
- $Settings['use_hashtype']!="salsa20"&&
- $Settings['use_hashtype']!="snefru"&&
- $Settings['use_hashtype']!="snefru256"&&
- $Settings['use_hashtype']!="gost"&&
- $Settings['use_hashtype']!="joaat"&&
- $Settings['use_hashtype']!="fnv132"&&
- $Settings['use_hashtype']!="fnv164") {
+ $Settings['use_hashtype']!="bcrypt") {
$Settings['use_hashtype'] = "sha1"; } }
// Check to see if variables are set
require_once($SettDir['misc'].'setcheck.php');
@ini_set('default_charset', $Settings['charset']); }
$File1Name = dirname($_SERVER['SCRIPT_NAME'])."/";
$File2Name = $_SERVER['SCRIPT_NAME'];
-$File3Name=str_replace($File1Name, null, $File2Name);
+/*$File3Name=str_replace($File1Name, null, $File2Name);
if ($File3Name=="sql.php"||$File3Name=="/sql.php") {
header('Location: index.php');
- exit(); }
+ exit(); }*/
+$File3Name = basename($_SERVER['SCRIPT_NAME']);
+if ($File3Name=="sql.php"||$File3Name=="/sql.php") {
+ header('Location: index.php');
+ exit(); }
//error_reporting(E_ERROR);
// Check if gzip is on and if user's browser can accept gzip pages
if($_GET['act']=="MkCaptcha"||$_GET['act']=="Captcha") {
$Settings['use_gzip'] = 'off'; }
if($Settings['use_gzip']=="on") {
-if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "gzip")) {
- $GZipEncode['Type'] = "gzip"; } else {
- if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "deflate")) {
- $GZipEncode['Type'] = "deflate"; } else {
- $Settings['use_gzip'] = "off"; $GZipEncode['Type'] = "none"; } } }
+if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "br")&&function_exists('brotli_compress')) {
+ $GZipEncode['Type'] = "brotli"; } else {
+ if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "gzip")) {
+ $GZipEncode['Type'] = "gzip"; } else {
+ if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "deflate")) {
+ $GZipEncode['Type'] = "deflate"; } else {
+ $Settings['use_gzip'] = "off"; $GZipEncode['Type'] = "none"; } } } }
+if($Settings['use_gzip']=="brotli"&&function_exists('brotli_compress')) {
+if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "br")) { $Settings['use_brotli'] = "on";
+ $GZipEncode['Type'] = "brotli"; } else { $Settings['use_gzip'] = "off"; } }
+if($Settings['use_gzip']=="brotli"&&!function_exists('brotli_compress')) { $GZipEncode['Type'] = "gzip"; }
if($Settings['use_gzip']=="gzip") {
if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "gzip")) { $Settings['use_gzip'] = "on";
$GZipEncode['Type'] = "gzip"; } else { $Settings['use_gzip'] = "off"; } }
$Settings['sql_charset'] = "latin1"; }
if($Settings['sql_collate']=="utf8_bin"||
$Settings['sql_collate']=="utf8_general_ci"||
- $Settings['sql_collate']=="utf8_unicode_ci") {
+ $Settings['sql_collate']=="utf8_unicode_ci"||
+ $Settings['sql_collate']=="utf8mb4_bin"||
+ $Settings['sql_collate']=="utf8mb4_general_ci"||
+ $Settings['sql_collate']=="utf8mb4_unicode_ci") {
$Settings['sql_charset'] = "utf8"; } }
if(isset($Settings['sql_collate'])&&isset($Settings['sql_charset'])) {
if($Settings['sql_charset']=="ascii") {
$Settings['sql_collate']!="latin1_general_ci"&&
$Settings['sql_collate']!="latin1_general_cs") {
$Settings['sql_collate'] = "latin1_general_ci"; } }
- if($Settings['sql_charset']=="utf8") {
+ if($Settings['sql_charset']=="utf8" || $Settings['sql_charset']=="utf8mb4") {
if($Settings['sql_collate']!="utf8_bin"&&
$Settings['sql_collate']!="utf8_general_ci"&&
- $Settings['sql_collate']!="utf8_unicode_ci") {
- $Settings['sql_collate'] = "utf8_unicode_ci"; } }
+ $Settings['sql_collate']!="utf8_unicode_ci"&&
+ $Settings['sql_collate']!="utf8mb4_bin"&&
+ $Settings['sql_collate']!="utf8mb4_general_ci"&&
+ $Settings['sql_collate']!="utf8mb4_unicode_ci") {
+ $Settings['sql_collate'] = "utf8mb4_unicode_ci"; } }
+ if($Settings['sql_collate']=="utf8_bin"||
+ $Settings['sql_collate']=="utf8_general_ci"||
+ $Settings['sql_collate']=="utf8_unicode_ci") {
+ $Settings['sql_charset'] = "utf8"; }
+ if($Settings['sql_collate']=="utf8mb4_bin"||
+ $Settings['sql_collate']=="utf8mb4_general_ci"||
+ $Settings['sql_collate']=="utf8mb4_unicode_ci") {
+ $Settings['sql_charset'] = "utf8mb4"; }
$SQLCollate = $Settings['sql_collate'];
$SQLCharset = $Settings['sql_charset']; }
if(!isset($Settings['sql_collate'])||!isset($Settings['sql_charset'])) {
$SQLCollate = "latin1_general_ci";
$SQLCharset = "latin1"; }
if($Settings['charset']=="UTF-8") {
- $SQLCollate = "utf8_unicode_ci";
- $SQLCharset = "utf8"; }
+ $SQLCollate = "utf8mb4_unicode_ci";
+ $SQLCharset = "utf8mb4"; }
$Settings['sql_collate'] = $SQLCollate;
$Settings['sql_charset'] = $SQLCharset; }
sql_set_charset($SQLCharset,$SQLStat);
$MkIndexFile = $exfile['index'].$Settings['file_ext']; }
if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
$MkIndexFile = $exfile['index']; }
-$temp_session_data = "ViewingPage|s:9:\"?act=view\";ViewingFile|s:".strlen($MkIndexFile).":\"".$MkIndexFile."\";PreViewingTitle|s:7:\"Viewing\";ViewingTitle|s:11:\"Board index\";UserID|s:1:\"0\";UserIP|s:".strlen($_SERVER['REMOTE_ADDR']).":\"".$_SERVER['REMOTE_ADDR']."\";UserGroup|s:".strlen($Settings['GuestGroup']).":\"".$Settings['GuestGroup']."\";UserGroupID|s:1:\"4\";UserTimeZone|s:".strlen($Settings['DefaultTimeZone']).":\"".$Settings['DefaultTimeZone']."\";UserDST|s:".strlen($Settings['DefaultDST']).":\"".$Settings['DefaultDST']."\";";
+$temp_session_data = "ViewingPage|s:9:\"?act=view\";ViewingFile|s:".strlen($MkIndexFile).":\"".$MkIndexFile."\";PreViewingTitle|s:7:\"Viewing\";ViewingTitle|s:11:\"Board index\";UserID|s:1:\"0\";UserIP|s:".strlen($_SERVER['REMOTE_ADDR']).":\"".$_SERVER['REMOTE_ADDR']."\";UserGroup|s:".strlen($Settings['GuestGroup']).":\"".$Settings['GuestGroup']."\";UserGroupID|s:1:\"4\";UserTimeZone|s:".strlen($Settings['DefaultTimeZone']).":\"".$Settings['DefaultTimeZone']."\";";
$alt_temp_session_data['ViewingPage'] = "?act=view";
$alt_temp_session_data['ViewingFile'] = $MkIndexFile;
$alt_temp_session_data['PreViewingTitle'] = "Viewing";
$alt_temp_session_data['UserIP'] = $_SERVER['REMOTE_ADDR'];
$alt_temp_session_data['UserGroupID'] = "4";
$alt_temp_session_data['UserTimeZone'] = $Settings['DefaultTimeZone'];
-$alt_temp_session_data['UserDST'] = $Settings['DefaultDST'];
$alttemp_session_data = serialize($alt_temp_session_data);
$alt_temp_session_data = $alttemp_session_data;
$alttemp_session_data = null;
$result = sql_query(sql_pre_query("SELECT * FROM \"".$sqltable."sessions\" WHERE \"session_id\" = '%s'", array($id)),$SQLStat);
if (!sql_num_rows($result)) {
sql_query(sql_pre_query("DELETE FROM \"".$sqltable."sessions\" WHERE \"session_id\"<>'%s' AND \"ip_address\"='%s' AND \"user_agent\"='%s'", array($id,$temp_user_ip,$temp_user_agent)),$SQLStat);
-$time = GMTimeStamp();
+$utctz = new DateTimeZone("UTC");
+$utccurtime = new DateTime();
+$utccurtime->setTimezone($utctz);
+$time = $utccurtime->getTimestamp();
sql_query(sql_pre_query("INSERT INTO \"".$sqltable."sessions\" (\"session_id\", \"session_data\", \"serialized_data\", \"user_agent\", \"ip_address\", \"expires\") VALUES\n".
"('%s', '%s', '%s', '%s', '%s', %i)", array($id,$temp_session_data,$alt_temp_session_data,$temp_user_agent,$temp_user_ip,$time)),$SQLStat);
return '';
} else {
-$time = GMTimeStamp();
+$utctz = new DateTimeZone("UTC");
+$utccurtime = new DateTime();
+$utccurtime->setTimezone($utctz);
+$time = $utccurtime->getTimestamp();
$predata = sql_num_rows($result);
$data = "";
if($predata > 0) {
//Session Write Function
function sql_session_write($id,$data) {
global $sqltable,$SQLStat,$SQLSType,$temp_user_ip,$temp_user_agent;
-$time = GMTimeStamp();
+$utctz = new DateTimeZone("UTC");
+$utccurtime = new DateTime();
+$utccurtime->setTimezone($utctz);
+$time = $utccurtime->getTimestamp();
$rs = sql_query(sql_pre_query("UPDATE \"".$sqltable."sessions\" SET \"session_data\"='%s',\"serialized_data\"='%s',\"user_agent\"='%s',\"ip_address\"='%s',\"expires\"=%i WHERE \"session_id\"='%s'", array($data,serialize($_SESSION),$temp_user_agent,$temp_user_ip,$time,$id)),$SQLStat);
return true; }
//Session Destroy Function
//Session Garbage Collection Function
function sql_session_gc($maxlifetime) {
global $sqltable,$SQLStat;
-$time = GMTimeStamp() - $maxlifetime;
+$utctz = new DateTimeZone("UTC");
+$utccurtime = new DateTime();
+$utccurtime->setTimezone($utctz);
+$time = $utccurtime->getTimestamp() - $maxlifetime;
//sql_query(sql_pre_query('DELETE FROM \"'.$sqltable.'sessions\" WHERE \"expires\" < UNIX_TIMESTAMP();', array(null)),$SQLStat);
sql_query(sql_pre_query("DELETE FROM \"".$sqltable."sessions\" WHERE \"expires\" < %i", array($time)),$SQLStat);
return true; }
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
if(!isset($_COOKIE[$Settings['sqltable']."sess"])) {
-$exptime = GMTimeStamp() - ini_get("session.gc_maxlifetime");
+$exptime = $utccurtime->getTimestamp() - ini_get("session.gc_maxlifetime");
sql_query(sql_pre_query("DELETE FROM \"".$Settings['sqltable']."sessions\" WHERE \"expires\" < %i OR \"ip_address\"='%s' AND \"user_agent\"='%s'", array($exptime,$temp_user_ip,$temp_user_agent)),$SQLStat); }
if(!isset($_SESSION['CheckCookie'])) {
if(isset($_COOKIE['SessPass'])&&isset($_COOKIE['MemberName'])) {
session_set_save_handler("sql_session_open", "sql_session_close", "sql_session_read", "sql_session_write", "sql_session_destroy", "sql_session_gc");
session_name($Settings['sqltable']."sess");
-session_start();
+if (version_compare(phpversion(), '7.0', '<')) { session_start(); } else {
+session_start([
+ 'use_trans_sid' => false,
+ 'use_cookies' => true,
+ 'use_only_cookies' => true,
+ 'gc_probability' => 1,
+ 'gc_divisor' => 100,
+ 'gc_maxlifetime' => 1440,
+ //'hash_function' => 1,
+ //'hash_bits_per_character' => 6,
+ 'name' => $Settings['sqltable']."sess",
+]); }
if(!isset($_SESSION['UserFormID'])) { $_SESSION['UserFormID'] = null; }
$iDBSessCloseDB = false;
$_SESSION['ShowActHidden'] = "no";
session_write_close(); } }
session_set_save_handler("sql_session_open", "sql_session_close", "sql_session_read", "sql_session_write", "sql_session_destroy", "sql_session_gc");
session_name($Settings['sqltable']."sess");
-session_start();
+if (version_compare(phpversion(), '7.0', '<')) { session_start(); } else {
+session_start([
+ 'use_trans_sid' => false,
+ 'use_cookies' => true,
+ 'use_only_cookies' => true,
+ 'gc_probability' => 1,
+ 'gc_divisor' => 100,
+ 'gc_maxlifetime' => 1440,
+ //'hash_function' => 1,
+ //'hash_bits_per_character' => 6,
+ 'name' => $Settings['sqltable']."sess",
+]); }
if(!isset($_SESSION['UserFormID'])) { $_SESSION['UserFormID'] = null; }
$iDBSessCloseDB = true;
output_reset_rewrite_vars();
"From: ".$isiteurl."\r\n".
"Via: ".$_SERVER['REMOTE_ADDR']."\r\n".
"Forwarded: ".$_SERVER['REMOTE_ADDR']."\r\n".
+ "X-Real-IP: ".$_SERVER['REMOTE_ADDR']."\r\n".
"X-Forwarded-For: ".$_SERVER['REMOTE_ADDR']."\r\n".
+ "X-Forwarded-Host: ".$URLsTest['host']."\r\n".
+ "X-Forwarded-Proto: ".$URLsTest['scheme']."\r\n".
+ "Board-Unique-ID: ".$Settings['BoardUUID']."\r\n".
"Client-IP: ".$_SERVER['REMOTE_ADDR']."\r\n"
)
);
if($_GET['act']=="MkCaptcha"||$_GET['act']=="Captcha") {
if($Settings['captcha_clean']=="on") { ob_clean(); }
require($SettDir['inc']."captcha.php");
- $aFonts = array('inc/fonts/VeraBd.ttf', 'inc/fonts/VeraBI.ttf', 'inc/fonts/VeraIt.ttf', 'inc/fonts/Vera.ttf');
+ $aFontDir = dirname(__FILE__)."/inc/fonts/";
+ $aFonts = array($aFontDir.'VeraBd.ttf', $aFontDir.'VeraBI.ttf', $aFontDir.'VeraIt.ttf', $aFontDir.'Vera.ttf');
$oPhpCaptcha = new PhpCaptcha($aFonts, 200, 60);
$RNumSize = rand(7,17); $i=0; $RandNum = null;
while ($i <= $RNumSize) {
if(isset($Settings['DefaultTimeZone'])) {
$_SESSION['UserTimeZone'] = $Settings['DefaultTimeZone'];
if(!isset($Settings['DefaultTimeZone'])) {
- $_SESSION['UserTimeZone'] = SeverOffSet().":00"; } } }
-$checktime = explode(":",$_SESSION['UserTimeZone']);
-if(count($checktime)!=2) {
- if(!isset($checktime[0])) { $checktime[0] = "0"; }
- if(!isset($checktime[1])) { $checktime[1] = "00"; }
- $_SESSION['UserTimeZone'] = $checktime[0].":".$checktime[1]; }
-if(!is_numeric($checktime[0])) { $checktime[0] = "0"; }
-if(!is_numeric($checktime[1])) { $checktime[1] = "00"; }
-if($checktime[1]<0) { $checktime[1] = "00"; $_SESSION['UserTimeZone'] = $checktime[0].":".$checktime[1]; }
-$checktimea = array("offset" => $_SESSION['UserTimeZone'], "hour" => $checktime[0], "minute" => $checktime[1]);
-if(!isset($_SESSION['UserDST'])) { $_SESSION['UserDST'] = null; }
-if($_SESSION['UserDST']==null) {
-if($Settings['DefaultDST']=="off") {
- $_SESSION['UserDST'] = "off"; }
-if($Settings['DefaultDST']=="on") {
- $_SESSION['UserDST'] = "on"; } }
+ $_SESSION['UserTimeZone'] = date_default_timezone_get(); } } }
+$usertz = new DateTimeZone($_SESSION['UserTimeZone']);
+$usercurtime->setTimestamp($defcurtime->getTimestamp());
+$usercurtime->setTimezone($usertz);
// Guest Stuff
if(isset($_SESSION['MemberName'])||
isset($_COOKIE['MemberName'])) {
$_GET['theme']=$Settings['DefaultTheme']; $_SESSION['Theme']=$Settings['DefaultTheme']; }
if (file_exists($SettDir['themes'].$_GET['theme']."/settings.php")) {
if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
-$NewDay=GMTimeStamp();
+$NewDay=$utccurtime->getTimestamp();
$qnewskin = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"UseTheme\"='%s',\"LastActive\"='%s' WHERE \"id\"=%i", array($_GET['theme'],$NewDay,$_SESSION['UserID']));
sql_query($qnewskin,$SQLStat); }
/* The file Theme Exists */ }
$_SESSION['Theme'] = chack_themes($_SESSION['Theme']);
if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
if($OldTheme!=$_SESSION['Theme']) {
-$NewDay=GMTimeStamp();
+$NewDay=$utccurtime->getTimestamp();
$qnewskin = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"UseTheme\"='%s',\"LastActive\"='%s' WHERE \"id\"=%i", array($_SESSION['Theme'],$NewDay,$_SESSION['UserID']));
sql_query($qnewskin,$SQLStat); } }
$_GET['theme']=$_SESSION['Theme']; }
$_GET['theme'] = $Settings['DefaultTheme'];
$_SESSION['Theme'] = $Settings['DefaultTheme'];
if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
-$NewDay=GMTimeStamp();
+$NewDay=$utccurtime->getTimestamp();
$qnewskin = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"UseTheme\"='%s',\"LastActive\"='%s' WHERE \"id\"=%i", array($_SESSION['Theme'],$NewDay,$_SESSION['UserID']));
sql_query($qnewskin,$SQLStat); }
$themequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."themes\" WHERE \"Name\"='%s'", array($_GET['theme']));
if($_SESSION['Theme']!=null) {
$_GET['theme'] = $_SESSION['Theme']; } }
if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
-$NewDay=GMTimeStamp();
+$NewDay=$utccurtime->getTimestamp();
$qnewskin = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"UseTheme\"='%s',\"LastActive\"='%s' WHERE \"id\"=%i", array($_GET['theme'],$NewDay,$_SESSION['UserID']));
sql_query($qnewskin,$SQLStat); } }
require($SettDir['inc'].'sqlthemes.php');
if(!isset($ThemeSet[$matches[1]])) { $return_text = null; }
return $return_text; }
foreach($ThemeSet AS $key => $value) {
+ if(isset($ThemeSet[$key])) {
$ThemeSet[$key] = preg_replace("/%%/s", "{percent}p", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}T/s", "get_theme_values", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}e/s", "get_env_values", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}i/s", "get_server_values", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}s/s", "get_setting_values", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}t/s", "get_time", $ThemeSet[$key]);
- $ThemeSet[$key] = preg_replace("/\{percent\}p/s", "%", $ThemeSet[$key]); }
+ $ThemeSet[$key] = preg_replace("/\{percent\}p/s", "%", $ThemeSet[$key]); } }
if(!isset($ThemeSet['TableStyle'])) {
$ThemeSet['TableStyle'] = "table"; }
if(isset($ThemeSet['TableStyle'])) {