فهرست منبع

Minor - format code

jmontoyaa 7 سال پیش
والد
کامیت
4c5ebe3ce5

+ 13 - 12
main/announcements/download.php

@@ -1,12 +1,12 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- *	This file is responsible for  passing requested documents to the browser.
- *	Html files are parsed to fix a few problems with URLs,
- *	but this code will hopefully be replaced soon by an Apache URL
- *	rewrite mechanism.
+ * This file is responsible for  passing requested documents to the browser.
+ * Html files are parsed to fix a few problems with URLs,
+ * but this code will hopefully be replaced soon by an Apache URL
+ * rewrite mechanism.
  *
- *	@package chamilo.announcements
+ * @package chamilo.announcements
  */
 
 session_cache_limiter('nocache');
@@ -28,7 +28,7 @@ $doc_url = str_replace('///', '&', $doc_url);
 $doc_url = str_replace(' ', '+', $doc_url);
 $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
 
-if (strpos($doc_url, '../') OR strpos($doc_url, '/..')) {
+if (strpos($doc_url, '../') || strpos($doc_url, '/..')) {
     $doc_url = '';
 }
 
@@ -50,26 +50,27 @@ if (is_dir($full_file_name)) {
     $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
     //redirect
     header('Location: '.$document_explorer);
+    exit;
 }
 
-$tbl_announcement_attachment = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
+$table = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
 
 // launch event
 Event::event_download($doc_url);
-
 $course_id = api_get_course_int_id();
-
 $doc_url = Database::escape_string($doc_url);
 
-$sql = "SELECT filename FROM $tbl_announcement_attachment
+$sql = "SELECT filename FROM $table
   	  	WHERE c_id = $course_id AND path LIKE BINARY '$doc_url'";
 
 $result = Database::query($sql);
 if (Database::num_rows($result) > 0) {
     $row = Database::fetch_array($result);
     $title = str_replace(' ', '_', $row['filename']);
-    if (Security::check_abs_path($full_file_name,
-        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/announcements/')
+    if (Security::check_abs_path(
+        $full_file_name,
+        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/announcements/'
+    )
     ) {
         $result = DocumentManager::file_send_for_download($full_file_name, true, $title);
         if ($result === false) {

+ 9 - 4
main/attendance/attendance_calendar.php

@@ -123,7 +123,6 @@ if (isset($action) && $action == 'calendar_add') {
     echo '<ul class="list-group">';
     if (!empty($attendance_calendar)) {
         foreach ($attendance_calendar as $calendar) {
-
             echo '<li class="list-group-item">';
             if ((isset($action) && $action === 'calendar_edit') &&
                 (isset($calendar_id) && $calendar_id == $calendar['id'])
@@ -152,9 +151,15 @@ if (isset($action) && $action == 'calendar_add') {
                 echo Display::return_icon(
                     'lp_calendar_event.png',
                     get_lang('DateTime'),
-                        null,
-                        ICON_SIZE_MEDIUM
-                ).' '.substr($calendar['date_time'], 0, strlen($calendar['date_time']) - 3).'&nbsp;';
+                    null,
+                    ICON_SIZE_MEDIUM
+                ).' '.
+                substr(
+                    $calendar['date_time'],
+                    0,
+                    strlen($calendar['date_time']) - 3
+                ).
+                '&nbsp;';
 
                 if (isset($calendar['groups']) && !empty($calendar['groups'])) {
                     foreach ($calendar['groups'] as $group) {

+ 16 - 13
main/attendance/attendance_sheet.php

@@ -22,13 +22,13 @@ if (api_is_allowed_to_edit(null, true) ||
 ) {
     $groupId = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null;
     $form = new FormValidator(
-            'filter',
-            'post',
-            'index.php?action=attendance_sheet_list&'.api_get_cidreq().'&attendance_id='.$attendance_id,
-            null,
-            array(),
-            'inline'
-        );
+        'filter',
+        'post',
+        'index.php?action=attendance_sheet_list&'.api_get_cidreq().'&attendance_id='.$attendance_id,
+        null,
+        array(),
+        'inline'
+    );
 
     $values = array(
         'all' => get_lang('All'),
@@ -64,7 +64,10 @@ if (api_is_allowed_to_edit(null, true) ||
     }
 
     if (!$exists_attendance_today) {
-        echo Display::return_message(get_lang('ThereIsNoClassScheduledTodayTryPickingAnotherDay'), 'warning');
+        echo Display::return_message(
+            get_lang('ThereIsNoClassScheduledTodayTryPickingAnotherDay'),
+            'warning'
+        );
     }
 
     $form->addSelect(
@@ -103,7 +106,6 @@ if (api_is_allowed_to_edit(null, true) ||
     );
 
     if (!$is_locked_attendance || api_is_platform_admin()) {
-
         $actionsLeft = '<a style="float:left;" href="index.php?'.api_get_cidreq().'&action=calendar_list&attendance_id='.$attendance_id.'">'.
             Display::return_icon('attendance_calendar.png', get_lang('AttendanceCalendar'), '', ICON_SIZE_MEDIUM).'</a>';
         $actionsLeft .= '<a id="pdf_export" style="float:left;"  href="index.php?'.api_get_cidreq().'&action=attendance_sheet_export_to_pdf&attendance_id='.$attendance_id.'&filter='.$default_filter.'&group_id='.$groupId.'">'.
@@ -126,7 +128,6 @@ if (api_is_allowed_to_edit(null, true) ||
     }
 
     $param_filter = '&filter='.Security::remove_XSS($default_filter).'&group_id='.$groupId;
-
     if (count($users_in_course) > 0) {
         ?>
         <script>
@@ -233,7 +234,10 @@ if (api_is_allowed_to_edit(null, true) ||
                             } else {
                                 $class = 'row_even';
                             }
-                            $username = api_htmlentities(sprintf(get_lang('LoginX'), $data['username']), ENT_QUOTES);
+                            $username = api_htmlentities(
+                                sprintf(get_lang('LoginX'), $data['username']),
+                                ENT_QUOTES
+                            );
                             ?>
                             <tr class="<?php echo $class ?>">
                                 <td><center><?php echo $i ?></center></td>
@@ -284,7 +288,6 @@ if (api_is_allowed_to_edit(null, true) ||
 
                         $result .= '<th>';
                         $result .= '<div class="date-attendance">'.$datetime.'&nbsp;';
-
                         if (api_is_allowed_to_edit(null, true)) {
                             $result .= '<span id="attendance_lock" style="cursor:pointer">'.(!$is_locked_attendance || api_is_platform_admin() ? $img_lock : '').'</span>';
                         }
@@ -400,7 +403,7 @@ if (api_is_allowed_to_edit(null, true) ||
                     <?php if (!$is_locked_attendance || api_is_platform_admin()) {
                         if (api_is_allowed_to_edit(null, true)) { ?>
                             <button type="submit" class="btn btn-primary"><?php echo get_lang('Save') ?></button>
-                        <?php }
+                    <?php }
                     } ?>
                     </div>
                 </div>

+ 0 - 1
main/attendance/index.php

@@ -90,7 +90,6 @@ if (!empty($attendance_id)) {
 }
 
 $htmlHeadXtra[] = '<script>
-
 $(function() {
     $("table th img").click(function() {
         var col_id = this.id;

+ 2 - 2
main/attendance/layout.php

@@ -12,7 +12,7 @@ api_protect_course_script(true);
 
 // Header
 $tool = TOOL_ATTENDANCE;
-Display :: display_header('');
+Display::display_header('');
 
 // Introduction section
 Display::display_introduction_section($tool);
@@ -24,4 +24,4 @@ Event::event_access_tool($tool);
 echo $content;
 
 // Footer
-Display :: display_footer();
+Display::display_footer();

+ 1 - 1
main/auth/categories_list.php

@@ -7,7 +7,7 @@
 * @package chamilo.auth
 */
 
-// Acces rights: anonymous users can't do anything usefull here.
+// Access rights: anonymous users can't do anything usefull here.
 api_block_anonymous_users();
 
 $stok = Security::get_token();

+ 0 - 2
main/auth/courses.php

@@ -267,9 +267,7 @@ switch ($action) {
         if (!$confirmed) {
             $template = new Template(null, false, false, false, false, false);
             $template->assign('session_id', $sessionId);
-
             $layout = $template->get_template('auth/confirm_session_subscription.tpl');
-
             echo $template->fetch($layout);
             exit;
         }

+ 3 - 3
main/auth/hrm_courses.php

@@ -1,9 +1,9 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-use Chamilo\CoreBundle\Entity\CourseRelUser,
-    Chamilo\CoreBundle\Entity\SessionRelCourseRelUser,
-    Chamilo\CoreBundle\Entity\Course;
+use Chamilo\CoreBundle\Entity\CourseRelUser;
+use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
+use Chamilo\CoreBundle\Entity\Course;
 
 require_once __DIR__.'/../inc/global.inc.php';
 

+ 12 - 9
main/blog/download.php

@@ -1,13 +1,13 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-*	This file is responsible for  passing requested documents to the browser.
-*	Html files are parsed to fix a few problems with URLs,
-*	but this code will hopefully be replaced soon by an Apache URL
-*	rewrite mechanism.
-*
-*	@package chamilo.blogs
-*/
+ * This file is responsible for  passing requested documents to the browser.
+ * Html files are parsed to fix a few problems with URLs,
+ * but this code will hopefully be replaced soon by an Apache URL
+ * rewrite mechanism.
+ *
+ * @package chamilo.blogs
+ */
 
 session_cache_limiter('public');
 
@@ -37,7 +37,9 @@ $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/b
 //if the rewrite rule asks for a directory, we redirect to the course view
 if (is_dir($full_file_name)) {
     //remove last slash if present
-    while ($doc_url{$dul = strlen($doc_url) - 1} == '/') $doc_url = substr($doc_url, 0, $dul);
+    while ($doc_url{$dul = strlen($doc_url) - 1} == '/') {
+        $doc_url = substr($doc_url, 0, $dul);
+    }
     //create the path
     $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
     //redirect
@@ -60,7 +62,8 @@ if (Database::num_rows($result) > 0) {
     $row = Database::fetch_array($result);
     if (Security::check_abs_path(
         $full_file_name,
-        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/blog/')
+        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/blog/'
+    )
     ) {
         $result = DocumentManager::file_send_for_download(
             $full_file_name,

+ 7 - 7
main/calendar/download.php

@@ -2,13 +2,13 @@
 /* For licensing terms, see /license.txt */
 
 /**
-*	This file is responsible for  passing requested documents to the browser.
-*	Html files are parsed to fix a few problems with URLs,
-*	but this code will hopefully be replaced soon by an Apache URL
-*	rewrite mechanism.
-*
-*	@package chamilo.calendar
-*/
+ * This file is responsible for  passing requested documents to the browser.
+ * Html files are parsed to fix a few problems with URLs,
+ * but this code will hopefully be replaced soon by an Apache URL
+ * rewrite mechanism.
+ *
+ * @package chamilo.calendar
+ */
 
 session_cache_limiter('public');
 

+ 1 - 1
main/calendar/ical_export.php

@@ -42,7 +42,7 @@ if (isset($_GET['course_id'])) {
 $event = $agenda->get_event($id);
 
 if (!empty($event)) {
-	define('ICAL_LANG', api_get_language_isocode());
+    define('ICAL_LANG', api_get_language_isocode());
 
     $ical = new vcalendar();
     $ical->setConfig('unique_id', api_get_path(WEB_PATH));

+ 10 - 6
main/course_description/add.php

@@ -38,14 +38,18 @@ echo '</div>';
 
 // error messages
 if (isset($error) && intval($error) == 1) {
-	echo Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'error', false);
+    echo Display::return_message(
+        get_lang('FormHasErrorsPleaseComplete'),
+        'error',
+        false
+    );
 }
 
 // default header title form
 $header = '';
 $description_type = intval($description_type);
 if ($description_type >= ADD_BLOCK) {
-	$header = $default_description_titles[ADD_BLOCK];
+    $header = $default_description_titles[ADD_BLOCK];
 }
 
 // display form
@@ -82,9 +86,9 @@ $form->addHtmlEditor(
 $form->addButtonCreate(get_lang('Save'));
 
 // display default questions
-if (isset ($question[$description_type])) {
-	$message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
-	$message .= $question[$description_type];
-	echo Display::return_message($message, 'normal', false);
+if (isset($question[$description_type])) {
+    $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
+    $message .= $question[$description_type];
+    echo Display::return_message($message, 'normal', false);
 }
 $form->display();

+ 0 - 1
main/course_description/course_description_controller.php

@@ -133,7 +133,6 @@ class CourseDescriptionController
                 $this->view->render();
             }
         } else {
-
             $data['default_description_titles'] = $course_description->get_default_description_title();
             $data['default_description_title_editable'] = $course_description->get_default_description_title_editable();
             $data['default_description_icon'] = $course_description->get_default_description_icon();

+ 43 - 42
main/course_description/edit.php

@@ -9,68 +9,69 @@
 
 // protect a course script
 api_protect_course_script(true);
+
 if (empty($id)) {
-	$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : '';
-	if (empty($id)) {
-		// If the ID was not provided, find the first matching description item given the item type
-		$course_description = new CourseDescription();
-		$description = $course_description->get_data_by_description_type($description_type);
-		if (count($description) > 0) {
-			$id = $description['id'];
-		}
-		// If no corresponding description is found, edit a new one
-		unset($course_description);
-	}
+    $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : '';
+    if (empty($id)) {
+        // If the ID was not provided, find the first matching description item given the item type
+        $course_description = new CourseDescription();
+        $description = $course_description->get_data_by_description_type($description_type);
+        if (count($description) > 0) {
+            $id = $description['id'];
+        }
+        // If no corresponding description is found, edit a new one
+        unset($course_description);
+    }
 }
 $original_id = $id;
 
 if (empty($error)) {
-	$token = Security::get_token();
+    $token = Security::get_token();
 }
 // display categories
 $categories = array();
 foreach ($default_description_titles as $id => $title) {
-	$categories[$id] = $title;
+    $categories[$id] = $title;
 }
 $categories[ADD_BLOCK] = get_lang('NewBloc');
 
 $i = 1;
 echo '<div class="actions" style="margin-bottom:30px">';
 echo '<a href="index.php?'.api_get_cidreq().'">'.
-		Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ToolCourseDescription'), '', ICON_SIZE_MEDIUM).
-	'</a>';
+        Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ToolCourseDescription'), '', ICON_SIZE_MEDIUM).
+    '</a>';
 
 ksort($categories);
 foreach ($categories as $id => $title) {
-	if ($i == ADD_BLOCK) {
-		echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
-			Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
-		break;
-	} else {
-		echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
-			Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
-		$i++;
-	}
+    if ($i == ADD_BLOCK) {
+        echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
+            Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
+        break;
+    } else {
+        echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
+            Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
+        $i++;
+    }
 }
 echo '</div>';
 
 // error messages
 if (isset($error) && intval($error) == 1) {
-	echo Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'error', false);
+    echo Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'error', false);
 }
 
 // default header title form
 $description_type = intval($description_type);
 $header = $default_description_titles[$description_type];
 if ($description_type >= ADD_BLOCK) {
-	$header = $default_description_titles[ADD_BLOCK];
+    $header = $default_description_titles[ADD_BLOCK];
 }
 
 // display form
 $form = new FormValidator(
-	'course_description',
-	'POST',
-	'index.php?action=edit&id='.$original_id.'&description_type='.$description_type.'&'.api_get_cidreq()
+    'course_description',
+    'POST',
+    'index.php?action=edit&id='.$original_id.'&description_type='.$description_type.'&'.api_get_cidreq()
 );
 $form->addElement('header', $header);
 $form->addElement('hidden', 'id', $original_id);
@@ -90,15 +91,15 @@ if (api_get_configuration_value('save_titles_as_html')) {
     $form->applyFilter('title', 'html_filter');
 }
 $form->addHtmlEditor(
-	'contentDescription',
-	get_lang('Content'),
-	true,
-	false,
-	array(
-		'ToolbarSet' => 'TrainingDescription',
-		'Width' => '100%',
-		'Height' => '200',
-	)
+    'contentDescription',
+    get_lang('Content'),
+    true,
+    false,
+    array(
+        'ToolbarSet' => 'TrainingDescription',
+        'Width' => '100%',
+        'Height' => '200',
+    )
 );
 $form->addButtonCreate(get_lang('Save'));
 
@@ -113,9 +114,9 @@ $default['description_type'] = $description_type;
 
 $form->setDefaults($default);
 
-if (isset ($question[$description_type])) {
-	$message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
-	$message .= $question[$description_type];
-	Display::addFlash(Display::return_message($message, 'normal', false));
+if (isset($question[$description_type])) {
+    $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
+    $message .= $question[$description_type];
+    Display::addFlash(Display::return_message($message, 'normal', false));
 }
 $form->display();

+ 9 - 7
main/course_info/delete_course.php

@@ -4,16 +4,17 @@
 use ChamiloSession as Session;
 
 /**
- *	This script is about deleting a course.
- *	It displays a message box ('are you sure you wish to delete this course')
- *	and deletes the course if the user answers affirmatively
+ * This script is about deleting a course.
+ * It displays a message box ('are you sure you wish to delete this course')
+ * and deletes the course if the user answers affirmatively
  *
- *	@package chamilo.course_info
+ * @package chamilo.course_info
  */
 
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_COURSES;
 $current_course_tool = TOOL_COURSE_MAINTENANCE;
+
 api_protect_course_script(true);
 
 $_course = api_get_course_info();
@@ -44,11 +45,12 @@ if (isset($_GET['delete']) && $_GET['delete'] === 'yes') {
     $message .= '<p><a class="btn btn-primary" href="'.api_get_path(WEB_CODE_PATH).'course_info/maintenance.php?'.api_get_cidreq().'">'.
         get_lang('No').'</a>&nbsp;<a class="btn btn-danger" href="'.api_get_self().'?delete=yes&'.api_get_cidreq().'">'.
         get_lang('Yes').'</a></p>';
-	$interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
+    $interbreadcrumb[] = array(
+        'url' => 'maintenance.php',
+        'name' => get_lang('Maintenance')
+    );
 }
 
 $tpl = new Template($tool_name);
-
 $tpl->assign('content', Display::return_message($message, 'warning', false));
 $tpl->display_one_col_template();
-

+ 12 - 6
main/course_info/download.php

@@ -12,9 +12,9 @@ require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_COURSES;
 
 if (isset($_GET['archive_path'])) {
-	$archive_path = api_get_path(SYS_ARCHIVE_PATH);
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH);
 } else {
-	$archive_path = CourseArchiver::getBackupDir();
+    $archive_path = CourseArchiver::getBackupDir();
 }
 $archive_file = isset($_GET['archive']) ? $_GET['archive'] : null;
 $archive_file = str_replace(array('..', '/', '\\'), '', $archive_file);
@@ -28,17 +28,23 @@ if (empty($extension) || !file_exists($archive_path.$archive_file)) {
 $extension = strtolower($extension);
 $content_type = '';
 
-if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) {
-	$content_type = 'application/force-download';
+if (in_array($extension, array('xml', 'csv')) &&
+    (api_is_platform_admin(true) || api_is_drh())
+) {
+    $content_type = 'application/force-download';
 } elseif ($extension === 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) {
-	$content_type = 'application/force-download';
+    $content_type = 'application/force-download';
 }
 
 if (empty($content_type)) {
     api_not_allowed(true);
 }
 if (Security::check_abs_path($archive_path.$archive_file, $archive_path)) {
-    DocumentManager::file_send_for_download($archive_path.$archive_file, true, $archive_file);
+    DocumentManager::file_send_for_download(
+        $archive_path.$archive_file,
+        true,
+        $archive_file
+    );
     exit;
 } else {
     api_not_allowed(true);

+ 3 - 4
main/course_info/maintenance_coach.php

@@ -26,13 +26,12 @@ Display :: display_header($nameTools);
 
 echo Display::page_subheader(
     Display::return_icon(
-        'save_import.gif', get_lang('Backup')
+        'save_import.gif',
+        get_lang('Backup')
     ).'&nbsp;&nbsp;'.get_lang('Backup')
 );
 
-$url = api_get_path(
-        WEB_CODE_PATH
-    ).'coursecopy/copy_course_session_selected.php?'.api_get_cidreq();
+$url = api_get_path(WEB_CODE_PATH).'coursecopy/copy_course_session_selected.php?'.api_get_cidreq();
 
 $link = Display::url(get_lang('CopyCourse'), $url);
 ?>