Github |
.';
if (!empty($fm_config['show_php_ver'])) {
echo ' | PHP ' . phpversion();
}
if (!empty($fm_config['show_php_ini'])) {
echo ' | ' . php_ini_loaded_file();
}
if (!empty($fm_config['show_gt'])) {
echo ' | ' . __('Generation time') . ': ' . round($totaltime, 2);
}
if (!empty($fm_config['enable_proxy'])) {
echo ' |
proxy';
}
if (!empty($fm_config['show_phpinfo'])) {
echo ' |
phpinfo';
}
if (!empty($fm_config['show_xls']) && !empty($link)) {
echo ' |
xls';
}
if (!empty($fm_config['fm_settings'])) {
echo ' |
' . __('Settings') . '';
}
?>
errors)) {
$this->errors = array();
}
}
function createArchive($file_list)
{
$result = false;
if (file_exists($this->archive_name) && is_file($this->archive_name)) {
$newArchive = false;
} else {
$newArchive = true;
}
if ($newArchive) {
if (!$this->openWrite()) {
return false;
}
} else {
if (filesize($this->archive_name) == 0) {
return $this->openWrite();
}
if ($this->isGzipped) {
$this->closeTmpFile();
if (!rename($this->archive_name, $this->archive_name . '.tmp')) {
$this->errors[] = __('Cannot rename') . ' ' . $this->archive_name . __(' to ') . $this->archive_name . '.tmp';
return false;
}
$tmpArchive = gzopen($this->archive_name . '.tmp', 'rb');
if (!$tmpArchive) {
$this->errors[] = $this->archive_name . '.tmp ' . __('is not readable');
rename($this->archive_name . '.tmp', $this->archive_name);
return false;
}
if (!$this->openWrite()) {
rename($this->archive_name . '.tmp', $this->archive_name);
return false;
}
$buffer = gzread($tmpArchive, 512);
if (!gzeof($tmpArchive)) {
do {
$binaryData = pack('a512', $buffer);
$this->writeBlock($binaryData);
$buffer = gzread($tmpArchive, 512);
} while (!gzeof($tmpArchive));
}
gzclose($tmpArchive);
unlink($this->archive_name . '.tmp');
} else {
$this->tmp_file = fopen($this->archive_name, 'r+b');
if (!$this->tmp_file) {
return false;
}
}
}
if (isset($file_list) && is_array($file_list)) {
if (count($file_list) > 0) {
$result = $this->packFileArray($file_list);
}
} else {
$this->errors[] = __('No file') . __(' to ') . __('Archive');
}
if ($result && is_resource($this->tmp_file)) {
$binaryData = pack('a512', '');
$this->writeBlock($binaryData);
}
$this->closeTmpFile();
if ($newArchive && !$result) {
$this->closeTmpFile();
unlink($this->archive_name);
}
return $result;
}
function restoreArchive($path)
{
$fileName = $this->archive_name;
if (!$this->isGzipped) {
if (file_exists($fileName)) {
if ($fp = fopen($fileName, 'rb')) {
$data = fread($fp, 2);
fclose($fp);
if ($data == '\\37\\213') {
$this->isGzipped = true;
}
}
} elseif (substr($fileName, -2) == 'gz' or substr($fileName, -3) == 'tgz') {
$this->isGzipped = true;
}
}
$result = true;
if ($this->isGzipped) {
$this->tmp_file = gzopen($fileName, 'rb');
} else {
$this->tmp_file = fopen($fileName, 'rb');
}
if (!$this->tmp_file) {
$this->errors[] = $fileName . ' ' . __('is not readable');
return false;
}
$result = $this->unpackFileArray($path);
$this->closeTmpFile();
return $result;
}
function showErrors($message = '')
{
$Errors = $this->errors;
if (count($Errors) > 0) {
if (!empty($message)) {
$message = ' (' . $message . ')';
}
$message = __('Error occurred') . $message . ':