From 4c1f1bde7887115d58167d373a2a936d2fbad1f4 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 3 Mar 2010 10:43:27 -0500 Subject: [PATCH 1/5] Minor - cleaning code --- main/announcements/announcements.php | 33 +++++++++++----------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/main/announcements/announcements.php b/main/announcements/announcements.php index b586288ced..86f383f98d 100755 --- a/main/announcements/announcements.php +++ b/main/announcements/announcements.php @@ -1,5 +1,5 @@ , UGent Internship * @author Patrick Cool , Ghent University: code cleaning @@ -33,7 +33,7 @@ $nameTools = get_lang('Announcement'); //session if(isset($_GET['id_session'])) { - $_SESSION['id_session'] = Security::remove_XSS($_GET['id_session']); + $_SESSION['id_session'] = intval($_GET['id_session']); } /* ------------ ACCESS RIGHTS ------------ */ @@ -276,16 +276,15 @@ if($surveyid) } if (!empty($_SESSION['toolgroup'])){ - $_clean['toolgroup']=(int)$_SESSION['toolgroup']; - $group_properties = GroupManager :: get_group_properties($_clean['toolgroup']); + $_clean_toolgroup=intval($_SESSION['toolgroup']); + $group_properties = GroupManager :: get_group_properties($_clean_toolgroup); $interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups')); - $interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$_SESSION['toolgroup'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')'); + $interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$_clean_toolgroup, "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')'); } else { if($surveyid) { - - $interbreadcrumb[] = array ("url" => "../survey/survey_list.php?cidReq=$cidReq", "name" => get_lang('Survey')); - $nameTools = get_lang('PublishSurvey'); - }else { + $interbreadcrumb[] = array ("url" => "../survey/survey_list.php?cidReq=$cidReq", "name" => get_lang('Survey')); + $nameTools = get_lang('PublishSurvey'); + } else { $nameTools = get_lang('Announcement'); $nameTools12 = get_lang('PublishSurvey'); } @@ -305,9 +304,7 @@ if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') { //we are not in the learning path Display::Display_header($nameTools,"Announcements"); -} -else -{ +} else { //we are in the learning path, only display central data and change css $display_title_list = false; $display_announcement_list = false; @@ -414,7 +411,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed $display_form = true; // RETRIEVE THE CONTENT OF THE ANNOUNCEMENT TO MODIFY - $id = intval(addslashes($_GET['id'])); + $id = intval($_GET['id']); if (!api_is_course_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $id)) { $sql="SELECT * FROM $tbl_announcement WHERE id='$id'"; @@ -424,8 +421,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed $edit_attachment = edit_announcement_attachment_file($last_id, $_FILES['user_upload'], $file_comment); if ($myrow) { $announcement_to_modify = $myrow['id']; - $content_to_modify = $myrow['content']; - + $content_to_modify = $myrow['content']; $title_to_modify = $myrow['title']; if ($originalresource!=="no") { @@ -437,12 +433,9 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed $display_announcement_list = false; } - if ($to=="everyone" OR !empty($_SESSION['toolgroup'])) - { + if ($to=="everyone" OR !empty($_SESSION['toolgroup'])) { $_SESSION['select_groupusers']="hide"; - } - else - { + } else { $_SESSION['select_groupusers']="show"; } } From a6e3580d6a7d6d4d1a2886163e082ce83eef60a0 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 3 Mar 2010 10:48:30 -0500 Subject: [PATCH 2/5] Minor - cleaning code --- main/announcements/announcements.inc.php | 31 +++--------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/main/announcements/announcements.inc.php b/main/announcements/announcements.inc.php index d4dd762cea..3e3f20110a 100755 --- a/main/announcements/announcements.inc.php +++ b/main/announcements/announcements.inc.php @@ -1,25 +1,5 @@ Date: Wed, 3 Mar 2010 11:27:58 -0500 Subject: [PATCH 3/5] Fixing sticky footer --- main/css/blue_lagoon/default.css | 6 +++--- main/css/chamilo/default.css | 9 +++++---- main/css/chamilo_green/default.css | 11 ++++++----- main/css/chamilo_red/default.css | 12 +++++++----- main/css/dokeos_blue/default.css | 6 +++--- main/css/public_admin/default.css | 6 +++--- 6 files changed, 27 insertions(+), 23 deletions(-) diff --git a/main/css/blue_lagoon/default.css b/main/css/blue_lagoon/default.css index 5395677bf6..f9a0530418 100755 --- a/main/css/blue_lagoon/default.css +++ b/main/css/blue_lagoon/default.css @@ -21,7 +21,7 @@ body { min-height: 100%; height: auto !important; height: 100%; - margin: 0 auto -3em; + margin: 0 auto -5em; } #outerframe { position: relative; /* do not remove, fixes a bug in IE */ @@ -361,13 +361,13 @@ select, input[type=checkbox], input[type=radio], input[type=button], input[type= background-repeat:repeat-x; font-size: 12px; color:#ffffff; - min-height: 50px; + height: 4em; /* Do not change this value */ overflow:hidden; width: 100%; padding-bottom:10px; } .push { - height: 3em; /* Very important */ + height: 5em; /* Very important */ } #footer .copyright { float: right; diff --git a/main/css/chamilo/default.css b/main/css/chamilo/default.css index f23f410bb2..79ec44c330 100644 --- a/main/css/chamilo/default.css +++ b/main/css/chamilo/default.css @@ -18,12 +18,12 @@ body { background-color: #fff; height: 100%; /* stick */ } - +/* Sticky footer*/ #wrapper{ min-height: 100%; height: auto !important; height: 100%; - margin: 0 auto -8em; + margin: 0 auto -9em; } input[type="text"]:focus, input[type="password"]:focus, textarea:focus { @@ -580,13 +580,14 @@ margin-top:0; background-repeat:repeat-x; font-size: 12px; color:#ffffff; - min-height: 100px; + height: 8em; /* Do not change this value */ overflow:hidden; width: 100%; padding-bottom:10px; } +/* Sticky footer*/ .push { - height: 8em; /* Very important */ + height: 10em; /* Very important */ } #footer .copyright { float: right; diff --git a/main/css/chamilo_green/default.css b/main/css/chamilo_green/default.css index 8c9b3d0ff8..6d23187ab9 100644 --- a/main/css/chamilo_green/default.css +++ b/main/css/chamilo_green/default.css @@ -18,12 +18,12 @@ body { background-color: #fff; height: 100%; /* stick */ } - +/* Sticky footer*/ #wrapper{ min-height: 100%; height: auto !important; height: 100%; - margin: 0 auto -8em; + margin: 0 auto -9em; } input[type="text"]:focus, input[type="password"]:focus, textarea:focus { @@ -583,17 +583,18 @@ margin-top:0; background-repeat:repeat-x; font-size: 12px; color:#ffffff; - min-height: 100px; + height: 8em; /* Do not change this value */ overflow:hidden; width: 100%; padding-bottom:10px; } +/* Sticky footer*/ .push { - height: 8em; /* Very important */ + height: 10em; /* Very important */ } #footer .copyright { float: right; - padding-top:60px; + padding-top:53px; margin-right:5%; background-color: #79aa0b; background-image: url(images/bg-footer.gif); diff --git a/main/css/chamilo_red/default.css b/main/css/chamilo_red/default.css index be54fba601..2dc8787764 100644 --- a/main/css/chamilo_red/default.css +++ b/main/css/chamilo_red/default.css @@ -19,11 +19,12 @@ body { height: 100%; /* stick */ } -#wrapper{ +/* Sticky footer*/ +#wrapper { min-height: 100%; height: auto !important; height: 100%; - margin: 0 auto -8em; + margin: 0 auto -9em; /* Do not change this value */ } input[type="text"]:focus, input[type="password"]:focus, textarea:focus { @@ -583,17 +584,18 @@ margin-top:0; background-repeat:repeat-x; font-size: 12px; color:#ffffff; - min-height: 100px; + height: 8em; /* Do not change this value */ overflow:hidden; width: 100%; padding-bottom:10px; } +/* Sticky footer*/ .push { - height: 8em; /* Very important */ + height: 10em; /* Do not change this value */ } #footer .copyright { float: right; - padding-top:60px; + padding-top:53px; margin-right:5%; background-color: #a90a0e; background-image: url(images/bg-footer.gif); diff --git a/main/css/dokeos_blue/default.css b/main/css/dokeos_blue/default.css index 722384162c..5f0e47e88d 100755 --- a/main/css/dokeos_blue/default.css +++ b/main/css/dokeos_blue/default.css @@ -19,7 +19,7 @@ body { min-height: 100%; height: auto !important; height: 100%; - margin: 0 auto -3em; + margin: 0 auto -5em; } #outerframe { position: relative; /* do not remove, fixes a bug in IE */ @@ -347,13 +347,13 @@ input[type="text"]:focus, input[type="password"]:focus, textarea:focus { background-repeat:repeat-x; font-size: 12px; color:#ffffff; - min-height: 50px; + height: 4em; /* Do not change this value */ overflow:hidden; width: 100%; padding-bottom:10px; } .push { - height: 3em; /* Very important */ + height: 5em; /* Very important */ } #footer .copyright { float: right; diff --git a/main/css/public_admin/default.css b/main/css/public_admin/default.css index c89fb8bf1f..dda1f38713 100755 --- a/main/css/public_admin/default.css +++ b/main/css/public_admin/default.css @@ -22,7 +22,7 @@ body { min-height: 100%; height: auto !important; height: 100%; - margin: 0 auto -8em; + margin: 0 auto -9em; } #outerframe { position: relative; /* do not remove, fixes a bug in IE */ @@ -411,13 +411,13 @@ select, input[type=checkbox], input[type=radio], input[type=button], input[type= background-repeat:repeat-x; font-size: 12px; color:#ffffff; - min-height: 100px; + height: 8em; /* Do not change this value */ overflow:hidden; width: 100%; padding-bottom:10px; } .push { - height: 8em; /* Very important */ + height: 9em; /* Very important */ } #footer .copyright { float: right; From 13f5f5babcc7b92534e2b9cb51db17822f1dac97 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 3 Mar 2010 12:15:20 -0500 Subject: [PATCH 4/5] Changing stylesheet preview UI from radio buttons to a select --- main/admin/settings.lib.php | 61 ++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/main/admin/settings.lib.php b/main/admin/settings.lib.php index 8e8a19915a..b0d156ce36 100644 --- a/main/admin/settings.lib.php +++ b/main/admin/settings.lib.php @@ -192,6 +192,7 @@ function display_plugin_cell($location, $plugin_info, $current_plugin, $active_p /** * This function allows the platform admin to choose the default stylesheet * @author Patrick Cool , Ghent University + * @author Julio Montoya , Chamilo */ function handle_stylesheets() { @@ -273,41 +274,44 @@ function handle_stylesheets() // Preview of the stylesheet echo '
'; +?> + +'; - + echo '
"; + if ($is_style_changeable) { + $list_of_styles[$style_dir] = ""; + $list_of_names[$style_dir] = $show_name; + //echo ""; + //echo ''.$show_name.''; + } else { echo ''.$show_name.''; } - else - echo ''.$show_name.''; - //echo ''; echo "
\n"; $counter++; } @@ -315,8 +319,15 @@ function handle_stylesheets() } @closedir($handle); } - if ($is_style_changeable) - { + //Sort styles in alphabetical order + asort($list_of_names); + foreach($list_of_names as $style_dir=>$item) { + echo $list_of_styles[$style_dir]; + } + + echo '
'; + //var_dump($list_of_names); + if ($is_style_changeable){ echo ''; } } From 0dcad12793e78b639179b6afb6b8affc5635cb6d Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 3 Mar 2010 12:22:08 -0500 Subject: [PATCH 5/5] Fixes http://chamilo.org/node/143 work.php deletes all homeworks --- main/work/work.lib.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main/work/work.lib.php b/main/work/work.lib.php index f3b7067928..edc8474377 100755 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -1041,18 +1041,18 @@ function del_dir($base_work_dir,$dir,$id) { if(empty($dir) or $dir=='/') { return -1; } - $check = Security::check_abs_path($base_work_dir.$dir, $base_work_dir); + $check = Security::check_abs_path($base_work_dir.$dir,$base_work_dir); if (!$check || !is_dir($base_work_dir.$dir)) { return -1; } $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); - $sql = "DELETE FROM $table WHERE url LIKE BINARY 'work/".$dir."/%'"; + $sql = "DELETE FROM $table WHERE url BINARY 'work/".$dir."/%'"; $res = Database::query($sql); //delete from DB the directories - $sql = "DELETE FROM $table WHERE filetype = 'folder' AND url LIKE BINARY '/".$dir."%'"; + $sql = "DELETE FROM $table WHERE filetype = 'folder' AND url BINARY '/".$dir."%'"; $res = Database::query($sql); - + require_once(api_get_path(LIBRARY_PATH).'/fileManage.lib.php'); $new_dir= $dir.'_DELETED_'.$id; if (api_get_setting('permanently_remove_deleted_files') == 'true'){ @@ -1064,6 +1064,7 @@ function del_dir($base_work_dir,$dir,$id) { } } + /** * Get the path of a document in the student_publication table (path relative to the course directory) * @param integer Element ID