]> andersk Git - sql-web.git/commitdiff
git-svn-id: svn://presbrey.mit.edu/php/php@100 a142d4bd-2cfb-0310-9673-cb33a7e74f58
authorJoe Presbrey <presbrey@mit.edu>
Tue, 11 Apr 2006 23:34:31 +0000 (23:34 +0000)
committerJoe Presbrey <presbrey@mit.edu>
Tue, 11 Apr 2006 23:34:31 +0000 (23:34 +0000)
lib/joe/errors.lib.php
lib/joe/joe.lib.php
lib/joe/mysql.lib.php [moved from lib/joe/dbaccess.lib.php with 51% similarity]

index 6f760fc69da6b08d7996ba9593ca62cc02f4d339..3fe1ca770e621ee1a96191c34f7c4dd662b5dee9 100644 (file)
@@ -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) {
index 0bf1fb034a21da6178ebc1383827eb6597b024d3..dffb0df346513b609b716774770accef27126833 100644 (file)
@@ -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));
 }
 
similarity index 51%
rename from lib/joe/dbaccess.lib.php
rename to lib/joe/mysql.lib.php
index 76a3a3437a735a2985fceb5589aba39125fedfa3..bc5214820b0b72c7e1aa3a1398d05017281a6ddb 100644 (file)
@@ -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);
-}
-
 ?>
This page took 0.03743 seconds and 5 git commands to generate.