From 0f99a422862fb05a7f4fe70b659afd07648e891e Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 19 Dec 2012 19:29:56 +0100 Subject: [PATCH] Cleaning white spaces --- main/admin/group_add.php | 2 +- main/admin/session_add.php | 102 +++++++------- main/dropbox/dropbox_functions.inc.php | 55 ++++---- main/forum/forumfunction.inc.php | 185 ++++++++++++------------- 4 files changed, 171 insertions(+), 173 deletions(-) diff --git a/main/admin/group_add.php b/main/admin/group_add.php index 5099e9486a..274c5e6423 100644 --- a/main/admin/group_add.php +++ b/main/admin/group_add.php @@ -132,7 +132,7 @@ if( $form->validate()) { else { $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $_configuration['root_web'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); } - @api_mail($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin); + api_mail_html($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin); }*/ Security::clear_token(); diff --git a/main/admin/session_add.php b/main/admin/session_add.php index e27cd7ef2e..5152ebeac9 100644 --- a/main/admin/session_add.php +++ b/main/admin/session_add.php @@ -23,7 +23,7 @@ $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Platf $interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList')); $htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; $htmlHeadXtra[] = api_get_jquery_libraries_js(array('jquery-ui-i18n')); $htmlHeadXtra = api_get_datetime_picker_js($htmlHeadXtra); @@ -38,14 +38,14 @@ if (isset($_GET['id'])) { $add_coach = null; if ($id) { - $tool_name = get_lang('EditSession'); - SessionManager::protect_session_edit($id); - $session_info = api_get_session_info($id); + $tool_name = get_lang('EditSession'); + SessionManager::protect_session_edit($id); + $session_info = api_get_session_info($id); if (!empty($session_info['id_coach'])) { - $user_info = api_get_user_info($session_info['id_coach']); + $user_info = api_get_user_info($session_info['id_coach']); $add_coach = '$("#coach_id").trigger("addItem", [{"title": "'.$user_info['complete_name'].'", "value": "'.$session_info['id_coach'].'"}]);'; } - $button = get_lang('Update'); + $button = get_lang('Update'); } else { $tool_name = get_lang('AddSession'); $button = get_lang('Add'); @@ -58,26 +58,26 @@ $htmlHeadXtra[] =' function check() { $("#coach_id option:selected").each(function() { var id = $(this).val(); - var name = $(this).text(); + var name = $(this).text(); if (id != "" ) { - $.ajax({ + $.ajax({ async: false, - url: "'.$url.'&a=user_exists", + url: "'.$url.'&a=user_exists", data: "id="+id, - success: function(return_value) { - if (return_value == 0 ) { - alert("'.get_lang('UserDoesNotExist').'"); + success: function(return_value) { + if (return_value == 0 ) { + alert("'.get_lang('UserDoesNotExist').'"); //Deleting select option tag $("#coach_id").find("option").remove(); - + $(".holder li").each(function () { if ($(this).attr("rel") == id) { $(this).remove(); } }); } - }, - }); + }, + }); } }); } @@ -91,106 +91,106 @@ $(function() { input_min_size: 1, cache: false, complete_text:"'.get_lang('StartToType').'", - firstselected: false, + firstselected: false, onselect: check, filter_selected: true, - newel: true + newel: true }); - - '.$add_coach.' + + '.$add_coach.' $("#display_end_date").datetimepicker({ dateFormat: "yy-mm-dd", - hour: 9, + hour: 9, onSelect: function(selectedDateTime) { var start = $(this).datetimepicker("getDate"); - + if (!$("#access_end_date").val()) { $("#access_end_date").val(selectedDateTime); } - + if (!$("#coach_access_end_date").val()) { $("#coach_access_end_date").val(selectedDateTime); } } }); - + $("#display_start_date").datetimepicker({ dateFormat: "yy-mm-dd", - hour: 9, + hour: 9, onSelect: function(selectedDateTime) { var start = $(this).datetimepicker("getDate"); - + if (!$("#access_start_date").val()) { $("#access_start_date").val(selectedDateTime); } - + if (!$("#coach_access_start_date").val()) { $("#coach_access_start_date").val(selectedDateTime); } } }); - + $("#access_start_date").datetimepicker({ dateFormat: "yy-mm-dd", hour: 9, onSelect: function(selectedDateTime) { - var start = $(this).datetimepicker("getDate"); - //$("#access_end_date").val(selectedDateTime); + var start = $(this).datetimepicker("getDate"); + //$("#access_end_date").val(selectedDateTime); } }); - + access_start_date_content = $("#access_end_date").val(); - + if (access_start_date_content.length > 0) { $("#visibility_container").show(); } else { $("#visibility_container").hide(); } - + $("#access_end_date").datetimepicker({ dateFormat: "yy-mm-dd", - onSelect: function(selectedDateTime) { + onSelect: function(selectedDateTime) { $("#visibility_container").show(); } }); - - $("#access_end_date").on("change", function() { + + $("#access_end_date").on("change", function() { content = $(this).val(); if (content.length > 0) { $("#visibility_container").show(); } else { $("#visibility_container").hide(); } - + }); - + $("#coach_access_start_date").datetimepicker({ dateFormat: "yy-mm-dd", hour: 9, onSelect: function(selectedDateTime) { - var start = $(this).datetimepicker("getDate"); + var start = $(this).datetimepicker("getDate"); //$("#coach_access_end_date").val(selectedDateTime); } }); - + $("#coach_access_end_date").datetimepicker({ dateFormat: "yy-mm-dd" }); var value = 1; - $("#advanced_parameters").on("click", function() { - $("#options").toggle(function() { + $("#advanced_parameters").on("click", function() { + $("#options").toggle(function() { if (value == 1) { - $("#advanced_parameters").addClass("btn-hide"); + $("#advanced_parameters").addClass("btn-hide"); value = 0; } else { - $("#advanced_parameters").removeClass("btn-hide"); + $("#advanced_parameters").removeClass("btn-hide"); value = 1; } }); }); - + }); '; @@ -201,7 +201,7 @@ $form->addElement('header', $tool_name); $form->addElement('text', 'name', get_lang('SessionName'), array('class' => 'span6')); $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); -if (empty($id)) { +if (empty($id)) { $form->addRule('name', get_lang('SessionNameAlreadyExists'), 'callback', 'check_session_name'); } else { $form->addElement('hidden', 'id', $id); @@ -218,7 +218,7 @@ $form->addElement('html',''); - + $form->addElement('button', 'submit', $button); if (!empty($session_info)) { @@ -270,7 +270,7 @@ if (!empty($session_info)) { $session_info['access_start_date'] = api_get_local_time($session_info['access_start_date'], null, null, true); $session_info['access_end_date'] = api_get_local_time($session_info['access_end_date'], null, null, true); $session_info['coach_access_start_date'] = api_get_local_time($session_info['coach_access_start_date'], null, null, true); - $session_info['coach_access_end_date'] = api_get_local_time($session_info['coach_access_end_date'], null, null, true); + $session_info['coach_access_end_date'] = api_get_local_time($session_info['coach_access_end_date'], null, null, true); $form->setDefaults($session_info); } @@ -281,7 +281,7 @@ if ($form->validate()) { header('Location: resume_session.php?id_session='.$params['id']); exit; } else { - $session_id = SessionManager::add($params); + $session_id = SessionManager::add($params); if ($session_id) { // integer => no error on session creation header('Location: add_courses_to_session.php?id_session='.$session_id.'&add=true&msg='); @@ -290,8 +290,8 @@ if ($form->validate()) { } } -function check_session_name($name) { - $session = SessionManager::get_session_by_name($name); +function check_session_name($name) { + $session = SessionManager::get_session_by_name($name); return empty($session) ? true : false; } diff --git a/main/dropbox/dropbox_functions.inc.php b/main/dropbox/dropbox_functions.inc.php index 21e366a534..a6c6ee6e38 100644 --- a/main/dropbox/dropbox_functions.inc.php +++ b/main/dropbox/dropbox_functions.inc.php @@ -37,10 +37,10 @@ function handle_multiple_actions() { // STEP 2: at least one file has to be selected. If not we return an error message $ids = Request::get('id', array()); - if(count($ids)>0){ + if(count($ids)>0){ $checked_file_ids = $_POST['id']; } - else{ + else{ foreach ($_POST as $key => $value) { if (strstr($value, $part.'_') AND $key != 'view_received_category' AND $key != 'view_sent_category') { $checked_files = true; @@ -112,11 +112,11 @@ function delete_category($action, $id, $user_id = null) { global $dropbox_cnf; global $is_courseAdmin, $is_courseTutor; - + if (empty($user_id)) { $user_id = api_get_user_id(); } - + $cat = get_dropbox_category($id); if (count($cat)==0) { return false; } if ($cat['user_id'] != $user_id && !api_is_platform_admin($user_id)) { @@ -199,7 +199,7 @@ function store_move($id, $target, $part) { $course_id = api_get_course_int_id(); if ((isset($id) AND $id != '') AND (isset($target) AND $target != '') AND (isset($part) AND $part != '')) { - + if ($part == 'received') { $sql = "UPDATE ".$dropbox_cnf["tbl_post"]." SET cat_id='".Database::escape_string($target)."' WHERE c_id = $course_id AND dest_user_id='".Database::escape_string($_user['user_id'])."' @@ -309,7 +309,7 @@ function get_dropbox_categories($filter = '') { function get_dropbox_category($id) { global $dropbox_cnf; $course_id = api_get_course_int_id(); - if (empty($id) or $id != intval($id)) { return array(); } + if (empty($id) or $id != intval($id)) { return array(); } $sql = "SELECT * FROM ".$dropbox_cnf['tbl_category']." WHERE c_id = $course_id AND cat_id='".$id."'"; $res = Database::query($sql); if ($res === false) { @@ -522,8 +522,8 @@ function display_add_form() { } $complete_user_list_for_dropbox = TableSort::sort_table($complete_user_list_for_dropbox, 'lastcommafirst'); } - - echo ''; /* Create the options inside the select box: List all selected users their user id as value and a name string as display @@ -645,14 +645,14 @@ function removeUnusedFiles() { // select all files that aren't referenced anymore $sql = "SELECT DISTINCT f.id, f.filename FROM " . dropbox_cnf('tbl_file') . " f - LEFT JOIN " . dropbox_cnf('tbl_person') . " p + LEFT JOIN " . dropbox_cnf('tbl_person') . " p ON (f.id = p.file_id) WHERE p.user_id IS NULL AND - f.c_id = $course_id + f.c_id = $course_id "; $result = Database::query($sql); while ($res = Database::fetch_array($result)) { - + //delete the selected files from the post and file tables $sql = "DELETE FROM " . dropbox_cnf('tbl_post') . " WHERE c_id = $course_id AND file_id = '" . $res['id'] . "'"; Database::query($sql); @@ -684,9 +684,9 @@ function getUserOwningThisMailing($mailingPseudoId, $owner = 0, $or_die = '') { $sql = "SELECT f.uploader_id FROM " . $dropbox_cnf['tbl_file'] . " f LEFT JOIN " . $dropbox_cnf['tbl_post'] . " p ON (f.id = p.file_id AND f.c_id = $course_id AND p.c_id = $course_id) - WHERE - p.dest_user_id = '" . $mailingPseudoId . "' AND - p.c_id = $course_id + WHERE + p.dest_user_id = '" . $mailingPseudoId . "' AND + p.c_id = $course_id "; $result = Database::query($sql); @@ -806,9 +806,9 @@ function store_add_dropbox() { if (!is_uploaded_file($dropbox_filetmpname)) { // check user fraud : no clean error msg. return get_lang('TheFileIsNotUploaded'); } - + $upload_ok = process_uploaded_file($_FILES['file'], true); - + if (!$upload_ok) { return null; } @@ -819,7 +819,7 @@ function store_add_dropbox() { $dropbox_filename = replace_dangerous_char($dropbox_filename); // Transform any .php file in .phps fo security $dropbox_filename = php2phps($dropbox_filename); - + //filter extension if (!filter_extension($dropbox_filename)) { return get_lang('UplUnableToSaveFileFilteredExtension'); @@ -876,7 +876,8 @@ function store_add_dropbox() { if ($b_send_mail) { foreach ($new_work_recipients as $recipient_id) { $recipent_temp = UserManager :: get_user_info_by_id($recipient_id); - @api_mail(api_get_person_name($recipent_temp['firstname'].' '.$recipent_temp['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $recipent_temp['email'], + api_mail_html( + api_get_person_name($recipent_temp['firstname'].' '.$recipent_temp['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $recipent_temp['email'], get_lang('NewDropboxFileUploaded'), get_lang('NewDropboxFileUploadedContent').' '.api_get_path(WEB_CODE_PATH).'dropbox/index.php?cidReq='.$_course['sysCode']."\n\n".api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS)."\n". get_lang('Email') ." : ".$_user['mail'], api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_user['mail']); } @@ -957,7 +958,7 @@ function format_feedback($feedback) { * @version march 2006 */ function feedback_form() { - $return = get_lang('AddNewFeedback').'
'; + $return = get_lang('AddNewFeedback').'
'; $number_users_who_see_file = check_if_file_exist($_GET['id']); if ($number_users_who_see_file) { $token = Security::get_token(); @@ -976,14 +977,14 @@ function user_can_download_file($id, $user_id) { $course_id = api_get_course_int_id(); $id = intval($id); $user_id = intval($user_id); - - $sql = "SELECT file_id FROM ".$dropbox_cnf['tbl_person']." WHERE c_id = $course_id AND user_id = $user_id AND file_id = ".$id; + + $sql = "SELECT file_id FROM ".$dropbox_cnf['tbl_person']." WHERE c_id = $course_id AND user_id = $user_id AND file_id = ".$id; $result = Database::query($sql); $number_users_who_see_file = Database::num_rows($result); - + $sql = "SELECT file_id FROM ".$dropbox_cnf["tbl_post"]." WHERE c_id = $course_id AND dest_user_id = $user_id AND file_id = ".$id; $result = Database::query($sql); - $count = Database::num_rows($result); + $count = Database::num_rows($result); return $number_users_who_see_file > 0 || $count > 0; } @@ -993,13 +994,13 @@ function check_if_file_exist($id) { global $dropbox_cnf; $id = intval($id); $course_id = api_get_course_int_id(); - $sql = "SELECT file_id FROM ".$dropbox_cnf['tbl_person']." WHERE c_id = $course_id AND file_id = ".$id; + $sql = "SELECT file_id FROM ".$dropbox_cnf['tbl_person']." WHERE c_id = $course_id AND file_id = ".$id; $result = Database::query($sql); $number_users_who_see_file = Database::num_rows($result); - + $sql = "SELECT file_id FROM ".$dropbox_cnf["tbl_post"]." WHERE c_id = $course_id AND file_id = ".$id; $result = Database::query($sql); - $count = Database::num_rows($result); + $count = Database::num_rows($result); return $number_users_who_see_file > 0 || $count > 0; } @@ -1058,7 +1059,7 @@ function zip_download($array) { ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id) INNER JOIN ".$dropbox_cnf['tbl_post']." post ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id) - WHERE file.id IN (".implode(', ',$array).") AND + WHERE file.id IN (".implode(', ',$array).") AND file.id = person.file_id AND (person.user_id = '".api_get_user_id()."' OR post.dest_user_id = '".api_get_user_id()."' ) "; $result = Database::query($sql); diff --git a/main/forum/forumfunction.inc.php b/main/forum/forumfunction.inc.php index 36d8fed169..ba553772bb 100644 --- a/main/forum/forumfunction.inc.php +++ b/main/forum/forumfunction.inc.php @@ -210,14 +210,14 @@ function show_add_forum_form($inputvalues = array(), $lp_id) { $form->addElement('select', 'forum_category', get_lang('InForumCategory'), $forum_categories_titles); $form->applyFilter('forum_category', 'html_filter'); - if ($_course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD) { + if ($_course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD) { // This is for horizontal $group = array(); $group[] =$form->createElement('radio', 'allow_anonymous', null, get_lang('Yes'), 1); $group[] =$form->createElement('radio', 'allow_anonymous', null, get_lang('No'), 0); $form->addGroup($group, 'allow_anonymous_group', get_lang('AllowAnonymousPosts'), ' '); } - + $form->addElement('advanced_settings', ' '.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedParameters').'',''); $form->addElement('html', '