Esempio n. 1
0
 public function testMysql()
 {
     Tests_DBLoader4Test::getUp();
     $servCheck = ServerCheck::getInstance();
     $mysql_params = $servCheck->getMysqlParams();
     $this->assertInstanceOf('ServerCheck_mysqlParams', $mysql_params);
 }
Esempio n. 2
0
 public function testMysql()
 {
     $this->markTestIncomplete('To be fixed.');
     Tests_DBLoader4Test::getUp();
     $servCheck = ServerCheck::getInstance();
     $mysql_params = $servCheck->getMysqlParams();
     $this->assertInstanceOf('ServerCheck_mysqlParams', $mysql_params);
 }
Esempio n. 3
0
 public function post()
 {
     if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
         return $this->delete();
     }
     $upload = isset($_FILES[$this->options['param_name']]) ? $_FILES[$this->options['param_name']] : null;
     $info = array();
     if ($upload && is_array($upload['tmp_name'])) {
         // param_name is an array identifier like "files[]",
         // $_FILES is a multi-dimensional array:
         foreach ($upload['tmp_name'] as $index => $value) {
             $info[] = $this->handle_file_upload($upload['tmp_name'][$index], isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index], isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index], isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index], $upload['error'][$index], $index);
         }
     } elseif ($upload || isset($_SERVER['HTTP_X_FILE_NAME'])) {
         // param_name is a single object identifier like "file",
         // $_FILES is a one-dimensional array:
         $info[] = $this->handle_file_upload(isset($upload['tmp_name']) ? $upload['tmp_name'] : null, isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : (isset($upload['name']) ? $upload['name'] : null), isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : (isset($upload['size']) ? $upload['size'] : null), isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : (isset($upload['type']) ? $upload['type'] : null), isset($upload['error']) ? $upload['error'] : null);
     }
     //check for server misconfiguration
     $uploadParams = ServerCheck::getInstance()->getUploadParams();
     if ($_SERVER['CONTENT_LENGTH'] >= $uploadParams->getPostMaxSize()) {
         $fp = fopen("php://input", "r");
         list($trash, $boundary) = explode('boundary=', $_SERVER['CONTENT_TYPE']);
         $regexp = '/' . $boundary . '.*?filename="(.*)".*?Content-Type:(.*)\\x{0D}\\x{0A}\\x{0D}\\x{0A}/sm';
         $readBuff = fread($fp, 1024);
         while (!preg_match($regexp, $readBuff, $matches)) {
             $readBuff .= fread($fp, 1024);
         }
         fclose($fp);
         $file = new stdClass();
         $file->name = $this->trim_file_name($matches[1], trim($matches[2]), null);
         $file->size = null;
         $file->type = trim($matches[2]);
         $file->error = "The file is too large. " . "Please Contact support@matecat.com and report these details: " . "\"The server configuration does not conform with Matecat configuration. " . "Check for max header post size value in the virtualhost configuration or php.ini.\"";
         $info = array($file);
     } elseif ($_SERVER['CONTENT_LENGTH'] >= $uploadParams->getUploadMaxFilesize()) {
         $info[0]->error = "The file is too large.  " . "Please Contact support@matecat.com and report these details: " . "\"The server configuration does not conform with Matecat configuration. " . "Check for max file upload value in the virtualhost configuration or php.ini.\"";
     }
     //check for server misconfiguration
     header('Vary: Accept');
     $json = json_encode($info);
     $redirect = isset($_REQUEST['redirect']) ? stripslashes($_REQUEST['redirect']) : null;
     if ($redirect) {
         header('Location: ' . sprintf($redirect, rawurlencode($json)));
         return;
     }
     if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false) {
         header('Content-type: application/json');
     } else {
         header('Content-type: text/plain');
     }
     echo $json;
 }
Esempio n. 4
0
    height: 35px;
    padding-top: 15px;
    width: 45px;
    margin: 10px;
    color: white;
}
.site-online{
  background-color: green;
}
.site-offline{
  background-color: red;
}
EOL;
Yii::app()->clientScript->registerCss("circle-ness", $newStyle);
/*Check class */
$sc = new ServerCheck($data->websiteURL);
if ($sc->getServerStatus() === "OFFLINE") {
    $classname = "site-offline";
    //report to sir about the incident
    $mailer = new YiiMailer();
    $mailer->setView('contact');
    $mailer->setData(array("websiteURL" => $data->websiteURL, "accountName" => $data->claimAccountName, "description" => "We cant seem to ping these website please double check these website."));
    $mailer->setFrom("*****@*****.**");
    $mailer->setTo("*****@*****.**");
    $mailer->setSubject(" {$data->claimAccountName}- Went Down");
    $mailer->send();
} else {
}
$applicationStatus = $data->application_status == Accounts::OK ? "site-online" : "site-offline";
$dataBaseApplication = $data->database_status == Accounts::OK ? "site-online" : "site-offline";
?>
Esempio n. 5
0
 protected function _getLazyCachedMysqlConfParams()
 {
     if (self::$MysqlParams === null) {
         self::$MysqlParams = new ServerCheck_params();
         $db = Database::obtain();
         $queryMysqlVariables = "show variables";
         $variables = $db->fetch_array($queryMysqlVariables);
         foreach ($variables as $key => $value) {
             $_VAR_NAME = $value['Variable_name'];
             self::$MysqlParams->{$_VAR_NAME} = $value['Value'];
         }
         self::$serverParams->mysql_params = new ServerCheck_mysqlParams(self::$MysqlParams);
     }
     return self::$MysqlParams;
 }