Minor - format code

skala
Julio Montoya 12 years ago
parent 9a6e72760b
commit ca198a488b
  1. 37
      main/inc/ajax/admin.ajax.php

@ -12,29 +12,29 @@ api_protect_admin_script();
$action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null; $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
switch ($action) { switch ($action) {
case 'update_changeable_setting': case 'update_changeable_setting':
$url_id = api_get_current_access_url_id(); $url_id = api_get_current_access_url_id();
if (api_is_global_platform_admin() && $url_id == 1) { if (api_is_global_platform_admin() && $url_id == 1) {
if (isset($_GET['id']) && !empty($_GET['id'])) { if (isset($_GET['id']) && !empty($_GET['id'])) {
$params = array('variable = ? ' => array($_GET['id'])); $params = array('variable = ? ' => array($_GET['id']));
$data = api_get_settings_params($params); $data = api_get_settings_params($params);
if (!empty($data)) { if (!empty($data)) {
foreach ($data as $item) { foreach ($data as $item) {
$params = array('id' =>$item['id'], 'access_url_changeable' => $_GET['changeable']); $params = array('id' =>$item['id'], 'access_url_changeable' => $_GET['changeable']);
api_set_setting_simple($params); api_set_setting_simple($params);
} }
} }
echo '1'; echo '1';
} }
} }
break; break;
case 'version': case 'version':
echo version_check(); echo version_check();
break; break;
} }
/** /**
* Displays either the text for the registration or the message that the installation is (not) up to date * Displays either the text for the registration or the message that the installation is (not) up to date
@ -44,7 +44,8 @@ switch ($action) {
* @version august 2006 * @version august 2006
* @todo have a 6monthly re-registration * @todo have a 6monthly re-registration
*/ */
function version_check() { function version_check()
{
$tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); $tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$sql = 'SELECT selected_value FROM '.$tbl_settings.' WHERE variable="registered" '; $sql = 'SELECT selected_value FROM '.$tbl_settings.' WHERE variable="registered" ';
$result = Database::query($sql); $result = Database::query($sql);
@ -75,7 +76,8 @@ function version_check() {
* @copyright (C) 2001 The phpBB Group * @copyright (C) 2001 The phpBB Group
* @return language string with some layout (color) * @return language string with some layout (color)
*/ */
function check_system_version() { function check_system_version()
{
global $_configuration; global $_configuration;
$system_version = trim($_configuration['system_version']); // the chamilo version of your installation $system_version = trim($_configuration['system_version']); // the chamilo version of your installation
@ -85,7 +87,7 @@ function check_system_version() {
// The number of users // The number of users
$number_of_users = statistics::count_users(); $number_of_users = statistics::count_users();
$number_of_active_users = statistics::count_users(null,null,null,true); $number_of_active_users = statistics::count_users(null, null, null, true);
$data = array( $data = array(
'url' => api_get_path(WEB_PATH), 'url' => api_get_path(WEB_PATH),
@ -133,7 +135,8 @@ function check_system_version() {
* @param bool Include HTTP Request headers? * @param bool Include HTTP Request headers?
* @param bool Include HTTP Response headers? * @param bool Include HTTP Response headers?
*/ */
function _http_request($ip, $port = 80, $uri = '/', $getdata = array(), $timeout = 1, $req_hdr = false, $res_hdr = false) { function _http_request($ip, $port = 80, $uri = '/', $getdata = array(), $timeout = 1, $req_hdr = false, $res_hdr = false)
{
$verb = 'GET'; $verb = 'GET';
$ret = ''; $ret = '';
$getdata_str = count($getdata) ? '?' : ''; $getdata_str = count($getdata) ? '?' : '';
@ -153,7 +156,9 @@ function _http_request($ip, $port = 80, $uri = '/', $getdata = array(), $timeout
$req .= $crlf; $req .= $crlf;
if ($req_hdr) { $ret .= $req; } if ($req_hdr) {
$ret .= $req;
}
if (($fp = @fsockopen($ip, $port, $errno, $errstr, $timeout)) == false) { if (($fp = @fsockopen($ip, $port, $errno, $errstr, $timeout)) == false) {
return "Error $errno: $errstr\n"; return "Error $errno: $errstr\n";
} }

Loading…
Cancel
Save