|
1 <?php |
|
2 /* |
|
3 * Decir |
|
4 * Version 0.1 |
|
5 * Copyright (C) 2007 Dan Fuhry |
|
6 * admin_base.php - lowlevel loader for the Decir admin panel |
|
7 * |
|
8 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
|
9 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
|
10 * |
|
11 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. |
|
13 */ |
|
14 |
|
15 $decir_menu['DecirIndex'] = 'Administration home'; |
|
16 |
|
17 function page_Admin_DecirIndex() |
|
18 { |
|
19 global $db, $session, $paths, $template, $plugins; // Common objects |
|
20 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
21 { |
|
22 echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
23 return; |
|
24 } |
|
25 |
|
26 // |
|
27 // Obtain forum statistics |
|
28 // |
|
29 |
|
30 // Number of users |
|
31 $q = $db->sql_query('SELECT COUNT(user_id)-1 AS num_users FROM ' . table_prefix . 'users;'); |
|
32 if ( !$q ) |
|
33 $db->_die(); |
|
34 |
|
35 $row = $db->fetchrow(); |
|
36 $db->free_result(); |
|
37 $num_users = $row['num_users']; |
|
38 |
|
39 // Number of posts |
|
40 $q = $db->sql_query('SELECT COUNT(post_id) AS num_posts FROM ' . table_prefix . 'decir_posts;'); |
|
41 if ( !$q ) |
|
42 $db->_die(); |
|
43 |
|
44 $row = $db->fetchrow(); |
|
45 $db->free_result(); |
|
46 $num_posts = $row['num_posts']; |
|
47 |
|
48 // Board start date |
|
49 $date = intval( getConfig('decir_install_date') ); |
|
50 if ( !$date ) |
|
51 { |
|
52 $date = time(); |
|
53 setConfig('decir_install_date', $date); |
|
54 } |
|
55 $start_date = date('F d, Y h:i a', $date); |
|
56 |
|
57 // Average posts per day |
|
58 $board_age_days = round( ( time() / ( 60*60*24 ) ) - ( $date / ( 60*60*24 ) ) ); |
|
59 if ( $board_age_days < 1 ) |
|
60 { |
|
61 $avg_posts = $num_posts; |
|
62 } |
|
63 else |
|
64 { |
|
65 $avg_posts = $num_posts / $board_age_days; |
|
66 } |
|
67 |
|
68 echo '<h3>Administration home</h3>'; |
|
69 echo '<p>Thank you for choosing Decir as your forum solution. From this panel you can control every aspect of your forum\'s behavior and appearance. If you need support |
|
70 for Decir, you can visit the <a href="http://forum.enanocms.org/">Enano support forums</a>.</p>'; |
|
71 echo '<h3>Board statistics</h3>'; |
|
72 echo "<div class=\"tblholder\"> |
|
73 <table border=\"0\" cellspacing=\"1\" cellpadding=\"4\"> |
|
74 <tr> |
|
75 <th colspan=\"4\">Board statistics</th> |
|
76 </tr> |
|
77 <tr> |
|
78 <td style=\"width: 25%;\" class=\"row1\"><b>Number of users:</b></td> |
|
79 <td style=\"width: 25%;\" class=\"row2\">{$num_users}</td> |
|
80 |
|
81 <td style=\"width: 25%;\" class=\"row1\"><b>Number of posts:</b></td> |
|
82 <td style=\"width: 25%;\" class=\"row2\">{$num_posts}</td> |
|
83 </tr> |
|
84 <tr> |
|
85 <td style=\"width: 25%;\" class=\"row1\"><b>Board started:</b></td> |
|
86 <td style=\"width: 25%;\" class=\"row2\">{$start_date} ({$board_age_days} days ago)</td> |
|
87 |
|
88 <td style=\"width: 25%;\" class=\"row1\"><b>Average posts per day:</b></td> |
|
89 <td style=\"width: 25%;\" class=\"row2\">{$avg_posts}</td> |
|
90 </tr> |
|
91 </table> |
|
92 </div>"; |
|
93 } |
|
94 |
|
95 ?> |