Mercurial > hg > fapweb
changeset 861:62b3a69e9030
Add stErrorLog() and use it.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 26 Nov 2014 11:07:22 +0200 |
parents | bb4a6967ccdd |
children | bfc40862ec35 |
files | admlogin.php msite.inc.php msitegen.inc.php usrlogin.php |
diffstat | 4 files changed, 25 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/admlogin.php Wed Nov 26 10:30:39 2014 +0200 +++ b/admlogin.php Wed Nov 26 11:07:22 2014 +0200 @@ -23,13 +23,13 @@ if (stGetRequestItem("admpass", FALSE) == $password) { if (!stSessionStart(SESS_ADMIN, $password, "admTimeout")) - error_log("Admin session AUTH LOGIN failed (session setup) @ ".$sfrom); + stErrorLog("Admin session AUTH LOGIN failed (session setup) @ ".$sfrom); else - error_log("Admin session LOGIN SUCCESS @ ".$sfrom); + stErrorLog("Admin session LOGIN SUCCESS @ ".$sfrom); } else { - error_log("Admin session AUTH LOGIN failed (password) @ ".$sfrom); + stErrorLog("Admin session AUTH LOGIN failed (password) @ ".$sfrom); } header("Location: admin.php");
--- a/msite.inc.php Wed Nov 26 10:30:39 2014 +0200 +++ b/msite.inc.php Wed Nov 26 11:07:22 2014 +0200 @@ -1015,7 +1015,7 @@ // Get file magic info if (($finfo = finfo_open()) === false) { - error_log("Internal error. Failed to initialize finfo()."); + stErrorLog("Internal error. Failed to initialize finfo()."); return stError("Internal error, failed to probe file."); } @@ -1026,7 +1026,7 @@ // Did we get anything? if ($sdata === FALSE || $smime === FALSE) { - error_log("Failed to probe file '".$filename."'."); + stErrorLog("Failed to probe file '".$filename."'."); return stError("Internal error, failed to probe file."); } @@ -1045,7 +1045,7 @@ return $fdata; } - error_log("File '".$filename."' (".$smime.") did not match any allowed file types."); + stErrorLog("File '".$filename."' (".$smime.") did not match any allowed file types."); return stError("No matching allowed file type found for '".$smime."'."); } @@ -1202,7 +1202,7 @@ // Set permissions before moving the file if (chmod($tmpFilename, stGetSetting($uploadType."PathPerms")) === false) { - error_log("Could not set permissions for uploaded file '".$tmpFilename."'."); + stErrorLog("Could not set permissions for uploaded file '".$tmpFilename."'."); return stError("Could not set permissions for uploaded file."); } @@ -1210,8 +1210,8 @@ $dstFilename = stMakePath(FALSE, array(stGetSetting("entryPath"), $compo["cpath"], $fentry["filename"])); if (@move_uploaded_file($tmpFilename, $dstFilename) === false) { - error_log("Could not move uploaded file '".$tmpFilename."' to '".$dstFilename."'."); - return stError("Deploying uploaded file failed."); + stErrorLog("Could not move uploaded file '".$tmpFilename."' to '".$dstFilename."'."); + return stError("Deploying uploaded file failed!"); } return TRUE;
--- a/msitegen.inc.php Wed Nov 26 10:30:39 2014 +0200 +++ b/msitegen.inc.php Wed Nov 26 11:07:22 2014 +0200 @@ -36,6 +36,13 @@ } +function stErrorLog($msg) +{ + error_log("FAPWeb: ".$msg); + return FALSE; +} + + function stError($msg) { global $errorSet, $errorMsgs; @@ -143,7 +150,7 @@ return $default; else { - error_log("No config value for '".$name."'"); + stErrorLog("No config value for '".$name."'"); die("No config value for '".$name."'.\n"); } } @@ -345,7 +352,7 @@ $str .= $argv[$n]; else { - error_log("Invalid stErrorStrF() format string, arg #".$n. + stErrorLog("Invalid stErrorStrF() format string, arg #".$n. " referenced, but only has ".$argc." arguments: '".$fmt."'\n"); return FALSE; } @@ -512,7 +519,7 @@ $dbh = new PDO($dbspec); } catch (PDOException $e) { - error_log("Could not connect to SQL database: ".$e->getMessage()."."); + stErrorLog("Could not connect to SQL database: ".$e->getMessage()."."); return FALSE; } return $dbh; @@ -536,7 +543,7 @@ function stLogSQLError($dbh, $sql) { - error_log("SQL error '".implode("; ", $dbh->errorInfo())."' in statement: \"".$sql."\""); + stErrorLog("SQL error '".implode("; ", $dbh->errorInfo())."' in statement: \"".$sql."\""); } @@ -550,7 +557,7 @@ stGetSetting("sqlOptions", array())); } catch (PDOException $e) { - error_log("Could not connect to SQL database: ".$e->getMessage()."."); + stErrorLog("Could not connect to SQL database: ".$e->getMessage()."."); return FALSE; } $db = stConnectSQLDBSpec(stGetSetting("sqlDB")); @@ -588,7 +595,7 @@ $sql .= stDBGetSQLParam($dbh, $fmt[++$pos], $argv[$argn++]); else { - error_log("Invalid SQL statement format string '".$fmt. + stErrorLog("Invalid SQL statement format string '".$fmt. "', not enough parameters specified (".$argn." of ".$argc.")"); return FALSE; } @@ -619,7 +626,7 @@ $sql .= stDBGetSQLParam($db, $fmt[++$pos], $argv[$argn++]); else { - error_log("Invalid SQL statement format string '".$fmt. + stErrorLog("Invalid SQL statement format string '".$fmt. "', not enough parameters specified (".$argn." of ".$argc.")"); return FALSE; }
--- a/usrlogin.php Wed Nov 26 10:30:39 2014 +0200 +++ b/usrlogin.php Wed Nov 26 11:07:22 2014 +0200 @@ -55,7 +55,7 @@ { if (!stSessionStart(SESS_USER, $password, "userTimeout")) { - error_log("User session AUTH LOGIN failed (session setup)"); + stErrorLog("User session AUTH LOGIN failed (session setup)"); $error = 2; } else @@ -67,7 +67,7 @@ } else { - error_log("User session AUTH LOGIN failed (password)"); + stErrorLog("User session AUTH LOGIN failed (password)"); $error = 1; }