Exemplo n.º 1
0
 /**
  * Return PHP Extension
  * @name run
  * @return string
  */
 public function run() {
     $html = null;
     $tool = new Tools();
     if ($this->object = $tool->getPatternObject('mysql.connect.json')) {
         if (isset($this->object->db) && is_array($this->object->db)) {
             $format = $tool->getRowFormat();
             foreach ($this->object->db as $name) {
                 $version = $this->findByDataBase($name);
                 $status = 'FAIL';
                 $recommended = "(recommended: {$name})";
                 if (!empty($version)) {
                     $status = 'OK';
                     $recommended = null;
                 }
                 $html .= PHP_EOL . vsprintf($format, array(
                             $name,
                             $version,
                             $recommended,
                             $status
                 ));
             }
         }
     }
     echo $html;
 }
Exemplo n.º 2
0
 /**
  * Make PHP Directive
  * @name run
  * @return string
  */
 public function run() {
     $html = null;
     $tool = new Tools();
     if ($object = $tool->getPatternObject('php.directive.json')) {
         $format = $tool->getRowFormat();
         foreach ($object as $directive => $behavior) {
             $get = "-";
             $status = 'FAIL';
             $recommended = null;
             if (!empty($directive) && isset($behavior->value, $behavior->opration)) {
                 $get = ini_get($directive);
                 $value = isset($behavior->regex) ? $tool->renderRegEx($behavior->regex, $get) : $get;
                 $recommended = "(recommended: {$behavior->value})";
                 @eval("if(\"{$value}\" {$behavior->opration} \"{$behavior->value}\"){"
                                 . " \$status = 'OK';"
                                 . " \$recommended = null;"
                                 . " }");
             }
             $html .= PHP_EOL . vsprintf($format, array(
                         $directive,
                         $get,
                         $recommended,
                         $status
             ));
         }
     }
     echo $html;
 }
Exemplo n.º 3
0
 /**
  * Return PHP Extension
  * @name run
  * @return string
  */
 public function run() {
     $html = null;
     $tool = new Tools();
     if ($object = $tool->getPatternObject('php.extension.json')) {
         $format = $tool->getRowFormat();
         $extensions = get_loaded_extensions();
         foreach ($object as $extension => $behavior) {
             $version = '-';
             $status = 'FAIL';
             $recommended = null;
             if (!empty($extension) && in_array($extension, $extensions)) {
                 $recommended = isset($behavior->recommended) ? "(recommended: {$behavior->recommended})" : null;
                 $info = new ReflectionExtension($extension);
                 if ($extension = $info->getName()) {
                     $version = $info->getVersion();
                     if (!isset($behavior->regex) || preg_match($behavior->regex, $version)) {
                         $status = 'OK';
                         $recommended = null;
                     }
                     $version = !empty($version) ? $version : "<small class=\"text-hover\">{$behavior->recommended}</small>";
                 }
             }
             $html .= PHP_EOL . vsprintf($format, array(
                         $extension,
                         $version,
                         $recommended,
                         $status
             ));
         }
     }
     echo $html;
 }
Exemplo n.º 4
0
 /**
  * Return Apache Module
  * @name run
  * @return string
  */
 public function run() {
     $html = null;
     $tool = new Tools();
     if ($object = $tool->getPatternObject('apache.module.json')) {
         $format = $tool->getRowFormat();
         foreach ($object as $module => $behavior) {
             $info = '-';
             $status = 'FAIL';
             if (!empty($module)) {
                 $info = isset($behavior->info) ? $behavior->info : $info;
                 if (in_array($module, apache_get_modules())) {
                     $status = 'OK';
                 }
             }
             $html .= PHP_EOL . vsprintf($format, array(
                         $module,
                         $info,
                         null,
                         $status
             ));
         }
     }
     echo $html;
 }