• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/PrivacySecurity/classes/class.ilRobotSettings.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00032 class ilRobotSettings
00033 {
00034         private $open_robots = false;
00035         private $settings = null;
00036         
00037         private static $instance = null;
00045         private function __construct()
00046         {
00047                 global $ilSetting;
00048                 
00049                 $this->settings = $ilSetting;
00050                 $this->read();
00051         }
00052         
00061         public static function _getInstance()
00062         {
00063                 if(isset(self::$instance) and self::$instance)
00064                 {
00065                         return self::$instance;
00066                 }
00067                 else
00068                 {
00069                         return self::$instance = new ilRobotSettings();
00070                 }
00071         }
00072         
00079         public function robotSupportEnabled()
00080         {
00081                 return (bool) $this->open_robots;
00082         }
00083         
00090         private function read()
00091         {
00092                 $this->open_robots = (bool) $this->settings->get('open_google',false);
00093                 if(!$this->checkModRewrite())
00094                 {
00095                         $this->open_robots = false;
00096                 }
00097         }
00098         
00106         public function checkModRewrite()
00107         {
00108                 if (function_exists("apache_get_modules"))
00109                 {
00110                         if(in_array('mod_rewrite',apache_get_modules()))
00111                         {
00112                                 return true;
00113                         }
00114                 }
00115                 return false;
00116         }
00117         
00124         public function checkRewrite()
00125         {
00126                 if(!function_exists('apache_lookup_uri'))
00127                 {
00128                         return true;
00129                 }
00130                 $status_info = @apache_lookup_uri(ILIAS_HTTP_PATH.'/goto_'.CLIENT_ID.'_root_1.html');
00131                 return $status_info->status == 200;
00132         }
00133 }
00134 
00135 
00136 ?>

Generated on Fri Dec 13 2013 17:57:00 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1