Completed
Push — 1.11.x ( b4cb95...04c255 )
by José
287:38 queued 248:49
created
main/exercise/hotspot.class.php 1 patch
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -12,31 +12,31 @@  discard block
 block discarded – undo
12 12
  **/
13 13
 class HotSpot extends Question
14 14
 {
15
-	public static $typePicture = 'hotspot.png';
16
-	public static $explanationLangVar = 'HotSpot';
15
+    public static $typePicture = 'hotspot.png';
16
+    public static $explanationLangVar = 'HotSpot';
17 17
 
18 18
     /**
19 19
      * HotSpot constructor.
20 20
      */
21
-	public function __construct()
22
-	{
23
-		parent::__construct();
24
-		$this->type = HOT_SPOT;
25
-	}
26
-
27
-	public function display()
28
-	{
29
-	}
30
-
31
-	/**
32
-	 * @param FormValidator $form
33
-	 * @param int $fck_config
34
-	 */
35
-	public function createForm (&$form, $fck_config=0)
36
-	{
37
-		parent::createForm($form, $fck_config);
38
-
39
-		if (!isset($_GET['editQuestion'])) {
21
+    public function __construct()
22
+    {
23
+        parent::__construct();
24
+        $this->type = HOT_SPOT;
25
+    }
26
+
27
+    public function display()
28
+    {
29
+    }
30
+
31
+    /**
32
+     * @param FormValidator $form
33
+     * @param int $fck_config
34
+     */
35
+    public function createForm (&$form, $fck_config=0)
36
+    {
37
+        parent::createForm($form, $fck_config);
38
+
39
+        if (!isset($_GET['editQuestion'])) {
40 40
             $form->addElement(
41 41
                 'file',
42 42
                 'imageUpload',
@@ -46,54 +46,54 @@  discard block
 block discarded – undo
46 46
                 )
47 47
             );
48 48
 
49
-			// setting the save button here and not in the question class.php
50
-			// Saving a question
51
-			$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
52
-			//$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
53
-			$form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
54
-			$form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
55
-		} else {
56
-			// setting the save button here and not in the question class.php
57
-			// Editing a question
58
-			$form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
59
-		}
60
-	}
61
-
62
-	/**
63
-	 * @param FormValidator $form
64
-	 * @param null $objExercise
65
-	 * @return null|false
66
-	 */
67
-	public function processCreation($form, $objExercise = null)
68
-	{
69
-		$file_info = $form->getSubmitValue('imageUpload');
70
-		$_course = api_get_course_info();
71
-		parent::processCreation($form, $objExercise);
72
-
73
-		if(!empty($file_info['tmp_name'])) {
74
-			$this->uploadPicture($file_info['tmp_name'], $file_info['name']);
75
-			$documentPath  = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
76
-			$picturePath   = $documentPath.'/images';
77
-
78
-			// fixed width ang height
79
-			if (file_exists($picturePath.'/'.$this->picture)) {
80
-				$this->resizePicture('width', 800);
81
-				$this->save();
82
-			} else {
83
-				return false;
84
-			}
85
-		}
86
-	}
87
-
88
-	function createAnswersForm($form)
89
-	{
90
-		// nothing
91
-	}
92
-
93
-	function processAnswersCreation($form)
94
-	{
95
-		// nothing
96
-	}
49
+            // setting the save button here and not in the question class.php
50
+            // Saving a question
51
+            $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
52
+            //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
53
+            $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
54
+            $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
55
+        } else {
56
+            // setting the save button here and not in the question class.php
57
+            // Editing a question
58
+            $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
59
+        }
60
+    }
61
+
62
+    /**
63
+     * @param FormValidator $form
64
+     * @param null $objExercise
65
+     * @return null|false
66
+     */
67
+    public function processCreation($form, $objExercise = null)
68
+    {
69
+        $file_info = $form->getSubmitValue('imageUpload');
70
+        $_course = api_get_course_info();
71
+        parent::processCreation($form, $objExercise);
72
+
73
+        if(!empty($file_info['tmp_name'])) {
74
+            $this->uploadPicture($file_info['tmp_name'], $file_info['name']);
75
+            $documentPath  = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
76
+            $picturePath   = $documentPath.'/images';
77
+
78
+            // fixed width ang height
79
+            if (file_exists($picturePath.'/'.$this->picture)) {
80
+                $this->resizePicture('width', 800);
81
+                $this->save();
82
+            } else {
83
+                return false;
84
+            }
85
+        }
86
+    }
87
+
88
+    function createAnswersForm($form)
89
+    {
90
+        // nothing
91
+    }
92
+
93
+    function processAnswersCreation($form)
94
+    {
95
+        // nothing
96
+    }
97 97
 }
98 98
 
99 99
 /**
@@ -101,38 +101,38 @@  discard block
 block discarded – undo
101 101
  */
102 102
 class HotSpotDelineation extends HotSpot
103 103
 {
104
-	public static $typePicture = 'hotspot-delineation.png';
105
-	public static $explanationLangVar = 'HotspotDelineation';
104
+    public static $typePicture = 'hotspot-delineation.png';
105
+    public static $explanationLangVar = 'HotspotDelineation';
106 106
 
107 107
     /**
108 108
      * HotSpotDelineation constructor.
109 109
      */
110
-	public function __construct()
111
-	{
112
-		parent::__construct();
113
-		$this -> type = HOT_SPOT_DELINEATION;
114
-
115
-	}
116
-
117
-	function createForm(&$form, $fck_config=0)
118
-	{
119
-		parent::createForm ($form, $fck_config);
120
-	}
121
-
122
-	function processCreation ($form, $objExercise = null)
123
-	{
124
-		$file_info = $form -> getSubmitValue('imageUpload');
125
-		parent::processCreation ($form, $objExercise);
126
-	}
127
-
128
-	function createAnswersForm ($form)
129
-	{
130
-		parent::createAnswersForm ($form);
131
-	}
132
-
133
-	function processAnswersCreation ($form)
134
-	{
135
-		parent::processAnswersCreation ($form);
136
-	}
110
+    public function __construct()
111
+    {
112
+        parent::__construct();
113
+        $this -> type = HOT_SPOT_DELINEATION;
114
+
115
+    }
116
+
117
+    function createForm(&$form, $fck_config=0)
118
+    {
119
+        parent::createForm ($form, $fck_config);
120
+    }
121
+
122
+    function processCreation ($form, $objExercise = null)
123
+    {
124
+        $file_info = $form -> getSubmitValue('imageUpload');
125
+        parent::processCreation ($form, $objExercise);
126
+    }
127
+
128
+    function createAnswersForm ($form)
129
+    {
130
+        parent::createAnswersForm ($form);
131
+    }
132
+
133
+    function processAnswersCreation ($form)
134
+    {
135
+        parent::processAnswersCreation ($form);
136
+    }
137 137
 }
138 138
 
Please login to merge, or discard this patch.
main/inc/lib/blog.lib.php 1 patch
Indentation   +97 added lines, -98 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@  discard block
 block discarded – undo
6 6
  *
7 7
  * Contains several functions dealing with displaying,
8 8
  * editing,... of a blog
9
-
10 9
  * @package chamilo.blogs
11 10
  * @author Toon Keppens <[email protected]>
12 11
  * @author Julio Montoya - Cleaning code
@@ -333,7 +332,7 @@  discard block
 block discarded – undo
333 332
                     // Storing the attachments if any
334 333
                     if ($result) {
335 334
                         $sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size, blog_id,comment_id) '.
336
-                               "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."',  '".$blog_id."', '0' )";
335
+                                "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."',  '".$blog_id."', '0' )";
337 336
                         Database::query($sql);
338 337
                         $id = Database::insert_id();
339 338
                         if ($id) {
@@ -470,7 +469,7 @@  discard block
 block discarded – undo
470 469
                     // Storing the attachments if any
471 470
                     if ($result) {
472 471
                         $sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '.
473
-                             "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."',  '".$blog_id."', '".$last_id."'  )";
472
+                                "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."',  '".$blog_id."', '".$last_id."'  )";
474 473
                         Database::query($sql);
475 474
 
476 475
                         $id = Database::insert_id();
@@ -1389,10 +1388,10 @@  discard block
 block discarded – undo
1389 1388
             echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />';
1390 1389
             echo "<table class=\"data_table\">";
1391 1390
             echo	"<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">",
1392
-                     "<th width='240'><b>",get_lang('Title'),"</b></th>",
1393
-                     "<th><b>",get_lang('Description'),"</b></th>",
1394
-                     "<th><b>",get_lang('Color'),"</b></th>",
1395
-                     "<th width='50'><b>",get_lang('Modify'),"</b></th>",
1391
+                        "<th width='240'><b>",get_lang('Title'),"</b></th>",
1392
+                        "<th><b>",get_lang('Description'),"</b></th>",
1393
+                        "<th><b>",get_lang('Color'),"</b></th>",
1394
+                        "<th width='50'><b>",get_lang('Modify'),"</b></th>",
1396 1395
                 "</tr>";
1397 1396
 
1398 1397
 
@@ -1424,14 +1423,14 @@  discard block
 block discarded – undo
1424 1423
                 echo '<td width="50">';
1425 1424
                 echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=edit&task_id='.$task['task_id'].'">';
1426 1425
                 echo Display::return_icon('edit.png', get_lang('EditTask'));
1427
-                      echo "</a>";
1428
-                      echo '<a href="'.$delete_link.'"';
1429
-                      echo $delete_confirm;
1430
-                       echo '>';
1426
+                        echo "</a>";
1427
+                        echo '<a href="'.$delete_link.'"';
1428
+                        echo $delete_confirm;
1429
+                        echo '>';
1431 1430
                         echo Display::return_icon($delete_icon, $delete_title);
1432
-                       echo "</a>";
1433
-                     echo '</td>';
1434
-                   echo '</tr>';
1431
+                        echo "</a>";
1432
+                        echo '</td>';
1433
+                    echo '</tr>';
1435 1434
             }
1436 1435
             echo "</table>";
1437 1436
         }
@@ -1455,11 +1454,11 @@  discard block
 block discarded – undo
1455 1454
         echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />';
1456 1455
         echo "<table class=\"data_table\">";
1457 1456
         echo	"<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">",
1458
-                 "<th width='240'><b>",get_lang('Member'),"</b></th>",
1459
-                 "<th><b>",get_lang('Task'),"</b></th>",
1460
-                 "<th><b>",get_lang('Description'),"</b></th>",
1461
-                 "<th><b>",get_lang('TargetDate'),"</b></th>",
1462
-                 "<th width='50'><b>",get_lang('Modify'),"</b></th>",
1457
+                    "<th width='240'><b>",get_lang('Member'),"</b></th>",
1458
+                    "<th><b>",get_lang('Task'),"</b></th>",
1459
+                    "<th><b>",get_lang('Description'),"</b></th>",
1460
+                    "<th><b>",get_lang('TargetDate'),"</b></th>",
1461
+                    "<th width='50'><b>",get_lang('Modify'),"</b></th>",
1463 1462
             "</tr>";
1464 1463
 
1465 1464
         $course_id = api_get_course_int_id();
@@ -2307,7 +2306,7 @@  discard block
 block discarded – undo
2307 2306
      * @param Integer $year: the 4-digit year indication e.g. 2005
2308 2307
      *
2309 2308
      * @return html code
2310
-    */
2309
+     */
2311 2310
     public static function display_minimonthcalendar($month, $year, $blog_id)
2312 2311
     {
2313 2312
         // Init
@@ -2600,34 +2599,34 @@  discard block
 block discarded – undo
2600 2599
  */
2601 2600
 function get_blog_attachment($blog_id, $post_id=null,$comment_id=null)
2602 2601
 {
2603
-	$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
2604
-
2605
-	$blog_id = intval($blog_id);
2606
-	$comment_id = intval($comment_id);
2607
-	$post_id = intval($post_id);
2608
-	$row=array();
2609
-	$where='';
2610
-	if (!empty ($post_id) && is_numeric($post_id)) {
2611
-		$where.=' AND post_id ="'.$post_id.'" ';
2612
-	}
2613
-
2614
-	if (!empty ($comment_id) && is_numeric($comment_id)) {
2615
-		if (!empty ($post_id)) {
2616
-			$where.= ' AND ';
2617
-		}
2618
-		$where.=' comment_id ="'.$comment_id.'" ';
2619
-	}
2602
+    $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
2603
+
2604
+    $blog_id = intval($blog_id);
2605
+    $comment_id = intval($comment_id);
2606
+    $post_id = intval($post_id);
2607
+    $row=array();
2608
+    $where='';
2609
+    if (!empty ($post_id) && is_numeric($post_id)) {
2610
+        $where.=' AND post_id ="'.$post_id.'" ';
2611
+    }
2612
+
2613
+    if (!empty ($comment_id) && is_numeric($comment_id)) {
2614
+        if (!empty ($post_id)) {
2615
+            $where.= ' AND ';
2616
+        }
2617
+        $where.=' comment_id ="'.$comment_id.'" ';
2618
+    }
2620 2619
 
2621 2620
     $course_id = api_get_course_int_id();
2622 2621
 
2623
-	$sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.'
2622
+    $sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.'
2624 2623
 	        WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'"  '.$where;
2625 2624
 
2626
-	$result=Database::query($sql);
2627
-	if (Database::num_rows($result)!=0) {
2628
-		$row=Database::fetch_array($result);
2629
-	}
2630
-	return $row;
2625
+    $result=Database::query($sql);
2626
+    if (Database::num_rows($result)!=0) {
2627
+        $row=Database::fetch_array($result);
2628
+    }
2629
+    return $row;
2631 2630
 }
2632 2631
 
2633 2632
 /**
@@ -2644,16 +2643,16 @@  discard block
 block discarded – undo
2644 2643
 
2645 2644
 function delete_all_blog_attachment($blog_id,$post_id=null,$comment_id=null)
2646 2645
 {
2647
-	$_course = api_get_course_info();
2648
-	$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
2649
-	$blog_id = intval($blog_id);
2650
-	$comment_id = intval($comment_id);
2651
-	$post_id = intval($post_id);
2646
+    $_course = api_get_course_info();
2647
+    $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
2648
+    $blog_id = intval($blog_id);
2649
+    $comment_id = intval($comment_id);
2650
+    $post_id = intval($post_id);
2652 2651
 
2653 2652
     $course_id = api_get_course_int_id();
2654
-	$where = null;
2653
+    $where = null;
2655 2654
 
2656
-	// delete files in DB
2655
+    // delete files in DB
2657 2656
     if (!empty ($post_id) && is_numeric($post_id)) {
2658 2657
         $where .= ' AND post_id ="'.$post_id.'" ';
2659 2658
     }
@@ -2665,25 +2664,25 @@  discard block
 block discarded – undo
2665 2664
         $where .= ' comment_id ="'.$comment_id.'" ';
2666 2665
     }
2667 2666
 
2668
-	// delete all files in directory
2669
-	$courseDir   = $_course['path'].'/upload/blog';
2670
-	$sys_course_path = api_get_path(SYS_COURSE_PATH);
2671
-	$updir = $sys_course_path.$courseDir;
2667
+    // delete all files in directory
2668
+    $courseDir   = $_course['path'].'/upload/blog';
2669
+    $sys_course_path = api_get_path(SYS_COURSE_PATH);
2670
+    $updir = $sys_course_path.$courseDir;
2672 2671
 
2673
-	$sql = 'SELECT path FROM '.$blog_table_attachment.'
2672
+    $sql = 'SELECT path FROM '.$blog_table_attachment.'
2674 2673
 	        WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'"  '.$where;
2675
-	$result=Database::query($sql);
2676
-
2677
-	while ($row=Database::fetch_row($result)) {
2678
-		$file=$updir.'/'.$row[0];
2679
-		if (Security::check_abs_path($file,$updir) )
2680
-		{
2681
-			@ unlink($file);
2682
-		}
2683
-	}
2684
-	$sql = 'DELETE FROM '. $blog_table_attachment.'
2674
+    $result=Database::query($sql);
2675
+
2676
+    while ($row=Database::fetch_row($result)) {
2677
+        $file=$updir.'/'.$row[0];
2678
+        if (Security::check_abs_path($file,$updir) )
2679
+        {
2680
+            @ unlink($file);
2681
+        }
2682
+    }
2683
+    $sql = 'DELETE FROM '. $blog_table_attachment.'
2685 2684
 	        WHERE c_id = '.$course_id.' AND  blog_id ="'.intval($blog_id).'"  '.$where;
2686
-	Database::query($sql);
2685
+    Database::query($sql);
2687 2686
 }
2688 2687
 
2689 2688
 /**
@@ -2693,12 +2692,12 @@  discard block
 block discarded – undo
2693 2692
  */
2694 2693
 function get_blog_post_from_user($course_code, $user_id)
2695 2694
 {
2696
-	$tbl_blogs 		= Database::get_course_table(TABLE_BLOGS);
2697
-	$tbl_blog_post 	= Database::get_course_table(TABLE_BLOGS_POSTS);
2698
-	$course_info 	= api_get_course_info($course_code);
2699
-	$course_id 		= $course_info['real_id'];
2695
+    $tbl_blogs 		= Database::get_course_table(TABLE_BLOGS);
2696
+    $tbl_blog_post 	= Database::get_course_table(TABLE_BLOGS_POSTS);
2697
+    $course_info 	= api_get_course_info($course_code);
2698
+    $course_id 		= $course_info['real_id'];
2700 2699
 
2701
-	$sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation
2700
+    $sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation
2702 2701
 			FROM $tbl_blogs blog
2703 2702
 			INNER JOIN  $tbl_blog_post post
2704 2703
 			ON (blog.blog_id = post.blog_id)
@@ -2707,19 +2706,19 @@  discard block
 block discarded – undo
2707 2706
 				post.c_id = $course_id AND
2708 2707
 				author_id =  $user_id AND visibility = 1
2709 2708
 			ORDER BY post.date_creation DESC ";
2710
-	$result = Database::query($sql);
2711
-	$return_data = '';
2712
-
2713
-	if (Database::num_rows($result)!=0) {
2714
-		while ($row=Database::fetch_array($result)) {
2715
-			$return_data.=  '<div class="clear"></div><br />';
2716
-			$return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>';
2717
-			$return_data.=  '<br / >';
2718
-			$return_data.= $row['full_text'];
2719
-			$return_data.= '<br /><br />';
2720
-		}
2721
-	}
2722
-	return $return_data;
2709
+    $result = Database::query($sql);
2710
+    $return_data = '';
2711
+
2712
+    if (Database::num_rows($result)!=0) {
2713
+        while ($row=Database::fetch_array($result)) {
2714
+            $return_data.=  '<div class="clear"></div><br />';
2715
+            $return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>';
2716
+            $return_data.=  '<br / >';
2717
+            $return_data.= $row['full_text'];
2718
+            $return_data.= '<br /><br />';
2719
+        }
2720
+    }
2721
+    return $return_data;
2723 2722
 }
2724 2723
 
2725 2724
 /**
@@ -2736,7 +2735,7 @@  discard block
 block discarded – undo
2736 2735
     $course_info = api_get_course_info($course_code);
2737 2736
     $course_id = $course_info['real_id'];
2738 2737
 
2739
-	$sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation
2738
+    $sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation
2740 2739
 			FROM $tbl_blogs blog INNER JOIN  $tbl_blog_comment comment
2741 2740
 			ON (blog.blog_id = comment.blog_id)
2742 2741
 			WHERE 	blog.c_id = $course_id AND
@@ -2744,18 +2743,18 @@  discard block
 block discarded – undo
2744 2743
 					author_id =  $user_id AND
2745 2744
 					visibility = 1
2746 2745
 			ORDER BY blog_name";
2747
-	$result = Database::query($sql);
2748
-	$return_data = '';
2749
-	if (Database::num_rows($result)!=0) {
2750
-		while ($row=Database::fetch_array($result)) {
2751
-			$return_data.=  '<div class="clear"></div><br />';
2752
-			$return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>';
2753
-			$return_data.=  '<br / >';
2754
-			//$return_data.=  '<strong>'.$row['title'].'</strong>'; echo '<br>';*/
2755
-			$return_data.=  $row['comment'];
2756
-			$return_data.=  '<br />';
2757
-		}
2758
-	}
2759
-	return $return_data;
2746
+    $result = Database::query($sql);
2747
+    $return_data = '';
2748
+    if (Database::num_rows($result)!=0) {
2749
+        while ($row=Database::fetch_array($result)) {
2750
+            $return_data.=  '<div class="clear"></div><br />';
2751
+            $return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>';
2752
+            $return_data.=  '<br / >';
2753
+            //$return_data.=  '<strong>'.$row['title'].'</strong>'; echo '<br>';*/
2754
+            $return_data.=  $row['comment'];
2755
+            $return_data.=  '<br />';
2756
+        }
2757
+    }
2758
+    return $return_data;
2760 2759
 }
2761 2760
 
Please login to merge, or discard this patch.
main/inc/lib/grade_model.lib.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
     /**
52 52
      * Displays the title + grid
53 53
      */
54
-	public function display()
54
+    public function display()
55 55
     {
56
-		// action links
57
-		echo '<div class="actions" style="margin-bottom:20px">';
56
+        // action links
57
+        echo '<div class="actions" style="margin-bottom:20px">';
58 58
         echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'', ICON_SIZE_MEDIUM).'</a>';
59
-		echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
60
-		echo '</div>';
59
+        echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
60
+        echo '</div>';
61 61
         echo Display::grid_html('grade_model');
62
-	}
62
+    }
63 63
 
64 64
     /**
65 65
      * Returns a Form validator Obj
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         }
118 118
 
119 119
         $form->addElement('hidden', 'maxvalue', '100');
120
-		$form->addElement('hidden', 'minvalue', '0');
120
+        $form->addElement('hidden', 'minvalue', '0');
121 121
         $renderer = & $form->defaultRenderer();
122 122
 
123 123
         $component_array = array();
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         // Setting the rules
193 193
         $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
194 194
 
195
-		return $form;
195
+        return $form;
196 196
     }
197 197
 
198 198
     /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      */
256 256
     public function delete($id)
257 257
     {
258
-	    parent::delete($id);
258
+        parent::delete($id);
259 259
     }
260 260
 
261 261
     /**
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
     /**
310 310
      * GradeModelComponents constructor.
311 311
      */
312
-	public function __construct()
312
+    public function __construct()
313 313
     {
314 314
         parent::__construct();
315 315
         $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS);
316
-	}
316
+    }
317 317
 
318 318
     /**
319 319
      * @param array $params
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function save($params, $show_query = false)
324 324
     {
325
-	    $id = parent::save($params, $show_query);
325
+        $id = parent::save($params, $show_query);
326 326
 
327 327
         return $id;
328 328
     }
Please login to merge, or discard this patch.
main/inc/lib/dashboard.lib.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
             }
308 308
         }
309 309
 
310
-		return $block_data;
311
-	}
310
+        return $block_data;
311
+    }
312 312
 
313 313
     /**
314 314
      * get data about enabled dashboard block (stored insise block table)
@@ -491,42 +491,42 @@  discard block
 block discarded – undo
491 491
         return $data;
492 492
     }
493 493
 
494
-	/**
495
-	 * This function update extra user blocks data after closing a dashboard block
496
-	 * @param int 		User id
497
-	 * @param string	plugin path
498
-	 * @param integer $user_id
499
-	 * @return bool
500
-	 */
501
-	public static function close_user_block($user_id, $path)
494
+    /**
495
+     * This function update extra user blocks data after closing a dashboard block
496
+     * @param int 		User id
497
+     * @param string	plugin path
498
+     * @param integer $user_id
499
+     * @return bool
500
+     */
501
+    public static function close_user_block($user_id, $path)
502 502
     {
503
-		$enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path);
504
-		$user_block_data = self::get_user_block_data($user_id);
505
-
506
-		foreach ($enabled_dashboard_blocks as $enabled_block) {
507
-			unset($user_block_data[$enabled_block['id']]);
508
-		}
509
-
510
-		// get columns and blocks id for updating extra user data
511
-		$columns = array();
512
-		$user_blocks_id = array();
513
-		foreach ($user_block_data as $data) {
514
-			$user_blocks_id[$data['block_id']] = true;
515
-			$columns[$data['block_id']] = $data['column'];
516
-		}
517
-
518
-		// update extra user blocks data
519
-		$upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
520
-
521
-		return $upd_extra_field;
522
-	}
523
-
524
-	/**
525
-	 * get links for styles from dashboard plugins
526
-	 * @return string   links
527
-	 */
528
-	public static function get_links_for_styles_from_dashboard_plugins() {
529
-
530
-		return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
531
-	}
503
+        $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path);
504
+        $user_block_data = self::get_user_block_data($user_id);
505
+
506
+        foreach ($enabled_dashboard_blocks as $enabled_block) {
507
+            unset($user_block_data[$enabled_block['id']]);
508
+        }
509
+
510
+        // get columns and blocks id for updating extra user data
511
+        $columns = array();
512
+        $user_blocks_id = array();
513
+        foreach ($user_block_data as $data) {
514
+            $user_blocks_id[$data['block_id']] = true;
515
+            $columns[$data['block_id']] = $data['column'];
516
+        }
517
+
518
+        // update extra user blocks data
519
+        $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
520
+
521
+        return $upd_extra_field;
522
+    }
523
+
524
+    /**
525
+     * get links for styles from dashboard plugins
526
+     * @return string   links
527
+     */
528
+    public static function get_links_for_styles_from_dashboard_plugins() {
529
+
530
+        return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
531
+    }
532 532
 }
Please login to merge, or discard this patch.
main/inc/lib/legal.lib.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
     {
16 16
     }
17 17
 
18
-	/**
19
-	 * Add a new Term and Condition
20
-	 * @param int $language language id
21
-	 * @param string $content content
22
-	 * @param int $type term and condition type (0 or 1)
23
-	 * @param string $changes explain changes
24
-	 * @return boolean success
25
-	 */
26
-	public static function add($language, $content, $type, $changes)
18
+    /**
19
+     * Add a new Term and Condition
20
+     * @param int $language language id
21
+     * @param string $content content
22
+     * @param int $type term and condition type (0 or 1)
23
+     * @param string $changes explain changes
24
+     * @return boolean success
25
+     */
26
+    public static function add($language, $content, $type, $changes)
27 27
     {
28 28
         $legal_table = Database::get_main_table(TABLE_MAIN_LEGAL);
29 29
         $last = self::get_last_condition($language);
@@ -96,27 +96,27 @@  discard block
 block discarded – undo
96 96
         }
97 97
     }
98 98
 
99
-	/**
100
-	 * Gets the data of a Term and condition by language
101
-	 * @param int $language language id
102
-	 * @return array all the info of a Term and condition
103
-	 */
104
-	public static function get_last_condition($language)
99
+    /**
100
+     * Gets the data of a Term and condition by language
101
+     * @param int $language language id
102
+     * @return array all the info of a Term and condition
103
+     */
104
+    public static function get_last_condition($language)
105 105
     {
106
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
107
-		$language= Database::escape_string($language);
108
-		$sql = "SELECT * FROM $legal_conditions_table
106
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
107
+        $language= Database::escape_string($language);
108
+        $sql = "SELECT * FROM $legal_conditions_table
109 109
                 WHERE language_id = '".$language."'
110 110
                 ORDER BY version DESC
111 111
                 LIMIT 1 ";
112
-		$result = Database::query($sql);
113
-		$result = Database::fetch_array($result, 'ASSOC');
112
+        $result = Database::query($sql);
113
+        $result = Database::fetch_array($result, 'ASSOC');
114 114
 
115 115
         if (isset($result['content'])) {
116 116
             $result['content'] = self::replaceTags($result['content']);
117 117
         }
118 118
         return $result;
119
-	}
119
+    }
120 120
 
121 121
     /**
122 122
      * @param string $content
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
         return $content;
141 141
     }
142 142
 
143
-	/**
144
-	 * Gets the last version of a Term and condition by language
145
-	 * @param int $language language id
146
-	 * @return boolean | int the version or false if does not exist
147
-	 */
148
-	public static function get_last_version($language)
143
+    /**
144
+     * Gets the last version of a Term and condition by language
145
+     * @param int $language language id
146
+     * @return boolean | int the version or false if does not exist
147
+     */
148
+    public static function get_last_version($language)
149 149
     {
150 150
         $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
151 151
         $language = intval($language);
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
 
164 164
             return false;
165 165
         }
166
-	}
166
+    }
167 167
 
168
-	/**
169
-	 * Show the last condition
170
-	 * @param array $term_preview with type and content i.e array('type'=>'1', 'content'=>'hola');
168
+    /**
169
+     * Show the last condition
170
+     * @param array $term_preview with type and content i.e array('type'=>'1', 'content'=>'hola');
171 171
      *
172
-	 * @return string html preview
173
-	 */
174
-	public static function show_last_condition($term_preview)
172
+     * @return string html preview
173
+     */
174
+    public static function show_last_condition($term_preview)
175 175
     {
176 176
         $preview = '';
177 177
         switch ($term_preview['type']) {
@@ -201,37 +201,37 @@  discard block
 block discarded – undo
201 201
             default:
202 202
                 break;
203 203
         }
204
-		return 	$preview;
205
-	}
204
+        return 	$preview;
205
+    }
206 206
 
207
-	/**
208
-	 * Get the terms and condition table (only for maintenance)
209
-	 * @param int $from
210
-	 * @param int $number_of_items
211
-	 * @param int $column
212
-	 * @return array
213
-	 */
214
-	public static function get_legal_data($from, $number_of_items, $column)
207
+    /**
208
+     * Get the terms and condition table (only for maintenance)
209
+     * @param int $from
210
+     * @param int $number_of_items
211
+     * @param int $column
212
+     * @return array
213
+     */
214
+    public static function get_legal_data($from, $number_of_items, $column)
215 215
     {
216
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
217
-		$lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE);
218
-		$from = intval($from);
219
-		$number_of_items = intval($number_of_items);
220
-		$column = intval($column);
216
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
217
+        $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE);
218
+        $from = intval($from);
219
+        $number_of_items = intval($number_of_items);
220
+        $column = intval($column);
221 221
 
222
- 		$sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
222
+            $sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
223 223
 				FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) ";
224
-		$sql .= "ORDER BY language, version ASC ";
225
-		$sql .= "LIMIT $from, $number_of_items ";
224
+        $sql .= "ORDER BY language, version ASC ";
225
+        $sql .= "LIMIT $from, $number_of_items ";
226 226
 
227
-		$result = Database::query($sql);
228
-		$legals = array();
229
-		$versions = array();
230
-		while ($legal = Database::fetch_array($result)) {
231
-			// max 2000 chars
232
-			//echo strlen($legal[1]); echo '<br>';
233
-			$versions[] = $legal[0];
234
-			$languages[] = $legal[1];
227
+        $result = Database::query($sql);
228
+        $legals = array();
229
+        $versions = array();
230
+        while ($legal = Database::fetch_array($result)) {
231
+            // max 2000 chars
232
+            //echo strlen($legal[1]); echo '<br>';
233
+            $versions[] = $legal[0];
234
+            $languages[] = $legal[1];
235 235
             if (strlen($legal[2]) > 2000) {
236 236
                 $legal[2] = substr($legal[2], 0, 2000).' ... ';
237 237
             }
@@ -240,50 +240,50 @@  discard block
 block discarded – undo
240 240
             } elseif ($legal[4] == 1) {
241 241
                 $legal[4] = get_lang('PageLink');
242 242
             }
243
-			$legals[] = $legal;
244
-		}
245
-		return $legals;
246
-	}
243
+            $legals[] = $legal;
244
+        }
245
+        return $legals;
246
+    }
247 247
 
248
-	/**
249
-	 * Gets the number of terms and conditions available
250
-	 * @return int
251
-	 */
252
-	public static function count()
248
+    /**
249
+     * Gets the number of terms and conditions available
250
+     * @return int
251
+     */
252
+    public static function count()
253 253
     {
254
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
255
-		$sql = "SELECT count(*) as count_result
254
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
255
+        $sql = "SELECT count(*) as count_result
256 256
 		        FROM $legal_conditions_table
257 257
 		        ORDER BY id DESC ";
258
-		$result = Database::query($sql);
259
-		$url = Database::fetch_array($result,'ASSOC');
260
-		$result = $url['count_result'];
258
+        $result = Database::query($sql);
259
+        $url = Database::fetch_array($result,'ASSOC');
260
+        $result = $url['count_result'];
261 261
 
262
-		return $result;
263
-	}
262
+        return $result;
263
+    }
264 264
 
265
-	/**
266
-	 * Get type of terms and conditions
267
-	 * @param int $legal_id
268
-	 * @param int $language_id
269
-	 * @return int The current type of terms and conditions
270
-	 */
271
-	public static function get_type_of_terms_and_conditions($legal_id, $language_id)
265
+    /**
266
+     * Get type of terms and conditions
267
+     * @param int $legal_id
268
+     * @param int $language_id
269
+     * @return int The current type of terms and conditions
270
+     */
271
+    public static function get_type_of_terms_and_conditions($legal_id, $language_id)
272 272
     {
273
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
274
-		$legal_id = intval($legal_id);
275
-		$language_id = intval($language_id);
276
-		$sql = 'SELECT type FROM '.$legal_conditions_table.'
273
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
274
+        $legal_id = intval($legal_id);
275
+        $language_id = intval($language_id);
276
+        $sql = 'SELECT type FROM '.$legal_conditions_table.'
277 277
 		        WHERE id =  "'.$legal_id.'" AND language_id="'.$language_id.'"';
278
-		$rs = Database::query($sql);
278
+        $rs = Database::query($sql);
279 279
 
280
-		return Database::result($rs,0,'type');
281
-	}
280
+        return Database::result($rs,0,'type');
281
+    }
282 282
 
283 283
     /**
284 284
      * @param int $userId
285 285
      */
286
-	public static function sendLegal($userId)
286
+    public static function sendLegal($userId)
287 287
     {
288 288
         $subject = get_lang('SendTermsSubject');
289 289
         $content = sprintf(
Please login to merge, or discard this patch.
main/social/profile.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -607,7 +607,7 @@
 block discarded – undo
607 607
                                 .' width="40px">';
608 608
                     $userInfo = api_get_user_info($user_invitation_id);
609 609
                     $invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">'
610
-                                 .api_get_person_name($userInfo['firstname'],$userInfo['lastname']).'</a>';
610
+                                    .api_get_person_name($userInfo['firstname'],$userInfo['lastname']).'</a>';
611 611
                     
612 612
                     $invitations .='<div class="pull-right">';
613 613
                     $invitations .=  '<a title="'.get_lang('SocialAddToFriends').'" id="btn_accepted_'.$user_invitation_id.'" class="btn btn-default btn-sm" onclick="register_friend(this)" href="javascript:void(0)">'
Please login to merge, or discard this patch.
plugin/vchamilo/lib/Virtual.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
     }
138 138
 
139 139
     /**
140
-    * provides a side connection to a vchamilo database
141
-    * @param array $_configuration
140
+     * provides a side connection to a vchamilo database
141
+     * @param array $_configuration
142 142
      *
143
-    * @return \Doctrine\DBAL\Driver\Connection
144
-    */
143
+     * @return \Doctrine\DBAL\Driver\Connection
144
+     */
145 145
     public static function bootConnection(&$_configuration)
146 146
     {
147 147
         $dbParams = array(
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
     }
250 250
 
251 251
     /**
252
-    * drop a vchamilo instance databases using the physical connection
253
-    * @param stdClass $params
254
-    * return an array of errors or false if ok
255
-    */
252
+     * drop a vchamilo instance databases using the physical connection
253
+     * @param stdClass $params
254
+     * return an array of errors or false if ok
255
+     */
256 256
     public static function dropDatabase($params)
257 257
     {
258 258
         $params = clone $params;
@@ -302,10 +302,10 @@  discard block
 block discarded – undo
302 302
     }
303 303
 
304 304
     /**
305
-    * get a proper SQLdump command
306
-    * @param object $vmoodledata the complete new host information
307
-    * @return string the shell command
308
-    */
305
+     * get a proper SQLdump command
306
+     * @param object $vmoodledata the complete new host information
307
+     * @return string the shell command
308
+     */
309 309
     public static function getDatabaseDumpCmd($vchamilodata)
310 310
     {
311 311
         $pgm = self::getConfig('vchamilo', 'mysql_cmd');
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
     }
470 470
 
471 471
     /**
472
-    * read manifest values in vchamilo template.
473
-    */
472
+     * read manifest values in vchamilo template.
473
+     */
474 474
     public static function getVmanifest($version)
475 475
     {
476 476
         $file = api_get_path(SYS_PATH).'/plugin/vchamilo/templates/'.$version.'/manifest.php';
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
     }
491 491
 
492 492
     /**
493
-    * make a fake vchamilo that represents the current host
494
-    */
493
+     * make a fake vchamilo that represents the current host
494
+     */
495 495
     public static function makeThis()
496 496
     {
497 497
         global $_configuration;
@@ -556,11 +556,11 @@  discard block
 block discarded – undo
556 556
     }
557 557
 
558 558
     /**
559
-    * this function set will map standard moodle API calls to chamilo
560
-    * internal primitives. This avoids too many changes to do in imported
561
-    * code
562
-    *
563
-    */
559
+     * this function set will map standard moodle API calls to chamilo
560
+     * internal primitives. This avoids too many changes to do in imported
561
+     * code
562
+     *
563
+     */
564 564
     public static function getConfig($module, $key, $isplugin = true)
565 565
     {
566 566
         if ($isplugin) {
Please login to merge, or discard this patch.
main/calendar/ical_export.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 $event = $agenda->get_event($id);
44 44
 
45 45
 if (!empty($event)) {
46
-	define('ICAL_LANG', api_get_language_isocode());
46
+    define('ICAL_LANG', api_get_language_isocode());
47 47
 
48 48
     $ical = new vcalendar();
49 49
     $ical->setConfig('unique_id',api_get_path(WEB_PATH));
Please login to merge, or discard this patch.
main/admin/ldap_users_list.php 1 patch
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 // Login as ...
21 21
 if ($action == "login_as" && !empty ($login_as_user_id))
22 22
 {
23
-	login_user($login_as_user_id);
23
+    login_user($login_as_user_id);
24 24
 }
25 25
 
26 26
 //if we already have a session id and a user...
@@ -37,150 +37,150 @@  discard block
 block discarded – undo
37 37
 
38 38
 if (isset ($_GET['action']))
39 39
 {
40
-	$check = Security::check_token('get');
41
-	if($check)
42
-	{
43
-		switch ($_GET['action'])
44
-		{
45
-			case 'show_message' :
46
-				Display :: display_header($tool_name);
47
-				Display :: display_normal_message($_GET['message']);
48
-				break;
49
-			case 'delete_user' :
50
-				Display :: display_header($tool_name);
51
-				if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id']))
52
-				{
53
-					Display :: display_normal_message(get_lang('UserDeleted'));
54
-				}
55
-				else
56
-				{
57
-					Display :: display_error_message(get_lang('CannotDeleteUser'));
58
-				}
59
-				break;
60
-			case 'lock' :
61
-				Display :: display_header($tool_name);
62
-				$message=lock_unlock_user('lock',$_GET['user_id']);
63
-				Display :: display_normal_message($message);
64
-				break;
65
-			case 'unlock';
66
-				Display :: display_header($tool_name);
67
-				$message=lock_unlock_user('unlock',$_GET['user_id']);
68
-				Display :: display_normal_message($message);
69
-				break;
70
-			case 'add_user';
71
-				$id=$_GET['id'];
72
-				$UserList=array();
73
-				$userid_match_login = array();
74
-				foreach ($id as $user_id) {
75
-					$tmp = ldap_add_user($user_id);
76
-					$UserList[]= $tmp;
77
-					$userid_match_login[$tmp] = $user_id;
78
-				}
79
-				if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) {
80
-					ldap_add_user_to_session($UserList, $_GET['id_session']);
81
-					header('Location: resume_session.php?id_session='.intval($_GET['id_session']));
82
-				} else {
83
-					Display :: display_header($tool_name);
84
-					if(count($userid_match_login)>0)
85
-					{
86
-						$message=get_lang('LDAPUsersAddedOrUpdated').':<br />';
87
-						foreach($userid_match_login as $user_id => $login)
88
-						{
89
-							$message .= '- '.$login.'<br />';
90
-						}
91
-					}
92
-					else
93
-					{
94
-						$message=get_lang('NoUserAdded');
95
-					}
96
-					Display :: display_normal_message($message,false);
97
-				}
98
-				break;
99
-			default :
100
-				Display :: display_header($tool_name);
101
-		}
102
-		Security::clear_token();
103
-	}
104
-	else
105
-	{
106
-		Display::display_header($tool_name);
107
-	}
40
+    $check = Security::check_token('get');
41
+    if($check)
42
+    {
43
+        switch ($_GET['action'])
44
+        {
45
+            case 'show_message' :
46
+                Display :: display_header($tool_name);
47
+                Display :: display_normal_message($_GET['message']);
48
+                break;
49
+            case 'delete_user' :
50
+                Display :: display_header($tool_name);
51
+                if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id']))
52
+                {
53
+                    Display :: display_normal_message(get_lang('UserDeleted'));
54
+                }
55
+                else
56
+                {
57
+                    Display :: display_error_message(get_lang('CannotDeleteUser'));
58
+                }
59
+                break;
60
+            case 'lock' :
61
+                Display :: display_header($tool_name);
62
+                $message=lock_unlock_user('lock',$_GET['user_id']);
63
+                Display :: display_normal_message($message);
64
+                break;
65
+            case 'unlock';
66
+                Display :: display_header($tool_name);
67
+                $message=lock_unlock_user('unlock',$_GET['user_id']);
68
+                Display :: display_normal_message($message);
69
+                break;
70
+            case 'add_user';
71
+                $id=$_GET['id'];
72
+                $UserList=array();
73
+                $userid_match_login = array();
74
+                foreach ($id as $user_id) {
75
+                    $tmp = ldap_add_user($user_id);
76
+                    $UserList[]= $tmp;
77
+                    $userid_match_login[$tmp] = $user_id;
78
+                }
79
+                if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) {
80
+                    ldap_add_user_to_session($UserList, $_GET['id_session']);
81
+                    header('Location: resume_session.php?id_session='.intval($_GET['id_session']));
82
+                } else {
83
+                    Display :: display_header($tool_name);
84
+                    if(count($userid_match_login)>0)
85
+                    {
86
+                        $message=get_lang('LDAPUsersAddedOrUpdated').':<br />';
87
+                        foreach($userid_match_login as $user_id => $login)
88
+                        {
89
+                            $message .= '- '.$login.'<br />';
90
+                        }
91
+                    }
92
+                    else
93
+                    {
94
+                        $message=get_lang('NoUserAdded');
95
+                    }
96
+                    Display :: display_normal_message($message,false);
97
+                }
98
+                break;
99
+            default :
100
+                Display :: display_header($tool_name);
101
+        }
102
+        Security::clear_token();
103
+    }
104
+    else
105
+    {
106
+        Display::display_header($tool_name);
107
+    }
108 108
 }
109 109
 else
110 110
 {
111
-	Display::display_header($tool_name);
111
+    Display::display_header($tool_name);
112 112
 }
113 113
 if (isset ($_POST['action']))
114 114
 {
115
-	$check = Security::check_token('get');
116
-	if($check)
117
-	{
118
-		switch ($_POST['action'])
119
-		{
120
-			case 'delete' :
121
-				$number_of_selected_users = count($_POST['id']);
122
-				$number_of_deleted_users = 0;
123
-				foreach ($_POST['id'] as $index => $user_id)
124
-				{
125
-					if($user_id != $_user['user_id'])
126
-					{
127
-						if(UserManager :: delete_user($user_id))
128
-						{
129
-							$number_of_deleted_users++;
130
-						}
131
-					}
132
-				}
133
-				if($number_of_selected_users == $number_of_deleted_users)
134
-				{
135
-					Display :: display_normal_message(get_lang('SelectedUsersDeleted'));
136
-				}
137
-				else
138
-				{
139
-					Display :: display_error_message(get_lang('SomeUsersNotDeleted'));
140
-				}
141
-				break;
142
-			case 'add_user' :
143
-				$number_of_selected_users = count($_POST['id']);
144
-				$number_of_added_users = 0;
145
-				$UserList=array();
146
-				foreach ($_POST['id'] as $index => $user_id)
147
-				{
148
-					if($user_id != $_user['user_id'])
149
-					{
150
-						$UserList[] = ldap_add_user($user_id);
151
-					}
152
-				}
153
-				if (isset($_GET['id_session']) && (trim($_GET['id_session'])!=""))
154
-					addUserToSession($UserList, $_GET['id_session']);
155
-				if(count($UserList)>0)
156
-				{
157
-					Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded'));
158
-				}
159
-				else
160
-				{
161
-					Display :: display_normal_message(get_lang('NoUserAdded'));
162
-				}
163
-				break;
115
+    $check = Security::check_token('get');
116
+    if($check)
117
+    {
118
+        switch ($_POST['action'])
119
+        {
120
+            case 'delete' :
121
+                $number_of_selected_users = count($_POST['id']);
122
+                $number_of_deleted_users = 0;
123
+                foreach ($_POST['id'] as $index => $user_id)
124
+                {
125
+                    if($user_id != $_user['user_id'])
126
+                    {
127
+                        if(UserManager :: delete_user($user_id))
128
+                        {
129
+                            $number_of_deleted_users++;
130
+                        }
131
+                    }
132
+                }
133
+                if($number_of_selected_users == $number_of_deleted_users)
134
+                {
135
+                    Display :: display_normal_message(get_lang('SelectedUsersDeleted'));
136
+                }
137
+                else
138
+                {
139
+                    Display :: display_error_message(get_lang('SomeUsersNotDeleted'));
140
+                }
141
+                break;
142
+            case 'add_user' :
143
+                $number_of_selected_users = count($_POST['id']);
144
+                $number_of_added_users = 0;
145
+                $UserList=array();
146
+                foreach ($_POST['id'] as $index => $user_id)
147
+                {
148
+                    if($user_id != $_user['user_id'])
149
+                    {
150
+                        $UserList[] = ldap_add_user($user_id);
151
+                    }
152
+                }
153
+                if (isset($_GET['id_session']) && (trim($_GET['id_session'])!=""))
154
+                    addUserToSession($UserList, $_GET['id_session']);
155
+                if(count($UserList)>0)
156
+                {
157
+                    Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded'));
158
+                }
159
+                else
160
+                {
161
+                    Display :: display_normal_message(get_lang('NoUserAdded'));
162
+                }
163
+                break;
164 164
 
165
-		}
166
-		Security::clear_token();
167
-	}
165
+        }
166
+        Security::clear_token();
167
+    }
168 168
 }
169 169
 
170 170
 $form = new FormValidator('advanced_search','get');
171 171
 $form->addText('keyword_username',get_lang('LoginName'),false);
172 172
 if (api_is_western_name_order())
173 173
 {
174
-	$form->addText('keyword_firstname', get_lang('FirstName'), false);
175
-	$form->addText('keyword_lastname', get_lang('LastName'), false);
174
+    $form->addText('keyword_firstname', get_lang('FirstName'), false);
175
+    $form->addText('keyword_lastname', get_lang('LastName'), false);
176 176
 }
177 177
 else
178 178
 {
179
-	$form->addText('keyword_lastname',get_lang('LastName'),false);
180
-	$form->addText('keyword_firstname',get_lang('FirstName'),false);
179
+    $form->addText('keyword_lastname',get_lang('LastName'),false);
180
+    $form->addText('keyword_firstname',get_lang('FirstName'),false);
181 181
 }
182 182
 if (isset($_GET['id_session']))
183
-	$form->addElement('hidden','id_session',$_GET['id_session']);
183
+    $form->addElement('hidden','id_session',$_GET['id_session']);
184 184
 
185 185
 $type = array();
186 186
 $type["all"] = get_lang('All');
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 $parameters['keyword_lastname'] = @$_GET['keyword_lastname'] ?: null;
203 203
 $parameters['keyword_email'] = @$_GET['keyword_email'] ?: null;
204 204
 if (isset($_GET['id_session']))
205
-	$parameters['id_session'] = $_GET['id_session'];
205
+    $parameters['id_session'] = $_GET['id_session'];
206 206
 // Create a sortable table with user-data
207 207
 
208 208
 $parameters['sec_token'] = Security::get_token();
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 $table->set_header(1, get_lang('LoginName'));
213 213
 if (api_is_western_name_order())
214 214
 {
215
-	$table->set_header(2, get_lang('FirstName'));
216
-	$table->set_header(3, get_lang('LastName'));
215
+    $table->set_header(2, get_lang('FirstName'));
216
+    $table->set_header(3, get_lang('LastName'));
217 217
 }
218 218
 else
219 219
 {
220
-	$table->set_header(2, get_lang('LastName'));
221
-	$table->set_header(3, get_lang('FirstName'));
220
+    $table->set_header(2, get_lang('LastName'));
221
+    $table->set_header(3, get_lang('FirstName'));
222 222
 }
223 223
 $table->set_header(4, get_lang('Email'));
224 224
 $table->set_header(5, get_lang('Actions'));
Please login to merge, or discard this patch.