Issue-4845: Merged in branch 'gsoc11_benj' for the enhanced mobile theme.
[atutor.git] / docs / admin / index.php
index f227661..d9061b1 100644 (file)
@@ -42,6 +42,7 @@ if (isset($_POST['social_submit'])) {
        }
        $_config['just_social'] = $_POST['just_social'];
 }
+
 require(AT_INCLUDE_PATH.'header.inc.php');
 
 if ($_config['check_version']) {
@@ -60,104 +61,109 @@ if ($_config['allow_instructor_requests'] && admin_authenticate(AT_ADMIN_PRIV_US
 
 
 
-       $update_server = "update.atutor.ca"; 
+$update_server = "update.atutor.ca"; 
+
+$file = fsockopen ($update_server, 80, $errno, $errstr, 15);
+
+if ($file) 
+{
+       // get patch list
+       $patch_folder = "http://" . $update_server . '/patch/' . str_replace('.', '_', VERSION) . '/';
 
-       $file = fsockopen ($update_server, 80, $errno, $errstr, 15);
+       $patch_list_xml = @file_get_contents($patch_folder . 'patch_list.xml');
        
-       if ($file
+       if ($patch_list_xml
        {
-               // get patch list
-               $patch_folder = "http://" . $update_server . '/patch/' . str_replace('.', '_', VERSION) . '/';
-
-               $patch_list_xml = @file_get_contents($patch_folder . 'patch_list.xml');
+               require_once('../mods/_standard/patcher/classes/PatchListParser.class.php');
+               $patchListParser = new PatchListParser();
+               $patchListParser->parse($patch_list_xml);
+               $patch_list_array = $patchListParser->getMyParsedArrayForVersion(VERSION);
                
-               if ($patch_list_xml) 
-               {
-                       require_once('../mods/_standard/patcher/classes/PatchListParser.class.php');
-                       $patchListParser = new PatchListParser();
-                       $patchListParser->parse($patch_list_xml);
-                       $patch_list_array = $patchListParser->getMyParsedArrayForVersion(VERSION);
-                       
-                       if (count($patch_list_array)) {
-                               foreach ($patch_list_array as $row_num => $patch) {
-                                       $patch_ids .= '\'' . $patch['atutor_patch_id'] . '\', ';
-                               }
-                                       
-                               $sql = "select count(distinct atutor_patch_id) cnt_installed_patches from ".TABLE_PREFIX."patches " .
-                                      "where atutor_patch_id in (" . substr($patch_ids, 0, -2) .")".
-                                      " and status like '%Installed'";
-                       
-                               $result = mysql_query($sql, $db) or die(mysql_error());
-                               $row = mysql_fetch_assoc($result);
+               if (count($patch_list_array)) {
+                       foreach ($patch_list_array as $row_num => $patch) {
+                               $patch_ids .= '\'' . $patch['atutor_patch_id'] . '\', ';
+                       }
                                
-                               $cnt = count($patch_list_array) - $row['cnt_installed_patches'];
-                               $savant->assign('cnt', $cnt);
-       
-                               if ($cnt > 0)
-                               {
-       
+                       $sql = "select count(distinct atutor_patch_id) cnt_installed_patches from ".TABLE_PREFIX."patches " .
+                              "where atutor_patch_id in (" . substr($patch_ids, 0, -2) .")".
+                              " and status like '%Installed'";
+               
+                       $result = mysql_query($sql, $db) or die(mysql_error());
+                       $row = mysql_fetch_assoc($result);
+                       
+                       $cnt = count($patch_list_array) - $row['cnt_installed_patches'];
+                       $savant->assign('cnt', $cnt);
+
+                       if ($cnt > 0)
+                       {
+
+
 
-       
-                               }
                        }
                }
-       } 
+       }
+} 
+
 if (!isset($_config['db_size']) || ($_config['db_size_ttl'] < time())) {
-                               $_config['db_size'] = 0;
-                               $sql = 'SHOW TABLE STATUS';
-                               $result = mysql_query($sql, $db);
-                               while($row = mysql_fetch_assoc($result)) {
-                                       $_config['db_size'] += $row['Data_length']+$row['Index_length'];
-                               
-                               }
+       $_config['db_size'] = 0;
+       $sql = 'SHOW TABLE STATUS';
+       $result = mysql_query($sql, $db);
+       while($row = mysql_fetch_assoc($result)) {
+               $_config['db_size'] += $row['Data_length']+$row['Index_length'];
+       
+       }
 
-                               $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('db_size', '{$_config['db_size']}')";
-                               mysql_query($sql, $db);
+       $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('db_size', '{$_config['db_size']}')";
+       mysql_query($sql, $db);
+
+       // get disk usage if we're on *nix
+       if (DIRECTORY_SEPARATOR == '/') {
+               $du = @shell_exec('du -sk '.escapeshellcmd(AT_CONTENT_DIR));
+               if ($du) {
+                       $_config['du_size'] = (int) $du;
+                       $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('du_size', '{$_config['du_size']}')";
+                       mysql_query($sql, $db);
                        
-                               // get disk usage if we're on *nix
-                               if (DIRECTORY_SEPARATOR == '/') {
-                                       $du = @shell_exec('du -sk '.escapeshellcmd(AT_CONTENT_DIR));
-                                       if ($du) {
-                                               $_config['du_size'] = (int) $du;
-                                               $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('du_size', '{$_config['du_size']}')";
-                                               mysql_query($sql, $db);
-                                               
-                                       }
-                               }
-
-                               $ttl = time() + 24 * 60 * 60; // every 1 day.
-                               $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('db_size_ttl', '$ttl')";
-                               mysql_query($sql, $db);
-                               
-                       }
+               }
+       }
 
-                       $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."courses";
-                       $result = mysql_query($sql, $db);
-                       $row = mysql_fetch_assoc($result);
-                       $num_courses = $row['cnt'];
-                       $savant->assign('num_courses', $num_courses);
+       $ttl = time() + 24 * 60 * 60; // every 1 day.
+       $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('db_size_ttl', '$ttl')";
+       mysql_query($sql, $db);
+       
+}
 
-                       $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."members";
-                       $result = mysql_query($sql, $db);
-                       $row = mysql_fetch_assoc($result);
-                       $num_users = $row['cnt'];
-                       $savant->assign('num_users', $num_users);
+$sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."courses";
+$result = mysql_query($sql, $db);
+$row = mysql_fetch_assoc($result);
+$num_courses = $row['cnt'];
+$savant->assign('num_courses', $num_courses);
 
-                       $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."admins";
-                       $result = mysql_query($sql, $db);
-                       $row = mysql_fetch_assoc($result);
-                       $num_users += $row['cnt'];
-                       
+$sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."members";
+$result = mysql_query($sql, $db);
+$row = mysql_fetch_assoc($result);
+$num_users = $row['cnt'];
+$savant->assign('num_users', $num_users);
 
-                       $sql = "SELECT VERSION()";
-                       $result = mysql_query($sql, $db);
-                       $row = mysql_fetch_array($result);
-                       $mysql_version = $row[0];
+$sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."admins";
+$result = mysql_query($sql, $db);
+$row = mysql_fetch_assoc($result);
+$num_users += $row['cnt'];
+
+
+$sql = "SELECT VERSION()";
+$result = mysql_query($sql, $db);
+$row = mysql_fetch_array($result);
+$mysql_version = $row[0];
 
 $savant->assign('path_length', $path_length);
 $savant->assign('pages', $_pages);
 $savant->assign('db_size', $_config['db_size']);
 $savant->assign('du_size', $_config['du_size']);
 $savant->assign('row', $row);
+
 $savant->display('admin/index.tmpl.php');
-require(AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
+
+require(AT_INCLUDE_PATH.'footer.inc.php'); 
+
+?>
\ No newline at end of file