From ca43eea9776f35a5c09331524c60b71d120fb203 Mon Sep 17 00:00:00 2001 From: Joe Presbrey Date: Tue, 11 Apr 2006 23:34:31 +0000 Subject: [PATCH] git-svn-id: svn://presbrey.mit.edu/php/php@100 a142d4bd-2cfb-0310-9673-cb33a7e74f58 --- lib/joe/errors.lib.php | 10 ++---- lib/joe/joe.lib.php | 12 ------- lib/joe/{dbaccess.lib.php => mysql.lib.php} | 38 --------------------- 3 files changed, 2 insertions(+), 58 deletions(-) rename lib/joe/{dbaccess.lib.php => mysql.lib.php} (51%) diff --git a/lib/joe/errors.lib.php b/lib/joe/errors.lib.php index 6f760fc..3fe1ca7 100644 --- a/lib/joe/errors.lib.php +++ b/lib/joe/errors.lib.php @@ -4,8 +4,8 @@ function ErrorHandler($errno, $errstr, $errfile, $errline, $errcontext) { $error_halt = true; $error_type = 'Error'; $error_msg = " $errstr occured in $errfile on $errline at ".date("D M j G:i:s T Y"); - $email_to = 'sql@mit.edu'; - $email_from = 'sql@sql.mit.edu'; + $email_to = 'USER@localhost'; + $email_from = 'USER@localhost'; switch($errno) { case E_USER_NOTICE: case E_NOTICE: @@ -34,19 +34,13 @@ function ErrorHandler($errno, $errstr, $errfile, $errline, $errcontext) { } $error_bt = ErrorBacktrace(debug_backtrace()); $error_msg = $type . ':' . $error_msg . "\n" . $error_bt . "\n\n"; - if (DEVEL && 0) { - echo nl2br($error_msg); - } else { $error_msg .= print_r(get_included_files(),1)."\n"; $error_msg .= print_r($errcontext,1); error_log($error_msg, 1, $email_to); if ($error_halt) { while(ob_get_level()) { ob_end_clean(); } - require_once('security.lib.php'); - redirect('error'); exit -1; } - } } function ErrorBacktrace($debug_backtrace) { diff --git a/lib/joe/joe.lib.php b/lib/joe/joe.lib.php index 0bf1fb0..dffb0df 100644 --- a/lib/joe/joe.lib.php +++ b/lib/joe/joe.lib.php @@ -2,12 +2,6 @@ /* (c) 2005 Joe Presbrey joepresbrey@gmail.com - - ATTN: This library was assembled and completed in its entirety independent of - any and all corporate projects and/or work environ. - - You may NOT use this library elsewhere! - */ function isPost() { @@ -80,7 +74,6 @@ function sessTime($query=null) { } function fetchRows($rs, $key = null) { - /* ask me how to use this if its not obvious ~ Joe */ if (!$rs) return array(); $kn = is_null($key); $n = mysql_num_rows($rs); @@ -180,11 +173,6 @@ function build_str($query_array) { } function newQS($key, $val=null) { - /* - parse_str($_SERVER['QUERY_STRING'], $arr); - $arr[$key] = $val; - return '?'.build_str($arr); - */ return newQSA(array($key=>$val)); } diff --git a/lib/joe/dbaccess.lib.php b/lib/joe/mysql.lib.php similarity index 51% rename from lib/joe/dbaccess.lib.php rename to lib/joe/mysql.lib.php index 76a3a34..bc52148 100644 --- a/lib/joe/dbaccess.lib.php +++ b/lib/joe/mysql.lib.php @@ -52,42 +52,4 @@ function calcDBSize($tdb) { } } -function checkQuotas($userId=null) { - if (empty($userId)) { - $sql = 'SELECT DatabaseId,Name FROM DB WHERE bEnabled=1'; - } else { - $sql = sprintf("SELECT DB.DatabaseId,Name FROM DB INNER JOIN DBOwner ON DB.DatabaseId = DBOwner.DatabaseId WHERE bEnabled=1 AND UserId = '%s'", mysql_escape_string($userId)); - } - $databases = fetchRows(DBSelect($sql),'Name'); - foreach($databases as $db) { - $DBId = $db['DatabaseId']; - $arr['dLastCheck'] = 'NOW()'; - $arr['nBytes'] = calcDBSize($db['Name']); - $sql = sprintf("UPDATE DB %s WHERE DatabaseId = '%s'", - buildSQLSet($arr), - mysql_escape_string($DBId)); - DBUpdate($sql); - } - $sql = "UPDATE UserStat SET nBytes = ( - SELECT SUM(nBytes) - FROM DB - INNER JOIN DBOwner ON DBOwner.DatabaseId = DB.DatabaseId - WHERE DBOwner.UserId = UserStat.UserId - AND DB.bEnabled=1 - GROUP BY UserId - ), dLastCheck = NOW()"; - if (!empty($userId)) $sql .= sprintf(" WHERE UserId = '%s'", mysql_escape_string($userId)); - DBUpdate($sql); - $sql = "UPDATE UserStat SET nDatabases = ( - SELECT COUNT(*) - FROM DB - INNER JOIN DBOwner ON DBOwner.DatabaseId = DB.DatabaseId - WHERE DBOwner.UserId = UserStat.UserId - AND DB.bEnabled=1 - GROUP BY UserId - ), dLastCheck = NOW()"; - if (!empty($userId)) $sql .= sprintf(" WHERE UserId = '%s'", mysql_escape_string($userId)); - DBUpdate($sql); -} - ?> -- 2.45.0