ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 }
94
95
102 public function checkRewrite()
103 {
104 if(!function_exists('apache_lookup_uri'))
105 {
106 return true;
107 }
108
109 $url = ILIAS_HTTP_PATH.'/goto_'.CLIENT_ID.'_root_1.html';
110 $status_info = @apache_lookup_uri($url);
111
112 // fallback for php as cgi (and available remote fopen)
113 if($status_info === false && ini_get('allow_url_fopen'))
114 {
115 // fopen respects HTTP error codes
116 $fp = @fopen($url, 'r');
117 if($fp)
118 {
119 fclose($fp);
120 return true;
121 }
122 return false;
123 }
124
125 return $status_info->status == 200;
126 }
127}
128
129
130?>
robotSupportEnabled()
Check if client is open for robots.
checkRewrite()
Indirect Check of allow override.
read()
Read settings.
__construct()
Private constructor => use getInstance.
static _getInstance()
Get instance.
global $ilSetting
Definition: privfeed.php:40
$url
Definition: shib_logout.php:72