Julio Montoya пре 15 година
родитељ
комит
431df0d970

+ 4 - 11
main/calendar/agenda.inc.php

@@ -1,11 +1,10 @@
 <?php //$Id: agenda.inc.php 22324 2009-07-23 17:44:22Z cfasanando $
 <?php //$Id: agenda.inc.php 22324 2009-07-23 17:44:22Z cfasanando $
-/* For licensing terms, see /dokeos_license.txt */
-/*
-==============================================================================
+/* For licensing terms, see /license.txt */
+/**
 	@author: Patrick Cool, patrick.cool@UGent.be
 	@author: Patrick Cool, patrick.cool@UGent.be
 	@version: 1.1
 	@version: 1.1
 	@todo: synchronisation with the function in myagenda.php (for instance: using one function for the mini_calendar
 	@todo: synchronisation with the function in myagenda.php (for instance: using one function for the mini_calendar
-==============================================================================
+
 	Large parts of the code are recycled from the old agenda tool, but I
 	Large parts of the code are recycled from the old agenda tool, but I
 	reworked it and cleaned the code to make it more readable. The code for
 	reworked it and cleaned the code to make it more readable. The code for
 	the small calender on the left is taken from the My Agenda tool.
 	the small calender on the left is taken from the My Agenda tool.
@@ -13,13 +12,11 @@
 	Reabability is also the reason why I use the if ($is_allowed_to_edit)
 	Reabability is also the reason why I use the if ($is_allowed_to_edit)
 	check for each part of the code. I'm aware that is duplication, but
 	check for each part of the code. I'm aware that is duplication, but
 	it makes the code much easier to read.
 	it makes the code much easier to read.
-==============================================================================
+
 */
 */
 
 
 /*
 /*
------------------------------------------------------------
 	Constants and variables
 	Constants and variables
------------------------------------------------------------
 */
 */
 // the variables for the days and the months
 // the variables for the days and the months
 // Defining the shorts for the days
 // Defining the shorts for the days
@@ -30,9 +27,7 @@ $DaysLong = api_get_week_days_long();
 $MonthsLong = api_get_months_long();
 $MonthsLong = api_get_months_long();
 
 
 /*
 /*
------------------------------------------------------------
 	Javascript
 	Javascript
------------------------------------------------------------
 */
 */
 
 
 $htmlHeadXtra[] = to_javascript();
 $htmlHeadXtra[] = to_javascript();
@@ -47,9 +42,7 @@ $(document).ready(function () {
 </script>';
 </script>';
 
 
 /*
 /*
-==============================================================================
 		FUNCTIONS
 		FUNCTIONS
-==============================================================================
 */
 */
 
 
 /**
 /**

+ 1 - 22
main/calendar/agenda.php

@@ -1,26 +1,5 @@
 <?php //$Id: agenda.php 22201 2009-07-17 19:57:03Z cfasanando $
 <?php //$Id: agenda.php 22201 2009-07-17 19:57:03Z cfasanando $
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2004-2008 Dokeos SPRL
-	Copyright (c) 2003-2005 Ghent University (UGent)
-	Copyright (c) various contributors
-
-	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.
-
-	See the GNU General Public License for more details.
-
-	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
-	Mail: info@dokeos.com
-==============================================================================
-*/
+/* For licensing terms, see /license.txt */
 /*
 /*
 ==============================================================================
 ==============================================================================
 	   INIT SECTION
 	   INIT SECTION

+ 1 - 22
main/calendar/calendar.php

@@ -1,26 +1,5 @@
 <?php //$Id: calendar.php 21101 2009-05-30 14:56:54Z iflorespaz $
 <?php //$Id: calendar.php 21101 2009-05-30 14:56:54Z iflorespaz $
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2004-2008 Dokeos SPRL
-	Copyright (c) 2003-2005 Ghent University (UGent)
-	Copyright (c) various contributors
-
-	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.
-
-	See the GNU General Public License for more details.
-
-	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
-	Mail: info@dokeos.com
-==============================================================================
-*/
+/* For licensing terms, see /license.txt */
 
 
 $language_file = 'agenda';
 $language_file = 'agenda';
 require_once dirname(__FILE__).'/../inc/global.inc.php';
 require_once dirname(__FILE__).'/../inc/global.inc.php';

+ 4 - 26
main/calendar/download.php

@@ -1,39 +1,16 @@
 <?php // $Id: $
 <?php // $Id: $
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2008 Dokeos SPRL
-
-	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.
-
-	See the GNU General Public License for more details.
-
-	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
-	info@dokeos.com
-==============================================================================
-*/
+/* For licensing terms, see /license.txt */
 /**
 /**
-==============================================================================
 *	This file is responsible for  passing requested documents to the browser.
 *	This file is responsible for  passing requested documents to the browser.
 *	Html files are parsed to fix a few problems with URLs,
 *	Html files are parsed to fix a few problems with URLs,
 *	but this code will hopefully be replaced soon by an Apache URL
 *	but this code will hopefully be replaced soon by an Apache URL
 *	rewrite mechanism.
 *	rewrite mechanism.
 *
 *
-*	@package dokeos.calendar
-==============================================================================
+*	@package chamilo.calendar
 */
 */
 
 
 /*
 /*
-==============================================================================
 		MAIN CODE
 		MAIN CODE
-==============================================================================
 */
 */
 
 
 session_cache_limiter('public');
 session_cache_limiter('public');
@@ -74,6 +51,7 @@ if (is_dir($full_file_name))
 	$document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
 	$document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
 	//redirect
 	//redirect
 	header('Location: '.$document_explorer);
 	header('Location: '.$document_explorer);
+	exit;
 }
 }
 
 
 $tbl_agenda_attachment 	= Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
 $tbl_agenda_attachment 	= Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
@@ -82,7 +60,7 @@ $tbl_agenda_attachment 	= Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
 event_download($doc_url);
 event_download($doc_url);
 
 
 $sql='SELECT filename FROM '.$tbl_agenda_attachment.'
 $sql='SELECT filename FROM '.$tbl_agenda_attachment.'
-  	  WHERE path LIKE BINARY "'.$doc_url.'"';
+  	  WHERE path LIKE BINARY "'.Database::escape_string($doc_url).'"';
 
 
 $result= Database::query($sql);
 $result= Database::query($sql);
 $row= Database::fetch_array($result);
 $row= Database::fetch_array($result);

+ 2 - 1
main/calendar/ical_export.php

@@ -1,4 +1,5 @@
-<?php // $id: $
+<?php
+/* For licensing terms, see /license.txt */
 /**
 /**
  * This file exclusively export calendar items to iCal or similar formats
  * This file exclusively export calendar items to iCal or similar formats
  * @author Yannick Warnier <yannick.warnier@dokeos.com>
  * @author Yannick Warnier <yannick.warnier@dokeos.com>

+ 34 - 38
main/calendar/myagenda.inc.php

@@ -1,13 +1,13 @@
 <?php //$Id: agenda.php 16490 2008-10-10 14:29:52Z elixir_inter $
 <?php //$Id: agenda.php 16490 2008-10-10 14:29:52Z elixir_inter $
-/* For licensing terms, see /dokeos_license.txt
-==============================================================================
+/* For licensing terms, see /license.txt */
+/**
 	@author: Patrick Cool <patrick.cool@UGent.be>, Ghent University
 	@author: Patrick Cool <patrick.cool@UGent.be>, Ghent University
 	@author: Toon Van Hoecke <toon.vanhoecke@ugent.be>, Ghent University
 	@author: Toon Van Hoecke <toon.vanhoecke@ugent.be>, Ghent University
 	@author: Eric Remy (initial version)
 	@author: Eric Remy (initial version)
 	@version: 2.2 alpha
 	@version: 2.2 alpha
 	@description: 	this file generates a general agenda of all items of the
 	@description: 	this file generates a general agenda of all items of the
 					courses the user is registered for
 					courses the user is registered for
-==============================================================================
+
 	version info:
 	version info:
 	-------------
 	-------------
 	-> version 2.2 : Patrick Cool, patrick.cool@ugent.be, november 2004
 	-> version 2.2 : Patrick Cool, patrick.cool@ugent.be, november 2004
@@ -55,8 +55,7 @@ function get_myagendaitems($courses_dbs, $month, $year)
 
 
 	$items = array ();
 	$items = array ();
 	// get agenda-items for every course
 	// get agenda-items for every course
-	foreach ($courses_dbs as $key => $array_course_info)
-	{
+	foreach ($courses_dbs as $key => $array_course_info) {
 		//databases of the courses
 		//databases of the courses
 		$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA, $array_course_info["db"]);
 		$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA, $array_course_info["db"]);
 		$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $array_course_info["db"]);
 		$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $array_course_info["db"]);
@@ -66,17 +65,16 @@ function get_myagendaitems($courses_dbs, $month, $year)
 		if ($array_course_info['status'] == '1')
 		if ($array_course_info['status'] == '1')
 		{
 		{
 			//echo "course admin";
 			//echo "course admin";
-			$sqlquery = "SELECT
-										DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
-										FROM ".$TABLEAGENDA." agenda,
-											 ".$TABLE_ITEMPROPERTY." ip
-										WHERE agenda.id = ip.ref
-										AND MONTH(agenda.start_date)='".$month."'
-										AND YEAR(agenda.start_date)='".$year."'
-										AND ip.tool='".TOOL_CALENDAR_EVENT."'
-										AND ip.visibility='1'
-										GROUP BY agenda.id
-										ORDER BY start_date ";
+			$sqlquery = "SELECT DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
+							FROM ".$TABLEAGENDA." agenda,
+								 ".$TABLE_ITEMPROPERTY." ip
+							WHERE agenda.id = ip.ref
+							AND MONTH(agenda.start_date)='".$month."'
+							AND YEAR(agenda.start_date)='".$year."'
+							AND ip.tool='".TOOL_CALENDAR_EVENT."'
+							AND ip.visibility='1'
+							GROUP BY agenda.id
+							ORDER BY start_date ";
 		}
 		}
 		// if the user is not an administrator of that course
 		// if the user is not an administrator of that course
 		else
 		else
@@ -84,31 +82,29 @@ function get_myagendaitems($courses_dbs, $month, $year)
 			//echo "GEEN course admin";
 			//echo "GEEN course admin";
 			if (is_array($group_memberships) && count($group_memberships)>0)
 			if (is_array($group_memberships) && count($group_memberships)>0)
 			{
 			{
-				$sqlquery = "SELECT
-													agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
-													FROM ".$TABLEAGENDA." agenda,
-														".$TABLE_ITEMPROPERTY." ip
-													WHERE agenda.id = ip.ref
-													AND MONTH(agenda.start_date)='".$month."'
-													AND YEAR(agenda.start_date)='".$year."'
-													AND ip.tool='".TOOL_CALENDAR_EVENT."'
-													AND	( ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") )
-													AND ip.visibility='1'
-													ORDER BY start_date ";
+				$sqlquery = "SELECT	agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
+								FROM ".$TABLEAGENDA." agenda,
+									".$TABLE_ITEMPROPERTY." ip
+								WHERE agenda.id = ip.ref
+								AND MONTH(agenda.start_date)='".$month."'
+								AND YEAR(agenda.start_date)='".$year."'
+								AND ip.tool='".TOOL_CALENDAR_EVENT."'
+								AND	( ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") )
+								AND ip.visibility='1'
+								ORDER BY start_date ";
 			}
 			}
 			else
 			else
 			{
 			{
-				$sqlquery = "SELECT
-													agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
-													FROM ".$TABLEAGENDA." agenda,
-														".$TABLE_ITEMPROPERTY." ip
-													WHERE agenda.id = ip.ref
-													AND MONTH(agenda.start_date)='".$month."'
-													AND YEAR(agenda.start_date)='".$year."'
-													AND ip.tool='".TOOL_CALENDAR_EVENT."'
-													AND ( ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id='0')
-													AND ip.visibility='1'
-													ORDER BY start_date ";
+				$sqlquery = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
+								FROM ".$TABLEAGENDA." agenda,
+									".$TABLE_ITEMPROPERTY." ip
+								WHERE agenda.id = ip.ref
+								AND MONTH(agenda.start_date)='".$month."'
+								AND YEAR(agenda.start_date)='".$year."'
+								AND ip.tool='".TOOL_CALENDAR_EVENT."'
+								AND ( ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id='0')
+								AND ip.visibility='1'
+								ORDER BY start_date ";
 			}
 			}
 		}
 		}
 
 

+ 18 - 41
main/calendar/myagenda.php

@@ -1,30 +1,13 @@
 <?php //$Id: myagenda.php 21102 2009-05-30 14:58:16Z iflorespaz $
 <?php //$Id: myagenda.php 21102 2009-05-30 14:58:16Z iflorespaz $
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2004-2008 Dokeos SPRL
-	Copyright (c) 2003 Ghent University (UGent)
-
-	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.
-
-	See the GNU General Public License for more details.
-
-	Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
-==============================================================================
+/* For licensing terms, see /license.txt */
+/**
 	@author: Patrick Cool <patrick.cool@UGent.be>, Ghent University
 	@author: Patrick Cool <patrick.cool@UGent.be>, Ghent University
 	@author: Toon Van Hoecke <toon.vanhoecke@ugent.be>, Ghent University
 	@author: Toon Van Hoecke <toon.vanhoecke@ugent.be>, Ghent University
 	@author: Eric Remy (initial version)
 	@author: Eric Remy (initial version)
 	@version: 2.2 alpha
 	@version: 2.2 alpha
 	@description: 	this file generates a general agenda of all items of the
 	@description: 	this file generates a general agenda of all items of the
 					courses the user is registered for
 					courses the user is registered for
-==============================================================================
+
 	version info:
 	version info:
 	-------------
 	-------------
 	-> version 2.3 : Yannick Warnier, yannick.warnier@dokeos.com 2008
 	-> version 2.3 : Yannick Warnier, yannick.warnier@dokeos.com 2008
@@ -55,11 +38,9 @@
 	The tool was initially called master-calendar as it collects all the calendar
 	The tool was initially called master-calendar as it collects all the calendar
 	items of all the courses one is subscribed to. It was very soon integrated in
 	items of all the courses one is subscribed to. It was very soon integrated in
 	Dokeos as this was a really basic and very usefull tool.
 	Dokeos as this was a really basic and very usefull tool.
+**/
 
 
-/* ==============================================================================
-				  			HEADER
-============================================================================== */
-
+//	HEADER
 
 
 // name of the language file that needs to be included
 // name of the language file that needs to be included
 $language_file = 'agenda';
 $language_file = 'agenda';
@@ -91,9 +72,9 @@ $htmlHeadXtra[] = "<script src=\"tbl_change.js\" type=\"text/javascript\" langua
 // showing the header
 // showing the header
 Display::display_header(get_lang('MyAgenda'));
 Display::display_header(get_lang('MyAgenda'));
 
 
-/* ==============================================================================
-  						SETTING SOME VARIABLES
-============================================================================== */
+
+//	SETTING SOME VARIABLES
+
 // setting the database variables
 // setting the database variables
 $TABLECOURS = Database :: get_main_table(TABLE_MAIN_COURSE);
 $TABLECOURS = Database :: get_main_table(TABLE_MAIN_COURSE);
 $TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
 $TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
@@ -109,7 +90,7 @@ $DaysLong = api_get_week_days_long();
 // Defining the months of the year to allow translation of the months
 // Defining the months of the year to allow translation of the months
 $MonthsLong = api_get_months_long();
 $MonthsLong = api_get_months_long();
 
 
-/*==============================================================================
+/*
   			TREATING THE URL PARAMETERS
   			TREATING THE URL PARAMETERS
 			1. The default values
 			1. The default values
 			2. storing it in the session
 			2. storing it in the session
@@ -121,22 +102,20 @@ $MonthsLong = api_get_months_long();
 			4. add personal agenda
 			4. add personal agenda
 			5. edit personal agenda
 			5. edit personal agenda
 			6. delete personal agenda
 			6. delete personal agenda
-  ============================================================================== */
+*/
+
 // 1. The default values. if there is no session yet, we have by default the month view
 // 1. The default values. if there is no session yet, we have by default the month view
-if (empty($_SESSION['view']))
-{
-	$_SESSION['view'] = "month";
+if (empty($_SESSION['view'])) {
+	$_SESSION['view'] = 'month';
 }
 }
 // 2. Storing it in the session. If we change the view by clicking on the links left, we change the session
 // 2. Storing it in the session. If we change the view by clicking on the links left, we change the session
 if (!empty($_GET['view'])) {
 if (!empty($_GET['view'])) {
 	$_SESSION['view'] = Security::remove_XSS($_GET['view']);
 	$_SESSION['view'] = Security::remove_XSS($_GET['view']);
-
 }
 }
+
 // 3. The views: (month, week, day, personal)
 // 3. The views: (month, week, day, personal)
-if ($_SESSION['view'])
-{
-	switch ($_SESSION['view'])
-	{
+if ($_SESSION['view']) {
+	switch ($_SESSION['view']) {
 		// 3.a Month view
 		// 3.a Month view
 		case "month" :
 		case "month" :
 			$process = "month_view";
 			$process = "month_view";
@@ -178,9 +157,7 @@ if (!empty($_GET['action']) && $_GET['action'] == "delete" AND $_GET['id'])
 {
 {
 	$process = "delete_personal_agenda_item";
 	$process = "delete_personal_agenda_item";
 }
 }
-/* ==============================================================================
-  						OUTPUT
-============================================================================== */
+// OUTPUT
 if (isset ($_user['user_id']))
 if (isset ($_user['user_id']))
 {
 {
 	// getting all the courses that this user is subscribed to
 	// getting all the courses that this user is subscribed to
@@ -306,4 +283,4 @@ if (isset ($_user['user_id']))
 }
 }
 echo "</td></tr></table>";
 echo "</td></tr></table>";
 Display :: display_footer();
 Display :: display_footer();
-?>
+?>

+ 9 - 14
main/calendar/print.php

@@ -1,20 +1,18 @@
 <?php
 <?php
+/* For licensing terms, see /license.txt */
 /**
 /**
  * See copyright information in the Dokeos root directory, dokeos_license.txt
  * See copyright information in the Dokeos root directory, dokeos_license.txt
- * @package dokeos.calendar
+ * @package chamilo.calendar
  */
  */
 // name of the language file that needs to be included
 // name of the language file that needs to be included
 $language_file = 'agenda';
 $language_file = 'agenda';
 $id=$_GET['id'];
 $id=$_GET['id'];
 
 
-if(strstr($id,','))
-{
+if(strstr($id,',')) {
 	$id=explode(',',$id);
 	$id=explode(',',$id);
 	$id=array_map('intval',$id);
 	$id=array_map('intval',$id);
 	$id=implode(',',$id);
 	$id=implode(',',$id);
-}
-else
-{
+} else {
 	$id=intval($id);
 	$id=intval($id);
 }
 }
 
 
@@ -23,8 +21,7 @@ require_once '../inc/global.inc.php';
 
 
 
 
 
 
-$TABLEAGENDA 		= Database::get_course_table(TABLE_AGENDA);
-
+$TABLEAGENDA 	= Database::get_course_table(TABLE_AGENDA);
 $sql 			= "SELECT * FROM $TABLEAGENDA WHERE id IN($id) ORDER BY start_date DESC";
 $sql 			= "SELECT * FROM $TABLEAGENDA WHERE id IN($id) ORDER BY start_date DESC";
 $result			= Database::query($sql);
 $result			= Database::query($sql);
 ?>
 ?>
@@ -73,11 +70,9 @@ while($row=Database::fetch_array($result))
 	echo $row['content'].'<hr size="1" noshade="noshade" />';
 	echo $row['content'].'<hr size="1" noshade="noshade" />';
 }
 }
 ?>
 ?>
-
 <br /><br />
 <br /><br />
-<center>
-<input type="button" value="<?php echo api_htmlentities(get_lang('Print'), ENT_QUOTES); ?>" onClick="javascript: window.print();" />
-</center>
-
+	<center>
+	<input type="button" value="<?php echo api_htmlentities(get_lang('Print'), ENT_QUOTES); ?>" onClick="javascript: window.print();" />
+	</center>
 </body>
 </body>
-</html>
+</html>