Explorar el Código

Feature #2099 -Cleaning some files.

Ivan Tcholakov hace 14 años
padre
commit
7520859e00
Se han modificado 2 ficheros con 245 adiciones y 300 borrados
  1. 190 251
      main/admin/index.php
  2. 55 49
      main/create_course/add_course.php

+ 190 - 251
main/admin/index.php

@@ -1,239 +1,210 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 /**
-*	Index of the admin tools
-*
-*	@package chamilo.admin
-*/
-// name of the language file that needs to be included <br />
-$language_file=array('admin','tracking');
+ *	Index page of the admin tools
+ *	@package chamilo.admin
+ */
+
+// Language files that need to be included.
+$language_file = array('admin', 'tracking');
 
-// resetting the course id
-$cidReset=true;
+// Resetting the course id.
+$cidReset = true;
 
-// including some necessary chamilo files
+// Including some necessary chamilo files.
 require_once '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'security.lib.php';
 require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 require_once api_get_path(SYS_CODE_PATH).'admin/statistics/statistics.lib.php';
 require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
 
-// setting the section (for the tabs)
-$this_section=SECTION_PLATFORM_ADMIN;
+// Setting the section (for the tabs).
+$this_section = SECTION_PLATFORM_ADMIN;
 
-// Access restrictions
+// Access restrictions.
 api_protect_admin_script(true);
 $nameTools = get_lang('PlatformAdmin');
 
-// setting breadcrumbs
+// Setting breadcrumbs.
 //$interbreadcrumb[] = array('url' => 'index.php', 'name' => $nameTools);
 
-// setting the name of the tool
-$tool_name=get_lang('PlatformAdmin');
+// Setting the name of the tool.
+$tool_name = get_lang('PlatformAdmin');
 
 // Displaying the header
 Display::display_header($nameTools);
 
 
-if(api_is_platform_admin()) {
-    if(is_dir(api_get_path(SYS_CODE_PATH).'install/') && is_readable(api_get_path(SYS_CODE_PATH).'install/index.php'))
-    {
+if (api_is_platform_admin()) {
+    if (is_dir(api_get_path(SYS_CODE_PATH).'install/') && is_readable(api_get_path(SYS_CODE_PATH).'install/index.php')) {
         Display::display_normal_message(get_lang('InstallDirAccessibleSecurityThreat'));
     }
-    /*
-                ACTION HANDLING
-        */
-    if (!empty($_POST['Register']))
-    {
+
+    /* ACTION HANDLING */
+
+    if (!empty($_POST['Register'])) {
         register_site();
         Display :: display_confirmation_message(get_lang('VersionCheckEnabled'));
     }
 
-    /*
-            MAIN SECTION
-    */
-    $keyword_url = Security::remove_XSS((empty($_GET['keyword'])?'':$_GET['keyword']));
+    /* MAIN SECTION */
+
+    $keyword_url = Security::remove_XSS((empty($_GET['keyword']) ? '' : $_GET['keyword']));
 }
 
 if (api_is_platform_admin()) {
-    ?>
-        <div class="admin_section">
+?>
+<div class="admin_section">
     <h4><?php Display::display_icon('members.gif', get_lang('Users')); ?> <?php echo api_ucfirst(get_lang('Users')); ?></h4>
 
-        <div style="list-style-type:none"><form method="get" action="user_list.php">
-            <input type="text" name="keyword" value="<?php echo $keyword_url; ?>"/>
-            <button class="search" type="submit"> <?php echo get_lang('Search');?>
-            </button>
+        <div style="list-style-type:none">
+            <form method="get" action="user_list.php">
+                <input type="text" name="keyword" value="<?php echo $keyword_url; ?>"/>
+                <button class="search" type="submit"> <?php echo get_lang('Search'); ?></button>
             </form>
         </div>
     <ul>
         <!-- <li><a href="user_list.php?search=advanced"><?php echo api_ucfirst(get_lang('AdvancedSearch')); ?></a></li> -->
-        <li><a href="user_list.php">	<?php echo get_lang('UserList') ?></a></li>
-        <li><a href="user_add.php">		<?php echo get_lang('AddUsers') ?></a></li>
-        <li><a href="user_export.php">	<?php echo get_lang('ExportUserListXMLCSV') ?></a></li>
-        <li><a href="user_import.php">	<?php echo get_lang('ImportUserListXMLCSV') ?></a></li>
-        <?php if (api_get_setting('allow_social_tool')=='true') { ?>
-            <li><a href="group_add.php">	<?php echo get_lang('AddGroups') ?></a></li>
-            <li><a href="group_list.php">	<?php echo get_lang('GroupList') ?></a></li>
-        <?php
-        }
-        if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){
-            ?>
-            <!-- dynamic ldap code -->
-              <li><a href="ldap_users_list.php"><?php echo get_lang('ImportLDAPUsersIntoPlatform');?></a></li>
-            <!-- dynamic ldap code -->
-            <?php
-            }
-        ?>
-        <li><a href="user_fields.php">	<?php echo get_lang('ManageUserFields'); ?></a></li>
-        </ul>
-        </div>
-<?php
-} else {
-    ?>
-    <div class="admin_section">
+        <li><a href="user_list.php"><?php echo get_lang('UserList'); ?></a></li>
+        <li><a href="user_add.php"><?php echo get_lang('AddUsers'); ?></a></li>
+        <li><a href="user_export.php"><?php echo get_lang('ExportUserListXMLCSV'); ?></a></li>
+        <li><a href="user_import.php"><?php echo get_lang('ImportUserListXMLCSV'); ?></a></li>
+    <?php if (api_get_setting('allow_social_tool') == 'true') { ?>
+        <li><a href="group_add.php"><?php echo get_lang('AddGroups'); ?></a></li>
+        <li><a href="group_list.php"><?php echo get_lang('GroupList'); ?></a></li>
+    <?php }
+    if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) { ?>
+        <li><a href="ldap_users_list.php"><?php echo get_lang('ImportLDAPUsersIntoPlatform');?></a></li>
+    <?php } ?>
+        <li><a href="user_fields.php"><?php echo get_lang('ManageUserFields'); ?></a></li>
+    </ul>
+</div>
+<?php } else { ?>
+<div class="admin_section">
     <h4><?php Display::display_icon('members.gif', get_lang('Users')); ?> <?php echo api_ucfirst(get_lang('Users')); ?></h4>
     <ul>
-        <li><a href="user_list.php">	<?php echo get_lang('UserList') ?></a></li>
-        <li><a href="../mySpace/user_add.php"><?php echo get_lang('AddUsers') ?></a></li>
-        <li><a href="user_import.php">	<?php echo get_lang('ImportUserListXMLCSV') ?></a></li>
+        <li><a href="user_list.php"><?php echo get_lang('UserList'); ?></a></li>
+        <li><a href="../mySpace/user_add.php"><?php echo get_lang('AddUsers'); ?></a></li>
+        <li><a href="user_import.php"><?php echo get_lang('ImportUserListXMLCSV'); ?></a></li>
     </ul>
-    </div>
+</div>
 <?php
 }
 
-//Advance search link moved
-/* <li><a href="course_list.php?search=advanced"><?php echo api_ucfirst(get_lang('AdvancedSearch')); ?></a></li> */
-
-if(api_is_platform_admin()) {
-?>
-    <div class="admin_section">
-        <h4><?php Display::display_icon('course.gif', get_lang('Courses')); ?> <?php echo api_ucfirst(get_lang('Courses')); ?></h4>
-        <div style="list-style-type:none">
-            <form method="get" action="course_list.php">
-                <input type="text" name="keyword" value="<?php echo $keyword_url; ?>"/>
-                <button class="search" type="submit"> <?php echo get_lang('Search');?></button>
-            </form>
-        </div>
+if (api_is_platform_admin()) { ?>
+<div class="admin_section">
+    <h4><?php Display::display_icon('course.gif', get_lang('Courses')); ?> <?php echo api_ucfirst(get_lang('Courses')); ?></h4>
+    <div style="list-style-type:none">
+        <form method="get" action="course_list.php">
+            <input type="text" name="keyword" value="<?php echo $keyword_url; ?>"/>
+            <button class="search" type="submit"><?php echo get_lang('Search'); ?></button>
+        </form>
+    </div>
     <ul>
-        <li><a href="course_list.php"><?php echo get_lang('CourseList') ?></a></li>
-        <li><a href="course_add.php"><?php echo get_lang('AddCourse') ?></a></li>
+        <li><a href="course_list.php"><?php echo get_lang('CourseList'); ?></a></li>
+        <li><a href="course_add.php"><?php echo get_lang('AddCourse'); ?></a></li>
         <li><a href="course_export.php"><?php echo get_lang('ExportCourses'); ?></a></li>
         <li><a href="course_import.php"><?php echo get_lang('ImportCourses'); ?></a></li>
-        <!-- <li><a href="course_virtual.php"><?php //echo get_lang('AdminManageVirtualCourses') ?></a></li> -->
+        <!-- <li><a href="course_virtual.php"><?php //echo get_lang('AdminManageVirtualCourses'); ?></a></li> -->
         <li><a href="course_category.php"><?php echo get_lang('AdminCategories'); ?></a></li>
         <li><a href="subscribe_user2course.php"><?php echo get_lang('AddUsersToACourse'); ?></a></li>
         <li><a href="course_user_import.php"><?php echo get_lang('ImportUsersToACourse'); ?></a></li>
-        <?php if (api_get_setting('search_enabled')=='true') { ?>
-          <li><a href="specific_fields.php"><?php echo get_lang('SpecificSearchFields'); ?></a></li>
-        <?php } ?>
-        <?php
-            if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){
-            ?>
-            <!-- dynamic ldap code -->
-            <li><a href="ldap_import_students.php"><?php echo get_lang('ImportLDAPUsersIntoCourse');?></a></li>
-            <!-- dynamic ldap code -->
-            <?php
-            }
-        ?>
+    <?php if (api_get_setting('search_enabled') == 'true') { ?>
+        <li><a href="specific_fields.php"><?php echo get_lang('SpecificSearchFields'); ?></a></li>
+    <?php }
+    if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) { ?>
+        <li><a href="ldap_import_students.php"><?php echo get_lang('ImportLDAPUsersIntoCourse'); ?></a></li>
+    <?php } ?>
     </ul>
-    </div>
+</div>
 
-    <div class="admin_section">
-     <h4><?php Display::display_icon('settings.gif', get_lang('Platform')); ?> <?php echo api_ucfirst(get_lang('Platform')); ?></h4>
-     <ul>
-      <li><a href="settings.php"><?php echo get_lang('DokeosConfigSettings') ?></a></li>
-      <li><a href="special_exports.php"><?php echo get_lang('SpecialExports') ?></a></li>
-      <li><a href="system_announcements.php"><?php echo get_lang('SystemAnnouncements') ?></a></li>
-      <li><a href="languages.php"><?php echo get_lang('Languages'); ?></a></li>
-      <li><a href="configure_homepage.php"><?php echo get_lang('ConfigureHomePage'); ?></a></li>
-      <li><a href="configure_inscription.php"><?php echo get_lang('ConfigureInscription'); ?></a></li>
-      <li><a href="statistics/index.php"><?php echo get_lang('Statistics'); ?> </a></li>
-      <li><a href="calendar.php"><?php echo get_lang('GlobalAgenda'); ?> </a></li>
-      <?php if(!empty($phpMyAdminPath)) { ?>
-      <li><a href="<?php echo $phpMyAdminPath; ?>" target="_blank"><?php echo get_lang("AdminDatabases"); ?></a><br />(<?php echo get_lang("DBManagementOnlyForServerAdmin"); ?>)</li>
-      <?php } ?>
-      <?php
-        if(!empty($_configuration['multiple_access_urls'])) {
+<div class="admin_section">
+    <h4><?php Display::display_icon('settings.gif', get_lang('Platform')); ?> <?php echo api_ucfirst(get_lang('Platform')); ?></h4>
+    <ul>
+        <li><a href="settings.php"><?php echo get_lang('DokeosConfigSettings') ?></a></li>
+        <li><a href="special_exports.php"><?php echo get_lang('SpecialExports') ?></a></li>
+        <li><a href="system_announcements.php"><?php echo get_lang('SystemAnnouncements') ?></a></li>
+        <li><a href="languages.php"><?php echo get_lang('Languages'); ?></a></li>
+        <li><a href="configure_homepage.php"><?php echo get_lang('ConfigureHomePage'); ?></a></li>
+        <li><a href="configure_inscription.php"><?php echo get_lang('ConfigureInscription'); ?></a></li>
+        <li><a href="statistics/index.php"><?php echo get_lang('Statistics'); ?> </a></li>
+        <li><a href="calendar.php"><?php echo get_lang('GlobalAgenda'); ?> </a></li>
+    <?php if (!empty($phpMyAdminPath)) { ?>
+        <li><a href="<?php echo $phpMyAdminPath; ?>" target="_blank"><?php echo get_lang('AdminDatabases'); ?></a><br />(<?php echo get_lang('DBManagementOnlyForServerAdmin'); ?>)</li>
+    <?php
+    }
+        if (!empty($_configuration['multiple_access_urls'])) {
             if (api_is_global_platform_admin()) {
                 echo '<li><a href="access_urls.php">'.get_lang('ConfigureMultipleAccessURLs').'</a></li>';
             }
-      }
+        }
 
-      if (api_get_setting('allow_reservation')=='true') {
-              echo '<li><a href="../reservation/m_category.php">'.get_lang('BookingSystem').'</a></li>';
-      }
+        if (api_get_setting('allow_reservation') == 'true') {
+            echo '<li><a href="../reservation/m_category.php">'.get_lang('BookingSystem').'</a></li>';
+        }
 
-        if (api_get_setting('allow_terms_conditions')=='true') {
-              echo '<li><a href="legal_add.php">'.get_lang('TermsAndConditions').'</a></li>';
-      }
+        if (api_get_setting('allow_terms_conditions') == 'true') {
+            echo '<li><a href="legal_add.php">'.get_lang('TermsAndConditions').'</a></li>';
+        }
 
-      //@todo Translations needed in order to see a better explanation of issues
-      echo '<li><a href="system_status.php">'.get_lang('SystemStatus').'</a></li>';
+        //@todo Translations needed in order to see a better explanation of issues
+        echo '<li><a href="system_status.php">'.get_lang('SystemStatus').'</a></li>';
 
-      if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) {
-      //do not show on production portals, where the tests directory doesn't exist
-          echo '<li><a href="filler.php">'.get_lang('DataFiller').'</a></li>';
-      }
-      ?>
-     </ul>
-    </div>
+        if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) {
+            // Do not show on production portals, where the tests directory doesn't exist.
+            echo '<li><a href="filler.php">'.get_lang('DataFiller').'</a></li>';
+        }
+    ?>
+    </ul>
+</div>
 
-    <?php
+<?php
 }
 
-if(api_get_setting('use_session_mode')=='true') {
-?>
+if (api_get_setting('use_session_mode') == 'true') { ?>
 
 <div class="admin_section">
- <h4><?php Display::display_icon('blackboard_blue.png', get_lang('Sessions'), array('width'=>'22px')); ?> <?php echo get_lang('Sessions') ?></h4>
- <div style="list-style-type:none"><form method="POST" action="session_list.php">
-    <input type="text" name="keyword_name" value="<?php echo $keyword_url; ?>"/>
-    <button class="search" type="submit"> <?php echo get_lang('Search');?>
-            </button>
-    </form>
+    <h4><?php Display::display_icon('blackboard_blue.png', get_lang('Sessions'), array('width' => '22px')); ?> <?php echo get_lang('Sessions'); ?></h4>
+    <div style="list-style-type:none">
+        <form method="POST" action="session_list.php">
+            <input type="text" name="keyword_name" value="<?php echo $keyword_url; ?>"/>
+            <button class="search" type="submit"><?php echo get_lang('Search'); ?></button>
+        </form>
+    </div>
+    <ul>
+        <!--  <li><a href="session_list.php?search=advanced"><?php echo api_ucfirst(get_lang('AdvancedSearch')); ?></a></li> -->
+        <li><a href="session_list.php"><?php echo get_lang('ListSession'); ?></a></li>
+        <li><a href="session_category_list.php"><?php echo get_lang('ListSessionCategory'); ?></a></li>
+        <li><a href="session_add.php"><?php echo get_lang('AddSession'); ?></a></li>
+        <li><a href="session_import.php"><?php echo get_lang('ImportSessionListXMLCSV'); ?></a></li>
+    <?php if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) { ?>
+        <li><a href="ldap_import_students_to_session.php"><?php echo get_lang('ImportLDAPUsersIntoSession'); ?></a></li>
+    <?php } ?>
+        <li><a href="session_export.php"><?php echo get_lang('ExportSessionListXMLCSV'); ?></a></li>
+        <li><a href="../coursecopy/copy_course_session.php"><?php echo get_lang('CopyFromCourseInSessionToAnotherSession'); ?></a></li>
+    </ul>
 </div>
 
- <ul>
-  <!--  <li><a href="session_list.php?search=advanced"><?php echo api_ucfirst(get_lang('AdvancedSearch')); ?></a></li> -->
-  <li><a href="session_list.php"><?php echo get_lang('ListSession') ?></a></li>
-  <li><a href="session_category_list.php"><?php echo get_lang('ListSessionCategory') ?></a></li>
-  <li><a href="session_add.php"><?php echo get_lang('AddSession') ?></a></li>
-  <li><a href="session_import.php"><?php echo get_lang('ImportSessionListXMLCSV') ?></a></li>
-  <?php
-        if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){
-        ?>
-        <!-- dynamic ldap code -->
-         <li><a href="ldap_import_students_to_session.php"><?php echo get_lang('ImportLDAPUsersIntoSession');?></a></li>
-        <!-- dynamic ldap code -->
-        <?php
-        }
-    ?>
-  <li><a href="session_export.php"><?php echo get_lang('ExportSessionListXMLCSV') ?></a></li>
-  <li><a href="../coursecopy/copy_course_session.php"><?php echo get_lang('CopyFromCourseInSessionToAnotherSession') ?></a></li>
-  </ul>
-  </div>
-
 <?php
-} else if(api_is_platform_admin()) {
-?>
+} elseif (api_is_platform_admin()) { ?>
 
 <div class="admin_section">
-<h4><?php Display::display_icon('group.gif', get_lang('AdminClasses')); ?> <?php echo api_ucfirst(get_lang('AdminClasses')); ?></h4>
-<div style="list-style-type:none"><form method="get" action="class_list.php">
-    <input type="text" name="keyword" value="<?php echo $keyword_url; ?>"/>
-    <input class="search" type="submit" value="<?php echo get_lang('Search'); ?>"/>
-    </form>
-</div>
-<ul>
-<li><a href="class_list.php"><?php echo get_lang('ClassList'); ?></a></li>
-<li><a href="class_add.php"><?php echo get_lang('AddClasses'); ?></a></li>
-<li><a href="class_import.php"><?php echo get_lang('ImportClassListCSV'); ?></a></li>
-<li><a href="class_user_import.php"><?php echo get_lang('AddUsersToAClass'); ?> CSV</a></li>
-<li><a href="subscribe_class2course.php"><?php echo get_lang('AddClassesToACourse'); ?></a></li>
-</ul>
-<br />
-<br />
+    <h4><?php Display::display_icon('group.gif', get_lang('AdminClasses')); ?> <?php echo api_ucfirst(get_lang('AdminClasses')); ?></h4>
+    <div style="list-style-type:none">
+        <form method="get" action="class_list.php">
+            <input type="text" name="keyword" value="<?php echo $keyword_url; ?>"/>
+            <input class="search" type="submit" value="<?php echo get_lang('Search'); ?>"/>
+        </form>
+    </div>
+    <ul>
+        <li><a href="class_list.php"><?php echo get_lang('ClassList'); ?></a></li>
+        <li><a href="class_add.php"><?php echo get_lang('AddClasses'); ?></a></li>
+        <li><a href="class_import.php"><?php echo get_lang('ImportClassListCSV'); ?></a></li>
+        <li><a href="class_user_import.php"><?php echo get_lang('AddUsersToAClass'); ?> CSV</a></li>
+        <li><a href="subscribe_class2course.php"><?php echo get_lang('AddClassesToACourse'); ?></a></li>
+    </ul>
+    <br /><br />
 </div>
 <?php
 }
@@ -242,51 +213,33 @@ if (api_is_platform_admin()) {
 ?>
 
 <div class="admin_section">
- <h4><?php Display::display_icon('visio_meeting.gif', get_lang('ConfigureExtensions')); ?> <?php echo api_ucfirst(get_lang('ConfigureExtensions')); ?></h4>
- <ul>
-  <li><a href="configure_extensions.php?display=visio"><?php echo get_lang('Visioconf'); ?></a></li>
-  <li><a href="configure_extensions.php?display=ppt2lp"><?php echo get_lang('Ppt2lp'); ?></a></li>
-  <?php
-  /* <li><a href="configure_extensions.php?display=ephorus"><?php echo get_lang('EphorusPlagiarismPrevention'); ?></a></li> */
-  ?>
-  <li><a href="configure_extensions.php?display=search"><?php echo get_lang('SearchEngine'); ?></a></li>
-  <li><a href="configure_extensions.php?display=serverstats"><?php echo get_lang('ServerStatistics'); ?></a></li>
-  <li><a href="configure_extensions.php?display=bandwidthstats"><?php echo get_lang('BandWidthStatistics'); ?></a></li>
-  </ul>
-</div>
+    <h4><?php Display::display_icon('visio_meeting.gif', get_lang('ConfigureExtensions')); ?> <?php echo api_ucfirst(get_lang('ConfigureExtensions')); ?></h4>
+    <ul>
+        <li><a href="configure_extensions.php?display=visio"><?php echo get_lang('Visioconf'); ?></a></li>
+        <li><a href="configure_extensions.php?display=ppt2lp"><?php echo get_lang('Ppt2lp'); ?></a></li>
 <?php
-    /*if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){
-    ?>
-    <!-- dynamic ldap code -->
-    <div class="admin_section">
-     <h4><?php Display::display_icon('members.gif', 'LDAP'); ?> LDAP</h4>
-     <ul>
-      <li><a href="ldap_users_list.php"><?php echo get_lang('ImportLDAPUsersIntoPlatform');?></a></li>
-      <li><a href="ldap_import_students.php"><?php echo get_lang('ImportLDAPUsersIntoCourse');?></a></li>
-      <li><a href="ldap_import_students_to_session.php"><?php echo get_lang('ImportLDAPUsersIntoSession');?></a></li>
-      <!--li><a href="ldap_users_synchro.php"><?php echo get_lang('LDAPSynchroImportUsersAndStepsInSessions');?></a></li-->
-     </ul>
-    </div>
-    <!-- dynamic ldap code -->
-    <?php
-    }*/
+        /* <li><a href="configure_extensions.php?display=ephorus"><?php echo get_lang('EphorusPlagiarismPrevention'); ?></a></li> */
 ?>
+        <li><a href="configure_extensions.php?display=search"><?php echo get_lang('SearchEngine'); ?></a></li>
+        <li><a href="configure_extensions.php?display=serverstats"><?php echo get_lang('ServerStatistics'); ?></a></li>
+        <li><a href="configure_extensions.php?display=bandwidthstats"><?php echo get_lang('BandWidthStatistics'); ?></a></li>
+    </ul>
+</div>
 
 <div class="admin_section">
- <h4><?php Display::display_icon('logo.gif', 'Chamilo'); ?> Chamilo.org</h4>
- <ul>
-  <li><a href="http://www.chamilo.org/" target="_blank"><?php echo get_lang('ChamiloHomepage'); ?></a></li>
-  <li><a href="http://www.chamilo.org/forum" target="_blank"><?php echo get_lang('ChamiloForum'); ?></a></li>
-  <li><a href="http://www.chamilo.org/extensions" target="_blank"><?php echo get_lang('ChamiloExtensions'); ?></a></li>
-
-  <?php
-  //try to display a maximum before we check the chamilo version and all that
-      //session_write_close(); //close session to avoid blocking concurrent access
+    <h4><?php Display::display_icon('logo.gif', 'Chamilo'); ?> Chamilo.org</h4>
+    <ul>
+        <li><a href="http://www.chamilo.org/" target="_blank"><?php echo get_lang('ChamiloHomepage'); ?></a></li>
+        <li><a href="http://www.chamilo.org/forum" target="_blank"><?php echo get_lang('ChamiloForum'); ?></a></li>
+        <li><a href="http://www.chamilo.org/extensions" target="_blank"><?php echo get_lang('ChamiloExtensions'); ?></a></li>
+<?php
+    // Try to display a maximum before we check the chamilo version and all that.
+    //session_write_close(); //close session to avoid blocking concurrent access
     flush(); //send data to client as much as allowed by the web server
     //ob_flush();
     echo '<br />'.get_lang('VersionCheck').': '.version_check().'';
-  ?>
- </ul>
+?>
+    </ul>
 </div>
 <?php
 }
@@ -303,31 +256,27 @@ function version_check() {
     $tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
     $sql = 'SELECT selected_value FROM  '.$tbl_settings.' WHERE variable="registered" ';
     $result = Database::query($sql);
-    $row=Database::fetch_array($result,'ASSOC');
+    $row = Database::fetch_array($result, 'ASSOC');
 
-    // The site has not been registered yet
-    //if (api_get_setting('registered')=='false')
+    // The site has not been registered yet.
+    //if (api_get_setting('registered') == 'false')
 
     $return = '';
-    if ($row['selected_value']=='false')
-    {
+    if ($row['selected_value'] == 'false') {
         $return .= '<form action="'.api_get_self().'" id="VersionCheck" name="VersionCheck" method="post">';
         $return .= get_lang('VersionCheckExplanation');
         $return .= '<input type="checkbox" name="donotlistcampus" value="1" id="checkbox" />'.get_lang('HideCampusFromPublicDokeosPlatformsList');
         $return .= '<button type="submit" class="save" name="Register" value="'.get_lang('EnableVersionCheck').'" id="register" />'.get_lang('EnableVersionCheck').'</button>';
         $return .= '</form>';
     } else {
-        // The site has been registered already but is seriously out of date (registration date + 15552000 seconds)
+        // The site has been registered already but is seriously out of date (registration date + 15552000 seconds).
         /*
-        if ((api_get_setting('registered') + 15552000) > mktime())
-        {
+        if ((api_get_setting('registered') + 15552000) > mktime()) {
             $return = 'It has been a long time since about your campus has been updated on chamilo.org';
             $return .= '<form action="'.api_get_self().'" id="VersionCheck" name="VersionCheck" method="post">';
             $return .= '<input type="submit" name="Register" value="Enable Version Check" id="register" />';
             $return .= '</form>';
-        }
-        else
-        {
+        } else {
         */
         $return = 'site registered. ';
         $return .= check_system_version();
@@ -344,70 +293,60 @@ function version_check() {
  *
  * @todo the $_settings should be reloaded here. => write api function for this and use this in global.inc.php also.
  */
-function register_site()
-{
-    // Database Table Definitions
+function register_site() {
     $tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
 
-    // the SQL statment
     $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='registered'";
     $result = Database::query($sql);
 
-    //
-    if ($_POST['donotlistcampus'])
-    {
+    if ($_POST['donotlistcampus']) {
         $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='donotlistcampus'";
         $result = Database::query($sql);
     }
 
-    // reload the settings
+    // Reload the settings.
 }
 
 
 /**
-* Check if the current installation is up to date
-* The code is borrowed from phpBB and slighlty modified
-* @author The phpBB Group <support@phpbb.com> (the code)
-* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (the modifications)
-* @copyright (C) 2001 The phpBB Group
-* @return language string with some layout (color)
-*/
-function check_system_version()
-{
+ * Check if the current installation is up to date
+ * The code is borrowed from phpBB and slighlty modified
+ * @author The phpBB Group <support@phpbb.com> (the code)
+ * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (the modifications)
+ * @copyright (C) 2001 The phpBB Group
+ * @return language string with some layout (color)
+ */
+function check_system_version() {
     global $_configuration;
     $system_version = trim($_configuration['system_version']); // the chamilo version of your installation
 
-    if (ini_get('allow_url_fopen')==1)
-    {
-        // the number of courses
+    if (ini_get('allow_url_fopen') == 1) {
+        // The number of courses
         $number_of_courses = statistics::count_courses();
 
-        // the number of users
-           $number_of_users = statistics::count_users();
+        // The number of users
+        $number_of_users = statistics::count_users();
 
-        $version_url= 'http://version.chamilo.org/version.php?url='.urlencode(api_get_path(WEB_PATH)).'&campus='.urlencode(api_get_setting('siteName')).'&contact='.urlencode(api_get_setting('emailAdministrator')).'&version='.urlencode($system_version).'&numberofcourses='.urlencode($number_of_courses).'&numberofusers='.urlencode($number_of_users).'&donotlistcampus='.api_get_setting('donotlistcampus').'&organisation='.urlencode(api_get_setting('Institution')).'&adminname='.urlencode(api_get_setting('administratorName').' '.api_get_setting('administratorSurname'));
+        $version_url = 'http://version.chamilo.org/version.php?url='.urlencode(api_get_path(WEB_PATH)).'&campus='.urlencode(api_get_setting('siteName')).'&contact='.urlencode(api_get_setting('emailAdministrator')).'&version='.urlencode($system_version).'&numberofcourses='.urlencode($number_of_courses).'&numberofusers='.urlencode($number_of_users).'&donotlistcampus='.api_get_setting('donotlistcampus').'&organisation='.urlencode(api_get_setting('Institution')).'&adminname='.urlencode(api_get_setting('administratorName').' '.api_get_setting('administratorSurname'));
 
-        $handle=@fopen($version_url,'r');
+        $handle = @fopen($version_url, 'r');
         if ($handle !== false) {
-            $version_info=trim(@fread($handle, 1024));
+            $version_info = trim(@fread($handle, 1024));
 
-            if ($system_version <> $version_info) {
-                $output='<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Chamilo '.$system_version. '</b>. '.str_replace('http://www.chamilo.org','<a href="http://www.chamilo.org">http://www.chamilo.org</a>',get_lang('PleaseVisitDokeos')).'</span>';
+            if ($system_version != $version_info) {
+                $output = '<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Chamilo '.$system_version. '</b>. '.str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitDokeos')).'</span>';
             } else {
                 $output = '<br /><span style="color:green">'.get_lang('VersionUpToDate').': Chamilo '.$version_info.'</span>';
             }
         } else {
             $output = '<span style="color:red">' . get_lang('ImpossibleToContactVersionServerPleaseTryAgain') . '</span>';
         }
-    }
-    else
-    {
+    } else {
         $output = '<span style="color:red">' . get_lang('AllowurlfopenIsSetToOff') . '</span>';
     }
     return $output;
 }
-/*
-        FOOTER
-*/
+
+/* FOOTER */
+
 Display::display_footer();
-?>

+ 55 - 49
main/create_course/add_course.php

@@ -1,28 +1,29 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 /**
-* This script allows professors and administrative staff to create course sites.
-* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
-* @author Roan Embrechts, refactoring
-* @package dokeos.create_course
-*/
+ * This script allows professors and administrative staff to create course sites.
+ * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
+ * @author Roan Embrechts, refactoring
+ * @package chamilo.create_course
+ */
 
-// name of the language file that needs to be included
-$language_file = "create_course";
+// Name of the language file that needs to be included.
+$language_file = 'create_course';
 
-//delete the globals["_cid"] we don't need it here
-$cidReset = true; // Flag forcing the 'current course' reset
+// Flag forcing the "current course" reset.
+$cidReset = true;
 
-// including the global file
+// Including the global initialization file.
 require_once '../inc/global.inc.php';
 
-// section for the tabs
+// Section for the tabs.
 $this_section = SECTION_COURSES;
 
-// include configuration file
+// Include configuration file.
 require_once api_get_path(CONFIGURATION_PATH).'add_course.conf.php';
 
-// require_once additional libraries
+// Require additional libraries.
 require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
 require_once api_get_path(LIBRARY_PATH).'course.lib.php';
 require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
@@ -39,52 +40,55 @@ $(window).load(function () {
 });
 </script>';
 
-$interbreadcrumb[] = array('url'=>api_get_path(WEB_PATH).'user_portal.php', 'name'=> get_lang('MyCourses'));
-// Displaying the header
+$interbreadcrumb[] = array('url' => api_get_path(WEB_PATH).'user_portal.php', 'name' => get_lang('MyCourses'));
+
+// Displaying the header.
 $tool_name = get_lang('CreateSite');
 
-if (api_get_setting('allow_users_to_create_courses')=='false' && !api_is_platform_admin()) {
+if (api_get_setting('allow_users_to_create_courses') == 'false' && !api_is_platform_admin()) {
     api_not_allowed(true);
 }
 Display :: display_header($tool_name);
 
-// Check access rights
+// Check access rights.
 if (!api_is_allowed_to_create_course()) {
-    Display :: display_error_message(get_lang("NotAllowed"));
+    Display :: display_error_message(get_lang('NotAllowed'));
     Display::display_footer();
     exit;
 }
-// Get all course categories
+// Get all course categories.
 $table_course_category = Database :: get_main_table(TABLE_MAIN_CATEGORY);
 $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
 
 global $_configuration;
 $dbnamelength = strlen($_configuration['db_prefix']);
-//Ensure the database prefix + database name do not get over 40 characters
+// Ensure the database prefix + database name do not get over 40 characters.
 $maxlength = 40 - $dbnamelength;
 
-// Build the form
+// Build the form.
 $categories = array();
 $form = new FormValidator('add_course');
-// form title
+
+// Form title
 $form->addElement('header', '', $tool_name);
-//title
-$form->addElement('text', 'title', get_lang('CourseName'), array('size'=>'60','id' => 'title'));
+
+// Title
+$form->addElement('text', 'title', get_lang('CourseName'), array('size' => '60', 'id' => 'title'));
 $form->applyFilter('title', 'html_filter');
 
-$form->addElement('static',null,null,get_lang('Ex'));
+$form->addElement('static', null, null, get_lang('Ex'));
 $categories_select = $form->addElement('select', 'category_code', get_lang('Fac'), $categories);
 $form->applyFilter('category_code', 'html_filter');
 
 CourseManager::select_and_sort_categories($categories_select);
-$form->addElement('static',null,null, get_lang('TargetFac'));
+$form->addElement('static', null, null, get_lang('TargetFac'));
 
-$form->add_textfield('wanted_code', get_lang('Code'),false,array('size'=>'$maxlength','maxlength'=>$maxlength));
+$form->add_textfield('wanted_code', get_lang('Code'), false, array('size' => '$maxlength', 'maxlength' => $maxlength));
 $form->applyFilter('wanted_code', 'html_filter');
-$form->addRule('wanted_code',get_lang('Max'),'maxlength',$maxlength);
+$form->addRule('wanted_code', get_lang('Max'), 'maxlength', $maxlength);
 
-$titular= &$form->add_textfield('tutor_name', get_lang('Professors'),null,array('size'=>'60','disabled'=>'disabled'));
-$form->addElement('static',null,null,get_lang('ExplicationTrainers'));
+$titular= &$form->add_textfield('tutor_name', get_lang('Professors'), null, array('size' => '60', 'disabled' => 'disabled'));
+$form->addElement('static', null, null, get_lang('ExplicationTrainers'));
 //$form->applyFilter('tutor_name', 'html_filter');
 
 $form->addElement('select_language', 'course_language', get_lang('Ln'));
@@ -93,16 +97,16 @@ $form->applyFilter('select_language', 'html_filter');
 $form->addElement('style_submit_button', null, get_lang('CreateCourseArea'), 'class="add"');
 $form->add_progress_bar();
 
-// Set default values
-if (isset($_user["language"]) && $_user["language"]!="") {
-    $values['course_language'] = $_user["language"];
+// Set default values.
+if (isset($_user['language']) && $_user['language'] != '') {
+    $values['course_language'] = $_user['language'];
 } else {
     $values['course_language'] = api_get_setting('platformLanguage');
 }
-
 $values['tutor_name'] = api_get_person_name($_user['firstName'], $_user['lastName'], null, null, $values['course_language']);
 $form->setDefaults($values);
-// Validate the form
+
+// Validate the form.
 if ($form->validate()) {
     $course_values = $form->exportValues();
     $wanted_code = $course_values['wanted_code'];
@@ -112,23 +116,23 @@ if ($form->validate()) {
     $course_language = $course_values['course_language'];
 
     if (trim($wanted_code) == '') {
-        $wanted_code = generate_course_code(api_substr($title,0,$maxlength));
+        $wanted_code = generate_course_code(api_substr($title, 0, $maxlength));
     }
 
-    $keys = define_course_keys($wanted_code, "", $_configuration['db_prefix']);
+    $keys = define_course_keys($wanted_code, '', $_configuration['db_prefix']);
 
-    $sql_check = sprintf('SELECT * FROM '.$table_course.' WHERE visual_code = "%s"',Database :: escape_string($wanted_code));
-    $result_check = Database::query($sql_check); //I don't know why this api function doesn't work...   Ivan, 12-FEB-2010: What do you mean?
-    if ( Database::num_rows($result_check)<1 ) {
+    $sql_check = sprintf('SELECT * FROM '.$table_course.' WHERE visual_code = "%s"', Database :: escape_string($wanted_code));
+    $result_check = Database::query($sql_check);
+    if (Database::num_rows($result_check) < 1) {
         if (sizeof($keys)) {
-            $visual_code = $keys["currentCourseCode"];
-            $code = $keys["currentCourseId"];
-            $db_name = $keys["currentCourseDbName"];
-            $directory = $keys["currentCourseRepository"];
+            $visual_code = $keys['currentCourseCode'];
+            $code = $keys['currentCourseId'];
+            $db_name = $keys['currentCourseDbName'];
+            $directory = $keys['currentCourseRepository'];
             $expiration_date = time() + $firstExpirationDelay;
             prepare_course_repository($directory, $code);
             update_Db_course($db_name);
-            $pictures_array=fill_course_repository($directory);
+            $pictures_array = fill_course_repository($directory);
             fill_Db_course($db_name, $directory, $course_language,$pictures_array);
             register_course($code, $visual_code, $directory, $db_name, $tutor_name, $category_code, $title, $course_language, api_get_user_id(), $expiration_date);
         }
@@ -137,20 +141,22 @@ if ($form->validate()) {
         $message .= ' <a href="'.$link.'">'.$title."</a>";
         //$message .= "<br /><br /><br />";
         //$message .= '<a class="bottom-link" href="'.api_get_path(WEB_PATH).'user_portal.php">'.get_lang('Enter').'</a>';
-        Display :: display_confirmation_message($message,false);
+        Display :: display_confirmation_message($message, false);
         echo '<div style="float:right; margin:0px; padding:0px;">' .
                 '<a class="bottom-link" href="'.api_get_path(WEB_PATH).'user_portal.php">'.get_lang('Enter').'</a>' .
              '</div>';
     } else {
         Display :: display_error_message(get_lang('CourseCodeAlreadyExists'),false);
+        // Display the form.
         $form->display();
         //echo '<p>'.get_lang('CourseCodeAlreadyExistExplained').'</p>';
     }
 
 } else {
-    // Display the form
+    // Display the form.
     $form->display();
     Display::display_normal_message(get_lang('Explanation'));
 }
-/*	FOOTER */
-Display :: display_footer();
+
+// Footer
+Display :: display_footer();