فهرست منبع

- bugfixes: fix log record when moved user_auth ip to another user
- bugfixes: fixed length email subject

Dmitriev Roman 4 سال پیش
والد
کامیت
04bff14897
2فایلهای تغییر یافته به همراه9 افزوده شده و 2 حذف شده
  1. 1 1
      html/admin/users/editauth.php
  2. 8 1
      html/inc/common.php

+ 1 - 1
html/admin/users/editauth.php

@@ -100,7 +100,7 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
 
 if (isset($_POST["moveauth"]) and !$old_auth_info['deleted']) {
     $new_parent_id = $_POST["f_new_parent"]*1;
-    apply_auth_rule($db_link,$id,$new_parent_id);
+    $changes=apply_auth_rule($db_link,$id,$new_parent_id);
     LOG_WARNING($db_link,"Адрес доступа перемещён к другому пользователю! Применено: $changes",$id);
     header("Location: " . $_SERVER["REQUEST_URI"]);
     exit;

+ 8 - 1
html/inc/common.php

@@ -1628,6 +1628,13 @@ global $L_DEBUG;
 if (isset($debug) and $debug) { write_log($db,$msg,$L_DEBUG,$auth_id); }
 }
 
+function get_first_line($msg) {
+if (empty $msg) { return; }
+preg_match('/(.*)(\n|\<br\\>)/', $msg, $matches);
+if (!empty $matches[1]) { return $matches[1]; }
+return;
+}
+
 function email ($level,$msg) {
 global $send_email;
 global $admin_email;
@@ -1638,7 +1645,7 @@ global $L_ERROR;
 if (!$send_email) { return; }
 if (!($level === $L_WARNING or $level === $L_ERROR)) { return; }
 
-$subject = substr($msg,0,80);
+$subject = get_first_line($msg);
 
 if ($level === $L_WARNING) { $subject = "WARN: ".$subject."..."; $message = 'WARNING! Manager: '.$_SESSION['login'].' </br>'; }
 if ($level === $L_ERROR) { $subject = "ERROR: ".$subject."..."; $message = 'ERROR! Manager: '.$_SESSION['login'].' </br>'; }