/** * */ function output() { global $application; ob_start(); phpinfo(1); $content = ob_get_contents(); ob_end_clean(); $flag = true; while ($flag) { $pos = _ml_strpos($content, "\n"); $line = _ml_substr($content, 0, $pos); $content = _ml_substr($content, $pos + 1); if (_ml_strpos($line, "System")) { $line = _ml_substr($line, 0, _ml_strrpos($line, "<")); $line = _ml_substr($line, 0, _ml_strrpos($line, "<")); $line = _ml_substr($line, _ml_strrpos($line, ">") + 1); $flag = false; } } $OS = $line; $request = new Request(); $request->setView('PHPInfo'); $link = $request->getURL(); global $db_link; $template_contents = array("ProductVersion" => PRODUCT_VERSION_NUMBER, "ProductVersionType" => PRODUCT_VERSION_TYPE, "ProductReleaseDate" => PRODUCT_VERSION_DATE, "CoreVersion" => CORE_VERSION, "ModulesList" => $this->outputModules(), "phpVersion" => PHP_VERSION, "MySQLVersion" => mysqli_get_server_info($db_link), "ServerOS" => $OS, "WebServerVersion" => $_SERVER["SERVER_SOFTWARE"], "PHPInfoLink" => $link); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); return modApiFunc('TmplFiller', 'fill', "tools/server_info/", "container.tpl.html", array()); }
public static function getPHPInfo() { if (isset(self::$_aPHPInfo)) { return self::$_aPHPInfo; } ob_start(); phpinfo(-1); $_sOutput = preg_replace(array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms', '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', "#[ \t]+#", '# #', '# +#', '# class=".*?"#', '%'%', '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>' . '<h1>PHP Version (.*?)</h1>(?:\\n+?)</td></tr>#', '#<h1><a href="(?:.*?)\\?=(.*?)">PHP Credits</a></h1>#', '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#', "# +#", '#<tr>#', '#</tr>#'), array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ', '<h2>PHP Configuration</h2>' . "\n" . '<tr><td>PHP Version</td><td>$2</td></tr>' . "\n" . '<tr><td>PHP Egg</td><td>$1</td></tr>', '<tr><td>PHP Credits Egg</td><td>$1</td></tr>', '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" . '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'), ob_get_clean()); $_aSections = explode('<h2>', strip_tags($_sOutput, '<h2><th><td>')); unset($_aSections[0]); $_aOutput = array(); foreach ($_aSections as $_sSection) { $_iIndex = substr($_sSection, 0, strpos($_sSection, '</h2>')); preg_match_all('#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#', $_sSection, $_aAskApache, PREG_SET_ORDER); foreach ($_aAskApache as $_aMatches) { if (!isset($_aMatches[1], $_aMatches[2])) { array_slice($_aMatches, 2); continue; } $_aOutput[$_iIndex][$_aMatches[1]] = !isset($_aMatches[3]) || $_aMatches[2] == $_aMatches[3] ? $_aMatches[2] : array_slice($_aMatches, 2); } } self::$_aPHPInfo = $_aOutput; return self::$_aPHPInfo; }
/** * http://www.php.net/manual/en/function.phpinfo.php * code at adspeed dot com * 09-Dec-2005 11:31 * This function parses the phpinfo output to get details about a PHP module. */ function ckeditor_parse_php_info() { ob_start(); phpinfo(INFO_MODULES); $s = ob_get_contents(); ob_end_clean(); $s = strip_tags($s, '<h2><th><td>'); $s = preg_replace('/<th[^>]*>([^<]+)<\\/th>/', "<info>\\1</info>", $s); $s = preg_replace('/<td[^>]*>([^<]+)<\\/td>/', "<info>\\1</info>", $s); $vTmp = preg_split('/(<h2>[^<]+<\\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE); $vModules = array(); for ($i = 1; $i < count($vTmp); $i++) { if (preg_match('/<h2>([^<]+)<\\/h2>/', $vTmp[$i], $vMat)) { $vName = trim($vMat[1]); $vTmp2 = explode("\n", $vTmp[$i + 1]); foreach ($vTmp2 as $vOne) { $vPat = '<info>([^<]+)<\\/info>'; $vPat3 = "/{$vPat}\\s*{$vPat}\\s*{$vPat}/"; $vPat2 = "/{$vPat}\\s*{$vPat}/"; if (preg_match($vPat3, $vOne, $vMat)) { // 3cols $vModules[$vName][trim($vMat[1])] = array(trim($vMat[2]), trim($vMat[3])); } elseif (preg_match($vPat2, $vOne, $vMat)) { // 2cols $vModules[$vName][trim($vMat[1])] = trim($vMat[2]); } } } } return $vModules; }
/** * Method to get the PHP info * * @return string */ public function getPhpInfo() { if (!is_null($this->phpInfo)) { return $this->phpInfo; } if (function_exists('phpinfo')) { ob_start(); date_default_timezone_set('UTC'); phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES); $phpInfo = ob_get_contents(); ob_end_clean(); preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpInfo, $output); $output = preg_replace('#<table[^>]*>#', '<table class="table table-striped">', $output[1][0]); $output = preg_replace('#(\\w),(\\w)#', '\\1, \\2', $output); $output = preg_replace('#<hr />#', '', $output); $output = str_replace('<div class="center">', '', $output); $output = preg_replace('#<tr class="h">(.*)<\\/tr>#', '<thead><tr class="h">$1</tr></thead><tbody>', $output); $output = str_replace('</table>', '</tbody></table>', $output); $output = str_replace('</div>', '', $output); $this->phpInfo = $output; } elseif (function_exists('phpversion')) { $this->phpInfo = $this->translator->trans('mautic.sysinfo.phpinfo.phpversion', array('%phpversion%' => phpversion())); } else { $this->phpInfo = $this->translator->trans('mautic.sysinfo.phpinfo.missing'); } return $this->phpInfo; }
/** * Check which version of GD is installed * @return int 0 if GD isn't installed, 1 if GD 1.x is installed and 2 if GD 2.x is installed */ function Image_Graph_gd_version() { if (function_exists("gd_info")) { $info = gd_info(); $version = $info['GD Version']; } else { ob_start(); phpinfo(8); $php_info = ob_get_contents(); ob_end_clean(); if (ereg("<td[^>]*>GD Version *<\/td><td[^>]*>([^<]*)<\/td>", $php_info, $result)) { $version = $result[1]; } } if ($version) { //define("GD_VERSION", $version); } if (ereg("1\.[0-9]{1,2}", $version)) { return 1; } elseif (ereg("2\.[0-9]{1,2}", $version)) { return 2; } else { return 0; } }
protected function compatibilityCheckPHPInfo() { ob_start(); phpinfo(); $phpinfo = ob_get_contents(); ob_end_clean(); $info = array(); preg_match_all('{<tr><td class="e">(?>(.+?)</td>)<td class="v">(?>(.+?)</td>)</tr>}', $phpinfo, $matches); foreach ($matches[1] as $key => $label) { $info[trim(strtolower($label))] = trim(strtolower($matches[2][$key])); } preg_match_all('{<tr class="h"><th>(?>(.+?)</th>)<th>(?>(.+?)</th>)</tr>}', $phpinfo, $matches); foreach ($matches[1] as $key => $label) { $info[trim(strtolower($label))] = trim(strtolower($matches[2][$key])); } if (isset($info['server_software'])) { if (strpos($info['server_software'], 'apache') === false) { $this->err("Apache web server server software is required. You are running \"{$info['server_software']}\". Continue at your own risk, ProcessWire is not currently tested with any other server software."); } else { $this->li("Server Software: {$info['server_software']}"); } } else { $this->err("Unable to determine server software. It may be okay to continue, but note that ProcessWire is only developed for Apache at present."); } $tests = array('mysqli support', 'spl support', 'ctype functions', 'gd support', 'iconv support', 'hash support', 'json support', 'pcre (perl compatible regular expressions) support', 'session support'); foreach ($tests as $test) { if (!isset($info[$test]) || $info[$test] != 'enabled') { $this->err("Failed test for: {$test}"); } else { $this->li("{$test}: OK"); } } }
/** * Test if the GD library is available * * @return array */ protected static function testGD() { $gd = array(); $output = ''; $gdVersion = null; $gdInfo = null; //$GDfuncList = get_extension_funcs('gd'); if (function_exists('gd_info')) { $gdInfo = gd_info(); $gdVersion = $gdInfo['GD Version']; } else { ob_start(); @phpinfo(INFO_MODULES); $output = ob_get_contents(); ob_end_clean(); $matches[1] = ''; if ($output !== '') { if (preg_match("/GD Version[ \t]*(<[^>]+>[ \t]*)+([^<>]+)/s", $output, $matches)) { $gdVersion = $matches[2]; } else { return $gd; } } } if (function_exists('imagecreatetruecolor') && function_exists('imagecreatefromjpeg')) { $gdVersion = isset($gdVersion) ? $gdVersion : 2; $gd['gd2'] = "GD: " . $gdVersion; } elseif (function_exists('imagecreatefromjpeg')) { $gdVersion = isset($gdVersion) ? $gdVersion : 1; $gd['gd1'] = "GD: " . $gdVersion; } return $gd; }
function php_admin_info() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.')); } // SET PLUGIN PATH REGARDLESS OF CONTAINING DIRECTORY $plug_path = plugins_url('/', __FILE__); $phpStyle = <<<PHPSTYLE \t<style type="text/css"> \t#php-info-wrapper { padding: 20px; } \t#php-info-wrapper table { padding: 1px; background: #ccc; border: 1px #777 solid; -webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px; } \t#php-info-wrapper td, th {padding:3px; background:#efefef; -webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;} \t#php-info-wrapper tr.h img { display:none; } \t#php-info-wrapper tr.h td{ background:none; } \t#php-info-wrapper tr.h { text-align:right; height: 130px; background: url({$plug_path}php-logo.png) no-repeat 30px center; } \t#php-info-wrapper tr.h h1{ padding-right:50px; } \t</style> PHPSTYLE; echo $phpStyle; echo '<div id="php-info-wrapper" class="wrap" >'; ob_start(); phpinfo(); $pinfo = ob_get_contents(); ob_end_clean(); $pinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $pinfo); $pinfo = preg_replace('%^.*<title>(.*)</title>.*$%ms', '$1', $pinfo); echo $pinfo; echo '</div>'; }
/** * @static * * @return string */ public static function getICUDataVersion() { if (defined('INTL_ICU_VERSION')) { return INTL_ICU_VERSION; } ob_start(); phpinfo(); $content = ob_get_contents(); ob_end_clean(); $info = explode("\n", $content); if ('cli' == php_sapi_name()) { foreach ($info as $line) { $results = array(); if (preg_match('/(ICU Data version|ICU version) => (.*)/', $line, $results)) { return $results[2]; } } } else { foreach ($info as $line) { $results = array(); if (preg_match('/(ICU Data version).*/', $line, $results)) { return trim(strtolower(strip_tags($results[0])), 'ICU Data version'); } if (preg_match('/(ICU version).*/', $line, $results)) { return trim(strtolower(strip_tags($results[0])), 'icu version'); } } } return; }
public function run($command) { if (in_array($command, $this->getSynonyms())) { $return = array(); $return[] = new Page($this->getHelp()); ob_start(); phpinfo(1); $phpModules = ob_get_clean(); $return[] = new Page("<h3 id='PHP General'>PHP General</h3>" . $phpModules); ob_start(); phpinfo(4); $phpModules = ob_get_clean(); $return[] = new Page("<h3 id='PHP Configuration'>PHP Configuration</h3>" . $phpModules); ob_start(); phpinfo(8); $phpModules = ob_get_clean(); $return[] = new Page("<h3 id='PHP Modules'>PHP Modules</h3>" . $phpModules); ob_start(); phpinfo(16); $phpModules = ob_get_clean(); $return[] = new Page("<h3 id='PHP Environment'>PHP Environment</h3>" . $phpModules); ob_start(); phpinfo(32); $phpModules = ob_get_clean(); $return[] = new Page("<h3 id='PHP Variables'>PHP Variables</h3>" . $phpModules); return $return; } return array(); }
/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { /*$arr = [5 => 0, 6 => 0, 7 => 0, 8 => 0]; $arr_test = []; $num = array_search(min($arr),$arr); var_dump($num); exit();*/ // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' /********************snoopy**********************/ /*$snoopy = new Snoopy(); header('Content-type:text/html;charset=gbk'); $snoopy->fetch('https://www.taobao.com'); print_r($snoopy->results);*/ /********************snoopy*************************/ //随机排序 /*$a = array(1,2,3,4,5); shuffle($a); for ($i=0; $i<count($a); ++$i) echo $a[$i]." "; shuffle($a); echo "<br />"; for ($i=0; $i<count($a); ++$i) echo $a[$i]." ";*/ echo phpinfo(); exit; $this->render('index'); }
protected function generateSummary() { $suhosin_help = <<<FEED <pre> http://www.magentocommerce.com/wiki/groups/227/magento-compatible_suhosin_configuration suggested in [.htaccess] php_value suhosin.mail.protect 0 php_value suhosin.memory_limit 256M php_value suhosin.post.max_vars 5000 php_value suhosin.post.max_value_length 500000 php_value suhosin.request.max_vars 5000 php_value suhosin.request.max_value_length 500000 <pre/> FEED; // Check if Suhosin is compiled into php and not a extension // magento says to use these settings if using Suhosin... //http://www.magentocommerce.com/wiki/groups/227/magento-compatible_suhosin_configuration ob_start(); phpinfo(); $phpinfo = ob_get_contents(); ob_end_clean(); $has_suhosin = false; if (!extension_loaded('suhosin')) { $this->addPass($this->__("PHP does not have problematic extension Suhosin.")); } else { $this->addNotice($this->__("PHP has extension Suhosin."), $this->__("If Magento has issues, try these configuration ontop of the default values: %s", $suhosin_help)); } if (strpos($phpinfo, "Suhosin Patch") === false) { $this->addPass($this->__("Suhosin is not compiled directly into the PHP binary.")); } else { $this->addNotice($this->__("Suhosin is compiled directly into the PHP binary."), $this->__("If Magento has issues, try these configuration ontop of the default values: %s", $suhosin_help)); } }
function index() { $this->template->set('title', $this->language->get('heading_title')); $view = $this->locator->create('template'); $view->set('button_list', $this->language->get('button_list')); $view->set('button_insert', $this->language->get('button_insert')); $view->set('button_update', $this->language->get('button_update')); $view->set('button_delete', $this->language->get('button_delete')); $view->set('button_save', $this->language->get('button_save')); $view->set('button_cancel', $this->language->get('button_cancel')); $view->set('button_print', $this->language->get('button_print')); $view->set('heading_title', $this->language->get('heading_title')); $view->set('heading_description', $this->language->get('heading_description')); $view->set('text_php', $this->language->get('text_php')); $view->set('text_db', $this->language->get('text_db')); $view->set('text_db_server', $this->language->get('text_db_server')); $view->set('text_db_name', $this->language->get('text_db_name')); $view->set('php', phpversion()); $view->set('server', $_SERVER['SERVER_SOFTWARE']); $view->set('db', 'MySQL ' . $this->modelServerInfo->get_server_info()); $view->set('db_server', DB_HOST); $view->set('db_name', DB_NAME); ob_start(); phpinfo(); $phpinfo = ob_get_contents(); ob_end_clean(); $phpinfo = str_replace('border: 1px', '', $phpinfo); preg_match('#<body>(.*?)</body>#is', $phpinfo, $regs); $view->set('phpinfo', $regs[1]); $this->template->set('content', $view->fetch('content/server_info.tpl')); $this->template->set($this->module->fetch()); $this->response->set($this->template->fetch('layout.tpl')); }
function login($username, $password) { global $_SESSION; // Check for LDAP functions if (!function_exists('ldap_connect')) { $ex = 'LDAP support is not enabled in your PHP configuration.'; if (strtolower(substr(PHP_OS, 0, 3)) == 'win') { ob_start(); phpinfo(INFO_GENERAL); $phpinfo = ob_get_contents(); ob_end_clean(); preg_match('/Loaded Configuration File <\\/td><td.*?>(.*?)\\s*</', $phpinfo, $phpinfo); $ex .= ' You probably just need to uncomment the line ;extension=php_ldap.dll in php.ini' . (count($phpinfo) > 1 ? ' (' . trim($phpinfo[1]) . ')' : '') . ' by removing the ";" and restart your web server.'; } else { if (strtolower(substr(PHP_OS, 0, 5)) == 'Linux') { $ex .= ' You probably need to install the php5-ldap (or similar depending on your distribution) package.'; } } throw new Exception($ex); } $auth = ldap_connect($this->config['host']); if (!$auth) { return false; } ldap_set_option($auth, LDAP_OPT_PROTOCOL_VERSION, 3); if (!@ldap_bind($auth, sprintf($this->config['bind_dn'], $username), $password)) { return false; } $_SESSION['valid'] = true; $_SESSION['user'] = $username; $_SESSION['admin'] = !$this->config['adminUser'] || $_SESSION['user'] == $this->config['adminUser']; $_SESSION['authCheckHeartbeat'] = time(); }
function access_details() { $access_details = array(); $access_details['domain'] = ''; $access_details['ip'] = ''; $access_details['directory'] = ''; $access_details['server_hostname'] = ''; $access_details['server_ip'] = ''; if (function_exists('phpinfo')) { ob_start(); phpinfo(); $phpinfo = ob_get_contents(); ob_end_clean(); $list = strip_tags($phpinfo); $access_details['domain'] = $this->scrape_phpinfo($list, 'HTTP_HOST'); $access_details['ip'] = $this->scrape_phpinfo($list, 'SERVER_ADDR'); $access_details['directory'] = $this->scrape_phpinfo($list, 'SCRIPT_FILENAME'); $access_details['server_hostname'] = $this->scrape_phpinfo($list, 'System'); $access_details['server_ip'] = @gethostbyname($access_details['server_hostname']); } $access_details['domain'] = $access_details['domain'] ? $access_details['domain'] : $_SERVER['HTTP_HOST']; $access_details['ip'] = $access_details['ip'] ? $access_details['ip'] : $this->server_addr(); $access_details['directory'] = $access_details['directory'] ? $access_details['directory'] : $this->path_translated(); $access_details['server_hostname'] = $access_details['server_hostname'] ? $access_details['server_hostname'] : @gethostbyaddr($access_details['ip']); $access_details['server_hostname'] = $access_details['server_hostname'] ? $access_details['server_hostname'] : 'Unknown'; $access_details['server_ip'] = $access_details['server_ip'] ? $access_details['server_ip'] : @gethostbyaddr($access_details['ip']); $access_details['server_ip'] = $access_details['server_ip'] ? $access_details['server_ip'] : 'Unknown'; foreach ($access_details as $key => $value) { $access_details[$key] = $access_details[$key] ? $access_details[$key] : 'Unknown'; } if ($this->valid_for_product_tiers) { $access_details['valid_for_product_tiers'] = $this->valid_for_product_tiers; } return $access_details; }
/** * PHP info * * @return null */ public function actionPhpInfo() { craft()->config->maxPowerCaptain(); ob_start(); phpinfo(-1); $phpInfo = ob_get_clean(); $phpInfo = preg_replace(array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms', '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', "#[ \t]+#", '# #', '# +#', '# class=".*?"#', '%'%', '#<tr>(?:.*?)"src="(?:.*?)=(.*?)" alt="PHP Logo" /></a><h1>PHP Version (.*?)</h1>(?:\\n+?)</td></tr>#', '#<h1><a href="(?:.*?)\\?=(.*?)">PHP Credits</a></h1>#', '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#', "# +#", '#<tr>#', '#</tr>#'), array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ', '<h2>PHP Configuration</h2>' . "\n" . '<tr><td>PHP Version</td><td>$2</td></tr>' . "\n" . '<tr><td>PHP Egg</td><td>$1</td></tr>', '<tr><td>PHP Credits Egg</td><td>$1</td></tr>', '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" . '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'), $phpInfo); $sections = explode('<h2>', strip_tags($phpInfo, '<h2><th><td>')); unset($sections[0]); $phpInfo = array(); foreach ($sections as $section) { $heading = substr($section, 0, strpos($section, '</h2>')); preg_match_all('#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#', $section, $parts, PREG_SET_ORDER); foreach ($parts as $row) { if (!isset($row[2])) { continue; } else { if (!isset($row[3]) || $row[2] == $row[3]) { $value = $row[2]; } else { $value = array_slice($row, 2); } } $phpInfo[$heading][$row[1]] = $value; } } $this->renderTemplate('utils/phpinfo', array('phpInfo' => $phpInfo)); }
public function getPHPInfo() { ob_start(); phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_ENVIRONMENT | INFO_VARIABLES); $phpInfoOutput = ob_get_clean(); $phpInfoStr = ''; foreach ($this->phpInfoToArray($phpInfoOutput) as $catTitle => $catData) { $phpInfoStr .= '<h3>' . $catTitle . '</h3> <table> <tbody>'; foreach ($catData as $key => $val) { $phpInfoStr .= '<tr> <th>' . $key . '</th> <td>'; if (is_array($val) === true) { $phpInfoStr .= '<ul>'; foreach ($val as $subKey => $subVal) { $phpInfoStr .= '<li>' . $subKey . ': ' . $subVal . '</li>'; } $phpInfoStr .= '</ul>'; } else { $phpInfoStr .= $val; } $phpInfoStr .= '</td> </tr>'; } $phpInfoStr .= '</tbody></table>'; } return $this->generatePage(array('siteTitle' => 'PHP info', 'phpinfo' => $phpInfoStr), 200); }
/** * This static function returns php informations * * @returns an array with php info */ function php() { // Get the general PHP info ob_start(); phpinfo(INFO_GENERAL); $phpInfo .= ob_get_contents(); ob_end_clean(); // Get the right part $phpInfo = substr($phpInfo, strpos($phpInfo, '<tr>')); $phpInfo = substr($phpInfo, 0, strpos($phpInfo, '</table>')); // Strip unneeded things $phpInfo = str_replace('<tr><td class="e">', '', $phpInfo); $phpInfo = str_replace(' </td></tr>', '', $phpInfo); $phpInfo = trim($phpInfo); // Get the settings $settings = array(); foreach (explode("\n", $phpInfo) as $line) { $line = explode(' </td><td class="v">', $line); if (isset($line[1])) { $settings[strtolower(str_replace(' ', '_', $line[0]))] = $line[1]; } else { $settings[strtolower(str_replace(' ', '_', $line[0]))] = ''; } } // export other values $settings['version'] = phpversion(); $settings['modules'] = implode(get_loaded_extensions(), ', '); $settings['os'] = PHP_OS; $settings['includePath'] = $GLOBALS['YD_INCLUDE_PATH']; return $settings; }
function __construct() { parent::__construct(); $this->aType2ClassCSS = array(BX_DOL_AUDIT_FAIL => 'fail', BX_DOL_AUDIT_WARN => 'warn', BX_DOL_AUDIT_UNDEF => 'undef', BX_DOL_AUDIT_OK => 'ok'); $this->aType2Title = array(BX_DOL_AUDIT_FAIL => _t('_sys_audit_title_fail'), BX_DOL_AUDIT_WARN => _t('_sys_audit_title_warn'), BX_DOL_AUDIT_UNDEF => _t('_sys_audit_title_undef'), BX_DOL_AUDIT_OK => _t('_sys_audit_title_ok')); $this->sMinPhpVer = '5.3.0'; $this->aPhpSettings = array('allow_url_fopen' => array('op' => '=', 'val' => true, 'type' => 'bool'), 'allow_url_include' => array('op' => '=', 'val' => false, 'type' => 'bool'), 'magic_quotes_gpc' => array('op' => '=', 'val' => false, 'type' => 'bool', 'warn' => 1), 'memory_limit' => array('op' => '>=', 'val' => 128 * 1024 * 1024, 'type' => 'bytes', 'unlimited' => -1), 'post_max_size' => array('op' => '>=', 'val' => 2 * 1024 * 1024, 'type' => 'bytes', 'warn' => 1), 'upload_max_filesize' => array('op' => '>=', 'val' => 2 * 1024 * 1024, 'type' => 'bytes', 'warn' => 1), 'register_globals' => array('op' => '=', 'val' => false, 'type' => 'bool'), 'safe_mode' => array('op' => '=', 'val' => false, 'type' => 'bool'), 'short_open_tag' => array('op' => '=', 'val' => true, 'type' => 'bool'), 'disable_functions' => array('op' => 'without', 'val' => 'shell_exec,eval,assert,phpinfo,getenv,ini_set,mail,fsockopen,chmod,parse_ini_file'), 'php module: mysql' => array('op' => 'module', 'val' => 'mysql'), 'php module: curl' => array('op' => 'module', 'val' => 'curl'), 'php module: gd' => array('op' => 'module', 'val' => 'gd'), 'php module: mbstring' => array('op' => 'module', 'val' => 'mbstring'), 'php module: json' => array('op' => 'module', 'val' => 'json'), 'php module: fileinfo' => array('op' => 'module', 'val' => 'fileinfo'), 'php module: zip' => array('op' => 'module', 'val' => 'zip'), 'php module: openssl' => array('op' => 'module', 'val' => 'openssl'), 'php module: exif' => array('op' => 'module', 'val' => 'exif')); $this->sMinMysqlVer = '4.1.2'; $this->aMysqlOptimizationSettings = array('key_buffer_size' => array('op' => '>=', 'val' => 128 * 1024, 'type' => 'bytes'), 'query_cache_limit' => array('op' => '>=', 'val' => 1000000), 'query_cache_size' => array('op' => '>=', 'val' => 16 * 1024 * 1024, 'type' => 'bytes'), 'query_cache_type' => array('op' => 'strcasecmp', 'val' => 'on'), 'max_heap_table_size' => array('op' => '>=', 'val' => 16 * 1024 * 1024, 'type' => 'bytes'), 'tmp_table_size' => array('op' => '>=', 'val' => 16 * 1024 * 1024, 'type' => 'bytes'), 'thread_cache_size ' => array('op' => '>', 'val' => 0)); $this->aOptimizationSettings = array('DB cache' => array('enabled' => 'sys_db_cache_enable', 'cache_engine' => 'sys_db_cache_engine', 'check_accel' => true), 'Page blocks cache' => array('enabled' => 'sys_pb_cache_enable', 'cache_engine' => 'sys_pb_cache_engine', 'check_accel' => true), 'Member menu cache' => array('enabled' => 'always_on', 'cache_engine' => 'sys_mm_cache_engine', 'check_accel' => true), 'Templates Cache' => array('enabled' => 'sys_template_cache_enable', 'cache_engine' => 'sys_template_cache_engine', 'check_accel' => true), 'CSS files cache' => array('enabled' => 'sys_template_cache_css_enable', 'cache_engine' => '', 'check_accel' => false), 'JS files cache' => array('enabled' => 'sys_template_cache_js_enable', 'cache_engine' => '', 'check_accel' => false), 'Compression for CSS/JS cache' => array('enabled' => 'sys_template_cache_compress_enable', 'cache_engine' => '', 'check_accel' => false)); $this->aRequiredApacheModules = array('rewrite_module' => 'mod_rewrite'); if (isset($_GET['action'])) { $sOutput = null; switch ($_GET['action']) { case 'audit_send_test_email': $sOutput = $this->sendTestEmail(); break; case 'phpinfo': ob_start(); phpinfo(); $sOutput = ob_get_clean(); break; case 'phpinfo_popup': $sUrlSelf = bx_js_string($_SERVER['PHP_SELF'], BX_ESCAPE_STR_APOS); $sUrlSelf = bx_append_url_params($sUrlSelf, array('action' => 'phpinfo')); $sOutput = '<iframe width="640" height="480" src="' . $sUrlSelf . '"></iframe>'; break; } if ($sOutput) { header('Content-type: text/html; charset=utf-8'); echo $sOutput; exit; } } }
/** * Renders a PHP info page. * * @return \Symfony\Component\HttpFoundation\Response */ public function phpinfoAction() { ob_start(); phpinfo(); $response = new Response(ob_get_clean()); return $response; }
function get_php_setting($type) { //1 = safe_mode,2=register_globals ("on","off") ob_start(); phpinfo(); $phpinfo = array('phpinfo' => array()); if (preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { if (strlen($match[1])) { $phpinfo[$match[1]] = array(); } elseif (isset($match[3])) { $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3]; } else { $phpinfo[end(array_keys($phpinfo))][] = $match[2]; } } } switch ($type) { case 1: return $phpinfo['PHP Core']['safe_mode'][0]; case 2: return $phpinfo['PHP Core']['register_globals'][0]; } ob_end_clean(); }
/** * */ public function __construct() { ob_start(); phpinfo(INFO_MODULES); $data0 = ob_get_contents(); ob_end_clean(); $data1 = strip_tags($data0, '<h2><th><td>'); $data2 = preg_replace('/<th[^>]*>([^<]+)<\\/th>/', "<info>\\1</info>", $data1); $data = preg_replace('/<td[^>]*>([^<]+)<\\/td>/', "<info>\\1</info>", $data2); // Split the data into an array $vTmp = preg_split('/(<h2>[^<]+<\\/h2>)/', $data, -1, PREG_SPLIT_DELIM_CAPTURE); $vModules = array(); $count = count($vTmp); for ($i = 1; $i < $count; $i += 2) { if (preg_match('/<h2>([^<]+)<\\/h2>/', $vTmp[$i], $vMat)) { $moduleName = trim($vMat[1]); $vTmp2 = explode("\n", $vTmp[$i + 1]); foreach ($vTmp2 as $vOne) { $vPat = '<info>([^<]+)<\\/info>'; $vPat3 = "/{$vPat}\\s*{$vPat}\\s*{$vPat}/"; $vPat2 = "/{$vPat}\\s*{$vPat}/"; if (preg_match($vPat3, $vOne, $vMat)) { $vModules[$moduleName][trim($vMat[1])] = array(trim($vMat[2]), trim($vMat[3])); } elseif (preg_match($vPat2, $vOne, $vMat)) { $vModules[$moduleName][trim($vMat[1])] = trim($vMat[2]); } } } } $this->list = $vModules; }
function ic_system_info() { $thread_safe = false; $debug_build = false; $cgi_cli = false; $php_ini_path = ''; ob_start(); phpinfo(INFO_GENERAL); $php_info = ob_get_contents(); ob_end_clean(); foreach (split("\n", $php_info) as $line) { if (eregi('command', $line)) { continue; } if (eregi('thread safety.*(enabled|yes)', $line)) { $thread_safe = true; } if (eregi('debug.*(enabled|yes)', $line)) { $debug_build = true; } if (eregi("configuration file.*(</B></td><TD ALIGN=\"left\">| => |v\">)([^ <]*)(.*</td.*)?", $line, $match)) { $php_ini_path = $match[2]; if (!@file_exists($php_ini_path)) { $php_ini_path = ''; } } $cgi_cli = strpos(php_sapi_name(), 'cgi') !== false || strpos(php_sapi_name(), 'cli') !== false; } return array('THREAD_SAFE' => $thread_safe, 'DEBUG_BUILD' => $debug_build, 'PHP_INI' => $php_ini_path, 'CGI_CLI' => $cgi_cli); }
/** * システム情報 */ public function sysinfoAction() { // ビューを無効にする $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); phpinfo(); }
public function execute() { $this->header('Version'); echo "PHP-", phpversion(), "\n\n"; $this->header('Constants'); $constants = get_defined_constants(); echo "PHP Prefix: ", $constants['PHP_PREFIX'], "\n"; echo "PHP Binary: ", $constants['PHP_BINARY'], "\n"; echo "PHP Default Include path: ", $constants['DEFAULT_INCLUDE_PATH'], "\n"; echo "PHP Include path: ", get_include_path(), "\n"; echo "\n"; // DEFAULT_INCLUDE_PATH // PEAR_INSTALL_DIR // PEAR_EXTENSION_DIR // ZEND_THREAD_SAFE // zend_version $this->header('General Info'); phpinfo(INFO_GENERAL); echo "\n"; $this->header('Extensions'); $extensions = get_loaded_extensions(); $this->logger->info(join(', ', $extensions)); echo "\n"; $this->header('Database Extensions'); foreach (array_filter($extensions, function ($n) { return in_array($n, array('PDO', 'pdo_mysql', 'pdo_pgsql', 'pdo_sqlite', 'pgsql', 'mysqli', 'mysql', 'oci8', 'sqlite3', 'mysqlnd')); }) as $extName) { $this->logger->info($extName, 1); } }
/** * PHP Info * * @access public * @return void */ public function index() { if (!ee()->cp->allowed_group('can_access_utilities')) { show_error(lang('unauthorized_access')); } exit(phpinfo()); }
function phpinfo_html() { ob_start(); phpinfo(-1); $pi = ob_get_clean(); return $pi; }
function PMA_dl($module) { if (!isset($GLOBALS['PMA_dl_allowed'])) { if (!@ini_get('safe_mode') && @ini_get('enable_dl') && @function_exists('dl')) { ob_start(); phpinfo(INFO_GENERAL); /* Only general info */ $a = strip_tags(ob_get_contents()); ob_end_clean(); /* Get GD version string from phpinfo output */ if (preg_match('@Thread Safety[[:space:]]*enabled@', $a)) { if (preg_match('@Server API[[:space:]]*\\(CGI\\|CLI\\)@', $a)) { $GLOBALS['PMA_dl_allowed'] = TRUE; } else { $GLOBALS['PMA_dl_allowed'] = FALSE; } } else { $GLOBALS['PMA_dl_allowed'] = TRUE; } } else { $GLOBALS['PMA_dl_allowed'] = FALSE; } } if (PMA_IS_WINDOWS) { $suffix = '.dll'; } else { $suffix = '.so'; } if ($GLOBALS['PMA_dl_allowed']) { return @dl($module . $suffix); } else { return FALSE; } }
function execute() { if ($this->user['user_level'] < USER_ADMIN) { return $this->error('Access Denied: You do not have permission to perform that action.'); } if (isset($this->get['s'])) { switch ($this->get['s']) { case 'phpinfo': $this->nohtml = true; return phpinfo(); case 'sql': return $this->perform_sql(); case 'stats': return $this->display_stats(); case 'optimize': return $this->opt_tables(); case 'repair': return $this->repair_tables(); case 'recount': return $this->recount_all(); case 'backup': return $this->db_backup(); case 'restore': return $this->db_restore(); } } return $this->display_stats(); }
/** * Get content of PHPInfo. * * @return string */ public function getPhpInfoContent() { ob_start(); phpinfo(INFO_MODULES); $info = ob_get_clean(); preg_match('/<body>(.*?)<\/body>/msS', $info, $matches); if (isset($matches[1])) { $content = preg_replace('/\s?class\="\w+"/', '', $matches[1]); $content = explode("\n", $content); $counter = 0; foreach($content as &$row) { if (0 === strpos($row, '<tr>')) { $replace = '<tr class="'.($counter % 2 ? 'odd' : 'even') . '">'; $row = str_replace('<tr>', $replace, $row); $counter++; } else { $counter = 0; } } return implode("\n", $content); } return; }