MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Revised BSD License for more details.
- Copyright 2004-2007 Cool Dude 2k - http://intdb.sourceforge.net/
- Copyright 2004-2007 Game Maker 2k - http://upload.idb.s1.jcink.com/
+ Copyright 2004-2009 Cool Dude 2k - http://idb.berlios.de/
+ Copyright 2004-2009 Game Maker 2k - http://intdb.sourceforge.net/
- $FileInfo: functions.php - Last Update: 10/05/2007 SVN 115 - Author: cooldude2k $
+ $FileInfo: functions.php - Last Update: 6/07/2009 SVN 262 - Author: cooldude2k $
*/
$File3Name = basename($_SERVER['SCRIPT_NAME']);
if ($File3Name=="functions.php"||$File3Name=="/functions.php") {
if ($_GET['act']=="PHPCredits") { @phpcredits(); exit(); }
if ($_GET['act']=="phpcredits") { @phpcredits(); exit(); }
*/// Connect to mysql database
-function ConnectMysql($sqlhost,$sqluser,$sqlpass,$sqldb) {
+function ConnectMysql($sqlhost,$sqluser,$sqlpass,$sqldb,$retlink=false) {
+if($retlink!==true) { $retlink = false; }
$StatSQL = @mysql_connect($sqlhost,$sqluser,$sqlpass);
$StatBase = @mysql_select_db($sqldb);
if (!$StatSQL) { return false; }
if (!$StatBase) { return false; }
-return true; }
+if($retlink===true) { return $StatSQL; }
+if($retlink===false) { return true; } }
$Names['RS'] = "Renee Sabonis";
define("_renee_", $Names['RS']);
// Change the title and gzip page
/* Change Some PHP Settings Fix the &PHPSESSID to &PHPSESSID */
$SessName = @session_name();
$output = preg_replace("/&PHPSESSID/", "&PHPSESSID", $output);
-$qstrcode = htmlentities($Settings['qstr']);
+$qstrcode = htmlentities($Settings['qstr'], ENT_QUOTES, $Settings['charset']);
$output = str_replace($Settings['qstr'].$SessName, $qstrcode.$SessName, $output);
if($use_gzip!="on") {
echo $output; }
/* Change Some PHP Settings Fix the &PHPSESSID to &PHPSESSID */
$SessName = @session_name();
$output = preg_replace("/&PHPSESSID/", "&PHPSESSID", $output);
-$qstrcode = htmlentities($Settings['qstr']);
+$qstrcode = htmlentities($Settings['qstr'], ENT_QUOTES, $Settings['charset']);
$output = str_replace($Settings['qstr'].$SessName, $qstrcode.$SessName, $output);
if($use_gzip!="on") {
echo $output; }
if($gzip_type=="deflate") {
$goutput = gzcompress($output); }
echo $goutput; } }
-$output = @ob_get_clean();
- $Names['RJ'] = "René Johnson";
+ $Names['RJ'] = "Kazuki Przyborowski";
define("_rene_", $Names['RJ']);
// GZip page for faster download
function gzip_page($use_gzip="off",$gzip_type="gzip") {
$goutput = gzcompress($output); }
echo $goutput; } }
$foo="bar"; $$foo="foo";
+if(function_exists('mysql_set_charset')===false) {
+function mysql_set_charset($charset) {
+ mysql_query("SET CHARACTER SET '".$charset."'");
+ mysql_query("SET NAMES '".$charset."'");
+ return true; } }
// SafeSQL Lite Source Code by Cool Dude 2k
// Make SQL Query's safe
function query($query_string,$query_vars) {
++$query_i; }
$query_val[0] = $query_string;
return call_user_func_array("sprintf",$query_val); }
+ $Names['KP'] = "Kazuki Przyborowski";
+define("_kazuki_", $Names['KP']);
// Kill bad vars for some functions
function killbadvars($varname) {
$badphp1 = array('$'); $badphp2 = array(null);
$varname = preg_replace("/(HTTP_COOKIE_VARS|HTTP_SESSION_VARS)/i", null, $varname);
$varname = preg_replace("/(HTTP_GET_VARS|HTTP_POST_VARS|HTTP_POST_FILES)/i", null, $varname);
return $varname; }
+// Trying to fix this bug. ^_^
+// http://xforce.iss.net/xforce/xfdb/49697
+if(!isset($Settings['DefaultTheme'])) {
+ $Settings['DefaultTheme'] = "iDB"; }
+$BoardTheme = $Settings['DefaultTheme'];
+function chack_themes($theme) {
+global $BoardTheme;
+if(!isset($theme)) { $theme = null; }
+require('settings.php');
+$ckskindir = dirname(realpath("settings.php"))."/".$SettDir['themes'];
+if ($handle = opendir($ckskindir)) { $dirnum = null;
+ while (false !== ($ckfile = readdir($handle))) {
+ if ($dirnum==null) { $dirnum = 0; }
+ if (file_exists($ckskindir.$ckfile."/info.php")) {
+ if ($ckfile != "." && $ckfile != "..") {
+ include($ckskindir.$ckfile."/info.php");
+ $cktheme[$dirnum] = $ckfile;
+ ++$dirnum; } } }
+ closedir($handle); asort($cktheme); }
+$theme=preg_replace("/(.*?)\.\/(.*?)/", $BoardTheme, $theme);
+if(!in_array($theme,$cktheme)||strlen($theme)>26) {
+ $theme = $BoardTheme; } return $theme; }
// Change the text to icons(smileys)
function text2icons($Text,$sqlt) {
global $Settings;
$getnextid = mysql_fetch_assoc($getnextidr);
return $getnextid['Auto_increment'];
@mysql_free_result($getnextidr); }
+function getnumrows($tablepre,$table) {
+ $getnextidq = query("SHOW TABLE STATUS LIKE '".$tablepre.$table."'", array());
+ $getnextidr = mysql_query($getnextidq);
+ $getnextid = mysql_fetch_assoc($getnextidr);
+ return $getnextid['Rows'];
+ @mysql_free_result($getnextidr); }
$Names['K'] = "Katarzyna";
define("_katarzyna_", $Names['K']);
// Change Time Stamp to a readable time
$TCMonth = date("n",$timestamp);
$TCDay = date("d",$timestamp);
$TCYear = date("Y",$timestamp);
-unset($dstake); $dstake = null;
+$dstake = null;
if(!is_numeric($minoffset)) { $minoffset = "00"; }
$ts_array = explode(":",$offset);
if(count($ts_array)!=2) {
function GMTimeGet($format,$offset,$minoffset=null,$dst=null) {
return GMTimeChange($format,GMTimeStamp(),$offset,$minoffset,$dst); }
function GMTimeGetS($format,$offset,$minoffset=null,$dst=null) {
-unset($dstake); $dstake = null;
+$dstake = null;
if(!is_numeric($offset)) { $offset = "0"; }
if(!is_numeric($minoffset)) { $minoffset = "00"; }
$ts_array = explode(":",$offset);
fclose($cpfp);
return true; }
/* str_ireplace for PHP below ver. 5 updated //
-// by René Johnson - Cool Dude 2k //
-// and upaded by René Johnson again */
+// by Kazuki Przyborowski - Cool Dude 2k //
+// and upaded by Kazuki Przyborowski again */
if(!function_exists('str_ireplace')) {
function str_ireplace($search,$replace,$subject) {
if(!is_array($search)&&is_array($replace)) {
$search = preg_quote($search, "/");
$subject = preg_replace("/".$search."/i", $replace, $subject); }
return $subject; } }
+/* Adds mysql_set_charset to PHP below Ver. 5.2.3 - by: Janez R. //
+// http://us.php.net/manual/en/function.mysql-set-charset.php#77565 */
+if (!function_exists('mysql_set_charset')) {
+ function mysql_set_charset($charset) {
+ return mysql_query("set names $charset"); } }
/* Adds httponly to PHP below Ver. 5.2.0 //
-// by René Johnson - Cool Dude 2k */
+// by Kazuki Przyborowski - Cool Dude 2k */
function http_set_cookie($name,$value=null,$expire=null,$path=null,$domain=null,$secure=false,$httponly=false) {
$mkcookie = null; $expireGMT = null;
if(!isset($name)) { echo "Error: You need to enter a name for cookie."; return false; }
$mkcookie = $mkcookie."; expires=".$expireGMT;
if(isset($path)&&$path!=null) { $mkcookie = $mkcookie."; path=".$path; }
if(isset($domain)&&$domain!=null) { $mkcookie = $mkcookie."; domain=".$domain; }
- if(isset($secure)&&$secure==true) { $mkcookie = $mkcookie."; secure"; }
- if(isset($httponly)&&$httponly==true) { $mkcookie = $mkcookie."; HttpOnly"; }
+ if(isset($secure)&&$secure===true) { $mkcookie = $mkcookie."; secure"; }
+ if(isset($httponly)&&$httponly===true) { $mkcookie = $mkcookie."; HttpOnly"; }
header($mkcookie, false); return true; } }
$foobar="fubar"; $$foobar="foobar";
// Debug info