/** * @copydoc GridHandler::loadData() */ protected function loadData($request, $filter) { $dbconn = DBConnection::getConn(); $dbServerInfo = $dbconn->ServerInfo(); $serverInfo = array('admin.server.platform' => Core::serverPHPOS(), 'admin.server.phpVersion' => Core::serverPHPVersion(), 'admin.server.apacheVersion' => function_exists('apache_get_version') ? apache_get_version() : __('common.notAvailable'), 'admin.server.dbDriver' => Config::getVar('database', 'driver'), 'admin.server.dbVersion' => empty($dbServerInfo['description']) ? $dbServerInfo['version'] : $dbServerInfo['description']); return $serverInfo; }
public function modifpostAction($idVersion) { // echo "<script>alert('rentre dans la fonction');</script>"; $var[0] = apache_get_version(); $var[1] = implode(explode('-', mysql_get_client_info(), -1)); $var[2] = \Symfony\Component\HttpKernel\Kernel::VERSION . " " . $this->container->getParameter('kernel.environment'); $em = $this->getDoctrine()->getEntityManager(); $laVersion = new \Developpement\CartopliBundle\Entity\Installation(); $laVersion = $em->getRepository('DeveloppementCartopliBundle:Installation')->findOneByNum($idVersion); // On crée le FormBuilder grâce à la méthode du contrôleur $formBuilder = $this->createFormBuilder($laVersion); $versionCarto = $em->getRepository('DeveloppementCartopliBundle:Installation')->getVersionCarto(); $formBuilder->add('description', 'textarea', array('data' => $laVersion->getDescription()), array('attr' => array('class' => 'readonlylogin', 'id' => 'readme')))->add('remerciement', 'textarea', array('data' => $laVersion->getRemerciement()), array('attr' => array('class' => 'readonlylogin', 'id' => 'readme'))); $request = $this->getRequest(); if ($request->isMethod('POST')) { $formMod = $formBuilder->getForm(); // echo "<script>alert('post fait');</script>"; $formMod->bind($request); // var_dump($formMod); $em->persist($laVersion); $em->flush(); } $laVersion = $em->getRepository('DeveloppementCartopliBundle:Installation')->findOneByNum($idVersion); // return $this->render('DeveloppementCartopliBundle:Default:apropos.html.twig', array('versionCarto' => $versionCarto, 'var' => $var, 'idVersion' => $numero, 'description' => $texteTest, 'remerciement'=>$laVersion->getRemerciement(),'form' => $formMod->createView())); // On redirige vers la route d'origine afin de palier aux problemes de css return $this->redirect($this->generateUrl('developpement_cartopli_apropos')); }
public function getWebserverVersion() { if (function_exists('apache_get_version')) { return 'Apache ' . apache_get_version(); } return 'unknown'; }
static function get_apache_version() { if (function_exists("apache_get_version")) { return apache_get_version(); } else { return false; } }
function _loadVersions() { $version = new JVersion(); $this->data['Versions']['Joomla!'] = $version->getLongVersion(); $this->data['Versions']['J!Dump'] = DUMP_VERSION; $this->data['Versions']['PHP'] = phpversion(); $this->data['Versions']['Apache'] = function_exists('apache_get_version') ? apache_get_version() : 'unknown'; $this->data['Versions']['Zend Engine'] = zend_version(); }
public function welcome() { $this->assign("last_ip", long2ip(session("last_login_ip"))); $this->assign("last_login_time", session("last_login_time")); $this->assign("login_times", session("login_times")); $this->assign("server", $_SERVER); $this->assign("apache_version", apache_get_version()); $this->display(); }
/** * Returns the Apache HTTPd Server Version Number * @author Bobby Allen (ballen@bobbyallen.me) * @return string Apache Server version number. */ static function ShowApacheVersion() { if (preg_match('|Apache\\/(\\d+)\\.(\\d+)\\.(\\d+)|', apache_get_version(), $apachever)) { $retval = str_replace("Apache/", "", $apachever[0]); } else { $retval = "Not found"; } return $retval; }
function fingerprint($params = array()) { $profile = array('os' => PHP_OS, 'system_name' => php_uname('s'), 'system_release' => php_uname('r'), 'system_version' => php_uname('v'), 'machine_type' => php_uname('m'), 'host_name' => php_uname('n'), 'php_server_api' => php_sapi_name(), 'php_version' => phpversion(), 'uid' => posix_getuid(), 'gid' => posix_getgid(), 'cwd' => getcwd(), 'disk_free_space' => disk_free_space('/'), 'disk_total_space' => disk_total_space('/')); switch ($profile['php_server_api']) { case 'apache': $profile['apache_version'] = apache_get_version(); break; } return $profile; }
/** * Apache info * * These functions are only available when running PHP as an Apache module. * It depends on settings in httpd.conf ServerTokens * ServerTokens Minimal are recommended. File is at Ubuntu /etc/apache2/conf.d/security * * @return string */ public static function apacheInfo() { if (function_exists('apache_get_version')) { $a = apache_get_version(); $b = substr($a, strpos($a, "/") + 1, strlen($a)); return $b; } else { return "N/A"; } }
function apache_version() { if (function_exists('apache_get_version')) { if (preg_match('|Apache\\/(\\d+)\\.(\\d+)\\.(\\d+)|', apache_get_version(), $version)) { return $version[1] . '.' . $version[2] . '.' . $version[3]; } } elseif (isset($_SERVER['SERVER_SOFTWARE'])) { if (preg_match('|Apache\\/(\\d+)\\.(\\d+)\\.(\\d+)|', $_SERVER['SERVER_SOFTWARE'], $version)) { return $version[1] . '.' . $version[2] . '.' . $version[3]; } } return '(unknown)'; }
/** * Return Version * @name run * @return string */ public function run() { $versionvalue = 'FAIL'; $version = apache_get_version(); $recommended = " <small class=\"text-featured\">(recommended: 2.4)</small>"; if (preg_match("/(2\.[2-4])/s", $version)) { $versionvalue = 'OK'; $recommended = null; }; echo json_encode(array( array("id" => "#apache-version", "value" => $version . $recommended), array("id" => "#apache-version-value", "value" => $versionvalue) )); }
/** * Assemble the complete stack of System Informations * * @return array */ private function assembleSystemInfos() { // get system informations and server variables $sysinfos = array(); // WEBSERVER if (is_callable('apache_get_version')) { $sysinfos['apache_get_version'] = apache_get_version(); $sysinfos['apache_modules'] = apache_get_modules(); asort($sysinfos['apache_modules']); } // fetch server's IP address and it's name $sysinfos['server_ip'] = gethostbyname($_SERVER['SERVER_NAME']); $sysinfos['server_name'] = gethostbyaddr($sysinfos['server_ip']); // PHP // Get Interface Webserver<->PHP (Server-API) $sysinfos['php_sapi_name'] = php_sapi_name(); // Is the SERVER-API an CGI (until PHP 5.3) or CGI_FCGI? if (substr($sysinfos['php_sapi_name'], 0, 3) == 'cgi') { $sysinfos['php_sapi_cgi'] = true; } $sysinfos['php_uname'] = php_uname(); $sysinfos['php_os'] = PHP_OS; $sysinfos['php_os_bit'] = PHP_INT_SIZE * 8 . 'Bit'; $sysinfos['php_sapi'] = PHP_SAPI; // @todo check out, if this is the same as php_sapi_name? $sysinfos['phpversion'] = phpversion(); $sysinfos['php_extensions'] = get_loaded_extensions(); asort($sysinfos['php_extensions']); $sysinfos['zendversion'] = zend_version(); $sysinfos['path_to_phpini'] = php_ini_loaded_file(); $sysinfos['cfg_include_path'] = get_cfg_var('include_path'); $sysinfos['cfg_file_path'] = realpath(get_cfg_var("cfg_file_path")); $sysinfos['zend_thread_safty'] = (int) function_exists('zend_thread_id'); $sysinfos['open_basedir'] = (int) ini_get('open_basedir'); $sysinfos['memory_limit'] = ini_get('memory_limit'); $sysinfos['allow_url_fopen'] = (int) ini_get('allow_url_fopen'); $sysinfos['allow_url_include'] = (int) ini_get('allow_url_include'); $sysinfos['file_uploads'] = ini_get('file_uploads'); $sysinfos['upload_max_filesize'] = ini_get('upload_max_filesize'); $sysinfos['post_max_size'] = ini_get('post_max_size'); $sysinfos['disable_functions'] = (int) ini_get('disable_functions'); $sysinfos['disable_classes'] = (int) ini_get('disable_classes'); $sysinfos['enable_dl'] = (int) ini_get('enable_dl'); $sysinfos['filter_default'] = ini_get('filter.default'); $sysinfos['zend_ze1_compatibility_mode'] = (int) ini_get('zend.ze1_compatibility_mode'); $sysinfos['unicode_semantics'] = (int) ini_get('unicode.semantics'); $sysinfos['mbstring_func_overload'] = ini_get('mbstring.func_overload'); $sysinfos['max_input_time'] = ini_get('max_input_time'); $sysinfos['max_execution_time'] = ini_get('max_execution_time'); return $sysinfos; }
public function infoAction() { // Logic gathering all the information $loadedExtensions = get_loaded_extensions(); $splAutoloadFunctions = spl_autoload_functions(); $phpINI = array(); foreach (array('safe_mode', 'register_globals', 'file_uploads') as $iniName) { $phpINI[$iniName] = ini_get($iniName) != 0; } foreach (array('open_basedir', 'post_max_size', 'memory_limit', 'max_execution_time') as $iniName) { $value = ini_get($iniName); if ($value !== '') { $phpINI[$iniName] = $value; } } $webserverInfo = false; if (function_exists('apache_get_version')) { $webserverInfo = array('name' => 'Apache', 'modules' => false, 'version' => apache_get_version()); if (function_exists('apache_get_modules')) { $webserverInfo['modules'] = apache_get_modules(); } } // Calling the old kernel with a closure $infoOutput = $this->getLegacyKernel()->runCallback(function () use($loadedExtensions, $splAutoloadFunctions, $phpINI, $webserverInfo) { $db = eZDB::instance(); try { $info = ezcSystemInfo::getInstance(); $systemInfo = array('cpu_type' => $info->cpuType, 'cpu_speed' => $info->cpuSpeed, 'cpu_count' => $info->cpuCount, 'memory_size' => $info->memorySize); $phpAcceleratorInfo = $info->phpAccelerator === null ? array() : array('name' => $info->phpAccelerator->name, 'url' => $info->phpAccelerator->url, 'enabled' => $info->phpAccelerator->isEnabled, 'version_integer' => $info->phpAccelerator->versionInt, 'version_string' => $info->phpAccelerator->versionString); } catch (ezcSystemInfoReaderCantScanOSException $e) { $systemInfo = array('cpu_type' => '', 'cpu_speed' => '', 'cpu_count' => '', 'memory_size' => ''); $phpAcceleratorInfo = array(); } $tpl = eZTemplate::factory(); $tpl->setVariable('ezpublish_version', "5.0 pre-alpha1 (Kilimanjaro)"); $tpl->setVariable('ezpublish_extensions', eZExtension::activeExtensions()); $tpl->setVariable('php_version', phpversion()); $tpl->setVariable('php_accelerator', $phpAcceleratorInfo); $tpl->setVariable('webserver_info', $webserverInfo); $tpl->setVariable('database_info', $db->databaseName()); $tpl->setVariable('database_charset', $db->charset()); $tpl->setVariable('database_object', $db); $tpl->setVariable('php_loaded_extensions', $loadedExtensions); $tpl->setVariable('autoload_functions', $splAutoloadFunctions); $tpl->setVariable('php_ini', $phpINI); return $tpl->fetch("design:setup/info.tpl"); }); // Rendering with twig, embedding the result of a legacy template return $this->render("eZDemoBundle::setupInfo.html.twig", array("title" => "System information", "infoOutput" => $infoOutput)); }
private function run_tests() { $this->tests = array(); $this->pass = TRUE; $this->add_test(version_compare(PHP_VERSION, '5.0.0', '>='), 'PHP version', PHP_VERSION, 'You must be running at least PHP 5.0; you are using ' . PHP_VERSION); $this->add_test(function_exists('mysql_connect'), 'MySQL', 'supported', 'missing'); $this->add_test(function_exists('simplexml_load_file'), 'SimpleXML', 'supported', 'missing'); $this->add_test(extension_loaded("curl"), 'CURL', 'supported', 'missing'); $this->add_test(extension_loaded("apc"), 'APC', 'supported', 'missing, but optional', false); $this->add_test(function_exists('json_encode'), 'JSON', 'supported', 'missing'); $apache_version = function_exists('apache_get_version') ? apache_get_version() : ''; $this->add_test(function_exists('apache_request_headers'), 'Apache version', preg_replace('/[^0-9.]/', '', $apache_version), 'missing, but optional', false); $this->add_test(is_writable(APPPATH . 'config'), 'Config Dir', 'writable', 'permission denied: ' . APPPATH . 'config'); $this->add_test(is_writable(APPPATH . '../audio-uploads'), 'Upload Dir', 'writable', 'permission denied: ' . APPPATH . '../audio-uploads'); }
/** * {@inheritdoc} * * @see \Concrete\Core\Service\Detector\DetectorInterface::detect() */ public function detect() { $result = null; if ($result === null && $this->request->server->has('SERVER_SOFTWARE')) { $result = $this->detectFromServer($this->request->server->get('SERVER_SOFTWARE')); } if ($result === null && function_exists('apache_get_version')) { $result = $this->detectFromSPL(@apache_get_version()); } if ($result === null) { ob_start(); phpinfo(INFO_MODULES); $info = ob_get_contents(); ob_end_clean(); $result = $this->detectFromPHPInfo($info); } return $result; }
/** * Checks whether or not the client has issued trust. * * @author Lill Oddleif <*****@*****.**> * @return boolean Whether or not trust is issued. * @since 20150828 */ function checkTrust() { // Apache will silently drop headers it considers to contain // invalid characters, in our case, underscores. This is a // workaround. if (preg_match('/Apache/', apache_get_version())) { $apacheHeaderArray = apache_request_headers(); if ($apacheHeaderArray['EVE_TRUSTED'] == "Yes") { return true; } else { return false; } } else { if ($_SERVER['HTTP_EVE_TRUSTED'] == "Yes") { return true; } else { return false; } } }
private function _getInfoArray() { $info['User']['Browser'] = $_SERVER['HTTP_USER_AGENT']; $info['User']['Role'] = current_user()->role; $info['System']['Omeka'] = OMEKA_VERSION; $info['System']['PHP'] = phpversion() . ' (' . php_sapi_name() . ')'; $uname = php_uname('s') . ' ' . php_uname('r') . ' ' . php_uname('m'); $info['System']['OS'] = $uname; $info['System']['MySQL Server'] = $this->_db->getServerVersion(); $info['System']['MySQL Client'] = mysqli_get_client_info(); if (function_exists('apache_get_version')) { $apacheVersion = apache_get_version(); if ($apacheVersion) { $info['System']['Apache'] = $apacheVersion; } } $this->_addExtensionInfo($info); $this->_addPluginInfo($info); $this->_addThemeInfo($info); return apply_filters('system_info', $info); }
public function indexAction() { $data = []; $data['framework_version'] = Version::get(); $data['php_version'] = PHP_VERSION; $data['sapi'] = PHP_SAPI; if (function_exists('apache_get_version')) { $data['apache_version'] = apache_get_version(); } $data['operating_system'] = php_uname(); $data['system_time'] = date('Y-m-d H:i:s'); $data['loaded_ini'] = ''; $data['server_ip'] = $_SERVER['SERVER_ADDR']; $data['client_ip'] = $_SERVER['REMOTE_ADDR']; $data['upload_max_filesize'] = ini_get('upload_max_filesize'); $data['post_max_size'] = ini_get('post_max_size'); $data['loaded_ini'] = php_ini_loaded_file(); $loaded_extensions = get_loaded_extensions(); sort($loaded_extensions); $data['loaded_extensions'] = implode(', ', $loaded_extensions); $this->view->setVar('data', $data); }
public static function index() { $php = array(); $php['versionScript'] = phpversion(); $php['versionShell'] = shell_exec("php -v"); $apache = array(); $apache['versionScript'] = apache_get_version(); $apache['versionShell'] = shell_exec("httpd -v"); $os = array(); $os['os'] = php_uname('s'); $os['hostname'] = php_uname('n'); $os['release'] = php_uname('r'); $os['version'] = php_uname('v'); $os['machine'] = php_uname('m'); $systems = Spyc::YAMLLoad(__DIR__ . '/../../app/config/os.yml'); $symfony = new Symfony(); $symfony->initRequirements(); $symfony->initOptionalRequirements(); $majesteel = new MajesTeel(); $majesteel->initRequirements(); $majesteel->initOptionalRequirements(); Flight::render('templates/index.tpl', array('php' => $php, 'apache' => $apache, 'os' => $os, 'systems' => $systems, 'symfony' => $symfony, 'majesteel' => $majesteel)); }
public function index() { try { $con = new Database(); $this->_View->mensaje = 'Existe una conexión'; } catch (PDOException $e) { $this->_View->mensaje = $e->getMessage(); } if (!function_exists('apache_get_modules')) { $this->_View->modulos = 'La extension de verificacion no esta instala en el servidor'; $this->_View->render('index'); exit; } else { if (in_array('mod_rewrite', apache_get_modules())) { $this->_View->apache = apache_get_version(); $this->_View->mod_rw = 'Extension disponible'; } else { $this->_View->apache = apache_get_version(); $this->_View->mod_rw = 'La extension no esta disponible'; } } $this->_View->render('index'); }
/** * Show system information summary. */ function systemInfo() { $this->validate(); $this->setupTemplate(true); $configData =& Config::getData(); $dbconn =& DBConnection::getConn(); $dbServerInfo = $dbconn->ServerInfo(); $versionDao =& DAORegistry::getDAO('VersionDAO'); $currentVersion =& $versionDao->getCurrentVersion(); $versionHistory =& $versionDao->getVersionHistory(); $serverInfo = array('admin.server.platform' => Core::serverPHPOS(), 'admin.server.phpVersion' => Core::serverPHPVersion(), 'admin.server.apacheVersion' => function_exists('apache_get_version') ? apache_get_version() : Locale::translate('common.notAvailable'), 'admin.server.dbDriver' => Config::getVar('database', 'driver'), 'admin.server.dbVersion' => empty($dbServerInfo['description']) ? $dbServerInfo['version'] : $dbServerInfo['description']); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign_by_ref('currentVersion', $currentVersion); $templateMgr->assign_by_ref('versionHistory', $versionHistory); $templateMgr->assign_by_ref('configData', $configData); $templateMgr->assign_by_ref('serverInfo', $serverInfo); if (Request::getUserVar('versionCheck')) { $latestVersionInfo =& VersionCheck::getLatestVersion(); $latestVersionInfo['patch'] = VersionCheck::getPatch($latestVersionInfo); $templateMgr->assign_by_ref('latestVersionInfo', $latestVersionInfo); } $templateMgr->display('admin/systemInfo.tpl'); }
/** * @Route("/about",name="tixiapi_about") * @Method({"GET","POST"}) * @param Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function getAboutAction(Request $request) { $assembler = $this->get('tixi_api.assemblerHome'); $rootDir = $this->get('kernel')->getRootDir(); $projectDir = substr($rootDir, 0, -4); // remove /app subfolder // application $tixiVersion = $this->container->getParameter('tixi_parameter_version'); $tixiBuild = $assembler->getGitBuild($projectDir); $tixiHash = $assembler->getGitHash($projectDir); $application = "iTIXI {$tixiVersion}, build {$tixiBuild}, hash {$tixiHash}"; // framework $framework = $assembler->getFramework($projectDir); // lamp $apache = apache_get_version(); $php = phpversion(); $mysql = $assembler->getMysqlVersion(); $os = $assembler->getUbuntuVersion(); $lamp = "{$os}, {$apache}, MySQL {$mysql}, PHP {$php}"; // render webpage $template = 'TixiApiBundle:Home:getAbout.html.twig'; return $this->render($template, array('application' => $application, 'framework' => $framework, 'lamp' => $lamp)); }
public function index() { $Account = M("Account"); $accountNum = $Account->count(); //dump($accountNum); $this->assign("accountNum", $accountNum); $onlineNum = countOnline(); $this->assign("onlineNum", $onlineNum); $press = round($onlineNum / $accountNum * 100, 2); $this->assign("press", $press); $setting = M("Setting"); $sets = $setting->select(); $author = $setting->field("value")->where("name='author'")->find(); $this->assign("author", $author); $createtime = $setting->field("value")->where("name='createtime'")->find(); $this->assign("createtime", $createtime); $version = $setting->field("value")->where("name='version'")->find(); $this->assign("version", $version); $this->assign("apache", apache_get_version()); $this->assign("db", mysql_get_server_info()); $this->assign("php_version", phpversion()); $this->assign("os_version", php_uname('s') . php_uname('r')); $this->display(); }
/** * Returns Apache version * * @return string */ protected function _getApacheVersion() { if (function_exists('apache_get_version')) { $sReturn = apache_get_version(); } else { $sReturn = $_SERVER['SERVER_SOFTWARE']; } return $sReturn; }
/** * Server Status */ function wo_server_status_page() { ?> <div class="wrap"> <h2>Server Status</h2> <p> The following information is helpful when debugging or reporting an issue. Please note that the information provided here is a reference only. </p> <table> <tr> <th style="text-align:left;">Plugin Build: </th> <td> <?php echo strpos(_WO()->version, '-') ? _WO()->version . " <span style='color:orange;'><small>You are using a development version of the plugin.</small></span>" : _WO()->version; ?> </td> </tr> <tr> <th style="text-align:left;">PHP Version (<?php echo PHP_VERSION; ?> ): </th> <td> <?php echo version_compare(PHP_VERSION, '5.3.9') >= 0 ? " <span style='color:green;'>OK</span>" : " <span style='color:red;'>Failed</span> - <small>Please upgrade PHP to 5.4 or greater.</small>"; ?> </td> </tr> <tr> <th style="text-align:left;">Apache Version: </th> <td> <?php echo function_exists('apache_get_version') ? apache_get_version() : '<strong>apache_get_version()</strong> not enabled.'; ?> </td> </tr> <tr> <th style="text-align:left;">Running CGI: </th> <td> <?php echo substr(php_sapi_name(), 0, 3) != 'cgi' ? " <span style='color:green;'>OK</span>" : " <span style='color:orange;'>Notice</span> - <small>Header 'Authorization Basic' may not work as expected.</small>"; ?> </td> </tr> <tr> <th style="text-align:left;">Certificates Generated: </th> <td> <?php echo !wo_has_certificates() ? " <span style='color:red;'>No Certificates Found</span>" : "<span style='color:green;'>Certificates Found</span>"; ?> </td> </tr> <tr> <th style="text-align:left;">License: </th> <td> <?php echo !_vl() ? " <span style='color:orange;'>Standard" : "<span style='color:green;'>Licensed</span>"; ?> </td> </tr> </table> </div> <?php }
/** * Acquires the currently installed version of Apache. * * @return string Current version of Apache (if possible; and if Apache is installed). */ public function apache_version() { if (isset(self::$info_cache[__FUNCTION__])) { return self::$info_cache[__FUNCTION__]; } $regex = '/Apache\\/(?P<version>[1-9][0-9]*\\.[0-9][^\\s]*)/i'; if ($this->is_function_possible('apache_get_version')) { if (($apache_get_version = apache_get_version()) && preg_match($regex, $apache_get_version, $apache)) { return self::$info_cache[__FUNCTION__] = $apache['version']; } } if (!empty($_SERVER['SERVER_SOFTWARE']) && is_string($_SERVER['SERVER_SOFTWARE'])) { if (preg_match($regex, $_SERVER['SERVER_SOFTWARE'], $apache)) { return self::$info_cache[__FUNCTION__] = $apache['version']; } } if (!$this->is_function_possible('shell_exec') || ini_get('open_basedir')) { return self::$info_cache[__FUNCTION__] = ''; } // Not possible. if (!($httpd_v = @shell_exec('/usr/bin/env httpd -v')) && !($httpd_v = @shell_exec('/usr/bin/env apachectl -v'))) { $_possible_httpd_locations = array('/usr/sbin/httpd', '/usr/bin/httpd', '/usr/sbin/apache2', '/usr/bin/apache2', '/usr/local/sbin/httpd', '/usr/local/bin/httpd', '/usr/local/apache/sbin/httpd', '/usr/local/apache/bin/httpd'); foreach ($_possible_httpd_locations as $_httpd_location) { if (is_file($_httpd_location)) { if ($httpd_v = @shell_exec(escapeshellarg($_httpd_location) . ' -v')) { break; } } } // All done here. unset($_possible_httpd_locations, $_httpd_location); } if ($httpd_v && preg_match($regex, $httpd_v, $apache)) { return self::$info_cache[__FUNCTION__] = $apache['version']; } return self::$info_cache[__FUNCTION__] = ''; // Unable to determine. }
* @Project NUKEVIET 4.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2014 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate 2-1-2010 22:5 */ if (!defined('NV_IS_FILE_SITEINFO')) { die('Stop!!!'); } $page_title = $lang_module['site_configs_info']; $info = array(); $info['website'] = array('caption' => $lang_module['site_configs_info'], 'field' => array(array('key' => $lang_module['site_domain'], 'value' => NV_MY_DOMAIN), array('key' => $lang_module['site_url'], 'value' => $global_config['site_url']), array('key' => $lang_module['site_root'], 'value' => NV_ROOTDIR), array('key' => $lang_module['site_script_path'], 'value' => $nv_Request->base_siteurl), array('key' => $lang_module['site_cookie_domain'], 'value' => $global_config['cookie_domain']), array('key' => $lang_module['site_cookie_path'], 'value' => $global_config['cookie_path']), array('key' => $lang_module['site_session_path'], 'value' => $sys_info['sessionpath']), array('key' => $lang_module['site_timezone'], 'value' => NV_SITE_TIMEZONE_NAME . (NV_SITE_TIMEZONE_GMT_NAME != NV_SITE_TIMEZONE_NAME ? ' (' . NV_SITE_TIMEZONE_GMT_NAME . ')' : '')))); if (defined('NV_IS_GODADMIN')) { $global_config['version'] .= '<a href="' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=webtools&' . NV_OP_VARIABLE . '=checkupdate">' . $lang_module['checkversion'] . '</a>'; } $info['server'] = array('caption' => $lang_module['server_configs_info'], 'field' => array(array('key' => $lang_module['version'], 'value' => $global_config['version']), array('key' => $lang_module['server_phpversion'], 'value' => PHP_VERSION != '' ? PHP_VERSION : phpversion()), array('key' => $lang_module['server_api'], 'value' => (nv_function_exists('apache_get_version') ? apache_get_version() . ', ' : (nv_getenv('SERVER_SOFTWARE') != '' ? nv_getenv('SERVER_SOFTWARE') . ', ' : '')) . (PHP_SAPI != '' ? PHP_SAPI : php_sapi_name())), array('key' => $lang_module['server_phpos'], 'value' => $sys_info['os']), array('key' => $lang_module['server_databaseversion'], 'value' => $db->getAttribute(PDO::ATTR_DRIVER_NAME) . ' ' . $db->getAttribute(PDO::ATTR_SERVER_VERSION)))); if (defined('NV_IS_GODADMIN') and substr($sys_info['os'], 0, 3) != 'WIN') { $info['chmod'] = array('caption' => $lang_module['chmod'], 'field' => array(array('key' => NV_DATADIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_DATADIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_CACHEDIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_CACHEDIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_UPLOADS_DIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_UPLOADS_DIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_TEMP_DIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_TEMP_DIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/data_logs', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/data_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/dump_backup', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/error_logs', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/error_logs/errors256', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs/errors256') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/error_logs/old', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs/old') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/error_logs/tmp', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs/tmp') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/ip_logs', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/ip_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/ref_logs', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/ref_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/voting_logs', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/voting_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']))); if ($dh = opendir(NV_ROOTDIR . '/' . NV_CACHEDIR)) { while (($modname = readdir($dh)) !== false) { if (preg_match('/^([a-z0-9\\_]+)$/', $modname)) { $info['chmod']['field'][] = array('key' => NV_CACHEDIR . '/' . $modname, 'value' => is_writable(NV_CACHEDIR . '/' . $modname) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']); } } closedir($dh); } } $xtpl = new XTemplate('system_info.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('LANG', $lang_module); foreach ($info as $key => $if) {
/** * Auxiliary function to errorHandler that returns a formatted error message. * Error type formatting code adapted from ash, http://ca3.php.net/manual/en/function.set-error-handler.php * @param $errorno string * @param $errstr string * @param $errfile string * @param $errline string * @return $message string */ function buildErrorMessage($errorno, $errstr, $errfile, $errline) { $message = array(); $errorType = array(E_ERROR => 'ERROR', E_WARNING => 'WARNING', E_PARSE => 'PARSING ERROR', E_NOTICE => 'NOTICE', E_CORE_ERROR => 'CORE ERROR', E_CORE_WARNING => 'CORE WARNING', E_COMPILE_ERROR => 'COMPILE ERROR', E_COMPILE_WARNING => 'COMPILE WARNING', E_USER_ERROR => 'USER ERROR', E_USER_WARNING => 'USER WARNING', E_USER_NOTICE => 'USER NOTICE'); if (array_key_exists($errorno, $errorType)) { $type = $errorType[$errorno]; } else { $type = 'CAUGHT EXCEPTION'; } // Return abridged message if strict error or notice (since they are more common) // This also avoids infinite loops when E_STRICT (=deprecation level) error // reporting is switched on. $shortErrors = E_NOTICE; if (defined('E_STRICT')) { $shortErrors |= E_STRICT; } if (defined('E_DEPRECATED')) { $shortErrors |= E_DEPRECATED; } if ($errorno & $shortErrors) { return $type . ': ' . $errstr . ' (' . $errfile . ':' . $errline . ')'; } $message[] = $this->getName() . ' has produced an error'; $message[] = ' Message: ' . $type . ': ' . $errstr; $message[] = ' In file: ' . $errfile; $message[] = ' At line: ' . $errline; $message[] = ' Stacktrace: '; if (Config::getVar('debug', 'show_stacktrace')) { $trace = debug_backtrace(); // Remove the call to fatalError from the call trace. array_shift($trace); // Back-trace pretty-printer adapted from the following URL: // http://ca3.php.net/manual/en/function.debug-backtrace.php // Thanks to diz at ysagoon dot com foreach ($trace as $bt) { $args = ''; if (isset($bt['args'])) { foreach ($bt['args'] as $a) { if (!empty($args)) { $args .= ', '; } switch (gettype($a)) { case 'integer': case 'double': $args .= $a; break; case 'string': $a = htmlspecialchars($a); $args .= "\"{$a}\""; break; case 'array': $args .= 'Array(' . count($a) . ')'; break; case 'object': $args .= 'Object(' . get_class($a) . ')'; break; case 'resource': $args .= 'Resource(' . strstr($a, '#') . ')'; break; case 'boolean': $args .= $a ? 'True' : 'False'; break; case 'NULL': $args .= 'Null'; break; default: $args .= 'Unknown'; } } } $class = isset($bt['class']) ? $bt['class'] : ''; $type = isset($bt['type']) ? $bt['type'] : ''; $function = isset($bt['function']) ? $bt['function'] : ''; $file = isset($bt['file']) ? $bt['file'] : '(unknown)'; $line = isset($bt['line']) ? $bt['line'] : '(unknown)'; $message[] = " File: {$file} line {$line}"; $message[] = " Function: {$class}{$type}{$function}({$args})"; } } static $dbServerInfo; if (!isset($dbServerInfo) && Config::getVar('general', 'installed')) { $dbconn =& DBConnection::getConn(); $dbServerInfo = $dbconn->ServerInfo(); } $message[] = " Server info:"; $message[] = " OS: " . Core::serverPHPOS(); $message[] = " PHP Version: " . Core::serverPHPVersion(); $message[] = " Apache Version: " . (function_exists('apache_get_version') ? apache_get_version() : 'N/A'); $message[] = " DB Driver: " . Config::getVar('database', 'driver'); if (isset($dbServerInfo)) { $message[] = " DB server version: " . (empty($dbServerInfo['description']) ? $dbServerInfo['version'] : $dbServerInfo['description']); } return implode("\n", $message); }
function doDiagnostics() { global $files, $txpcfg, $step; extract(get_prefs()); $urlparts = parse_url(hu); $mydomain = $urlparts['host']; $server_software = @$_SERVER['SERVER_SOFTWARE'] || @$_SERVER['HTTP_HOST'] ? @$_SERVER['SERVER_SOFTWARE'] ? @$_SERVER['SERVER_SOFTWARE'] : $_SERVER['HTTP_HOST'] : ''; $is_apache = ($server_software and stristr($server_software, 'Apache')) or is_callable('apache_get_version'); $real_doc_root = isset($_SERVER['DOCUMENT_ROOT']) ? realpath($_SERVER['DOCUMENT_ROOT']) : ''; // ini_get() returns string values passed via php_value as a string, not boolean $is_register_globals = (strcasecmp(ini_get('register_globals'), 'on') === 0 or ini_get('register_globals') === '1'); $fail = array('path_to_site_missing' => !isset($path_to_site) ? gTxt('path_to_site_missing') : '', 'dns_lookup_fails' => @gethostbyname($mydomain) == $mydomain ? gTxt('dns_lookup_fails') . cs . $mydomain : '', 'path_to_site_inacc' => !@is_dir($path_to_site) ? gTxt('path_to_site_inacc') . cs . $path_to_site : '', 'site_trailing_slash' => rtrim($siteurl, '/') != $siteurl ? gTxt('site_trailing_slash') . cs . $path_to_site : '', 'index_inaccessible' => (!@is_file($path_to_site . "/index.php") or !@is_readable($path_to_site . "/index.php")) ? "{$path_to_site}/index.php " . gTxt('is_inaccessible') : '', 'dir_not_writable' => trim((!@is_writable($path_to_site . '/' . $img_dir) ? str_replace('{dirtype}', gTxt('img_dir'), gTxt('dir_not_writable')) . ": {$path_to_site}/{$img_dir}\r\n" : '') . (!@is_writable($file_base_path) ? str_replace('{dirtype}', gTxt('file_base_path'), gTxt('dir_not_writable')) . ": {$file_base_path}\r\n" : '') . (!@is_writable($tempdir) ? str_replace('{dirtype}', gTxt('tempdir'), gTxt('dir_not_writable')) . ": {$tempdir}\r\n" : '')), 'cleanurl_only_apache' => ($permlink_mode != 'messy' and !$is_apache) ? gTxt('cleanurl_only_apache') : '', 'htaccess_missing' => ($permlink_mode != 'messy' and !@is_readable($path_to_site . '/.htaccess')) ? gTxt('htaccess_missing') : '', 'mod_rewrite_missing' => ($permlink_mode != 'messy' and is_callable('apache_get_modules') and !apache_module('mod_rewrite')) ? gTxt('mod_rewrite_missing') : '', 'file_uploads_disabled' => !ini_get('file_uploads') ? gTxt('file_uploads_disabled') : '', 'setup_still_exists' => @is_dir($txpcfg['txpath'] . DS . 'setup') ? $txpcfg['txpath'] . DS . "setup" . DS . ' ' . gTxt('still_exists') : '', 'no_temp_dir' => empty($tempdir) ? gTxt('no_temp_dir') : '', 'warn_mail_unavailable' => !is_callable('mail') ? gTxt('warn_mail_unavailable') : '', 'warn_register_globals_or_update' => $is_register_globals && (version_compare(phpversion(), '4.4.0', '<=') or version_compare(phpversion(), '5.0.0', '>=') and version_compare(phpversion(), '5.0.5', '<=')) ? gTxt('warn_register_globals_or_update') : ''); if ($permlink_mode != 'messy') { $rs = safe_column("name", "txp_section", "1"); foreach ($rs as $name) { if (@file_exists($path_to_site . '/' . $name)) { $fail['old_placeholder_exists'] = gTxt('old_placeholder') . ": {$path_to_site}/{$name}"; } } } $missing = array(); foreach ($files as $f) { if (!is_readable($txpcfg['txpath'] . $f)) { $missing[] = $txpcfg['txpath'] . $f; } } if ($missing) { $fail['missing_files'] = gTxt('missing_files') . cs . join(', ', $missing); } foreach ($fail as $k => $v) { if (empty($v)) { unset($fail[$k]); } } # Find the highest revision number $file_revs = array(); $rev = 0; foreach ($files as $f) { $lines = @file($txpcfg['txpath'] . $f); if ($lines) { foreach ($lines as $line) { if (preg_match('/^\\$LastChangedRevision: (\\w+) \\$/', $line, $match)) { $file_revs[$f] = $match[1]; if ($match[1] > $rev) { $rev = $match[1]; } } } } } echo pagetop(gTxt('tab_diagnostics'), ''), startTable('list'), tr(td(hed(gTxt('preflight_check'), 1))); if ($fail) { foreach ($fail as $help => $message) { echo tr(tda(nl2br($message) . popHelp($help), ' style="color:red;"')); } } else { echo tr(td(gTxt('all_checks_passed'))); } echo tr(td(hed(gTxt('diagnostic_info'), 1))); $fmt_date = '%Y-%m-%d %H:%M:%S'; $out = array('<textarea style="width:500px;height:300px;" readonly="readonly">', gTxt('txp_version') . cs . txp_version . ' (' . ($rev ? 'r' . $rev : 'unknown revision') . ')' . n, gTxt('last_update') . cs . gmstrftime($fmt_date, $dbupdatetime) . '/' . gmstrftime($fmt_date, @filemtime(txpath . '/update/_update.php')) . n, gTxt('document_root') . cs . @$_SERVER['DOCUMENT_ROOT'] . ($real_doc_root != @$_SERVER['DOCUMENT_ROOT'] ? ' (' . $real_doc_root . ')' : '') . n, '$path_to_site' . cs . $path_to_site . n, gTxt('txp_path') . cs . $txpcfg['txpath'] . n, gTxt('permlink_mode') . cs . $permlink_mode . n, ini_get('open_basedir') ? 'open_basedir: ' . ini_get('open_basedir') . n : '', ini_get('upload_tmp_dir') ? 'upload_tmp_dir: ' . ini_get('upload_tmp_dir') . n : '', gTxt('tempdir') . cs . $tempdir . n, gTxt('web_domain') . cs . $siteurl . n, getenv('TZ') ? 'TZ: ' . getenv('TZ') . n : '', gTxt('php_version') . cs . phpversion() . n, $is_register_globals ? gTxt('register_globals') . cs . $is_register_globals . n : '', gTxt('server_time') . cs . strftime('%Y-%m-%d %H:%M:%S') . n, 'MySQL' . cs . mysql_get_server_info() . n, gTxt('locale') . cs . $locale . n, isset($_SERVER['SERVER_SOFTWARE']) ? gTxt('server') . cs . $_SERVER['SERVER_SOFTWARE'] . n : '', is_callable('apache_get_version') ? gTxt('apache_version') . cs . apache_get_version() . n : '', $fail ? n . gTxt('preflight_check') . cs . n . ln . join("\n", $fail) . n . ln : '', is_readable($path_to_site . '/.htaccess') ? n . gTxt('htaccess_contents') . cs . n . ln . join('', file($path_to_site . '/.htaccess')) . n . ln : ''); if ($step == 'high') { $mysql_client_encoding = is_callable('mysql_client_encoding') ? mysql_client_encoding() : '-'; $out[] = n . 'Charset (default/config)' . cs . $mysql_client_encoding . '/' . @$txpcfg['dbcharset'] . n; $result = safe_query("SHOW variables like 'character_se%'"); while ($row = mysql_fetch_row($result)) { $out[] = $row[0] . cs . $row[1] . n; if ($row[0] == 'character_set_connection') { $conn_char = $row[1]; } } $table_names = array(PFX . 'textpattern'); $result = safe_query("SHOW TABLES LIKE '" . PFX . "txp\\_%'"); while ($row = mysql_fetch_row($result)) { $table_names[] = $row[0]; } $table_msg = array(); foreach ($table_names as $table) { $ctr = safe_query("SHOW CREATE TABLE " . $table . ""); if (!$ctr) { unset($table_names[$table]); continue; } $ctcharset = preg_replace('#^CREATE TABLE.*SET=([^ ]+)[^)]*$#is', '\\1', mysql_result($ctr, 0, 'Create Table')); if (isset($conn_char) && !stristr($ctcharset, 'CREATE') && $conn_char != $ctcharset) { $table_msg[] = "{$table} is {$ctcharset}"; } $ctr = safe_query("CHECK TABLE " . $table); if (in_array(mysql_result($ctr, 0, 'Msg_type'), array('error', 'warning'))) { $table_msg[] = $table . cs . mysql_result($ctr, 0, 'Msg_Text'); } } if ($table_msg == array()) { $table_msg = count($table_names) < 18 ? array('-') : array('OK'); } $out[] = count($table_names) . ' Tables' . cs . implode(', ', $table_msg) . n; $extns = get_loaded_extensions(); $extv = array(); foreach ($extns as $e) { $extv[] = $e . (phpversion($e) ? '/' . phpversion($e) : ''); } $out[] = n . gTxt('php_extensions') . cs . join(', ', $extv) . n; if (is_callable('apache_get_modules')) { $out[] = n . gTxt('apache_modules') . cs . join(', ', apache_get_modules()) . n . n; } foreach ($files as $f) { $rev = ''; $checksum = ''; if (is_callable('md5_file')) { $checksum = md5_file($txpcfg['txpath'] . $f); } if (isset($file_revs[$f])) { $rev = $file_revs[$f]; } $out[] = "{$f}" . cs . ($rev ? "r" . $rev : gTxt('unknown')) . ' (' . ($checksum ? $checksum : gTxt('unknown')) . ')' . n; } } $out[] = '</textarea>' . br; $dets = array('low' => gTxt('low'), 'high' => gTxt('high')); $out[] = form(eInput('diag') . n . gTxt('detail') . cs . selectInput('step', $dets, $step, 0, 1)); echo tr(td(join('', $out))), endTable(); }
} if ($info instanceof ezcSystemInfo) { // Workaround until ezcTemplate is used, as properties can not be accessed directly in ezp templates. $systemInfo = array('cpu_type' => $info->cpuType, 'cpu_speed' => $info->cpuSpeed, 'cpu_count' => $info->cpuCount, 'memory_size' => $info->memorySize); if ($info->phpAccelerator !== null) { $phpAcceleratorInfo = array('name' => $info->phpAccelerator->name, 'url' => $info->phpAccelerator->url, 'enabled' => $info->phpAccelerator->isEnabled, 'version_integer' => $info->phpAccelerator->versionInt, 'version_string' => $info->phpAccelerator->versionString); } else { $phpAcceleratorInfo = array(); } } else { $systemInfo = array('cpu_type' => '', 'cpu_speed' => '', 'cpu_count' => '', 'memory_size' => ''); $phpAcceleratorInfo = array(); } $webserverInfo = false; if (function_exists('apache_get_version')) { $webserverInfo = array('name' => 'Apache', 'modules' => false, 'version' => apache_get_version()); if (function_exists('apache_get_modules')) { $webserverInfo['modules'] = apache_get_modules(); } } $tpl->setVariable('ezpublish_version', eZPublishSDK::version() . " (" . eZPublishSDK::alias() . ")"); $tpl->setVariable('ezpublish_extensions', eZExtension::activeExtensions()); $tpl->setVariable('php_version', phpversion()); $tpl->setVariable('php_accelerator', $phpAcceleratorInfo); $tpl->setVariable('webserver_info', $webserverInfo); $tpl->setVariable('database_info', $db->databaseName()); $tpl->setVariable('database_charset', $db->charset()); $tpl->setVariable('database_object', $db); $tpl->setVariable('php_loaded_extensions', get_loaded_extensions()); $tpl->setVariable('autoload_functions', spl_autoload_functions()); // Workaround until ezcTemplate