Browse Source

[svn r9997]

Patrick Cool 18 years ago
parent
commit
8c5b65be3f
4 changed files with 48 additions and 29 deletions
  1. 7 2
      main/inc/banner.inc.php
  2. 10 10
      main/inc/course_document.inc.php
  3. 15 9
      main/inc/global.inc.php
  4. 16 8
      main/inc/local.inc.php

+ 7 - 2
main/inc/banner.inc.php

@@ -54,7 +54,9 @@ elseif (isset ($nameTools) && $langFile != 'course_home')
 {
 	//Put the name of the user-tools in the header
 	if (!isset ($_user['user_id']))
+	{
 		echo " ";
+	}
 	elseif(!$noPHP_SELF)
 	{
 		echo "<div id=\"my_courses\"><a href=\"".$_SERVER['PHP_SELF']."?".api_get_cidreq(), "\" target=\"_top\">", $nameTools, "</a></div>", "\n";
@@ -350,9 +352,12 @@ if (isset ($dokeos_database_connection))
 <?php
 //to mask the main div, set $header_hide_main_div to true in any script just before calling Display::display_header();
 global $header_hide_main_div;
-if(!empty($header_hide_main_div) && $header_hide_main_div===true){
+if(!empty($header_hide_main_div) && $header_hide_main_div===true)
+{
 	//do nothing
-}else{
+}
+else
+{
 ?>
 <div id="main"> <!-- start of #main wrapper for #content and #menu divs -->
 <?php

+ 10 - 10
main/inc/course_document.inc.php

@@ -271,15 +271,13 @@ function getlist ($directory) {
 			if ($filename != '..')
 			if ($filename != '.')
 			{
-
-
-			$file = array(
-				"lastedit_date" =>date ("Y-m-d H:i:s", filemtime($path)),
-				"visibility" => 1,
-				"path" => $path,
-				"title" => basename($path),
-				"filetype" => filetype($path),
-				"size" => filesize ($path)
+				$file = array(
+					"lastedit_date" =>date ("Y-m-d H:i:s", filemtime($path)),
+					"visibility" => 1,
+					"path" => $path,
+					"title" => basename($path),
+					"filetype" => filetype($path),
+					"size" => filesize ($path)
 			);
 
 
@@ -291,7 +289,9 @@ function getlist ($directory) {
 
 		return $files;
 
-	} else {
+	} 
+	else
+	{
 		return false;
 	}
 

+ 15 - 9
main/inc/global.inc.php

@@ -93,15 +93,14 @@ if(empty($statsDbName) && $already_installed)
 
 $dokeos_database_connection = @mysql_connect($dbHost, $dbLogin, $dbPass) or die ($error_message);
 
-if (! $dbHost) die($error_message);
+if (! $dbHost)
+{
+	die($error_message);
+}
 
 unset($error_message);
 
-$selectResult = mysql_select_db($mainDbName,$dokeos_database_connection)
-
-or die ( "<center>"
-		."WARNING ! SYSTEM UNABLE TO SELECT THE MAIN DOKEOS DATABASE"
-		."</center>");
+$selectResult = mysql_select_db($mainDbName,$dokeos_database_connection) or die ('<center>WARNING ! SYSTEM UNABLE TO SELECT THE MAIN DOKEOS DATABASE</center>');
 
 /*
 --------------------------------------------
@@ -113,9 +112,13 @@ $result=mysql_query($sql) or die(mysql_error());
 while ($row=mysql_fetch_array($result))
 {
 	if ($row['subkey']==NULL)
-		{ $_setting[$row['variable']]=$row['selected_value']; }
+	{ 
+		$_setting[$row['variable']]=$row['selected_value']; 
+	}
 	else
-		{ $_setting[$row['variable']][$row['subkey']]=$row['selected_value']; }
+	{
+		$_setting[$row['variable']][$row['subkey']]=$row['selected_value'];
+	}
 }
 // we have to store the settings for the plugins differently because it expects an array
 $sql="SELECT * FROM settings_current WHERE category='plugins'";
@@ -141,7 +144,10 @@ require($includePath."/local.inc.php");
 
 include_once($includePath."/lib/online.inc.php");
 // 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'] : '',$statsDbName); }
+if (!$x=strpos($_SERVER['PHP_SELF'],'whoisonline.php')) 
+{ 
+	LoginCheck(isset($_user['user_id']) ? $_user['user_id'] : '',$statsDbName); 
+}
 
 // ===== end "who is logged in?" module section =====
 

+ 16 - 8
main/inc/local.inc.php

@@ -460,8 +460,8 @@ if (isset($cidReset) && $cidReset) // course session data refresh requested or e
 
             $_cid                            = $cData['code'             ];
 
-	    $_course['id'          ]         = $cData['code'             ]; //auto-assigned integer
-	    $_course['name'        ]         = $cData['title'         ];
+			$_course['id'          ]         = $cData['code'             ]; //auto-assigned integer
+			$_course['name'        ]         = $cData['title'         ];
             $_course['official_code']         = $cData['visual_code'        ]; // use in echo
             $_course['sysCode'     ]         = $cData['code'             ]; // use as key in db
             $_course['path'        ]         = $cData['directory'        ]; // use as key in path
@@ -496,10 +496,13 @@ if (isset($cidReset) && $cidReset) // course session data refresh requested or e
 }
 else // continue with the previous values
 {
-	if(empty($_SESSION['_course']) OR empty($_SESSION['_cid'])){ //no previous values...
+	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;
-	}else{
+	}
+	else
+	{
 		$_cid 		= $_SESSION['_cid'   ];
    		$_course    = $_SESSION['_course'];
 	}
@@ -565,7 +568,8 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) // sessi
 	
 	            api_session_register('_courseUser');
 	        }
-        	else {
+        	else 
+        	{
 	        	// vérifier que c pas le coach du cours
 	        	$sql = "SELECT 1 
 						FROM `".$mainDbName."`.`session_rel_course`
@@ -573,7 +577,8 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) // sessi
 						AND session_rel_course.id_coach = '".$_user['user_id']."'";
 		        
 		        $result = api_sql_query($sql,__FILE__,__LINE__);
-		        if($row = mysql_fetch_array($result)){
+		        if($row = mysql_fetch_array($result))
+		        {
 		        	$_courseUser['role'] = 'Professor';
 		            $is_courseMember     = true;
 		            $is_courseTutor      = true;
@@ -581,7 +586,8 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) // sessi
 		
 		            api_session_register('_courseUser');
 		        }
-		        else {       
+		        else 
+		        {       
 	        		// vérifier que c pas un élève de la session        
 			        $sql = "SELECT * FROM `".$mainDbName."`.`session_rel_course_rel_user`
 			        		WHERE `id_user`  = '".$_user['user_id']."' 
@@ -708,7 +714,9 @@ if ((isset($gidReset) && $gidReset) || (isset($cidReset) && $cidReset)) // sessi
 elseif(isset($_SESSION['_gid'])) // continue with the previous values
 {
     $_gid             = $_SESSION ['_gid'            ];
-}else{ //if no previous value, assign caracteristic undefined value
+}
+else
+{ //if no previous value, assign caracteristic undefined value
 	$_gid = -1;
 }