Feature #1744 - Cleaning logical conditions (3).

skala
Ivan Tcholakov 16 years ago
parent 7515a2354b
commit c7b44cc1e9
  1. 2
      main/inc/course_document.inc.php
  2. 104
      main/inc/lib/attendance.lib.php
  3. 6
      main/inc/lib/course.lib.php
  4. 11
      main/inc/lib/fckeditor/editor/dialog/fck_scayt.html
  5. 4
      main/inc/lib/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js
  6. 6
      main/inc/lib/fckeditor/editor/dialog/fck_template.html
  7. 2
      main/inc/lib/fckeditor/editor/filemanager/browser/default/browser.html
  8. 2
      main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageEditor.php
  9. 34
      main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php
  10. 4
      main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/editor.js
  11. 14
      main/inc/lib/fckeditor/editor/plugins/ImageManager/editor.php
  12. 6
      main/inc/lib/fckeditor/editor/plugins/ImageManager/editorFrame.php
  13. 6
      main/inc/lib/fckeditor/editor/plugins/ImageManager/images.php
  14. 4
      main/inc/lib/fckeditor/editor/plugins/ImageManager/manager.php
  15. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_details_listing.php
  16. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php
  17. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_file_listing.php
  18. 4
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.file.php
  19. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.image.php
  20. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.manager.php
  21. 4
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/function.base.php
  22. 18
      main/inc/lib/fckeditor/editor/plugins/flvPlayer/flvPlayer.js
  23. 28
      main/inc/lib/fckeditor/editor/plugins/imgmap/jscripts/imgmap.js
  24. 2
      main/inc/lib/fckeditor/editor/plugins/youtube/youtube.js
  25. 4
      main/inc/lib/fckeditor/fckeditor.php
  26. 8
      main/inc/lib/fileUpload.lib.php
  27. 20
      main/inc/lib/glossary.lib.php
  28. 10
      main/inc/lib/group_portal_manager.lib.php
  29. 30
      main/inc/lib/groupmanager.lib.php
  30. 10
      main/inc/lib/main_api.lib.php
  31. 6
      main/inc/lib/sessionmanager.lib.php
  32. 38
      main/inc/lib/social.lib.php
  33. 2
      main/inc/lib/tablesort.lib.php
  34. 414
      main/inc/lib/thematic.lib.php
  35. 10
      main/inc/lib/tracking.lib.php
  36. 16
      main/inc/lib/usermanager.lib.php
  37. 4
      main/inc/local.inc.php

@ -270,7 +270,7 @@ function OpenFile( fileUrl, type )
if (type=="audio")
{
ret = confirm('<?php echo api_utf8_encode(get_lang('AutostartMp3')); ?>');
if (ret==true)
if (ret)
{
GetE('autostart').checked = true;
}

@ -4,7 +4,7 @@
/**
* This file contains class used like library, provides functions for attendance tool. It's also used like model to attendance_controller (MVC pattern)
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> improvements
* @author Julio Montoya <gugli100@gmail.com> improvements
* @package chamilo.attendance
*/
@ -40,18 +40,18 @@ class Attendance
return $obj->total_number_of_items;
}
/**
* Get attendance list only the id, name and attendance_qualify_max fields
* @param string course db name (optional)
* @param int session id (optional)
* @return array attendances list
*/
function get_attendances_list($course_db_name = '', $session_id = null) {
function get_attendances_list($course_db_name = '', $session_id = null) {
// Initializing database table and variables
$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$data = array();
if (!empty($course_db_name)) {
$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE, $course_db_name);
}
@ -67,7 +67,7 @@ class Attendance
$data[$row['id']] = $row;
}
}
return $data;
return $data;
}
/**
@ -108,9 +108,9 @@ class Attendance
$student_param = '';
if (api_is_drh() && ($_GET['student_id'])) {
$student_param = '&student_id='.Security::remove_XSS($_GET['student_id']);
$student_param = '&student_id='.Security::remove_XSS($_GET['student_id']);
}
$attendance[1] = '<a href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$attendance[0].$param_gradebook.$student_param.'">'.$attendance[1].'</a>';
$attendance[3] = '<center>'.$attendance[3].'</center>';
if (api_is_allowed_to_edit(null, true)) {
@ -178,7 +178,7 @@ class Attendance
if ($link_to_gradebook) {
$description = '';
$link_id=is_resource_in_course_gradebook($course_code,7,$last_id,$session_id);
if ($link_id==false) {
if (!$link_id) {
add_resource_to_course_gradebook($course_code, 7, $last_id, $title_gradebook,$weight_calification,$value_calification,$description,time(),1,$session_id);
} else {
Database::query('UPDATE '.$table_link.' SET weight='.$weight_calification.' WHERE id='.$link_id.'');
@ -223,20 +223,20 @@ class Attendance
if ($link_to_gradebook) {
$description = '';
$link_id=is_resource_in_course_gradebook($course_code,7,$attendance_id,$session_id);
if ($link_id==false) {
if (!$link_id) {
add_resource_to_course_gradebook($course_code, 7, $attendance_id, $title_gradebook,$weight_calification,$value_calification,$description,time(),1,$session_id);
} else {
Database::query('UPDATE '.$table_link.' SET weight='.$weight_calification.' WHERE id='.$link_id.'');
}
}
$last_id = $attendance_id;
return $last_id;
}
/**
* delete attendaces
* @param int|array one or many attendances id
* @param int|array one or many attendances id
* @return int affected rows
*/
public function attendance_delete($attendance_id) {
@ -281,19 +281,19 @@ class Attendance
$a_course_users = CourseManager :: get_user_list_from_course_code($current_course_id, false, 0, '','lastname');
}
// get registered users inside current course
$a_users = array();
$a_users = array();
foreach ($a_course_users as $key =>$user_data) {
$value = array();
$uid = $user_data['user_id'];
$status = $user_data['status'];
$user_status_in_course = CourseManager::get_user_in_course_status($uid, $current_course_id);
//Not taking into account DRH or COURSEMANAGER
if ($uid <= 1 || $status == DRH || $user_status_in_course == COURSEMANAGER) continue;
if (!empty($attendance_id)) {
if (!empty($attendance_id)) {
$user_faults = $this->get_faults_of_user($uid, $attendance_id);
$value['attendance_result'] = $user_faults['faults'].'/'.$user_faults['total'].' ('.$user_faults['faults_porcent'].'%)';
$value['result_color_bar'] = $user_faults['color_bar'];
}
@ -301,19 +301,19 @@ class Attendance
// user's picture
$image_path = UserManager::get_user_picture_path_by_id($uid, 'web', false);
$user_profile = UserManager::get_picture_user($uid, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
if (!empty($image_path['file'])) {
$photo = '<center><a class="thickbox" href="'.$image_path['dir'].$image_path['file'].'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" title="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" /></a></center>';
} else {
$photo = '<center><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" title="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" /></center>';
}
$value['photo'] = $photo;
$value['firstname'] = $user_data['firstname'];
$value['lastname'] = $user_data['lastname'];
$value['user_id'] = $uid;
//Sending only 5 items in the array instead of 60
//Sending only 5 items in the array instead of 60
$a_users[$key] = $value;
}
return $a_users;
@ -455,16 +455,16 @@ class Attendance
* @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange)
*/
public function get_faults_of_user($user_id, $attendance_id) {
// initializing database table and variables
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT);
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT);
$user_id = intval($user_id);
$attendance_id = intval($attendance_id);
$results = array();
$attendance_data = $this->get_attendance_by_id($attendance_id);
$total_done_attendance = $attendance_data['attendance_qualify_max'];
$attendance_user_score = $this->get_user_score($user_id, $attendance_id);
// calculate results
$faults = $total_done_attendance-$attendance_user_score;
$faults = $faults > 0 ? $faults:0;
@ -473,7 +473,7 @@ class Attendance
$results['total'] = $total_done_attendance;
$results['faults_porcent'] = $faults_porcent;
$color_bar = '';
if ($faults_porcent > 25 ) {
$color_bar = '#F11';
} else if ($faults_porcent > 10) {
@ -483,30 +483,30 @@ class Attendance
return $results;
}
/**
* Get results of faults average for all courses by user
* @param int user id
* @param int user id
* @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange)
*/
public function get_faults_average_inside_courses($user_id) {
// get all courses of current user
$courses = CourseManager::get_courses_list_by_user_id($user_id, true);
$user_id = intval($user_id);
$courses = CourseManager::get_courses_list_by_user_id($user_id, true);
$user_id = intval($user_id);
$results = array();
$total_faults = $total_weight = $porcent = 0;
foreach ($courses as $course) {
foreach ($courses as $course) {
//$course_code = $course['code'];
//$course_info = api_get_course_info($course_code);
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT, $course['db_name']);
$attendances_by_course = $this->get_attendances_list($course['db_name']);
foreach ($attendances_by_course as $attendance) {
foreach ($attendances_by_course as $attendance) {
// get total faults and total weight
$total_done_attendance = $attendance['attendance_qualify_max'];
$total_done_attendance = $attendance['attendance_qualify_max'];
$sql = "SELECT score FROM $tbl_attendance_result WHERE user_id=$user_id AND attendance_id=".$attendance['id'];
$rs = Database::query($sql);
$score = 0;
@ -517,7 +517,7 @@ class Attendance
$faults = $total_done_attendance-$score;
$faults = $faults > 0 ? $faults:0;
$total_faults += $faults;
$total_weight += $total_done_attendance;
$total_weight += $total_done_attendance;
}
}
@ -525,30 +525,30 @@ class Attendance
$results['faults'] = $total_faults;
$results['total'] = $total_weight;
$results['porcent'] = $porcent;
return $results;
}
/**
* Get results of faults average by course
* @param int user id
* @param int user id
* @param int Session id (optional)
* @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange)
*/
public function get_faults_average_by_course($user_id, $course_code, $session_id = null) {
// Database tables and variables
$course_info = api_get_course_info($course_code);
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT, $course_info['dbName']);
$user_id = intval($user_id);
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT, $course_info['dbName']);
$user_id = intval($user_id);
$results = array();
$total_faults = $total_weight = $porcent = 0;
$attendances_by_course = $this->get_attendances_list($course_info['dbName'], $session_id);
foreach ($attendances_by_course as $attendance) {
$attendances_by_course = $this->get_attendances_list($course_info['dbName'], $session_id);
foreach ($attendances_by_course as $attendance) {
// Get total faults and total weight
$total_done_attendance = $attendance['attendance_qualify_max'];
$total_done_attendance = $attendance['attendance_qualify_max'];
$sql = "SELECT score FROM $tbl_attendance_result WHERE user_id=$user_id AND attendance_id=".$attendance['id'];
$rs = Database::query($sql);
$score = 0;
@ -559,9 +559,9 @@ class Attendance
$faults = $total_done_attendance-$score;
$faults = $faults > 0 ? $faults:0;
$total_faults += $faults;
$total_weight += $total_done_attendance;
$total_weight += $total_done_attendance;
}
$porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0;
$results['faults'] = $total_faults;
$results['total'] = $total_weight;
@ -580,7 +580,7 @@ class Attendance
global $dateTimeFormatLong;
$tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET);
$tbl_attendance_calendar= Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
$attendance_calendar = $this->get_attendance_calendar($attendance_id);
$calendar_ids = array();
// get all dates from calendar by current attendance
@ -692,8 +692,8 @@ class Attendance
$rs = Database::query($sql);
$data = array();
if (Database::num_rows($rs) > 0) {
while ($row = Database::fetch_array($rs)) {
$row['date_time'] = api_get_local_time($row['date_time']);
while ($row = Database::fetch_array($rs)) {
$row['date_time'] = api_get_local_time($row['date_time']);
$row['date'] = api_format_date($row['date_time'], DATE_FORMAT_SHORT);
$row['time'] = api_format_date($row['date_time'], TIME_NO_SEC_FORMAT);
$data[] = $row;
@ -737,11 +737,11 @@ class Attendance
// save repeated dates
switch($repeat_type) {
case 'daily':
case 'daily':
for ($i = $start_date + 86400; ($i <= $end_date); $i += 86400) {
$datetime = date('Y-m-d H:i:s', $i);
$datetimezone = api_get_utc_datetime($datetime);
$this->set_date_time($datetimezone);
$this->set_date_time($datetimezone);
$res = $this->attendance_calendar_add($attendance_id);
}
break;

@ -440,7 +440,7 @@ class CourseManager {
$sql_course = "SELECT course_code FROM $table_field cf INNER JOIN $t_cfv cfv ON cfv.field_id=cf.id WHERE field_variable='$original_course_id_name' AND field_value='$original_course_id_value'";
$res = Database::query($sql_course);
$row = Database::fetch_object($res_course);
if($row != false) {
if ($row) {
return $row->course_code;
} else {
return 0;
@ -458,7 +458,7 @@ class CourseManager {
$sql = "SELECT code FROM course WHERE id = '$id';";
$res = Database::query($sql);
$row = Database::fetch_object($res);
if($row != false) {
if ($row) {
return $row->code;
} else {
return null;
@ -2199,7 +2199,7 @@ class CourseManager {
$data = '';
foreach ($descriptions as $id => $description) {
$data .= '<div class="sectiontitle">';
if (api_is_allowed_to_edit() && $action_show == true) {
if (api_is_allowed_to_edit() && $action_show) {
//delete
$data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=delete&amp;description_id='.$description->id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">';
$data .= Display::return_icon('delete.gif', get_lang('Delete'), array('style' => 'vertical-align:middle;float:right;'));

@ -325,13 +325,12 @@
var that = get.wrap(this);
var isCheck = that.getAttr("checked");
//console.info(isCheck)
if ( isCheck == false ) {
//that.setAttr("checked",false);
options[ this.name ] = 0;
}else{
//that.setAttr("checked",true);
if ( isCheck ) {
//that.setAttr("checked", true);
options[ this.name ] = 1;
} else {
//that.setAttr("checked", false);
options[ this.name ] = 0;
}
//console.info(options)
});

@ -72,7 +72,7 @@ function clearSuggestions() {
function enableUndo() {
if( this.undoButton ) {
if( this.undoButton.disabled == true ) {
if( this.undoButton.disabled ) {
this.undoButton.disabled = false;
}
}
@ -80,7 +80,7 @@ function enableUndo() {
function disableUndo() {
if( this.undoButton ) {
if( this.undoButton.disabled == false ) {
if( !this.undoButton.disabled ) {
this.undoButton.disabled = true;
}
}

@ -86,9 +86,9 @@ window.onload = function()
//window.parent.SetAutoSize( true ) ;
LoadTemplatesXml() ;
// select first by default (Chamilo customization)
if(window.top.load_default_template==true)
SelectTemplate(0);
// Select first by default (Chamilo customization)
if ( window.top.load_default_template )
SelectTemplate( 0 ) ;
}
function LoadTemplatesXml()

@ -226,7 +226,7 @@ oIcons.GetIcon = function( fileName )
break ;
}
if ( this.AvailableIcons[ sExtension ] == true )
if ( this.AvailableIcons[ sExtension ] )
return sExtension ;
else
return 'default.icon' ;

@ -237,7 +237,7 @@ class ImageEditor
$newSaveFile = $this->makeRelative($relative, $saveFile);
$oldSaveFile = $newSaveFile;
if ($this->manager->config['allow_newFileName'] && $this->manager->config['allow_overwrite'] == false)
if ($this->manager->config['allow_newFileName'] && !$this->manager->config['allow_overwrite'])
{
// check whether a file already exist and if there is, create a variant of the filename
$newName = $this->getUniqueFilename($newSaveFile);

@ -103,7 +103,7 @@ class ImageManager
$base = Files::fixPath($base);
$dirs = array();
if($this->isValidBase() == false)
if (!$this->isValidBase())
return $dirs;
$d = @dir($base);
@ -128,7 +128,7 @@ class ImageManager
&& strpos($entry, 'css') === false
&& strpos($entry, 'HotPotatoes_files') === false
&& ($in_group || (!$in_group && strpos($entry, '_groupdocs') === false))
&& $this->isThumbDir($entry) == false)
&& !$this->isThumbDir($entry))
{
$relative = Files::fixPath($path.$entry);
$fullpath = Files::fixPath($base.$entry);
@ -186,7 +186,7 @@ class ImageManager
$files = array();
$dirs = array();
if($this->isValidBase() == false)
if (!$this->isValidBase())
return array($files,$dirs);
$path = Files::fixPath($path);
@ -249,7 +249,7 @@ class ImageManager
*/
}
if($is_dir && $this->isThumbDir($entry) == false) {
if ($is_dir && !$this->isThumbDir($entry)) {
global $_course;
if (isset($_course['dbName']) && $_course<>'-1') {
//checking visibility
@ -270,7 +270,7 @@ class ImageManager
$count = $this->countFiles($full);
$dirs[$relative] = array('fullpath'=>$full,'entry'=>$entry,'count'=>$count);
}
else if(is_file($fullpath.$entry) && $this->isThumb($entry)==false && $this->isTmpFile($entry) == false)
else if(is_file($fullpath.$entry) && !$this->isThumb($entry) && !$this->isTmpFile($entry))
{
$img = $this->getImageInfo($fullpath.$entry);
@ -323,11 +323,11 @@ class ImageManager
while (false !== ($entry = $d->read()))
{
//echo $entry."<br>";
if(substr($entry,0,1) != '.'
&& $this->isThumbDir($entry) == false
&& $this->isTmpFile($entry) == false
&& $this->isThumb($entry) == false)
//echo $entry."<br />";
if (substr($entry, 0, 1) != '.'
&& !$this->isThumbDir($entry)
&& !$this->isTmpFile($entry)
&& !$this->isThumb($entry))
{
$total++;
}
@ -369,7 +369,7 @@ class ImageManager
*/
function isThumbDir($entry)
{
if($this->config['thumbnail_dir'] == false
if (!$this->config['thumbnail_dir']
|| strlen(trim($this->config['thumbnail_dir'])) == 0)
Return false;
else
@ -402,7 +402,7 @@ class ImageManager
$thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename'];
if($this->config['safe_mode'] == true
if ($this->config['safe_mode']
|| strlen(trim($this->config['thumbnail_dir'])) == 0)
{
Return Files::makeFile($path_parts['dirname'],$thumbnail);
@ -436,7 +436,7 @@ class ImageManager
$thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename'];
if($path_parts['dirname']=='\\') $path_parts['dirname']='/';
if($this->config['safe_mode'] == true
if ($this->config['safe_mode']
|| strlen(trim($this->config['thumbnail_dir'])) == 0)
{
$path = Files::fixPath($path_parts['dirname']);
@ -494,7 +494,7 @@ class ImageManager
*/
function processUploads()
{
if($this->isValidBase() == false)
if (!$this->isValidBase())
return;
$relative = null;
@ -571,7 +571,7 @@ class ImageManager
}
// Checking for a valid image by reading binary file (partially in most cases).
if($this->config['validate_images'] == true)
if ($this->config['validate_images'])
{
$imgInfo = @getImageSize($file['tmp_name']);
if(!is_array($imgInfo))
@ -756,7 +756,7 @@ class ImageManager
{
$fullpath = Files::makeFile($this->getBaseDir(),$relative);
//check that the file is an image
if($this->config['validate_images'] == true)
if ($this->config['validate_images'])
{
if(!is_array($this->getImageInfo($fullpath)))
return false; //hmmm not an Image!!???
@ -821,7 +821,7 @@ class ImageManager
*/
function processNewDir()
{
if($this->config['safe_mode'] == true)
if ($this->config['safe_mode'])
Return false;
if(isset($_GET['newDir']) && isset($_GET['dir']))

@ -19,7 +19,7 @@
{
editor.window.document.getElementById("imgCanvas").style.display = "block";
editor.window.document.getElementById("background").style.display = "none";
if (editor.window.watermarkingEnabled == true)
if (editor.window.watermarkingEnabled)
{
editor.window.dd.elements.floater.hide();
}
@ -55,7 +55,7 @@
{
editor.window.document.getElementById("imgCanvas").style.display = "none";
editor.window.document.getElementById("background").style.display = "block";
if (editor.window.watermarkingEnabled == true)
if (editor.window.watermarkingEnabled)
{
editor.window.dd.elements.floater.show();
editor.window.dd.elements.floater.moveTo(0, 0);

@ -287,12 +287,12 @@ body {
</div>
<div id="tools_save" style="display:none;">
<?php if($IMConfig['demo'] != true) { ?>
<?php if (!$IMConfig['demo']) { ?>
<div id="tool_inputs">
<?php if($IMConfig['allow_newFileName'] == true) { ?>
<label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php if($IMConfig['allow_overwrite'] == false){ echo $editor->getDefaultSaveFile(); }else{ echo basename($clean_img); } ?>" />
<?php if ($IMConfig['allow_newFileName']) { ?>
<label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php if (!$IMConfig['allow_overwrite']) { echo $editor->getDefaultSaveFile(); }else{ echo basename($clean_img); } ?>" />
<?php }else{ ?>
<input type="hidden" id="save_filename" value="<?php echo basename($clean_img); ?>" />
<?php } ?>
@ -301,13 +301,13 @@ body {
$pos = strrpos($clean_img, ".");
$ext = substr($clean_img, $pos + 1);
?>
<select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle; <?php if($IMConfig['allow_newFileName'] != true && $ext != "jpg" && $ext != "jpeg") {echo "display: none;";} ?>" onchange="updateFormat(this)">
<select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle; <?php if (!$IMConfig['allow_newFileName'] && $ext != "jpg" && $ext != "jpeg") {echo "display: none;";} ?>" onchange="updateFormat(this)">
<option value="" selected>Image Format</option>
<option value="">---------------------</option>
<option value="jpeg,85">JPEG High</option>
<option value="jpeg,60">JPEG Medium</option>
<option value="jpeg,35">JPEG Low</option>
<?php if($IMConfig['allow_newFileName'] == true){ ?>
<?php if ($IMConfig['allow_newFileName']) { ?>
<option value="png">PNG</option>
<?php if($editor->isGDGIFAble() != -1) { ?>
<option value="gif">GIF</option>
@ -344,8 +344,8 @@ body {
<div id="toolbar">
<div id="buttons">
<a href="javascript:toggle('replace')" id="icon_replace" title="Replace" <?php if($IMConfig['allow_replace'] == false) { echo "style=\"display: none;\""; } ?> ><img src="img/replace.gif" height="20" width="20" alt="Replace" /><span>Replace</span></a>
<a href="javascript:toggle('watermark')" id="icon_watermark" title="Watermark" <?php if(empty($IMConfig['watermarks'])) { echo "style=\"display: none;\""; } ?> ><img src="img/watermark.gif" height="20" width="20" alt="Watermark" /><span>Watermark</span></a>
<a href="javascript:toggle('replace')" id="icon_replace" title="Replace" <?php if (!$IMConfig['allow_replace']) { echo "style=\"display: none;\""; } ?> ><img src="img/replace.gif" height="20" width="20" alt="Replace" /><span>Replace</span></a>
<a href="javascript:toggle('watermark')" id="icon_watermark" title="Watermark" <?php if (empty($IMConfig['watermarks'])) { echo "style=\"display: none;\""; } ?> ><img src="img/watermark.gif" height="20" width="20" alt="Watermark" /><span>Watermark</span></a>
<a href="javascript:toggle('crop')" id="icon_crop" title="Crop"><img src="img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a>
<a href="javascript:toggle('scale')" id="icon_scale" title="Resize"><img src="img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a>
<a href="javascript:toggle('rotate')" id="icon_rotate" title="Rotate"><img src="img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a>

@ -160,7 +160,7 @@
// save message
var message = i18n('File saved.');
<?php
if ($editor->forcedNewName != false)
if ($editor->forcedNewName)
{
?>
message += '\n' + i18n('File name was changed into ') + '<?php echo $editor->forcedNewName; ?>';
@ -273,10 +273,10 @@
<script type="text/javascript">
// <![CDATA[
if (watermarkingEnabled == true)
if (watermarkingEnabled)
{
SET_DHTML("background"+NO_DRAG, "floater"+CURSOR_MOVE);
if (window.firstWatermarkItemUnavailable == true)
if (window.firstWatermarkItemUnavailable)
{
dd.elements.floater.swapImage(eval("window." + watermarkBox.options[0].value + "Preload.src"));
}

@ -56,10 +56,10 @@ function drawFiles($list, &$manager)
<td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block">
<a href="javascript: void(0);" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);"title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"><img src="<?php echo $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"/></a>
</td></tr><tr><td class="edit" style="padding-top: 5px;">
<?php if($IMConfig['allow_delete'] == true) { ?>
<?php if ($IMConfig['allow_delete']) { ?>
<a href="images.php?dir=<?php echo $relative; ?>&amp;delf=<?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a>
<?php } ?>
<?php if($IMConfig['allow_edit'] == true) { ?>
<?php if ($IMConfig['allow_edit']) { ?>
<a href="javascript: void(0);" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a>
<?php } ?>
<?php if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?>
@ -209,7 +209,7 @@ function drawErrorBase(&$manager)
</head>
<body dir="<?php echo $IMConfig['text_direction']; ?>">
<?php if ($manager->isValidBase() == false) { drawErrorBase($manager); }
<?php if (!$manager->isValidBase()) { drawErrorBase($manager); }
elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?>
<table>
<tr>

@ -153,7 +153,7 @@ body {
<?php } ?>
</select>
<a href="javascript: void(0);" onclick="javascript: goUpDir();" title="Directory Up"><img src="img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" />&nbsp;<span>Directory Up</span></a>
<?php if($IMConfig['safe_mode'] == false && $IMConfig['allow_new_dir']) { ?>
<?php if (!$IMConfig['safe_mode'] && $IMConfig['allow_new_dir']) { ?>
<a href="javascript: void(0);" onclick="newFolder();" title="New Folder"><img src="img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a>
<?php } ?>
<div id="messages" style="display: none;"><span id="message"></span><img SRC="img/dots.gif" width="22" height="12" alt="..." /></div>
@ -182,7 +182,7 @@ body {
<td><input type="text" id="f_horiz" class="smallWidth" value="" /></td>
</tr>
<tr>
<?php if($IMConfig['allow_upload'] == true) { ?>
<?php if ($IMConfig['allow_upload']) { ?>
<td align="right"><label for="upload">Upload</label></td>
<td>
<table cellpadding="0" cellspacing="0" border="0">

@ -54,7 +54,7 @@
///Second step: hiding as the case
//Juan Carlos Raña
if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group==true && $file['name'][0]!='.')
if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group && $file['name'][0]!='.')
{
if($file['type'] == 'file')
{

@ -37,7 +37,7 @@
///Second step: hiding as the case
//Juan Carlos Ra<EFBFBD>a
if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group==true && $file['name'][0]!='.')
if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group && $file['name'][0]!='.')
{
?>

@ -115,7 +115,7 @@
}
if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) || ereg($css_folder_dokeos, $file['path']) || ereg($hotpotatoes_folder_dokeos, $file['path']) || ereg($chat_files_dokeos, $file['path']) || $hide_doc_group==true || $file['name'][0]=='.')//Dokeos fix for hidden items.
if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) || ereg($css_folder_dokeos, $file['path']) || ereg($hotpotatoes_folder_dokeos, $file['path']) || ereg($chat_files_dokeos, $file['path']) || $hide_doc_group || $file['name'][0]=='.')//Dokeos fix for hidden items.
{
$count_hideItem=$count_hideItem+1;

@ -366,7 +366,7 @@
* @param boolean $empty
* @return boolean
*/
function __recursive_remove_directory($directory, $empty=FALSE)
function __recursive_remove_directory($directory, $empty = FALSE)
{
// if the path has a slash at the end we remove it here
if(substr($directory,-1) == '/')
@ -418,7 +418,7 @@
@closedir($handle);
// if the option to empty is not set to true
if($empty == FALSE)
if (!$empty)
{
// try to delete the now empty directory
if(!@rmdir($directory))

@ -488,7 +488,7 @@
$giftype = ($write) ? ' Create Support' : ' Read Support';
$support = strtoupper($extension) . ($extension == 'gif' ? $giftype : ' Support');
if (!isset($this->gdInfo[$support]) || $this->gdInfo[$support] == false) {
if (!isset($this->gdInfo[$support]) || !$this->gdInfo[$support]) {
$request = ($write) ? 'saving' : 'reading';
$this->_debug("Support for $request the file type '$extension' cannot be found.");
return false;

@ -203,7 +203,7 @@ class manager
}
if(ereg($deleted_by_dokeos_folder, $path)|| ereg($css_folder_dokeos, $path) || ereg($hotpotatoes_folder_dokeos, $path) || ereg($chat_files_dokeos, $path) || $hide_doc_group==true || $file[0]=='.')
if(ereg($deleted_by_dokeos_folder, $path)|| ereg($css_folder_dokeos, $path) || ereg($hotpotatoes_folder_dokeos, $path) || ereg($chat_files_dokeos, $path) || $hide_doc_group || $file[0]=='.')
{
$this->currentFolderInfo['subdir']=$this->currentFolderInfo['subdir']-1;
}

@ -864,7 +864,7 @@ function getRootPath() {
}
}
if(!ereg($deleted_by_dokeos, $folderName) && !ereg($css_folder_dokeos, $folderName) && !ereg($hotpotatoes_folder_dokeos, $folderName) && !ereg($chat_files_dokeos, $folderName) && !ereg($thumbs_folder, $folderName) && $show_doc_group==true)
if(!ereg($deleted_by_dokeos, $folderName) && !ereg($css_folder_dokeos, $folderName) && !ereg($hotpotatoes_folder_dokeos, $folderName) && !ereg($chat_files_dokeos, $folderName) && !ereg($thumbs_folder, $folderName) && $show_doc_group)
{
return substr($folderName,strpos($folderName, '-'),strlen($folderName)); //hide the firsts numbers
}
@ -1169,7 +1169,7 @@ function getRootPath() {
if ( $old_x >= 0 && $old_x < $src_x
&& $old_y >= 0 && $old_y < $src_y ) {
if ($bicubic == true) {
if ($bicubic) {
$sY = $old_y + 1;
$siY = $old_y;
$siY2 = $old_y - 1;

@ -220,7 +220,7 @@ function LoadSelection()
function Ok()
{
var rbFileTypeVal = "single" ;
if ( GetE( 'rbFileType' ).checked == false )
if ( !GetE( 'rbFileType' ).checked )
{
rbFileTypeVal = "list" ;
}
@ -449,7 +449,7 @@ Media.prototype.getInnerHTML = function ( objectId )
var thisHeight = this.height ;
var thisMediaType = "single" ;
if ( GetE( 'rbFileType' ).checked == false )
if ( !GetE( 'rbFileType' ).checked )
{
thisMediaType = "mpl" ;
}
@ -470,10 +470,10 @@ Media.prototype.getInnerHTML = function ( objectId )
cssfloat = 'float: left;' ;
}
var s = "" ;
var s = "" ;
//Replacing the creation of the SWFObject to the use of the object tag in order to avoid HTMLPurifier conflicts see CT#1297
//Replacing the creation of the SWFObject to the use of the object tag in order to avoid HTMLPurifier conflicts see CT#1297
s+= '<div id="player' + randomnumber + '-parent" style="text-align: center;' + cssfloat + '">\n';
s+= '<div style="border-style: none; height: ' + thisHeight + 'px; width:' + thisWidth + 'px; overflow: hidden; background-color: rgb(220, 220, 220); background-image: url(' + oEditor.FCKConfig.PluginsPath + 'flvPlayer/flvPlayer.gif); background-repeat:no-repeat; background-position:center;' + cssalign + '">';
s+= '<script src="' + oEditor.FCKConfig.PluginsPath + 'flvPlayer/swfobject.js" type="text/javascript"></script>\n';
@ -500,9 +500,9 @@ Media.prototype.getInnerHTML = function ( objectId )
s+= '<p><a href="http://get.adobe.com/flashplayer">Get Flash</a> to see this player.</p>';
// s+= '</object>';
s+= '</object>';
/*
s += '\n' ;
s += '<div id="player' + randomnumber + '-parent" style="text-align: center;">\n'; //'<div id="player' + randomnumber + '-parent" style="text-align: center;' + cssfloat + '">\n';
@ -617,7 +617,7 @@ Media.prototype.getInnerHTML = function ( objectId )
}
s += ' s1.addVariable("shuffle","false");\n' ;
if (this.loop == true)
if (this.loop)
{
s += ' s1.addVariable("repeat","list");\n' ;
}

@ -772,7 +772,7 @@ this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_NORM_SHAPE;
}else{
if(this.areas[id].shape=="circle"||this.areas[id].shape=="polygon"){
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[id].style.borderWidth="1px";
this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_NORM_BOX;
@ -852,7 +852,7 @@ if(!this.areas[id].label){
return;
}
try{
if(this.config.label==""||this.config.label==false){
if(this.config.label=="" || !this.config.label){
this.areas[id].label.innerHTML="";
this.areas[id].label.style.display="none";
}else{
@ -874,7 +874,7 @@ this.log("Error putting label",1);
};
imgmap.prototype._puthint=function(id){
try{
if(this.config.hint==""||this.config.hint==false){
if(this.config.hint=="" || !this.config.hint){
this.areas[id].title="";
this.areas[id].alt="";
}else{
@ -1411,7 +1411,7 @@ this.is_drawing=this.DM_POLYGON_DRAW;
this.statusMessage(this.strings["POLYGON_DRAW"]);
this.areas[this.currentid].style.left=x+"px";
this.areas[this.currentid].style.top=y+"px";
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[this.currentid].style.borderWidth="1px";
this.areas[this.currentid].style.borderStyle="dotted";
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
@ -1439,7 +1439,7 @@ this.is_drawing=this.DM_SQUARE_DRAW;
this.statusMessage(this.strings["SQUARE_DRAW"]);
this.areas[this.currentid].style.left=x+"px";
this.areas[this.currentid].style.top=y+"px";
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[this.currentid].style.borderWidth="1px";
this.areas[this.currentid].style.borderStyle="dotted";
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
@ -1472,7 +1472,7 @@ this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_HIGHLIGHT_SHAPE;
}else{
if(this.areas[id].shape=="circle"||this.areas[id].shape=="polygon"){
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[id].style.borderWidth="1px";
this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_HIGHLIGHT_BOX;
@ -1503,7 +1503,7 @@ this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_NORM_SHAPE;
}else{
if(this.areas[id].shape=="circle"||this.areas[id].shape=="polygon"){
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[id].style.borderWidth="1px";
this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_NORM_BOX;
@ -1652,7 +1652,7 @@ if(_9e<6&&_9f>6){
if(this.areas[this.currentid].shape=="circle"){
this.is_drawing=this.DM_SQUARE_RESIZE_LEFT;
this.statusMessage(this.strings["SQUARE_RESIZE_LEFT"]);
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
}
}else{
@ -1667,7 +1667,7 @@ if(_9e>parseInt(this.areas[this.currentid].style.width)-6&&_9f>6){
if(this.areas[this.currentid].shape=="circle"){
this.is_drawing=this.DM_SQUARE_RESIZE_RIGHT;
this.statusMessage(this.strings["SQUARE_RESIZE_RIGHT"]);
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
}
}else{
@ -1682,7 +1682,7 @@ if(_9e>6&&_9f<6){
if(this.areas[this.currentid].shape=="circle"){
this.is_drawing=this.DM_SQUARE_RESIZE_TOP;
this.statusMessage(this.strings["SQUARE_RESIZE_TOP"]);
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
}
}else{
@ -1697,7 +1697,7 @@ if(_9f>parseInt(this.areas[this.currentid].style.height)-6&&_9e>6){
if(this.areas[this.currentid].shape=="circle"){
this.is_drawing=this.DM_SQUARE_RESIZE_BOTTOM;
this.statusMessage(this.strings["SQUARE_RESIZE_BOTTOM"]);
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
}
}else{
@ -1711,7 +1711,7 @@ this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_SHAPE;
if(this.areas[this.currentid].shape=="circle"){
this.is_drawing=this.DM_SQUARE_MOVE;
this.statusMessage(this.strings["SQUARE_MOVE"]);
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
}
this.memory[this.currentid].rdownx=_9e;
@ -1731,7 +1731,7 @@ this.memory[this.currentid].ypoints[i]=this.areas[this.currentid].ypoints[i];
}
this.is_drawing=this.DM_POLYGON_MOVE;
this.statusMessage(this.strings["POLYGON_MOVE"]);
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
}
this.memory[this.currentid].rdownx=_9e;
@ -1752,7 +1752,7 @@ this.areas[this.currentid].style.borderWidth="1px";
this.areas[this.currentid].style.borderStyle="dotted";
}else{
if(this.areas[this.currentid].shape=="circle"||this.areas[this.currentid].shape=="polygon"){
if(this.config.bounding_box==true){
if(this.config.bounding_box){
this.areas[this.currentid].style.borderWidth="1px";
this.areas[this.currentid].style.borderStyle="dotted";
}

@ -118,7 +118,7 @@ function Ok()
}
// Check security
if ( checkCode( GetE( 'txtUrl' ).value ) == false )
if ( !checkCode( GetE( 'txtUrl' ).value ) )
{
alert( oEditor.FCKLang.DlgYouTubeSecurity ) ;
return false ;

@ -241,7 +241,7 @@ class FCKeditor
foreach ( $this->Config as $sKey => $sValue )
{
if ( $bFirst == false ) {
if ( !$bFirst ) {
$sParams .= '&amp;' ;
} else {
$bFirst = false ;
@ -494,7 +494,7 @@ class FCKeditor
$current_session_id = api_get_session_id();
if($current_session_id==0)
{
$config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$config['CreateDocumentDir'] = $relative_path_prefix.'courses/'.api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$config['BaseHref'] = $script_path;

@ -1017,13 +1017,13 @@ function search_img_from_html($html_file) {
*/
function create_unexisting_directory($_course, $user_id, $to_group_id, $to_user_id, $base_work_dir, $desired_dir_name, $title = null, $visibility = '') {
$nb = '';
while (file_exists($base_work_dir.$desired_dir_name.$nb)) {
while (file_exists($base_work_dir.$desired_dir_name.$nb)) {
$nb += 1;
}
if($title == null) {
$title = basename($desired_dir_name);
}
if (mkdir($base_work_dir.$desired_dir_name.$nb, api_get_permissions_for_new_directories(), true)) {
// Check if pathname already exists inside document table
$tbl_document = Database::get_course_table(TABLE_DOCUMENT, $_course['dbName']);
@ -1043,7 +1043,7 @@ function create_unexisting_directory($_course, $user_id, $to_group_id, $to_user_
return $desired_dir_name.$nb;
}
} else {
//This means the folder NOT exist in the filesystem (now this was created) but there is a record in the Database
//This means the folder NOT exist in the filesystem (now this was created) but there is a record in the Database
return $desired_dir_name.$nb;
}
} else {
@ -1342,7 +1342,7 @@ function api_replace_parameter($upload_path, $buffer, $param_name = 'src') {
//$message .= "In tag $count, <b>" . htmlentities($tag_list[$count])
// . "</b>, parameter <b>" . $replace_what[$count] . "</b> replaced by <b>" . $replace_by[$count] . "</b><br>"; //debug
}
//if (isset($message) && $message == true) api_display_debug_info($message); //debug
//if ($message) api_display_debug_info($message); //debug
$buffer = str_replace($replace_what, $replace_by, $buffer);
return $buffer;
}

@ -164,7 +164,7 @@ class GlossaryManager {
return 0;
}
$row = Database::fetch_array($res_max);
if (!empty($row[0])) {
if (!empty($row[0])) {
return $row[0];
}
return 0;
@ -218,8 +218,8 @@ class GlossaryManager {
FROM $t_glossary g
WHERE g.glossary_id = '".intval($glossary_id)."' ";
$result = Database::query($sql);
if ($result === false || Database::num_rows($result) != 1) {
return false;
if ($result === false || Database::num_rows($result) != 1) {
return false;
}
return Database::fetch_array($result);
}
@ -251,7 +251,7 @@ class GlossaryManager {
}
/**
* This is the main function that displays the list or the table with all
* This is the main function that displays the list or the table with all
* the glossary terms
* @param string View ('table' or 'list'). Optional parameter. Defaults to 'table' and prefers glossary_view from the session by default.
* @return void
@ -259,10 +259,10 @@ class GlossaryManager {
* @version januari 2009, dokeos 1.8.6
*/
function display_glossary($view = 'table') {
// This function should always be called with the corresponding
// This function should always be called with the corresponding
// parameter for view type. Meanwhile, use this cheap trick.
if (empty ($_SESSION['glossary_view'])) {
$_SESSION['glossary_view'] = $view;
if (empty ($_SESSION['glossary_view'])) {
$_SESSION['glossary_view'] = $view;
}
// action links
echo '<div class="actions" style="margin-bottom:10px">';
@ -326,7 +326,7 @@ class GlossaryManager {
$t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
$session_id = intval($session_id);
$sql_filter = api_get_session_condition($session_id);
$sql = "SELECT count(glossary_id) as total FROM $t_glossary ".
$sql = "SELECT count(glossary_id) as total FROM $t_glossary ".
" WHERE 1=1 $sql_filter";
$res = Database::query($sql);
if ($res === false) { return 0; }
@ -400,7 +400,7 @@ class GlossaryManager {
if (api_is_allowed_to_edit(null,true)) {
$array[5] = $data[5];
}
// Date treatment for timezones
$array[3] = api_get_local_time($array[3], null, date_default_timezone_get());
$array[4] = api_get_local_time($array[4], null, date_default_timezone_get());
@ -521,7 +521,7 @@ class GlossaryManager {
$res = Database::query($sql);
$found = false;
while ($row = Database::fetch_array($res)) {
if ($found == true and empty($next_id)) {
if ($found && empty($next_id)) {
$next_id = $row['glossary_id'];
$next_display_order = $row['display_order'];
}

@ -165,7 +165,7 @@ class GroupPortalManager
}
}
if ($show_tag_links == true) {
if ($show_tag_links) {
if (is_array($tags) && count($tags)>0) {
foreach ($tags as $tag) {
$tag_tmp[] = '<a href="'.api_get_path(WEB_PATH).'main/social/search.php?q='.$tag['tag'].'">'.$tag['tag'].'</a>';
@ -208,7 +208,7 @@ class GroupPortalManager
$array = array();
if (Database::num_rows($result) > 0) {
while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($with_image == true) {
if ($with_image) {
$picture = self::get_picture_group($row['id'], $row['picture_uri'],80);
$img = '<img src="'.$picture['file'].'" />';
$row['picture_uri'] = $img;
@ -245,7 +245,7 @@ class GroupPortalManager
$result=Database::query($sql);
$array = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($with_image == true) {
if ($with_image) {
$picture = self::get_picture_group($row['id'], $row['picture_uri'],80);
$img = '<img src="'.$picture['file'].'" />';
$row['picture_uri'] = $img;
@ -279,7 +279,7 @@ class GroupPortalManager
$result=Database::query($sql);
$array = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($with_image == true) {
if ($with_image) {
$picture = self::get_picture_group($row['id'], $row['picture_uri'],80);
$img = '<img src="'.$picture['file'].'" />';
$row['picture_uri'] = $img;
@ -339,7 +339,7 @@ class GroupPortalManager
$result=Database::query($sql);
$array = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($with_image == true) {
if ($with_image) {
$image_path = UserManager::get_user_picture_path_by_id($row['user_id'], 'web', false, true);
$picture = UserManager::get_picture_user($row['user_id'], $image_path['file'],$image_conf['height'],$image_conf['size']);
$row['image'] = '<img src="'.$picture['file'].'" '.$picture['style'].' />';

@ -211,12 +211,12 @@ class GroupManager {
$lastId = Database::insert_id();
$desired_dir_name= '/'.replace_dangerous_char($name,'strict').'_groupdocs';
$my_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document';
$unique_name = create_unexisting_directory($_course,$_user['user_id'],$lastId,NULL,$my_path, $desired_dir_name);
/* Stores the directory path into the group table */
$sql = "UPDATE ".$table_group." SET name = '".Database::escape_string($name)."', secret_directory = '".$unique_name."' WHERE id ='".$lastId."'";
Database::query($sql);
// create a forum if needed
@ -389,9 +389,9 @@ class GroupManager {
// define repository for deleted element
/* Useless code
$group_garbage = api_get_path(SYS_ARCHIVE_PATH).$course['path']."/group";
$group_garbage = api_get_path(SYS_ARCHIVE_PATH).$course['path']."/group";
var_dump($group_garbage);
if (!file_exists($group_garbage))
FileManager :: mkdirs($group_garbage, api_get_permissions_for_new_directories());
@ -401,7 +401,7 @@ class GroupManager {
$sql = 'SELECT id, secret_directory, session_id FROM '.$group_table.' WHERE id IN ('.implode(' , ', $group_ids).')';
$db_result = Database::query($sql);
$forum_ids = array ();
while ($group = Database::fetch_object($db_result)) {
// move group-documents to garbage
//$source_directory = api_get_path(SYS_COURSE_PATH).$course['path']."/group/".$group->secret_directory;
@ -410,22 +410,22 @@ class GroupManager {
$destination_dir = api_get_path(SYS_COURSE_PATH).$course['path']."/document".$group->secret_directory.'_DELETED_'.$group->id;
if (!empty($group->secret_directory)) {
//Deleting from document tool
//Deleting from document tool
DocumentManager::delete_document($course, $group->secret_directory, $source_directory);
if (file_exists($source_directory)) {
if (file_exists($source_directory)) {
if (api_get_setting('permanently_remove_deleted_files') == 'true') {
//Delete
my_delete($source_directory);
} else {
//Rename
//Rename
rename($source_directory, $destination_dir);
}
}
}
}
//$forum_ids[] = $group->forum_id;
}
// delete the groups
$sql = "DELETE FROM ".$group_table." WHERE id IN ('".implode("' , '", $group_ids)."')";
Database::query($sql);
@ -1082,7 +1082,7 @@ class GroupManager {
$users = array ();
while ($user = Database::fetch_object($db_result))
{
if ($id_only==false)
if (!$id_only)
{
$member['user_id'] = $user->user_id;
$member['firstname'] = $user->firstname;
@ -1312,15 +1312,15 @@ class GroupManager {
$user_id = Database::escape_string($user_id);
$sql = "SELECT group_id FROM $tbl_group WHERE user_id = '$user_id'";
$groupres = Database::query($sql);
// uncommenting causes a bug in Agenda AND announcements because there we check if the return value of this function is an array or not
//$groups=array();
if($groupres) {
while ($myrow= Database::fetch_array($groupres))
$groups[]=$myrow['group_id'];
}
return $groups;
}
/*

@ -1590,7 +1590,7 @@ function api_get_session_condition($session_id, $and = true, $with_base_content
$session_id = intval($session_id);
//condition to show resources by session
$condition_session = '';
$condition_add = $and == false ? " WHERE " : " AND ";
$condition_add = $and ? " AND " : " WHERE ";
if ($with_base_content) {
$condition_session = $condition_add." (session_id = $session_id OR session_id = 0) ";
@ -1979,12 +1979,12 @@ function api_is_allowed_to_edit($tutor = false, $coach = false, $session_coach =
$is_allowed_coach_to_edit = api_is_coach();
$session_visibility = api_get_session_visibility($my_session_id);
$is_courseAdmin = api_is_course_admin() || api_is_platform_admin();
if (!$is_courseAdmin && $tutor == true) { // If we also want to check if the user is a tutor...
if (!$is_courseAdmin && $tutor) { // If we also want to check if the user is a tutor...
$is_courseAdmin = $is_courseAdmin || api_is_course_tutor();
}
if (!$is_courseAdmin && $coach == true) { // If we also want to check if the user is a coach...';
if (!$is_courseAdmin && $coach) { // If we also want to check if the user is a coach...';
// Check if session visibility is read only for coachs
if ($session_visibility==SESSION_VISIBLE_READ_ONLY) {
if ($session_visibility == SESSION_VISIBLE_READ_ONLY) {
$is_allowed_coach_to_edit = false;
}
@ -1995,7 +1995,7 @@ function api_is_allowed_to_edit($tutor = false, $coach = false, $session_coach =
}
}
if (!$is_courseAdmin && $session_coach == true) {
if (!$is_courseAdmin && $session_coach) {
$is_courseAdmin = $is_courseAdmin || api_is_coach();
}

@ -360,7 +360,7 @@ class SessionManager {
}
if ($send_email == true) {
if ($send_email) {
global $_configuration;
//sending emails only
if(is_array($user_list) && count($user_list)>0) {
@ -890,7 +890,7 @@ class SessionManager {
$result = @Database::query($sql);
while ($rows = Database::fetch_array($result)) {
$session_id = $rows['id'];
if ($delete_session == true){
if ($delete_session) {
if ($from_ws) {
SessionManager::delete_session($session_id,true);
} else {
@ -1179,7 +1179,7 @@ class SessionManager {
$sql_session = "SELECT session_id FROM $table_field sf INNER JOIN $t_sfv sfv ON sfv.field_id=sf.id WHERE field_variable='$original_session_id_name' AND field_value='$original_session_id_value'";
$res_session = Database::query($sql_session);
$row = Database::fetch_object($res_session);
if ($row != false) {
if ($row) {
return $row->session_id;
} else {
return 0;

@ -104,14 +104,14 @@ class SocialManager extends UserManager {
$sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE firstName LIKE "%'.Database::escape_string($search_name).'%" OR lastName LIKE "%'.Database::escape_string($search_name).'%" OR '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%") ) ';
}
$res=Database::query($sql);
while ($row=Database::fetch_array($res,'ASSOC')) {
if ($load_extra_info == true) {
$res = Database::query($sql);
while ($row = Database::fetch_array($res, 'ASSOC')) {
if ($load_extra_info) {
$path = UserManager::get_user_picture_path_by_id($row['friend_user_id'],'web',false,true);
$my_user_info=api_get_user_info($row['friend_user_id']);
$list_ids_friends[]=array('friend_user_id'=>$row['friend_user_id'],'firstName'=>$my_user_info['firstName'] , 'lastName'=>$my_user_info['lastName'], 'username'=>$my_user_info['username'], 'image'=>$path['file']);
$my_user_info = api_get_user_info($row['friend_user_id']);
$list_ids_friends[] = array('friend_user_id'=>$row['friend_user_id'],'firstName'=>$my_user_info['firstName'] , 'lastName'=>$my_user_info['lastName'], 'username'=>$my_user_info['username'], 'image'=>$path['file']);
} else {
$list_ids_friends[]=$row;
$list_ids_friends[] = $row;
}
}
return $list_ids_friends;
@ -790,7 +790,7 @@ class SocialManager extends UserManager {
$extra_params['cidReq'] = Security::remove_XSS($_GET['cidReq']);
$course_url = '&amp;cidReq='.Security::remove_XSS($_GET['cidReq']);
}
foreach ($user_list as $user) {
$uid = $user[0];
$user_info = api_get_user_info($uid);
@ -801,7 +801,7 @@ class SocialManager extends UserManager {
$url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$uid.$course_url;
} else {
$url = '?id='.$uid.$course_url;
}
}
} else {
$url = '#';
}
@ -826,7 +826,7 @@ class SocialManager extends UserManager {
if (api_get_setting('show_email_addresses') == 'true') {
$table_header[] = array(get_lang('Email'), true);
}
}
Display::display_sortable_table($table_header, $table_data, array(), array('per_page' => 25), $extra_params, array(),'grid');
}
}
@ -839,7 +839,7 @@ class SocialManager extends UserManager {
$safe_user_id = Database::escape_string($user_id);
// to prevent a hacking attempt: http://www.dokeos.com/forum/viewtopic.php?t=5363
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT * FROM $user_table WHERE user_id='".intval($safe_user_id)."'";
$result = Database::query($sql);
if (Database::num_rows($result) == 1) {
@ -853,7 +853,7 @@ class SocialManager extends UserManager {
echo $alt;
echo '</div><br />';
echo '<div>';
echo '<div style="margin:0 auto; width:350px; border:1px;">';
echo '<div id="whoisonline-user-image" style="float:left; padding:5px;">';
if (strlen(trim($user_object->picture_uri)) > 0) {
@ -881,17 +881,17 @@ class SocialManager extends UserManager {
}
echo '<div style="text-align:center;padding-top:5px;">'.$status.'</div>';
echo '</div>';
echo '<div id="whoisonline-user-info" style="float:left; padding-left:15px;">';
global $user_anonymous;
if (api_get_setting('allow_social_tool') == 'true' && api_get_user_id() <> $user_anonymous && api_get_user_id() <> 0) {
echo '<p><a href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$safe_user_id.'">'.Display :: return_icon('my_shared_profile.png', get_lang('SocialInvitationToFriends'),array('height'=>'18px')).get_lang('ViewSharedProfile').'</a></p>';
if (api_get_setting('allow_social_tool') == 'true' && api_get_user_id() <> $user_anonymous && api_get_user_id() <> 0) {
echo '<p><a href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$safe_user_id.'">'.Display :: return_icon('my_shared_profile.png', get_lang('SocialInvitationToFriends'),array('height'=>'18px')).get_lang('ViewSharedProfile').'</a></p>';
$user_anonymous = api_get_anonymous_id();
if ($safe_user_id != api_get_user_id() && !api_is_anonymous($safe_user_id)) {
$user_relation = SocialManager::get_relation_between_contacts(api_get_user_id(), $safe_user_id);
if ($user_relation == 0 || $user_relation == 6) {

@ -187,7 +187,7 @@ class TableSort {
$check_date = strtotime(strip_tags($row[$column]));
// strtotime Returns a timestamp on success, FALSE otherwise.
// Previous to PHP 5.1.0, this function would return -1 on failure.
$is_date &= ($check_date != -1 && $check_date != false);
$is_date &= ($check_date != -1 && $check_date);
} else {
$is_date &= false;
}

@ -13,7 +13,7 @@
* @package chamilo.course_progress
*/
class Thematic
{
{
private $session_id;
private $thematic_id;
private $thematic_title;
@ -21,7 +21,7 @@ class Thematic
private $thematic_plan_id;
private $thematic_plan_title;
private $thematic_plan_description;
private $thematic_plan_description_type;
private $thematic_plan_description_type;
private $thematic_advance_id;
private $attendance_id;
private $thematic_advance_content;
@ -29,24 +29,24 @@ class Thematic
private $duration;
public function __construct() {}
/**
* Get the total number of thematic inside current course and current session
* @see SortableTable#get_total_number_of_items()
*/
public function get_number_of_thematics() {
public function get_number_of_thematics() {
$tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
$sql = "SELECT COUNT(id) AS total_number_of_items FROM $tbl_thematic WHERE active = 1 $condition_session ";
$res = Database::query($sql);
$res = Database::query($sql);
$obj = Database::fetch_object($res);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
}
/**
* Get the thematics to display on the current page (fill the sortable-table)
* @param int offset of first user to recover
@ -68,7 +68,7 @@ class Thematic
$sql = "SELECT
id AS col0,
title AS col1,
display_order AS col2
display_order AS col2
FROM $tbl_thematic
WHERE active = 1 $condition_session
ORDER BY col2 LIMIT $from,$number_of_items ";
@ -80,34 +80,34 @@ class Thematic
$param_gradebook = '&gradebook='.$_SESSION['gradebook'];
}
while ($thematic = Database::fetch_row($res)) {
$thematic[1] = '<a href="index.php?'.api_get_cidreq().'&action=thematic_details&thematic_id='.$thematic[0].$param_gradebook.'">'.Security::remove_XSS($thematic[1], STUDENT).'</a>';
while ($thematic = Database::fetch_row($res)) {
$thematic[1] = '<a href="index.php?'.api_get_cidreq().'&action=thematic_details&thematic_id='.$thematic[0].$param_gradebook.'">'.Security::remove_XSS($thematic[1], STUDENT).'</a>';
if (api_is_allowed_to_edit(null, true)) {
$actions = '';
$actions = '';
$actions .= '<center><a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('info.gif',get_lang('ThematicPlan')).'</a>&nbsp;';
$actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('porcent.png',get_lang('ThematicAdvance')).'</a>&nbsp;';
if ($thematic[2] > 1) {
$actions .= '<a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('up.gif', get_lang('Up')).'</a>';
} else {
$actions .= Display::return_icon('up_na.gif','&nbsp;');
}
if ($thematic[2] < self::get_max_thematic_item()) {
$actions .= '<a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('down.gif',get_lang('Down')).'</a>';
} else {
$actions .= Display::return_icon('down_na.gif','&nbsp;');
}
$actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>&nbsp;';
$actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a></center>';
$thematics[] = array($thematic[0], $thematic[1], $actions);
}
}
}
return $thematics;
}
/**
* Get the maximum display order of the thematic item
* @return int Maximum display order
@ -123,7 +123,7 @@ class Thematic
$row = Database::fetch_array($rs);
return $row[0];
}
/**
* Move a thematic
*
@ -143,17 +143,17 @@ class Thematic
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
$sql = "SELECT id, display_order FROM $tbl_thematic WHERE active = 1 $condition_session ORDER BY display_order $sortorder";
$res = Database::query($sql);
$found = false;
//Variable definition
//Variable definition
$current_id = 0;
$next_id = 0;
while ($row = Database::fetch_array($res)) {
if ($found == true && empty($next_id)) {
if ($found && empty($next_id)) {
$next_id = intval($row['id']);
$next_display_order = intval($row['display_order']);
}
@ -167,7 +167,7 @@ class Thematic
// get last done thematic advance before move thematic list
$last_done_thematic_advance = $this->get_last_done_thematic_advance();
if (!empty($next_display_order) && !empty($current_id)) {
$sql = "UPDATE $tbl_thematic SET display_order = $next_display_order WHERE id = $current_id ";
Database::query($sql);
@ -176,27 +176,27 @@ class Thematic
$sql = "UPDATE $tbl_thematic SET display_order = $current_display_order WHERE id = $next_id ";
Database::query($sql);
}
// update done advances with de current thematic list
$update_done_advances = $this->update_done_thematic_advances($last_done_thematic_advance);
}
/**
* get thematic list
* @param int Thematic id (optional), get list by id
* @return array Thematic data
*/
*/
public function get_thematic_list($thematic_id = null, $course_code = null, $session_id = null) {
// set current course and session
if (isset($course_code)) {
$course_info = api_get_course_info($course_code);
$tbl_thematic = Database :: get_course_table(TABLE_THEMATIC, $course_info['dbName']);
} else {
$tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
$tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
}
if (isset($session_id)) {
$session_id = intval($session_id);
} else {
@ -204,11 +204,11 @@ class Thematic
}
$data = array();
$condition = '';
$condition = '';
if (isset($thematic_id)) {
$thematic_id = intval($thematic_id);
$condition = " WHERE id = $thematic_id ";
} else {
} else {
$condition_session = api_get_session_condition($session_id);
$condition = " WHERE active = 1 $condition_session ";
}
@ -216,46 +216,46 @@ class Thematic
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
if (!empty($thematic_id)) {
$data = Database::fetch_array($res);
$data = Database::fetch_array($res);
} else {
while ($row = Database::fetch_array($res)) {
$data[$row['id']] = $row;
$data[$row['id']] = $row;
}
}
}
return $data;
}
/**
* insert or update a thematic
* @return int last thematic id
*/
public function thematic_save() {
global $_course;
// definition database table
// definition database table
$tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
// protect data
$id = intval($this->thematic_id);
$title = Database::escape_string($this->thematic_title);
$content = Database::escape_string($this->thematic_content);
$session_id = intval($this->session_id);
$user_id = api_get_user_id();
// get the maximum display order of all the glossary items
$max_thematic_item = $this->get_max_thematic_item();
if (empty($id)) {
$max_thematic_item = $this->get_max_thematic_item();
if (empty($id)) {
// insert
$sql = "INSERT INTO $tbl_thematic(title, content, active, display_order, session_id) VALUES ('$title', '$content', 1, ".(intval($max_thematic_item)+1).", $session_id) ";
Database::query($sql);
$last_id = Database::insert_id();
$last_id = Database::insert_id();
if (Database::affected_rows()) {
// save inside item property table
$last_id = Database::insert_id();
api_item_property_update($_course, 'thematic', $last_id,"ThematicAdded", $user_id);
}
}
} else {
// update
$sql = "UPDATE $tbl_thematic SET title = '$title', content = '$content', session_id = $session_id WHERE id = $id ";
@ -265,10 +265,10 @@ class Thematic
// save inside item property table
api_item_property_update($_course, 'thematic', $last_id,"ThematicUpdated", $user_id);
}
}
return $last_id;
}
return $last_id;
}
/**
* Delete logically (set active field to 0) a thematic
* @param int|array One or many thematic ids
@ -302,24 +302,24 @@ class Thematic
api_item_property_update($_course, 'thematic', $thematic_id,"ThematicDeleted", $user_id);
}
}
return $affected_rows;
return $affected_rows;
}
/**
* Get the total number of thematic advance inside current course
* @see SortableTable#get_total_number_of_items()
*/
public function get_number_of_thematic_advances() {
global $thematic_id;
$tbl_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
$sql = "SELECT COUNT(id) AS total_number_of_items FROM $tbl_thematic_advance WHERE thematic_id = $thematic_id ";
public function get_number_of_thematic_advances() {
global $thematic_id;
$tbl_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
$sql = "SELECT COUNT(id) AS total_number_of_items FROM $tbl_thematic_advance WHERE thematic_id = $thematic_id ";
$res = Database::query($sql);
$res = Database::query($sql);
$obj = Database::fetch_object($res);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
}
/**
* Get the thematic advances to display on the current page (fill the sortable-table)
* @param int offset of first user to recover
@ -329,8 +329,8 @@ class Thematic
* @see SortableTable#get_table_data($from)
*/
public function get_thematic_advance_data($from, $number_of_items, $column, $direction) {
global $thematic_id;
$tbl_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
global $thematic_id;
$tbl_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
$thematic_data = self::get_thematic_list($thematic_id);
$column = intval($column);
$from = intval($from);
@ -342,98 +342,98 @@ class Thematic
id AS col0,
start_date AS col1,
duration AS col2,
content AS col3
content AS col3
FROM $tbl_thematic_advance
WHERE thematic_id = $thematic_id
ORDER BY col$column $direction LIMIT $from,$number_of_items ";
$res = Database::query($sql);
$data = array ();
$data = array ();
$i = 1;
while ($thematic_advance = Database::fetch_row($res)) {
while ($thematic_advance = Database::fetch_row($res)) {
$thematic_advance[1] = api_get_local_time($thematic_advance[1]);
$thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG);
if (api_is_allowed_to_edit(null, true)) {
$actions = '';
$actions = '';
$actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>&nbsp;';
$actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a></center>';
$data[] = array($i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions);
}
$i++;
$i++;
}
return $data;
}
/**
* get thematic advance data by tematic id
* @param int Thematic id
* @param string Course code (optional)
* @return array data
*/
public function get_thematic_advance_by_thematic_id($thematic_id, $course_code = null) {
*/
public function get_thematic_advance_by_thematic_id($thematic_id, $course_code = null) {
// set current course
if (isset($course_code)) {
$course_info = api_get_course_info($course_code);
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE, $course_info['dbName']);
} else {
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
}
$thematic_id = intval($thematic_id);
$data = array();
$data = array();
$sql = "SELECT * FROM $tbl_thematic_advance WHERE thematic_id = $thematic_id ";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_array($res)) {
$data[] = $row;
}
$data[] = $row;
}
}
return $data;
}
/**
* get thematic advance list
* @param int Thematic advance id (optional), get data by thematic advance list
* @param string Course code (optional)
* @return array data
*/
public function get_thematic_advance_list($thematic_advance_id = null, $course_code = null) {
public function get_thematic_advance_list($thematic_advance_id = null, $course_code = null) {
// set current course
if (isset($course_code)) {
$course_info = api_get_course_info($course_code);
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE, $course_info['dbName']);
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE, $course_info['dbName']);
} else {
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
}
$data = array();
$condition = '';
if (isset($thematic_advance_id)) {
$thematic_advance_id = intval($thematic_advance_id);
$condition = " WHERE id = $thematic_advance_id ";
$condition = " WHERE id = $thematic_advance_id ";
}
$sql = "SELECT * FROM $tbl_thematic_advance $condition ORDER BY start_date ";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
if (!empty($thematic_advance_id)) {
if (Database::num_rows($res) > 0) {
if (!empty($thematic_advance_id)) {
$data = Database::fetch_array($res);
} else {
// group all data group by thematic id
$tmp = array();
while ($row = Database::fetch_array($res)) {
while ($row = Database::fetch_array($res)) {
$tmp[] = $row['thematic_id'];
if (in_array($row['thematic_id'], $tmp)) {
$data[$row['thematic_id']][$row['id']] = $row;
}
}
}
}
}
return $data;
}
/**
* insert or update a thematic advance
* @return int last thematic advance id
@ -442,9 +442,9 @@ class Thematic
global $_course;
// definition database table
// definition database table
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
// protect data
$id = intval($this->thematic_advance_id);
$tematic_id = intval($this->thematic_id);
@ -454,7 +454,7 @@ class Thematic
$duration = intval($this->duration);
$user_id = api_get_user_id();
if (empty($id)) {
if (empty($id)) {
// insert
$sql = "INSERT INTO $tbl_thematic_advance (thematic_id, attendance_id, content, start_date, duration) VALUES ($tematic_id, $attendance_id, '$content', '".api_get_utc_datetime($start_date)."', $duration) ";
Database::query($sql);
@ -472,11 +472,11 @@ class Thematic
api_item_property_update($_course, 'thematic_advance', $last_id,"ThematicAdvanceUpdated", $user_id);
}
}
return $last_id;
}
/**
* delete thematic advance
* @param int Thematic advance id
@ -485,7 +485,7 @@ class Thematic
public function thematic_advance_destroy($thematic_advance_id) {
global $_course;
// definition database table
// definition database table
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
// protect data
@ -498,10 +498,10 @@ class Thematic
if ($affected_rows) {
api_item_property_update($_course, 'thematic_advance', $thematic_advance_id,"ThematicAdvanceDeleted", $user_id);
}
return $affected_rows;
}
/**
* get thematic plan data
* @param int Thematic id (optional), get data by thematic id
@ -509,8 +509,8 @@ class Thematic
* @return array Thematic plan data
*/
public function get_thematic_plan_data($thematic_id = null, $description_type = null) {
// definition database table
// definition database table
$tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN);
$data = array();
$condition = '';
@ -522,50 +522,50 @@ class Thematic
$description_type = intval($description_type);
$condition .= " AND description_type = $description_type ";
}
$sql = "SELECT * FROM $tbl_thematic_plan WHERE 1 $condition";
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if (!isset($thematic_id) && !isset($description_type)) {
if (Database::num_rows($rs) > 0) {
if (!isset($thematic_id) && !isset($description_type)) {
// group all data group by thematic id
$tmp = array();
while ($row = Database::fetch_array($rs)) {
while ($row = Database::fetch_array($rs)) {
$tmp[] = $row['thematic_id'];
if (in_array($row['thematic_id'], $tmp)) {
$data[$row['thematic_id']][$row['id']] = $row;
}
}
}
} else {
while ($row = Database::fetch_array($rs)) {
$data[] = $row;
}
}
}
}
}
return $data;
}
/**
* insert or update a thematic plan
* @return int affected rows
*/
public function thematic_plan_save() {
global $_course;
// definition database table
// definition database table
$tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN);
// protect data
$thematic_id = intval($this->thematic_id);
$title = Database::escape_string($this->thematic_plan_title);
$description = Database::escape_string($this->thematic_plan_description);
$description_type = intval($this->thematic_plan_description_type);
$user_id = api_get_user_id();
// check thematic plan type already exists
$sql = "SELECT id FROM $tbl_thematic_plan WHERE thematic_id = $thematic_id AND description_type = $description_type ";
$rs = Database::query($sql);
$affected_rows = 0;
if (Database::num_rows($rs) > 0) {
$row_thematic_plan = Database::fetch_array($rs);
@ -586,11 +586,11 @@ class Thematic
if ($affected_rows) {
api_item_property_update($_course, 'thematic_plan', $last_id,"ThematicPlanAdded", $user_id);
}
}
return $affected_rows;
}
return $affected_rows;
}
/**
* delete a thematic plan description
* @param int Thematic id
@ -598,15 +598,15 @@ class Thematic
* @return int Affected rows
*/
public function thematic_plan_destroy($thematic_id, $description_type) {
// definition database table
// definition database table
$tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN);
// protect data
$thematic_id = intval($thematic_id);
$thematic_id = intval($thematic_id);
$description_type = intval($description_type);
$user_id = api_get_user_id();
// get thematic plan id
$thematic_plan_data = $this->get_thematic_plan_data($thematic_id, $description_type);
$thematic_plan_id = $thematic_plan_data[0]['id'];
@ -615,45 +615,45 @@ class Thematic
$sql = "DELETE FROM $tbl_thematic_plan WHERE thematic_id = $thematic_id AND description_type = $description_type ";
Database::query($sql);
$affected_rows = Database::affected_rows();
if ($affected_rows) {
if ($affected_rows) {
api_item_property_update($_course, 'thematic_plan', $thematic_plan_id,"ThematicPlanDeleted", $user_id);
}
return $affected_rows;
}
/**
* Get next description type for a new thematic plan description (option 'others')
* @param int Thematic id
* @return int New Description type
* @return int New Description type
*/
public function get_next_description_type($thematic_id) {
// definition database table
// definition database table
$tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN);
// protect data
$thematic_id = intval($thematic_id);
$thematic_id = intval($thematic_id);
$description_type = intval($description_type);
$next_description_type = 0;
$sql = "SELECT MAX(description_type) as max FROM $tbl_thematic_plan WHERE thematic_id = $thematic_id AND description_type >= ".ADD_THEMATIC_PLAN." ";
$rs = Database::query($sql);
$row = Database::fetch_array($rs);
$last_description_type = $row['max'];
if (isset($last_description_type)) {
$row = Database::fetch_array($rs);
$next_description_type = $last_description_type + 1;
} else {
$next_description_type = ADD_THEMATIC_PLAN;
}
return $next_description_type;
}
/**
* update done thematic advances from thematic details interface
* @param int Thematic id
@ -667,14 +667,14 @@ class Thematic
$affected_rows = 0;
$user_id = api_get_user_id();
$a_thematic_advance_ids = array();
if (!empty($thematic_data)) {
foreach ($thematic_data as $thematic) {
foreach ($thematic_data as $thematic) {
$thematic_id = $thematic['id'];
if (!empty($thematic_advance_data[$thematic['id']])) {
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
$a_thematic_advance_ids[] = $thematic_advance['id'];
if (!empty($thematic_advance_data[$thematic['id']])) {
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
$a_thematic_advance_ids[] = $thematic_advance['id'];
// update done thematic for previous advances ((done_advance = 1))
$upd = "UPDATE $tbl_thematic_advance set done_advance = 1 WHERE id = ".$thematic_advance['id']." ";
Database::query($upd);
@ -684,13 +684,13 @@ class Thematic
}
if ($thematic_advance['id'] == $thematic_advance_id) {
break 2;
}
}
}
}
}
}
}
}
// Update done thematic for others advances (done_advance = 0)
// Update done thematic for others advances (done_advance = 0)
if (!empty($a_thematic_advance_ids) && count($a_thematic_advance_ids) > 0) {
$upd = "UPDATE $tbl_thematic_advance set done_advance = 0 WHERE id NOT IN(".implode(',',$a_thematic_advance_ids).") ";
Database::query($upd);
@ -700,46 +700,46 @@ class Thematic
$rs_thematic_done = Database::query("SELECT ref FROM $tbl_item_property WHERE tool='thematic_advance' AND lastedit_type='ThematicAdvanceDone'");
if (Database::num_rows($rs_thematic_done) > 0) {
while ($row_thematic_done = Database::fetch_array($rs_thematic_done)) {
$ref = $row_thematic_done['ref'];
$ref = $row_thematic_done['ref'];
if (in_array($ref, $a_thematic_advance_ids)) { continue; }
// update items
Database::query("UPDATE $tbl_item_property SET lastedit_date='".date('Y-m-d H:i:s', time())."', lastedit_type='ThematicAdvanceUpdated', lastedit_user_id = $user_id WHERE tool='thematic_advance' AND ref=$ref");
}
}
}
}
return $affected_rows;
}
/**
* Get last done thematic advance from thematic details interface
* @return int Last done thematic advance id
*/
public function get_last_done_thematic_advance() {
$thematic_data = $this->get_thematic_list();
$thematic_advance_data = $this->get_thematic_advance_list();
$thematic_advance_data = $this->get_thematic_advance_list();
$a_thematic_advance_ids = array();
$last_done_advance_id = 0;
if (!empty($thematic_data)) {
foreach ($thematic_data as $thematic) {
foreach ($thematic_data as $thematic) {
$thematic_id = $thematic['id'];
if (!empty($thematic_advance_data[$thematic['id']])) {
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
if (!empty($thematic_advance_data[$thematic['id']])) {
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
if ($thematic_advance['done_advance'] == 1) {
$a_thematic_advance_ids[] = $thematic_advance['id'];
}
}
}
}
}
}
}
}
if (!empty($a_thematic_advance_ids)) {
$last_done_advance_id = array_pop($a_thematic_advance_ids);
$last_done_advance_id = intval($last_done_advance_id);
}
return $last_done_advance_id;
return $last_done_advance_id;
}
/**
@ -747,21 +747,21 @@ class Thematic
* @return int next thematic advance not done
*/
public function get_next_thematic_advance_not_done() {
$thematic_data = $this->get_thematic_list();
$thematic_advance_data = $this->get_thematic_advance_list();
$thematic_advance_data = $this->get_thematic_advance_list();
$a_thematic_advance_ids = array();
$next_advance_not_done = 0;
if (!empty($thematic_data)) {
foreach ($thematic_data as $thematic) {
foreach ($thematic_data as $thematic) {
$thematic_id = $thematic['id'];
if (!empty($thematic_advance_data[$thematic['id']])) {
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
if (!empty($thematic_advance_data[$thematic['id']])) {
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
if ($thematic_advance['done_advance'] == 0) {
$a_thematic_advance_ids[] = $thematic_advance['id'];
}
}
}
}
}
}
}
}
@ -769,10 +769,10 @@ class Thematic
$next_advance_not_done = array_shift($a_thematic_advance_ids);
$next_advance_not_done = intval($next_advance_not_done);
}
return $next_advance_not_done;
return $next_advance_not_done;
}
/**
* Get total average of thematic advances
* @param string Course code (optional)
@ -780,15 +780,15 @@ class Thematic
* @return float Average of thematic advances
*/
public function get_total_average_of_thematic_advances($course_code = null, $session_id = null) {
$thematic_data = $this->get_thematic_list(null, $course_code, $session_id);
$thematic_advance_data = $this->get_thematic_advance_list(null, $course_code);
$thematic_advance_data = $this->get_thematic_advance_list(null, $course_code);
$a_average_of_advances_by_thematic = array();
$total_average = 0;
if (!empty($thematic_data)) {
foreach ($thematic_data as $thematic) {
$thematic_id = $thematic['id'];
$a_average_of_advances_by_thematic[$thematic_id] = $this->get_average_of_advances_by_thematic($thematic_id, $course_code);
foreach ($thematic_data as $thematic) {
$thematic_id = $thematic['id'];
$a_average_of_advances_by_thematic[$thematic_id] = $this->get_average_of_advances_by_thematic($thematic_id, $course_code);
}
}
@ -796,44 +796,44 @@ class Thematic
if (!empty($a_average_of_advances_by_thematic)) {
$count_tematics = count($thematic_data);
$score = array_sum($a_average_of_advances_by_thematic);
$total_average = round(($score*100)/($count_tematics*100));
$total_average = round(($score*100)/($count_tematics*100));
}
return $total_average;
}
/**
* Get average of advances by thematic
* Get average of advances by thematic
* @param int Thematic id
* @param string Course code (optional)
* @return float Average of thematic advances
*/
public function get_average_of_advances_by_thematic($thematic_id, $course_code = null) {
$thematic_advance_data = $this->get_thematic_advance_by_thematic_id($thematic_id, $course_code);
$average = 0;
$thematic_advance_data = $this->get_thematic_advance_by_thematic_id($thematic_id, $course_code);
$average = 0;
if (!empty($thematic_advance_data)) {
// get all done advances by thematic
$advances = array();
$count_done_advances = 0;
$average = 0;
foreach ($thematic_advance_data as $thematic_advance) {
$average = 0;
foreach ($thematic_advance_data as $thematic_advance) {
if ($thematic_advance['done_advance'] == 1) {
$count_done_advances++;
}
}
$advances[] = $thematic_advance['done_advance'];
}
// calculate average by thematic
$count_total_advances = count($advances);
$average = round(($count_done_advances*100)/$count_total_advances);
}
// calculate average by thematic
$count_total_advances = count($advances);
$average = round(($count_done_advances*100)/$count_total_advances);
}
return $average;
}
/**
* set attributes for fields of thematic table
* @param int Thematic id
@ -842,17 +842,17 @@ class Thematic
* @param int Session id
* @return void
*/
public function set_thematic_attributes($id = null, $title = '', $content = '', $session_id = 0) {
public function set_thematic_attributes($id = null, $title = '', $content = '', $session_id = 0) {
$this->thematic_id = $id;
$this->thematic_title = $title;
$this->thematic_content = $content;
$this->session_id = $session_id;
$this->session_id = $session_id;
}
/**
* set attributes for fields of thematic_plan table
* set attributes for fields of thematic_plan table
* @param int Thematic id
* @param string Thematic plan title
* @param string Thematic plan title
* @param string Thematic plan description
* @param int Thematic plan description type
* @return void
@ -861,13 +861,13 @@ class Thematic
$this->thematic_id = $thematic_id;
$this->thematic_plan_title = $title;
$this->thematic_plan_description = $description;
$this->thematic_plan_description_type = $description_type;
$this->thematic_plan_description_type = $description_type;
}
/**
* set attributes for fields of thematic_advance table
* set attributes for fields of thematic_advance table
* @param int Thematic advance id
* @param int Thematic id
* @param int Thematic id
* @param int Attendance id
* @param string Content
* @param string Date and time
@ -880,9 +880,9 @@ class Thematic
$this->attendance_id = $attendance_id;
$this->thematic_advance_content = $content;
$this->start_date = $start_date;
$this->duration = $duration;
$this->duration = $duration;
}
/**
* set thematic id
* @param int Thematic id
@ -891,15 +891,15 @@ class Thematic
public function set_thematic_id($thematic_id) {
$this->thematic_id = $thematic_id;
}
/**
* get thematic id
* @return void
*/
public function get_thematic_id() {
return $this->thematic_id;
return $this->thematic_id;
}
/**
* Get thematic plan titles by default
* @return array
@ -911,7 +911,7 @@ class Thematic
$default_thematic_plan_titles[3]= get_lang('Infrastructure');
$default_thematic_plan_titles[4]= get_lang('Methodology');
$default_thematic_plan_titles[5]= get_lang('AditionalNotes');
$default_thematic_plan_titles[6]= get_lang('Others');
$default_thematic_plan_titles[6]= get_lang('Others');
return $default_thematic_plan_titles;
}
@ -923,8 +923,8 @@ class Thematic
$default_thematic_plan_icon = array();
$default_thematic_plan_icon[1]= 'spire.gif';
$default_thematic_plan_icon[2]= 'korganizer.gif';
$default_thematic_plan_icon[3]= 'kcmdf_big.gif';
$default_thematic_plan_icon[4]= 'misc.gif';
$default_thematic_plan_icon[3]= 'kcmdf_big.gif';
$default_thematic_plan_icon[4]= 'misc.gif';
$default_thematic_plan_icon[5]= 'ktip.gif';
$default_thematic_plan_icon[6]= 'new_test.gif';
return $default_thematic_plan_icon;
@ -940,10 +940,10 @@ class Thematic
$question[2]= get_lang('SkillToAcquireQuestions');
$question[3]= get_lang('InfrastructureQuestions');
$question[4]= get_lang('MethodologyQuestions');
$question[5]= get_lang('AditionalNotesQuestions');
$question[5]= get_lang('AditionalNotesQuestions');
return $question;
}
/**
* buid a string datetime from array
* @param array array containing data e.g: $array('Y'=>'2010', 'F' => '02', 'd' => '10', 'H' => '12', 'i' => '30')

@ -197,7 +197,7 @@ class Tracking {
$rs = Database::query($sql);
if (Database::num_rows($rs)>0) {
if ($first_login_date = Database::result($rs, 0, 0)) {
if ($convert_date == true) {
if ($convert_date) {
return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
} else {
return $first_login_date;
@ -237,13 +237,13 @@ class Tracking {
//If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds
if ($currentTimestamp - $timestamp > 604800) {
if ($convert_date == true) {
if ($convert_date) {
return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . (api_is_allowed_to_edit()?' <a href="'.api_get_path(REL_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'" title="'.get_lang('RemindInactiveUser').'"><img align="middle" src="'.api_get_path(WEB_IMG_PATH).'messagebox_warning.gif" /></a>':'').'</span>';
} else {
return $last_login_date;
}
} else {
if ($convert_date == true) {
if ($convert_date) {
return api_format_date($last_login_date, DATE_FORMAT_SHORT);
} else {
return $last_login_date;
@ -493,7 +493,7 @@ class Tracking {
}
// average progress = total sum divided by the number of views
// summed up.
if ($return_array == false) {
if (!$return_array) {
$avg_progress = round($sum / $number_items, 1);
return $avg_progress;
} else {
@ -733,7 +733,7 @@ class Tracking {
//var_dump($lp_with_quiz);
if ($lp_with_quiz != 0 ) {
if ($return_array == false) {
if (!$return_array) {
$score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2);
return $score_of_scorm_calculate;
} else {

@ -428,7 +428,7 @@ class UserManager
$sql = "SELECT user_id FROM $t_uf uf INNER JOIN $t_ufv ufv ON ufv.field_id=uf.id WHERE field_variable='$original_user_id_name' AND field_value='$original_user_id_value';";
$res = Database::query($sql);
$row = Database::fetch_object($res);
if ($row != false) {
if ($row) {
return $row->user_id;
} else {
return 0;
@ -1052,7 +1052,7 @@ class UserManager
break;
}
}
if ($check == false) {
if (!$check) {
return false; //option value not found
}
} else {
@ -1133,7 +1133,7 @@ class UserManager
$sort_direction = strtoupper($direction);
}
$sqlf = "SELECT * FROM $t_uf ";
if ($all_visibility == false) {
if (!$all_visibility) {
$sqlf .= " WHERE field_visible = 1 ";
}
$sqlf .= " ORDER BY ".$columns[$column]." $sort_direction " ;
@ -1205,7 +1205,7 @@ class UserManager
public static function get_number_of_extra_fields($all_visibility = true) {
$t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD);
$sqlf = "SELECT * FROM $t_uf ";
if ($all_visibility == false) {
if (!$all_visibility) {
$sqlf .= " WHERE field_visible = 1 ";
}
$sqlf .= " ORDER BY field_order";
@ -1444,7 +1444,7 @@ class UserManager
$sql = "SELECT f.id as id, f.field_variable as fvar, f.field_type as type FROM $t_uf f ";
$filter_cond = '';
if ($all_visibility == false) {
if (!$all_visibility) {
if (isset($field_filter)) {
$field_filter = intval($field_filter);
$filter_cond .= " AND field_filter = $field_filter ";
@ -1528,7 +1528,7 @@ class UserManager
$sql .= " WHERE f.field_variable = '$field_variable' ";
if ($all_visibility == false) {
if (!$all_visibility) {
$sql .= " AND f.field_visible = 1 ";
}
@ -1658,7 +1658,7 @@ class UserManager
ON (user_field.id = user_field_values.field_id)
WHERE $where";
if ($all_visibility == true) {
if ($all_visibility) {
$sql .= " AND user_field.field_visible = 1 ";
} else {
$sql .= " AND user_field.field_visible = 0 ";
@ -2991,7 +2991,7 @@ class UserManager
$tbl_my_message = Database :: get_main_table(TABLE_MAIN_MESSAGE);
$friend_id = intval($friend_id);
if ($real_removed == true) {
if ($real_removed) {
//Delete user friend
/*
$sql_delete_relationship1 = 'UPDATE ' . $tbl_my_friend .' SET relation_type='.USER_RELATION_TYPE_DELETED.' WHERE friend_user_id='.$friend_id;

@ -677,7 +677,7 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) {
} // end else
//Now check for anonymous user mode
if (isset($use_anonymous) && $use_anonymous == true) {
if ($use_anonymous) {
//if anonymous mode is set, then try to set the current user as anonymous
//if he doesn't have a login yet
api_set_anonymous();
@ -691,7 +691,7 @@ if (isset($use_anonymous) && $use_anonymous == true) {
if (!empty($cDir)) {
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
$c = CourseManager::get_course_id_from_path($cDir);
if ($c != false) { $cidReq = $c; }
if ($c) { $cidReq = $c; }
}
// if the requested course is different from the course in session

Loading…
Cancel
Save