2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
14 define('AT_INCLUDE_PATH', '../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 if (defined('AT_DEVEL_TRANSLATE') && AT_DEVEL_TRANSLATE) {
19 $msg->addWarning('TRANSLATE_ON');
21 $smtp_server = ini_get('SMTP');
22 if (($smtp_server == '' || $smtp_server == 'localhost') && ini_get('sendmail_path') == '') {
23 $msg->addWarning('MAIL_NOT_ON');
26 // Social networking only switch
27 if (isset($_POST['social_submit'])) {
28 $_POST['just_social'] = intval($_POST['just_social']);
30 if ($_POST['just_social'] == 1) {
31 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('just_social', '$_POST[just_social]')";
32 mysql_query($sql, $db);
33 write_to_log(AT_ADMIN_LOG_REPLACE, 'config', mysql_affected_rows($db), $sql);
34 $msg->addFeedback('ATUTOR_SOCIAL_ONLY');
36 } else if ($_POST['just_social'] == 0) {
37 $sql = "DELETE FROM ".TABLE_PREFIX."config WHERE name='just_social'";
38 mysql_query($sql, $db);
39 write_to_log(AT_ADMIN_LOG_DELETE, 'config', mysql_affected_rows($db), $sql);
40 $msg->addFeedback('ATUTOR_SOCIAL_LMS');
43 $_config['just_social'] = $_POST['just_social'];
45 require(AT_INCLUDE_PATH.'header.inc.php');
47 if ($_config['check_version']) {
48 $request = @file('http://atutor.ca/check_atutor_version.php?return');
49 if ($request && version_compare(VERSION, $request[0], '<')) {
50 $msg->printFeedbacks('ATUTOR_UPDATE_AVAILABLE');
56 <div class="container" style="width: 40%; float: right; padding-top: 4px; padding-left: 10px;">
57 <div class="input-form" style="width: 98%;">
59 <h3><?php echo _AT('social_switch'); ?></h3>
60 <p><?php echo _AT('social_switch_text'); ?></p>
62 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
64 <?php echo _AT('social_switch'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['just_social'] ? _AT('just_social') : _AT('social_and_lms')); ?>)<br />
65 <input type="radio" name="just_social" value="1" id="social_y" <?php if($_config['just_social']) { echo 'checked="checked"'; }?> /><label for="social_y"><?php echo _AT('just_social'); ?></label> <br /><input type="radio" name="just_social" value="0" id="social_n" <?php if(!$_config['just_social']) { echo 'checked="checked"'; }?> /><label for="social_n"><?php echo _AT('social_and_lms'); ?></label>
68 <div class="row buttons">
69 <input type="submit" name="social_submit" value="<?php echo _AT('save'); ?>" />
74 <div class="input-form" style="width: 98%;">
76 <h3><?php echo _AT('donate'); ?></h3>
77 <p><?php echo _AT('donate_text'); ?></p>
80 <div style="text-align:center;">
81 <a href="http://www.atutor.ca/payment/index.php?project=ATutor-Donation"><img src="<?php echo $_base_href; ?>/images/donate.gif" height="28" width="136" border="0" alt="<?php echo _AT('donate'); ?>" /></a><br /><br />
84 <?php if ($_config['allow_instructor_requests'] && admin_authenticate(AT_ADMIN_PRIV_USERS, AT_PRIV_RETURN)): ?>
86 $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."instructor_approvals";
87 $result = mysql_query($sql, $db);
88 $row = mysql_fetch_assoc($result);
90 <div class="input-form" style="width: 98%;">
91 <form method="get" action="mods/_core/users/instructor_requests.php">
93 <h3><?php echo _AT('instructor_requests'); ?></h3>
94 <p><?php echo _AT('instructor_requests_text', $row['cnt']); ?></p>
97 <div class="row buttons">
98 <input type="submit" name="submit" value="<?php echo _AT('view'); ?>" />
107 $update_server = "update.atutor.ca";
109 $file = fsockopen ($update_server, 80, $errno, $errstr, 15);
114 $patch_folder = "http://" . $update_server . '/patch/' . str_replace('.', '_', VERSION) . '/';
116 $patch_list_xml = @file_get_contents($patch_folder . 'patch_list.xml');
120 require_once('../mods/_standard/patcher/classes/PatchListParser.class.php');
121 $patchListParser = new PatchListParser();
122 $patchListParser->parse($patch_list_xml);
123 $patch_list_array = $patchListParser->getMyParsedArrayForVersion(VERSION);
125 if (count($patch_list_array)) {
126 foreach ($patch_list_array as $row_num => $patch) {
127 $patch_ids .= '\'' . $patch['atutor_patch_id'] . '\', ';
130 $sql = "select count(distinct atutor_patch_id) cnt_installed_patches from ".TABLE_PREFIX."patches " .
131 "where atutor_patch_id in (" . substr($patch_ids, 0, -2) .")".
132 " and status like '%Installed'";
134 $result = mysql_query($sql, $db) or die(mysql_error());
135 $row = mysql_fetch_assoc($result);
137 $cnt = count($patch_list_array) - $row['cnt_installed_patches'];
142 <div class="input-form" style="width: 98%;">
143 <form method="get" action="mods/_standard/patcher/index_admin.php">
145 <h3><?php echo _AT('available_patches'); ?></h3>
146 <p><?php echo _AT('available_patches_text', $cnt); ?></p>
149 <div class="row buttons">
150 <input type="submit" name="submit" value="<?php echo _AT('view'); ?>" />
162 <div class="input-form" style="width: 98%">
164 if (!isset($_config['db_size']) || ($_config['db_size_ttl'] < time())) {
165 $_config['db_size'] = 0;
166 $sql = 'SHOW TABLE STATUS';
167 $result = mysql_query($sql, $db);
168 while($row = mysql_fetch_assoc($result)) {
169 $_config['db_size'] += $row['Data_length']+$row['Index_length'];
172 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('db_size', '{$_config['db_size']}')";
173 mysql_query($sql, $db);
175 // get disk usage if we're on *nix
176 if (DIRECTORY_SEPARATOR == '/') {
177 $du = @shell_exec('du -sk '.escapeshellcmd(AT_CONTENT_DIR));
179 $_config['du_size'] = (int) $du;
180 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('du_size', '{$_config['du_size']}')";
181 mysql_query($sql, $db);
185 $ttl = time() + 24 * 60 * 60; // every 1 day.
186 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('db_size_ttl', '$ttl')";
187 mysql_query($sql, $db);
190 $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."courses";
191 $result = mysql_query($sql, $db);
192 $row = mysql_fetch_assoc($result);
193 $num_courses = $row['cnt'];
195 $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."members";
196 $result = mysql_query($sql, $db);
197 $row = mysql_fetch_assoc($result);
198 $num_users = $row['cnt'];
200 $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."admins";
201 $result = mysql_query($sql, $db);
202 $row = mysql_fetch_assoc($result);
203 $num_users += $row['cnt'];
205 $sql = "SELECT VERSION()";
206 $result = mysql_query($sql, $db);
207 $row = mysql_fetch_array($result);
208 $mysql_version = $row[0];
212 <h3><?php echo _AT('statistics_information'); ?></h3>
214 <dl class="col-list">
215 <?php if ($_config['db_size']): ?>
216 <dt><?php echo _AT('database'); ?>:</dt>
217 <dd><?php echo number_format($_config['db_size']/AT_KBYTE_SIZE/AT_KBYTE_SIZE,2); ?> <acronym title="<?php echo _AT('megabytes'); ?>"><?php echo _AT('mb'); ?></acronym></dd>
220 <?php if ($_config['du_size']): ?>
221 <dt><?php echo _AT('disk_usage'); ?>:</dt>
222 <dd><?php echo number_format($_config['du_size']/AT_KBYTE_SIZE,2); ?> <acronym title="<?php echo _AT('megabytes'); ?>"><?php echo _AT('mb'); ?></acronym></dd>
225 <dt><?php echo _AT('courses'); ?>:</dt>
226 <dd><?php echo $num_courses; ?></dd>
228 <dt><?php echo _AT('users'); ?>:</dt>
229 <dd><?php echo $num_users; ?></dd>
231 <dt><?php echo _AT('atutor_version'); ?>:</dt>
233 require('../svn.php');
234 if (!empty($svn_data)) {
235 $svn_data = explode("\n", $svn_data);
236 if (substr($svn_data[1], 0, 1) == 'r') {
237 $svn_data = $svn_data[1];
238 } else if (substr($svn_data[2], 0, 1) == 'r') {
239 $svn_data = $svn_data[2];
242 if (count($svn_data) > 1) {
244 $build_date = date('Y-m-d H:i:s');
246 $svn_data = explode(' ', $svn_data);
248 $build = $svn_data[0];
249 $build_date = $svn_data[4] .' '. $svn_data[5];
251 $build_str = '(' . $build . ' - '.$build_date . ')';
254 <dd><?php echo _AT('atutor_version_text', VERSION . $build_str, urlencode(VERSION)); ?></dd>
256 <dt><?php echo _AT('php_version'); ?>:</dt>
257 <dd><?php echo PHP_VERSION; ?></dd>
259 <dt><?php echo _AT('mysql_version'); ?>:</dt>
260 <dd><?php echo $mysql_version; ?></dd>
262 <dt><?php echo _AT('os'); ?>:</dt>
263 <dd><?php echo @php_uname('s') . ' ' . @php_uname('r'); ?></dd>
270 <div class="admin_container" style="width: 55%;">
272 $path_length = strlen($_base_path);
274 echo '<ol id="tools" style="margin-right: 0px;">';
275 foreach ($_top_level_pages as $page_info) {
276 echo '<li class="top-tool"><a href="' . $page_info['url'] . '">' . $page_info['title'] . '</a> ';
278 $page_info['url'] = substr($page_info['url'], $path_length);
280 if ($_pages[$page_info['url']]['children']) {
281 echo '<ul class="child-top-tool">';
282 foreach ($_pages[$page_info['url']]['children'] as $child) {
283 // check whether the page is set to be available for mobile themes. @see include/lib/menu_pages.php
284 if (page_available($child)) {
285 echo ' <li class="child-tool"><a href="'.$child.'">'._AT($_pages[$child]['title_var']).'</a></li>';
295 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>