function system_information() { global $mysqli, $server, $redis_server, $mqtt_server; $result = $mysqli->query("select now() as datetime, time_format(timediff(now(),convert_tz(now(),@@session.time_zone,'+00:00')),'%H:%i') AS timezone"); $db = $result->fetch_array(); @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', php_uname('a'), 5)); @exec('ps ax | grep feedwriter.php | grep -v grep', $feedwriterproc); $meminfo = false; if (@is_readable('/proc/meminfo')) { $data = explode("\n", file_get_contents("/proc/meminfo")); $meminfo = array(); foreach ($data as $line) { if (strpos($line, ':') !== false) { list($key, $val) = explode(":", $line); $meminfo[$key] = 1024 * floatval(trim(str_replace(' kB', '', $val))); } } } $emoncms_modules = ""; $emoncmsModulesPath = substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], '/')) . '/Modules'; // Set the Modules path $emoncmsModuleFolders = glob("{$emoncmsModulesPath}/*", GLOB_ONLYDIR); // Use glob to get all the folder names only foreach ($emoncmsModuleFolders as $emoncmsModuleFolder) { // loop through the folders if ($emoncms_modules != "") { $emoncms_modules .= " "; } $emoncms_modules .= str_replace($emoncmsModulesPath . "/", '', $emoncmsModuleFolder); } return array('date' => date('Y-m-d H:i:s T'), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @exec('uptime'), 'http_server' => $_SERVER['SERVER_SOFTWARE'], 'php' => PHP_VERSION, 'zend' => function_exists('zend_version') ? zend_version() : 'n/a', 'db_server' => $server, 'db_ip' => gethostbyname($server), 'db_version' => 'MySQL ' . $mysqli->server_info, 'db_stat' => $mysqli->stat(), 'db_date' => $db['datetime'] . " (UTC " . $db['timezone'] . ")", 'redis_server' => $redis_server['host'] . ":" . $redis_server['port'], 'redis_ip' => gethostbyname($redis_server['host']), 'feedwriter' => !empty($feedwriterproc), 'mqtt_server' => $mqtt_server['host'], 'mqtt_ip' => gethostbyname($mqtt_server['host']), 'mqtt_port' => $mqtt_server['port'], 'hostbyaddress' => @gethostbyaddr(gethostbyname($host)), 'http_proto' => $_SERVER['SERVER_PROTOCOL'], 'http_mode' => $_SERVER['GATEWAY_INTERFACE'], 'http_port' => $_SERVER['SERVER_PORT'], 'php_modules' => get_loaded_extensions(), 'mem_info' => $meminfo, 'partitions' => disk_list(), 'emoncms_modules' => $emoncms_modules); }
/** * @param CommandSender $sender */ public function sendPHPInfo(CommandSender $sender) { $info = ["CWD" => getcwd(), "GID" => getmygid(), "PID" => getmypid(), "UID" => getmyuid(), "Memory-usage" => memory_get_usage(true), "Memory-peak-usage" => memory_get_peak_usage(true), "PHP-version" => phpversion(), "Zend-version" => zend_version()]; foreach ($info as $key => $value) { $sender->sendMessage($key . ": " . $value); } }
function get_system_info() { global $gacl_api; //Grab system info $system_info .= 'PHP Version: ' . phpversion() . "\n"; $system_info .= 'Zend Version: ' . zend_version() . "\n"; $system_info .= 'Web Server: ' . $_SERVER['SERVER_SOFTWARE'] . "\n\n"; $system_info .= 'phpGACL Settings: ' . "\n"; $system_info .= ' phpGACL Version: ' . $gacl_api->get_version() . "\n"; $system_info .= ' phpGACL Schema Version: ' . $gacl_api->get_schema_version() . "\n"; if ($gacl_api->_caching == TRUE) { $caching = 'True'; } else { $caching = 'False'; } $system_info .= ' Caching Enabled: ' . $caching . "\n"; if ($gacl_api->_force_cache_expire == TRUE) { $force_cache_expire = 'True'; } else { $force_cache_expire = 'False'; } $system_info .= ' Force Cache Expire: ' . $force_cache_expire . "\n"; $system_info .= ' Database Prefix: \'' . $gacl_api->_db_table_prefix . "'\n"; $system_info .= ' Database Type: ' . $gacl_api->_db_type . "\n"; $database_server_info = $gacl_api->db->ServerInfo(); $system_info .= ' Database Version: ' . $database_server_info['version'] . "\n"; $system_info .= ' Database Description: ' . $database_server_info['description'] . "\n\n"; $system_info .= 'Server Name: ' . $_SERVER["SERVER_NAME"] . "\n"; $system_info .= ' OS: ' . PHP_OS . "\n"; $system_info .= ' IP Address: ' . $_SERVER["REMOTE_ADDR"] . "\n"; $system_info .= ' Browser: ' . $_SERVER["HTTP_USER_AGENT"] . "\n\n"; $system_info .= 'System Information: ' . php_uname() . "\n"; return trim($system_info); }
/** * Retreive server information * * @return array */ function oosGetSystemInformation() { // Get database information $dbconn =& oosDBGetConn(); $oostable =& oosDBGetTables(); $db_host = $dbconn->host; $db_database = $dbconn->database; $phpv = phpversion(); $db_result = $dbconn->ServerInfo($oostable['countries']); list($system, $host, $kernel) = preg_split('/[\s,]+/', @exec('uname -a'), 5); return array('date' => oos_datetime_short(date('Y-m-d H:i:s')), 'system' => $_ENV["OS"], 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @exec('uptime'), 'HTTP_SERVER' => $_SERVER['SERVER_SOFTWARE'], 'php' => $phpv, 'zend' => (function_exists('zend_version') ? zend_version() : ''), 'db_server' => $db_host, 'db_ip' => gethostbyname(OOS_DB_SERVER), 'db_version' => OOS_DB_TYPE . $db_result['description'], 'db_database' => $db_database); }
/** * Retrieve web server and database server information * * @access public */ function lc_get_system_information() { global $lC_Database; $Qdb_date = $lC_Database->query('select now() as datetime'); $Qdb_uptime = $lC_Database->query('show status like "Uptime"'); @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', @exec('uname -a'), 5)); $db_uptime = intval($Qdb_uptime->valueInt('Value') / 3600) . ':' . str_pad(intval($Qdb_uptime->valueInt('Value') / 60 % 60), 2, '0', STR_PAD_LEFT); return array('date' => lC_DateTime::getShort(null, true), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @exec('uptime'), 'http_server' => $_SERVER['SERVER_SOFTWARE'], 'php' => PHP_VERSION, 'zend' => function_exists('zend_version') ? zend_version() : '', 'db_server' => DB_SERVER, 'db_ip' => gethostbyname(DB_SERVER), 'db_version' => 'MySQL ' . (function_exists('mysql_get_server_info') ? @mysql_get_server_info() : ''), 'db_date' => lC_DateTime::getShort($Qdb_date->value('datetime'), true), 'db_uptime' => $db_uptime); }
function copy() { if (version_compare(zend_version(), '2', '>')) { return clone $this; } else { $xml_svg = $this; return $xml_svg; } }
function system_information() { global $mysqli, $server, $redis_server, $mqtt_server; $result = $mysqli->query("select now() as datetime, time_format(timediff(now(),convert_tz(now(),@@session.time_zone,'+00:00')),'%H:%i') AS timezone"); $db = $result->fetch_array(); @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', @exec('uname -a'), 5)); @exec('ps ax | grep feedwriter.php | grep -v grep', $feedwriterproc); return array('date' => date('Y-m-d H:i:s T'), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @exec('uptime'), 'http_server' => $_SERVER['SERVER_SOFTWARE'], 'php' => PHP_VERSION, 'zend' => function_exists('zend_version') ? zend_version() : 'n/a', 'db_server' => $server, 'db_ip' => gethostbyname($server), 'db_version' => 'MySQL ' . $mysqli->server_info, 'db_stat' => $mysqli->stat(), 'db_date' => $db['datetime'] . " (UTC " . $db['timezone'] . ")", 'redis_server' => $redis_server['host'] . ":" . $redis_server['port'], 'redis_ip' => gethostbyname($redis_server['host']), 'feedwriter' => !empty($feedwriterproc), 'mqtt_server' => $mqtt_server['host'], 'mqtt_ip' => gethostbyname($mqtt_server['host']), 'mqtt_port' => $mqtt_server['port'], 'hostbyaddress' => gethostbyaddr(gethostbyname($host)), 'http_proto' => $_SERVER['SERVER_PROTOCOL'], 'http_mode' => $_SERVER['GATEWAY_INTERFACE'], 'http_port' => $_SERVER['SERVER_PORT'], 'php_modules' => get_loaded_extensions()); }
public static function getInfo() { @($system = php_uname('s')); @($kernel = @php_uname('r') . ' ' . @php_uname('v') . ' ' . @php_uname('m')); @($host = @php_uname('n')); @($ip = @gethostbyname($host)); @($hostbyip = @gethostbyaddr($ip)); return array('version' => About::getGitBranch(), 'date' => date('Y-m-d H:i:s T'), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => $ip, 'uptime' => @exec('uptime'), 'http_server' => About::getServerVar('SERVER_SOFTWARE'), 'php' => PHP_VERSION, 'php_modules' => get_loaded_extensions(), 'zend' => function_exists('zend_version') ? zend_version() : 'n/a', 'hostbyaddress' => $hostbyip, 'http_proto' => About::getServerVar('SERVER_PROTOCOL'), 'http_mode' => About::getServerVar('GATEWAY_INTERFACE'), 'http_port' => About::getServerVar('SERVER_PORT')); }
/** * Main * * @param string[] args * @return int */ public static function main(array $args) { Console::writeLinef('XP %s { PHP %s & ZE %s } @ %s', xp::version(), phpversion(), zend_version(), php_uname()); Console::writeLine('Copyright (c) 2001-2013 the XP group'); foreach (ClassLoader::getLoaders() as $delegate) { Console::writeLine($delegate->toString()); } return 1; }
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(); }
function randomBytes($length = 16, $secure = true, $raw = true, $startEntropy = "", &$rounds = 0, &$drop = 0) { static $lastRandom = ""; $output = ""; $length = abs((int) $length); $secureValue = ""; $rounds = 0; $drop = 0; while (!isset($output[$length - 1])) { //some entropy, but works ^^ $weakEntropy = array(is_array($startEntropy) ? implode($startEntropy) : $startEntropy, serialize(stat(__FILE__)), __DIR__, PHP_OS, microtime(), (string) lcg_value(), (string) PHP_MAXPATHLEN, PHP_SAPI, (string) PHP_INT_MAX . "." . PHP_INT_SIZE, serialize($_SERVER), serialize(get_defined_constants()), get_current_user(), serialize(ini_get_all()), (string) memory_get_usage() . "." . memory_get_peak_usage(), php_uname(), phpversion(), extension_loaded("gmp") ? gmp_strval(gmp_random(4)) : microtime(), zend_version(), (string) getmypid(), (string) getmyuid(), (string) mt_rand(), (string) getmyinode(), (string) getmygid(), (string) rand(), function_exists("zend_thread_id") ? (string) zend_thread_id() : microtime(), var_export(@get_browser(), true), function_exists("getrusage") ? @implode(getrusage()) : microtime(), function_exists("sys_getloadavg") ? @implode(sys_getloadavg()) : microtime(), serialize(get_loaded_extensions()), sys_get_temp_dir(), (string) disk_free_space("."), (string) disk_total_space("."), uniqid(microtime(), true), file_exists("/proc/cpuinfo") ? file_get_contents("/proc/cpuinfo") : microtime()); shuffle($weakEntropy); $value = hash("sha512", implode($weakEntropy), true); $lastRandom .= $value; foreach ($weakEntropy as $k => $c) { //mixing entropy values with XOR and hash randomness extractor $value ^= hash("sha256", $c . microtime() . $k, true) . hash("sha256", mt_rand() . microtime() . $k . $c, true); $value ^= hash("sha512", (string) lcg_value() . $c . microtime() . $k, true); } unset($weakEntropy); if ($secure === true) { $strongEntropyValues = array(is_array($startEntropy) ? hash("sha512", $startEntropy[($rounds + $drop) % count($startEntropy)], true) : hash("sha512", $startEntropy, true), file_exists("/dev/urandom") ? fread(fopen("/dev/urandom", "rb"), 64) : str_repeat("", 64), (function_exists("openssl_random_pseudo_bytes") and version_compare(PHP_VERSION, "5.3.4", ">=")) ? openssl_random_pseudo_bytes(64) : str_repeat("", 64), function_exists("mcrypt_create_iv") ? mcrypt_create_iv(64, MCRYPT_DEV_URANDOM) : str_repeat("", 64), $value); $strongEntropy = array_pop($strongEntropyValues); foreach ($strongEntropyValues as $value) { $strongEntropy = $strongEntropy ^ $value; } $value = ""; //Von Neumann randomness extractor, increases entropy $bitcnt = 0; for ($j = 0; $j < 64; ++$j) { $a = ord($strongEntropy[$j]); for ($i = 0; $i < 8; $i += 2) { $b = ($a & 1 << $i) > 0 ? 1 : 0; if ($b != (($a & 1 << $i + 1) > 0 ? 1 : 0)) { $secureValue |= $b << $bitcnt; if ($bitcnt == 7) { $value .= chr($secureValue); $secureValue = 0; $bitcnt = 0; } else { ++$bitcnt; } ++$drop; } else { $drop += 2; } } } } $output .= substr($value, 0, min($length - strlen($output), $length)); unset($value); ++$rounds; } $lastRandom = hash("sha512", $lastRandom, true); return $raw === false ? bin2hex($output) : $output; }
public function process() { $res = $this->request->server; $res['phpversion'] = phpversion(); $res['zend_version'] = zend_version(); $res['sapi'] = php_sapi_name(); $res['handlers'] = Hm_Handler_Modules::dump(); $res['output'] = Hm_Output_Modules::dump(); $this->out('server_info', $res); }
public static function execute() { $result = array(); $db_time = OSCOM::callDB('Admin\\ServerInfo\\GetTime'); $db_uptime = OSCOM::callDB('Admin\\ServerInfo\\GetUptime'); $db_version = OSCOM::callDB('Admin\\ServerInfo\\GetVersion'); @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', @exec('uname -a'), 5)); $data = array(array('key' => 'date', 'title' => OSCOM::getDef('field_server_date'), 'value' => DateTime::getShort(null, true)), array('key' => 'system', 'title' => OSCOM::getDef('field_server_operating_system'), 'value' => $system . ' ' . $kernel), array('key' => 'host', 'title' => OSCOM::getDef('field_server_host'), 'value' => $host . ' (' . gethostbyname($host) . ')'), array('key' => 'uptime', 'title' => OSCOM::getDef('field_server_up_time'), 'value' => @exec('uptime')), array('key' => 'http_server', 'title' => OSCOM::getDef('field_http_server'), 'value' => $_SERVER['SERVER_SOFTWARE']), array('key' => 'php', 'title' => OSCOM::getDef('field_php_version'), 'value' => 'PHP v' . PHP_VERSION . ' / Zend v' . zend_version()), array('key' => 'db_server', 'title' => OSCOM::getDef('field_database_host'), 'value' => DB_SERVER . ' (' . gethostbyname(DB_SERVER) . ')'), array('key' => 'db_version', 'title' => OSCOM::getDef('field_database_version'), 'value' => $db_version), array('key' => 'db_date', 'title' => OSCOM::getDef('field_database_date'), 'value' => DateTime::getShort($db_time, true)), array('key' => 'db_uptime', 'title' => OSCOM::getDef('field_database_up_time'), 'value' => $db_uptime)); $result['entries'] = $data; $result['total'] = count($data); return $result; }
function index() { // $this->output->cache(1440); // 캐시 되고 있는동안 common 작동 안함 // 계정의 사용량을 구함 $account_space = `du -sb`; $account_space = substr($account_space, 0, strlen($account_space) - 3); // DATA 폴더의 용량을 구함 $data_path = DATA_PATH; $data_space = `du -sb {$data_path}`; $data_space = substr($data_space, 0, strlen($data_space) - 8); // GD 버젼 $gd_support = extension_loaded('gd'); if ($gd_support) { $gd_info = gd_info(); $gd_version = $gd_info['GD Version']; } else { $gd_version = 'GD가 설치되지 않음'; } // MySQL 버전 $query = $this->db->query('select version() as ver'); $row = $query->row_array(); $db_version = $row['ver']; /* // http://kr2.php.net/manual/kr/function.mysql-stat.php $mysql_stat = explode(' ', mysql_stat()); $a = explode(':', $mysql_stat[0]); $db_date = $a[0] . ': '; $days = floor($a[1]/86400); if ($days) $db_date .= $days . '일 '; $hours = (floor($a[1]/3600)%24); if ($hours) $db_date .= $hours . '시간 '; $min = (floor($a[1]/60)%60); if ($min) $db_date .= $min . '분'; $t = explode(':', $mysql_stat[2]); $db_status = $mysql_stat[1].'<br/>'; $db_status .= $t[0].': '.number_format($t[1]).'<br/>'; $db_status .= $mysql_stat[3].'<br/>'; $db_status .= $mysql_stat[4].'<br/>'; $db_status .= $mysql_stat[5].'<br/>'; $db_status .= $mysql_stat[6].'<br/>'; $db_status .= $mysql_stat[7].'<br/>'; */ $head = array('title' => '관리자 페이지'); $data = array('os_version' => php_uname('r'), 'ip_addr' => gethostbyname(trim(`hostname`)), 'account_space' => byte_format($account_space), 'data_space' => byte_format($data_space), 'code_space' => byte_format($account_space - $data_space), 'php_version' => phpversion(), 'zend_version' => zend_version(), 'gd_version' => $gd_version, 'max_filesize' => get_cfg_var('upload_max_filesize'), 'db_version' => $db_version, 'db_date' => '', 'db_status' => ''); widget::run('head', $head); $this->load->view(ADM_F . '/main', $data); widget::run('tail'); }
/** * Computes a reversed diff. * * Example: * <code> * $diff = new Text_Diff($lines1, $lines2); * $rev = $diff->reverse(); * </code> * * @return Text_Diff A Diff object representing the inverse of the * original diff. Note that we purposely don't return a * reference here, since this essentially is a clone() * method. */ function reverse() { if (version_compare(zend_version(), '2', '>')) { $rev = clone $this; } else { $rev = $this; } $rev->_edits = array(); foreach ($this->_edits as $edit) { $rev->_edits[] = $edit->reverse(); } return $rev; }
/** * Retrieve web server and database server information * * @access public */ public static function getAll() { $OSCOM_Database = Registry::get('Database'); $result = array(); $Qdate = $OSCOM_Database->query('select now() as datetime'); $Quptime = $OSCOM_Database->query('show status like "Uptime"'); @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', @exec('uname -a'), 5)); $db_uptime = intval($Quptime->valueInt('Value') / 3600) . ':' . str_pad(intval($Quptime->valueInt('Value') / 60 % 60), 2, '0', STR_PAD_LEFT); $data = array(array('key' => 'date', 'title' => OSCOM::getDef('field_server_date'), 'value' => DateTime::getShort(null, true)), array('key' => 'system', 'title' => OSCOM::getDef('field_server_operating_system'), 'value' => $system . ' ' . $kernel), array('key' => 'host', 'title' => OSCOM::getDef('field_server_host'), 'value' => $host . ' (' . gethostbyname($host) . ')'), array('key' => 'uptime', 'title' => OSCOM::getDef('field_server_up_time'), 'value' => @exec('uptime')), array('key' => 'http_server', 'title' => OSCOM::getDef('field_http_server'), 'value' => $_SERVER['SERVER_SOFTWARE']), array('key' => 'php', 'title' => OSCOM::getDef('field_php_version'), 'value' => 'PHP v' . PHP_VERSION . ' / Zend v' . zend_version()), array('key' => 'db_server', 'title' => OSCOM::getDef('field_database_host'), 'value' => DB_SERVER . ' (' . gethostbyname(DB_SERVER) . ')'), array('key' => 'db_version', 'title' => OSCOM::getDef('field_database_version'), 'value' => 'MySQL v' . $OSCOM_Database->getServerVersion()), array('key' => 'db_date', 'title' => OSCOM::getDef('field_database_date'), 'value' => DateTime::getShort($Qdate->value('datetime'), true)), array('key' => 'db_uptime', 'title' => OSCOM::getDef('field_database_up_time'), 'value' => $db_uptime)); $result['entries'] = $data; $result['total'] = count($data); return $result; }
/** * 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; }
/** * Computes a reversed diff. * * Example: * <code> * $diff = new diff($lines1, $lines2); * $rev = $diff->reverse(); * </code> * * @return diff A Diff object representing the inverse of the original diff. * Note that we purposely don't return a reference here, since * this essentially is a clone() method. */ function reverse() { if (version_compare(zend_version(), '2', '>')) { $rev = clone $this; } else { $rev = $this; } $rev->_edits = array(); for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; $rev->_edits[] = $edit->reverse(); } return $rev; }
public static function execute() { $result = array(); $db_time = OSCOM::callDB('Admin\\ServerInfo\\GetTime'); $db_uptime = OSCOM::callDB('Admin\\ServerInfo\\GetUptime'); $db_version = OSCOM::callDB('Admin\\ServerInfo\\GetVersion'); $uptime = '---'; if (!in_array('exec', explode(',', str_replace(' ', '', ini_get('disable_functions'))))) { $uptime = @exec('uptime'); } $data = array(array('key' => 'date', 'title' => OSCOM::getDef('field_server_date'), 'value' => DateTime::getShort(null, true)), array('key' => 'system', 'title' => OSCOM::getDef('field_server_operating_system'), 'value' => php_uname('s') . ' ' . php_uname('r')), array('key' => 'host', 'title' => OSCOM::getDef('field_server_host'), 'value' => php_uname('n') . ' (' . gethostbyname(php_uname('n')) . ')'), array('key' => 'uptime', 'title' => OSCOM::getDef('field_server_up_time'), 'value' => $uptime), array('key' => 'http_server', 'title' => OSCOM::getDef('field_http_server'), 'value' => $_SERVER['SERVER_SOFTWARE']), array('key' => 'php', 'title' => OSCOM::getDef('field_php_version'), 'value' => 'PHP v' . PHP_VERSION . ' / Zend v' . zend_version()), array('key' => 'db_server', 'title' => OSCOM::getDef('field_database_host'), 'value' => OSCOM::getConfig('db_server') . ' (' . gethostbyname(OSCOM::getConfig('db_server')) . ')'), array('key' => 'db_version', 'title' => OSCOM::getDef('field_database_version'), 'value' => $db_version), array('key' => 'db_date', 'title' => OSCOM::getDef('field_database_date'), 'value' => DateTime::getShort($db_time, true)), array('key' => 'db_uptime', 'title' => OSCOM::getDef('field_database_up_time'), 'value' => $db_uptime)); $result['entries'] = $data; $result['total'] = count($data); return $result; }
/** * 后台默认页面 */ public function def() { $phpInfo = array(); $phpInfo['version'] = PHP_VERSION; $phpInfo['system'] = PHP_OS; $phpInfo['max_time'] = ini_get("max_execution_time") . " 秒"; $phpInfo['max_upload'] = ini_get("file_uploads") ? ini_get("upload_max_filesize") : "Disabled"; if (function_exists("gd_info")) { $gd = gd_info(); $phpInfo['gd'] = $gd["GD Version"]; } else { $phpInfo['gd'] = "<span style='color:red'>Unknow</span>"; } $phpInfo['now_time'] = date("Y-m-d H:i:s"); $phpInfo['memory'] = get_cfg_var("memory_limit") ? get_cfg_var("memory_limit") : "无"; $phpInfo['server'] = $_SERVER['SERVER_SOFTWARE']; $phpInfo['zend'] = zend_version(); $this->view->assign('phpInfo', $phpInfo); $this->view->set_tpl('index/index_default'); }
/** * Main * * @param string[] $args * @return int */ public static function main(array $args) { if (empty($args)) { Console::writeLinef('XP %s { PHP %s & ZE %s } @ %s', \xp::version(), phpversion(), zend_version(), php_uname()); Console::writeLine('Copyright (c) 2001-2016 the XP group'); foreach (\lang\ClassLoader::getLoaders() as $delegate) { Console::writeLine($delegate->toString()); } return 1; } else { foreach ($args as $arg) { $method = $arg . 'Version'; if (is_callable(['self', $method])) { Console::writeLine(self::$method()); } else { Console::$err->writeLinef('Unkown version argument `%s\'', $arg); } } return 0; } }
function system_information() { global $mysqli, $server, $redis_server, $mqtt_server; $result = $mysqli->query("select now() as datetime, time_format(timediff(now(),convert_tz(now(),@@session.time_zone,'+00:00')),'%H:%i') AS timezone"); $db = $result->fetch_array(); @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', php_uname('a'), 5)); @exec('ps ax | grep feedwriter.php | grep -v grep', $feedwriterproc); if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $meminfo = array(); } else { //Only do this on NON-Windows Platforms $data = explode("\n", file_get_contents("/proc/meminfo")); $meminfo = array(); foreach ($data as $line) { if (strpos($line, ':') !== false) { list($key, $val) = explode(":", $line); $meminfo[$key] = 1024 * floatval(trim(str_replace(' kB', '', $val))); } } } return array('date' => date('Y-m-d H:i:s T'), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @exec('uptime'), 'http_server' => $_SERVER['SERVER_SOFTWARE'], 'php' => PHP_VERSION, 'zend' => function_exists('zend_version') ? zend_version() : 'n/a', 'db_server' => $server, 'db_ip' => gethostbyname($server), 'db_version' => 'MySQL ' . $mysqli->server_info, 'db_stat' => $mysqli->stat(), 'db_date' => $db['datetime'] . " (UTC " . $db['timezone'] . ")", 'redis_server' => $redis_server['host'] . ":" . $redis_server['port'], 'redis_ip' => gethostbyname($redis_server['host']), 'feedwriter' => !empty($feedwriterproc), 'mqtt_server' => $mqtt_server['host'], 'mqtt_ip' => gethostbyname($mqtt_server['host']), 'mqtt_port' => $mqtt_server['port'], 'hostbyaddress' => @gethostbyaddr(gethostbyname($host)), 'http_proto' => $_SERVER['SERVER_PROTOCOL'], 'http_mode' => $_SERVER['GATEWAY_INTERFACE'], 'http_port' => $_SERVER['SERVER_PORT'], 'php_modules' => get_loaded_extensions(), 'mem_info' => $meminfo, 'partitions' => disk_list()); }
/** * @throws \DebugBar\DebugBarException */ public function boot() { $debugbar = $this->app['debugbar']; if ($debugbar instanceof LaravelDebugbar && $debugbar->isEnabled()) { /** * CodeCollector获取代码提交和版本信息 */ $codeCollector = new MessagesCollector('code'); $codeCollector->addMessage('enviroment:' . $this->app->environment()); //package "sebastian/version": "1.*" required if (class_exists(Version::class)) { $version = static::appVersion($this->app['config']->get('app.version')); $codeCollector->addMessage('base path:' . base_path()); $codeCollector->addMessage("version:\n" . $version); } if (class_exists(Repository::class)) { $repository = new \Gitonomy\Git\Repository(base_path()); $head = $repository->getHeadCommit(); $log = $head->getLog(null, null, 5); $commits = array(); foreach ($log->getCommits() as $commit) { $commits[] = $this->commitMessageArray($commit); } $codeCollector->addMessage("current commit:\n" . $head->getRevision(), 'HEAD'); $codeCollector->addMessage($commits, 'git-log'); } $debugbar->addCollector($codeCollector); /** * ServerCollector获取服务器信息 */ $serverCollector = new MessagesCollector('sever'); $serverCollector->addMessage(php_uname(), 'uname'); $serverCollector->addMessage("sapi_name:" . php_sapi_name(), 'phpinfo'); $serverCollector->addMessage("PHP version:" . PHP_VERSION, 'phpinfo'); $serverCollector->addMessage("Zend_Version:" . zend_version(), 'phpinfo'); $serverCollector->addMessage(sys_getloadavg(), 'load'); $debugbar->addCollector($serverCollector); } }
function tep_get_system_information() { global $HTTP_SERVER_VARS; $db_query = tep_db_query("select now() as datetime"); $db = tep_db_fetch_array($db_query); @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', @exec('uname -a'), 5)); $data = array(); $data['oscommerce'] = array('version' => tep_get_version()); $data['system'] = array('date' => date('Y-m-d H:i:s O T'), 'os' => PHP_OS, 'kernel' => $kernel, 'uptime' => @exec('uptime'), 'http_server' => $HTTP_SERVER_VARS['SERVER_SOFTWARE']); $data['mysql'] = array('version' => tep_db_get_server_info(), 'date' => $db['datetime']); $data['php'] = array('version' => PHP_VERSION, 'zend' => zend_version(), 'sapi' => PHP_SAPI, 'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '', 'safe_mode' => (int) @ini_get('safe_mode'), 'open_basedir' => (int) @ini_get('open_basedir'), 'memory_limit' => @ini_get('memory_limit'), 'error_reporting' => error_reporting(), 'display_errors' => (int) @ini_get('display_errors'), 'allow_url_fopen' => (int) @ini_get('allow_url_fopen'), 'allow_url_include' => (int) @ini_get('allow_url_include'), 'file_uploads' => (int) @ini_get('file_uploads'), 'upload_max_filesize' => @ini_get('upload_max_filesize'), 'post_max_size' => @ini_get('post_max_size'), 'disable_functions' => @ini_get('disable_functions'), 'disable_classes' => @ini_get('disable_classes'), 'enable_dl' => (int) @ini_get('enable_dl'), 'magic_quotes_gpc' => (int) @ini_get('magic_quotes_gpc'), 'register_globals' => (int) @ini_get('register_globals'), 'filter.default' => @ini_get('filter.default'), 'zend.ze1_compatibility_mode' => (int) @ini_get('zend.ze1_compatibility_mode'), 'unicode.semantics' => (int) @ini_get('unicode.semantics'), 'zend_thread_safty' => (int) function_exists('zend_thread_id'), 'extensions' => get_loaded_extensions()); return $data; }
--TEST-- ZE2 __set() and __get() --SKIPIF-- <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) { die('skip ZendEngine 2 needed'); } ?> --FILE-- <?php class setter { public $n; public $x = array('a' => 1, 'b' => 2, 'c' => 3); function __get($nm) { echo "Getting [{$nm}]\n"; if (isset($this->x[$nm])) { $r = $this->x[$nm]; echo "Returning: {$r}\n"; return $r; } else { echo "Nothing!\n"; } } function __set($nm, $val) { echo "Setting [{$nm}] to {$val}\n"; if (isset($this->x[$nm])) { $this->x[$nm] = $val; echo "OK!\n";
/** * Administration panel - PHP Infos * * @package Cotonti * @copyright (c) Cotonti Team * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt */ defined('COT_CODE') && defined('COT_ADMIN') or die('Wrong URL.'); list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('admin', 'a'); cot_block($usr['auth_read']); $t = new XTemplate(cot_tplfile('admin.infos', 'core')); $adminpath[] = array(cot_url('admin', 'm=other'), $L['Other']); $adminpath[] = array(cot_url('admin', 'm=infos'), $L['adm_infos']); $adminhelp = $L['adm_help_versions']; $adminsubtitle = $L['adm_infos']; /* === Hook === */ foreach (cot_getextplugins('admin.infos.first') as $pl) { include $pl; } /* ===== */ @error_reporting(0); $t->assign(array('ADMIN_INFOS_PHPVER' => function_exists('phpversion') ? phpversion() : $L['adm_help_config'], 'ADMIN_INFOS_ZENDVER' => function_exists('zend_version') ? zend_version() : $L['adm_help_config'], 'ADMIN_INFOS_INTERFACE' => function_exists('php_sapi_name') ? php_sapi_name() : $L['adm_help_config'], 'ADMIN_INFOS_CACHEDRIVERS' => is_array($cot_cache_drivers) ? implode(', ', $cot_cache_drivers) : '', 'ADMIN_INFOS_OS' => function_exists('php_uname') ? php_uname() : $L['adm_help_config'], 'ADMIN_INFOS_DATE' => cot_date('datetime_medium', $sys['now'], false), 'ADMIN_INFOS_GMDATE' => gmdate('Y-m-d H:i'), 'ADMIN_INFOS_GMTTIME' => $usr['gmttime'], 'ADMIN_INFOS_USRTIME' => $usr['localtime'], 'ADMIN_INFOS_TIMETEXT' => $usr['timetext'])); /* === Hook === */ foreach (cot_getextplugins('admin.infos.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $adminmain = $t->text('MAIN'); @error_reporting(7);
function cmdHelp($command) { global $progname, $all_commands, $config; if ($command == "options") { return "Options:\n" . " -v increase verbosity level (default 1)\n" . " -q be quiet, decrease verbosity level\n" . " -c file find user configuration in `file'\n" . " -C file find system configuration in `file'\n" . " -d foo=bar set user config variable `foo' to `bar'\n" . " -D foo=bar set system config variable `foo' to `bar'\n" . " -G start in graphical (Gtk) mode\n" . " -s store user configuration\n" . " -S store system configuration\n" . " -u foo unset `foo' in the user configuration\n" . " -h, -? display help/usage (this message)\n" . " -V version information\n"; } elseif ($command == "shortcuts") { $sc = PEAR_Command::getShortcuts(); $ret = "Shortcuts:\n"; foreach ($sc as $s => $c) { $ret .= sprintf(" %-8s %s\n", $s, $c); } return $ret; } elseif ($command == "version") { return "PEAR Version: " . $GLOBALS['pear_package_version'] . "\nPHP Version: " . phpversion() . "\nZend Engine Version: " . zend_version() . "\nRunning on: " . php_uname(); } elseif ($help = PEAR_Command::getHelp($command)) { if (is_string($help)) { return "{$progname} {$command} [options] {$help}\n"; } if ($help[1] === null) { return "{$progname} {$command} {$help['0']}"; } else { return "{$progname} {$command} [options] {$help['0']}\n{$help['1']}"; } } return "Command '{$command}' is not valid, try 'pear help'"; }
</td> <td>哈稀计算:</td> <td><?php echo isfun("mhash_count"); ?> </td> </tr> </table> <!--第三方组件信息--> <table width="100%" cellpadding="3" cellspacing="0" align="center"> <tr><th colspan="4" >第三方组件</th></tr> <tr> <td width="32%">Zend版本</td> <td width="18%"><?php $zend_version = zend_version(); if (empty($zend_version)) { echo '<font color=red>×</font>'; } else { echo $zend_version; } ?> </td> <td width="32%"> <?php $PHP_VERSION = PHP_VERSION; $PHP_VERSION = substr($PHP_VERSION, 2, 1); if ($PHP_VERSION > 2) { echo "ZendGuardLoader[启用]"; } else { echo "Zend Optimizer";
*/ /**#@+ * ERROR constants */ define('PEAR_ERROR_RETURN', 1); define('PEAR_ERROR_PRINT', 2); define('PEAR_ERROR_TRIGGER', 4); define('PEAR_ERROR_DIE', 8); define('PEAR_ERROR_CALLBACK', 16); /** * WARNING: obsolete * @deprecated */ define('PEAR_ERROR_EXCEPTION', 32); /**#@-*/ define('PEAR_ZE2', function_exists('version_compare') && version_compare(zend_version(), "2-dev", "ge")); if (substr(PHP_OS, 0, 3) == 'WIN') { define('OS_WINDOWS', true); define('OS_UNIX', false); define('PEAR_OS', 'Windows'); } else { define('OS_WINDOWS', false); define('OS_UNIX', true); define('PEAR_OS', 'Unix'); // blatant assumption } // instant backwards compatibility if (!defined('PATH_SEPARATOR')) { if (OS_WINDOWS) { define('PATH_SEPARATOR', ';'); } else {
/** * Analyze the source code of the given PHP file * * @param string Filename of the PHP file * @return mixed * @access private */ function _analyzeSourceCode($file) { if (!function_exists("token_get_all")) { return false; } if (!defined('T_DOC_COMMENT')) { define('T_DOC_COMMENT', T_COMMENT); } if (!defined('T_INTERFACE')) { define('T_INTERFACE', -1); } if (!defined('T_IMPLEMENTS')) { define('T_IMPLEMENTS', -1); } if (!($fp = @fopen($file, "r"))) { return false; } fclose($fp); $contents = file_get_contents($file); $tokens = token_get_all($contents); /* for ($i = 0; $i < sizeof($tokens); $i++) { @list($token, $data) = $tokens[$i]; if (is_string($token)) { var_dump($token); } else { print token_name($token) . ' '; var_dump(rtrim($data)); } } */ $look_for = 0; $paren_level = 0; $bracket_level = 0; $brace_level = 0; $lastphpdoc = ''; $current_class = ''; $current_interface = ''; $current_class_level = -1; $current_function = ''; $current_function_level = -1; $declared_classes = array(); $declared_interfaces = array(); $declared_functions = array(); $declared_methods = array(); $used_classes = array(); $used_functions = array(); $extends = array(); $implements = array(); $nodeps = array(); $inquote = false; $interface = false; for ($i = 0; $i < sizeof($tokens); $i++) { if (is_array($tokens[$i])) { list($token, $data) = $tokens[$i]; } else { $token = $tokens[$i]; $data = ''; } if ($inquote) { if ($token != '"' && $token != T_END_HEREDOC) { continue; } else { $inquote = false; continue; } } switch ($token) { case T_WHITESPACE: continue; case ';': if ($interface) { $current_function = ''; $current_function_level = -1; } break; case '"': case T_START_HEREDOC: $inquote = true; break; case T_CURLY_OPEN: case T_DOLLAR_OPEN_CURLY_BRACES: case '{': $brace_level++; continue 2; case '}': $brace_level--; if ($current_class_level == $brace_level) { $current_class = ''; $current_class_level = -1; } if ($current_function_level == $brace_level) { $current_function = ''; $current_function_level = -1; } continue 2; case '[': $bracket_level++; continue 2; case ']': $bracket_level--; continue 2; case '(': $paren_level++; continue 2; case ')': $paren_level--; continue 2; case T_INTERFACE: $interface = true; case T_CLASS: if ($current_class_level != -1 || $current_function_level != -1) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE, array('file' => $file)); return false; } case T_FUNCTION: case T_NEW: case T_EXTENDS: case T_IMPLEMENTS: $look_for = $token; continue 2; case T_STRING: if (version_compare(zend_version(), '2.0', '<')) { if (in_array(strtolower($data), array('public', 'private', 'protected', 'abstract', 'interface', 'implements', 'throw'))) { $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_PHP5, array($file)); } } if ($look_for == T_CLASS) { $current_class = $data; $current_class_level = $brace_level; $declared_classes[] = $current_class; } elseif ($look_for == T_INTERFACE) { $current_interface = $data; $current_class_level = $brace_level; $declared_interfaces[] = $current_interface; } elseif ($look_for == T_IMPLEMENTS) { $implements[$current_class] = $data; } elseif ($look_for == T_EXTENDS) { $extends[$current_class] = $data; } elseif ($look_for == T_FUNCTION) { if ($current_class) { $current_function = "{$current_class}::{$data}"; $declared_methods[$current_class][] = $data; } elseif ($current_interface) { $current_function = "{$current_interface}::{$data}"; $declared_methods[$current_interface][] = $data; } else { $current_function = $data; $declared_functions[] = $current_function; } $current_function_level = $brace_level; $m = array(); } elseif ($look_for == T_NEW) { $used_classes[$data] = true; } $look_for = 0; continue 2; case T_VARIABLE: $look_for = 0; continue 2; case T_DOC_COMMENT: case T_COMMENT: if (preg_match('!^/\\*\\*\\s!', $data)) { $lastphpdoc = $data; if (preg_match_all('/@nodep\\s+(\\S+)/', $lastphpdoc, $m)) { $nodeps = array_merge($nodeps, $m[1]); } } continue 2; case T_DOUBLE_COLON: if (!($tokens[$i - 1][0] == T_WHITESPACE || $tokens[$i - 1][0] == T_STRING)) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE, array('file' => $file)); return false; } $class = $tokens[$i - 1][1]; if (strtolower($class) != 'parent') { $used_classes[$class] = true; } continue 2; } } return array("source_file" => $file, "declared_classes" => $declared_classes, "declared_interfaces" => $declared_interfaces, "declared_methods" => $declared_methods, "declared_functions" => $declared_functions, "used_classes" => array_diff(array_keys($used_classes), $nodeps), "inheritance" => $extends, "implements" => $implements); }