Not Reviewed
Show More
Add another comment
| @@ -13,8 +13,7 define('MTS_TYPE_META', 8); // Changes in the metatype manager | |||||
|
|
13 | define('MTS_TUMBLR', 10); |
|
13 | define('MTS_TUMBLR', 10); |
|
|
14 |
|
14 | ||
|
|
15 |
|
15 | ||
|
|
16 |
|
16 | define('MTA_ADD', 'create'); // Creation action | |
|
|
17 | define('MTA_ADD', 'create'); // Creation action |
|
||
|
|
18 | define('MTA_INSERT', 'create'); // Creation action |
|
17 | define('MTA_INSERT', 'create'); // Creation action |
|
|
19 | define('MTA_DELETE', 'delete'); // Deletion action |
|
18 | define('MTA_DELETE', 'delete'); // Deletion action |
|
|
20 | define('MTA_REMOVE', 'delete'); // Deletion action |
|
19 | define('MTA_REMOVE', 'delete'); // Deletion action |
| @@ -24,21 +23,29 define('MTA_CHANGE', 'update'); // Modification action | |||||
|
|
24 |
|
23 | ||
|
|
25 | function adminlog($msg, $section, $action, $level=E_USER_NOTICE, $email=false) |
|
24 | function adminlog($msg, $section, $action, $level=E_USER_NOTICE, $email=false) |
|
|
26 | { |
|
25 | { |
|
|
27 |
global $ |
|
26 | global $dbConnection, $currentuser; |
|
|
28 |
|
27 | ||
|
|
29 |
$sql = |
|
28 | $sql = 'INSERT INTO admin_log (contributor, section, action, level, message) VALUES (?, ?, ?, ?, ?)'; |
|
|
30 | (is_numeric($currentuser->id) ? $currentuser->id : "NULL"), $section, mysqli_real_escape_string($mtdb->link, $action), $level, mysqli_real_escape_string($mtdb->link, $msg)); |
|
29 | $stmt = $dbConnection->prepare($sql); |
|
|
31 | $mtdb->query( $sql ) or die($sql."<br>".mysqli_error($mtdb->link)."<br>\n".var_export(debug_backtrace())); |
|
30 | $stmt->bindValue(1, is_numeric($currentuser->id) ? $currentuser->id : 'NULL'); |
|
|
|
31 | $stmt->bindValue(2, $section); | ||
|
|
|
32 | $stmt->bindValue(3, $action); | ||
|
|
|
33 | $stmt->bindValue(4, $level); | ||
|
|
|
34 | $stmt->bindValue(5, $msg); | ||
|
|
|
35 | $stmt->execute() or die($sql . '<br>' . $stmt->errorCode() . '<br>' . var_export(debug_backtrace())); | ||
|
|
32 |
|
36 | ||
|
|
33 | // Log all important sorts of messages in the Apache log |
|
37 | // Log all important sorts of messages in the Apache log |
|
|
34 |
if( $level & (E_USER_WARNING | E_USER_ERROR) ) |
|
38 | if( $level & (E_USER_WARNING | E_USER_ERROR) ) |
|
|
|
39 | { | ||
|
|
35 | error_log($msg, 0); |
|
40 | error_log($msg, 0); |
|
|
36 | } |
|
41 | } |
|
|
37 |
|
42 | ||
|
|
38 | // Email critical messages and those for which email is requested |
|
43 | // Email critical messages and those for which email is requested |
|
|
39 |
if($email || E_USER_ERROR == $level || E_ERROR == $level) |
|
44 | if($email || E_USER_ERROR == $level || E_ERROR == $level) |
|
|
|
45 | { | ||
|
|
40 | // Pretty printing |
|
46 | // Pretty printing |
|
|
41 |
switch($level) |
|
47 | switch($level) |
|
|
|
48 | { | ||
|
|
42 | case E_USER_NOTICE: |
|
49 | case E_USER_NOTICE: |
|
|
43 | case E_NOTICE: |
|
50 | case E_NOTICE: |
|
|
44 | $importance = 'Notice'; |
|
51 | $importance = 'Notice'; |
| @@ -56,7 +63,8 function adminlog($msg, $section, $action, $level=E_USER_NOTICE, $email=false) | |||||
|
|
56 | break; |
|
63 | break; |
|
|
57 | } |
|
64 | } |
|
|
58 |
|
65 | ||
|
|
59 |
switch($section) |
|
66 | switch($section) |
|
|
|
67 | { | ||
|
|
60 | case MTS_LOGIN: $area = 'User login'; break; |
|
68 | case MTS_LOGIN: $area = 'User login'; break; |
|
|
61 | case MTS_USER: $area = 'Modify user'; break; |
|
69 | case MTS_USER: $area = 'Modify user'; break; |
|
|
62 | case MTS_PAGE: $area = 'Modify page'; break; |
|
70 | case MTS_PAGE: $area = 'Modify page'; break; |
Comments 0
You need to be logged in to leave comments.
Login now
