2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto */
9 /* This program is free software. You can redistribute it and/or */
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /************************************************************************/
15 define('AT_INCLUDE_PATH', '../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
19 if (defined('AT_DEVEL_TRANSLATE') && AT_DEVEL_TRANSLATE) {
20 $msg->addWarning('TRANSLATE_ON');
22 // Social networking only switch
23 if (isset($_POST['social_submit'])) {
24 $_POST['just_social'] = intval($_POST['just_social']);
26 if ($_POST['just_social'] == 1) {
27 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('just_social', '$_POST[just_social]')";
28 mysql_query($sql, $db);
29 write_to_log(AT_ADMIN_LOG_REPLACE, 'config', mysql_affected_rows($db), $sql);
30 $msg->addFeedback('ATUTOR_SOCIAL_ONLY');
32 } else if ($_POST['just_social'] == 0) {
33 $sql = "DELETE FROM ".TABLE_PREFIX."config WHERE name='just_social'";
34 mysql_query($sql, $db);
35 write_to_log(AT_ADMIN_LOG_DELETE, 'config', mysql_affected_rows($db), $sql);
36 $msg->addFeedback('ATUTOR_SOCIAL_LMS');
39 $_config['just_social'] = $_POST['just_social'];
41 require(AT_INCLUDE_PATH.'header.inc.php');
43 if ($_config['check_version']) {
44 $request = @file('http://atutor.ca/check_atutor_version.php?return');
45 if ($request && version_compare(VERSION, $request[0], '<')) {
46 $msg->printFeedbacks('ATUTOR_UPDATE_AVAILABLE');
52 <div style="width: 40%; float: right; padding-top: 4px; padding-left: 10px;">
53 <div class="input-form" style="width: 98%;">
55 <h3><?php echo _AT('social_switch'); ?></h3>
56 <p><?php echo _AT('social_switch_text'); ?></p>
59 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
60 <?php echo _AT('social_switch'); ?> (<?php echo _AT('default'); ?>: <?php echo ($_config_defaults['just_social'] ? _AT('just_social') : _AT('social_and_lms')); ?>)<br />
61 <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>
64 <div class="row buttons">
65 <input type="submit" name="social_submit" value="<?php echo _AT('save'); ?>" />
70 <div class="input-form" style="width: 98%;">
72 <h3><?php echo _AT('donate'); ?></h3>
73 <p><?php echo _AT('donate_text'); ?></p>
76 <div style="text-align:center;">
77 <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 />
80 <?php if ($_config['allow_instructor_requests'] && admin_authenticate(AT_ADMIN_PRIV_USERS, AT_PRIV_RETURN)): ?>
82 $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."instructor_approvals";
83 $result = mysql_query($sql, $db);
84 $row = mysql_fetch_assoc($result);
86 <div class="input-form" style="width: 98%;">
87 <form method="get" action="admin/instructor_requests.php">
89 <h3><?php echo _AT('instructor_requests'); ?></h3>
90 <p><?php echo _AT('instructor_requests_text', $row['cnt']); ?></p>
93 <div class="row buttons">
94 <input type="submit" name="submit" value="<?php echo _AT('view'); ?>" />
103 $update_server = "update.atutor.ca";
105 $file = fsockopen ($update_server, 80, $errno, $errstr, 15);
110 $patch_folder = "http://" . $update_server . '/patch/' . str_replace('.', '_', VERSION) . '/';
112 $patch_list_xml = @file_get_contents($patch_folder . 'patch_list.xml');
116 require_once('../mods/_standard/patcher/classes/PatchListParser.class.php');
117 $patchListParser =& new PatchListParser();
118 $patchListParser->parse($patch_list_xml);
119 $patch_list_array = $patchListParser->getMyParsedArrayForVersion(VERSION);
121 foreach ($patch_list_array as $row_num => $patch)
122 $patch_ids .= '\'' . $patch['atutor_patch_id'] . '\', ';
124 $sql = "select count(distinct atutor_patch_id) cnt_installed_patches from ".TABLE_PREFIX."patches " .
125 "where atutor_patch_id in (" . substr($patch_ids, 0, -2) .")".
126 " and status like '%Installed'";
128 $result = mysql_query($sql, $db) or die(mysql_error());
129 $row = mysql_fetch_assoc($result);
131 $cnt = count($patch_list_array) - $row['cnt_installed_patches'];
136 <div class="input-form" style="width: 98%;">
137 <form method="get" action="mods/_standard/patcher/index_admin.php">
139 <h3><?php echo _AT('available_patches'); ?></h3>
140 <p><?php echo _AT('available_patches_text', $cnt); ?></p>
143 <div class="row buttons">
144 <input type="submit" name="submit" value="<?php echo _AT('view'); ?>" />
155 <div class="input-form" style="width: 98%">
157 if (!isset($_config['db_size']) || ($_config['db_size_ttl'] < time())) {
158 $_config['db_size'] = 0;
159 $sql = 'SHOW TABLE STATUS';
160 $result = mysql_query($sql, $db);
161 while($row = mysql_fetch_assoc($result)) {
162 $_config['db_size'] += $row['Data_length']+$row['Index_length'];
165 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('db_size', '{$_config['db_size']}')";
166 mysql_query($sql, $db);
168 // get disk usage if we're on *nix
169 if (DIRECTORY_SEPARATOR == '/') {
170 $du = shell_exec('du -sk '.escapeshellcmd(AT_CONTENT_DIR));
172 $_config['du_size'] = (int) $du;
173 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('du_size', '{$_config['du_size']}')";
174 mysql_query($sql, $db);
178 $ttl = time() + 24 * 60 * 60; // every 1 day.
179 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('db_size_ttl', '$ttl')";
180 mysql_query($sql, $db);
183 $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."courses";
184 $result = mysql_query($sql, $db);
185 $row = mysql_fetch_assoc($result);
186 $num_courses = $row['cnt'];
188 $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."members";
189 $result = mysql_query($sql, $db);
190 $row = mysql_fetch_assoc($result);
191 $num_users = $row['cnt'];
193 $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."admins";
194 $result = mysql_query($sql, $db);
195 $row = mysql_fetch_assoc($result);
196 $num_users += $row['cnt'];
198 $sql = "SELECT VERSION()";
199 $result = mysql_query($sql, $db);
200 $row = mysql_fetch_array($result);
201 $mysql_version = $row[0];
205 <h3><?php echo _AT('statistics_information'); ?></h3>
207 <dl class="col-list">
208 <?php if ($_config['db_size']): ?>
209 <dt><?php echo _AT('database'); ?>:</dt>
210 <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>
213 <?php if ($_config['du_size']): ?>
214 <dt><?php echo _AT('disk_usage'); ?>:</dt>
215 <dd><?php echo number_format($_config['du_size']/AT_KBYTE_SIZE,2); ?> <acronym title="<?php echo _AT('megabytes'); ?>"><?php echo _AT('mb'); ?></acronym></dd>
218 <dt><?php echo _AT('courses'); ?>:</dt>
219 <dd><?php echo $num_courses; ?></dd>
221 <dt><?php echo _AT('users'); ?>:</dt>
222 <dd><?php echo $num_users; ?></dd>
224 <dt><?php echo _AT('atutor_version'); ?>:</dt>
225 <dd><?php echo _AT('atutor_version_text', VERSION, urlencode(VERSION)); ?></dd>
227 <dt><?php echo _AT('php_version'); ?>:</dt>
228 <dd><?php echo PHP_VERSION; ?></dd>
230 <dt><?php echo _AT('mysql_version'); ?>:</dt>
231 <dd><?php echo $mysql_version; ?></dd>
233 <dt><?php echo _AT('os'); ?>:</dt>
234 <dd><?php echo php_uname('s') . ' ' . php_uname('r'); ?></dd>
241 <div style="width: 55%;">
243 $path_length = strlen($_base_path);
245 echo '<ol id="tools" style="margin-right: 0px;">';
246 foreach ($_top_level_pages as $page_info) {
247 echo '<li class="top-tool"><a href="' . $page_info['url'] . '">' . $page_info['title'] . '</a> ';
249 $page_info['url'] = substr($page_info['url'], $path_length);
251 if ($_pages[$page_info['url']]['children']) {
252 echo '<ul class="child-top-tool">';
253 foreach ($_pages[$page_info['url']]['children'] as $child) {
254 echo ' <li class="child-tool"><a href="'.$child.'">'._AT($_pages[$child]['title_var']).'</a></li>';
263 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>