Julio Montoya 14 years ago
parent
commit
f3c7bbd3a6

+ 17 - 17
main/admin/class_add.php

@@ -2,25 +2,25 @@
 // $Id: class_add.php 10215 2006-11-27 13:57:17Z pcool $
 /*
 ==============================================================================
-	Dokeos - elearning and course management software
+    Dokeos - elearning and course management software
 
-	Copyright (c) 2004 Dokeos S.A.
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) Olivier Brouckaert
-	Copyright (c) Bart Mollet, Hogeschool Gent
+    Copyright (c) 2004 Dokeos S.A.
+    Copyright (c) 2003 Ghent University (UGent)
+    Copyright (c) 2001 Universite catholique de Louvain (UCL)
+    Copyright (c) Olivier Brouckaert
+    Copyright (c) Bart Mollet, Hogeschool Gent
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+    For a full list of contributors, see "credits.txt".
+    The full license can be read in "license.txt".
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
 
-	See the GNU General Public License for more details.
+    See the GNU General Public License for more details.
 
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
+    Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
 ==============================================================================
 */
 /**
@@ -56,9 +56,9 @@ $form = new FormValidator('add_class');
 $form->add_textfield('name', get_lang('ClassName'));
 $form->addElement('style_submit_button', 'submit', get_lang('Ok'), 'class="add"');
 if ($form->validate()) {
-	$values = $form->exportValues();
-	ClassManager::create_class($values['name']);
-	header('Location: class_list.php');
+    $values = $form->exportValues();
+    ClassManager::create_class($values['name']);
+    header('Location: class_list.php');
 }
 
 // Displaying the header.

+ 16 - 16
main/admin/class_edit.php

@@ -3,24 +3,24 @@
 
 /*
 ==============================================================================
-	Dokeos - elearning and course management software
+    Dokeos - elearning and course management software
 
-	Copyright (c) 2004 Dokeos S.A.
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) Olivier Brouckaert
+    Copyright (c) 2004 Dokeos S.A.
+    Copyright (c) 2003 Ghent University (UGent)
+    Copyright (c) 2001 Universite catholique de Louvain (UCL)
+    Copyright (c) Olivier Brouckaert
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+    For a full list of contributors, see "credits.txt".
+    The full license can be read in "license.txt".
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
 
-	See the GNU General Public License for more details.
+    See the GNU General Public License for more details.
 
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
+    Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
 ==============================================================================
 */
 /**
@@ -62,9 +62,9 @@ $form->addElement('style_submit_button', 'submit', get_lang('Ok'), 'class="add"'
 $form->setDefaults(array('name'=>$class['name']));
 if($form->validate())
 {
-	$values = $form->exportValues();
-	ClassManager :: set_name($values['name'], $class_id);
-	header('Location: class_list.php');
+    $values = $form->exportValues();
+    ClassManager :: set_name($values['name'], $class_id);
+    header('Location: class_list.php');
 }
 
 Display :: display_header($tool_name);

+ 55 - 55
main/admin/class_import.php

@@ -2,25 +2,25 @@
 // $Id: class_import.php 10215 2006-11-27 13:57:17Z pcool $
 /*
 ==============================================================================
-	Dokeos - elearning and course management software
+    Dokeos - elearning and course management software
 
-	Copyright (c) 2004 Dokeos S.A.
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) Olivier Brouckaert
-	Copyright (c) Bart Mollet, Hogeschool Gent
+    Copyright (c) 2004 Dokeos S.A.
+    Copyright (c) 2003 Ghent University (UGent)
+    Copyright (c) 2001 Universite catholique de Louvain (UCL)
+    Copyright (c) Olivier Brouckaert
+    Copyright (c) Bart Mollet, Hogeschool Gent
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+    For a full list of contributors, see "credits.txt".
+    The full license can be read in "license.txt".
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
 
-	See the GNU General Public License for more details.
+    See the GNU General Public License for more details.
 
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
+    Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
 ==============================================================================
 */
 /**
@@ -35,37 +35,37 @@
  * Validates imported data.
  */
 function validate_data($classes) {
-	$errors = array();
-	foreach ($classes as $index => $class) {
-		// 1. Check wheter ClassName is available.
-		if (!isset($class['ClassName']) || strlen(trim($class['ClassName'])) == 0) {
-			$class['line'] = $index + 2;
-			$class['error'] = get_lang('MissingClassName');
-			$errors[] = $class;
-		}
-		// 2. Check whether class doesn't exist yet.
-		else {
-			if (ClassManager::class_name_exists($class['ClassName'])) {
-				$class['line'] = $index + 2;
-				$class['error'] = get_lang('ClassNameExists').' <strong>'.$class['ClassName'].'</strong>';
-				$errors[] = $class;
-			}
-		}
-	}
-	return $errors;
+    $errors = array();
+    foreach ($classes as $index => $class) {
+        // 1. Check wheter ClassName is available.
+        if (!isset($class['ClassName']) || strlen(trim($class['ClassName'])) == 0) {
+            $class['line'] = $index + 2;
+            $class['error'] = get_lang('MissingClassName');
+            $errors[] = $class;
+        }
+        // 2. Check whether class doesn't exist yet.
+        else {
+            if (ClassManager::class_name_exists($class['ClassName'])) {
+                $class['line'] = $index + 2;
+                $class['error'] = get_lang('ClassNameExists').' <strong>'.$class['ClassName'].'</strong>';
+                $errors[] = $class;
+            }
+        }
+    }
+    return $errors;
 }
 
 /**
  * Save imported class data to database
  */
 function save_data($classes) {
-	$number_of_added_classes = 0;
-	foreach ($classes as $index => $class) {
-		if (ClassManager::create_class($class['ClassName'])) {
-			$number_of_added_classes++;
-		}
-	}
-	return $number_of_added_classes;
+    $number_of_added_classes = 0;
+    foreach ($classes as $index => $class) {
+        if (ClassManager::create_class($class['ClassName'])) {
+            $number_of_added_classes++;
+        }
+    }
+    return $number_of_added_classes;
 }
 
 // Language files that should be included.
@@ -106,22 +106,22 @@ $form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
 $form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
 
 if ($form->validate()) {
-	$classes = Import::csv_to_array($_FILES['import_file']['tmp_name']);
-	$errors = validate_data($classes);
-	if (count($errors) == 0) {
-		$number_of_added_classes = save_data($classes);
-		Display::display_normal_message($number_of_added_classes.' '.get_lang('ClassesCreated'));
-	} else {
-		$error_message = get_lang('ErrorsWhenImportingFile');
-		$error_message .= '<ul>';
-		foreach ($errors as $index => $error_class) {
-			$error_message .= '<li>'.$error_class['error'].' ('.get_lang('Line').' '.$error_class['line'].')';
-			$error_message .= '</li>';
-		}
-		$error_message .= '</ul>';
-		$error_message .= get_lang('NoClassesHaveBeenCreated');
-		Display :: display_error_message($error_message);
-	}
+    $classes = Import::csv_to_array($_FILES['import_file']['tmp_name']);
+    $errors = validate_data($classes);
+    if (count($errors) == 0) {
+        $number_of_added_classes = save_data($classes);
+        Display::display_normal_message($number_of_added_classes.' '.get_lang('ClassesCreated'));
+    } else {
+        $error_message = get_lang('ErrorsWhenImportingFile');
+        $error_message .= '<ul>';
+        foreach ($errors as $index => $error_class) {
+            $error_message .= '<li>'.$error_class['error'].' ('.get_lang('Line').' '.$error_class['line'].')';
+            $error_message .= '</li>';
+        }
+        $error_message .= '</ul>';
+        $error_message .= get_lang('NoClassesHaveBeenCreated');
+        Display :: display_error_message($error_message);
+    }
 }
 
 $form->display();

+ 62 - 62
main/admin/class_information.php

@@ -1,24 +1,24 @@
 <?php // $Id: class_information.php 16954 2008-11-26 14:41:35Z pcool $
 /*
 ==============================================================================
-	Dokeos - elearning and course management software
+    Dokeos - elearning and course management software
 
-	Copyright (c) 2004 Dokeos S.A.
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) Olivier Brouckaert
+    Copyright (c) 2004 Dokeos S.A.
+    Copyright (c) 2003 Ghent University (UGent)
+    Copyright (c) 2001 Universite catholique de Louvain (UCL)
+    Copyright (c) Olivier Brouckaert
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+    For a full list of contributors, see "credits.txt".
+    The full license can be read in "license.txt".
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
 
-	See the GNU General Public License for more details.
+    See the GNU General Public License for more details.
 
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
+    Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
 ==============================================================================
 */
 /**
@@ -41,7 +41,7 @@ api_protect_admin_script();
 require api_get_path(LIBRARY_PATH).'classmanager.lib.php';
 
 if (!isset($_GET['id'])) {
-	api_not_allowed();
+    api_not_allowed();
 }
 
 $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
@@ -61,37 +61,37 @@ echo '<h4>'.get_lang('Users').'</h4>';
 echo '<blockquote>';
 $users = ClassManager::get_users($class_id);
 if (count($users) > 0) {
-	$is_western_name_order = api_is_western_name_order();
-	$table_header[] = array (get_lang('OfficialCode'), true);
-	if ($is_western_name_order) {
-		$table_header[] = array (get_lang('FirstName'), true);
-		$table_header[] = array (get_lang('LastName'), true);
-	} else {
-		$table_header[] = array (get_lang('LastName'), true);
-		$table_header[] = array (get_lang('FirstName'), true);
-	}
-	$table_header[] = array (get_lang('Email'), true);
-	$table_header[] = array (get_lang('Status'), true);
-	$table_header[] = array ('', false);
-	$data = array();
-	foreach($users as $index => $user) {
-		$row = array ();
-		$row[] = $user['official_code'];
-		if ($is_western_name_order) {
-			$row[] = $user['firstname'];
-			$row[] = $user['lastname'];
-		} else {
-			$row[] = $user['lastname'];
-			$row[] = $user['firstname'];
-		}
-		$row[] = Display :: encrypted_mailto_link($user['email'], $user['email']);
-		$row[] = $user['status'] == 5 ? get_lang('Student') : get_lang('Teacher');
-		$row[] = '<a href="user_information.php?user_id='.$user['user_id'].'">'.Display::return_icon('synthese_view.gif').'</a>';
-		$data[] = $row;
-	}
-	Display::display_sortable_table($table_header,$data,array(),array(),array('id'=>$_GET['id']));
+    $is_western_name_order = api_is_western_name_order();
+    $table_header[] = array (get_lang('OfficialCode'), true);
+    if ($is_western_name_order) {
+        $table_header[] = array (get_lang('FirstName'), true);
+        $table_header[] = array (get_lang('LastName'), true);
+    } else {
+        $table_header[] = array (get_lang('LastName'), true);
+        $table_header[] = array (get_lang('FirstName'), true);
+    }
+    $table_header[] = array (get_lang('Email'), true);
+    $table_header[] = array (get_lang('Status'), true);
+    $table_header[] = array ('', false);
+    $data = array();
+    foreach($users as $index => $user) {
+        $row = array ();
+        $row[] = $user['official_code'];
+        if ($is_western_name_order) {
+            $row[] = $user['firstname'];
+            $row[] = $user['lastname'];
+        } else {
+            $row[] = $user['lastname'];
+            $row[] = $user['firstname'];
+        }
+        $row[] = Display :: encrypted_mailto_link($user['email'], $user['email']);
+        $row[] = $user['status'] == 5 ? get_lang('Student') : get_lang('Teacher');
+        $row[] = '<a href="user_information.php?user_id='.$user['user_id'].'">'.Display::return_icon('synthese_view.gif').'</a>';
+        $data[] = $row;
+    }
+    Display::display_sortable_table($table_header,$data,array(),array(),array('id'=>$_GET['id']));
 } else {
-	echo get_lang('NoUsersInClass');
+    echo get_lang('NoUsersInClass');
 }
 echo '</blockquote>';
 
@@ -100,25 +100,25 @@ echo '</blockquote>';
  */
 $courses = ClassManager::get_courses($class_id);
 if (count($courses) > 0) {
-	$header[] = array (get_lang('Code'), true);
-	$header[] = array (get_lang('Title'), true);
-	$header[] = array ('', false);
-	$data = array ();
-	foreach( $courses as $index => $course) {
-		$row = array ();
-		$row[] = $course['visual_code'];
-		$row[] = $course['title'];
-		$row[] = '<a href="course_information.php?code='.$course['code'].'">'.Display::return_icon('info_small.gif', get_lang('Delete')).'</a>'.
-					'<a href="'.api_get_path(WEB_COURSE_PATH).$course['directory'].'">'.Display::return_icon('course_home.gif', get_lang('CourseHome')).'</a>' .
-					'<a href="course_edit.php?course_code='.$course['code'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
-		$data[] = $row;
-	}
-	echo '<p><b>'.get_lang('Courses').'</b></p>';
-	echo '<blockquote>';
-	Display :: display_sortable_table($header, $data, array (), array (), array('id'=>$_GET['id']));
-	echo '</blockquote>';
+    $header[] = array (get_lang('Code'), true);
+    $header[] = array (get_lang('Title'), true);
+    $header[] = array ('', false);
+    $data = array ();
+    foreach( $courses as $index => $course) {
+        $row = array ();
+        $row[] = $course['visual_code'];
+        $row[] = $course['title'];
+        $row[] = '<a href="course_information.php?code='.$course['code'].'">'.Display::return_icon('info_small.gif', get_lang('Delete')).'</a>'.
+                    '<a href="'.api_get_path(WEB_COURSE_PATH).$course['directory'].'">'.Display::return_icon('course_home.gif', get_lang('CourseHome')).'</a>' .
+                    '<a href="course_edit.php?course_code='.$course['code'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
+        $data[] = $row;
+    }
+    echo '<p><b>'.get_lang('Courses').'</b></p>';
+    echo '<blockquote>';
+    Display :: display_sortable_table($header, $data, array (), array (), array('id'=>$_GET['id']));
+    echo '</blockquote>';
 } else {
-	echo '<p>'.get_lang('NoCoursesForThisClass').'</p>';
+    echo '<p>'.get_lang('NoCoursesForThisClass').'</p>';
 }
 
 // Displaying the footer.

+ 68 - 68
main/admin/class_list.php

@@ -2,24 +2,24 @@
 // $Id: class_list.php 20441 2009-05-10 07:39:15Z ivantcholakov $
 /*
 ==============================================================================
-	Dokeos - elearning and course management software
+    Dokeos - elearning and course management software
 
-	Copyright (c) 2004 Dokeos S.A.
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) Olivier Brouckaert
+    Copyright (c) 2004 Dokeos S.A.
+    Copyright (c) 2003 Ghent University (UGent)
+    Copyright (c) 2001 Universite catholique de Louvain (UCL)
+    Copyright (c) Olivier Brouckaert
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+    For a full list of contributors, see "credits.txt".
+    The full license can be read in "license.txt".
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
 
-	See the GNU General Public License for more details.
+    See the GNU General Public License for more details.
 
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
+    Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
 ==============================================================================
 */
 /**
@@ -41,14 +41,14 @@ api_protect_admin_script();
  * Gets the total number of classes.
  */
 function get_number_of_classes() {
-	$tbl_class = Database :: get_main_table(TABLE_MAIN_CLASS);
-	$sql = "SELECT COUNT(*) AS number_of_classes FROM $tbl_class";
-	if (isset ($_GET['keyword'])) {
-		$sql .= " WHERE (name LIKE '%".Database::escape_string(trim($_GET['keyword']))."%')";
-	}
-	$res = Database::query($sql);
-	$obj = Database::fetch_object($res);
-	return $obj->number_of_classes;
+    $tbl_class = Database :: get_main_table(TABLE_MAIN_CLASS);
+    $sql = "SELECT COUNT(*) AS number_of_classes FROM $tbl_class";
+    if (isset ($_GET['keyword'])) {
+        $sql .= " WHERE (name LIKE '%".Database::escape_string(trim($_GET['keyword']))."%')";
+    }
+    $res = Database::query($sql);
+    $obj = Database::fetch_object($res);
+    return $obj->number_of_classes;
 }
 
 /**
@@ -58,38 +58,38 @@ function get_number_of_classes() {
  * @param string $direction
  */
 function get_class_data($from, $number_of_items, $column, $direction) {
-	$tbl_class_user = Database::get_main_table(TABLE_MAIN_CLASS_USER);
-	$tbl_class = Database :: get_main_table(TABLE_MAIN_CLASS);
-	$from 				= Database::escape_string($from);
-	$number_of_items 	= Database::escape_string($number_of_items);
-	$column 			= Database::escape_string($column);
-	$direction 			= Database::escape_string($direction);
-
-	$sql = "SELECT 	id AS col0, name AS col1, COUNT(user_id) AS col2, id AS col3
-		FROM $tbl_class
-			LEFT JOIN $tbl_class_user ON id=class_id ";
-	if (isset ($_GET['keyword'])) {
-		$sql .= " WHERE (name LIKE '%".Database::escape_string(trim($_GET['keyword']))."%')";
-	}
-	$sql .= " GROUP BY id,name ORDER BY col$column $direction LIMIT $from,$number_of_items";
-	$res = Database::query($sql);
-	$classes = array ();
-	while ($class = Database::fetch_row($res)) {
-		$classes[] = $class;
-	}
-	return $classes;
+    $tbl_class_user = Database::get_main_table(TABLE_MAIN_CLASS_USER);
+    $tbl_class = Database :: get_main_table(TABLE_MAIN_CLASS);
+    $from 				= Database::escape_string($from);
+    $number_of_items 	= Database::escape_string($number_of_items);
+    $column 			= Database::escape_string($column);
+    $direction 			= Database::escape_string($direction);
+
+    $sql = "SELECT 	id AS col0, name AS col1, COUNT(user_id) AS col2, id AS col3
+        FROM $tbl_class
+            LEFT JOIN $tbl_class_user ON id=class_id ";
+    if (isset ($_GET['keyword'])) {
+        $sql .= " WHERE (name LIKE '%".Database::escape_string(trim($_GET['keyword']))."%')";
+    }
+    $sql .= " GROUP BY id,name ORDER BY col$column $direction LIMIT $from,$number_of_items";
+    $res = Database::query($sql);
+    $classes = array ();
+    while ($class = Database::fetch_row($res)) {
+        $classes[] = $class;
+    }
+    return $classes;
 }
 
 /**
  * Filter for sortable table to display edit icons for class
  */
 function modify_filter($class_id) {
-	$class_id = Security::remove_XSS($class_id);
-	$result = '<a href="class_information.php?id='.$class_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>';
-	$result .= '<a href="class_edit.php?idclass='.$class_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
-	$result .= '<a href="class_list.php?action=delete_class&amp;class_id='.$class_id.'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
-	$result .= '<a href="subscribe_user2class.php?idclass='.$class_id.'">'.Display::return_icon('add_multiple_users.gif', get_lang('AddUsersToAClass')).'</a>';
-	return $result;
+    $class_id = Security::remove_XSS($class_id);
+    $result = '<a href="class_information.php?id='.$class_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>';
+    $result .= '<a href="class_edit.php?idclass='.$class_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
+    $result .= '<a href="class_list.php?action=delete_class&amp;class_id='.$class_id.'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
+    $result .= '<a href="subscribe_user2class.php?idclass='.$class_id.'">'.Display::return_icon('add_multiple_users.gif', get_lang('AddUsersToAClass')).'</a>';
+    return $result;
 }
 
 require api_get_path(LIBRARY_PATH).'fileManage.lib.php';
@@ -103,30 +103,30 @@ Display :: display_header($tool_name);
 //api_display_tool_title($tool_name);
 
 if (isset($_POST['action'])) {
-	switch ($_POST['action']) {
-		// Delete selected classes
-		case 'delete_classes' :
-			$classes = $_POST['class'];
-			if (count($classes) > 0) {
-				foreach ($classes as $index => $class_id) {
-					ClassManager :: delete_class($class_id);
-				}
-				Display :: display_normal_message(get_lang('ClassesDeleted'));
-			}
-			break;
-	}
+    switch ($_POST['action']) {
+        // Delete selected classes
+        case 'delete_classes' :
+            $classes = $_POST['class'];
+            if (count($classes) > 0) {
+                foreach ($classes as $index => $class_id) {
+                    ClassManager :: delete_class($class_id);
+                }
+                Display :: display_normal_message(get_lang('ClassesDeleted'));
+            }
+            break;
+    }
 }
 
 if (isset($_GET['action'])) {
-	switch ($_GET['action']) {
-		case 'delete_class':
-			ClassManager :: delete_class($_GET['class_id']);
-			Display :: display_normal_message(get_lang('ClassDeleted'));
-			break;
-		case 'show_message':
-			Display :: display_normal_message(Security::remove_XSS(stripslashes($_GET['message'])));
-			break;
-	}
+    switch ($_GET['action']) {
+        case 'delete_class':
+            ClassManager :: delete_class($_GET['class_id']);
+            Display :: display_normal_message(get_lang('ClassDeleted'));
+            break;
+        case 'show_message':
+            Display :: display_normal_message(Security::remove_XSS(stripslashes($_GET['message'])));
+            break;
+    }
 }
 
 // Create a search-box

+ 116 - 116
main/admin/class_user_import.php

@@ -3,21 +3,21 @@
 // $Id: class_user_import.php 9018 2006-06-28 15:11:16Z evie_em $
 /*
 ==============================================================================
-	Dokeos - elearning and course management software
+    Dokeos - elearning and course management software
 
-	Copyright (c) 2005 Bart Mollet <bart.mollet@hogent.be>
+    Copyright (c) 2005 Bart Mollet <bart.mollet@hogent.be>
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+    For a full list of contributors, see "credits.txt".
+    The full license can be read in "license.txt".
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
 
-	See the GNU General Public License for more details.
+    See the GNU General Public License for more details.
 
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
+    Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
 ==============================================================================
 */
 /**
@@ -32,51 +32,51 @@
  * Validates imported data.
  */
 function validate_data($user_classes) {
-	global $purification_option_for_usernames;
-	$errors = array ();
-	$classcodes = array ();
-	foreach ($user_classes as $index => $user_class) {
-		$user_class['line'] = $index + 1;
-		// 1. Check whether mandatory fields are set.
-		$mandatory_fields = array ('UserName', 'ClassName');
-		foreach ($mandatory_fields as $key => $field) {
-			if (!isset ($user_class[$field]) || strlen($user_class[$field]) == 0) {
-				$user_class['error'] = get_lang($field.'Mandatory');
-				$errors[] = $user_class;
-			}
-		}
-		// 2. Check whether classcode exists.
-		if (isset ($user_class['ClassName']) && strlen($user_class['ClassName']) != 0) {
-			// 2.1 Check whether code has been allready used in this CVS-file.
-			if (!isset ($classcodes[$user_class['ClassName']])) {
-				// 2.1.1 Check whether code exists in DB.
-				$class_table = Database :: get_main_table(TABLE_MAIN_CLASS);
-				$sql = "SELECT * FROM $class_table WHERE name = '".Database::escape_string($user_class['ClassName'])."'";
-				$res = Database::query($sql);
-				if (Database::num_rows($res) == 0) {
-					$user_class['error'] = get_lang('CodeDoesNotExists');
-					$errors[] = $user_class;
-				} else {
-					$classcodes[$user_class['CourseCode']] = 1;
-				}
-			}
-		}
-		// 3. Check username, first, check whether it is empty.
-		if (!UserManager::is_username_empty($user_class['UserName'])) {
-			// 3.1. Check whether username is too long.
-			if (UserManager::is_username_too_long($user_class['UserName'])) {
-				$user_class['error'] = get_lang('UserNameTooLong').': '.$user_class['UserName'];
-				$errors[] = $user_class;
-			}
-			$username = UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames);
-			// 3.2. Check whether username exists.
-			if (UserManager::is_username_available($username)) {
-				$user_class['error'] = get_lang('UnknownUser').': '.$username;
-				$errors[] = $user_class;
-			}
-		}
-	}
-	return $errors;
+    global $purification_option_for_usernames;
+    $errors = array ();
+    $classcodes = array ();
+    foreach ($user_classes as $index => $user_class) {
+        $user_class['line'] = $index + 1;
+        // 1. Check whether mandatory fields are set.
+        $mandatory_fields = array ('UserName', 'ClassName');
+        foreach ($mandatory_fields as $key => $field) {
+            if (!isset ($user_class[$field]) || strlen($user_class[$field]) == 0) {
+                $user_class['error'] = get_lang($field.'Mandatory');
+                $errors[] = $user_class;
+            }
+        }
+        // 2. Check whether classcode exists.
+        if (isset ($user_class['ClassName']) && strlen($user_class['ClassName']) != 0) {
+            // 2.1 Check whether code has been allready used in this CVS-file.
+            if (!isset ($classcodes[$user_class['ClassName']])) {
+                // 2.1.1 Check whether code exists in DB.
+                $class_table = Database :: get_main_table(TABLE_MAIN_CLASS);
+                $sql = "SELECT * FROM $class_table WHERE name = '".Database::escape_string($user_class['ClassName'])."'";
+                $res = Database::query($sql);
+                if (Database::num_rows($res) == 0) {
+                    $user_class['error'] = get_lang('CodeDoesNotExists');
+                    $errors[] = $user_class;
+                } else {
+                    $classcodes[$user_class['CourseCode']] = 1;
+                }
+            }
+        }
+        // 3. Check username, first, check whether it is empty.
+        if (!UserManager::is_username_empty($user_class['UserName'])) {
+            // 3.1. Check whether username is too long.
+            if (UserManager::is_username_too_long($user_class['UserName'])) {
+                $user_class['error'] = get_lang('UserNameTooLong').': '.$user_class['UserName'];
+                $errors[] = $user_class;
+            }
+            $username = UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames);
+            // 3.2. Check whether username exists.
+            if (UserManager::is_username_available($username)) {
+                $user_class['error'] = get_lang('UnknownUser').': '.$username;
+                $errors[] = $user_class;
+            }
+        }
+    }
+    return $errors;
 }
 
 /**
@@ -84,50 +84,50 @@ function validate_data($user_classes) {
  */
 function save_data($users_classes) {
 
-	global $purification_option_for_usernames;
-
-	// Table definitions.
-	$user_table 		= Database :: get_main_table(TABLE_MAIN_USER);
-	$class_user_table 	= Database :: get_main_table(TABLE_MAIN_CLASS_USER);
-	$class_table 		= Database :: get_main_table(TABLE_MAIN_CLASS);
-
-	// Data parsing: purification + conversion (UserName, ClassName) --> (user_is, class_id)
-	$csv_data = array ();
-	foreach ($users_classes as $index => $user_class) {
-		$sql1 = "SELECT user_id FROM $user_table WHERE username = '".Database::escape_string(UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames))."'";
-		$res1 = Database::query($sql1);
-		$obj1 = Database::fetch_object($res1);
-		$sql2 = "SELECT id FROM $class_table WHERE name = '".Database::escape_string(trim($user_class['ClassName']))."'";
-		$res2 = Database::query($sql2);
-		$obj2 = Database::fetch_object($res2);
-		if ($obj1 && $obj2) {
-			$csv_data[$obj1->user_id][$obj2->id] = 1;
-		}
-	}
-
-	// Logic for processing the request (data + UI options).
-	$db_subscriptions = array();
-	foreach ($csv_data as $user_id => $csv_subscriptions) {
-		$sql = "SELECT class_id FROM $class_user_table cu WHERE cu.user_id = $user_id";
-		$res = Database::query($sql);
-		while ($obj = Database::fetch_object($res)) {
-			$db_subscriptions[$obj->class_id] = 1;
-		}
-		$to_subscribe = array_diff(array_keys($csv_subscriptions), array_keys($db_subscriptions));
-		$to_unsubscribe = array_diff(array_keys($db_subscriptions), array_keys($csv_subscriptions));
-		// Subscriptions for new classes.
-		if ($_POST['subscribe']) {
-			foreach ($to_subscribe as $class_id) {
-				ClassManager::add_user($user_id, $class_id);
-			}
-		}
-		// Unsubscription from previous classes.
-		if ($_POST['unsubscribe']) {
-			foreach ($to_unsubscribe as $class_id) {
-				ClassManager::unsubscribe_user($user_id, $class_id);
-			}
-		}
-	}
+    global $purification_option_for_usernames;
+
+    // Table definitions.
+    $user_table 		= Database :: get_main_table(TABLE_MAIN_USER);
+    $class_user_table 	= Database :: get_main_table(TABLE_MAIN_CLASS_USER);
+    $class_table 		= Database :: get_main_table(TABLE_MAIN_CLASS);
+
+    // Data parsing: purification + conversion (UserName, ClassName) --> (user_is, class_id)
+    $csv_data = array ();
+    foreach ($users_classes as $index => $user_class) {
+        $sql1 = "SELECT user_id FROM $user_table WHERE username = '".Database::escape_string(UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames))."'";
+        $res1 = Database::query($sql1);
+        $obj1 = Database::fetch_object($res1);
+        $sql2 = "SELECT id FROM $class_table WHERE name = '".Database::escape_string(trim($user_class['ClassName']))."'";
+        $res2 = Database::query($sql2);
+        $obj2 = Database::fetch_object($res2);
+        if ($obj1 && $obj2) {
+            $csv_data[$obj1->user_id][$obj2->id] = 1;
+        }
+    }
+
+    // Logic for processing the request (data + UI options).
+    $db_subscriptions = array();
+    foreach ($csv_data as $user_id => $csv_subscriptions) {
+        $sql = "SELECT class_id FROM $class_user_table cu WHERE cu.user_id = $user_id";
+        $res = Database::query($sql);
+        while ($obj = Database::fetch_object($res)) {
+            $db_subscriptions[$obj->class_id] = 1;
+        }
+        $to_subscribe = array_diff(array_keys($csv_subscriptions), array_keys($db_subscriptions));
+        $to_unsubscribe = array_diff(array_keys($db_subscriptions), array_keys($csv_subscriptions));
+        // Subscriptions for new classes.
+        if ($_POST['subscribe']) {
+            foreach ($to_subscribe as $class_id) {
+                ClassManager::add_user($user_id, $class_id);
+            }
+        }
+        // Unsubscription from previous classes.
+        if ($_POST['unsubscribe']) {
+            foreach ($to_unsubscribe as $class_id) {
+                ClassManager::unsubscribe_user($user_id, $class_id);
+            }
+        }
+    }
 }
 
 /**
@@ -136,8 +136,8 @@ function save_data($users_classes) {
  * @return array All course-information read from the file
  */
 function parse_csv_data($file) {
-	$courses = Import::csv_to_array($file);
-	return $courses;
+    $courses = Import::csv_to_array($file);
+    return $courses;
 }
 
 $language_file = array('admin', 'registration');
@@ -170,26 +170,26 @@ $form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('Subscri
 $form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
 $form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
 if ($form->validate()) {
-	$users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
-	$errors = validate_data($users_classes);
-	if (count($errors) == 0) {
-		save_data($users_classes);
-		header('Location: class_list.php?action=show_message&message='.urlencode(get_lang('FileImported')));
-		exit();
-	}
+    $users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
+    $errors = validate_data($users_classes);
+    if (count($errors) == 0) {
+        save_data($users_classes);
+        header('Location: class_list.php?action=show_message&message='.urlencode(get_lang('FileImported')));
+        exit();
+    }
 }
 
 Display :: display_header($tool_name);
 api_display_tool_title($tool_name);
 
 if (count($errors) != 0) {
-	$error_message = "\n";
-	foreach ($errors as $index => $error_class_user) {
-		$error_message .= get_lang('Line').' '.$error_class_user['line'].': '.$error_class_user['error'].'</b>: ';
-		$error_message .= "\n";
-	}
-	$error_message .= "\n";
-	Display :: display_error_message($error_message);
+    $error_message = "\n";
+    foreach ($errors as $index => $error_class_user) {
+        $error_message .= get_lang('Line').' '.$error_class_user['line'].': '.$error_class_user['error'].'</b>: ';
+        $error_message .= "\n";
+    }
+    $error_message .= "\n";
+    Display :: display_error_message($error_message);
 }
 
 $form->display();
@@ -206,7 +206,7 @@ adam;class01
 
 /*
 ==============================================================================
-		FOOTER
+        FOOTER
 ==============================================================================
 */
 Display :: display_footer();

+ 52 - 52
main/admin/subscribe_class2course.php

@@ -3,24 +3,24 @@
 // $Id: subscribe_class2course.php 20441 2009-05-10 07:39:15Z ivantcholakov $
 /*
 ==============================================================================
-	Dokeos - elearning and course management software
+    Dokeos - elearning and course management software
 
-	Copyright (c) 2004 Dokeos S.A.
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) Olivier Brouckaert
+    Copyright (c) 2004 Dokeos S.A.
+    Copyright (c) 2003 Ghent University (UGent)
+    Copyright (c) 2001 Universite catholique de Louvain (UCL)
+    Copyright (c) Olivier Brouckaert
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+    For a full list of contributors, see "credits.txt".
+    The full license can be read in "license.txt".
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
 
-	See the GNU General Public License for more details.
+    See the GNU General Public License for more details.
 
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
+    Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
 ==============================================================================
 */
 /**
@@ -61,41 +61,41 @@ Display :: display_header($tool_name);
 
 if ($_POST['formSent'])
 {
-	$form_sent = $_POST['formSent'];
-	$classes = is_array($_POST['ClassList']) ? $_POST['ClassList'] : array();
-	$courses = is_array($_POST['CourseList']) ? $_POST['CourseList'] : array();
-	$first_letter_class = $_POST['firstLetterClass'];
-	$first_letter_course = $_POST['firstLetterCourse'];
-
-	if ($form_sent == 1)
-	{
-		if (count($classes) == 0 || count($courses) == 0)
-		{
-			Display::display_error_message(get_lang('AtLeastOneClassAndOneCourse'));
-		}
-		elseif (api_substr($_POST['formSubmit'], -2) == '>>') // add classes to courses
-		{
-			foreach ($courses as $course_code)
-			{
-				foreach ($classes as $class_id)
-				{
-					ClassManager :: subscribe_to_course($class_id, $course_code);
-				}
-			}
-			Display::display_normal_message(get_lang('ClassesSubscribed'));
-		}
-		else // remove classes from courses
-			{
-			foreach ($courses as $course_code)
-			{
-				foreach ($classes as $class_id)
-				{
-					ClassManager :: unsubscribe_from_course($class_id, $course_code);
-				}
-			}
-			Display::display_normal_message(get_lang('ClassesUnsubscribed'));
-		}
-	}
+    $form_sent = $_POST['formSent'];
+    $classes = is_array($_POST['ClassList']) ? $_POST['ClassList'] : array();
+    $courses = is_array($_POST['CourseList']) ? $_POST['CourseList'] : array();
+    $first_letter_class = $_POST['firstLetterClass'];
+    $first_letter_course = $_POST['firstLetterCourse'];
+
+    if ($form_sent == 1)
+    {
+        if (count($classes) == 0 || count($courses) == 0)
+        {
+            Display::display_error_message(get_lang('AtLeastOneClassAndOneCourse'));
+        }
+        elseif (api_substr($_POST['formSubmit'], -2) == '>>') // add classes to courses
+        {
+            foreach ($courses as $course_code)
+            {
+                foreach ($classes as $class_id)
+                {
+                    ClassManager :: subscribe_to_course($class_id, $course_code);
+                }
+            }
+            Display::display_normal_message(get_lang('ClassesSubscribed'));
+        }
+        else // remove classes from courses
+            {
+            foreach ($courses as $course_code)
+            {
+                foreach ($classes as $class_id)
+                {
+                    ClassManager :: unsubscribe_from_course($class_id, $course_code);
+                }
+            }
+            Display::display_normal_message(get_lang('ClassesUnsubscribed'));
+        }
+    }
 }
 
 $sql = "SELECT id,name FROM $tbl_class WHERE name LIKE '".$first_letter_class."%' ORDER BY ". (count($classes) > 0 ? "(id IN('".implode("','", $classes)."')) DESC," : "")." name";
@@ -106,7 +106,7 @@ $result = Database::query($sql);
 $db_courses = Database::store_result($result);
 if (!empty ($error_message))
 {
-	Display :: display_normal_message($error_message);
+    Display :: display_normal_message($error_message);
 }
 ?>
 <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;">
@@ -144,7 +144,7 @@ if (!empty ($error_message))
 foreach ($db_classes as $class)
 {
 ?>
-	<option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option>
+    <option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option>
 <?php
 }
 ?>
@@ -161,7 +161,7 @@ foreach ($db_classes as $class)
 foreach ($db_courses as $course)
 {
 ?>
-	<option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option>
+    <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option>
 <?php
 }
 ?>
@@ -173,7 +173,7 @@ foreach ($db_courses as $course)
 <?php
 /*
 ==============================================================================
-		FOOTER
+        FOOTER
 ==============================================================================
 */
 Display :: display_footer();

+ 60 - 60
main/admin/subscribe_user2class.php

@@ -2,24 +2,24 @@
 // $Id: subscribe_user2class.php 12269 2007-05-03 14:17:37Z elixir_julian $
 /*
 ==============================================================================
-	Dokeos - elearning and course management software
+    Dokeos - elearning and course management software
 
-	Copyright (c) 2004 Dokeos S.A.
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) Olivier Brouckaert
+    Copyright (c) 2004 Dokeos S.A.
+    Copyright (c) 2003 Ghent University (UGent)
+    Copyright (c) 2001 Universite catholique de Louvain (UCL)
+    Copyright (c) Olivier Brouckaert
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+    For a full list of contributors, see "credits.txt".
+    The full license can be read in "license.txt".
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
 
-	See the GNU General Public License for more details.
+    See the GNU General Public License for more details.
 
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
+    Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
 ==============================================================================
 */
 /**
@@ -57,8 +57,8 @@ $result = Database::query($sql);
 
 if (!list ($class_name) = Database::fetch_row($result))
 {
-	header('Location: class_list.php?filtreCours='.urlencode($course));
-	exit ();
+    header('Location: class_list.php?filtreCours='.urlencode($course));
+    exit ();
 }
 
 $noPHP_SELF = true;
@@ -70,46 +70,46 @@ $interbreadcrumb[] = array ("url" => "class_list.php?filtreCours=".urlencode($co
 
 if ($_POST['formSent'])
 {
-	$form_sent = $_POST['formSent'];
-	$first_letter_left = $_POST['firstLetterLeft'];
-	$first_letter_right = $_POST['firstLetterRight'];
-	$left_user_list = is_array($_POST['LeftUserList']) ? $_POST['LeftUserList'] : array();
-	$right_user_list = is_array($_POST['RightUserList']) ? $_POST['RightUserList'] : array();
-	$add_to_class = empty ($_POST['addToClass']) ? 0 : 1;
-	$remove_from_class = empty ($_POST['removeFromClass']) ? 0 : 1;
-	if ($form_sent == 1)
-	{
-		if ($add_to_class)
-		{
-			if (count($left_user_list) == 0)
-			{
-				$error_message = get_lang('AtLeastOneUser');
-			}
-			else
-			{
-				foreach ($left_user_list as $user_id)
-				{
-					ClassManager :: add_user($user_id, $class_id);
-				}
-				header('Location: class_list.php?filtreCours='.urlencode($course));
-				exit ();
-			}
-		}
-		elseif ($remove_from_class)
-		{
-			if (count($right_user_list) == 0)
-				$error_message = get_lang('AtLeastOneUser');
-			else
-			{
-				foreach ($right_user_list as $index => $user_id)
-				{
-					ClassManager :: unsubscribe_user($user_id, $class_id);
-				}
-				header('Location: class_list.php?filtreCours='.urlencode($course));
-				exit ();
-			}
-		}
-	}
+    $form_sent = $_POST['formSent'];
+    $first_letter_left = $_POST['firstLetterLeft'];
+    $first_letter_right = $_POST['firstLetterRight'];
+    $left_user_list = is_array($_POST['LeftUserList']) ? $_POST['LeftUserList'] : array();
+    $right_user_list = is_array($_POST['RightUserList']) ? $_POST['RightUserList'] : array();
+    $add_to_class = empty ($_POST['addToClass']) ? 0 : 1;
+    $remove_from_class = empty ($_POST['removeFromClass']) ? 0 : 1;
+    if ($form_sent == 1)
+    {
+        if ($add_to_class)
+        {
+            if (count($left_user_list) == 0)
+            {
+                $error_message = get_lang('AtLeastOneUser');
+            }
+            else
+            {
+                foreach ($left_user_list as $user_id)
+                {
+                    ClassManager :: add_user($user_id, $class_id);
+                }
+                header('Location: class_list.php?filtreCours='.urlencode($course));
+                exit ();
+            }
+        }
+        elseif ($remove_from_class)
+        {
+            if (count($right_user_list) == 0)
+                $error_message = get_lang('AtLeastOneUser');
+            else
+            {
+                foreach ($right_user_list as $index => $user_id)
+                {
+                    ClassManager :: unsubscribe_user($user_id, $class_id);
+                }
+                header('Location: class_list.php?filtreCours='.urlencode($course));
+                exit ();
+            }
+        }
+    }
 }
 Display :: display_header($tool_name);
 //api_display_tool_title($tool_name);
@@ -122,7 +122,7 @@ $result = Database::query($sql);
 $right_users = Database::store_result($result);
 if (!empty ($error_message))
 {
-	Display :: display_normal_message($error_message);
+    Display :: display_normal_message($error_message);
 }
 ?>
 <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?course=<?php echo urlencode($course); ?>&amp;idclass=<?php echo $class_id; ?>" style="margin:0px;">
@@ -167,9 +167,9 @@ foreach ($left_users as $user)
     </select>
    </td>
    <td width="20%" valign="middle" align="center">
-	<input type="submit" name="addToClass" value="<?php echo get_lang('AddToClass'); ?> &gt;&gt;"/>
-	<br/><br/>
-	<input type="submit" name="removeFromClass" value="&lt;&lt; <?php echo get_lang('RemoveFromClass'); ?>"/>
+    <input type="submit" name="addToClass" value="<?php echo get_lang('AddToClass'); ?> &gt;&gt;"/>
+    <br/><br/>
+    <input type="submit" name="removeFromClass" value="&lt;&lt; <?php echo get_lang('RemoveFromClass'); ?>"/>
    </td>
    <td width="40%" align="center">
     <select name="RightUserList[]" multiple="multiple" size="20" style="width:230px;">
@@ -189,7 +189,7 @@ foreach ($right_users as $user)
 <?php
 /*
 ==============================================================================
-		FOOTER
+        FOOTER
 ==============================================================================
 */
 Display :: display_footer();

+ 158 - 158
main/admin/subscribe_user2course.php

@@ -2,25 +2,25 @@
 // $Id: subscribe_user2course.php 19597 2009-04-07 14:38:36Z pcool $
 /*
 ==============================================================================
-	Dokeos - elearning and course management software
+    Dokeos - elearning and course management software
 
-	Copyright (c) 2004-2009 Dokeos SPRL
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) Olivier Brouckaert
+    Copyright (c) 2004-2009 Dokeos SPRL
+    Copyright (c) 2003 Ghent University (UGent)
+    Copyright (c) 2001 Universite catholique de Louvain (UCL)
+    Copyright (c) Olivier Brouckaert
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+    For a full list of contributors, see "credits.txt".
+    The full license can be read in "license.txt".
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
 
-	See the GNU General Public License for more details.
+    See the GNU General Public License for more details.
 
-	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
-	Mail: info@dokeos.com
+    Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
+    Mail: info@dokeos.com
 ==============================================================================
 */
 /**
@@ -37,7 +37,7 @@
 
 /*
 ==============================================================================
-		INIT SECTION
+        INIT SECTION
 ==============================================================================
 */
 // name of the language file that needs to be included
@@ -58,7 +58,7 @@ api_protect_admin_script();
 
 /*
 -----------------------------------------------------------
-	Global constants and variables
+    Global constants and variables
 -----------------------------------------------------------
 */
 
@@ -74,7 +74,7 @@ $tbl_user 	= Database :: get_main_table(TABLE_MAIN_USER);
 
 /*
 -----------------------------------------------------------
-	Header
+    Header
 -----------------------------------------------------------
 */
 $tool_name = get_lang('AddUsersToACourse');
@@ -86,8 +86,8 @@ $htmlHeadXtra[] = '
 
 function validate_filter() {
 
-		document.formulaire.form_sent.value=0;
-		document.formulaire.submit();
+        document.formulaire.form_sent.value=0;
+        document.formulaire.submit();
 
 }
 
@@ -107,7 +107,7 @@ $form->display();
 
 /*
 ==============================================================================
-		MAIN CODE
+        MAIN CODE
 ==============================================================================
 */
 
@@ -116,126 +116,126 @@ $form->display();
 $extra_field_list= UserManager::get_extra_fields();
 $new_field_list = array();
 if (is_array($extra_field_list)) {
-	foreach ($extra_field_list as $extra_field) {
-		//if is enabled to filter and is a "<select>" field type
-		if ($extra_field[8]==1 && $extra_field[2]==4 ) {
-			$new_field_list[] = array('name'=> $extra_field[3], 'variable'=>$extra_field[1], 'data'=> $extra_field[9]);
-		}
-	}
+    foreach ($extra_field_list as $extra_field) {
+        //if is enabled to filter and is a "<select>" field type
+        if ($extra_field[8]==1 && $extra_field[2]==4 ) {
+            $new_field_list[] = array('name'=> $extra_field[3], 'variable'=>$extra_field[1], 'data'=> $extra_field[9]);
+        }
+    }
 }
 
 
 /*
 -----------------------------------------------------------
-	React on POSTed request
+    React on POSTed request
 -----------------------------------------------------------
 */
 if ($_POST['form_sent']) {
-	$form_sent = $_POST['form_sent'];
-	$users = is_array($_POST['UserList']) ? $_POST['UserList'] : array() ;
-	$courses = is_array($_POST['CourseList']) ? $_POST['CourseList'] : array() ;
-	$first_letter_user = $_POST['firstLetterUser'];
-	$first_letter_course = $_POST['firstLetterCourse'];
-
-	foreach ($users as $key => $value) {
-		$users[$key] = intval($value);
-	}
-
-	if ($form_sent == 1) {
-		if ( count($users) == 0 || count($courses) == 0) {
-			Display :: display_error_message(get_lang('AtLeastOneUserAndOneCourse'));
-		} else {
-			foreach ($courses as $course_code) {
-				foreach ($users as $user_id) {
-					CourseManager::subscribe_user($user_id,$course_code);
-				}
-			}
-			Display :: display_confirmation_message(get_lang('UsersAreSubscibedToCourse'));
-		}
-	}
+    $form_sent = $_POST['form_sent'];
+    $users = is_array($_POST['UserList']) ? $_POST['UserList'] : array() ;
+    $courses = is_array($_POST['CourseList']) ? $_POST['CourseList'] : array() ;
+    $first_letter_user = $_POST['firstLetterUser'];
+    $first_letter_course = $_POST['firstLetterCourse'];
+
+    foreach ($users as $key => $value) {
+        $users[$key] = intval($value);
+    }
+
+    if ($form_sent == 1) {
+        if ( count($users) == 0 || count($courses) == 0) {
+            Display :: display_error_message(get_lang('AtLeastOneUserAndOneCourse'));
+        } else {
+            foreach ($courses as $course_code) {
+                foreach ($users as $user_id) {
+                    CourseManager::subscribe_user($user_id,$course_code);
+                }
+            }
+            Display :: display_confirmation_message(get_lang('UsersAreSubscibedToCourse'));
+        }
+    }
 }
 
 /*
 -----------------------------------------------------------
-	Display GUI
+    Display GUI
 -----------------------------------------------------------
 */
 if(empty($first_letter_user)) {
-	$sql = "SELECT count(*) as nb_users FROM $tbl_user";
-	$result = Database::query($sql);
-	$num_row = Database::fetch_array($result);
-	if($num_row['nb_users']>1000)
-	{//if there are too much users to gracefully handle with the HTML select list,
-	 // assign a default filter on users names
-		$first_letter_user = 'A';
-	}
-	unset($result);
+    $sql = "SELECT count(*) as nb_users FROM $tbl_user";
+    $result = Database::query($sql);
+    $num_row = Database::fetch_array($result);
+    if($num_row['nb_users']>1000)
+    {//if there are too much users to gracefully handle with the HTML select list,
+     // assign a default filter on users names
+        $first_letter_user = 'A';
+    }
+    unset($result);
 }
 
 //Filter by Extra Fields
 $use_extra_fields = false;
 if (is_array($extra_field_list)) {
-	if (is_array($new_field_list) && count($new_field_list)>0 ) {
-		$result_list=array();
-		foreach ($new_field_list as $new_field) {
-			$varname = 'field_'.$new_field['variable'];
-			if (Usermanager::is_extra_field_available($new_field['variable'])) {
-				if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
-					$use_extra_fields = true;
-					$extra_field_result[]= Usermanager::get_extra_user_data_by_value($new_field['variable'], $_POST[$varname]);
-				}
-			}
-		}
-	}
+    if (is_array($new_field_list) && count($new_field_list)>0 ) {
+        $result_list=array();
+        foreach ($new_field_list as $new_field) {
+            $varname = 'field_'.$new_field['variable'];
+            if (Usermanager::is_extra_field_available($new_field['variable'])) {
+                if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
+                    $use_extra_fields = true;
+                    $extra_field_result[]= Usermanager::get_extra_user_data_by_value($new_field['variable'], $_POST[$varname]);
+                }
+            }
+        }
+    }
 }
 
 if ($use_extra_fields) {
-	$final_result = array();
-	if (count($extra_field_result)>1) {
-		for($i=0;$i<count($extra_field_result)-1;$i++) {
-			if (is_array($extra_field_result[$i+1])) {
-				$final_result  = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]);
-			}
-		}
-	} else {
-		$final_result = $extra_field_result[0];
-	}
-
-	$where_filter ='';
-	if ($_configuration['multiple_access_urls']) {
-		if (is_array($final_result) && count($final_result)>0) {
-			$where_filter = " AND u.user_id IN  ('".implode("','",$final_result)."') ";
-		} else {
-			//no results
-			$where_filter = " AND u.user_id  = -1";
-		}
-	} else {
-		if (is_array($final_result) && count($final_result)>0) {
-			$where_filter = " AND user_id IN  ('".implode("','",$final_result)."') ";
-		} else {
-			//no results
-			$where_filter = " AND user_id  = -1";
-		}
-	}
+    $final_result = array();
+    if (count($extra_field_result)>1) {
+        for($i=0;$i<count($extra_field_result)-1;$i++) {
+            if (is_array($extra_field_result[$i+1])) {
+                $final_result  = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]);
+            }
+        }
+    } else {
+        $final_result = $extra_field_result[0];
+    }
+
+    $where_filter ='';
+    if ($_configuration['multiple_access_urls']) {
+        if (is_array($final_result) && count($final_result)>0) {
+            $where_filter = " AND u.user_id IN  ('".implode("','",$final_result)."') ";
+        } else {
+            //no results
+            $where_filter = " AND u.user_id  = -1";
+        }
+    } else {
+        if (is_array($final_result) && count($final_result)>0) {
+            $where_filter = " AND user_id IN  ('".implode("','",$final_result)."') ";
+        } else {
+            //no results
+            $where_filter = " AND user_id  = -1";
+        }
+    }
 }
 
 $target_name = api_sort_by_first_name() ? 'firstname' : 'lastname';
 $sql = "SELECT user_id,lastname,firstname,username
-		FROM $tbl_user
-		WHERE user_id<>2 AND ".$target_name." LIKE '".$first_letter_user."%' $where_filter
-		ORDER BY ". (count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$target_name;
+        FROM $tbl_user
+        WHERE user_id<>2 AND ".$target_name." LIKE '".$first_letter_user."%' $where_filter
+        ORDER BY ". (count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$target_name;
 
 global $_configuration;
 if ($_configuration['multiple_access_urls']) {
-	$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-	$access_url_id = api_get_current_access_url_id();
-	if ($access_url_id != -1){
-		$sql = "SELECT u.user_id,lastname,firstname,username  FROM ".$tbl_user ." u
-		INNER JOIN $tbl_user_rel_access_url user_rel_url
-		ON (user_rel_url.user_id = u.user_id)
-		WHERE u.user_id<>2 AND access_url_id =  $access_url_id AND (".$target_name." LIKE '".$first_letter_user."%' ) $where_filter
-		ORDER BY ". (count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$target_name;
-	}
+    $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+    $access_url_id = api_get_current_access_url_id();
+    if ($access_url_id != -1){
+        $sql = "SELECT u.user_id,lastname,firstname,username  FROM ".$tbl_user ." u
+        INNER JOIN $tbl_user_rel_access_url user_rel_url
+        ON (user_rel_url.user_id = u.user_id)
+        WHERE u.user_id<>2 AND access_url_id =  $access_url_id AND (".$target_name." LIKE '".$first_letter_user."%' ) $where_filter
+        ORDER BY ". (count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$target_name;
+    }
 }
 
 $result = Database::query($sql);
@@ -245,15 +245,15 @@ unset($result);
 $sql = "SELECT code,visual_code,title FROM $tbl_course WHERE visual_code LIKE '".$first_letter_course."%' ORDER BY ". (count($courses) > 0 ? "(code IN('".implode("','", $courses)."')) DESC," : "")." visual_code";
 
 if ($_configuration['multiple_access_urls']) {
-	$tbl_course_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
-	$access_url_id = api_get_current_access_url_id();
-	if ($access_url_id != -1){
-		$sql = "SELECT code, visual_code, title
-				FROM $tbl_course as course
-		  		INNER JOIN $tbl_course_rel_access_url course_rel_url
-				ON (course_rel_url.course_code= course.code)
-		  		WHERE access_url_id =  $access_url_id  AND (visual_code LIKE '".$first_letter_course."%' ) ORDER BY ". (count($courses) > 0 ? "(code IN('".implode("','", $courses)."')) DESC," : "")." visual_code";
-	}
+    $tbl_course_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
+    $access_url_id = api_get_current_access_url_id();
+    if ($access_url_id != -1){
+        $sql = "SELECT code, visual_code, title
+                FROM $tbl_course as course
+                  INNER JOIN $tbl_course_rel_access_url course_rel_url
+                ON (course_rel_url.course_code= course.code)
+                  WHERE access_url_id =  $access_url_id  AND (visual_code LIKE '".$first_letter_course."%' ) ORDER BY ". (count($courses) > 0 ? "(code IN('".implode("','", $courses)."')) DESC," : "")." visual_code";
+    }
 }
 
 $result = Database::query($sql);
@@ -261,18 +261,18 @@ $db_courses = Database::store_result($result);
 unset($result);
 
 if ($_configuration['multiple_access_urls']) {
-	$tbl_course_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
-	$access_url_id = api_get_current_access_url_id();
-	if ($access_url_id != -1){
-		$sqlNbCours = "	SELECT course_rel_user.course_code, course.title
-			FROM $tbl_course_user as course_rel_user
-			INNER JOIN $tbl_course as course
-			ON course.code = course_rel_user.course_code
-		  	INNER JOIN $tbl_course_rel_access_url course_rel_url
-			ON (course_rel_url.course_code= course.code)
-		  	WHERE access_url_id =  $access_url_id  AND course_rel_user.user_id='".$_user['user_id']."' AND course_rel_user.status='1'
-		  	ORDER BY course.title";
-	}
+    $tbl_course_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
+    $access_url_id = api_get_current_access_url_id();
+    if ($access_url_id != -1){
+        $sqlNbCours = "	SELECT course_rel_user.course_code, course.title
+            FROM $tbl_course_user as course_rel_user
+            INNER JOIN $tbl_course as course
+            ON course.code = course_rel_user.course_code
+              INNER JOIN $tbl_course_rel_access_url course_rel_url
+            ON (course_rel_url.course_code= course.code)
+              WHERE access_url_id =  $access_url_id  AND course_rel_user.user_id='".$_user['user_id']."' AND course_rel_user.status='1'
+              ORDER BY course.title";
+    }
 }
 
 
@@ -282,28 +282,28 @@ if ($_configuration['multiple_access_urls']) {
 <?php
 
 if (is_array($extra_field_list)) {
-	if (is_array($new_field_list) && count($new_field_list)>0 ) {
-		echo '<h3>'.get_lang('FilterUsers').'</h3>';
-		foreach ($new_field_list as $new_field) {
-			echo $new_field['name'];
-			$varname = 'field_'.$new_field['variable'];
-			echo '&nbsp;<select name="'.$varname.'">';
-			echo '<option value="0">--'.get_lang('Select').'--</option>';
-			foreach	($new_field['data'] as $option) {
-				$checked='';
-				if (isset($_POST[$varname])) {
-					if ($_POST[$varname]==$option[1]) {
-						$checked = 'selected="true"';
-					}
-				}
-				echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
-			}
-			echo '</select>';
-			echo '&nbsp;&nbsp;';
-		}
-		echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />';
-		echo '<br /><br />';
-	}
+    if (is_array($new_field_list) && count($new_field_list)>0 ) {
+        echo '<h3>'.get_lang('FilterUsers').'</h3>';
+        foreach ($new_field_list as $new_field) {
+            echo $new_field['name'];
+            $varname = 'field_'.$new_field['variable'];
+            echo '&nbsp;<select name="'.$varname.'">';
+            echo '<option value="0">--'.get_lang('Select').'--</option>';
+            foreach	($new_field['data'] as $option) {
+                $checked='';
+                if (isset($_POST[$varname])) {
+                    if ($_POST[$varname]==$option[1]) {
+                        $checked = 'selected="true"';
+                    }
+                }
+                echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
+            }
+            echo '</select>';
+            echo '&nbsp;&nbsp;';
+        }
+        echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />';
+        echo '<br /><br />';
+    }
 }
 
 ?>
@@ -340,9 +340,9 @@ if (is_array($extra_field_list)) {
     <td width="40%" align="center">
      <select name="UserList[]" multiple="multiple" size="20" style="width:230px;">
 <?php
-		foreach ($db_users as $user) {
+        foreach ($db_users as $user) {
 ?>
-	  <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?></option>
+      <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?></option>
 <?php
 }
 ?>
@@ -354,9 +354,9 @@ if (is_array($extra_field_list)) {
    <td width="40%" align="center">
     <select name="CourseList[]" multiple="multiple" size="20" style="width:230px;">
 <?php
-		foreach ($db_courses as $course) {
+        foreach ($db_courses as $course) {
 ?>
-	 <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option>
+     <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option>
 <?php
 }
 ?>
@@ -368,7 +368,7 @@ if (is_array($extra_field_list)) {
 <?php
 /*
 ==============================================================================
-		FOOTER
+        FOOTER
 ==============================================================================
 */
 Display :: display_footer();

+ 2 - 2
main/inc/lib/internationalization_database/name_order_conventions.php

@@ -84,11 +84,11 @@ return array(
 	'slovenian' =>        array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),
 
 	//'spanish' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'last_name'  ),
-	'spanish' =>          array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'  ),
+	//'spanish' =>          array(  'format' => 'title last_name first_name',  'sort_by' => 'last_name'  ),
 	// Some experimental settings for Spanish language:
 	//'spanish' =>          array(  'format' => 'title first_name LAST_NAME',  'sort_by' => 'first_name'  ), // Western order, last name is uppercase when a full name is assembled
 	//'spanish' =>          array(  'format' => 'title first_name LAST_NAME',  'sort_by' => 'last_name'   ), // Western order, last name is uppercase when a full name is assembled
-	//'spanish' =>          array(  'format' => 'title last_name, first_name',  'sort_by' => 'last_name'  ), // Library order
+	'spanish' =>          array(  'format' => 'title last_name, first_name',  'sort_by' => 'last_name'  ), // Library order
 	//'spanish' =>          array(  'format' => 'title LAST_NAME, first_name',  'sort_by' => 'last_name'  ), // Library order, last name is uppercase when a full name is assembled
 
 	'swahili' =>          array(  'format' => 'title first_name last_name',  'sort_by' => 'first_name'  ),

+ 7 - 3
main/inc/lib/message.lib.php

@@ -919,7 +919,9 @@ class MessageManager
 
 									$html.=	'</div>';
 									$html.= '<br />';
-									$html.= '<div class="message-group-author">'.get_lang('From').'&nbsp;<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a></div>';
+										$image_path = UserManager::get_user_picture_path_by_id($topic['user_sender_id'], 'web', false, true);							$image_repository = $image_path['dir'];
+										$existing_image = $image_path['file'];
+									$html.= '<div class="message-group-author"><img src="'.$image_repository.$existing_image.'" alt="'.$name.'"  width="44" height="44" title="'.$name.'" />&nbsp;<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a></div>';
 									$html.= '<div class="message-group-content">'.$topic['content'].'</div>';
 									$html.= '<div class="message-attach">'.(!empty($files_attachments)?implode('&nbsp;|&nbsp;',$files_attachments):'').'</div>';
 								$html.= '</div>';
@@ -947,8 +949,10 @@ class MessageManager
 									$html_items.= '&nbsp;&nbsp;<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$item['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic['id'].'&topics_page_nr='.intval($_GET['topics_page_nr']).'&items_page_nr='.intval($items_page_nr).'&topic_id='.$topic['id'].'" class="thickbox" title="'.get_lang('Edit').'">'.Display :: return_icon('edit.gif', get_lang('Edit')).'</a>';
 								}
 								$html_items.= '</div>';
-								$html_items.= '<div class="message-group-title">'.Security::remove_XSS($item['title']).'&nbsp;</div>';
-								$html_items.= '<div class="message-group-author">'.get_lang('From').'&nbsp;<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$item['user_sender_id'].'">'.$name.'&nbsp;</a></div>';
+								$html_items.= '<div class="message-group-title">'.Security::remove_XSS($item['title']).'&nbsp;</div>';						
+									$image_path = UserManager::get_user_picture_path_by_id($topic['user_sender_id'], 'web', false, true);								$image_repository = $image_path['dir'];
+									$existing_image = $image_path['file'];
+								$html_items.= '<div class="message-group-author"><img src="'.$image_repository.$existing_image.'" alt="'.$name.'"  width="44" height="44" title="'.$name.'" />&nbsp;<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$item['user_sender_id'].'">'.$name.'&nbsp;</a></div>';
 								$html_items.= '<div class="message-group-content">'.$item['content'].'</div>';
 
 								if ($item['send_date'] != $item['update_date']) {