Dokeos PHP Cross Reference Learning Management Systems

Source: /main/admin/index.php - 571 lines - 25015 bytes - Summary - Text - Print

   1  <?php
   2  /* For licensing terms, see /dokeos_license.txt */
   3  
   4  /**
   5  * @package dokeos.admin
   6  */
   7  
   8  // Language files that should be included
   9  $language_file=array('admin','tracking');
  10  
  11  // resetting the course id
  12  $cidReset=true;
  13  
  14  // setting the help
  15  $help_content = 'platformadministration';
  16  
  17  // including the global Dokeos file
  18  require_once  '../inc/global.inc.php';
  19  
  20  // including additional libraries
  21  require_once api_get_path(LIBRARY_PATH).'security.lib.php';
  22  
  23  // Section for the tabs
  24  $this_section=SECTION_PLATFORM_ADMIN;
  25  
  26  // Access restrictions
  27  api_protect_admin_script(true);
  28  
  29  $nameTools = get_lang('PlatformAdmin');
  30  
  31  // setting breadcrumbs
  32  //$interbreadcrumb[] = array('url' => 'index.php', 'name' => $nameTools);
  33  
  34  // setting the name of the tool
  35  $tool_name=get_lang('PlatformAdmin');
  36  
  37  // Displaying the header
  38  Display::display_header($nameTools);
  39  
  40  
  41  if(api_is_platform_admin())
  42  {
  43      if(is_dir(api_get_path(SYS_CODE_PATH).'install/') && is_readable(api_get_path(SYS_CODE_PATH).'install/index.php'))
  44      {
  45          Display::display_warning_message(get_lang('InstallDirAccessibleSecurityThreat'));
  46      }
  47      /*
  48      ==============================================================================
  49              ACTION HANDLING
  50      ==============================================================================
  51      */
  52      if (!empty($_POST['Register']))
  53      {
  54          register_site();
  55          Display :: display_confirmation_message(get_lang('VersionCheckEnabled'));
  56      }
  57  
  58      /*
  59      ==============================================================================
  60              MAIN SECTION
  61      ==============================================================================
  62      */
  63      $keyword_url = Security::remove_XSS((empty($_GET['keyword'])?'':$_GET['keyword']));
  64  }
  65  
  66  echo '<div id="content">';
  67  
  68  if (api_is_platform_admin()) {
  69      ?>
  70      <div class="admin_section section">
  71      <div class="admin_section_title sectiontitle"><a href="user_list.php"><?php echo Display::return_icon('pixel.gif', get_lang('HomePage'), array('class' => 'toolactionplaceholdericon toolactionadminusers')); ?> <?php echo api_ucfirst(get_lang('Users')); ?></a></div>
  72      <div class="admin_section_content sectioncontent">
  73      <form method="get" action="user_list.php">
  74              <input type="text" name="keyword" value="<?php echo $keyword_url; ?>"/>
  75              <button class="search" type="submit"> <?php echo get_lang('Search');?>
  76              </button>
  77              </form>
  78      <ul>
  79          <li><a href="user_list.php?search=advanced"><?php echo api_ucfirst(get_lang('AdvancedSearch')); ?></a></li>
  80          <li><a href="user_list.php">    <?php echo get_lang('UserList') ?></a></li>
  81          <li><a href="user_add.php">        <?php echo get_lang('AddUsers') ?></a></li>
  82          <?php 
  83          //if (api_get_setting('allow_social_tool')=='true') { ?>
  84          <!--<li><a href="group_add.php">    <?php echo get_lang('AddGroups') ?></a></li>
  85              <li><a href="group_list.php">    <?php echo get_lang('GroupList') ?></a></li>-->
  86          <?php
  87          //}
  88          if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){
  89              ?>
  90              <!-- dynamic ldap code -->
  91                <li><a href="ldap_users_list.php"><?php echo get_lang('ImportLDAPUsersIntoPlatform');?></a></li>
  92              <!-- dynamic ldap code -->
  93              <?php
  94              }
  95          ?>
  96          </ul>
  97      </div>
  98      </div>
  99  <?php
 100  }
 101  else
 102  {
 103      ?>
 104      <div class="admin_section section">
 105      <div class="admin_section_title sectiontitle"><a href="user_list.php"><?php echo Display::return_icon('pixel.gif', get_lang('HomePage'), array('class' => 'toolactionplaceholdericon toolactionadminusers')); ?> <?php echo api_ucfirst(get_lang('Users')); ?></a></div>
 106      <div class="admin_section_content sectioncontent">
 107      <ul>
 108          <li><a href="user_list.php">    <?php echo get_lang('UserList') ?></a></li>
 109          <li><a href="../mySpace/user_add.php"><?php echo get_lang('AddUsers') ?></a></li>
 110          <li><a href="user_import.php">    <?php echo get_lang('ImportUserListXMLCSV') ?></a></li>
 111      </ul>
 112      </div>
 113      </div>
 114  <?php
 115  }
 116  
 117  
 118  if(api_is_platform_admin()) {
 119  ?>
 120      <div class="admin_section section">
 121      <div class="admin_section_title sectiontitle"><a href="course_list.php"><?php echo Display::return_icon('pixel.gif', get_lang('Courses'), array('class' => 'toolactionplaceholdericon toolactionadmincourses')); ?> <?php echo api_ucfirst(get_lang('Courses')); ?></a></div>
 122      <div class="admin_section_content sectioncontent">
 123          <form method="get" action="course_list.php">
 124          <input type="text" name="keyword" value="<?php echo $keyword_url; ?>"/>
 125          <button class="search" type="submit"> <?php echo get_lang('Search');?>
 126              </button>
 127          </form>
 128          <ul>
 129          <!--<li style="list-style-type:none"></li>-->
 130          <li>
 131          <a href="course_list.php?search=advanced"><?php echo api_ucfirst(get_lang('AdvancedSearch')); ?></a>
 132  
 133      </li>
 134      <li><a href="course_list.php"><?php echo get_lang('CourseList') ?></a></li>
 135      <li><a href="course_add.php"><?php echo get_lang('AddCourse') ?></a></li>
 136      <li><a href="course_enrolment.php"><?php echo get_lang('EnrolmentToCoursesAtRegistrationToPortal') ?></a></li>    
 137      <!--<li><a href="course_virtual.php"><?php //echo get_lang('AdminManageVirtualCourses') ?></a></li>-->
 138      <li><a href="course_category.php"><?php echo get_lang('AdminCategories'); ?></a></li>    
 139      <li><a href="course_user_import.php"><?php echo get_lang('ImportUsersToACourse'); ?></a></li>
 140      <?php if (api_get_setting('search_enabled')=='true') { ?>
 141        <!--<li><a href="specific_fields.php"><?php echo get_lang('SpecificSearchFields'); ?></a></li></li>-->
 142      <?php } ?>
 143      <?php
 144          if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){
 145          ?>
 146          <!-- dynamic ldap code -->
 147          <li><a href="ldap_import_students.php"><?php echo get_lang('ImportLDAPUsersIntoCourse');?></a></li>
 148          <!-- dynamic ldap code -->
 149          <?php
 150          }
 151      ?>
 152  
 153      </ul>
 154      </div>
 155      </div>
 156  
 157  
 158      <div class="admin_section section">
 159      <div class="admin_section_title sectiontitle"><a href="settings.php?category=Platform"><?php echo Display::return_icon('pixel.gif', get_lang('Platform'), array('class' => 'toolactionplaceholdericon toolactionhomepage')); ?> <?php echo api_ucfirst(get_lang('Platform')); ?></a></div>
 160      <div class="admin_section_content sectioncontent">
 161       <ul>
 162        <li><a href="settings.php?category=Platform"><?php echo get_lang('DokeosConfigSettings') ?></a></li>
 163        <li><a href="special_exports.php"><?php echo get_lang('SpecialExports') ?></a></li>
 164        <li><a href="system_announcements.php"><?php echo get_lang('SystemAnnouncements') ?></a></li>
 165        <li><a href="languages.php"><?php echo get_lang('Languages'); ?></a></li>
 166        <li><a href="configure_homepage.php"><?php echo get_lang('ConfigureHomePage'); ?></a></li>
 167        <li><a href="configure_inscription.php"><?php echo get_lang('ConfigureInscription'); ?></a></li>
 168        <li><a href="statistics/index.php"><?php echo get_lang('ToolName'); ?> </a></li>
 169        <li><a href="agenda.php"><?php echo get_lang('GlobalAgenda'); ?> </a></li>
 170        <?php
 171        if (api_get_setting('show_emailtemplates')=='true') {
 172        echo '<li><a href="emailtemplates.php">'.get_lang('Automaticemails').'</a></li>';
 173        }
 174        ?>
 175        <?php if(!empty($phpMyAdminPath)) { ?>
 176        <li><a href="<?php echo $phpMyAdminPath; ?>" target="_blank"><?php echo get_lang("AdminDatabases"); ?></a><br />(<?php echo get_lang("DBManagementOnlyForServerAdmin"); ?>)</li>
 177        <?php } ?>
 178        <?php
 179        if(!empty($_configuration['multiple_access_urls']))
 180        {
 181          echo '<li><a href="access_urls.php">'.get_lang('ConfigureMultipleAccessURLs').'</a></li>';
 182        }
 183  
 184        /*if (api_get_setting('allow_reservation')=='true') {
 185                echo '<li><a href="../reservation/m_category.php">'.get_lang('BookingSystem').'</a></li>';
 186        }*/
 187  
 188          if (api_get_setting('allow_terms_conditions')=='true') {
 189                echo '<li><a href="legal_add.php">'.get_lang('TermsAndConditions').'</a></li>';
 190        }
 191  
 192        ?>
 193       </ul>
 194      </div>
 195      </div>
 196  
 197      <?php
 198  }
 199  
 200  if(api_get_setting('show_catalogue')=='true')
 201  {
 202  ?>
 203  
 204      <div class="admin_section section">
 205          <div class="admin_section_title sectiontitle"><a href="catalogue_management.php"><?php echo Display::return_icon('pixel.gif', get_lang('Catalogue'), array('class' => 'toolactionplaceholdericon toolactionadmincatalogue')); ?> <?php echo get_lang('Catalogue') ?></a></div>
 206          <div class="admin_section_content sectioncontent">
 207   <ul>
 208    <li><a href="catalogue_management.php"><?php echo get_lang('Catalogue') ?></a></li>
 209    <li><a href="topic_list.php"><?php echo get_lang('Topics') ?></a></li>
 210    <li><a href="programme_list.php"><?php echo get_lang('Programmes') ?></a></li>
 211    <li><a href="session_list.php"><?php echo get_lang('Sessions') ?></a></li>
 212    <li><a href="session_add.php"><?php echo get_lang('AddSession') ?></a></li>  
 213                  <?php    if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){ ?>
 214           <li><a href="ldap_import_students_to_session.php"><?php echo get_lang('ImportLDAPUsersIntoSession');?></a></li>
 215                  <?php    } ?>  
 216    </ul>
 217           </div>
 218      </div>
 219  
 220  <?php
 221  }
 222  else if(api_get_setting('use_session_mode')=='true')
 223  {
 224  ?>
 225  
 226      <div class="admin_section section">
 227          <div class="admin_section_title sectiontitle"><a href="session_list.php"><?php echo Display::return_icon('pixel.gif', get_lang('Sessions'), array('class' => 'toolactionplaceholdericon toolactionadminsession')); ?> <?php echo get_lang('Sessions') ?></a></div>
 228          <div class="admin_section_content sectioncontent">
 229   <form method="POST" action="session_list.php">
 230      <input type="text" name="keyword_name" value="<?php echo $keyword_url; ?>"/>
 231                  <button class="search" type="submit"> <?php echo get_lang('Search');?></button>
 232      </form>
 233   <ul>
 234    <li><a href="session_list.php?search=advanced"><?php echo api_ucfirst(get_lang('AdvancedSearch')); ?></a></li>
 235    <li><a href="session_list.php"><?php echo get_lang('ListSession'); ?></a></li>
 236    <li><a href="session_category_list.php"><?php echo get_lang('ListSessionCategory'); ?></a></li>
 237    <li><a href="session_add.php"><?php echo get_lang('AddSession'); ?></a></li>
 238   <?php    if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){ ?>
 239   <li><a href="ldap_import_students_to_session.php"><?php echo get_lang('ImportLDAPUsersIntoSession');?></a></li>
 240   <?php    } ?>  
 241    </ul>
 242           </div>
 243      </div>
 244  
 245  <?php
 246  }
 247  else if(api_is_platform_admin())
 248  {
 249  ?>
 250  
 251  <div class="admin_section section">
 252  <div class="admin_section_title sectiontitle"><a href="class_list.php"><?php Display::return_icon('pixel.gif', get_lang('AdminClasses'), array('class' => 'toolactionplaceholdericon toolactionadminsession')); ?> <?php echo api_ucfirst(get_lang('AdminClasses')); ?></a></div>
 253  <div class="admin_section_content sectioncontent">
 254  <form method="get" action="class_list.php">
 255  
 256      <input type="text" name="keyword" value="<?php echo $keyword_url; ?>"/>
 257      <button class="search" type="submit"> <?php echo get_lang('Search');?></button>
 258      </form>
 259  <ul>
 260  <!--<li style="list-style-type:none"></li>-->
 261  <li><a href="class_list.php"><?php echo get_lang('ClassList'); ?></a></li>
 262  <li><a href="class_add.php"><?php echo get_lang('AddClasses'); ?></a></li>
 263  <li><a href="class_import.php"><?php echo get_lang('ImportClassListCSV'); ?></a></li>
 264  <li><a href="class_user_import.php"><?php echo get_lang('AddUsersToAClass'); ?> CSV</a></li>
 265  <li><a href="subscribe_class2course.php"><?php echo get_lang('AddClassesToACourse'); ?></a></li>
 266  </ul>
 267  <br />
 268  <br />
 269  </div>
 270  </div>
 271  <?php
 272  }
 273  
 274  if(api_is_platform_admin()){
 275  ?>
 276  <div class="admin_section section">
 277  <div class="admin_section_title sectiontitle"><a href="http://www.dokeos.com/forum/" target="_blank"><?php echo Display::return_icon('pixel.gif', get_lang('Dokeos'), array('class' => 'toolactionplaceholdericon toolactionadminsupport')); ?> Dokeos Community</a></div>
 278  <div class="admin_section_content sectioncontent">
 279   <ul>
 280    <li><a href="http://www.dokeos.com/forum/" target="_blank"><?php echo get_lang('DokeosForum'); ?></a></li>
 281    <li><a href="http://www.dokeos.com/wiki/index.php/Main_Page" target="_blank"><?php echo get_lang('TechnicalWiki'); ?></a></li>
 282    <li><a href="http://www.dokeos.com/en/documentation.php" target="_blank"><?php echo get_lang('Documentation'); ?></a></li>
 283    <li><a href="http://www.dokeos.com/en/mind" target="_blank"><?php echo get_lang('DokeosMind'); ?></a></li>
 284    <li><a href="http://www.dokeos.com/DLTT/" target="_blank"><?php echo get_lang('TranslationTool'); ?></a></li>
 285    <li><a href="http://www.dokeos.com/en/community.php" target="_blank"><?php echo get_lang('WorldwideMap'); ?></a></li>
 286    <li><a href="http://www.dokeos.com/en/services/e-courses-production" target="_blank"><?php echo get_lang('AuthoringStudio'); ?></a></li>
 287    <li>
 288    <?php
 289    //try to display a maximum before we check the dokeos version and all that
 290        //session_write_close(); //close session to avoid blocking concurrent access
 291      flush(); //send data to client as much as allowed by the web server
 292      //ob_flush();
 293      echo get_lang('VersionCheck').': '.get_lang('SiteRegistered');
 294    ?>
 295    </li>
 296    <!--<li><a href="configure_extensions.php?display=visio"><?php echo get_lang('Visioconf'); ?></a></li>
 297        <li><a href="configure_extensions.php?display=ppt2lp"><?php echo get_lang('Ppt2lp'); ?></a></li>  
 298        <li><a href="configure_extensions.php?display=ephorus"><?php echo get_lang('EphorusPlagiarismPrevention'); ?></a></li> 
 299    ?>
 300    <li><a href="configure_extensions.php?display=search"><?php echo get_lang('SearchEngine'); ?></a></li>
 301    <li><a href="configure_extensions.php?display=serverstats"><?php echo get_lang('ServerStatistics'); ?></a></li>
 302    <li><a href="configure_extensions.php?display=bandwidthstats"><?php echo get_lang('BandWidthStatistics'); ?></a></li>-->
 303    </ul>
 304  </div>
 305  </div>
 306  <?php
 307      /*if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){
 308      ?>
 309      <!-- dynamic ldap code -->
 310      <div class="admin_section">
 311       <h4><?php Display::display_icon('members.gif', 'LDAP'); ?> LDAP</h4>
 312       <ul>
 313        <li><a href="ldap_users_list.php"><?php echo get_lang('ImportLDAPUsersIntoPlatform');?></a></li>
 314        <!--<li><a href="ldap_import_students.php"><?php echo get_lang('ImportLDAPUsersIntoCourse');?></a></li>
 315        <li><a href="ldap_import_students_to_session.php"><?php echo get_lang('ImportLDAPUsersIntoSession');?></a></li> -->
 316        <li><a href="session_auto_import.php"><?php echo 'Table de correspondance des Sessions';?></a></li>
 317  
 318        <!--li><a href="ldap_users_synchro.php"><?php echo get_lang('LDAPSynchroImportUsersAndStepsInSessions');?></a></li-->
 319       </ul>
 320      </div>
 321      <!-- dynamic ldap code -->
 322      <?php
 323      }*/
 324  ?>
 325  <!--<div class="admin_section section">
 326  <div class="admin_section_title sectiontitle"><?php Display::display_icon('dokeos.gif', 'Dokeos'); ?> Dokeos.com</div>
 327  <div class="admin_section_content sectioncontent">
 328   <ul>
 329    <li><a href="http://www.dokeos.com/" target="_blank"><?php echo get_lang('DokeosHomepage'); ?></a></li>
 330    <li><a href="http://www.dokeos.com/forum/" target="_blank"><?php echo get_lang('DokeosForum'); ?></a></li>
 331    <li><a href="http://www.dokeos.com/extensions/" target="_blank"><?php echo get_lang('DokeosExtensions'); ?></a></li>
 332    <li>-->
 333    <?php
 334    //try to display a maximum before we check the dokeos version and all that
 335        //session_write_close(); //close session to avoid blocking concurrent access
 336      //flush(); //send data to client as much as allowed by the web server
 337      //ob_flush();
 338      //echo get_lang('VersionCheck').': '.version_check();
 339    ?>
 340   <!-- </li>
 341   </ul>
 342  </div>
 343  </div>-->
 344  
 345  <div class="admin_section section">
 346  <div class="admin_section_title sectiontitle"><a href="http://www.dokeos.com/en/node/32"><?php echo Display::return_icon('pixel.gif', get_lang('ConfigureExtensions'), array('class' => 'toolactionplaceholdericon toolactionadminconfext')); ?> <?php echo api_ucfirst(get_lang('ConfigureExtensions')); ?></a></div>
 347  <div class="admin_section_content sectioncontent">
 348   <ul>
 349       <?php if(api_get_setting('service_ppt2lp', 'active') == 'true') { ?>
 350          <li><a href="configure_extensions.php?display=ppt2lp"><?php echo get_lang('Ppt2lp'); ?></a></li>
 351       <?php } ?>
 352       <?php if(api_get_setting('service_visio', 'active') == 'true') { ?>
 353          <li><a href="configure_extensions.php?display=visio"><?php echo get_lang('Visioconf'); ?></a></li>
 354       <?php } ?>
 355       <?php if(api_get_setting('search_enabled') == 'true') { ?>
 356          <li><a href="configure_extensions.php?display=search"><?php echo get_lang('SearchEngine'); ?></a></li>
 357       <?php } ?>
 358   <!-- <li><a href="configure_extensions.php?display=visio"><?php echo get_lang('Visioconf'); ?></a></li>
 359    <li><a href="configure_extensions.php?display=ephorus"><?php echo get_lang('EphorusPlagiarismPrevention'); ?></a></li>
 360    <li><a href="configure_extensions.php?display=search"><?php echo get_lang('SearchEngine'); ?></a></li>
 361    <li><a href="configure_extensions.php?display=serverstats"><?php echo get_lang('ServerStatistics'); ?></a></li>
 362    <li><a href="configure_extensions.php?display=bandwidthstats"><?php echo get_lang('BandWidthStatistics'); ?></a></li>
 363    <li><a href="http://www.dokeos.com/en/services/e-courses-production" target="_blank"><?php echo get_lang('CourseBuildingStudio'); ?></a></li>
 364    <li><a href="http://www.dokeos.com/en/node/777" target="_blank"><?php echo get_lang('ContentShop'); ?></a></li>
 365    <li><a href="http://www.dokeos.com/en/download.php" target="_blank"><?php echo get_lang('MedPro'); ?></a></li>
 366    <li><a href="http://www.dokeos.com/en/services/technical-assistance" target="_blank"><?php echo get_lang('TechnicalAssistance'); ?></a></li>
 367    <li><a href="configure_extensions.php?display=visio"><?php echo get_lang('Videoconferencing'); ?></a></li>
 368    <li><a href="configure_extensions.php?display=ppt2lp"><?php echo get_lang('OogieRapidLearning'); ?></a></li>-->
 369    <li><a href="http://www.dokeos.com/en/deployment/professional"><?php echo get_lang('DokeosProFeatures'); ?></a></li>
 370    <li><a href="http://www.dokeos.com/en/services/certified-training"><?php echo get_lang('TrainersTraining'); ?></a></li>  
 371    <li><a href="http://www.dokeos.com/en/services/hr-integration"><?php echo get_lang('HRIntegration'); ?></a></li>  
 372    <li><a href="http://www.dokeos.com/en/node/32"><?php echo get_lang('TechnicalAssistance'); ?></a></li>
 373    </ul>
 374  </div>
 375  </div>
 376  
 377  
 378  <div class="clear">&nbsp;</div>
 379  <?php
 380  }
 381  
 382  /**
 383   * Displays either the text for the registration or the message that the installation is (not) up to date
 384   *
 385   * @return string html code
 386   * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
 387   * @version august 2006
 388   * @todo have a 6monthly re-registration
 389   */
 390  function version_check()
 391  {
 392      $tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
 393      $sql = 'SELECT selected_value FROM  '.$tbl_settings.' WHERE variable="registered" ';
 394      $result = Database::query($sql,__FILE__,__LINE__);
 395      $row=Database::fetch_array($result,'ASSOC');
 396  
 397      // The site has not been registered yet
 398      //if (api_get_setting('registered')=='false')
 399  
 400      $return = '';
 401      if ($row['selected_value']=='false')
 402      {
 403          $return .= '<form action="'.api_get_self().'" id="VersionCheck" name="VersionCheck" method="post">';
 404          $return .= get_lang('VersionCheckExplanation');
 405          $return .= '<input type="checkbox" name="donotlistcampus" value="1" id="checkbox" />'.get_lang('HideCampusFromPublicDokeosPlatformsList');
 406          $return .= '<button type="submit" class="save" name="Register" value="'.get_lang('EnableVersionCheck').'" id="register" />'.get_lang('EnableVersionCheck').'</button>';
 407          $return .= '</form>';
 408      }
 409      else
 410      {
 411          // The site has been registered already but is seriously out of date (registration date + 15552000 seconds)
 412          /*
 413          if ((api_get_setting('registered') + 15552000) > mktime())
 414          {
 415              $return = 'It has been a long time since about your campus has been updated on Dokeos.com';
 416              $return .= '<form action="'.api_get_self().'" id="VersionCheck" name="VersionCheck" method="post">';
 417              $return .= '<input type="submit" name="Register" value="Enable Version Check" id="register" />';
 418              $return .= '</form>';
 419          }
 420          else
 421          {
 422          */
 423          $return = 'site registered. ';
 424          $return .= check_dokeos_version2();
 425          //}
 426      }
 427      return $return;
 428  }
 429  
 430  /**
 431   * This setting changes the registration status for the campus
 432   *
 433   * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
 434   * @version August 2006
 435   *
 436   * @todo the $_settings should be reloaded here. => write api function for this and use this in global.inc.php also.
 437   */
 438  function register_site()
 439  {
 440      // Database Table Definitions
 441      $tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
 442  
 443      // the SQL statment
 444      $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='registered'";
 445      $result = Database::query($sql,__FILE__,__LINE__);
 446  
 447      //
 448      if ($_POST['donotlistcampus'])
 449      {
 450          $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='donotlistcampus'";
 451          $result = Database::query($sql,__FILE__,__LINE__);
 452      }
 453  
 454      // reload the settings
 455  }
 456  
 457  /**
 458  * Check if the current installation is up to date
 459  * The code is borrowed from phpBB and slighlty modified
 460  * @author The phpBB Group <support@phpbb.com> (the code)
 461  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (the modifications)
 462  * @copyright (C) 2001 The phpBB Group
 463  * @return language string with some layout (color)
 464  */
 465  function check_dokeos_version2()
 466  {
 467      global $_configuration;
 468      $dokeos_version = trim($_configuration['dokeos_version']); // the dokeos version of your installation
 469  
 470      if (ini_get('allow_url_fopen')==1)
 471      {
 472          // the number of courses
 473          $sql="SELECT count(code) FROM ".Database::get_main_table(TABLE_MAIN_COURSE);
 474          $result=Database::query($sql,__FILE__,__LINE__);
 475          $row = Database::fetch_array($result);
 476          $number_of_courses = $row[0];
 477  
 478          // the number of users
 479          $sql="SELECT count(user_id) FROM ".Database::get_main_table(TABLE_MAIN_USER);
 480          $result=Database::query($sql,__FILE__,__LINE__);
 481          $row = Database::fetch_array($result);
 482          $number_of_users = $row[0];
 483  
 484          $script = 'version.pro.php';
 485          $version_url= 'http://www.dokeos.com/'.$script.'?url='.urlencode(api_get_path(WEB_PATH)).'&campus='.urlencode(api_get_setting('siteName')).'&contact='.urlencode(api_get_setting('emailAdministrator')).'&version='.urlencode($dokeos_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'));
 486          $handle=@fopen($version_url,'r');
 487          $version_info=trim(@fread($handle, 1024));
 488  
 489          if ($dokeos_version<>$version_info)
 490          {
 491              $output='<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' <b>Dokeos '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Dokeos '.$dokeos_version. '</b>. '.str_replace('http://www.dokeos.com','<a href="http://www.dokeos.com">http://www.dokeos.com</a>',get_lang('PleaseVisitDokeos')).'</span>';
 492          }
 493          else
 494          {
 495              $output = '<br /><span style="color:green">'.get_lang('VersionUpToDate').': Dokeos '.$version_info.'</span>';
 496          }
 497      }
 498      else
 499      {
 500          $output = '<span style="color:red">' . get_lang('AllowurlfopenIsSetToOff') . '</span>';
 501      }
 502      return $output;
 503  }
 504  
 505  /**
 506  * Check if the current installation is up to date
 507  * The code is borrowed from phpBB and slighlty modified
 508  * @author The phpBB Group <support@phpbb.com> (the code)
 509  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (the modifications)
 510  * @copyright (C) 2001 The phpBB Group
 511  * @return language string with some layout (color)
 512  * @deprecated     For some reason this code adds a 9 in front and a 0 at the end of what normally gets displayed by
 513                  the http://www.dokeos.com/version.php page (instead of version.txt) . That's why I chose to use fopen which requires however
 514                  that allow_url_open is set to true
 515  */
 516  function check_dokeos_version()
 517  {
 518      global $_configuration; // the dokeos version of your installation
 519      $dokeos_version = $_configuration['dokeos_version'];
 520  
 521      if ($fsock = @fsockopen('www.dokeos.com', 80, $errno, $errstr))
 522      {
 523          @fputs($fsock, "GET /version.php HTTP/1.1\r\n");
 524          @fputs($fsock, "HOST: www.dokeos.com\r\n");
 525          @fputs($fsock, "Connection: close\r\n\r\n");
 526  
 527          $get_info = false;
 528          while (!@feof($fsock))
 529          {
 530              if ($get_info)
 531              {
 532                  $version_info .= @fread($fsock, 1024);
 533              }
 534              else
 535              {
 536                  if (@fgets($fsock, 1024) == "\r\n")
 537                  {
 538                      $get_info = true;
 539                  }
 540              }
 541          }
 542          @fclose($fsock);
 543  
 544          if (trim($dokeos_version)<>trim($version_info))
 545          {
 546              $output='<span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' <b>Dokeos '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Dokeos '.$dokeos_version. '</b>. '.str_replace('http://www.dokeos.com','<a href="http://www.dokeos.com">http://www.dokeos.com</a>',get_lang('PleaseVisitDokeos')).'</span>';
 547          }
 548          else
 549          {
 550              $output = '<span style="color:green">'.get_lang('VersionUpToDate').': Dokeos '.$version_info.'</span>';
 551          }
 552      }
 553      else
 554      {
 555          if ($errstr)
 556          {
 557              $output = '<span style="color:red">' . get_lang('ConnectSocketError') . ': '. $errstr . '</span>';
 558          }
 559          else
 560          {
 561              $output = '<span>' . get_lang('SocketFunctionsDisabled') . '</span>';
 562          }
 563      }
 564      return $output;
 565  }
 566  
 567  echo '</div>';
 568  
 569  // display the footer
 570  Display::display_footer();
 571  ?>

title

Description

title

Description

title

Description

title

title

Body