public function execute() { include_once rex_path::addon('import_export', 'functions/function_import_export.php'); include_once rex_path::addon('import_export', 'functions/function_import_folder.php'); $filename = $this->getParam('filename', self::DEFAULT_FILENAME); $filename = str_replace('%REX_SERVER', parse_url(rex::getServer(), PHP_URL_HOST), $filename); $filename = str_replace('%REX_VERSION', rex::getVersion(), $filename); $filename = strftime($filename); $file = $filename; $dir = getImportDir() . '/'; $ext = '.sql'; if (file_exists($dir . $file . $ext)) { $i = 1; while (file_exists($dir . $file . '_' . $i . $ext)) { ++$i; } $file = $file . '_' . $i; } if (rex_a1_export_db($dir . $file . $ext)) { $message = $file . $ext . ' created'; if ($this->sendmail) { if (!rex_addon::get('phpmailer')->isAvailable()) { $this->setMessage($message . ', mail not sent (addon "phpmailer" isn\'t activated)'); return false; } $mail = new rex_mailer(); $mail->AddAddress($this->mailaddress); $mail->Subject = rex_i18n::msg('im_export_mail_subject'); $mail->Body = rex_i18n::msg('im_export_mail_body', rex::getServerName()); $mail->AddAttachment($dir . $file . $ext, $filename . $ext); if ($mail->Send()) { $this->setMessage($message . ', mail sent'); return true; } $this->setMessage($message . ', mail not sent'); return false; } $this->setMessage($message); return true; } $this->setMessage($file . $ext . ' not created'); return false; }
function execute() { global $REX; include_once $REX['INCLUDE_PATH'] . '/addons/import_export/functions/function_import_export.inc.php'; include_once $REX['INCLUDE_PATH'] . '/addons/import_export/functions/function_import_folder.inc.php'; $file = 'rex_' . $REX['VERSION'] . '_' . date("Ymd"); $dir = getImportDir() . '/'; $ext = '.sql'; if (file_exists($dir . $file . $ext)) { $i = 1; while (file_exists($dir . $file . '_' . $i . $ext)) { $i++; } $file = $file . '_' . $i; } if (rex_a1_export_db($dir . $file . $ext)) { $this->setMessage($file . $ext . ' created'); return true; } return false; }
function execute() { global $REX; include_once $REX['INCLUDE_PATH'] . '/addons/import_export/functions/function_import_export.inc.php'; include_once $REX['INCLUDE_PATH'] . '/addons/import_export/functions/function_import_folder.inc.php'; $server = preg_replace('@^https?://|/.*|[^\\w.-]@', '', $REX['SERVER']); $file = strtolower($server) . '_rex' . $REX['VERSION'] . $REX['SUBVERSION'] . $REX['MINORVERSION'] . '_' . date('Ymd_Hi'); $dir = getImportDir() . '/'; $ext = '.sql'; if (file_exists($dir . $file . $ext)) { $i = 1; while (file_exists($dir . $file . '_' . $i . $ext)) { $i++; } $file = $file . '_' . $i; } if (rex_a1_export_db($dir . $file . $ext)) { $this->setMessage($file . $ext . ' created'); return true; } return false; }
} } elseif (isset($function) && $function == "export") { // ------------------------------ FUNC EXPORT $exportfilename = strtolower($exportfilename); $exportfilename = stripslashes($exportfilename); $filename = ereg_replace("[^\\.a-z0-9_\\-]", "", $exportfilename); if ($filename != $exportfilename) { $msg = $I18N_IM_EXPORT->msg("filename_updated"); $exportfilename = $filename; } else { $content = ""; if ($exporttype == "sql") { // ------------------------------ FUNC EXPORT SQL $header = "plain/text"; $ext = ".sql"; $content = rex_a1_export_db(); // ------------------------------ /FUNC EXPORT SQL } elseif ($exporttype == "files") { // ------------------------------ FUNC EXPORT FILES $header = "tar/gzip"; $ext = ".tar.gz"; if ($EXPDIR == "") { $msg = $I18N_IM_EXPORT->msg("please_choose_folder"); } else { $content = rex_a1_export_files($EXPDIR, $filename); } // ------------------------------ /FUNC EXPORT FILES } if ($content != "" && $exportdl == 1) { $filename = $filename . $ext; header("Content-type: {$header}");
$content = ''; $hasContent = false; $header = ''; $ext = $exporttype == 'sql' ? '.sql' : '.tar.gz'; $export_path = getImportDir() . '/'; if (file_exists($export_path . $filename . $ext)) { $i = 1; while (file_exists($export_path . $filename . '_' . $i . $ext)) { ++$i; } $filename = $filename . '_' . $i; } if ($exporttype == 'sql') { // ------------------------------ FUNC EXPORT SQL $header = 'plain/text'; $hasContent = rex_a1_export_db($export_path . $filename . $ext, $EXPTABLES); // ------------------------------ /FUNC EXPORT SQL } elseif ($exporttype == 'files') { // ------------------------------ FUNC EXPORT FILES $header = 'tar/gzip'; if (empty($EXPDIR)) { $error = rex_i18n::msg('im_export_please_choose_folder'); } else { $content = rex_a1_export_files($EXPDIR); $hasContent = rex_file::put($export_path . $filename . $ext, $content); } // ------------------------------ /FUNC EXPORT FILES } if ($hasContent) { if ($exportdl) { $filename = $filename . $ext;
$content = ''; $hasContent = false; $header = ''; $ext = $exporttype == 'sql' ? '.sql' : '.tar.gz'; $export_path = getImportDir() . '/'; if (file_exists($export_path . $filename . $ext)) { $i = 1; while (file_exists($export_path . $filename . '_' . $i . $ext)) { $i++; } $filename = $filename . '_' . $i; } if ($exporttype == 'sql') { // ------------------------------ FUNC EXPORT SQL $header = 'plain/text'; $hasContent = rex_a1_export_db($export_path . $filename . $ext); // ------------------------------ /FUNC EXPORT SQL } elseif ($exporttype == 'files') { // ------------------------------ FUNC EXPORT FILES $header = 'tar/gzip'; if (empty($EXPDIR)) { $warning = $I18N->msg('im_export_please_choose_folder'); } else { $content = rex_a1_export_files($EXPDIR); $hasContent = rex_put_file_contents($export_path . $filename . $ext, $content); } // ------------------------------ /FUNC EXPORT FILES } if ($hasContent) { if ($exportdl) { while (ob_get_level()) {