*/ if (!isset($sess_id_course_instance) && isset($id_instance)) { $sess_id_course_instance = $id_instance; } $title = translateFN("ADA - Chat Log"); if (!isset($id_chatroom)) { $id_chatroom = null; } $chatroomObj = new ChatRoom($id_chatroom); if (is_object($chatroomObj) && !AMA_DataHandler::isError($chatroomObj)) { //get the array with all the current info of the chatoorm $id_course_instance = $chatroomObj->id_course_instance; $id_course = $dh->get_course_id_for_course_instance($id_course_instance); // ****************************************************** // get course object $courseObj = read_course($id_course); if (is_object($courseObj) && !AMA_DB::isError($courseObj)) { $course_title = $courseObj->titolo; //title $id_toc = $courseObj->id_nodo_toc; //id_toc_node } } if (empty($media_path)) { $media_path = MEDIA_PATH_DEFAULT; } $banner = (include "{$root_dir}/include/banner.inc.php"); if (isset($id_chatroom)) { $menuOptions['id_room'] = $id_chatroom; } if (isset($id_course)) {
/* * Get this user needed objects from $neededObjAr based on user tyoe */ if (is_array($neededObjAr) && is_array($neededObjAr[$id_profile])) { $thisUserNeededObjAr = $neededObjAr[$id_profile]; } else { $thisUserNeededObjAr = array(); } if (in_array('course', $thisUserNeededObjAr)) { /** * get Course object */ /** * @var Object */ $courseObj = read_course($sess_id_course); //mydebug(__LINE__,__FILE__,$courseObj); if (ADA_Error::isError($courseObj)) { $courseObj->handleError(); } else { //mydebug(__LINE__,__FILE__,$courseObj); $course_title = $courseObj->titolo; //title $id_toc = $courseObj->id_nodo_toc; //id_toc_node $course_media_path = $courseObj->media_path; $course_author_id = $courseObj->id_autore; $course_family = $courseObj->template_family; $course_static_mode = $courseObj->static_mode; } if (empty($course_media_path)) {
/** * checks if the passed object type and id are coming from the public tester. * If true sets the needed GLOBALS['dh'] session variables accordingly. * * @param string $objType either 'course' or 'node' * @param string $objID object id to be checked and loaded if need be * * return true if invalid has to be set to true on the caller */ function checkAndSetPublicTester($objType, $objID) { $common_dh = $GLOBALS['common_dh']; if ($objType !== 'course' || is_null($objID)) { $tmp_id_course = isset($_REQUEST['id_course']) ? DataValidator::is_uinteger($_REQUEST['id_course']) : false; if ($tmp_id_course === false) { $tmp_id_course = isset($_REQUEST['id_node']) ? substr($_REQUEST['id_node'], 0, strpos($_REQUEST['id_node'], '_')) : false; } if ($tmp_id_course === false) { $tmp_id_course = isset($_SESSION['sess_id_course']) ? DataValidator::is_uinteger($_SESSION['sess_id_course']) : false; } if ($tmp_id_course === false) { $tmp_id_course = isset($_SESSION['sess_id_node']) ? substr($_SESSION['sess_id_node'], 0, strpos($_SESSION['sess_id_node'], '_')) : false; } } else { $tmp_id_course = $objID; } if ($tmp_id_course !== false) { // get the tester for the passed id_course $tester_infoAr = $common_dh->get_tester_info_from_id_course($tmp_id_course); // get the service info for the passed id_course $service_inforAr = $common_dh->get_service_type_info_from_course($tmp_id_course); // check that the tester is valid and is the public one and // check that the service is valid and is a public one if (!AMA_DB::isError($tester_infoAr) && is_array($tester_infoAr) && isset($tester_infoAr['puntatore']) && $tester_infoAr['puntatore'] == ADA_PUBLIC_TESTER && !AMA_DB::isError($service_inforAr) && is_array($service_inforAr) && isset($service_inforAr['isPublic']) && intval($service_inforAr['isPublic']) !== 0) { // save the dh, if a restrore is needed afterwards $olddh = $GLOBALS['dh']; // load the dh $dh = AMA_DataHandler::instance(MultiPort::getDSN($tester_infoAr['puntatore'])); if (!AMA_DB::isError($dh)) { // check the object if ($objType == 'node') { $dataHa = $dh->get_node_info($objID); if (AMA_DB::isError($dataHa) || !is_array($dataHa)) { $retval = true; // restore the saved datahandler $GLOBALS['dh'] = $olddh; } else { $retval = false; // set the datahandler $GLOBALS['dh'] = $dh; $_SESSION['sess_id_node'] = $objID; $_SESSION['sess_id_course'] = $tmp_id_course; } } else { if ($objType == 'course') { // set the datahandler $GLOBALS['dh'] = $dh; $sess_courseObj = read_course($objID); if (AMA_DB::isError($sess_courseObj) || !$sess_courseObj instanceof Course) { $retval = true; // restore the saved datahandler $GLOBALS['dh'] = $olddh; } else { $retval = false; $_SESSION['sess_courseObj'] = $sess_courseObj; $_SESSION['sess_id_course'] = $objID; } } } } } } return isset($retval) ? $retval : true; }