Execute($sql);
$rows = 0;
while ($products = $products_result->fields) {
$rows++;
$name = $products['products_name'];
$name = str_replace('|',' ',$name);
$name = strip_tags($name);
$price = $products['products_price'];
$tax = (100+oos_get_tax_rate($products['products_tax_class_id']))/100;
$price = number_format($price*$tax,2,".","");
$schema .= $products['products_id']. '|' . $products['products_model'] . '|' . $name . '|' . $products['products_tax_class_id'] . '|' . $products['products_status'] . '|' . $price . "\n";
// Move that ADOdb pointer!
$products_result->MoveNext();
}
fputs($fp, $schema);
fclose($fp);
if (isset($_POST['download']) && ($_POST['download'] == 'yes')) {
switch ($_POST['compress']) {
case 'gzip':
exec(LOCAL_EXE_GZIP . ' ' . OOS_EXPORT_PATH . $excel_file);
$excel_file .= '.gz';
break;
case 'zip':
exec(LOCAL_EXE_ZIP . ' -j ' . OOS_EXPORT_PATH . $excel_file . '.zip ' . OOS_EXPORT_PATH . $excel_file);
@unlink(OOS_EXPORT_PATH . $excel_file);
$excel_file .= '.zip';
}
header('Content-type: application/x-octet-stream');
header('Content-disposition: attachment; filename=' . $excel_file);
readfile(OOS_EXPORT_PATH . $excel_file);
@unlink(OOS_EXPORT_PATH . $excel_file);
exit;
} else {
switch ($_POST['compress']) {
case 'gzip':
exec(LOCAL_EXE_GZIP . ' ' . $excel_file);
break;
case 'zip':
exec(LOCAL_EXE_ZIP . ' -j ' . $excel_file . '.zip ' . $excel_file);
unlink(OOS_EXPORT_PATH . $excel_file);
}
$messageStack->add_session(SUCCESS_DATABASE_SAVED, 'success');
}
oos_redirect_admin(oos_href_link_admin($aContents['export_excel']));
break;
case 'download':
$extension = substr($_GET['file'], -3);
if ( ($extension == 'zip') || ($extension == '.gz') || ($extension == 'cvs') ) {
if ($fp = fopen(OOS_EXPORT_PATH . $_GET['file'], 'rb')) {
$buffer = fread($fp, filesize(OOS_EXPORT_PATH . $_GET['file']));
fclose($fp);
header('Content-type: application/x-octet-stream');
header('Content-disposition: attachment; filename=' . $_GET['file']);
echo $buffer;
exit;
}
} else {
$messageStack->add(ERROR_DOWNLOAD_LINK_NOT_ACCEPTABLE, 'error');
}
break;
case 'deleteconfirm':
if (strstr($_GET['file'], '..')) oos_redirect_admin(oos_href_link_admin($aContents['export_excel']));
oos_remove(OOS_EXPORT_PATH . '/' . oos_db_prepare_input($_GET['file']));
if (!$oos_remove_error) {
$messageStack->add_session(SUCCESS_EXPORT_DELETED, 'success');
oos_redirect_admin(oos_href_link_admin($aContents['export_excel']));
}
break;
}
}
// check if the backup directory exists
$dir_ok = FALSE;
if (is_dir(oos_get_local_path(OOS_EXPORT_PATH))) {
if (is_writeable(oos_get_local_path(OOS_EXPORT_PATH))) {
$dir_ok = TRUE;
} else {
$messageStack->add(ERROR_EXPORT_DIRECTORY_NOT_WRITEABLE, 'error');
}
} else {
$messageStack->add(ERROR_EXPORT_DIRECTORY_DOES_NOT_EXIST, 'error');
}
require 'includes/header.php';
?>
-
' . HEADER_TITLE_TOP . ''; ?>
-
' . BOX_HEADING_CATALOG . ''; ?>
-
|
|
|
|
read()) {
if ( ($file != '.') && ($file != '..') && ($file != '.htaccess') ) {
if (!is_dir(OOS_EXPORT_PATH . $file)) {
$contents[] = $file;
}
}
}
sort($contents);
for ($files = 0, $count = count($contents); $files < $count; $files++) {
$entry = $contents[$files];
$check = 0;
if ((!isset($_GET['file']) || (isset($_GET['file']) && ($_GET['file'] == $entry))) && !isset($buInfo) && ($action != 'backup')) {
$file_array['file'] = $entry;
$file_array['date'] = date(PHP_DATE_TIME_FORMAT, filemtime(OOS_EXPORT_PATH . $entry));
$file_array['size'] = number_format(filesize(OOS_EXPORT_PATH . $entry)) . ' bytes';
switch (substr($entry, -3)) {
case 'zip': $file_array['compression'] = 'ZIP'; break;
case '.gz': $file_array['compression'] = 'GZIP'; break;
default: $file_array['compression'] = TEXT_NO_EXTENSION; break;
}
$buInfo = new objectInfo($file_array);
}
echo ' ' . "\n";
$onclick_link = 'file=' . $entry;
?>
' . oos_image(OOS_IMAGES . 'icons/file_download.gif', ICON_FILE_DOWNLOAD) . ' ' . $entry; ?> |
|
bytes |
file) ) { echo ''; } else { echo '' . oos_image(OOS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?> |
close();
}
?>
|
' . oos_button(IMAGE_BACKUP) . ''; ?> |
|
'' . TEXT_INFO_HEADING_NEW_BACKUP . '');
$contents = array('form' => oos_draw_form('id', 'backup', $aContents['export_excel'], 'action=make_file_now', 'post', FALSE));
$contents[] = array('text' => TEXT_INFO_NEW_BACKUP);
if (file_exists(LOCAL_EXE_GZIP)) $contents[] = array('text' => '
' . oos_draw_radio_field('compress', 'gzip') . ' ' . TEXT_INFO_USE_GZIP);
if (file_exists(LOCAL_EXE_ZIP)) $contents[] = array('text' => oos_draw_radio_field('compress', 'zip') . ' ' . TEXT_INFO_USE_ZIP);
if ($dir_ok == TRUE) {
$contents[] = array('text' => '
' . oos_draw_checkbox_field('download', 'yes') . ' ' . TEXT_INFO_DOWNLOAD_ONLY . '*
*' . TEXT_INFO_BEST_THROUGH_HTTPS);
} else {
$contents[] = array('text' => '
' . oos_draw_radio_field('download', 'yes', TRUE) . ' ' . TEXT_INFO_DOWNLOAD_ONLY . '*
*' . TEXT_INFO_BEST_THROUGH_HTTPS);
}
$contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(IMAGE_BACKUP) . ' ' . BUTTON_CANCEL . '');
break;
case 'delete':
$heading[] = array('text' => '' . $buInfo->date . '');
$contents = array('form' => oos_draw_form('id', 'delete', $aContents['export_excel'], 'file=' . $buInfo->file . '&action=deleteconfirm', 'post', FALSE));
$contents[] = array('text' => TEXT_DELETE_INTRO);
$contents[] = array('text' => '
' . $buInfo->file . '');
$contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(BUTTON_DELETE) . ' ' . BUTTON_CANCEL . '');
break;
default:
if (isset($buInfo) && is_object($buInfo)) {
$heading[] = array('text' => '' . $buInfo->date . '');
$contents[] = array('align' => 'center', 'text' => '' . oos_button(BUTTON_DELETE) . '');
$contents[] = array('text' => '
' . TEXT_INFO_DATE . ' ' . $buInfo->date);
$contents[] = array('text' => TEXT_INFO_SIZE . ' ' . $buInfo->size);
$contents[] = array('text' => '
' . TEXT_INFO_COMPRESSION . ' ' . $buInfo->compression);
}
break;
}
if ( (oos_is_not_null($heading)) && (oos_is_not_null($contents)) ) {
?>
infoBox($heading, $contents);
?>
|