Browse Source

Minor - Format code

Julio Montoya 10 years ago
parent
commit
c9295139e3
2 changed files with 30 additions and 23 deletions
  1. 8 8
      main/inc/global.inc.php
  2. 22 15
      main/inc/local.inc.php

+ 8 - 8
main/inc/global.inc.php

@@ -114,13 +114,15 @@ if (empty($_configuration['statistics_database']) && $already_installed) {
 }
 global $database_connection;
 // Connect to the server database and select the main chamilo database.
+// When $_configuration['db_persistent_connection'] is set, it is expected to be a boolean type.
 if (!($conn_return = @Database::connect(
     array(
         'server'        => $_configuration['db_host'],
         'username'      => $_configuration['db_user'],
         'password'      => $_configuration['db_password'],
-        'persistent'    => $_configuration['db_persistent_connection'] // When $_configuration['db_persistent_connection'] is set, it is expected to be a boolean type.
-    )))) {
+        'persistent'    => $_configuration['db_persistent_connection']
+    )))
+) {
     $global_error_code = 3;
     // The database server is not available or credentials are invalid.
     require $includePath.'/global_error_message.inc.php';
@@ -180,7 +182,7 @@ if (!Database::select_db($_configuration['main_database'], $database_connection)
     die();
 }
 
-/*   Initialization of the default encodings */
+/* Initialization of the default encodings */
 // The platform's character set must be retrieved at this early moment.
 $sql = "SELECT selected_value FROM settings_current WHERE variable = 'platform_charset';";
 $result = Database::query($sql);
@@ -317,8 +319,6 @@ if (file_exists($mail_conf)) {
 
 // ===== "who is logged in?" module section =====
 
-
-
 // check and modify the date of user in the track.e.online table
 if (!$x = strpos($_SERVER['PHP_SELF'], 'whoisonline.php')) {
     LoginCheck(isset($_user['user_id']) ? $_user['user_id'] : '');
@@ -327,9 +327,9 @@ if (!$x = strpos($_SERVER['PHP_SELF'], 'whoisonline.php')) {
 // ===== end "who is logged in?" module section =====
 
 if (api_get_setting('server_type') == 'test') {
-    //error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
-    ini_set('display_errors', '1');
-    error_reporting(-1);
+    error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
+    /*ini_set('display_errors', '1');
+    error_reporting(-1);*/
 } else {
     /*
     Server type is not test

+ 22 - 15
main/inc/local.inc.php

@@ -177,14 +177,20 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
 
     //Platform legal terms and conditions
     if (api_get_setting('allow_terms_conditions') == 'true') {
-        if (isset($_POST['login']) && isset($_POST['password']) && isset($_SESSION['term_and_condition']['user_id'])) {
-            $user_id = $_SESSION['term_and_condition']['user_id'];    // user id
+        if (isset($_POST['login']) && isset($_POST['password']) &&
+            isset($_SESSION['term_and_condition']['user_id'])
+        ) {
+            // user id
+            $user_id = $_SESSION['term_and_condition']['user_id'];
             // Update the terms & conditions
             $legal_type = null;
             //verify type of terms and conditions
             if (isset($_POST['legal_info'])) {
                 $info_legal = explode(':', $_POST['legal_info']);
-                $legal_type = LegalManager::get_type_of_terms_and_conditions($info_legal[0], $info_legal[1]);
+                $legal_type = LegalManager::get_type_of_terms_and_conditions(
+                    $info_legal[0],
+                    $info_legal[1]
+                );
             }
 
             //is necessary verify check
@@ -622,9 +628,9 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
                 //lookup the user in the main database
                 $user_table = Database::get_main_table(TABLE_MAIN_USER);
                 $sql = "SELECT user_id, username, password, auth_source, active, expiration_date
-                    FROM $user_table
-                    WHERE openid = '$id1'
-                    OR openid = '$id2' ";
+                        FROM $user_table
+                        WHERE openid = '$id1'
+                        OR openid = '$id2' ";
                 $result = Database::query($sql);
                 if ($result !== false) {
                     if (Database::num_rows($result)>0) {
@@ -717,7 +723,9 @@ if (!empty($cDir)) {
 
 // if the requested course is different from the course in session
 
-if (!empty($cidReq) && (!isset($_SESSION['_cid']) or (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid']))) {
+if (!empty($cidReq) && (!isset($_SESSION['_cid']) or
+    (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid']))
+) {
     $cidReset = true;
     $gidReset = true;    // As groups depend from courses, group id is reset
 }
@@ -796,8 +804,8 @@ if (isset($cidReset) && $cidReset) {
         if (!empty($_course)) {
 
             //@TODO real_cid should be cid, for working with numeric course id
-            $_real_cid                      = $_course['real_id'];
-            $_cid                           = $_course['code'];
+            $_real_cid = $_course['real_id'];
+            $_cid = $_course['code'];
 
             Session::write('_real_cid', $_real_cid);
             Session::write('_cid', $_cid);
@@ -853,7 +861,7 @@ if (isset($cidReset) && $cidReset) {
             }
         }
 
-        //Deleting session info
+        // Deleting session info.
         if (api_get_session_id()) {
             Session::erase('id_session');
             Session::erase('session_name');
@@ -880,12 +888,12 @@ if (isset($cidReset) && $cidReset) {
     }
 
     if (empty($_SESSION['_course']) or empty($_SESSION['_cid'])) { //no previous values...
-        $_cid         = -1;        //set default values that will be caracteristic of being unset
-        $_course      = -1;
+        $_cid = -1; // Set default values
+        $_course = -1;
     } else {
 
-        $_cid      = $_SESSION['_cid'   ];
-        $_course   = $_SESSION['_course'];
+        $_cid = $_SESSION['_cid'];
+        $_course = $_SESSION['_course'];
 
         // these lines are usefull for tracking. Indeed we can have lost the id_session and not the cid.
         // Moreover, if we want to track a course with another session it can be usefull
@@ -1154,7 +1162,6 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) {
                         }
                     }
                 }
-
             }
 
             //If I'm the admin platform i'm a teacher of the course