function callfile_setAccess() { switch (@$_REQUEST['stype']) { case 'backupDatabase': backupDatabase(); break; //备份数据库 //备份数据库 case 'recoveryDatabase': recoveryDatabase(); //恢复数据库 break; default: eerr('setAccess页里没有动作', @$_REQUEST['stype']); } }
* Open Source Financial Management * Visit http://badger.berlios.org * **/ define('BADGER_ROOT', '../..'); require_once BADGER_ROOT . '/includes/fileHeaderFrontEnd.inc.php'; require_once BADGER_ROOT . '/modules/importExport/exportLogic.php'; require_once BADGER_ROOT . '/core/urlTools.php'; if (isset($_GET['mode'])) { $action = $_GET['mode']; } else { $action = 'displayProcedure'; } switch ($action) { case 'backupDatabase': backupDatabase(); break; case 'update': update(); break; case 'displayProcedure': default: displayProcedure(); break; } function displayProcedure() { global $tpl; $widgets = new WidgetEngine($tpl); $widgets->addNavigationHead(); $procedureTitle = getUpdateTranslation('updateProcedure', 'pageTitle');
function backupTables() { global $ax, $calID, $set, $lcV; echo "<fieldset><legend>{$ax['mdb_backup']}</legend>\n"; //get table names $tables = getTables(); if (empty($tables)) { echo "{$ax['mdb_noshow_tables']}\n"; $result = false; } else { $sqlFile = backupDatabase($tables, true); //create backup file //save .sql dump file $fName = "./files/{$calID}-dump-" . date('Ymd-His') . '.sql'; echo "<br>{$ax['mdb_file_name']} <strong>{$fName}</strong><br>\n"; if (file_put_contents($fName, $sqlFile) !== false) { echo "{$ax['mdb_file_saved']}<br>\n"; $result = basename($fName); } else { echo "<br><br><strong>{$ax['mdb_write_error']}</strong><br>\n"; $result = false; } } echo "</fieldset>\n"; return $result; }
<?php include "../config.php"; include "../include/common.php"; include "../include/db_connect.php"; include "../include/session.php"; include "../include/backup.php"; if (isset($_SESSION['root'])) { $backupLink = FALSE; if (isset($_REQUEST['backup'])) { $dbResult = backupDatabase(); $fileResult = backupFiles(); if ($fileResult !== false) { $backupLink = array($dbResult, $fileResult[0], $fileResult[1]); $success = "Backup created!"; } else { $error = "Something went wrong! If this continues, contact us!"; } } if (isset($success)) { get_page_advanced("backup", "root", array('backupLink' => $backupLink, 'success' => $success)); } else { if (isset($error)) { get_page_advanced("backup", "root", array('backupLink' => $backupLink, 'error' => $error)); } else { if (isset($warning)) { get_page_advanced("backup", "root", array('backupLink' => $backupLink, 'warning' => $warning)); } else { if (isset($info)) { get_page_advanced("backup", "root", array('backupLink' => $backupLink, 'info' => $info)); } else {
function admin_dispatchAction($action) { if ($action == 'general') { showInterface('admin/general.php'); } elseif ($action == 'adminSave') { admin_saveSettings('admin/general.php'); } elseif ($action == 'vendor') { showInterface('admin/vendor.php'); } elseif ($action == 'vendorSave') { admin_saveSettings('admin/vendor.php'); } elseif ($action == 'phpinfo') { disableInDemoMode('', 'admin/general.php'); phpinfo(); print "<h2>get_loaded_extensions()</h2>\n" . implode("<br/>\n", get_loaded_extensions()) . "\n"; if (function_exists('apache_get_modules')) { print "<h2>apache_get_modules()</h2>\n" . implode("<br/>\n", apache_get_modules()) . "\n"; } print "<h2>get_defined_constants()</h2>\n<xmp>" . print_r(get_defined_constants(), true) . "</xmp>\n"; // $mbInfo = mb_get_info(); ksort($mbInfo); print "<h2>mb_get_info()</h2>\n<xmp>" . print_r($mbInfo, true) . "</xmp>\n"; exit; } elseif ($action == 'ulimit') { disableInDemoMode('', 'admin/general.php'); print "<h2>Soft Resource Limits (ulimit -a -S)</h2>\n"; list($maxCpuSeconds, $memoryLimitKbytes, $maxProcessLimit, $ulimitOutput) = getUlimitValues('soft'); showme($ulimitOutput); print "<h2>Hard Resource Limits (ulimit -a -H)</h2>\n"; list($maxCpuSeconds, $memoryLimitKbytes, $maxProcessLimit, $ulimitOutput) = getUlimitValues('soft'); showme($ulimitOutput); exit; } elseif ($action == 'updateDate') { getAjaxDate(); } elseif ($action == 'getUploadPathPreview') { getUploadPathPreview(@$_REQUEST['dirOrUrl'], @$_REQUEST['inputValue'], @$_REQUEST['isCustomField'], true); } elseif ($action == 'plugins') { // allow disabling plugins if (file_exists("{$GLOBALS['PROGRAM_DIR']}/plugins/_disable_all_plugins.txt")) { alert('Development Mode: Plugins are disabled. Remove or rename /plugins/_disable_all_plugins.txt to enable.<br/>'); } else { } showInterface('admin/plugins.php'); } elseif ($action == 'pluginHooks') { showInterface('admin/pluginHooks.php'); } elseif ($action == 'deactivatePlugin') { security_dieUnlessPostForm(); security_dieUnlessInternalReferer(); security_dieOnInvalidCsrfToken(); disableInDemoMode('plugins', 'admin/plugins.php'); deactivatePlugin(@$_REQUEST['file']); redirectBrowserToURL('?menu=admin&action=plugins', true); exit; } elseif ($action == 'activatePlugin') { security_dieUnlessPostForm(); security_dieUnlessInternalReferer(); security_dieOnInvalidCsrfToken(); disableInDemoMode('plugins', 'admin/plugins.php'); activatePlugin(@$_REQUEST['file']); redirectBrowserToURL('?menu=admin&action=plugins', true); exit; } elseif ($action == 'backup') { security_dieUnlessPostForm(); security_dieUnlessInternalReferer(); security_dieOnInvalidCsrfToken(); disableInDemoMode('', 'admin/general.php'); $filename = backupDatabase(null, @$_REQUEST['backupTable']); notice(sprintf(t('Created backup file %1$s (%2$s seconds)'), $filename, showExecuteSeconds(true))); showInterface('admin/general.php'); exit; } elseif ($action == 'restore') { security_dieUnlessPostForm(); security_dieUnlessInternalReferer(); security_dieOnInvalidCsrfToken(); disableInDemoMode('', 'admin/general.php'); $filename = @$_REQUEST['file']; restoreDatabase(DATA_DIR . '/backups/' . $filename); notice("Restored backup file /data/backups/{$filename}"); makeAllUploadRecordsRelative(); showInterface('admin/general.php'); exit; } elseif ($action == 'bgtasksLogsClear') { security_dieUnlessPostForm(); security_dieUnlessInternalReferer(); security_dieOnInvalidCsrfToken(); disableInDemoMode('', 'admin/general.php'); mysql_delete('_cron_log', null, 'true'); notice(t("Background Task logs have been cleared.")); showInterface('admin/general.php'); exit; } else { showInterface('admin/general.php'); } }