ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilRobotSettings.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
33 {
34  private $open_robots = false;
35  private $settings = null;
36 
37  private static $instance = null;
45  private function __construct()
46  {
47  global $ilSetting;
48 
49  $this->settings = $ilSetting;
50  $this->read();
51  }
52 
61  public static function _getInstance()
62  {
63  if(isset(self::$instance) and self::$instance)
64  {
65  return self::$instance;
66  }
67  else
68  {
69  return self::$instance = new ilRobotSettings();
70  }
71  }
72 
79  public function robotSupportEnabled()
80  {
81  return (bool) $this->open_robots;
82  }
83 
90  private function read()
91  {
92  $this->open_robots = (bool) $this->settings->get('open_google',false);
93  if(!$this->checkModRewrite())
94  {
95  $this->open_robots = false;
96  }
97  }
98 
106  public function checkModRewrite()
107  {
108  if (function_exists("apache_get_modules"))
109  {
110  if(in_array('mod_rewrite',apache_get_modules()))
111  {
112  return true;
113  }
114  }
115  return false;
116  }
117 
124  public function checkRewrite()
125  {
126  if(!function_exists('apache_lookup_uri'))
127  {
128  return true;
129  }
130  $status_info = @apache_lookup_uri(ILIAS_HTTP_PATH.'/goto_'.CLIENT_ID.'_root_1.html');
131  return $status_info->status == 200;
132  }
133 }
134 
135 
136 ?>