diff options
30 files changed, 269 insertions, 273 deletions
diff --git a/addmedia.php b/addmedia.php index e26cc23626..f9dfc4e400 100644 --- a/addmedia.php +++ b/addmedia.php @@ -199,7 +199,7 @@ if ($action=="newentry") { $error .= i18n::translate('There was an error uploading your file.')."<br />".file_upload_error_text($_FILES["mediafile"]["error"])."<br />"; } else { @chmod(filename_decode($newFile), WT_PERM_FILE); - AddToLog("Media file {$folderName}{$mediaFile} uploaded"); + AddToLog("Media file {$folderName}{$mediaFile} uploaded", 'media'); } } } @@ -214,7 +214,7 @@ if ($action=="newentry") { $error .= i18n::translate('There was an error uploading your file.')."<br />".file_upload_error_text($_FILES["thumbnail"]["error"])."<br />"; } else { @chmod(filename_decode($newThum), WT_PERM_FILE); - AddToLog("Media file {$thumbFolderName}{$mediaFile} uploaded"); + AddToLog("Media file {$thumbFolderName}{$mediaFile} uploaded", 'media'); } } } @@ -225,7 +225,7 @@ if ($action=="newentry") { $error .= i18n::translate('There was an error uploading your file.')."<br />".i18n::translate('The file %s could not be copied from %s', $realThumbFolderName.$mediaFile, $realThumbFolderName.$mediaFile)."<br />"; } else { @chmod(filename_decode($whichFile2), WT_PERM_FILE); - AddToLog("Media file {$folderName}{$mediaFile} copied from {$thumbFolderName}{$mediaFile}"); + AddToLog("Media file {$folderName}{$mediaFile} copied from {$thumbFolderName}{$mediaFile}", 'media'); } } if ($error=="" && !empty($_FILES["mediafile"]["name"]) && empty($_FILES["thumbnail"]["name"])) { @@ -242,7 +242,7 @@ if ($action=="newentry") { } else { echo i18n::translate('Thumbnail %s generated automatically.', $thumbnail); print "<br />"; - AddToLog("Media thumbnail {$thumbnail} generated"); + AddToLog("Media thumbnail {$thumbnail} generated", 'media'); } } } diff --git a/client.php b/client.php index 61342b1e8d..3039533b4f 100644 --- a/client.php +++ b/client.php @@ -42,7 +42,7 @@ $READ_ONLY = ((isset($_SESSION['readonly']))&&($_SESSION['readonly']==true)) ? 1 // Make sure there is at least one gedcom. if (count(get_all_gedcoms())==0) { - addDebugLog($action." ERROR 21: No Gedcoms available on this site."); + addToLog($action." ERROR 21: No Gedcoms available on this site.", 'debug'); print "ERROR 21: No Gedcoms available on this site.\n"; exit; } @@ -50,7 +50,7 @@ if (count(get_all_gedcoms())==0) { $gedcom=safe_REQUEST($_REQUEST,'GEDCOM'); if ($gedcom) { if (!in_array($gedcom, get_all_gedcoms())) { - addDebugLog("ERROR 21: Invalid GEDCOM specified. Remember that the GEDCOM is case sensitive."); + addToLog("ERROR 21: Invalid GEDCOM specified. Remember that the GEDCOM is case sensitive.", 'debug'); print "ERROR 21: Invalid GEDCOM specified. Remember that the GEDCOM is case sensitive.\n"; exit; } @@ -59,7 +59,7 @@ if ($gedcom) { $GED_ID=get_id_from_gedcom($GEDCOM); if (!get_gedcom_setting($GED_ID, 'imported')) { - addDebugLog($action." ERROR 22: Gedcom [$GEDCOM] needs to be imported."); + addToLog($action." ERROR 22: Gedcom [$GEDCOM] needs to be imported.", 'debug'); print "ERROR 22: Gedcom [$GEDCOM] needs to be imported.\n"; exit; } @@ -69,11 +69,11 @@ $action=safe_REQUEST($_REQUEST,'action'); // The following actions can be performed without being connected. switch ($action) { case '': - addDebugLog("ERROR 1: No action specified."); + addToLog("ERROR 1: No action specified.", 'debug'); print "ERROR 1: No action specified.\n"; exit; case 'version': - addDebugLog($action." SUCCESS\n".WT_VERSION_TEXT."\n"); + addToLog($action." SUCCESS\n".WT_VERSION_TEXT."\n", 'debug'); print "SUCCESS\n".WT_VERSION_TEXT."\n"; exit; case 'connect': @@ -84,21 +84,21 @@ case 'connect': if ($user_id) { $stat=newConnection(); if ($stat!==false) { - addDebugLog($action." username=$username SUCCESS\n".$stat); + addToLog($action." username=$username SUCCESS\n".$stat, 'debug'); print "SUCCESS\n".$stat; } $_SESSION['connected']=$user_id; } else { - addDebugLog($action." username=$username ERROR 10: Username and password key failed to authenticate."); + addToLog($action." username=$username ERROR 10: Username and password key failed to authenticate.", 'debug'); print "ERROR 10: Username and password key failed to authenticate.\n"; } } else { $stat=newConnection(); if ($stat!==false) { - addDebugLog($action." SUCCESS\n".$stat); + addToLog($action." SUCCESS\n".$stat, 'debug'); print "SUCCESS\n".$stat; } - AddToLog('Read-Only Anonymous Client connection.'); + AddToLog('Read-Only Anonymous Client connection.', 'auth'); $_SESSION['connected']='Anonymous'; $_SESSION['readonly']=1; } @@ -108,13 +108,13 @@ case 'listgedcoms': foreach (get_all_gedcoms() as $ged_id=>$gedcom) { $out_msg.="$gedcom\t".get_gedcom_setting($ged_id, 'title')."\n"; } - addDebugLog($action." ".$out_msg); + addToLog($action." ".$out_msg, 'debug'); print $out_msg; exit; default: // All other actions require an authenticated connection if (empty($_SESSION['connected'])){ - addDebugLog($action." ERROR 12: use 'connect' action to initiate a session."); + addToLog($action." ERROR 12: use 'connect' action to initiate a session.", 'debug'); print "ERROR 12: use 'connect' action to initiate a session.\n"; exit; } @@ -168,10 +168,10 @@ case 'get': $gedrecords = str_replace($match[$i][1], $mediaurl, $gedrecords); } } - addDebugLog($action." xref=$xref ".$gedrecords); + addToLog($action." xref=$xref ".$gedrecords, 'debug'); print "SUCCESS\n".$gedrecords; } else { - addDebugLog($action." ERROR 3: No gedcom id specified. Please specify a xref."); + addToLog($action." ERROR 3: No gedcom id specified. Please specify a xref.", 'debug'); print "ERROR 3: No gedcom id specified. Please specify a xref.\n"; } exit; @@ -179,13 +179,13 @@ case 'getvar': $var=safe_REQUEST($_REQUEST,'var', '[A-Za-z0-9_]+'); $public_vars = array("READ_ONLY","GEDCOM","PEDIGREE_ROOT_ID"); if ($var && in_array($var, $public_vars) && isset($$var)) { - addDebugLog($action." var=$var SUCCESS\n".$$var); + addToLog($action." var=$var SUCCESS\n".$$var, 'debug'); print "SUCCESS\n".$$var; } else if (WT_USER_ID && $var && isset($$var) && !in_array($var, $CONFIG_VARS)) { - addDebugLog($action." var=$var SUCCESS\n".$$var); + addToLog($action." var=$var SUCCESS\n".$$var, 'debug'); print "SUCCESS\n".$$var; } else { - addDebugLog($action." var=$var ERROR 13: Invalid variable specified. Please provide a variable."); + addToLog($action." var=$var ERROR 13: Invalid variable specified. Please provide a variable.", 'debug'); print "ERROR 13: Invalid variable specified.\n"; } exit; @@ -198,19 +198,19 @@ case 'update': $gedrec = preg_replace(array("/\\\\+r/","/\\\\+n/"), array("\r","\n"), $gedrec); $success = replace_gedrec($xref, $gedrec); if ($success) { - addDebugLog($action." xref=$xref gedrec=$gedrec SUCCESS"); + addToLog($action." xref=$xref gedrec=$gedrec SUCCESS", 'debug'); print "SUCCESS\n"; } } else { - addDebugLog($action." xref=$xref ERROR 11: No write privileges for this record."); + addToLog($action." xref=$xref ERROR 11: No write privileges for this record.", 'debug'); print "ERROR 11: No write privileges for this record.\n"; } } else { - addDebugLog($action." xref=$xref ERROR 8: No gedcom record provided. Unable to process request."); + addToLog($action." xref=$xref ERROR 8: No gedcom record provided. Unable to process request.", 'debug'); print "ERROR 8: No gedcom record provided. Unable to process request.\n"; } } else { - addDebugLog($action." ERROR 3: No gedcom id specified. Please specify a xref."); + addToLog($action." ERROR 3: No gedcom id specified. Please specify a xref.", 'debug'); print "ERROR 3: No gedcom id specified. Please specify a xref.\n"; } exit; @@ -221,15 +221,15 @@ case 'append': $gedrec = preg_replace(array("/\\\\+r/","/\\\\+n/"), array("\r","\n"), $gedrec); $xref = append_gedrec($gedrec); if ($xref) { - addDebugLog($action." gedrec=$gedrec SUCCESS\n$xref"); + addToLog($action." gedrec=$gedrec SUCCESS\n$xref", 'debug'); print "SUCCESS\n$xref\n"; } } else { - addDebugLog($action." gedrec=$gedrec ERROR 11: No write privileges for this record."); + addToLog($action." gedrec=$gedrec ERROR 11: No write privileges for this record.", 'debug'); print "ERROR 11: No write privileges for this record.\n"; } } else { - addDebugLog($action." ERROR 8: No gedcom record provided. Unable to process request."); + addToLog($action." ERROR 8: No gedcom record provided. Unable to process request.", 'debug'); print "ERROR 8: No gedcom record provided. Unable to process request.\n"; } exit; @@ -239,15 +239,15 @@ case 'delete': if (empty($_SESSION['readonly']) && WT_USER_CAN_EDIT && displayDetailsById($xref)) { $success = delete_gedrec($xref); if ($success) { - addDebugLog($action." xref=$xref SUCCESS"); + addToLog($action." xref=$xref SUCCESS", 'debug'); print "SUCCESS\n"; } } else { - addDebugLog($action." xref=$xref ERROR 11: No write privileges for this record."); + addToLog($action." xref=$xref ERROR 11: No write privileges for this record.", 'debug'); print "ERROR 11: No write privileges for this record.\n"; } } else { - addDebugLog($action." ERROR 3: No gedcom id specified. Please specify a xref."); + addToLog($action." ERROR 3: No gedcom id specified. Please specify a xref.", 'debug'); print "ERROR 3: No gedcom id specified. Please specify a xref.\n"; } exit; @@ -263,10 +263,10 @@ case 'getnext': //-- do not have full access to this record, so privatize it $gedrec = privatize_gedcom($gedrec); } - addDebugLog($action." xref=$xref SUCCESS\n".trim($gedrec)); + addToLog($action." xref=$xref SUCCESS\n".trim($gedrec), 'debug'); print "SUCCESS\n".trim($gedrec); } else { - addDebugLog($action." ERROR 3: No gedcom id specified. Please specify a xref."); + addToLog($action." ERROR 3: No gedcom id specified. Please specify a xref.", 'debug'); print "ERROR 3: No gedcom id specified. Please specify a xref.\n"; } exit; @@ -282,10 +282,10 @@ case 'getprev': //-- do not have full access to this record, so privatize it $gedrec = privatize_gedcom($gedrec); } - addDebugLog($action." xref=$xref SUCCESS\n".trim($gedrec)); + addToLog($action." xref=$xref SUCCESS\n".trim($gedrec), 'debug'); print "SUCCESS\n".trim($gedrec); } else { - addDebugLog($action." ERROR 3: No gedcom id specified. Please specify a xref."); + addToLog($action." ERROR 3: No gedcom id specified. Please specify a xref.", 'debug'); print "ERROR 3: No gedcom id specified. Please specify a xref.\n"; } exit; @@ -294,12 +294,12 @@ case 'search': if ($query) { $sindilist=search_indis(array($query), array(WT_GED_ID), 'AND', true); print "SUCCESS\n"; - addDebugLog($action." query=$query SUCCESS"); + addToLog($action." query=$query SUCCESS", 'debug'); foreach($sindilist as $indi) { echo $indi->getXref(), "\n"; } } else { - addDebugLog($action." ERROR 15: No query specified. Please specify a query."); + addToLog($action." ERROR 15: No query specified. Please specify a query.", 'debug'); print "ERROR 15: No query specified. Please specify a query.\n"; } exit; @@ -312,12 +312,12 @@ case 'soundex': if ($lastname || $firstname) { $sindilist=search_indis_soundex($soundex, $lastname, $firstname, $place, array(WT_GED_ID)); print "SUCCESS\n"; - addDebugLog($action." lastname=$lastname firstname=$firstname SUCCESS"); + addToLog($action." lastname=$lastname firstname=$firstname SUCCESS", 'debug'); foreach($sindilist as $indi) { echo $indi->getXref(), "\n"; } } else { - addDebugLog($action." ERROR 16: No names specified. Please specify a firstname or a lastname."); + addToLog($action." ERROR 16: No names specified. Please specify a firstname or a lastname.", 'debug'); print "ERROR 16: No names specified. Please specify a firstname or a lastname.\n"; } exit; @@ -334,29 +334,29 @@ case 'getxref': } if (!$position || !$type) { - addDebugLog($action." type=$type position=$position ERROR 18: Invalid \$type specification. Valid types are INDI, FAM, SOUR, REPO, NOTE, OBJE, or OTHER"); + addToLog($action." type=$type position=$position ERROR 18: Invalid \$type specification. Valid types are INDI, FAM, SOUR, REPO, NOTE, OBJE, or OTHER", 'debug'); print "ERROR 18: Invalid \$type or \$position specification. Valid types are INDI, FAM, SOUR, REPO, NOTE, OBJE, or OTHER\n"; exit; } switch ($position) { case 'first': $xref=get_first_xref($type, $GED_ID); - addDebugLog($action." type=$type position=$position SUCCESS\n$xref"); + addToLog($action." type=$type position=$position SUCCESS\n$xref", 'debug'); print "SUCCESS\n$xref\n"; break; case 'last': $xref=get_last_xref($type, $GED_ID); - addDebugLog($action." type=$type position=$position SUCCESS\n$xref"); + addToLog($action." type=$type position=$position SUCCESS\n$xref", 'debug'); print "SUCCESS\n$xref\n"; break; case 'next': $xref=get_next_xref($xref, $GED_ID); - addDebugLog($action." type=$type position=$position SUCCESS\n$xref"); + addToLog($action." type=$type position=$position SUCCESS\n$xref", 'debug'); print "SUCCESS\n$xref\n"; break; case 'prev': $xref=get_prev_xref($xref, $GED_ID); - addDebugLog($action." type=$type position=$position SUCCESS\n$xref"); + addToLog($action." type=$type position=$position SUCCESS\n$xref", 'debug'); print "SUCCESS\n$xref\n"; break; case 'all': @@ -393,18 +393,18 @@ case 'getxref': foreach ($statement->fetchOneColumn() as $id) { print "{$id}\n"; } - addDebugLog($action." type=$type position=$position "); + addToLog($action." type=$type position=$position ", 'debug'); break; case 'new': if (empty($_SESSION['readonly']) && WT_USER_CAN_EDIT) { $gedrec = "0 @REF@ $type"; $xref = append_gedrec($gedrec); if ($xref) { - addDebugLog($action." type=$type position=$position SUCCESS\n$xref"); + addToLog($action." type=$type position=$position SUCCESS\n$xref", 'debug'); print "SUCCESS\n$xref\n"; } } else { - addDebugLog($action." type=$type position=$position ERROR 11: No write privileges for this record."); + addToLog($action." type=$type position=$position ERROR 11: No write privileges for this record.", 'debug'); print "ERROR 11: No write privileges for this record.\n"; } break; @@ -427,10 +427,10 @@ case 'uploadmedia': } } if (!empty($error)) { - addDebugLog($action." $error"); + addToLog($action." $error", 'debug'); print $error."\n"; } else { - addDebugLog($action." SUCCESS"); + addToLog($action." SUCCESS", 'debug'); print "SUCCESS\n"; } exit; @@ -438,7 +438,7 @@ case 'getchanges': $lastdate = new GedcomDate(safe_REQUEST($_REQUEST,'date', '\d\d \w\w\w \d\d\d\d')); if ($lastdate->isOK()) { if ($lastdate->MinJD()<server_jd()-180) { - addDebugLog($action." ERROR 24: You cannot retrieve updates for more than 180 days."); + addToLog($action." ERROR 24: You cannot retrieve updates for more than 180 days.", 'debug'); print "ERROR 24: You cannot retrieve updates for more than 180 days.\n"; } else { print "SUCCESS\n"; @@ -447,12 +447,12 @@ case 'getchanges': } } } else { - addDebugLog($action." ERROR 23: Invalid date parameter. Please use a valid date in the GEDCOM format DD MMM YYYY."); + addToLog($action." ERROR 23: Invalid date parameter. Please use a valid date in the GEDCOM format DD MMM YYYY.", 'debug'); print "ERROR 23: Invalid date parameter. Please use a valid date in the GEDCOM format DD MMM YYYY.\n"; } exit; default: - addDebugLog($action." ERROR 2: Unable to process request. Unknown action."); + addToLog($action." ERROR 2: Unable to process request. Unknown action.", 'debug'); print "ERROR 2: Unable to process request. Unknown action.\n"; } ?> diff --git a/edit_privacy.php b/edit_privacy.php index a1478ff615..825f6b68c2 100644 --- a/edit_privacy.php +++ b/edit_privacy.php @@ -257,7 +257,7 @@ if ($action=="update") { } // NOTE: load the new variables require $INDEX_DIRECTORY.$GEDCOM.'_priv.php'; - $logline = AddToLog("Privacy file $PRIVACY_MODULE updated"); + $logline = AddToLog("Privacy file $PRIVACY_MODULE updated", 'config'); $gedcomprivname = $GEDCOM."_priv.php"; //-- delete the cache files for the Home Page blocks diff --git a/editconfig_gedcom.php b/editconfig_gedcom.php index 22fa626d6e..c954948b60 100644 --- a/editconfig_gedcom.php +++ b/editconfig_gedcom.php @@ -128,7 +128,7 @@ if (isset($GEDCOMPATH)) { // NOTE: When uploading a file check if it doesn't exist yet if ($action=="replace" || !in_array($GEDFILENAME, get_all_gedcoms()) && !file_exists($upload_path.$GEDFILENAME)) { if (move_uploaded_file($_FILES['GEDCOMPATH']['tmp_name'], $upload_path.$GEDFILENAME)) { - AddToLog("Gedcom ".$path.$GEDFILENAME." uploaded"); + AddToLog("Gedcom ".$path.$GEDFILENAME." uploaded", 'config'); $GEDCOMPATH = $upload_path.$GEDFILENAME; } else { $error = i18n::translate('There was an error uploading your file.')."<br />".file_upload_error_text($_FILES['GEDCOMPATH']['error']); @@ -495,7 +495,7 @@ if ($action=="update") { if (($NEW_USE_MEDIA_FIREWALL=='yes') && !$USE_MEDIA_FIREWALL) { - AddToLog("Media Firewall enabled"); + AddToLog("Media Firewall enabled", 'config'); if (!$errors) { // create/modify an htaccess file in the main media directory @@ -533,7 +533,7 @@ if ($action=="update") { } } elseif (($NEW_USE_MEDIA_FIREWALL=='no') && $USE_MEDIA_FIREWALL) { - AddToLog("Media Firewall disabled"); + AddToLog("Media Firewall disabled", 'config'); if (file_exists($MEDIA_DIRECTORY.".htaccess")) { $httext = implode('', file($MEDIA_DIRECTORY.".htaccess")); @@ -578,7 +578,7 @@ if ($action=="update") { require_once WT_ROOT.'includes/index_cache.php'; clearCache(); - $logline = AddToLog("Gedcom configuration ".$INDEX_DIRECTORY.$FILE."_conf.php"." updated"); + $logline = AddToLog("Gedcom configuration ".$INDEX_DIRECTORY.$FILE."_conf.php"." updated", 'config'); $gedcomconfname = $FILE."_conf.php"; if (!$errors) { $gednews = getUserNews($FILE); diff --git a/edituser.php b/edituser.php index 47c8a4abb9..fbea84d252 100644 --- a/edituser.php +++ b/edituser.php @@ -69,7 +69,7 @@ if ($form_action=='update') { } else { // Change password if (!empty($form_pass1)) { - AddToLog('User changed password'); + AddToLog('User changed password', 'auth'); set_user_password(WT_USER_ID, crypt($form_pass1)); } $old_realname =getUserFullName(WT_USER_ID); @@ -86,7 +86,7 @@ if ($form_action=='update') { // Change username if ($form_username!=WT_USER_NAME) { - AddToLog('User renamed to ->'.$form_username.'<-'); + AddToLog('User renamed to ->'.$form_username.'<-', 'auth'); rename_user(WT_USER_ID, $form_username); $_SESSION['pgv_user']=$form_username; } @@ -76,14 +76,14 @@ if ($action=="commit") { WT_DB::prepare("UPDATE {$TBLPREFIX}blocks SET b_order=?, b_username=?, b_config=? WHERE b_id=? and b_username=? and b_location=?") ->execute(array($order, $whichGEDCOM, serialize($body), $pidb, $oldGEDCOM, 'body')); - AddToChangeLog("FAQ item has been edited.<br />Header ID: ".$pidh.".<br />Body ID: ".$pidb, $GEDCOM); + AddToChangeLog("FAQ item has been edited.<br />Header ID: ".$pidh.".<br />Body ID: ".$pidb, get_id_from_gedcom($GEDCOM)); break; case 'delete': WT_DB::prepare("DELETE FROM {$TBLPREFIX}blocks WHERE b_order=? AND b_name=? AND b_username=?") ->execute(array($id, 'faq', $oldGEDCOM)); - AddToChangeLog("FAQ item has been deleted.<br />Header ID: ".$pidh.".<br />Body ID: ".$pidb, $oldGEDCOM); + AddToChangeLog("FAQ item has been deleted.<br />Header ID: ".$pidh.".<br />Body ID: ".$pidb, get_id_from_gedcom($oldGEDCOM)); break; case 'add': @@ -104,7 +104,7 @@ if ($action=="commit") { WT_DB::prepare("INSERT INTO {$TBLPREFIX}blocks (b_id, b_username, b_location, b_order, b_name, b_config) VALUES (?, ?, ?, ?, ?, ?)") ->execute(array($newid+1, $whichGEDCOM, 'body', $order, 'faq', serialize($body))); - AddToChangeLog("FAQ item has been added.<br />Header ID: ".$newid.".<br />Body ID: ".($newid+1), $whichGEDCOM); + AddToChangeLog("FAQ item has been added.<br />Header ID: ".$newid.".<br />Body ID: ".($newid+1), get_id_from_gedcom($whichGEDCOM)); break; case 'moveup': @@ -122,7 +122,7 @@ if ($action=="commit") { WT_DB::prepare("UPDATE {$TBLPREFIX}blocks SET b_order=? WHERE b_id=? and b_location=?") ->execute(array($id-1, $pidb, 'body')); - AddToChangeLog("FAQ item has been moved up.<br />Header ID: ".$pidh.".<br />Body ID: ".$pidb, $oldGEDCOM); + AddToChangeLog("FAQ item has been moved up.<br />Header ID: ".$pidh.".<br />Body ID: ".$pidb, get_id_from_gedcom($oldGEDCOM)); break; case 'movedown': @@ -140,7 +140,7 @@ if ($action=="commit") { WT_DB::prepare("UPDATE {$TBLPREFIX}blocks SET b_order=? WHERE b_id=? and b_location=?") ->execute(array($id+1, $pidb, 'body')); - AddToChangeLog("FAQ item has been moved down.<br />Header ID: ".$pidh.".<br />Body ID: ".$pidb, $GEDCOM); + AddToChangeLog("FAQ item has been moved down.<br />Header ID: ".$pidh.".<br />Body ID: ".$pidb, get_id_from_gedcom($GEDCOM)); break; } diff --git a/genservice.php b/genservice.php index 79c41958f2..fa525a9e9d 100644 --- a/genservice.php +++ b/genservice.php @@ -49,7 +49,6 @@ if(!isset($_SERVER['QUERY_STRING']) || strstr($_SERVER['QUERY_STRING'],'wsdl')== $ct = preg_match("~<\w*:gedcom_id>(.*)</\w*:gedcom_id>~", $HTTP_RAW_POST_DATA, $match); if ($ct>0) $_REQUEST['ged'] = trim($match[1]); - //AddToLog("Setting SID to ".$SID." ".$HTTP_RAW_POST_DATA); require_once WT_ROOT.'includes/functions/functions_edit.php'; } } diff --git a/includes/authentication.php b/includes/authentication.php index 82c0b0e5c0..e37c7d7367 100644 --- a/includes/authentication.php +++ b/includes/authentication.php @@ -68,12 +68,12 @@ function authenticateUser($user_name, $password, $basic=false) { //-- reset the user's session $_SESSION = array(); $_SESSION['pgv_user'] = $user_id; - AddToLog(($basic ? 'Basic HTTP Authentication' :'Login'). ' Successful'); + AddToLog(($basic ? 'Basic HTTP Authentication' :'Login'). ' Successful', 'auth'); return $user_id; } } } - AddToLog(($basic ? 'Basic HTTP Authentication' : 'Login').' Failed ->'.$user_name.'<-'); + AddToLog(($basic ? 'Basic HTTP Authentication' : 'Login').' Failed ->'.$user_name.'<-', 'auth'); return false; } @@ -109,10 +109,10 @@ function basicHTTPAuthenticateUser() { function userLogout($user_id) { set_user_setting($user_id, 'loggedin', 'N'); if ($user_id != "Anonymous" and $user_id != "") { - AddToLog('Logout '.getUserName($user_id)); + AddToLog('Logout '.getUserName($user_id), 'auth'); } // If we are logging ourself out, then end our session too. - if (getUserId()==$user_id) { + if (WT_USER_ID==$user_id) { session_destroy(); } } @@ -296,142 +296,142 @@ function getUserGedcomId($user_id, $ged_id) { /** * add a message into the log-file - * @param string $LogString the message to add - * @param boolean $savelangerror - * @return string returns the log line if successfully inserted into the log (used for CVS/SVN commit messages) */ -function AddToLog($LogString, $savelangerror=false) { - global $INDEX_DIRECTORY, $LOGFILE_CREATE, $argc; +function AddToLog($log_message, $log_type='error') { + global $TBLPREFIX, $argc; - $wroteLogString = false; - - if ($LOGFILE_CREATE=='none') { + switch (get_site_setting('LOGFILE_CREATE')) { + case 'none': + return; + case 'database': + WT_DB::prepare( + "INSERT INTO {$TBLPREFIX}log (log_type, log_message, ip_address, user_id, gedcom_id) VALUES (?, ?, ?, ?, ?)" + )->execute(array( + $log_type, + $log_message, + $argc ? 'cli' : $_SERVER['REMOTE_ADDR'], + getUserId() ? getUserId() : null, + WT_GED_ID ? WT_GED_ID : null + )); return; + case 'daily': + $logfile=get_site_setting('INDEX_DIRECTORY').'pgv-'.date('Ymd').'.log'; + break; + case 'weekly': + $logfile=get_site_setting('INDEX_DIRECTORY').'pgv-'.date('Ym').'-week'.date('W').'.log'; + break; + case 'monthly': + $logfile=get_site_setting('INDEX_DIRECTORY').'pgv-'.date('Ym').'.log'; + break; + case 'yearly': + $logfile=get_site_setting('INDEX_DIRECTORY').'pgv-'.date('Y').'.log'; + break; } - if (isset($_SERVER['REMOTE_ADDR'])) { - $REMOTE_ADDR = $_SERVER['REMOTE_ADDR']; - } elseif ($argc>1) { - $REMOTE_ADDR = 'cli'; - } - if ($LOGFILE_CREATE !== 'none' && $savelangerror === false) { - if (empty($LOGFILE_CREATE)) - $LOGFILE_CREATE='daily'; - if ($LOGFILE_CREATE=='daily') - $logfile = $INDEX_DIRECTORY.'pgv-' . date('Ymd') . '.log'; - if ($LOGFILE_CREATE=='weekly') - $logfile = $INDEX_DIRECTORY.'pgv-' . date('Ym') . '-week' . date('W') . '.log'; - if ($LOGFILE_CREATE=='monthly') - $logfile = $INDEX_DIRECTORY.'pgv-' . date('Ym') . '.log'; - if ($LOGFILE_CREATE=='yearly') - $logfile = $INDEX_DIRECTORY.'pgv-' . date('Y') . '.log'; - if (is_writable($INDEX_DIRECTORY)) { - $logline=date('d.m.Y H:i:s').' - '.$REMOTE_ADDR.' - '.(getUserId() ? getUserName() : 'Anonymous').' - '.$LogString.WT_EOL; - $fp = fopen($logfile, 'a'); - flock($fp, 2); - fputs($fp, $logline); - flock($fp, 3); - fclose($fp); - $wroteLogString = true; - } - } - if ($wroteLogString) - return $logline; - else - return ''; + $logline= + date('d.m.Y H:i:s'). + ' - '.($argc ? 'cli' : $_SERVER['REMOTE_ADDR']). + ' - '.(getUserId() ? getUserName() : 'Anonymous'). + ' - '.$LogString.WT_EOL; + + $fp=fopen($logfile, 'a'); + flock($fp, 2); + fputs($fp, $logline); + flock($fp, 3); + fclose($fp); } //----------------------------------- AddToSearchLog //-- requires a string to add into the searchlog-file -function AddToSearchLog($LogString, $allgeds) { - global $INDEX_DIRECTORY; - - if (empty($allgeds)) - return; +function AddToSearchLog($log_message, $geds) { + global $TBLPREFIX; $all_geds=get_all_gedcoms(); - - //-- do not allow code to be written to the log file - $LogString = preg_replace('/<\?.*\?>/', '*** CODE DETECTED ***', $LogString); - - foreach ($allgeds as $ged_id=>$ged_name) { - if (count($all_geds)) { - // If we have more than one gedcom, then need to load the settings - require get_config_file($ged_id); // Note: load locally, not globally - } + foreach ($geds as $ged_id=>$ged_name) { + require get_config_file($ged_id); // Note: load locally, not globally switch ($SEARCHLOG_CREATE) { case 'none': continue 2; + case 'database': + WT_DB::prepare( + "INSERT INTO {$TBLPREFIX}log (log_type, log_message, ip_address, user_id, gedcom_id) VALUES ('search', ?, ?, ?, ?)" + )->execute(array( + (count($all_geds)==count($geds) ? 'Global search: ' : 'Gedcom search: ').$log_message, + $_SERVER['REMOTE_ADDR'], + WT_USER_ID ? WT_USER_ID : null, + $ged_id + )); + break; case 'yearly': - $logfile=$INDEX_DIRECTORY.'srch-'.$ged_name.date('Y').'.log'; + $logfile=get_site_setting('INDEX_DIRECTORY').'srch-'.$ged_name.date('Y').'.log'; break; case 'monthly': - $logfile=$INDEX_DIRECTORY.'srch-'.$ged_name.date('Ym').'.log'; + $logfile=get_site_setting('INDEX_DIRECTORY').'srch-'.$ged_name.date('Ym').'.log'; break; case 'weekly': - $logfile=$INDEX_DIRECTORY.'srch-'.$ged_name.date('Ym').'-week'.date('W').'.log'; + $logfile=get_site_setting('INDEX_DIRECTORY').'srch-'.$ged_name.date('Ym').'-week'.date('W').'.log'; break; case 'daily': - default: - $logfile=$INDEX_DIRECTORY.'srch-'.$ged_name.date('Ymd').'.log'; + $logfile=get_site_setting('INDEX_DIRECTORY').'srch-'.$ged_name.date('Ymd').'.log'; break; } - if (is_writable($INDEX_DIRECTORY)) { - $logline='Date / Time: '.date('d.m.Y H:i:s').' - IP: '.$_SERVER['REMOTE_ADDR'].' - User: '.WT_USER_NAME.'<br />'; - if (count($allgeds)==count($all_geds)) { - $logline.='Searchtype: Global<br />'; - } else { - $logline.='Searchtype: Gedcom<br />'; - } - $logline.=$LogString.'<br /><br />'.WT_EOL; - $fp=fopen($logfile, 'a'); - flock($fp, 2); - fputs($fp, $logline); - flock($fp, 3); - fclose($fp); + $logline='Date / Time: '.date('d.m.Y H:i:s').' - IP: '.$_SERVER['REMOTE_ADDR'].' - User: '.WT_USER_NAME.'<br />'; + if (count($allgeds)==count($all_geds)) { + $logline.='Searchtype: Global<br />'; + } else { + $logline.='Searchtype: Gedcom<br />'; } + $logline.=$LogString.'<br /><br />'.WT_EOL; + $fp=fopen($logfile, 'a'); + flock($fp, 2); + fputs($fp, $logline); + flock($fp, 3); + fclose($fp); } } //----------------------------------- AddToChangeLog //-- requires a string to add into the changelog-file -function AddToChangeLog($LogString, $ged="") { - global $INDEX_DIRECTORY, $CHANGELOG_CREATE, $GEDCOM, $username, $SEARCHLOG_CREATE; - - //-- do not allow code to be written to the log file - $LogString = preg_replace('/<\?.*\?>/', "*** CODE DETECTED ***", $LogString); +function AddToChangeLog($log_message, $ged_id=WT_GED_ID) { + global $TBLPREFIX; - if (empty($ged)) - $ged = $GEDCOM; - $oldged = $GEDCOM; - $GEDCOM = $ged; - if ($ged!=$oldged) - include(get_config_file()); - if ($CHANGELOG_CREATE != "none") { - $REMOTE_ADDR = $_SERVER['REMOTE_ADDR']; - if (empty($CHANGELOG_CREATE)) - $CHANGELOG_CREATE="daily"; - if ($CHANGELOG_CREATE=="daily") - $logfile = $INDEX_DIRECTORY."/ged-" . $GEDCOM . date("Ymd") . ".log"; - if ($CHANGELOG_CREATE=="weekly") - $logfile = $INDEX_DIRECTORY."/ged-" . $GEDCOM . date("Ym") . "-week" . date("W") . ".log"; - if ($CHANGELOG_CREATE=="monthly") - $logfile = $INDEX_DIRECTORY."/ged-" . $GEDCOM . date("Ym") . ".log"; - if ($CHANGELOG_CREATE=="yearly") - $logfile = $INDEX_DIRECTORY."/ged-" . $GEDCOM . date("Y") . ".log"; - if (is_writable($INDEX_DIRECTORY)) { - $logline = date("d.m.Y H:i:s") . " - " . $REMOTE_ADDR . " - " . $LogString . "\r\n"; - $fp = fopen($logfile, "a"); - flock($fp, 2); - fputs($fp, $logline); - flock($fp, 3); - fclose($fp); - } + if ($ged_id!=WT_GED_ID) { + require get_config_file($ged_id); // Note: load locally, not globally + } + switch ($CHANGELOG_CREATE) { + case 'none': + break; + case 'database': + WT_DB::prepare( + "INSERT INTO {$TBLPREFIX}log (log_type, log_message, ip_address, user_id, gedcom_id) VALUES ('change', ?, ?, ?, ?)" + )->execute(array( + $log_message, + $_SERVER['REMOTE_ADDR'], + WT_USER_ID ? WT_USER_ID : null, + $ged_id + )); + break; + case 'yearly': + $logfile=get_site_setting('INDEX_DIRECTORY').'ged-'.$ged_name.date('Y').'.log'; + break; + case 'monthly': + $logfile=get_site_setting('INDEX_DIRECTORY').'ged-'.$ged_name.date('Ym').'.log'; + break; + case 'weekly': + $logfile=get_site_setting('INDEX_DIRECTORY').'ged-'.$ged_name.date('Ym').'-week'.date('W').'.log'; + break; + case 'daily': + $logfile=get_site_setting('INDEX_DIRECTORY').'ged-'.$ged_name.date('Ymd').'.log'; + break; } - $GEDCOM = $oldged; - if ($ged!=$oldged) - include(get_config_file()); + $LogString = preg_replace('/<\?.*\?>/', "*** CODE DETECTED ***", $log_message); + $logline = date("d.m.Y H:i:s") . " - " . $REMOTE_ADDR . " - " . $LogString . "\r\n"; + $fp=fopen($logfile, 'a'); + flock($fp, 2); + fputs($fp, $logline); + flock($fp, 3); + fclose($fp); } //----------------------------------- addMessage diff --git a/includes/classes/class_localclient.php b/includes/classes/class_localclient.php index fc84e6c076..cb55fa0144 100644 --- a/includes/classes/class_localclient.php +++ b/includes/classes/class_localclient.php @@ -111,7 +111,6 @@ class LocalClient extends ServiceClient { { // privatize the gedcoms returned $gedrec = privatize_gedcom($indi["gedcom"]); - //AddToLog(substr($gedrec,0,50)); // set the fields that exist and return all the results that are not private if(preg_match("~".$query."~i",$gedrec)>0) { @@ -127,7 +126,6 @@ class LocalClient extends ServiceClient { $results_array[] = $person; } } -// AddToLog('Found '.count($results_array).' after privatizing'); // set the number of possible results //$results[0]['totalResults'] = count($results_array); $results_array = array_slice($results_array,$start,$max); diff --git a/includes/classes/class_media.php b/includes/classes/class_media.php index 0966ea2848..8916be9573 100644 --- a/includes/classes/class_media.php +++ b/includes/classes/class_media.php @@ -241,7 +241,7 @@ class Media extends GedcomRecord { if ($this->fileExists()) { // alert the admin if we cannot determine the mime type of an existing file // as the media firewall will be unable to serve this file properly - AddToLog(i18n::translate('Media Firewall error: >Unknown Mimetype< for file').' >'.$this->file.'<'); + AddToLog('Media Firewall error: >Unknown Mimetype< for file >'.$this->file.'<', 'media'); } } else { $this->mime=$mime[$this->ext]; diff --git a/includes/classes/class_module.php b/includes/classes/class_module.php index 6402d15701..ead12a8782 100644 --- a/includes/classes/class_module.php +++ b/includes/classes/class_module.php @@ -96,7 +96,7 @@ abstract class WT_Module { $array[$module_name]=new $class(); } else { // Module has been deleted from disk? Remove it from the database. - AddToLog("Module {$module_name} has been deleted from disk - deleting from database"); + AddToLog("Module {$module_name} has been deleted from disk - deleting from database", 'config'); WT_DB::prepare("DELETE FROM {$TBLPREFIX}module_privacy WHERE module_name=?")->execute(array($module_name)); WT_DB::prepare("DELETE FROM {$TBLPREFIX}module WHERE module_name=?")->execute(array($module_name)); } diff --git a/includes/classes/class_serviceclient.php b/includes/classes/class_serviceclient.php index a0cbf160f9..ceacd3d6ea 100644 --- a/includes/classes/class_serviceclient.php +++ b/includes/classes/class_serviceclient.php @@ -111,7 +111,6 @@ class ServiceClient extends GedcomRecord { if (!class_exists('Soap_Client') || $this->client_type=='PEAR:SOAP') { require_once './SOAP/Client.php'; - //AddToLog('Using PEAR:SOAP library'); // get the wsdl and cache it $wsdl = new SOAP_WSDL($this->url); //change the encoding style @@ -737,7 +736,7 @@ class ServiceClient extends GedcomRecord { $result = $this->soapClient->getGedcomRecord($this->SID, $xref); if (PEAR::isError($result) || isset($result->faultcode) || get_class($result)=='SOAP_Fault' || is_object($result)) { if (isset($result->faultstring)) { - AddToLog($result->faultstring); + AddToLog($result->faultstring, 'error'); print $result->faultstring; } return $localrec; @@ -763,7 +762,7 @@ class ServiceClient extends GedcomRecord { $result = $this->soapClient->getGedcomRecord($this->SID, $xref); if (PEAR::isError($result) || isset($result->faultcode) || is_object($result) && get_class($result)=='SOAP_Fault') { if (isset($result->faultstring)) { - AddToLog($result->faultstring); + AddToLog($result->faultstring, 'error'); print $result->faultstring; } return $localrec; @@ -802,8 +801,8 @@ class ServiceClient extends GedcomRecord { // If there are no changes between the local and remote copies if (PEAR::isError($person) || isset($person->faultcode) || get_class($person)=='SOAP_Fault' || isset($person->error_message_prefix)) { - if (isset($person->faultstring)) AddToLog($person->faultstring); - else AddToLog($person->message); + if (isset($person->faultstring)) AddToLog($person->faultstring, 'error'); + else AddToLog($person->message, 'edit'); //-- update the last change time $pos1 = strpos($localrec, "1 CHAN"); if ($pos1!==false) { diff --git a/includes/controllers/search_ctrl.php b/includes/controllers/search_ctrl.php index f45787d99c..e0010db02a 100644 --- a/includes/controllers/search_ctrl.php +++ b/includes/controllers/search_ctrl.php @@ -491,7 +491,7 @@ class SearchControllerRoot extends BaseController { return; } - AddToLog("Search And Replace old:".$oldquery." new:".$this->replace); + AddToLog("Search And Replace old:".$oldquery." new:".$this->replace, 'edit'); $manual_save = true; // Include edit functions. require_once WT_ROOT.'includes/functions/functions_edit.php'; diff --git a/includes/functions/functions.php b/includes/functions/functions.php index b0b4012092..266bb566eb 100644 --- a/includes/functions/functions.php +++ b/includes/functions/functions.php @@ -394,7 +394,7 @@ function pgv_error_handler($errno, $errstr, $errfile, $errline) { } echo $fmt_msg; if (function_exists('AddToLog')) { - AddToLog($log_msg); + AddToLog($log_msg, 'error'); } if ($errno==1) { die(); @@ -2645,7 +2645,7 @@ function write_changes() { //-- release the mutex acquired above $mutex->Release(); - $logline = AddToLog("pgv_changes.php updated"); + $logline = AddToLog("pgv_changes.php updated", 'edit'); return true; } @@ -2797,7 +2797,7 @@ function get_report_list($force=false) { $fp = @fopen($INDEX_DIRECTORY."/reports.dat", "w"); @fwrite($fp, serialize($files)); @fclose($fp); - $logline = AddToLog("reports.dat updated"); + $logline = AddToLog("reports.dat updated", 'config'); return $files; } @@ -3044,7 +3044,7 @@ function CheckPageViews() { // The configured page view rate has been exceeded // - Log a message and then sleep to slow things down $text = "Permitted page view rate of {$MAX_VIEWS} per {$MAX_VIEW_TIME} seconds exceeded."; - AddToLog($text); + AddToLog($text, 'auth'); sleep($sleepTime); } } diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php index 804be4c6f4..0aa195f175 100644 --- a/includes/functions/functions_edit.php +++ b/includes/functions/functions_edit.php @@ -249,7 +249,7 @@ function replace_gedrec($gid, $gedrec, $chan=true, $linkpid='') { //-- delete records will be added back in when they are accepted //-- but we should add a warning to the log else if ($lastchange["type"]=="delete") { - AddToLog("Possible GEDCOM corruption: Attempting to replace GEDCOM record $gid which has already been marked for deletion."); + AddToLog("Possible GEDCOM corruption: Attempting to replace GEDCOM record $gid which has already been marked for deletion.", 'error'); } } } @@ -1993,19 +1993,6 @@ function addNewFact($fact) { } /** -* Add Debug Log -* -* This function adds debugging information to the log file -* only if debugging output is enabled in session.php -* @param string $logstr the string to add to the log -*/ -function addDebugLog($logstr) { - if (WT_DEBUG) { - AddToChangeLog($logstr); - } -} - -/** * This function splits the $glevels, $tag, $islink, and $text arrays so that the * entries associated with a SOUR record are separate from everything else. * diff --git a/includes/functions/functions_export.php b/includes/functions/functions_export.php index c70ab1b6ef..984a1b99ad 100644 --- a/includes/functions/functions_export.php +++ b/includes/functions/functions_export.php @@ -161,7 +161,7 @@ function gedcom_header($gedfile) { function createTempUser($userID, $rights, $gedcom) { if ($tempUserID=get_user_id($userID)) { delete_user($tempUserID); - AddToLog("deleted dummy user -> {$userID} <-, which was not deleted in a previous session"); + AddToLog("deleted dummy user -> {$userID} <-, which was not deleted in a previous session", 'auth'); } $ged_id=get_id_from_gedcom($gedcom); @@ -190,7 +190,7 @@ function createTempUser($userID, $rights, $gedcom) { set_user_gedcom_setting($tempUserID, $ged_id, 'canedit', 'none'); break; } - AddToLog("created dummy user -> {$userID} <- with level {$rights} to GEDCOM {$gedcom}"); + AddToLog("created dummy user -> {$userID} <- with level {$rights} to GEDCOM {$gedcom}", 'auth'); // Save things in cache $_SESSION["pgv_GEDCOM"] = $gedcom; @@ -366,7 +366,7 @@ function export_gedcom($gedcom, $gedout, $exportOptions) { if ($exportOptions['privatize']!='none') { $_SESSION["pgv_user"]=$_SESSION["org_user"]; delete_user($export_user_id); - AddToLog("deleted dummy user -> {$tempUserID} <-"); + AddToLog("deleted dummy user -> {$tempUserID} <-", 'auth'); } $GEDCOM = $oldGEDCOM; @@ -452,7 +452,7 @@ function export_gramps($gedcom, $gedout, $exportOptions) { if ($exportOptions['privatize']!='none') { $_SESSION["pgv_user"]=$_SESSION["org_user"]; delete_user($export_user_id); - AddToLog("deleted dummy user -> {$tempUserID} <-"); + AddToLog("deleted dummy user -> {$tempUserID} <-", 'auth'); } $GEDCOM = $oldGEDCOM; diff --git a/includes/functions/functions_import.php b/includes/functions/functions_import.php index 456ac18001..d35c1d065b 100644 --- a/includes/functions/functions_import.php +++ b/includes/functions/functions_import.php @@ -1299,7 +1299,7 @@ function write_file() { fclose($fp); //-- always release the mutex $mutex->Release(); - $logline = AddToLog($path." updated"); + $logline = AddToLog($path." updated", 'config'); return true; } @@ -1346,12 +1346,12 @@ function accept_changes($cid) { $pos2=find_newline_string($fcontents, "0", $pos1+5); if ($pos2===false) { $fcontents=substr($fcontents, 0, $pos1).'0 TRLR'.WT_EOL; - AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct"); + AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct", 'error'); } else { $fcontents=substr($fcontents, 0, $pos1).substr($fcontents, $pos2); } } else { - AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct. Deleted gedcom record $gid was not found in the gedcom file."); + AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct. Deleted gedcom record $gid was not found in the gedcom file.", 'error'); } } elseif ($change["type"]=="append") { $pos1=find_newline_string($fcontents, "0 TRLR"); @@ -1362,16 +1362,16 @@ function accept_changes($cid) { $pos2=find_newline_string($fcontents, "0", $pos1+5); if ($pos2===false) { $fcontents=substr($fcontents, 0, $pos1).'0 TRLR'.WT_EOL; - AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct"); + AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct", 'error'); } else { $fcontents=substr($fcontents, 0, $pos1).reformat_record_export($gedrec).substr($fcontents, $pos2); } } else { //-- attempted to replace a record that doesn't exist - AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct. Replaced gedcom record $gid was not found in the gedcom file."); + AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct. Replaced gedcom record $gid was not found in the gedcom file.", 'error'); $pos1=find_newline_string($fcontents, "0 TRLR"); $fcontents=substr($fcontents, 0, $pos1).reformat_record_export($gedrec).'0 TRLR'.WT_EOL; - AddToLog("Gedcom record $gid was appended back to the GEDCOM file."); + AddToLog("Gedcom record $gid was appended back to the GEDCOM file.", 'edit'); } } if (!isset($manual_save) || $manual_save==false) { @@ -1384,7 +1384,7 @@ function accept_changes($cid) { if (!isset($manual_save) || $manual_save==false) { write_changes(); } - $logline = AddToLog("Accepted change $cid " . $change["type"] . " into database"); + $logline = AddToLog("Accepted change $cid " . $change["type"] . " into database", 'edit'); if (isset ($change["linkpid"])) { accept_changes($change["linkpid"] . "_" . $GEDCOM); } diff --git a/includes/functions/functions_mediadb.php b/includes/functions/functions_mediadb.php index 9c3ea2cfc4..0e1bc1c4c9 100644 --- a/includes/functions/functions_mediadb.php +++ b/includes/functions/functions_mediadb.php @@ -929,7 +929,7 @@ function process_uploadMedia_form() { $error .= i18n::translate('There was an error uploading your file.')."<br />".file_upload_error_text($_FILES["mediafile".$i]["error"])."<br />"; } else { @chmod(filename_decode($destFolder.$mediaFile), WT_PERM_FILE); - AddToLog("Media file {$folderName}{$mediaFile} uploaded"); + AddToLog("Media file {$folderName}{$mediaFile} uploaded", 'media'); } } if ($error=="" && !empty($_FILES["thumbnail".$i]["name"])) { @@ -939,7 +939,7 @@ function process_uploadMedia_form() { $error .= i18n::translate('There was an error uploading your file.')."<br />".file_upload_error_text($_FILES["thumbnail".$i]["error"])."<br />"; } else { @chmod(filename_decode($destThumbFolder.$mediaFile), WT_PERM_FILE); - AddToLog("Media file {$thumbFolderName}{$mediaFile} uploaded"); + AddToLog("Media file {$thumbFolderName}{$mediaFile} uploaded", 'media'); } } if ($error=="" && empty($_FILES["mediafile".$i]["name"]) && !empty($_FILES["thumbnail".$i]["name"])) { @@ -949,7 +949,7 @@ function process_uploadMedia_form() { $error .= i18n::translate('There was an error uploading your file.')."<br />".file_upload_error_text($_FILES["thumbnail".$i]["error"])."<br />"; } else { @chmod(filename_decode($folderName.$mediaFile), WT_PERM_FILE); - AddToLog("Media file {$folderName}{$mediaFile} copied from {$thumbFolderName}{$mediaFile}"); + AddToLog("Media file {$folderName}{$mediaFile} copied from {$thumbFolderName}{$mediaFile}", 'media'); } } if ($error=="" && !empty($_FILES["mediafile".$i]["name"]) && empty($_FILES["thumbnail".$i]["name"])) { @@ -966,7 +966,7 @@ function process_uploadMedia_form() { } else { echo i18n::translate('Thumbnail %s generated automatically.', $thumbnail); print "<br />"; - AddToLog("Media thumbnail {$thumbnail} generated"); + AddToLog("Media thumbnail {$thumbnail} generated", 'media'); } } } @@ -1874,11 +1874,11 @@ function hasMemoryForImage($serverFilename, $debug_verboseLogging=false) { $memorySpare = $memoryAvailable - $memoryUsed - $memoryNeeded; if ($memorySpare > 0) { // we have enough memory to load this file - if ($debug_verboseLogging) AddToLog("Media: >about to load< file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory avail: ".$memoryAvailable." used: ".$memoryUsed." needed: ".$memoryNeeded." spare: ".$memorySpare); + if ($debug_verboseLogging) AddToLog("Media: >about to load< file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory avail: ".$memoryAvailable." used: ".$memoryUsed." needed: ".$memoryNeeded." spare: ".$memorySpare, 'media'); return true; } else { // not enough memory to load this file - AddToLog("Media: >image too large to load< file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory avail: ".$memoryAvailable." used: ".$memoryUsed." needed: ".$memoryNeeded." spare: ".$memorySpare); + AddToLog("Media: >image too large to load< file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory avail: ".$memoryAvailable." used: ".$memoryUsed." needed: ".$memoryNeeded." spare: ".$memorySpare, 'media'); return false; } } else { diff --git a/includes/session_spider.php b/includes/session_spider.php index a894c8e976..f5068ac495 100644 --- a/includes/session_spider.php +++ b/includes/session_spider.php @@ -89,7 +89,7 @@ try { if ($banned_ip->comment) { $log_msg.=' ('.$banned_ip->comment.')'; } - AddToLog($log_msg); + AddToLog($log_msg, 'auth'); header('HTTP/1.1 403 Access Denied'); exit; } @@ -161,9 +161,7 @@ if ($quitReason != "") { //-- load db specific functions require_once WT_ROOT.'includes/functions/functions_db.php'; require_once WT_ROOT.'includes/authentication.php'; // -- load the authentication system - AddToLog("MSG>{$quitReason}; script terminated."); - AddToLog("UA>{$ua}<"); - AddToLog("URI>{$_SERVER["REQUEST_URI"]}<"); + AddToLog("MSG>{$quitReason}; script terminated. UA>{$ua}< >{$_SERVER["REQUEST_URI"]}<", 'auth'); } header("HTTP/1.0 403 Forbidden"); print "Hackers are not welcome here."; @@ -380,9 +378,7 @@ if(!empty($SEARCH_SPIDER)) { if ($logSpider) { //adds a message to the log that a new spider session is starting require_once WT_ROOT.'includes/authentication.php'; // -- Loaded early so AddToLog works - AddToLog("New search engine encountered: ->".$outstr."<-"); - AddToLog("UA>{$ua}<"); - AddToLog("URI>{$_SERVER["REQUEST_URI"]}<"); + AddToLog("New search engine encountered: ->".$outstr."<- UA>{$ua}< >{$_SERVER["REQUEST_URI"]}<", 'auth'); } } if(isset($_SESSION['last_spider_date'])) { @@ -390,7 +386,7 @@ if(!empty($SEARCH_SPIDER)) { //adds a message to the log that a new spider session is starting if ($logSpider) { require_once WT_ROOT.'includes/authentication.php'; // -- Loaded early so AddToLog works - AddToLog("Returning search engine last seen ".$_SESSION['spider_count']." times on ".$_SESSION['last_spider_date']." from ".$_SESSION['last_spider_ip']." ->".$outstr."<-"); + AddToLog("Returning search engine last seen ".$_SESSION['spider_count']." times on ".$_SESSION['last_spider_date']." from ".$_SESSION['last_spider_ip']." ->".$outstr."<-", 'auth'); } $_SESSION['last_spider_date'] = $spiderdate; $spidercount = 1; diff --git a/login_register.php b/login_register.php index a0a7e17a1c..b6ac34b881 100644 --- a/login_register.php +++ b/login_register.php @@ -96,13 +96,13 @@ switch ($action) { print "<div class=\"center\">"; $user_id=get_user_id($user_name); if (!$user_id) { - AddToLog("New password requests for user ".$user_name." that does not exist"); + AddToLog("New password requests for user ".$user_name." that does not exist", 'auth'); print "<span class=\"warning\">"; echo i18n::translate('Could not verify the information you entered. Please try again or contact the site administrator for more information.'); print "</span><br />"; } else { if (getUserEmail($user_id)=='') { - AddToLog("Unable to send password to user ".$user_name." because they do not have an email address"); + AddToLog("Unable to send password to user ".$user_name." because they do not have an email address", 'auth'); print "<span class=\"warning\">"; echo i18n::translate('Could not verify the information you entered. Please try again or contact the site administrator for more information.'); print "</span><br />"; @@ -143,7 +143,7 @@ switch ($action) { <tr><td class="wrap <?php print $TEXT_DIRECTION; ?>"><?php print i18n::translate('Hello...<br /><br />An email with your new password was sent to the address we have on file for <b>%s</b>.<br /><br />Please check your email account; you should receive our message soon.<br /><br />Recommendation:<br />You should login to this site with your new password as soon as possible, and you should change your password to maintain your data\'s security.', $user_name);?></td></tr> </table> <?php - AddToLog("Password request was sent to user: ".$user_name); + AddToLog("Password request was sent to user: ".$user_name, 'auth'); i18n::init(WT_LOCALE); // Reset language } @@ -306,7 +306,7 @@ switch ($action) { exit; } if ((stripos($user_name, "SUNTZU")!==false) || (stripos($user_email, "SUNTZU")!==false)) { - AddToLog("SUNTZU hacker"); + AddToLog("SUNTZU hacker", 'auth'); print "Go Away!"; exit; } @@ -315,12 +315,12 @@ switch ($action) { if (!isset($_SERVER['HTTP_REFERER']) || stristr($_SERVER['HTTP_REFERER'],"login_register.php")===false) { print "<center><br /><span class=\"error\">Invalid page referer.</span>\n"; print "<br /><br /></center>"; - AddToLog('Invalid page referer while trying to register a user. Possible spam attack.'); + AddToLog('Invalid page referer while trying to register a user. Possible spam attack.', 'auth'); exit; } if ((!isset($_SESSION["good_to_send"]))||($_SESSION["good_to_send"]!==true)) { - AddToLog('Invalid session reference while trying to register a user. Possible spam attack.'); + AddToLog('Invalid session reference while trying to register a user. Possible spam attack.', 'auth'); exit; } $_SESSION["good_to_send"] = false; @@ -331,7 +331,7 @@ switch ($action) { print "<div class=\"center\">"; $user_created_ok = false; - AddToLog("User registration requested for: ".$user_name); + AddToLog("User registration requested for: ".$user_name, 'auth'); if (get_user_id($user_name)) { print "<span class=\"warning\">".i18n::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.')."</span><br /><br />"; @@ -471,7 +471,7 @@ switch ($action) { exit; } $QUERY_STRING = ""; - AddToLog("User attempted to verify hashcode: ".$user_name); + AddToLog("User attempted to verify hashcode: ".$user_name, 'auth'); // Change to the new user's language $user_id=get_user_id($user_name); @@ -494,7 +494,7 @@ switch ($action) { if (!$REQUIRE_ADMIN_AUTH_REGISTRATION) { set_user_setting($user_id, 'verified_by_admin', 'yes'); } - AddToLog("User verified: ".$user_name); + AddToLog("User verified: ".$user_name, 'auth'); // switch language to webmaster settings i18n::init(get_user_setting($WEBMASTER_EMAIL, 'language')); @@ -339,7 +339,7 @@ if (check_media_structure()) { } } else { print "<div class=\"error\">".$directory." ".i18n::translate('Directory does not exist.')."</div>"; - AddToLog($directory." ".i18n::translate('Directory does not exist.')); + AddToLog('Directory does not exist.'.$directory, 'media'); } // Thumbs directory check @@ -374,22 +374,22 @@ if (check_media_structure()) { if (!isset($error)) { if (count($files) > 0 ) { print "<div class=\"error\">".$directory." -- ".i18n::translate('Directory not empty.')."</div>"; - AddToLog($directory." -- ".i18n::translate('Directory not empty.')); + AddToLog($directory." -- ".i18n::translate('Directory not empty.'), 'media'); $clean = false; } if (count($thumbfiles) > 0) { print "<div class=\"error\">".$thumbdir." -- ".i18n::translate('Directory not empty.')."</div>"; - AddToLog($thumbdir." -- ".i18n::translate('Directory not empty.')); + AddToLog($thumbdir." -- ".i18n::translate('Directory not empty.'), 'media'); $clean = false; } if (count($files_fw) > 0 ) { print "<div class=\"error\">".$directory_fw." -- ".i18n::translate('Directory not empty.')."</div>"; - AddToLog($directory_fw." -- ".i18n::translate('Directory not empty.')); + AddToLog($directory_fw." -- ".i18n::translate('Directory not empty.'), 'media'); $clean = false; } if (count($thumbfiles_fw) > 0) { print "<div class=\"error\">".$thumbdir_fw." -- ".i18n::translate('Directory not empty.')."</div>"; - AddToLog($thumbdir_fw." -- ".i18n::translate('Directory not empty.')); + AddToLog($thumbdir_fw." -- ".i18n::translate('Directory not empty.'), 'media'); $clean = false; } else $clean = true; @@ -411,27 +411,27 @@ if (check_media_structure()) { if (@is_dir(filename_decode($thumbdir_fw))) $resthumb_fw = @rmdir(filename_decode(substr($thumbdir_fw, 0, -1))); if ($resdir && $resthumb && $resdir_fw && $resthumb_fw) { print i18n::translate('Media and thumbnail directories successfully removed.'); - AddToLog($directory." -- ".i18n::translate('Media and thumbnail directories successfully removed.')); + AddToLog($directory." -- ".i18n::translate('Media and thumbnail directories successfully removed.'), 'media'); } else { if (!$resdir) { print "<div class=\"error\">".i18n::translate('Media directory not removed.')."</div>"; - AddToLog($directory." -- ".i18n::translate('Media directory not removed.')); + AddToLog($directory." -- ".i18n::translate('Media directory not removed.'), 'media'); } else if (!$resdir_fw) { print "<div class=\"error\">".i18n::translate('Media directory not removed.')."</div>"; - AddToLog($directory_fw." -- ".i18n::translate('Media directory not removed.')); + AddToLog($directory_fw." -- ".i18n::translate('Media directory not removed.'), 'media'); } else { print i18n::translate('Media directory successfully removed.'); - AddToLog($directory." -- ".i18n::translate('Media directory successfully removed.')); + AddToLog($directory." -- ".i18n::translate('Media directory successfully removed.'), 'media'); } if (!$resthumb) { print "<div class=\"error\">".i18n::translate('Thumbnail directory not removed.')."</div>"; - AddToLog($thumbdir." -- ".i18n::translate('Thumbnail directory not removed.')); + AddToLog($thumbdir." -- ".i18n::translate('Thumbnail directory not removed.'), 'media'); } else if (!$resthumb_fw) { print "<div class=\"error\">".i18n::translate('Thumbnail directory not removed.')."</div>"; - AddToLog($thumbdir_fw." -- ".i18n::translate('Thumbnail directory not removed.')); + AddToLog($thumbdir_fw." -- ".i18n::translate('Thumbnail directory not removed.'), 'media'); } else { print i18n::translate('Thumbnail directory successfully removed.'); - AddToLog($thumbdir." -- ".i18n::translate('Thumbnail directory successfully removed.')); + AddToLog($thumbdir." -- ".i18n::translate('Thumbnail directory successfully removed.'), 'media'); } } diff --git a/mediafirewall.php b/mediafirewall.php index bd5c35c3af..325a015aea 100644 --- a/mediafirewall.php +++ b/mediafirewall.php @@ -293,7 +293,7 @@ function textlength($t, $mxl, $text) { function imagettftextErrorHandler($errno, $errstr, $errfile, $errline) { global $useTTF, $serverFilename; // log the error - AddToLog("Media Firewall error: >".$errstr."< in file >".$serverFilename."< (".getImageInfoForLog($serverFilename).")" ); + AddToLog("Media Firewall error: >".$errstr."< in file >".$serverFilename."< (".getImageInfoForLog($serverFilename).")", 'error'); // change value of useTTF to false so the fallback watermarking can be used. $useTTF = false; @@ -506,9 +506,9 @@ if ( $generatewatermark ) { $im = @$imCreateFunc($serverFilename); if ($im) { - if ($debug_verboseLogging) AddToLog("Media Firewall log: >about to watermark< file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory used: ".memory_get_usage()); + if ($debug_verboseLogging) AddToLog("Media Firewall log: >about to watermark< file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory used: ".memory_get_usage(), 'media'); $im = applyWatermark($im); - if ($debug_verboseLogging) AddToLog("Media Firewall log: >watermark complete< file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory used: ".memory_get_usage()); + if ($debug_verboseLogging) AddToLog("Media Firewall log: >watermark complete< file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory used: ".memory_get_usage(), 'media'); $imSendFunc = 'image'.$type; // save the image, if preferences allow @@ -525,12 +525,12 @@ if ( $generatewatermark ) { $imSendFunc($im); imagedestroy($im); - if ($debug_verboseLogging) AddToLog("Media Firewall log: >done with < file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory used: ".memory_get_usage()); + if ($debug_verboseLogging) AddToLog("Media Firewall log: >done with < file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory used: ".memory_get_usage(), 'media'); exit; } else { // this image is defective. log it - AddToLog("Media Firewall error: >".i18n::translate('This media file is broken and cannot be watermarked')."< in file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory used: ".memory_get_usage()); + AddToLog("Media Firewall error: >".i18n::translate('This media file is broken and cannot be watermarked')."< in file >".$serverFilename."< (".getImageInfoForLog($serverFilename).") memory used: ".memory_get_usage(), 'media'); // set usewatermark to false so image will simply be passed through below $usewatermark = false; diff --git a/message.php b/message.php index 01af2dbb3e..c4d27ac040 100644 --- a/message.php +++ b/message.php @@ -86,7 +86,7 @@ if (($action=="send")&&(isset($_SESSION["good_to_send"]))&&($_SESSION["good_to_s if (!isset($_SERVER['HTTP_REFERER']) || stristr($_SERVER['HTTP_REFERER'],"message.php")===false) { print "<center><br /><span class=\"error\">Invalid page referer.</span>\n"; print "<br /><br /></center>"; - AddToLog('Invalid page referer while trying to send a message. Possible spam attack.'); + AddToLog('Invalid page referer while trying to send a message. Possible spam attack.', 'auth'); $action="compose"; } if ($action!="compose") { @@ -139,16 +139,16 @@ if (($action=="send")&&(isset($_SESSION["good_to_send"]))&&($_SESSION["good_to_s print i18n::translate('Message successfully sent to %s', "<b>".getUserFullName($to_user_id)."</b>"); print "<br />"; } else { - AddToLog('Invalid TO user.'.$to.' Possible spam attack.'); + AddToLog('Invalid TO user.'.$to.' Possible spam attack.', 'auth'); } } else { - AddToLog('Unable to send message. TO:'.$to.' FROM:'.$from); + AddToLog('Unable to send message. TO:'.$to.' FROM:'.$from, 'error'); } $i++; } } } -else if ($action=="send") AddToLog('Invalid Compose Session while trying to send a message. Possible spam attack.'); +else if ($action=="send") AddToLog('Invalid Compose Session while trying to send a message. Possible spam attack.', 'auth'); if ($action=="compose") { print '<span class="subheaders">'.i18n::translate('Send Message').'</span>'; diff --git a/modules/clippings/clippings_ctrl.php b/modules/clippings/clippings_ctrl.php index cb0d848f15..edfb64cccc 100644 --- a/modules/clippings/clippings_ctrl.php +++ b/modules/clippings/clippings_ctrl.php @@ -403,7 +403,7 @@ class ClippingsControllerRoot extends BaseController { if ($this->privatize_export!='none') {
$_SESSION["pgv_user"]=$_SESSION["org_user"];
delete_user($export_user_id);
- AddToLog("deleted dummy user -> {$tempUserID} <-");
+ AddToLog("deleted dummy user -> {$tempUserID} <-", 'auth');
}
if($this->IncludeMedia == "yes")
diff --git a/modules/googlemap/editconfig.php b/modules/googlemap/editconfig.php index 28a5a1e46f..3fb75b5390 100644 --- a/modules/googlemap/editconfig.php +++ b/modules/googlemap/editconfig.php @@ -133,7 +133,7 @@ if ($action=="update" && !isset($security_user)) { set_site_setting('GM_PRE_POST_MODE_'.$i, $_POST['NEW_GM_PRE_POST_MODE_'.$i]); } - AddToLog('Googlemap config updated'); + AddToLog('Googlemap config updated', 'config'); // read the config file again, to set the vars require WT_ROOT.'modules/googlemap/defaultconfig.php'; } diff --git a/modules/lightbox/lb_editconfig.php b/modules/lightbox/lb_editconfig.php index 251dc881e7..3e5cecd986 100644 --- a/modules/lightbox/lb_editconfig.php +++ b/modules/lightbox/lb_editconfig.php @@ -69,7 +69,7 @@ if ($action=='update' && !isset($security_user)) { set_site_setting('LB_URL_WIDTH', $_POST['NEW_LB_URL_WIDTH']); set_site_setting('LB_URL_HEIGHT', $_POST['NEW_LB_URL_HEIGHT']); - AddToLog('Lightbox config updated'); + AddToLog('Lightbox config updated', 'config'); // read the config file again, to set the vars require WT_ROOT.'modules/lightbox/lb_defaultconfig.php'; } diff --git a/modules/sitemap/index.php b/modules/sitemap/index.php index 878cfd3fc5..7c8bfee51f 100644 --- a/modules/sitemap/index.php +++ b/modules/sitemap/index.php @@ -175,7 +175,7 @@ if ($action=="sendFiles") { echo "</urlset>"; $_SESSION["pgv_user"]=$_SESSION["org_user"]; delete_user($sitemap_user_id); - AddToLog("deleted dummy user -> #SiteMap# <-"); + AddToLog("deleted dummy user -> #SiteMap# <-", 'auth'); $GEDCOM = $oldGEDCOM; exit; } @@ -605,7 +605,7 @@ try { " setting_name VARCHAR(32) NOT NULL,". " setting_value VARCHAR(255) NOT NULL,". " PRIMARY KEY (gedcom_id, setting_name),". - " FOREIGN KEY fk1 (gedcom_id) REFERENCES {$TBLPREFIX}gedcom (gedcom_id)". + " FOREIGN KEY fk1 (gedcom_id) REFERENCES {$TBLPREFIX}gedcom (gedcom_id) /* ON DELETE CASCADE */". ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); $dbh->exec( @@ -626,7 +626,7 @@ try { " setting_name VARCHAR(32) NOT NULL,". " setting_value VARCHAR(255) NOT NULL,". " PRIMARY KEY (user_id, setting_name),". - " FOREIGN KEY fk1 (user_id) REFERENCES {$TBLPREFIX}user (user_id)". + " FOREIGN KEY fk1 (user_id) REFERENCES {$TBLPREFIX}user (user_id) /* ON DELETE CASCADE */". ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); $dbh->exec( @@ -636,8 +636,25 @@ try { " setting_name VARCHAR(32) NOT NULL,". " setting_value VARCHAR(255) NOT NULL,". " PRIMARY KEY (user_id, gedcom_id, setting_name),". - " FOREIGN KEY fk1 (user_id) REFERENCES {$TBLPREFIX}user (user_id),". - " FOREIGN KEY fk2 (gedcom_id) REFERENCES {$TBLPREFIX}gedcom (gedcom_id)". + " FOREIGN KEY fk1 (user_id) REFERENCES {$TBLPREFIX}user (user_id) /* ON DELETE CASCADE */,". + " FOREIGN KEY fk2 (gedcom_id) REFERENCES {$TBLPREFIX}gedcom (gedcom_id) /* ON DELETE CASCADE */". + ") COLLATE utf8_unicode_ci ENGINE=InnoDB" + ); + $dbh->exec( + "CREATE TABLE IF NOT EXISTS {$TBLPREFIX}log (". + " log_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,". + " log_type ENUM('auth', 'change', 'config', 'debug', 'edit', 'error', 'media', 'search') NOT NULL,". + " log_message TEXT NOT NULL,". + " ip_address VARCHAR(40) NOT NULL,". + " user_id INTEGER NULL,". + " gedcom_id INTEGER NULL,". + " KEY ix1 (log_time),". + " KEY ix2 (log_type),". + " KEY ix3 (ip_address),". + " KEY ix4 (user_id),". + " KEY ix5 (gedcom_id),". + " FOREIGN KEY fk1 (user_id) REFERENCES {$TBLPREFIX}user (user_id) /* ON DELETE SET NULL */,". + " FOREIGN KEY fk2 (gedcom_id) REFERENCES {$TBLPREFIX}gedcom (gedcom_id) /* ON DELETE SET NULL */". ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); $dbh->exec( @@ -894,8 +911,8 @@ try { " component ENUM('menu', 'sidebar', 'tab') NOT NULL,". " access_level TINYINT NOT NULL,". " PRIMARY KEY (module_name, gedcom_id, component),". - " FOREIGN KEY fk1 (module_name) REFERENCES {$TBLPREFIX}module (module_name),". - " FOREIGN KEY fk2 (gedcom_id ) REFERENCES {$TBLPREFIX}gedcom (gedcom_id )". + " FOREIGN KEY fk1 (module_name) REFERENCES {$TBLPREFIX}module (module_name) /* ON DELETE CASCADE */,". + " FOREIGN KEY fk2 (gedcom_id ) REFERENCES {$TBLPREFIX}gedcom (gedcom_id) /* ON DELETE CASCADE */". ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); $dbh->exec( diff --git a/uploadgedcom.php b/uploadgedcom.php index acdf1a42ec..a2a4f2f455 100644 --- a/uploadgedcom.php +++ b/uploadgedcom.php @@ -113,7 +113,7 @@ else if ($check == "add") { $newgedcom = preg_replace('/[\r\n]+/', WT_EOL, $newgedcom); fwrite($fp, $newgedcom); fclose($fp); - $logline = AddToLog($GEDFILENAME." updated"); + $logline = AddToLog($GEDFILENAME." updated", 'config'); $verify = "validate_form"; $exists = true; // NOTE: Go straight to import, no other settings needed @@ -1092,7 +1092,7 @@ if ($stage == 1) { print "<span class=\"error\">Unable to copy updated GEDCOM file ".$INDEX_DIRECTORY.basename($GEDCOM_FILE).".new to ".$GEDCOM_FILE."</span><br />"; } else { @unlink($INDEX_DIRECTORY.basename($GEDCOM_FILE).".new"); - $logline = AddToLog($GEDCOM_FILE." updated"); + $logline = AddToLog($GEDCOM_FILE." updated", 'config'); } $newtime = time(); $exectime = $newtime - $oldtime; diff --git a/useradmin.php b/useradmin.php index 04f16b7acc..1e9af16a3c 100644 --- a/useradmin.php +++ b/useradmin.php @@ -105,7 +105,7 @@ if ($action=='deleteuser') { $user_id=get_user_id($username); if ($user_id!=WT_USER_ID) { delete_user($user_id); - AddToLog("deleted user ->{$username}<-"); + AddToLog("deleted user ->{$username}<-", 'auth'); } // User data is cached, so reload the page to ensure we're up to date header("Location: useradmin.php"); @@ -127,9 +127,9 @@ if ($action=='createuser' || $action=='edituser2') { if ($user_id=create_user($username, $realname, $emailaddress, crypt($pass1))) { set_user_setting($user_id, 'reg_timestamp', date('U')); set_user_setting($user_id, 'sessiontime', '0'); - AddToLog("User ->{$username}<- created"); + AddToLog("User ->{$username}<- created", 'auth'); } else { - AddToLog("User ->{$username}<- was not created"); + AddToLog("User ->{$username}<- was not created", 'auth'); $user_id=get_user_id($username); } } else { @@ -138,12 +138,12 @@ if ($action=='createuser' || $action=='edituser2') { // Change password if ($action=='edituser2' && !empty($pass1)) { set_user_password($user_id, crypt($pass1)); - AddToLog("User ->{$oldusername}<- had password changed"); + AddToLog("User ->{$oldusername}<- had password changed", 'auth'); } // Change username if ($action=='edituser2' && $username!=$oldusername) { rename_user($oldusername, $username); - AddToLog("User ->{$oldusername}<- renamed to ->{$username}<-"); + AddToLog("User ->{$oldusername}<- renamed to ->{$username}<-", 'auth'); } // Create/change settings that can be updated in the user's gedcom record? $email_changed=($emailaddress!=getUserEmail($user_id)); @@ -946,7 +946,7 @@ if ($action == "cleanup2") { $var = "del_".str_replace(array(".", "-", " "), array("_", "_", "_"), $user_name); if (safe_POST($var)=='yes') { delete_user($user_id); - AddToLog("deleted user ->{$user_name}<-"); + AddToLog("deleted user ->{$user_name}<-", 'auth'); echo i18n::translate('Deleted user: '); echo $user_name, "<br />"; } else { $tempArray = unserialize(get_user_setting($user_id, 'canedit')); |
