Julio Montoya 15 anos atrás
pai
commit
9d77754210

+ 6 - 7
main/admin/add_users_to_session.php

@@ -1,9 +1,7 @@
 <?php //$id: $
-/* For licensing terms, see /dokeos_license.txt */
+/* For licensing terms, see /license.txt */
 /**
-==============================================================================
-*	@package dokeos.admin
-==============================================================================
+*	@package chamilo.admin
 */
 
 // name of the language file that needs to be included
@@ -13,10 +11,10 @@ $language_file=array('admin','registration');
 $cidReset=true;
 
 // including some necessary dokeos files
-require('../inc/global.inc.php');
-
-require_once ('../inc/lib/xajax/xajax.inc.php');
+require_once '../inc/global.inc.php';
+require_once '../inc/lib/xajax/xajax.inc.php';
 $xajax = new xajax();
+
 //$xajax->debugOn();
 $xajax -> registerFunction ('search_users');
 
@@ -245,6 +243,7 @@ if($_POST['form_sent']) {
 			//header('Location: '.Security::remove_XSS($_GET['page']).'?id_session='.$id_session);
 		//else
 		header('Location: resume_session.php?id_session='.$id_session);
+		exit;
 	}
 }
 

+ 5 - 10
main/admin/resume_session.php

@@ -1,21 +1,17 @@
-<?php // $Id: resume_session.php 20709 2009-05-15 19:12:37Z ivantcholakov $
-/* For licensing terms, see /dokeos_license.txt */
+<?php
+/* For licensing terms, see /license.txt */
 /**
-==============================================================================
 *	@author Bart Mollet
-*	@package dokeos.admin
-==============================================================================
+*	@package chamilo.admin
 */
 /*
-==============================================================================
 		INIT SECTION
-==============================================================================
 */
 
 // name of the language file that needs to be included
 $language_file = 'admin';
 $cidReset = true;
-require '../inc/global.inc.php';
+require_once '../inc/global.inc.php';
 
 // setting the section (for the tabs)
 $this_section=SECTION_PLATFORM_ADMIN;
@@ -49,8 +45,7 @@ $rs = Database::query($sql);
 $session = Database::store_result($rs);
 $session = $session[0];
 
-if(!api_is_platform_admin() && $session['session_admin_id']!=$_user['user_id'])
-{
+if(!api_is_platform_admin() && $session['session_admin_id']!=$_user['user_id']) {
 	api_not_allowed(true);
 }
 

+ 12 - 20
main/forum/forumfunction.inc.php

@@ -2813,8 +2813,8 @@ function send_notification_mails($thread_id, $reply_info) {
 	// 2. the forum is visible
 	// 3. the thread is visible
 	// 4. the reply is visible (=when there is
-	$current_thread=get_thread_information($thread_id);
-	$current_forum=get_forum_information($current_thread['forum_id']);
+	$current_thread	= get_thread_information($thread_id);
+	$current_forum	= get_forum_information($current_thread['forum_id']);
 	$current_forum_category=get_forumcategory_information($current_forum['forum_category']);
 	if($current_thread['visibility']=='1' AND $current_forum['visibility']=='1' AND $current_forum_category['visibility']=='1' AND $current_forum['approval_direct_post']!='1') {
 		$send_mails=true;
@@ -2823,7 +2823,7 @@ function send_notification_mails($thread_id, $reply_info) {
 	}
 
 	// the forum category, the forum, the thread and the reply are visible to the user
-	if ($send_mails==true) {
+	if ($send_mails == true) {
 		send_notifications($current_thread['forum_id'],$thread_id);
 		/*
 		$table_user 	= Database :: get_main_table(TABLE_MAIN_USER);
@@ -2870,29 +2870,25 @@ function handle_mail_cue($content, $id) {
 	$table_threads 		= Database :: get_course_table(TABLE_FORUM_THREAD);
 	$table_posts 		= Database :: get_course_table(TABLE_FORUM_POST);
 	$table_users 		= Database :: get_main_table(TABLE_MAIN_USER);
-    $table_userscourses = Database :: get_main_table(TABLE_MAIN_COURSE_REL_USER);
-    $course = api_get_course_id();
-	
+        	
 	// if the post is made visible we only have to send mails to the people who indicated that they wanted to be informed for that thread.
 	if ($content=='post') {
 		// getting the information about the post (need the thread_id)
-		$post_info=get_post_information($id);
+		$post_info = get_post_information($id);
 		$thread_id = Database::escape_string($post_info['thread_id']);
         
 		// sending the mail to all the users that wanted to be informed for replies on this thread.
 		$sql="SELECT users.firstname, users.lastname, users.user_id, users.email 
-		        FROM $table_mailcue mailcue, $table_posts posts, 
-		             $table_users users, $table_userscourses userscourses
+		        FROM $table_mailcue mailcue, $table_posts posts, $table_users users
 				WHERE posts.thread_id='$thread_id'
 				AND posts.post_notification='1'
 				AND mailcue.thread_id='$thread_id'
 				AND users.user_id=posts.poster_id
 				AND users.active=1
-				AND userscourses.user_id = users.user_id
-				AND userscourses.course_code = '$course'
 				GROUP BY users.email";
+				
 		$result=Database::query($sql);
-		while ($row=Database::fetch_array($result)) {
+		while ($row=Database::fetch_array($result)) {			
 			send_mail($row, get_thread_information($post_info['thread_id']));
 		}
 
@@ -2904,15 +2900,12 @@ function handle_mail_cue($content, $id) {
 	} elseif ($content=='thread') {
 		// sending the mail to all the users that wanted to be informed for replies on this thread.
 		$sql="SELECT users.firstname, users.lastname, users.user_id, users.email
-		        FROM $table_mailcue mailcue, $table_posts posts, 
-		             $table_users users, $table_userscourses userscourses
+		        FROM $table_mailcue mailcue, $table_posts posts, $table_users users
 				WHERE posts.thread_id='".Database::escape_string($id)."'
 				AND posts.post_notification='1'
 				AND mailcue.thread_id='".Database::escape_string($id)."'
 				AND users.user_id=posts.poster_id
 				AND users.active=1
-                AND userscourses.user_id = users.user_id
-                AND userscourses.course_code = $course
 				GROUP BY users.email";
 		$result=Database::query($sql);
 		while ($row=Database::fetch_array($result)) {
@@ -2923,13 +2916,13 @@ function handle_mail_cue($content, $id) {
 		$sql_delete_mailcue="DELETE FROM $table_mailcue WHERE thread_id='".Database::escape_string($id)."'";
 		$result=Database::query($sql_delete_mailcue);
 	} elseif ($content=='forum') {
-		$sql="SELECT * FROM $table_threads WHERE forum_id='".Database::escape_string($id)."'";
+		$sql="SELECT thread_id FROM $table_threads WHERE forum_id='".Database::escape_string($id)."'";
 		$result=Database::query($sql);
 		while ($row=Database::fetch_array($result)) {
 			handle_mail_cue('thread',$row['thread_id']);
 		}
 	} elseif ($content=='forum_category') {
-		$sql="SELECT * FROM $table_forums WHERE forum_category ='".Database::escape_string($id)."'";
+		$sql="SELECT forum_id FROM $table_forums WHERE forum_category ='".Database::escape_string($id)."'";
 		$result=Database::query($sql);
 		while ($row=Database::fetch_array($result)) {
 			handle_mail_cue('forum',$row['forum_id']);
@@ -3674,8 +3667,7 @@ function get_notifications($content,$id) {
 	}
 
 	$sql = "SELECT user.user_id, user.firstname, user.lastname, user.email, user.user_id user FROM $table_users user, $table_notification notification
-			WHERE user.user_id = notification.user_id
-			AND notification.$database_field= '".Database::escape_string($id)."'";
+			WHERE user.active = 1 AND user.user_id = notification.user_id AND notification.$database_field= '".Database::escape_string($id)."'";
 
 	$result=Database::query($sql);
 	$return = array();

+ 7 - 1
main/inc/lib/course.lib.php

@@ -285,7 +285,13 @@ class CourseManager {
 				WHERE user_id IN (".$user_ids.")");
 		Database::query("DELETE FROM ".Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER, $course->db_name)."
 				WHERE user_id IN (".$user_ids.")");
-
+		
+		//Deleting users in forum_notification and mailqueue course tables 
+		$sql_delete_forum_notification = "DELETE FROM  ".Database::get_course_table(TABLE_FORUM_NOTIFICATION, $course->db_name)." WHERE user_id IN (".$user_ids.")";		
+		Database::query($sql_delete_forum_notification);
+		
+		$sql_delete_mail_queue = "DELETE FROM ".Database::get_course_table(TABLE_FORUM_MAIL_QUEUE, $course->db_name)." WHERE user_id IN (".$user_ids.")";
+		Database::query($sql_delete_mail_queue);
 
 
 		// Unsubscribe user from the course.

+ 6 - 7
main/inc/lib/system_announcements.lib.php

@@ -1,14 +1,12 @@
 <?php
-/* For licensing terms, see /dokeos_license.txt */
+/* For licensing terms, see /license.txt */
 define('VISIBLE_GUEST', 1);
 define('VISIBLE_STUDENT', 2);
 define('VISIBLE_TEACHER', 3);
 /**
-==============================================================================
 *	This is the system announcements library for Dokeos.
 *
-*	@package dokeos.library
-==============================================================================
+*	@package chamilo.library
 */
 class SystemAnnouncementManager
 {
@@ -370,14 +368,15 @@ class SystemAnnouncementManager
 		global $_setting;
 		global $charset;
 		$user_table = Database :: get_main_table(TABLE_MAIN_USER);
+		
 		if ($teacher <> 0 AND $student == '0') {
-			$sql = "SELECT firstname, lastname, email, status FROM $user_table WHERE email<>'' AND status = '1'";
+			$sql = "SELECT firstname, lastname, email, status FROM $user_table WHERE email<>'' AND status = '1' AND active = 1";
 		}
 		if ($teacher == '0' AND $student <> '0') {
-			$sql = "SELECT firstname, lastname, email, status FROM $user_table WHERE email<>'' AND status = '5'";
+			$sql = "SELECT firstname, lastname, email, status FROM $user_table WHERE email<>'' AND status = '5' AND active = 1 ";
 		}
 		if ($teacher<>'0' AND $student <> '0') {
-			$sql = "SELECT firstname, lastname, email FROM $user_table WHERE email<>''";
+			$sql = "SELECT firstname, lastname, email FROM $user_table WHERE email<>'' AND active = 1 ";
 		}
 		if ($teacher == '0' AND $student == '0') {
 			return true;