This repository has been archived by the owner on Feb 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall20.xml
50 lines (43 loc) · 1.55 KB
/
install20.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>SimpleDeskTeam:ErrorLogCounter</id>
<version>1.0</version>
<file name="$sourcedir/Subs.php">
<operation><!-- Figure out the number of items -->
<search position="end" />
<add><![CDATA[
// SimpleDesk team: Error Log Counter
function get_error_log_count_for_menu()
{
global $context, $smcFunc;
if (!$context['user']['is_admin'])
return '';
if (!isset($context['num_errors_in_log']))
{
$query = $smcFunc['db_query']('', '
SELECT COUNT(id_error) AS errors
FROM {db_prefix}log_errors',
array()
);
if ($row = $smcFunc['db_fetch_row']($query))
$context['num_errors_in_log'] = $row[0] > 0 ? ' (<strong>' . $row[0] . '</strong>)' : '';
else
$context['num_errors_in_log'] = '';
}
return $context['num_errors_in_log'];
}
]]></add>
</operation>
<operation><!-- Add it to the menu item -->
<search position="replace"><![CDATA['title' => $txt['errlog'],]]></search>
<add><![CDATA['title' => $txt['errlog'] . get_error_log_count_for_menu(),]]></add>
</operation>
</file>
<file name="$sourcedir/Admin.php">
<operation><!-- Add to the logs menu too -->
<search position="replace"><![CDATA['errorlog' => array($txt['errlog'],]]></search>
<add><![CDATA['errorlog' => array($txt['errlog'] . get_error_log_count_for_menu(),]]></add>
</operation>
</file>
</modification>