diff --git a/main/admin/languages.php b/main/admin/languages.php index 2207d4fea6..c1c8d774dd 100755 --- a/main/admin/languages.php +++ b/main/admin/languages.php @@ -32,7 +32,7 @@ if (isset($_POST['sent_http_request'])) { SubLanguageManager::make_unavailable_language($_POST['id']); echo 'set_hidden'; } else { - echo 'confirm:' . intval($_POST['id']); + echo 'confirm:'.intval($_POST['id']); } } } @@ -54,21 +54,21 @@ $htmlHeadXtra[] = ''; + echo ''; return; } @@ -363,7 +363,7 @@ function downloadMP3_google($filepath, $dir) $proxySettings = api_get_configuration_value('proxy_settings'); $key = api_get_configuration_value('translate_app_google_key'); - $url = "https://www.googleapis.com/language/translate/v2?key=$key&" . $clean_lang . "&target=$clean_lang&q=" . urlencode($clean_text) . ""; + $url = "https://www.googleapis.com/language/translate/v2?key=$key&".$clean_lang."&target=$clean_lang&q=".urlencode($clean_text).""; if (empty($proxySettings)) { $content = file_get_contents($url); @@ -383,7 +383,7 @@ function downloadMP3_google($filepath, $dir) $relativeUrlPath = $dir; $doc_id = add_document( $_course, - $relativeUrlPath . $audio_filename, + $relativeUrlPath.$audio_filename, 'file', filesize($documentPath), $audio_title @@ -402,7 +402,7 @@ function downloadMP3_google($filepath, $dir) ); Display::display_confirmation_message(get_lang('DocumentCreated')); //return to location - echo ''; + echo ''; } /** @@ -415,10 +415,10 @@ function downloadMP3_google($filepath, $dir) */ function downloadMP3_pediaphon($filepath, $dir) { - $location = 'create_audio.php?' . api_get_cidreq() . '&id=' . intval($_POST['id']) . '&service=pediaphon'; + $location = 'create_audio.php?'.api_get_cidreq().'&id='.intval($_POST['id']).'&service=pediaphon'; //security if (!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) { - echo ''; + echo ''; return; } $_course = api_get_course_info(); @@ -428,33 +428,33 @@ function downloadMP3_pediaphon($filepath, $dir) $clean_text = trim($_POST['text']); $clean_voices = Security::remove_XSS($_POST['voices']); if (empty($clean_title) || empty($clean_text) || empty($clean_voices)) { - echo ''; + echo ''; return; } $clean_title = Security::remove_XSS($clean_title); $clean_title = Database::escape_string($clean_title); - $clean_title = str_replace(' ', '_', $clean_title);//compound file names + $clean_title = str_replace(' ', '_', $clean_title); //compound file names $clean_text = Security::remove_XSS($clean_text); $clean_lang = Security::remove_XSS($_POST['lang']); $clean_speed = Security::remove_XSS($_POST['speed']); $extension = 'mp3'; - $audio_filename = $clean_title . '.' . $extension; + $audio_filename = $clean_title.'.'.$extension; $audio_title = str_replace('_', ' ', $clean_title); //prevent duplicates - if (file_exists($filepath . '/' . $clean_title . '.' . $extension)) { + if (file_exists($filepath.'/'.$clean_title.'.'.$extension)) { $i = 1; - while (file_exists($filepath . '/' . $clean_title . '_' . $i . '.' . $extension)) { + while (file_exists($filepath.'/'.$clean_title.'_'.$i.'.'.$extension)) { $i++; } - $audio_filename = $clean_title . '_' . $i . '.' . $extension; - $audio_title = $clean_title . '_' . $i . '.' . $extension; + $audio_filename = $clean_title.'_'.$i.'.'.$extension; + $audio_title = $clean_title.'_'.$i.'.'.$extension; $audio_title = str_replace('_', ' ', $audio_title); } - $documentPath = $filepath . '/' . $audio_filename; + $documentPath = $filepath.'/'.$audio_filename; $clean_text = api_replace_dangerous_char($clean_text); //adding the file @@ -463,17 +463,17 @@ function downloadMP3_pediaphon($filepath, $dir) $url_pediaphon = 'http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice.cgi'; $find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/(.*)\.mp3\"/'; } else { - $url_pediaphon = 'http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_' . $clean_lang . '.cgi';//en, es, fr - $find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/' . $clean_lang . '\/(.*)\.mp3\"/'; + $url_pediaphon = 'http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_'.$clean_lang.'.cgi'; //en, es, fr + $find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/'.$clean_lang.'\/(.*)\.mp3\"/'; } - $data = "stimme=" . $clean_voices . "&inputtext=" . $clean_text . "&speed=" . $clean_speed . "&go=speak"; + $data = "stimme=".$clean_voices."&inputtext=".$clean_text."&speed=".$clean_speed."&go=speak"; $opts = array( 'http' => array( 'method' => 'POST', 'header' => "Content-Type: application/x-www-form-urlencoded\r\n", - "Content-Length: " . strlen($data) . "\r\n", + "Content-Length: ".strlen($data)."\r\n", 'content' => $data ) ); @@ -517,5 +517,5 @@ function downloadMP3_pediaphon($filepath, $dir) ); Display::display_confirmation_message(get_lang('DocumentCreated')); //return to location - echo ''; + echo ''; } diff --git a/main/exercise/hotpotatoes.lib.php b/main/exercise/hotpotatoes.lib.php index 5f4ae8830c..90fa4ccc76 100755 --- a/main/exercise/hotpotatoes.lib.php +++ b/main/exercise/hotpotatoes.lib.php @@ -66,7 +66,7 @@ function GetQuizName($fname, $fpath) if ($title == '') { $title = basename($fname); } - return (string)$title; + return (string) $title; } /** @@ -177,7 +177,7 @@ function GetImgName($imgtag) if ($src == '') { return ''; } else { - $tmp_src = basename($src) ; + $tmp_src = basename($src); if ($tmp_src == '') { return $src; } else { @@ -199,7 +199,7 @@ function GetSrcName($imgtag) { // Select src tag from img tag. $match = array(); - preg_match("|(src=\".*\" )|U", $imgtag, $match); //src + preg_match("|(src=\".*\" )|U", $imgtag, $match); //src list($key, $srctag) = each($match); $src = substr($srctag, 5, (strlen($srctag) - 7)); if (stristr($src, 'http') === false) { @@ -231,8 +231,8 @@ function GetImgParams($fname, $fpath, &$imgparams, &$imgcount) while (list($key, $imgtag) = each($match)) { $imgname = GetImgName($imgtag); if ($imgname != '' && !in_array($imgname, $imgparams)) { - array_push($imgparams, $imgname); // name (+ type) of the images in the html test - $imgcount = $imgcount + 1; // number of images in the html test + array_push($imgparams, $imgname); // name (+ type) of the images in the html test + $imgcount = $imgcount + 1; // number of images in the html test } } } @@ -408,7 +408,7 @@ function CheckSubFolder($path) if ($file != '..') { $full_name = $folder.'/'.$file; if (is_dir($full_name)) { - $dflag = 1; // first directory + $dflag = 1; // first directory } } } diff --git a/main/gradebook/gradebook_edit_result.php b/main/gradebook/gradebook_edit_result.php index d9bfd8d485..32b1399bad 100755 --- a/main/gradebook/gradebook_edit_result.php +++ b/main/gradebook/gradebook_edit_result.php @@ -8,7 +8,7 @@ require_once __DIR__.'/../inc/global.inc.php'; api_block_anonymous_users(); GradebookUtils::block_students(); -$select_eval=Security::remove_XSS($_GET['selecteval']); +$select_eval = Security::remove_XSS($_GET['selecteval']); if (empty($select_eval)) { api_not_allowed(); } @@ -34,7 +34,7 @@ if ($edit_result_form->validate()) { /** @var Result $result */ $result = $resultedit[0]; - if (empty($score)){ + if (empty($score)) { $score = 0; } $result->set_score(api_number_format($score, api_get_setting('gradebook_number_decimals'))); @@ -47,11 +47,11 @@ if ($edit_result_form->validate()) { $table = $edit_result_form->toHtml(); -$interbreadcrumb[] = array ( +$interbreadcrumb[] = array( 'url' => $_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook') ); -$interbreadcrumb[]= array ( +$interbreadcrumb[] = array( 'url' => 'gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq(), 'name' => get_lang('ViewResult') ); diff --git a/main/inc/ajax/record_audio_wami.ajax.php b/main/inc/ajax/record_audio_wami.ajax.php index d7cb87fa3f..ee9413bd33 100755 --- a/main/inc/ajax/record_audio_wami.ajax.php +++ b/main/inc/ajax/record_audio_wami.ajax.php @@ -50,7 +50,7 @@ if ($ext != 'wav') { // Do not use here check Fileinfo method because return: text/plain $dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; -$saveDir = $dirBaseDocuments . $wamidir; +$saveDir = $dirBaseDocuments.$wamidir; if (!is_dir($saveDir)) { DocumentManager::createDefaultAudioFolder($_course); @@ -90,7 +90,7 @@ $output = true; ob_start(); // Strangely the file path changes with a double extension -copy($documentPath, $documentPath . '.wav'); +copy($documentPath, $documentPath.'.wav'); $documentData = DocumentManager::upload_document( $file, diff --git a/main/inc/lib/formvalidator/Element/receivers.php b/main/inc/lib/formvalidator/Element/receivers.php index 84e794b592..3e0f0ee117 100755 --- a/main/inc/lib/formvalidator/Element/receivers.php +++ b/main/inc/lib/formvalidator/Element/receivers.php @@ -43,9 +43,9 @@ class HTML_QuickForm_receivers extends HTML_QuickForm_group */ function _createElements() { - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); $this->_elements[0]->setChecked(true); - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')')); + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array('onclick' => 'javascript:receivers_show(\'receivers_to\')')); $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); $this->_elements[2]->setSelected($this->receivers_selected); } diff --git a/main/link/link_goto.php b/main/link/link_goto.php index 4a0b8d91f7..56a6f162b9 100755 --- a/main/link/link_goto.php +++ b/main/link/link_goto.php @@ -25,8 +25,8 @@ $linkUrl = html_entity_decode(Security::remove_XSS($linkInfo['url'])); // Launch event Event::event_link($linkId); -header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 +header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); // HTTP/1.0 +header("Pragma: no-cache"); // HTTP/1.0 header("Location: $linkUrl"); exit; diff --git a/main/lp/openoffice_text_document.class.php b/main/lp/openoffice_text_document.class.php index d7153da652..25aefd8512 100755 --- a/main/lp/openoffice_text_document.class.php +++ b/main/lp/openoffice_text_document.class.php @@ -121,7 +121,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument { $intro_content = api_substr($content, 0, api_strpos($content, $matches[0][0])); $items_to_create[get_lang('Introduction')] = $intro_content; - for ($i = 0; $i $page_content) { + foreach ($pages as $key => $page_content) { // For every pages, we create a new file. $key += 1; @@ -249,7 +249,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument { foreach ($specific_fields as $specific_field) { if (isset($_REQUEST[$specific_field['code']])) { $sterms = trim($_REQUEST[$specific_field['code']]); - $all_specific_terms .= ' '. $sterms; + $all_specific_terms .= ' '.$sterms; if (!empty($sterms)) { $sterms = explode(',', $sterms); foreach ($sterms as $sterm) { @@ -258,7 +258,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument { } } } - $page_content = $all_specific_terms .' '. $page_content; + $page_content = $all_specific_terms.' '.$page_content; $ic_slide->addValue('content', $page_content); // Add a comment to say terms separated by commas. $courseid = api_get_course_id(); @@ -269,7 +269,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument { SE_COURSE_ID => $courseid, SE_TOOL_ID => TOOL_LEARNPATH, SE_DATA => array('lp_id' => $lp_id, 'lp_item' => $previous, 'document_id' => $document_id), - SE_USER => (int)api_get_user_id(), + SE_USER => (int) api_get_user_id(), ); $ic_slide->xapian_data = serialize($xapian_data); $di->addChunk($ic_slide); @@ -312,7 +312,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument { $content = '
'.$content; } - $content = preg_replace('||i','
\\0', $content, -1, $count); + $content = preg_replace('||i', '\\0', $content, -1, $count); if ($count < 1) { $content = $content.''; } @@ -340,7 +340,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument { } } elseif ($img_width > $max_width - 10) { - $picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width-10).'"', $images[0][$key]); + $picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width - 10).'"', $images[0][$key]); $content = str_replace($images[0][$key], $picture_resized, $content); } } diff --git a/main/survey/ch_percentage.php b/main/survey/ch_percentage.php index e366c16ecb..f6f4f2d34a 100644 --- a/main/survey/ch_percentage.php +++ b/main/survey/ch_percentage.php @@ -21,7 +21,7 @@ class ch_percentage extends survey_question $options[$key] = $value; } - $name = 'question' . $questionData['question_id']; + $name = 'question'.$questionData['question_id']; $form->addSelect( $name, null, $options diff --git a/main/webservices/test.php b/main/webservices/test.php index 7331e51a02..0ab6ab2989 100755 --- a/main/webservices/test.php +++ b/main/webservices/test.php @@ -15,13 +15,13 @@ $serversys = api_get_path(SYS_CODE_PATH).'webservices/'; $script = isset($_POST['script']) ? $_POST['script'] : false; $function = isset($_POST['function']) ? $_POST['function'] : false; -$contact= $server.$script.'?wsdl'; +$contact = $server.$script.'?wsdl'; $client = new nusoap_client($contact); $err = $client->getError(); if ($err) { // Display the error - echo '

Constructor error

' . $err . '
'; + echo '

Constructor error

'.$err.'
'; // At this point, you know the call that follows will fail } $response = array(); @@ -37,8 +37,8 @@ if (!empty($function)) { $list = scandir($serversys); $scripts = array(); foreach ($list as $item) { - if (substr($item,0,1) == '.') { continue; } - if (substr($item,-8)=='soap.php') { + if (substr($item, 0, 1) == '.') { continue; } + if (substr($item, -8) == 'soap.php') { $scripts[] = $item; } } @@ -55,7 +55,7 @@ foreach ($scripts as $script) { ?>
-
+

diff --git a/main/work/work_list.php b/main/work/work_list.php index 6278b83260..c1ec700a81 100755 --- a/main/work/work_list.php +++ b/main/work/work_list.php @@ -2,7 +2,7 @@ /* For licensing terms, see /license.txt */ require_once __DIR__.'/../inc/global.inc.php'; -$current_course_tool = TOOL_STUDENTPUBLICATION; +$current_course_tool = TOOL_STUDENTPUBLICATION; api_protect_course_script(true); @@ -74,7 +74,7 @@ if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !api_is_in get_lang('UploadMyAssignment'), null, ICON_SIZE_MEDIUM - ) . get_lang('UploadMyAssignment'), + ).get_lang('UploadMyAssignment'), $url, array('class'=>'btn-toolbar') ); @@ -125,10 +125,10 @@ if (!api_is_invitee()) { ); $column_model = array( - array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'), - array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'), + array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'), + array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'), array('name'=>'qualification', 'index'=>'qualification', 'width'=>'30', 'align'=>'center', 'search' => 'true'), - array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'), + array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'), array('name'=>'qualificator_id', 'index'=>'qualificator_id', 'width'=>'20', 'align'=>'left', 'search' => 'true'), array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') ); @@ -144,11 +144,11 @@ if (!api_is_invitee()) { ); $column_model = array( - array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'), - array('name'=>'title', 'index'=>'title', 'width'=>'60', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"), - array('name'=>'qualification', 'index'=>'qualification', 'width'=>'30', 'align'=>'center', 'search' => 'true'), + array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'), + array('name'=>'title', 'index'=>'title', 'width'=>'60', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"), + array('name'=>'qualification', 'index'=>'qualification', 'width'=>'30', 'align'=>'center', 'search' => 'true'), array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true', 'sortable'=>'false'), - array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') + array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') ); }