Beispiel #1
0
 /**
  * Finds the current http server.
  * @return string
  * @static
  * @final
  */
 public static final function Server()
 {
     if (Server::PHPInterface() == 'cli' || Server::PerlRegex() === false) {
         return false;
     }
     $server = is_null($_SERVER["SERVER_SOFTWARE"]) || @strlen($_SERVER["SERVER_SOFTWARE"]) < 1 ? $_SERVER["SERVER_SIGNATURE"] : $_SERVER["SERVER_SOFTWARE"];
     if (@preg_match("#^([a-zA-Z-]+).*?([\\d]+\\.[\\d]+(\\.[\\d]+)?)#i", trim($server), $arServer)) {
         return "{$arServer[1]} {$arServer[2]}";
     } else {
         return false;
     }
 }
Beispiel #2
0
 /**
  * The class constructor initializes variables.
  * @param string $ip
  * @final
  */
 public final function __construct($ip = '')
 {
     if (empty($ip) && Http::RealIP()) {
         $ip = Http::RealIP();
     }
     if (empty($ip) === false || Server::PerlRegex() != false || @preg_match(self::REGX, trim($ip)) != false || Server::Json() != false) {
         $geo = @json_decode(@file_get_contents("http://api.2ip.com.ua/geo.json?ip={$ip}"), true);
         if (empty($geo) == false) {
             $this->data = array_merge($this->data, $geo);
         }
         $provider = @json_decode(@file_get_contents("http://api.2ip.com.ua/provider.json?ip={$ip}"), true);
         if (empty($provider) == false) {
             $this->data = array_merge($this->data, $provider);
         }
     }
 }
Beispiel #3
0
 /**
  * Search data platform Magento.
  * @return boolean
  * @final
  */
 private final function Magento()
 {
     global $docroot;
     $root = $docroot && empty($docroot) === false ? $docroot : $_SERVER['DOCUMENT_ROOT'];
     if (file_exists("{$root}/app/Mage.php")) {
         $file = file_get_contents("{$root}/app/Mage.php");
         if (stripos($file, 'Magento') !== false) {
             $this->name = 'Magento';
             $file = str_replace("\n", "", $file);
             if (Server::PerlRegex() && preg_match("/.*getVersionInfo\\(\\)\\s+\\{(.*\\s+\\)\\;)\\s+\\}.*/", $file, $regx)) {
                 $v = @eval($regx[1]);
                 if ($v) {
                     $this->version = trim("{$v['major']}.{$v['minor']}.{$v['revision']}" . ($v['patch'] != '' ? ".{$v['patch']}" : "") . "-{$v['stability']}{$v['number']}", '.-');
                 }
             }
             if (file_exists("{$root}/app/etc/local.xml") && Server::SimpleXML()) {
                 $config = file_get_contents("{$root}/app/etc/local.xml");
                 $config = str_replace("<![CDATA[", "", $config);
                 $config = str_replace("]]>", "", $config);
                 $config = simplexml_load_string($config);
                 if (isset($config->global->resources->default_setup->connection)) {
                     $config = $config->global->resources->default_setup->connection;
                     $this->db['driver'] = 'mysql';
                 }
                 if (isset($config->host)) {
                     $this->db['host'] = (string) $config->host;
                 }
                 if (isset($config->username)) {
                     $this->db['user'] = (string) $config->username;
                 }
                 if (isset($config->password)) {
                     $this->db['password'] = (string) $config->password;
                 }
                 if (isset($config->dbname)) {
                     $this->db['dbname'] = (string) $config->dbname;
                 }
             }
             return true;
         }
     }
     return false;
 }
Beispiel #4
0
$b->add('Requirejs', JavaScript::Requirejs(), null, null, 'Finds Requirejs.');
$b->add('Ember', JavaScript::Ember(), null, null, 'Finds Ember.');
$b->addHeader('Main.');
$b->add('PHP Interface', Server::PHPInterface(), null, null, 'Finds interface php.');
$b->add('PHP Version', Server::PHPVersion(), null, null, 'Finds version of php.');
$b->add('PHP Accelerator', Server::PHPAccelerator(), null, null, 'Finds accelerator php.');
$b->add('Safe Mode', Server::SafeMode(), null, null, 'Checking Safe Mode.');
$b->add('Short Open Tag', Server::ShortOpenTag(), null, null, 'Checking Short Open Tag.');
$b->add('Shared Memory', Server::SharedMemory(), null, null, 'Checking Shared Memory.');
$b->add('Posix', Server::Posix(), null, null, 'Checking posix.');
$b->add('Pcntl', Server::Pcntl(), null, null, 'Checking pcntl.');
$b->add('Email Sending', Server::EmailSending(), null, null, 'Checking Messages.');
$b->add('Mcrypt', Server::Mcrypt(), null, null, 'Checking mcrypt.');
$b->add('Sockets', Server::Sockets(), null, null, 'Checking sockets.');
$b->add('PHP Regex', Server::PHPRegex(), null, null, 'Checking php regex.');
$b->add('Perl Regex', Server::PerlRegex(), null, null, 'Checking perl regex.');
$b->add('Zlib', Server::Zlib(), null, null, 'Checking zlib.');
$b->add('GDlib', Server::GDlib(), null, null, 'Checking gdlib.');
$b->add('Free Type', Server::FreeType(), null, null, 'Checking free type.');
$b->add('Mbstring', Server::Mbstring(), null, null, 'Checking mbstring.');
$b->add('PDO', Server::PDO(), null, null, 'Checking PDO');
$b->add('SimpleXML', Server::SimpleXML(), null, null, 'Checking SimpleXML');
$b->add('DOMDocument', Server::DOMDocument(), null, null, 'Checking DOMDocument');
$b->add('Curl', Server::Curl(), null, null, 'Checking Curl');
$b->add('Memory Limit', Server::MemoryLimit(), null, null, 'Checking Memory Limit');
$b->add('Max Execution Time', Server::MaxExecutionTime(), null, null, 'Checking Max Execution Time');
$b->add('Umask', Server::Umask(), null, null, 'Finds and returns the umask.');
$b->add('Post Max Size', Server::PostMaxSize(), null, null, 'Finds and returns the post max size.');
$b->add('Register Globals', Server::RegisterGlobals(), null, null, 'Checking Register Globals.');
$b->add('Display Errors', Server::DisplayErrors(), null, null, 'Checking Display Errors.');
$b->add('PHP File Uploads', Server::PHPFileUploads(), null, null, 'Checking PHPFileUploads.');
 /**
  * Searches for java scripts on the site
  * @param string $regxHtml
  * @param string $regxFind
  * @param string $regxVersion
  * @return array|boolean
  * @final
  */
 private static final function search($regxHtml, $regxFind, $regxVersion = null)
 {
     global $docroot;
     if (Server::PHPInterface() == 'cli' || Server::PerlRegex() == false) {
         return false;
     }
     $root = $docroot && empty($docroot) === false ? $docroot : $_SERVER['DOCUMENT_ROOT'];
     $content = false;
     $port = $_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : 80;
     $html = file_get_contents(($port == 443 ? 'https://' : 'http://') . Tools::getHost());
     if (preg_match($regxHtml, $html, $regx)) {
         if (stripos($regx[1], 'http') === false) {
             if (stripos($regx[1], '//') === false) {
                 $regx[1] = ($port == 443 ? 'https://' : 'http://') . Tools::getHost() . "/";
             } else {
                 $regx[1] = "http:{$regx[1]}";
             }
         }
         $content = file_get_contents($regx[1]);
     }
     if ($content == false && function_exists('exec')) {
         exec("find {$root} -name \"*.js\" -exec grep \"{$regxFind}\" {} \\; | head -n 1", $out);
         $content = reset($out);
     }
     if (is_null($regxVersion) == false && preg_match($regxVersion, substr($content, 0, 2000), $regx)) {
         return array('value' => true, 'version' => empty($regx[1]) == false ? reset(explode(' ', $regx[1])) : '');
     } elseif ($content !== false) {
         return true;
     }
     return false;
 }
Beispiel #6
0
 /**
  * Receives the clock frequency of the CPU.
  * @return array|boolean
  * @final
  */
 public static final function CPUClock()
 {
     if (function_exists('exec') == false || Server::PerlRegex() == false) {
         return false;
     }
     $result = false;
     exec('cat /proc/cpuinfo | grep -m 1 "model name"', $cpu);
     if (preg_match("/.*@\\s(.*)/", reset($cpu), $regx)) {
         $result = array('value' => preg_replace('/[^0-9\\.]/', '', $regx[1]), 'postfix' => preg_replace('/[^a-zA-Z]/', '', $regx[1]));
     }
     return $result;
 }