Browse Source

Fixing version check for 1.10

Julio Montoya 11 years ago
parent
commit
7d39a6199a

+ 1 - 0
main/admin/index.php

@@ -300,6 +300,7 @@ if (api_is_platform_admin()) {
 }
 $admin_ajax_url = api_get_path(WEB_AJAX_PATH).'admin.ajax.php';
 
+$app['template']->assign('web_admin_ajax_url', $admin_ajax_url);
 $app['template']->assign('blocks', $blocks);
 $app['template']->display('default/admin/settings_index.tpl');
 

+ 3 - 3
main/course_home/vertical_activity.php

@@ -55,7 +55,7 @@ if (api_is_platform_admin()) {
 //	COURSE ADMIN ONLY VIEW
 
 // Start of tools for CourseAdmins (teachers/tutors)
-if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {   
+if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
     $content .=  '<div class="courseadminview" style="border:0px; margin-top: 0px;padding:5px;">
     <div class="normal-message" id="id_normal_message" style="display:none">';
         $content .=  '<img src="'.api_get_path(WEB_PATH).'main/inc/lib/javascript/indicator.gif"/>&nbsp;&nbsp;';
@@ -109,8 +109,8 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
 		foreach($my_list as $key=>$new_tool) {
 			$tool_name = CourseHome::translate_tool_name($new_tool);
 			$order_tool_list [$key]= $tool_name;
-		}		
-		natsort($order_tool_list);		
+		}
+		natsort($order_tool_list);
 		$my_temp_tool_array = array();
 		foreach($order_tool_list as $key=>$new_tool) {
 			$my_temp_tool_array[] = $my_list[$key];

+ 17 - 17
main/inc/ajax/admin.ajax.php

@@ -5,7 +5,6 @@
  */
 
 require_once '../global.inc.php';
-require_once api_get_path(SYS_CODE_PATH).'admin/statistics/statistics.lib.php';
 
 api_protect_admin_script();
 
@@ -33,29 +32,30 @@ switch ($action) {
         }
         echo json_encode($json_coaches);
         break;
-	case 'update_changeable_setting':        
+	case 'update_changeable_setting':
         $url_id = api_get_current_access_url_id();
-        
-        if (api_is_global_platform_admin() && $url_id == 1) {            
-            if (isset($_GET['id']) && !empty($_GET['id'])) {                
+
+        if (api_is_global_platform_admin() && $url_id == 1) {
+            if (isset($_GET['id']) && !empty($_GET['id'])) {
                 $params = array('variable = ? ' =>  array($_GET['id']));
-                $data = api_get_settings_params($params);                
+                $data = api_get_settings_params($params);
                 if (!empty($data)) {
-                    foreach ($data as $item) {                
+                    foreach ($data as $item) {
                         $params = array('id' =>$item['id'], 'access_url_changeable' => $_GET['changeable']);
-                        api_set_setting_simple($params);        
+                        api_set_setting_simple($params);
                     }
-                }                
+                }
                 echo '1';
-            }        
+            }
         }
         break;
-        
+
     case 'version':
         echo version_check();
+        exit;
         break;
 }
-    
+
 
 /**
  * Displays either the text for the registration or the message that the installation is (not) up to date
@@ -95,7 +95,7 @@ function version_check()
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (the modifications)
  * @author Yannick Warnier <ywarnier@beeznest.org> for the move to HTTP request
  * @copyright (C) 2001 The phpBB Group
- * @return language string with some layout (color)
+ * @return string language string with some layout (color)
  */
 function check_system_version()
 {
@@ -104,11 +104,11 @@ function check_system_version()
 
     if (ini_get('allow_url_fopen') == 1) {
         // The number of courses
-        $number_of_courses = statistics::count_courses();
+        $number_of_courses = Statistics::count_courses();
 
         // The number of users
-        $number_of_users = statistics::count_users();
-        $number_of_active_users = statistics::count_users(null,null,null,true);
+        $number_of_users = Statistics::count_users();
+        $number_of_active_users = Statistics::count_users(null, null, null, true);
 
         $data = array(
             'url' => api_get_path(WEB_PATH),
@@ -186,7 +186,7 @@ function _http_request($ip, $port = 80, $uri = '/', $getdata = array(), $timeout
 
     stream_set_timeout($fp, $timeout);
     $r = @fwrite($fp, $req);
-    $line = @fread($fp,512);
+    $line = @fread($fp, 512);
     $ret .= $line;
     fclose($fp);
 

+ 9 - 6
main/template/default/admin/settings_index.tpl

@@ -3,11 +3,11 @@
 <script>
 $(function() {
     //$("#settings").tabs();
-    $.ajax({    
-        url:'{{web_admin_ajax_url}}?a=version',
+    $.ajax({
+        url:'{{ web_admin_ajax_url }}?a=version',
         success:function(version){
             $(".admin-block-version").html(version);
-        } 
+        }
     });
 });
 </script>
@@ -15,7 +15,8 @@ $(function() {
     <div class="row">
 
     {% for block_item in blocks %}
-        {% if loop.index % 2 == 1%}
+
+        {% if loop.index % 2 == 1 %}
             {% if app.full_width == 1 %}
                 <div class="row-fluid">
             {% else %}
@@ -23,9 +24,9 @@ $(function() {
             {% endif %}
         {% endif %}
 
-        <div id="tabs-{{loop.index}}" class="span6">
+        <div id="tabs-{{ loop.index }}" class="span6">
             <div class="well_border {{ block_item.class }}">
-                <h4>{{block_item.icon}} {{block_item.label}}</h4>
+                <h4>{{ block_item.icon }} {{ block_item.label }}</h4>
                 <div style="list-style-type:none">
                     {{ block_item.search_form }}
                 </div>
@@ -48,9 +49,11 @@ $(function() {
                 {% endif %}
             </div>
         </div>
+
         {% if loop.index % 2 == 0 %}
             </div>
         {% endif %}
     {% endfor %}
+    </div>
 </div>
 {% endblock %}