OSDN Git Service

Fixed a bug in (/inc/rssfeed.php).
authorKazuki Przyborowski <kazuki.przyborowski@gmail.com>
Wed, 25 Nov 2009 04:23:23 +0000 (04:23 +0000)
committerKazuki Przyborowski <kazuki.przyborowski@gmail.com>
Wed, 25 Nov 2009 04:23:23 +0000 (04:23 +0000)
Also add function output_error by Howard Yeend.

git-svn-id: svn://svn.code.sf.net/p/intdb/svn/trunk@363 2b68903e-0b30-0410-9a39-a2e4f3c5be39

inc/function.php
inc/misc/functions.php
inc/misc/mysql.php
inc/rssfeed.php
inc/versioninfo.php

index 9782c15..f9b8782 100644 (file)
@@ -11,7 +11,7 @@
     Copyright 2004-2009 iDB Support - http://idb.berlios.de/
     Copyright 2004-2009 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: function.php - Last Update: 11/23/2009 SVN 358 - Author: cooldude2k $
+    $FileInfo: function.php - Last Update: 11/24/2009 SVN 363 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="function.php"||$File3Name=="/function.php") {
@@ -57,6 +57,12 @@ if(!isset($REFERERurl['host'])) { $REFERERurl['host'] = null; }
 $URL['REFERER'] = $REFERERurl['host'];
 $URL['HOST'] = $basecheck['host'];
 $REFERERurl = null;
+// Function made by Howard Yeend
+// http://php.net/manual/en/function.trigger-error.php#92016
+// http://www.puremango.co.uk/
+function output_error($message, $level=E_USER_ERROR) {
+    $caller = next(debug_backtrace());
+    trigger_error($message.' in <strong>'.$caller['function'].'</strong> called from <strong>'.$caller['file'].'</strong> on line <strong>'.$caller['line'].'</strong>'."\n<br />error handler", $level); }
 // http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/
 /**
   * Generates an UUID
@@ -169,7 +175,7 @@ if($type=="location") { header("Location: ".$url); } return true; }
 function html_tag_make($name="br",$emptytag=true,$attbvar=null,$attbval=null,$extratest=null) {
        $var_num = count($attbvar); $value_num = count($attbval);
        if($var_num!=$value_num) { 
-               trigger_error("Erorr Number of Var and Values dont match!",E_USER_ERROR);
+               output_error("Erorr Number of Var and Values dont match!",E_USER_ERROR);
        return false; } $i = 0;
        while ($i < $var_num) {
        if($i==0) { $mytag = "<".$name." ".$attbvar[$i]."=\"".$attbval[$i]."\""; }
index 6b9f16f..75a248c 100644 (file)
@@ -11,7 +11,7 @@
     Copyright 2004-2009 iDB Support - http://idb.berlios.de/
     Copyright 2004-2009 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: functions.php - Last Update: 11/23/2009 SVN 359 - Author: cooldude2k $
+    $FileInfo: functions.php - Last Update: 11/24/2009 SVN 363 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="functions.php"||$File3Name=="/functions.php") {
@@ -411,10 +411,10 @@ return $subject; } }
 function http_set_cookie($name,$value=null,$expire=null,$path=null,$domain=null,$secure=false,$httponly=false) {
        $mkcookie = null; $expireGMT = null;
        if(!isset($name)) { 
-       trigger_error("Error: You need to enter a name for cookie.",E_USER_ERROR); 
+       output_error("Error: You need to enter a name for cookie.",E_USER_ERROR); 
        return false; }
        if(!isset($expire)) { 
-       trigger_error("Error: You need to enter a time for cookie to expire.",E_USER_ERROR); 
+       output_error("Error: You need to enter a time for cookie to expire.",E_USER_ERROR); 
        return false; }
        $expireGMT = gmdate("D, d-M-Y H:i:s \G\M\T", $expire);
        if(!isset($value)) { $value = null; }
index 862b27b..db61bf2 100644 (file)
@@ -11,7 +11,7 @@
     Copyright 2004-2009 iDB Support - http://idb.berlios.de/
     Copyright 2004-2009 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: mysql.php - Last Update: 11/23/2009 SVN 360 - Author: cooldude2k $
+    $FileInfo: mysql.php - Last Update: 11/24/2009 SVN 363 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="mysql.php"||$File3Name=="/mysql.php") {
@@ -55,7 +55,7 @@ if(isset($link)) {
 if(!isset($link)) {
        $result = mysql_query($query); }
 if ($result===false) {
-    trigger_error("Invalid query: ".sql_error(),E_USER_ERROR);
+    output_error("SQL Error: ".sql_error(),E_USER_ERROR);
        return false; }
 if ($result!==false) {
        ++$NumQueries;
@@ -64,7 +64,7 @@ if ($result!==false) {
 function sql_num_rows($result) {
 $num = mysql_num_rows($result);
 if ($num===false) {
-    trigger_error("Invalid query: ".sql_error(),E_USER_ERROR);
+    output_error("SQL Error: ".sql_error(),E_USER_ERROR);
        return false; }
        return $num; }
 // Connect to mysql database
@@ -75,26 +75,26 @@ $link = mysql_connect($server,$username,$password); }
 if($new_link===true) {
 $link = mysql_connect($server,$username,$password,$new_link); }
 if ($link===false) {
-    trigger_error("Not connected: ".sql_error(),E_USER_ERROR);
+    output_error("Not connected: ".sql_error(),E_USER_ERROR);
        return false; }
 if($database!==null) {
 $dlink = mysql_select_db($database,$link);
 if ($dlink===false) {
-    trigger_error("Can't use database ".$database.": ".sql_error(),E_USER_ERROR);
+    output_error("Can't use database ".$database.": ".sql_error(),E_USER_ERROR);
        return false; } }
 return $link; }
 // Query Results :P
 function sql_result($result,$row,$field=0) {
 $value = mysql_result($result, $row, $field);
 if ($value===false) { 
-    trigger_error("Invalid query: ".sql_error(),E_USER_ERROR);
+    output_error("SQL Error: ".sql_error(),E_USER_ERROR);
        return false; }
        return $value; }
 // Free Results :P
 function sql_free_result($result) {
 $fresult = mysql_free_result($result);
 if ($fresult===false) {
-    trigger_error("Invalid query: ".sql_error(),E_USER_ERROR);
+    output_error("SQL Error: ".sql_error(),E_USER_ERROR);
        return false; }
 if ($fresult===true) {
        return true; } }
@@ -123,7 +123,7 @@ if(isset($link)) {
 if(!isset($link)) {
        $string = mysql_real_escape_string($string); }
 if ($string===false) {
-    trigger_error("Invalid query: ".sql_error(),E_USER_ERROR);
+    output_error("SQL Error: ".sql_error(),E_USER_ERROR);
        return false; }
        return $string; }
 // SafeSQL Lite Source Code by Cool Dude 2k
@@ -147,11 +147,11 @@ function sql_set_charset($charset,$link=null) {
 if(function_exists('mysql_set_charset')===false) {
        $result = sql_query("SET CHARACTER SET '".$charset."'");
 if ($result===false) {
-    trigger_error("Invalid query: ".sql_error(),E_USER_ERROR);
+    output_error("SQL Error: ".sql_error(),E_USER_ERROR);
        return false; }
        $result = sql_query("SET NAMES '".$charset."'"); 
 if ($result===false) {
-    trigger_error("Invalid query: ".sql_error(),E_USER_ERROR);
+    output_error("SQL Error: ".sql_error(),E_USER_ERROR);
        return false; }
        return true; }
 if(function_exists('mysql_set_charset')===true) {
@@ -160,7 +160,7 @@ if(isset($link)) {
 if(!isset($link)) {
        $result = mysql_set_charset($charset); }
 if ($result===false) {
-    trigger_error("Invalid query: ".sql_error(),E_USER_ERROR);
+    output_error("SQL Error: ".sql_error(),E_USER_ERROR);
        return false; }
        return true; } }
 /*
@@ -171,7 +171,7 @@ if(isset($link)) {
 if(!isset($link)) {
        $result = sql_set_charset($charset); }
 if ($result===false) {
-    trigger_error("Invalid query: ".sql_error(),E_USER_ERROR);
+    output_error("SQL Error: ".sql_error(),E_USER_ERROR);
        return false; }
        return true; } }
 */
index 0836741..1728d4c 100644 (file)
@@ -11,7 +11,7 @@
     Copyright 2004-2009 iDB Support - http://idb.berlios.de/
     Copyright 2004-2009 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: rssfeed.php - Last Update: 11/23/2009 SVN 359 - Author: cooldude2k $
+    $FileInfo: rssfeed.php - Last Update: 11/24/2009 SVN 363 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="rssfeed.php"||$File3Name=="/rssfeed.php") {
@@ -170,7 +170,7 @@ $RSS .= '<item rdf:about="'.$BoardURL.url_maker($exfilerss['topic'],$Settings['f
 if($_GET['feedtype']=="rss") {
 $CDataDescription = "<![CDATA[\n".$MyDescription."\n]]>";
 $RSS .= '<item>'."\n".'<pubDate>'.$TheTime.'</pubDate>'."\n".'<author>'.$UsersName.'</author>'."\n".'<title>'.$TopicName.'</title>'."\n".'<description>'.$CDataDescription.'</description>'."\n".'<link>'.$BoardURL.url_maker($exfilerss['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstrrss['topic'],$exqstrrss['topic']).'</link>'."\n".'<guid>'.$BoardURL.url_maker($exfilerss['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstrrss['topic'],$exqstrrss['topic']).'</guid>'."\n".'</item>'."\n"; } }
-++$i; } sql_free_result($result);
+++$i; sql_free_result($presult); }
 sql_free_result($result);
 ++$glti; }
 xml_doc_start("1.0",$Settings['charset']);
index 718dab5..301e9a2 100644 (file)
@@ -11,7 +11,7 @@
     Copyright 2004-2009 iDB Support - http://idb.berlios.de/
     Copyright 2004-2009 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: versioninfo.php - Last Update: 11/24/2009 SVN 362 - Author: cooldude2k $
+    $FileInfo: versioninfo.php - Last Update: 11/24/2009 SVN 363 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="versioninfo.php"||$File3Name=="/versioninfo.php") {
@@ -27,7 +27,7 @@ function version_info($proname,$subver,$ver,$supver,$reltype,$svnver,$showsvn) {
        return $return_var; }
 // Version number and date stuff. :P
 $VER1[0] = 0; $VER1[1] = 3; $VER1[2] = 2; $VERFull[1] = $VER1[0].".".$VER1[1].".".$VER1[2];
-$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 362; $RName = "iDB"; $SFName = "IntDB";
+$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 363; $RName = "iDB"; $SFName = "IntDB";
 $SVNDay[0] = 11; $SVNDay[1] = 24; $SVNDay[2] = 2009; $SVNDay[3] = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2];
 $VerInfo['iDB_Ver'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[1],$SubVerN,false);
 $VerInfo['iDB_Ver_SVN'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[1],$SubVerN,true);