public function displayList() { global $cookie, $currentIndex; $warnings = array(); if (!file_exists(_PS_ROOT_DIR_ . '/.htaccess')) { $warnings[] = $this->l('In order to enable the PrestaShop Webservice, please generate the .htaccess file via the "Generators" tab (in the "Tools" tab).'); } if (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === false) { $warnings[] = $this->l('To avoid operating problems, please use an Apache server.'); } if (function_exists('apache_get_modules')) { $apache_modules = apache_get_modules(); if (!in_array('mod_auth_basic', $apache_modules)) { $warnings[] = $this->l('Please activate the Apache module \'mod_auth_basic\' to allow authentication of PrestaShop webservice.'); } if (!in_array('mod_rewrite', $apache_modules)) { $warnings[] = $this->l('Please activate the Apache module \'mod_rewrite\' to allow using the PrestaShop webservice.'); } } else { $warnings[] = $this->l('We could not check if basic authentication and rewrite extensions are activated. Please manually check if they are activated in order to use the PrestaShop webservice.'); } if (!extension_loaded('SimpleXML')) { $warnings[] = $this->l('Please activate the PHP extension \'SimpleXML\' to allow testing of PrestaShop webservice.'); } if (!configuration::get('PS_SSL_ENABLED')) { $warnings[] = $this->l('If possible, it is preferable to use SSL (https) for webservice calls, as it avoids the security issues of type "man in the middle".'); } $this->displayWarning($warnings); foreach ($this->_list as $k => $item) { if ($item['is_module'] && $item['class_name'] && $item['module_name'] && ($instance = Module::getInstanceByName($item['module_name'])) && !$instance->useNormalPermissionBehaviour()) { unset($this->_list[$k]); } } parent::displayList(); }
/** * @return true if url rewriting is available, else false. */ public function has_url_rewriting() { if (function_exists('apache_get_modules')) { return in_array(self::$mod_rewrite, apache_get_modules()); } throw new UnsupportedOperationException('can\'t check url rewriting availabilty'); }
public function setupSeo() { if (file_exists('../.htaccess')) { return; } else { if (function_exists('apache_get_modules')) { $modules = apache_get_modules(); $mod_rewrite = in_array('mod_rewrite', $modules); } else { $mod_rewrite = getenv('HTTP_MOD_REWRITE') == 'On' ? true : false; } if ($mod_rewrite && file_exists('../.htaccess.txt')) { chmod('../.htaccess.txt', 0777); $file = fopen('../.htaccess.txt', 'a'); $document = file_get_contents('../.htaccess.txt'); $root = rtrim(HTTP_SERVER, '/'); $folder = substr(strrchr($root, '/'), 1); $path = rtrim(rtrim(dirname($_SERVER['SCRIPT_NAME']), ''), '/' . $folder . '.\\'); if (strlen($path) > 1) { $path .= '/'; } if (!$path) { $path = '/'; } $document = str_replace('RewriteBase /', 'RewriteBase ' . $path, $document); file_put_contents('../.htaccess.txt', $document); fflush($file); fclose($file); rename('../.htaccess.txt', '../.htaccess'); } } clearstatcache(); }
/** * @return bool */ private function isModRewriteEnabled() { if (!function_exists('apache_get_modules')) { return false; } return in_array('mod_rewrite', apache_get_modules()); }
function _mod_rewrite() { if (function_exists('apache_get_modules')) { debug_log("apache_get_modules exists"); if (in_array('mod_rewrite', apache_get_modules())) { debug_log("mod_rewrite activé"); return true; } else { debug_log("mod_rewrite desactivé"); } } else { debug_log("apache_get_modules non exists"); } if (isset($_SERVER['HTTP_MOD_REWRITE'])) { debug_log("l'info est indiqué dans la Globale _SERVER_ ..."); if (getenv('HTTP_MOD_REWRITE') === 'On') { debug_log("mod_rewrite activé"); return true; } else { debug_log("mod_rewrite desactivé"); } } else { debug_log("l'info n'est pas indiqué dans la Globale _SERVER_ ..."); } //if (strpos(shell_exec('/usr/local/apache/bin/apachectl -l'), 'mod_rewrite') !== false) // return true; return false; }
private function check_module($name, $type = null) { $server = array('mod_security', 'mod_win32', 'mpm_winnt', 'http_core', 'mod_so', 'mod_actions', 'mod_alias', 'mod_asis', 'mod_auth_basic', 'mod_auth_digest', 'mod_authn_default', 'mod_authn_file', 'mod_authz_default', 'mod_authz_groupfile', 'mod_authz_host', 'mod_authz_user', 'mod_autoindex', 'mod_cgi', 'mod_dav_lock', 'mod_dir', 'mod_env', 'mod_headers', 'mod_include', 'mod_info', 'mod_isapi', 'mod_log_config', 'mod_mime', 'mod_negotiation', 'mod_proxy', 'mod_proxy_ajp', 'mod_rewrite', 'mod_setenvif', 'mod_ssl', 'mod_status', 'mod_php5', 'mod_perl'); $php = array('bcmath', 'calendar', 'com_dotnet', 'ctype', 'date', 'ereg', 'filter', 'ftp', 'hash', 'iconv', 'json', 'mcrypt', 'SPL', 'odbc', 'pcre', 'Reflection', 'session', 'standard', 'mysqlnd', 'tokenizer', 'zip', 'zlib', 'libxml', 'dom', 'PDO', 'bz2', 'SimpleXML', 'wddx', 'xml', 'xmlreader', 'xmlwriter', 'apache2handler', 'Phar', 'curl', 'mbstring', 'exif', 'gd', 'gettext', 'imap', 'mysql', 'mysqli', 'pdo_mysql', 'PDO_ODBC', 'pdo_sqlite', 'soap', 'sockets', 'SQLite', 'sqlite3', 'xmlrpc', 'ming', 'mhash'); $name = strtolower($name); if (empty($type)) { if (in_array($name, $php)) { $type = CS_CHECK_PHP_MODULE; } else { if (in_array($name, $server)) { $type = CS_CHECK_SERVER_MODULE; } else { $type = CS_CHECK_FUNCTION; } } } switch ($type) { case CS_CHECK_PHP_MODULE: return extension_loaded($name); break; case CS_CHECK_SERVER_MODULE: if (function_exists('apache_get_modules')) { return in_array($name, apache_get_modules()); } else { return -1; } break; case CS_CHECK_PHP_INI: return (bool) ini_get($name); break; default: return function_exists($name); break; } }
public function setup() { if (is_file($this->_configFile) && filesize($this->_configFile) > 0) { $this->response->sendHTTPStatusCode(404)->send('Fraym is already installed! Delete Config.php to reinstall.'); } $apacheModules = null; $openBasedir = ini_get('open_basedir'); $apcEnabled = (extension_loaded('apc') || extension_loaded('apcu')) && ini_get('apc.enabled'); $opcacheEnabled = ini_get('opcache.enable'); $opcacheCommentsEnabled = ini_get('opcache.load_comments') === false || ini_get('opcache.load_comments') == '1' ? true : false; if (function_exists('apache_get_modules')) { $apacheModules = apache_get_modules(); } $this->view->assign('phpVersion', phpversion()); $this->view->assign('openBasedir', $openBasedir); $this->view->assign('apcEnabled', $apcEnabled); $this->view->assign('opcacheEnabled', $opcacheEnabled); $this->view->assign('opcacheCommentsEnabled', $opcacheCommentsEnabled); $this->view->assign('apacheModules', $apacheModules); $this->view->assign('timezones', $this->getTimezones()); $this->view->assign('done', false); $this->view->assign('error', false); $this->view->assign('post', $this->request->getGPAsObject()); if ($this->request->isPost()) { $cmd = $this->request->post('cmd'); if ($cmd === 'checkDatabase') { $this->checkDatabase(); } elseif ($result = $this->install()) { $this->view->assign('done', true); } } $this->view->setTemplate('Install')->render(); }
public function __construct($file) { $this->setFile($file); if (function_exists('apache_get_modules') && in_array('mod_xsendfile', apache_get_modules())) { $this->setXSendFile(true); } }
private function step1() { $this->Session->delete('Settings'); $systemCheckPassed = true; $systemCheck = array(); $systemCheck['php']['passed'] = version_compare(PHP_VERSION, '5.3', '>=') ? true : false; $systemCheck['php']['version'] = phpversion(); $systemCheckPassed = $systemCheck['php']['passed'] ? $systemCheckPassed : false; $phpExtensions = get_loaded_extensions(); $systemCheck['mysql']['passed'] = in_array('mysql', $phpExtensions) || in_array('mysqli', $phpExtensions) || in_array('pdo_mysql', $phpExtensions) ? true : false; $systemCheckPassed = $systemCheck['mysql']['passed'] ? $systemCheckPassed : false; if (function_exists('apache_get_modules')) { $systemCheck['rewrite']['passed'] = in_array('mod_rewrite', apache_get_modules()) ? true : false; } else { $systemCheck['rewrite']['passed'] = false; $systemCheck['rewrite']['warning'] = true; } $systemCheck['config']['passed'] = is_writable('../Config') ? true : false; $systemCheckPassed = $systemCheck['config']['passed'] ? $systemCheckPassed : false; $systemCheck['tmp']['passed'] = is_writable('../tmp') ? true : false; $systemCheckPassed = $systemCheck['tmp']['passed'] ? $systemCheckPassed : false; $systemCheck['files']['passed'] = is_writable('../webroot/files') ? true : false; $systemCheckPassed = $systemCheck['files']['passed'] ? $systemCheckPassed : false; $this->set('systemCheckPassed', $systemCheckPassed); $this->set('systemCheck', $systemCheck); }
function image() { ob_end_clean(); $hash = basename($_REQUEST["hash"]); if ($hash) { $filename = $this->cache_dir . "/" . $hash . '.png'; if (file_exists($filename)) { /* See if we can use X-Sendfile */ $xsendfile = false; if (function_exists('apache_get_modules') && array_search('mod_xsendfile', apache_get_modules())) { $xsendfile = true; } if ($xsendfile) { header("X-Sendfile: {$filename}"); header("Content-type: application/octet-stream"); header('Content-Disposition: attachment; filename="' . basename($filename) . '"'); } else { header("Content-type: image/png"); $stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT"; header("Last-Modified: {$stamp}", true); readfile($filename); } } else { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); echo "File not found."; } } }
public function getStep2() { $this->layout->step = 2; $data['req']['php_version'] = PHP_VERSION_ID >= 50400; $data['req']['mcrypt'] = extension_loaded('mcrypt'); $data['req']['pdo'] = extension_loaded('pdo_mysql'); if (function_exists('apache_get_modules')) { $data['req']['rewrite'] = in_array('mod_rewrite', apache_get_modules()); } $dirs = array($_SERVER['DOCUMENT_ROOT'] . '/apps/frontend/storage/', $_SERVER['DOCUMENT_ROOT'] . '/apps/backend/storage/', $_SERVER['DOCUMENT_ROOT'] . '/upload/', $_SERVER['DOCUMENT_ROOT'] . '/install/', $_SERVER['DOCUMENT_ROOT'] . '/apps/frontend/config/', $_SERVER['DOCUMENT_ROOT'] . '/apps/backend/config/'); foreach ($dirs as $path) { $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $item) { @chmod($item, 0777); } } $data['req']['wr_fr_storage'] = is_writable($_SERVER['DOCUMENT_ROOT'] . '/apps/frontend/storage/'); $data['req']['wr_bk_storage'] = is_writable($_SERVER['DOCUMENT_ROOT'] . '/apps/backend/storage/'); $data['req']['wr_upload'] = is_writable($_SERVER['DOCUMENT_ROOT'] . '/upload/'); $data['req']['wr_install'] = is_writable($_SERVER['DOCUMENT_ROOT'] . '/install/'); $data['req']['wr_fr_db'] = is_writable($_SERVER['DOCUMENT_ROOT'] . '/apps/frontend/config/'); $data['req']['wr_bk_db'] = is_writable($_SERVER['DOCUMENT_ROOT'] . '/apps/backend/config/'); $data['valid_step'] = true; foreach ($data['req'] as $valid) { $data['valid_step'] = $data['valid_step'] && $valid; } Session::put('step2', $data['valid_step']); $this->layout->content = View::make('install::step2', $data); return $this->layout; }
public function output() { if ($this->maxAge && isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == infraRequestUtils::formatHttpTime($this->lastModified)) { infraRequestUtils::sendCachingHeaders($this->maxAge, false, $this->lastModified); header("HTTP/1.1 304 Not Modified"); return; } $useXsendFile = false; $rangeLength = null; if (!$this->fileData && $this->xSendFileAllowed && in_array('mod_xsendfile', apache_get_modules())) { $useXsendFile = true; } else { list($rangeFrom, $rangeTo, $rangeLength) = infraRequestUtils::handleRangeRequest($this->fileSize); } if (class_exists('KalturaMonitorClient')) { KalturaMonitorClient::monitorDumpFile($this->fileSize, $this->filePath); } infraRequestUtils::sendCdnHeaders($this->fileExt, $rangeLength, $this->maxAge, $this->mimeType, false, $this->lastModified); // return "Accept-Ranges: bytes" header. Firefox looks for it when playing ogg video files // upon detecting this header it cancels its original request and starts sending byte range requests header("Accept-Ranges: bytes"); header("Access-Control-Allow-Origin:*"); if ($this->fileData) { echo substr($this->fileData, $rangeFrom, $rangeLength); } else { if ($useXsendFile) { header('X-Kaltura-Sendfile:'); header("X-Sendfile: {$this->filePath}"); } else { infraRequestUtils::dumpFilePart($this->filePath, $rangeFrom, $rangeLength); } } }
function CMS_DATA() { $cms_folder = 'weasel-cms/'; require_once $cms_folder . 'parsedown.php'; $_DATA = []; $_DATA['site'] = (include $cms_folder . 'config.php'); $_DATA['site']['path'] = dirname($_SERVER['PHP_SELF']); unset($_DATA['site']['user']); unset($_DATA['site']['pass']); // Get all the existing data on to from the .dat file $db_data = file($cms_folder . $_DATA['site']['db'], FILE_IGNORE_NEW_LINES); $_DATA['pages'] = array(); foreach ($db_data as $data_line) { $_DATA['pages'][] = json_decode($data_line, true); } // Order the data array by descending datetime, extract slugs and exclude inactive posts $db_slugs = array(); $items_datetime = array(); foreach ($_DATA['pages'] as $key => $row) { if (empty($row['active'])) { unset($_DATA['pages'][$key]); } else { $items_datetime[$key] = $row['timedate']; $db_slugs[] = $row['slug']; $_DATA['pages'][$key]['link'] = in_array('mod_rewrite', apache_get_modules()) ? dirname($_SERVER['PHP_SELF']) . '' . $row['slug'] . '.cms' : 'index.php?p=' . $row['slug']; unset($_DATA['pages'][$key]['order']); unset($_DATA['pages'][$key]['active']); unset($_DATA['pages'][$key]['timestamp']); $_DATA['pages'][$key]['timedate'] = date('Y.m.j H:i', $_DATA['pages'][$key]['timedate']); $_DATA['pages'][$key]['tags'] = implode(', ', $_DATA['pages'][$key]['tags']); $_DATA['pages'][$key]['content'] = Parsedown::instance()->text($_DATA['pages'][$key]['content']); } } array_multisort($items_datetime, SORT_DESC, $_DATA['pages']); // Get the current page data $_DATA['page'] = $_DATA['pages'][0]; $_DATA['is_page'] = false; if (!empty($_GET['p']) && in_array($_GET['p'], $db_slugs)) { foreach ($_DATA['pages'] as $db_element) { if ($_GET['p'] == $db_element['slug']) { $_DATA['page'] = $db_element; $_DATA['is_page'] = true; break; } } } // Navigation Menu output $_DATA['menu'] = '<ul>'; foreach ($_DATA['pages'] as $_PAGEITEM) { $current = $_PAGEITEM['slug'] == $_DATA['page']['slug'] ? ' class="active"' : ''; $_DATA['menu'] .= '<li' . $current . '>'; $_DATA['menu'] .= '<a href="' . $_PAGEITEM['link'] . '" title="' . $_PAGEITEM['title'] . '">'; $_DATA['menu'] .= $_PAGEITEM['title'] . '</a>'; $_DATA['menu'] .= '</li>'; } $_DATA['menu'] .= '</ul>'; // Returns the parsed data return $_DATA; }
function mod_rewrite_on() { if (!function_exists('apache_get_modules')) { return false; } $m = @apache_get_modules(); return array_search('mod_rewrite', $m) !== FALSE; }
public function __construct() { if (function_exists('apache_get_modules')) { if (!in_array('mod_rewrite', apache_get_modules())) { throw new \Exception("Apache module 'rewrite' not found."); } } }
/** * @return boolean */ private function isModRewriteEnabled() : bool { if (function_exists('apache_get_modules')) { return in_array('mod_rewrite', apache_get_modules()); } else { return getenv('HTTP_MOD_REWRITE') === 'On' ? true : false; } }
function ShowForm() { global $langmessage, $gp_filesystem; $confirmed_mod_rewrite = false; if (function_exists('apache_get_modules')) { $mods = apache_get_modules(); if (in_array('mod_rewrite', $mods) !== false) { $confirmed_mod_rewrite = true; } } if (!$confirmed_mod_rewrite) { echo '<p class="gp_notice">'; echo $langmessage['limited_mod_rewrite']; echo '</p>'; } $this->CheckHtaccess(); echo '<form method="post" action="' . common::GetUrl('Admin_Permalinks') . '">'; echo '<table cellspacing="11">'; //default $checked = ''; if (!$_SERVER['gp_rewrite']) { $checked = 'checked="checked"'; } echo '<tr><td>'; echo '<label>'; echo '<input type="radio" name="none" ' . $checked . ' /> '; echo '<button type="submit" name="rewrite_setting" value="no_rewrite" class="gpsubmit">'; echo $langmessage['use_index.php']; echo '</button>'; echo '</label>'; echo '</td><td>'; echo ' <tt>'; echo $this->ExampleUrl(true); echo '</tt>'; echo '</td></tr>'; //hide index.php $checked = ''; if ($_SERVER['gp_rewrite']) { $checked = 'checked="checked"'; } echo '<tr><td>'; echo '<label>'; echo '<input type="radio" name="none" ' . $checked . ' /> '; echo '<button type="submit" name="rewrite_setting" value="hide_index" class="gpsubmit">'; echo $langmessage['hide_index']; echo '</button> '; echo '</label>'; echo '</td><td>'; echo ' <tt>'; echo $this->ExampleUrl(false); echo '</tt>'; echo '</td></tr>'; echo '</table>'; echo '<p>'; echo '<input type="hidden" name="cmd" value="continue" />'; echo '</p>'; echo '</form>'; }
protected static function getInfo() { if (is_null(self::$apache_modules)) { self::$apache_modules = function_exists('apache_get_modules') ? apache_get_modules() : array(); } if (is_null(self::$php_modules)) { self::$php_modules = get_loaded_extensions(); } }
function get_mod_rewrite_status() { $apache_modules = apache_get_modules(); if (in_array('mod_rewrite', $apache_modules)) { return TRUE; } else { return FALSE; } }
/** * Gets list of loaded Apache modules * * @access public * @return string Comma separated apache modules */ function GetApacheModules() { if (strpos(strtolower(php_sapi_name()), 'apache') !== false && function_exists('apache_get_modules')) { $modules = @apache_get_modules(); sort($modules); return implode(', ', $modules); } return ''; }
/** * Check if an apache module is loaded * * @param string Apache module name * @return boolean */ function apache_is_module_loaded($mod_name) { if (function_exists('apache_get_modules')) { $modules = apache_get_modules(); } else { $modules = array('mod_php5', 'mod_rewrite'); } return in_array($mod_name, $modules); }
private function apachechk($str) { $array = apache_get_modules(); if (in_array($str, $array)) { return Yii::t('app', "OK"); } else { return Yii::t('app', "Failed"); } }
static function checkRecommendedApacheModules() { $apache_modules_recommended = array(); if (function_exists("apache_get_modules")) { $apache_modules = apache_get_modules(); $apache_modules_recommended = array('mod_deflate' => array('title' => 'Deflate', 'info' => Language::key('env_test_apache_deflate_info'), 'loaded' => in_array('mod_deflate', $apache_modules)), 'mod_rewrite' => array('title' => 'ModRewrite', 'info' => Language::key('env_test_apache_rewrite_info'), 'loaded' => in_array('mod_rewrite', $apache_modules))); } return $apache_modules_recommended; }
function MARKET_Request() { global $MARKET_mode, $MARKET_mod_rewrite; $url = ''; if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()) || getenv('HTTP_MOD_REWRITE') == 'On') { $MARKET_mod_rewrite = true; if (array_key_exists('REQUEST_URI', $_SERVER)) { $url = substr($_SERVER['REQUEST_URI'], strlen(MARKET_WEB_DIR) + 1); $url = preg_replace('@\\?.*@', '', $url); } } else { $MARKET_mod_rewrite = false; if (array_key_exists('PATH_INFO', $_SERVER)) { $url = substr($_SERVER['PATH_INFO'], 1); } } $query_string = $_SERVER['QUERY_STRING']; if (!$url || preg_match('@/$@', $url)) { $url .= 'index.html'; } $params = explode('/', $url); // Language $lng =& $this->getRef('Lang'); if ($lng->isLanguage($params[0])) { $lang = $params[0]; $this->stripParams($params, $url); $lng->setLanguage($lang); } else { $lng->setLanguage(''); if (count($lng->getAvailable()) > 1) { $this->redirectTo(MARKET_WEB_DIR . '/' . $lng->lang . '/' . $url . ($query_string ? '?' . $query_string : '')); } } $this->request = $url . ($query_string ? '?' . $query_string : ''); // MARKET Mode switch ($params[0]) { case 'admin': $MARKET_mode = 'admin'; // $this->stripParams($params, $url); $lng->loadStrings($lng->lang, true); break; case 'edit': $MARKET_mode = 'edit'; $this->stripParams($params, $url); $lng->loadStrings($lng->lang, true); break; default: $MARKET_mode = 'public'; $lng->loadStrings($lng->lang, true); } $last = count($params) - 1; $params[$last] = preg_replace('@\\.html$@', '', $params[$last]); $this->url = $url; $this->query_string = $query_string; $this->params = $params; }
public static function has_mod_rewrite() { if (function_exists('apache_get_modules')) { $modules = apache_get_modules(); #echo __METHOD__ . "\n"; #print_r($modules); return in_array('mod_rewrite', $modules); } return FALSE; }
/** * RewriteChecker constructor. * * @throws \ManaPHP\Mvc\Router\RewriteChecker\Exception */ public function __construct() { if (!isset($_SERVER['MANAPHP_REWRITE_ON'])) { if (PHP_SAPI === 'apache2handler') { if (!in_array('mod_rewrite', apache_get_modules(), true)) { throw new RewriteCheckerException('please install Apache mod_rewrite module'); } } } }
/** * Play a song. * As of current Koel supports two streamer: x_sendfile and native PHP readfile. * * @param $id */ public function play($id) { if (env('MOD_X_SENDFILE_ENABLED') || function_exists('apache_get_modules') && in_array('mod_xsendfile', apache_get_modules())) { (new XSendFileStreamer($id))->stream(); return; } (new PHPStreamer($id))->stream(); // Exit here to avoid accidentally sending extra content at the end of the file. exit; }
/** * modRewriteCheck - Check for the installation of apache mod_rewrite * * @since 3.2.3 * @access public * @return void */ public static function modRewriteCheck() { if (function_exists('apache_get_modules')) { if (!in_array('mod_rewrite', apache_get_modules())) { self::$_parent->admin_notices[] = array('type' => 'error', 'msg' => '<strong><center>The Apache mod_rewrite module is not enabled on your server.</center></strong> <br/> Both Wordpress and Redux require the enabling of the Apache mod_rewrite module to function properly. Please contact whomever provides support for your server and ask them to enable the mod_rewrite module', 'id' => 'mod_rewrite_notice_', 'dismiss' => false); } } }
private function apachechk($str){ $array=[]; if (function_exists('apache_get_modules')) $array=apache_get_modules(); if(in_array($str,$array)) return Yii::t('app', "OK"); else return Yii::t('app', "Failed"); }
protected function _getModGeoIp() { if (function_exists('apache_get_modules')) { $modules = apache_get_modules(); $mod_geoip = in_array('mod_geoip', $modules); } else { $mod_geoip = getenv('HTTP_MOD_GEOIP') == 'On' ? true : false; } return $mod_geoip; }