ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  return self::$instance;
65  } else {
66  return self::$instance = new ilRobotSettings();
67  }
68  }
69 
76  public function robotSupportEnabled()
77  {
78  return (bool) $this->open_robots;
79  }
80 
87  private function read()
88  {
89  $this->open_robots = (bool) $this->settings->get('open_google', false);
90  }
91 
92 
99  public function checkRewrite()
100  {
101  if (!function_exists('apache_lookup_uri')) {
102  return true;
103  }
104 
105  $url = ILIAS_HTTP_PATH . '/goto_' . CLIENT_ID . '_root_1.html';
106  $status_info = @apache_lookup_uri($url);
107 
108  // fallback for php as cgi (and available remote fopen)
109  if ($status_info === false && ini_get('allow_url_fopen')) {
110  // fopen respects HTTP error codes
111  $fp = @fopen($url, 'r');
112  if ($fp) {
113  fclose($fp);
114  return true;
115  }
116  return false;
117  }
118 
119  return $status_info->status == 200;
120  }
121 }
checkRewrite()
Indirect Check of allow override.
static _getInstance()
Get instance.
robotSupportEnabled()
Check if client is open for robots.
settings()
Definition: settings.php:2
global $ilSetting
Definition: privfeed.php:17
$url
__construct()
Private constructor => use getInstance.
read()
Read settings.