$dircontent = scandir($dir); foreach ($dircontent as $c) { if ($c != '.' and $c != '..' and is_dir($dir . '/' . $c)) { rmr($dir . '/' . $c); } else { if ($c != '.' and $c != '..') { unlink($dir . '/' . $c); } } } rmdir($dir); } else { @unlink($dir); } } $response = new UpdateResponse(); if (!is_dir(EASYWIDIR . '/tmp')) { @mkdir(EASYWIDIR . '/tmp'); } if (is_dir(EASYWIDIR . '/tmp')) { $response->add('Creating tempfolder <b>tmp/</b>'); $opts = stream_context_create(array('http' => array('method' => 'GET', 'header' => "Accept-language: en\r\nUser-Agent: " . $ui->server['HTTP_HOST'] . "\r\n"))); $response->add('Downloading: ' . $licenceDetails['v'] . '.zip'); $fp = @fopen('http://update.easy-wi.com/ew/' . $licenceDetails['v'] . '.zip', 'rb', false, $opts); $zip = @fopen(EASYWIDIR . '/tmp/' . $licenceDetails['v'] . '.zip', 'wb'); if ($fp == true and $zip == true) { while (!feof($fp)) { fwrite($zip, fread($fp, 8192)); } fclose($fp); fclose($zip);
$this->response = ''; } function add($newtext) { $this->response .= $newtext; } function printresponse() { return $this->response; } function __destruct() { unset($this->response); } } $response = new UpdateResponse(); } else { if (!defined('EASYWIDIR')) { define('EASYWIDIR', dirname(dirname(__FILE__))); } } if (!isset($sql)) { include EASYWIDIR . '/stuff/config.php'; $dbConnect['db'] = $db; try { $sql = new PDO("mysql:host={$host};dbname={$db}", $user, $pwd, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); } catch (PDOException $error) { echo $error->getMessage(); die; } }
{ public $response = ''; function __construct() { $this->response = ''; } function add($newtext) { $this->response .= $newtext; } function __destruct() { unset($this->response); } } $response = new UpdateResponse(); $sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); require_once EASYWIDIR . '/stuff/methods/class_tables.php'; $tables = new Tables($dbConnect['db']); $response->add('Adding tables if needed.'); $tables->createMissingTables(); $response->add('Repairing tables if needed.'); $tables->correctTablesStatus(); $tables->correctExistingTables(); foreach ($tables->getExecutedSql() as $change) { $response->add($change . '<br>'); } $response->add('Fixing data entries if needed.'); include EASYWIDIR . '/stuff/methods/tables_entries_repair.php'; $template_file = $response->response; } else {
} } if (strlen($response->response) > 0) { $displayToUser .= "<div class='alert alert-success'>{$languageObject->ok_db_tables_create}</div>"; $displayToUser .= "<div class='alert alert-success'>{$response->response}</div>"; } else { $displayToUser .= "<div class='alert alert-success'>{$languageObject->ok_db_tables_create}</div>"; } $displayToUser .= "<div class='pager'><a href='?step=5{$languageGetParameter}' class='pull-right'><span class='btn btn-primary btn-lg'>{$languageObject->continue}</span></a></div>"; } catch (PDOException $error) { $systemCheckError['tables_add.php'] = "<div class='alert alert-danger'>{$error->getMessage()}" . implode("\r\n", $tables->getExecutedSql()) . "</div>"; } } if ($currentStep == 5 and count($systemCheckError) == 0) { try { $response = new UpdateResponse(); require_once EASYWIDIR . '/stuff/methods/class_tables.php'; $tables = new Tables($db); $response->add('Repairing tables if needed.<br>'); $tables->correctTablesStatus(); $tables->correctExistingTables(); foreach ($tables->getExecutedSql() as $change) { $response->add($change . '<br>'); } if (strpos($response->response, 'Error: no such table:') !== false) { $systemCheckError['tables_repair.php'] = "<div class='alert alert-danger'>{$response->response}</div>"; } else { if (strlen($response->response) > 0) { $displayToUser .= "<div class='alert alert-success'>{$languageObject->ok_db_tables_check_repair}</div>"; $displayToUser .= "<div class='alert alert-success'>{$response->response}</div>"; } else {