Browse Source

Adding the \"id_session\" parameter to the api_get_cidreq() function see BT#245

Julio Montoya 15 years ago
parent
commit
3e1f9099a4
2 changed files with 3 additions and 5 deletions
  1. 1 1
      main/inc/lib/main_api.lib.php
  2. 2 4
      main/inc/local.inc.php

+ 1 - 1
main/inc/lib/main_api.lib.php

@@ -910,7 +910,7 @@ function api_get_anonymous_id() {
  * Returns the cidreq parameter name + current course id
  */
 function api_get_cidreq() {
-	return empty($GLOBALS['_cid']) ? '' : 'cidReq='.htmlspecialchars($GLOBALS['_cid']);
+	return empty($GLOBALS['_cid']) ? '' : 'cidReq='.htmlspecialchars($GLOBALS['_cid']).(api_get_session_id()==0?'':'&session_id='.api_get_session_id());
 }
 
 /**

+ 2 - 4
main/inc/local.inc.php

@@ -841,9 +841,7 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or
 	} else {
 		$_cid 		= $_SESSION['_cid'   ];
    		$_course    = $_SESSION['_course'];
-   		if ($_cid != '') {
-        	$cidReset = true; // force the user validation
-		}        
+
    		// 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
 		if (!empty($_GET['id_session'])) {
@@ -995,7 +993,7 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) { // ses
 			            	$is_courseAdmin = false;
 			            }
 			            api_session_register('_courseUser');
-			        } else {			        	
+			        } else {
 			        	if (api_get_session_id() != 0) {
 			        		// Check if the user is a student is this session
 					        $sql = "SELECT * FROM ".$tbl_session_course_user."