1
application/.htaccess
Normale Datei
|
@ -0,0 +1 @@
|
|||
Deny from all
|
49
application/Bootstrap.php
Normale Datei
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Bootstrap class
|
||||
*
|
||||
* @package MySQLDumper
|
||||
*/
|
||||
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
{
|
||||
public function _initActionHelpers()
|
||||
{
|
||||
Zend_Controller_Action_HelperBroker::addHelper(
|
||||
new Msd_Action_Helper_AssignConfigAndLanguage()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start session
|
||||
*
|
||||
* Anyhing else is set in configs/application.ini
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function _initApplication()
|
||||
{
|
||||
Zend_Session::setOptions(array('strict' => true));
|
||||
Zend_Session::start();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Set Firebug_logger in registry
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function _initFirbugLogger()
|
||||
{
|
||||
$writer = new Zend_Log_Writer_Firebug();
|
||||
$logger = new Zend_Log($writer);
|
||||
Zend_Registry::set('logger', $logger);
|
||||
}
|
||||
}
|
36
application/configs/application.ini
Normale Datei
|
@ -0,0 +1,36 @@
|
|||
[production]
|
||||
phpSettings.display_startup_errors = 0
|
||||
phpSettings.display_errors = 1
|
||||
phpSettings.error_reporting = E_ALL
|
||||
phpSettings.default_charset = "UTF-8"
|
||||
phpSettings.date.timezone = "Europe/Berlin"
|
||||
phpSettings.magic_quotes_runtime = 0
|
||||
includePaths.library = APPLICATION_PATH "" DS ".." DS "library"
|
||||
bootstrap.path = APPLICATION_PATH "" DS "Bootstrap.php"
|
||||
bootstrap.class = "Bootstrap"
|
||||
appnamespace = "Application"
|
||||
resources.frontController.controllerDirectory = APPLICATION_PATH "" DS "controllers"
|
||||
resources.frontController.moduleDirectory = APPLICATION_PATH "" DS "modules"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.view.basePath = APPLICATION_PATH "" DS "views"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "" DS "views" DS "layouts"
|
||||
resources.frontController.actionHelperPaths.Msd_Action_Helper = "Msd" DS "Action" DS "Helper" DS
|
||||
resources.view.encoding = "UTF-8"
|
||||
resources.view.helperPath.ZendX_JQuery_View_Helper = "ZendX/JQuery/View/Helper/"
|
||||
resources.view.helperPath.Msd_View_Helper = APPLICATION_PATH "" DS "views" DS "helpers"
|
||||
resources.view.doctype = XHTML1_STRICT
|
||||
; setHelperPath plugin is no longer used, because the paths are set here.
|
||||
resources.frontController.plugins.loginCheck = "Application_Plugin_LoginCheck"
|
||||
resources.frontController.plugins.deviceCheck = "Application_Plugin_DeviceCheck"
|
||||
|
||||
autoloaderNamespaces[] = "Msd"
|
||||
|
||||
[staging : production]
|
||||
|
||||
[development : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 1
|
||||
phpSettings.error_reporting = E_ALL
|
||||
resources.frontController.params.displayExceptions = 1
|
||||
|
||||
[testing : development]
|
73
application/configs/defaultConfig.ini
Normale Datei
|
@ -0,0 +1,73 @@
|
|||
[general]
|
||||
mode = "easy"
|
||||
logMaxsize = "1048576"
|
||||
logUnit = "kb"
|
||||
minspeed = "100"
|
||||
maxspeed = "10000"
|
||||
gzip = "y"
|
||||
multipart = "n"
|
||||
multipartSize = ""
|
||||
multipartSizeUnit = "kb"
|
||||
optimize = "n"
|
||||
errorHandling = "s"
|
||||
dbDelete = "n"
|
||||
title = "defaultConfig"
|
||||
|
||||
[autodelete]
|
||||
Activated = "n"
|
||||
PreserveBackups = ""
|
||||
|
||||
[email]
|
||||
sendEmail = "n"
|
||||
SenderAddress = ""
|
||||
SenderName = ""
|
||||
RecipientAddress = ""
|
||||
RecipientName = ""
|
||||
RecipientCc.0.Address = ""
|
||||
RecipientCc.0.Name = ""
|
||||
attachBackup = "n"
|
||||
Maxsize = ""
|
||||
MaxsizeUnit = "kb"
|
||||
Program = "php"
|
||||
|
||||
[ftp]
|
||||
0.use = "n"
|
||||
0.timeout = "10"
|
||||
0.passiveMode = "y"
|
||||
0.ssl = "n"
|
||||
0.server = ""
|
||||
0.port = "21"
|
||||
0.user = ""
|
||||
0.pass = ""
|
||||
0.dir = "/"
|
||||
|
||||
[cronscript]
|
||||
perlExtension = "pl"
|
||||
perlPath = ""
|
||||
perlTextOutput = "y"
|
||||
perlTextOutputComplete = "y"
|
||||
perlFileComment = ""
|
||||
|
||||
[interface]
|
||||
language = "de"
|
||||
theme = "msd"
|
||||
notificationWindowPosition = "middleCenter"
|
||||
showServerCaption = "y"
|
||||
showTooltips = "y"
|
||||
sqlboxHeight = "30"
|
||||
recordsPerPage = "50"
|
||||
sqlbrowserViewMode = "compact"
|
||||
refreshProcesslist = "3"
|
||||
|
||||
[dbuser]
|
||||
host = "localhost"
|
||||
user = "root"
|
||||
pass = ""
|
||||
manual = ""
|
||||
port = ""
|
||||
socket = ""
|
||||
defaultDb = "information_schema"
|
||||
|
||||
[systemDatabases]
|
||||
0 = "mysql"
|
||||
1 = "information_schema"
|
12
application/configs/update.ini
Normale Datei
|
@ -0,0 +1,12 @@
|
|||
[update]
|
||||
host = "update.mysqldumper.de"
|
||||
protocol = "http"
|
||||
path = "/"
|
||||
file = "index.php"
|
||||
|
||||
[language]
|
||||
request.params.a = "get_language_file"
|
||||
request.params.v = ":version"
|
||||
request.params.l = ":language"
|
||||
request.sourceFileKey = "f"
|
||||
targetBaseDir = APPLICATION_PATH "" DS "language"
|
380
application/controllers/ConfigController.php
Normale Datei
|
@ -0,0 +1,380 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Config Controller
|
||||
*
|
||||
* Controller to handle actions triggered on configuration screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class ConfigController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Active jQuery tab Id
|
||||
* @var string
|
||||
*/
|
||||
private $_activeTab = 'tab_general';
|
||||
|
||||
/**
|
||||
* Build the form on demand.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _buildForm()
|
||||
{
|
||||
$form = new Zend_Form(
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
)
|
||||
);
|
||||
$form->addElementPrefixPath(
|
||||
'Msd_Form_Decorator',
|
||||
'Msd/Form/Decorator/',
|
||||
'decorator'
|
||||
);
|
||||
$form->addPrefixPath(
|
||||
'Msd_Form_Decorator',
|
||||
'Msd/Form/Decorator/',
|
||||
'decorator'
|
||||
);
|
||||
$form->setAction(
|
||||
$this->view->url(
|
||||
array(
|
||||
'controller' => 'config',
|
||||
'action' => 'index'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$langs = $this->view->lang->getAvailableLanguages();
|
||||
asort($langs);
|
||||
|
||||
$formGeneral = $this->_getSubformIni('general');
|
||||
$elementTitle = $formGeneral->getElement('title');
|
||||
$elementTitle->setValue(
|
||||
$this->view->config->get('config.general.title')
|
||||
);
|
||||
|
||||
$form->addSubForm($formGeneral, 'general');
|
||||
$form->addSubForm($this->_getPanelDatabases(), 'dbuser');
|
||||
$form->addSubForm($this->_getSubformIni('autodelete'), 'autodelete');
|
||||
$form->addSubForm(new Application_Form_Config_Email(), 'email');
|
||||
$form->addSubForm(new Application_Form_Config_Ftp(), 'ftp');
|
||||
$form->addSubForm($this->_getSubformIni('cronscript'), 'cronscript');
|
||||
|
||||
$formInterface = $this->_getSubformIni('interface');
|
||||
$themeSelect = $formInterface->getElement('theme');
|
||||
$themeSelect->setMultiOptions(Msd_File::getThemeList());
|
||||
$langSelect = $formInterface->getElement('language');
|
||||
$langSelect->setMultiOptions($langs);
|
||||
$form->addSubForm($formInterface, 'interface');
|
||||
|
||||
$form->clearDecorators();
|
||||
$translator = $this->view->lang->getTranslator();
|
||||
|
||||
$saveIcon = $this->view->getIcon('save', $translator->_('L_SAVE'));
|
||||
$form->addElement(
|
||||
'submit',
|
||||
'save',
|
||||
array(
|
||||
'class' => 'Formbutton',
|
||||
'helper' => 'formButton',
|
||||
'content' => $saveIcon . ' ' . $translator->_('L_SAVE'),
|
||||
'escape' => false,
|
||||
'type' => 'submit',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array(
|
||||
'ViewHelper',
|
||||
'Tooltip'
|
||||
)
|
||||
)
|
||||
);
|
||||
$form->addDecorator('ConfigForm');
|
||||
$this->_setFormDefaultValues($form);
|
||||
$this->_setGroupVisibilities($form);
|
||||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Index action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
if ($this->_request->isPost()) {
|
||||
// if language is changed, we need to refresh the config before
|
||||
// the form is rendered
|
||||
$postData = $this->_request->getParams();
|
||||
if (isset($postData['language'])) {
|
||||
$this->view->lang->loadLanguage($postData['language']);
|
||||
}
|
||||
}
|
||||
$this->_buildForm();
|
||||
$this->_activeTab = $this->_getParam('selectedTab', 'tab_general');
|
||||
if ($this->_request->isPost()) {
|
||||
$this->_validateForm();
|
||||
}
|
||||
$this->view->currentTab = $this->_activeTab;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get validation errors and look for first tab with errors to jump to
|
||||
*
|
||||
* @param array $messages Form error messages
|
||||
*
|
||||
* @return array Array with messages and first tab to show
|
||||
*/
|
||||
private function _getFormErrors($messages)
|
||||
{
|
||||
$message = array();
|
||||
$firstTab = null;
|
||||
$form = $this->view->form;
|
||||
foreach ($messages as $tabKey => $tabMessage) {
|
||||
foreach ($tabMessage as $inputName => $inputMessage) {
|
||||
foreach ($inputMessage as $messageId => $messageText) {
|
||||
if ($firstTab === null) {
|
||||
$firstTab = 'tab_' . $tabKey;
|
||||
}
|
||||
$subForm = $form->getSubForm($tabKey);
|
||||
$formElement = $subForm->getElement($inputName);
|
||||
$elementClass = $formElement->getAttrib('class');
|
||||
$elementClass .= ' ' . 'inputError';
|
||||
$formElement->setAttrib('class', $elementClass);
|
||||
$message[] = $formElement->getLabel() . ': ' .
|
||||
$this->view->lang->translateZendId(
|
||||
$messageId,
|
||||
$messageText
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$ret = array();
|
||||
$ret['messages'] = implode('<br />', $message);
|
||||
$ret['firstTab'] = $firstTab;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get view values for configuration panel databases
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getPanelDatabases()
|
||||
{
|
||||
$formDb = $this->_getSubformIni('dbuser');
|
||||
|
||||
// get database names
|
||||
$dbAdapter = Msd_Db::getAdapter();
|
||||
$databases = $dbAdapter->getDatabaseNames();
|
||||
|
||||
// fill select-options with database names
|
||||
$formDb->getElement('defaultDb')->addMultioptions(
|
||||
array_combine($databases, $databases)
|
||||
);
|
||||
|
||||
return $formDb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read ini file and create subform
|
||||
*
|
||||
* @param string $subform
|
||||
*
|
||||
* @return Zend_Form_SubForm
|
||||
*/
|
||||
private function _getSubformIni($subform)
|
||||
{
|
||||
$subFormIni = new Zend_Config_Ini(
|
||||
APPLICATION_PATH . DS . 'forms' . DS . 'Config' . DS . $subform .
|
||||
'.ini'
|
||||
);
|
||||
$options = array('displayGroupPrefixPath' => $subform . '_');
|
||||
return new Zend_Form_SubForm($subFormIni, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Cc-Recipient to email form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addRecipientCcAction()
|
||||
{
|
||||
$recipientsCc = $this->view->config->get('config.email.RecipientCc');
|
||||
if ($recipientsCc === null) {
|
||||
$recipientsCc = array();
|
||||
}
|
||||
$index = count($recipientsCc);
|
||||
$recipientsCc[$index]['Name'] = '';
|
||||
$recipientsCc[$index]['Address'] = '';
|
||||
$recipientsCc = array_values($recipientsCc);
|
||||
$this->view->config->set('config.email.RecipientCc', $recipientsCc);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a Cc-Recipient entry
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteRecipientCcAction()
|
||||
{
|
||||
$recipientToDelete = (int)$this->_request->getPost('param');
|
||||
$recipientsCc = $this->view->config->get('config.email.RecipientCc');
|
||||
if (isset($recipientsCc[$recipientToDelete])) {
|
||||
unset($recipientsCc[$recipientToDelete]);
|
||||
}
|
||||
$this->view->config->set('config.email.RecipientCc', $recipientsCc);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Ftp-Connection
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addFtpConnectionAction()
|
||||
{
|
||||
$ftpConfig = $this->view->config->get('config.ftp');
|
||||
$index = 0;
|
||||
if (!empty($ftpConfig)) {
|
||||
$index = max(array_keys($ftpConfig)) + 1;
|
||||
}
|
||||
$default = $this->view->config->loadConfiguration(
|
||||
'defaultConfig',
|
||||
false
|
||||
);
|
||||
$default = $default->toArray();
|
||||
$ftpConfig[$index] = $default['ftp'][0];
|
||||
$this->view->config->set('config.ftp', $ftpConfig);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Ftp-Connection
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteFtpConnectionAction()
|
||||
{
|
||||
$index = (int)$this->_request->getPost('param');
|
||||
$ftpConfig = $this->view->config->get('config.ftp');
|
||||
if (isset($ftpConfig[$index])) {
|
||||
unset($ftpConfig[$index]);
|
||||
sort($ftpConfig);
|
||||
}
|
||||
$this->view->config->set('config.ftp', $ftpConfig);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default value of all sub forms to the configuration values
|
||||
*
|
||||
* @param Zend_Form $form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _setFormDefaultValues($form)
|
||||
{
|
||||
$subForms = $form->getSubForms();
|
||||
foreach ($subForms as $subForm) {
|
||||
$group = $subForm->getName();
|
||||
$elements = array_keys($subForm->getElements());
|
||||
foreach ($elements as $element) {
|
||||
$element = str_replace($group . '_', '', $element);
|
||||
$element = str_replace('_', '.', $element);
|
||||
$value = $this->view->config->get(
|
||||
'config.' .
|
||||
$group . '.' .
|
||||
$element
|
||||
);
|
||||
if ($value !== null) {
|
||||
$subForm->setDefault($element, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the config form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _validateForm()
|
||||
{
|
||||
$postData = $this->_request->getPost();
|
||||
$form = $this->view->form;
|
||||
$form->setDefaults($postData);
|
||||
if (isset($postData['save'])) {
|
||||
if (!$form->isValid($postData)) {
|
||||
$errors = $this->_getFormErrors($form->getMessages());
|
||||
if ($errors['messages'] != '') {
|
||||
$this->view->popUpMessage()->addMessage(
|
||||
'config-validate-error',
|
||||
'L_ERROR',
|
||||
$errors['messages'],
|
||||
array(
|
||||
'modal' => true
|
||||
)
|
||||
);
|
||||
// jump to first tab with validation error
|
||||
$this->_activeTab = $errors['firstTab'];
|
||||
}
|
||||
} else {
|
||||
$configData = $form->getValidValues($postData);
|
||||
$configValidator =
|
||||
new Application_Model_Config_FormValidator($configData);
|
||||
$configValidator->validate($this->view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default visibilities of the display groups inside of the form.
|
||||
* The visibilities depends on the current configuration.
|
||||
*
|
||||
* @param Zend_Form $form The whole form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _setGroupVisibilities(Zend_Form $form)
|
||||
{
|
||||
$visibilityMap = array(
|
||||
true => 'block',
|
||||
false => 'none',
|
||||
);
|
||||
$emailForm = $form->getSubForm('email');
|
||||
$sendmailConfig = $emailForm->getDisplayGroup('sendmailConfig');
|
||||
$smtpConfig = $emailForm->getDisplayGroup('smtpConfig');
|
||||
$sendmailVisibility = false;
|
||||
$smtpVisibility = false;
|
||||
switch ($this->view->config->get('config.email.Program')) {
|
||||
case 'sendmail':
|
||||
$sendmailVisibility = true;
|
||||
break;
|
||||
case 'smtp':
|
||||
$smtpVisibility = true;
|
||||
break;
|
||||
}
|
||||
$sendmailConfig->addAttribs(
|
||||
array(
|
||||
'style' => 'display:'
|
||||
. $visibilityMap[$sendmailVisibility] . ';',
|
||||
)
|
||||
);
|
||||
$smtpConfig->addAttribs(
|
||||
array(
|
||||
'style' => 'display:' . $visibilityMap[$smtpVisibility] . ';',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
71
application/controllers/DumpController.php
Normale Datei
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Dump Controller
|
||||
*
|
||||
* Controller to handle actions triggered on dump screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class DumpController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Show dump page
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$dump = new Msd_Dump();
|
||||
$dump->prepareDumpProcess();
|
||||
$this->view->dumpData = '';
|
||||
$this->view->dumpData->nrOfDatabasesToBackup =
|
||||
count($dump->dbsToBackup);
|
||||
$this->view->dumpData->databasesToBackup =
|
||||
implode(', ', array_keys($dump->dbsToBackup));
|
||||
$this->view->dumpData->sumTotal = $dump->sumTotal;
|
||||
//TODO get comment from config profile
|
||||
$this->view->dumpData->comment = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Start dump action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function startDumpAction()
|
||||
{
|
||||
$taskList = Msd_TaskManager::getInstance('backupTasks');
|
||||
$tasks = $taskList->getTasks();
|
||||
$this->view->config = Msd_Configuration::getInstance();
|
||||
$this->view->sessionId = Zend_Session::getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do dump action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function doDumpAction()
|
||||
{
|
||||
Zend_Layout::getMvcInstance()->disableLayout();
|
||||
Zend_Controller_Front::getInstance()->setParam('noViewRenderer', true);
|
||||
$taskList = Msd_TaskManager::getInstance('backupTasks');
|
||||
$tasks = $taskList->getTasks();
|
||||
$ret = array(
|
||||
'backup_in_progress' => false,
|
||||
'config_file' => $this->view->config->get('dynamic.configFile')
|
||||
|
||||
);
|
||||
echo json_encode($ret);
|
||||
}
|
||||
}
|
60
application/controllers/ErrorController.php
Normale Datei
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Error Controller
|
||||
*
|
||||
* Handle unexpected errors and uncaught Exceptions
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class ErrorController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Handle error
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function errorAction()
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$errors = $this->_getParam('error_handler');
|
||||
if (is_object($errors)) {
|
||||
$exceptionTypes = array(
|
||||
Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE,
|
||||
Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER,
|
||||
Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION
|
||||
);
|
||||
if (in_array($errors->type, $exceptionTypes)) {
|
||||
// 404 error -- controller or action not found
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
$this->view->message = 'Page not found<br />'
|
||||
. $errors->exception->getMessage();
|
||||
$this->view->displayErrors = 1;
|
||||
} else {
|
||||
// application error
|
||||
$this->getResponse()->setHttpResponseCode(200);
|
||||
$this->view->message = 'Application error: '
|
||||
. $errors->exception->getMessage();
|
||||
}
|
||||
|
||||
// conditionally display exceptions
|
||||
if ($this->getInvokeArg('displayExceptions') == true) {
|
||||
$this->view->exception = $errors->exception;
|
||||
}
|
||||
if (in_array(APPLICATION_ENV, array('development', 'testing'))) {
|
||||
$this->view->displayErrors = 1;
|
||||
}
|
||||
$this->view->request = $errors->request;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
32
application/controllers/FilesController.php
Normale Datei
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* File Controller
|
||||
*
|
||||
* Controller to handle actions triggered on file management screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class FilesController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
// action body
|
||||
}
|
||||
|
||||
public function restoreAction()
|
||||
{
|
||||
//Dateien waehlen
|
||||
}
|
||||
}
|
||||
|
306
application/controllers/IndexController.php
Normale Datei
|
@ -0,0 +1,306 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Index controller
|
||||
*
|
||||
* Controller to handle actions triggered on index screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class IndexController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Remember last controler
|
||||
* @var string
|
||||
*/
|
||||
private $_lastController;
|
||||
|
||||
/**
|
||||
* Remember last action
|
||||
* @var string
|
||||
*/
|
||||
private $_lastAction;
|
||||
|
||||
/**
|
||||
* Init
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$this->_lastController = $request->getParam('lastController', 'index');
|
||||
$this->_lastAction = $request->getParam('lastAction', 'index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Process index action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$version = new Msd_Version();
|
||||
if (!$version->checkPhpVersion()) {
|
||||
$this->_forward(
|
||||
'badversion',
|
||||
'install',
|
||||
'default',
|
||||
array(
|
||||
'message' => 'L_PHP_VERSION_TOO_OLD'
|
||||
)
|
||||
);
|
||||
}
|
||||
try {
|
||||
$dbo = Msd_Db::getAdapter();
|
||||
$data = Msd_File::getLatestBackupInfo();
|
||||
if (!empty($data)) {
|
||||
$statusline = Msd_File_Dump::getStatusline($data['filename']);
|
||||
$data['filename'] = $statusline['dbname'];
|
||||
} else {
|
||||
$data['filename'] = '';
|
||||
}
|
||||
$data['mysqlServerVersion'] = $dbo->getServerInfo();
|
||||
$data['mysqlClientVersion'] = $dbo->getClientInfo();
|
||||
$data['serverMaxExecutionTime'] =
|
||||
(int)@get_cfg_var('max_execution_time');
|
||||
$this->view->assign($data);
|
||||
if ($this->view->config->get('dynamic.dbActual') == '') {
|
||||
$dbNames = $dbo->getDatabaseNames();
|
||||
$this->view->config->set('dynamic.dbActual', $dbNames[0]);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$configNames = Msd_File::getConfigNames();
|
||||
if (count($configNames) == 0) {
|
||||
// no configuration file found - we need to install MSD
|
||||
$this->_redirect('/install/index');
|
||||
} else {
|
||||
// config found and loaded but we couldn't access MySQL
|
||||
// MySQL data seems to be invalid (changed user or server)
|
||||
// TODO give feedback to user and let him correct MySQL data
|
||||
$this->_redirect('/index/login');
|
||||
}
|
||||
}
|
||||
if (!$version->checkMysqlVersion()) {
|
||||
$this->_forward(
|
||||
'badversion',
|
||||
'install',
|
||||
'default',
|
||||
array('message' => 'L_MYSQL_VERSION_TOO_OLD')
|
||||
);
|
||||
}
|
||||
$this->view->version = $version;
|
||||
$this->view->dbAdapter = get_class($dbo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch configuration file
|
||||
*
|
||||
* Load selected configuration and forward to last page
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function switchconfigAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$request = $this->getRequest();
|
||||
$file = base64_decode($request->getParam('selectedConfig'));
|
||||
$this->view->config = Msd_Configuration::getInstance();
|
||||
$this->view->config->loadConfiguration($file);
|
||||
if ($this->_lastAction != 'switchconfig') { //prevent endless loop
|
||||
$this->_forward($this->_lastAction, $this->_lastController);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select another database as actual db
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function selectdbAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$request = $this->getRequest();
|
||||
$selectedDb = base64_decode($request->getParam('selectedDb'));
|
||||
$this->view->config->set('dynamic.dbActual', $selectedDb);
|
||||
if ($this->_lastAction != 'selectdb') { //prevent endless loop
|
||||
$redirectUrl = $this->view->url(
|
||||
array(
|
||||
'controller' => $this->_lastController,
|
||||
'action' => $this->_lastAction,
|
||||
),
|
||||
null,
|
||||
true
|
||||
);
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh database list
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function dbrefreshAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$dbo = Msd_Db::getAdapter();
|
||||
$databases = $dbo->getDatabaseNames();
|
||||
$this->view->config->set('dynamic.databases', $databases);
|
||||
$actualDb = $this->view->config->get('dynamic.dbActual');
|
||||
if ($dbo->selectDb($actualDb) !== true) {
|
||||
//actual db is no longer available -> switch to first one
|
||||
$this->view->config->set('dynamic.dbActual', $databases[0]);
|
||||
}
|
||||
if ($this->_lastAction != 'refreshdb') { //prevent endless loop
|
||||
$redirectUrl = $this->view->url(
|
||||
array(
|
||||
'controller' => $this->_lastController,
|
||||
'action' => $this->_lastAction,
|
||||
),
|
||||
null,
|
||||
true
|
||||
);
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process phpinfo action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function phpinfoAction()
|
||||
{
|
||||
//nothing to process - just render view
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to url
|
||||
*
|
||||
* @param array $url
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _doRedirect(array $url = array())
|
||||
{
|
||||
$this->_response->setRedirect($this->view->url($url, null, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout the user and redirect him to login page
|
||||
*/
|
||||
public function logoutAction()
|
||||
{
|
||||
//un-Auth user
|
||||
$user = new Msd_User();
|
||||
$user->logout();
|
||||
if (PHP_SAPI != 'cli') {
|
||||
setcookie('msd_autologin', null, null, '/');
|
||||
}
|
||||
$this->_doRedirect(
|
||||
array(
|
||||
'controller' => 'index',
|
||||
'action' => 'login'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* User login
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loginAction()
|
||||
{
|
||||
$form = new Application_Form_Login();
|
||||
if ($this->_request->isPost()) {
|
||||
$user = new Msd_User();
|
||||
$postData = $this->_request->getParams();
|
||||
if ($form->isValid($postData)) {
|
||||
$autoLogin = ($postData['autologin'] == 1) ? true : false;
|
||||
$loginResult = $user->login(
|
||||
$postData['user'],
|
||||
$postData['pass'],
|
||||
$autoLogin
|
||||
);
|
||||
$this->view->messages = $user->getAuthMessages();
|
||||
switch ($loginResult) {
|
||||
case Msd_User::NO_USER_FILE:
|
||||
case Msd_User::NO_VALID_USER:
|
||||
// users.ini doesn't exist or doesn't have entries
|
||||
$this->_doRedirect(
|
||||
array(
|
||||
'controller' => 'install',
|
||||
'action' => 'index'
|
||||
)
|
||||
);
|
||||
break;
|
||||
case Msd_User::UNKNOWN_IDENTITY:
|
||||
// user is not listed in users.ini
|
||||
break;
|
||||
case Msd_User::SUCCESS:
|
||||
$defaultDb = $this->view->config->get(
|
||||
'config.dbuser.defaultDb'
|
||||
);
|
||||
|
||||
// set actualDb to defaultDb
|
||||
if ($defaultDb != '') {
|
||||
$this->view->config->set(
|
||||
'dynamic.dbActual',
|
||||
$defaultDb
|
||||
);
|
||||
}
|
||||
$this->_doRedirect(
|
||||
array(
|
||||
'controller' => 'index',
|
||||
'action' => 'index'
|
||||
)
|
||||
);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
// if we get here wrong credentials are given
|
||||
$this->view->popUpMessage()
|
||||
->addMessage(
|
||||
'login-message',
|
||||
'L_LOGIN',
|
||||
$user->getAuthMessages(),
|
||||
array(
|
||||
'modal' => true,
|
||||
'dialogClass' => 'error'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle menu state (shown or hidden) and save state to session.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxToggleMenuAction()
|
||||
{
|
||||
$menu = new Zend_Session_Namespace('menu');
|
||||
if (isset($menu->showMenu)) {
|
||||
$menu->showMenu = (int)$menu->showMenu;
|
||||
} else {
|
||||
$menu->showMenu = 0;
|
||||
}
|
||||
$menu->showMenu = $menu->showMenu == 1 ? 0 : 1;
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->view->showMenu = $menu->showMenu;
|
||||
}
|
||||
|
||||
}
|
387
application/controllers/InstallController.php
Normale Datei
|
@ -0,0 +1,387 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Install controller
|
||||
*
|
||||
* Controller to handle actions triggered on install process
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class InstallController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Init controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$layout = Zend_Layout::getMvcInstance();
|
||||
$layout->setLayout('install');
|
||||
$this->version = new Msd_Version();
|
||||
$_SESSION['msd_install'] = true;
|
||||
if (
|
||||
$this->_request->getActionName() != 'badversion!' &&
|
||||
!$this->version->checkPhpVersion()
|
||||
) {
|
||||
$this->_forward(
|
||||
'badversion',
|
||||
'install',
|
||||
'default',
|
||||
array(
|
||||
'message' => 'L_PHP_VERSION_TOO_OLD'
|
||||
)
|
||||
);
|
||||
}
|
||||
$config = Msd_Configuration::getInstance('defaultConfig');
|
||||
$config->set('config.interface.theme', 'msd');
|
||||
}
|
||||
|
||||
/**
|
||||
* Start installation process
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
// delete cookie from further installation if present
|
||||
// to not import old values
|
||||
if (isset($_SESSION['msd_autologin'])) {
|
||||
setcookie('msd_autologin', null, null, '/');
|
||||
$_SESSION['msd_autologin'] = array();
|
||||
}
|
||||
Zend_Session_Namespace::resetSingleInstance('MySQLDumper');
|
||||
$config = Msd_Configuration::getInstance('defaultConfig', true);
|
||||
$lang = Msd_Language::getInstance();
|
||||
if ($this->_request->isPost()) {
|
||||
$language = $this->_getParam('language');
|
||||
$config->set('config.interface.language', $language);
|
||||
$config->set('dynamic.configFile', 'mysqldumper');
|
||||
$config->set('config.general.title', 'MySQLDumper');
|
||||
$config->saveConfigToSession();
|
||||
$_SESSION['msd_lang'] = $language;
|
||||
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step2'), null, true);
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
}
|
||||
// set selected languge
|
||||
$language = $this->_getParam('language', 'en');
|
||||
$languages = $lang->getAvailableLanguages();
|
||||
|
||||
// check user browser language
|
||||
$locale = new Zend_Locale();
|
||||
$browserLocale = array_keys($locale->getBrowser());
|
||||
|
||||
// get default or last selected language
|
||||
if ($language === null) {
|
||||
if (isset($_SESSION['msd_lang'])) {
|
||||
$language = $_SESSION['msd_lang'];
|
||||
} else {
|
||||
foreach ($browserLocale as $localeCode) {
|
||||
if (array_key_exists($localeCode, $languages)) {
|
||||
$language = $localeCode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Msd_Language::getInstance()->loadLanguage($language);
|
||||
$this->view->language = $language;
|
||||
$this->view->stepInfo = array(
|
||||
'language' => $language,
|
||||
'stepInfo' => array(
|
||||
'number' => 1,
|
||||
'description' => $lang->getTranslator()
|
||||
->_('L_SELECT_LANGUAGE')
|
||||
. ' (' . $language . ')'));
|
||||
$languagesStatus = array();
|
||||
foreach ($languages as $langId => $langName) {
|
||||
$languagesStatus[$langId] = array(
|
||||
'langName' => $langName,
|
||||
'installed' => file_exists(
|
||||
APPLICATION_PATH . DS . 'language' .
|
||||
DS . $langId . DS . 'lang.php'
|
||||
)
|
||||
);
|
||||
}
|
||||
$config->set('config.interface.language', $language);
|
||||
$this->view->languages = $languagesStatus;
|
||||
$this->view->lang = $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 2 - check directories
|
||||
*
|
||||
* Make sure work-directories exist and are writable.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function step2Action()
|
||||
{
|
||||
$lang = Msd_Language::getInstance();
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$language = $config->get('config.interface.language');
|
||||
$this->view->stepInfo = array(
|
||||
'language' => $language,
|
||||
'firstStepOK' => true,
|
||||
'stepInfo' => array(
|
||||
'number' => 2,
|
||||
'description' => $lang->getTranslator()->_('L_CHECK_DIRS'),
|
||||
)
|
||||
);
|
||||
$creationStatus = array();
|
||||
$checkDirs = array(
|
||||
'work' => $config->get('paths.work'),
|
||||
'config' => $config->get('paths.config'),
|
||||
'log' => $config->get('paths.log'),
|
||||
'backup' => $config->get('paths.backup'),
|
||||
'iconpath' => $config->get('paths.iconpath')
|
||||
);
|
||||
|
||||
foreach ($checkDirs as $checkDir) {
|
||||
clearstatcache();
|
||||
if (!is_dir($checkDir)) {
|
||||
@mkdir($checkDir, 0777);
|
||||
}
|
||||
clearstatcache();
|
||||
$checkExists = file_exists($checkDir);
|
||||
$checkWritable = Msd_File::isWritable($checkDir, 0777);
|
||||
$creationStatus[$checkDir] = array(
|
||||
'chmod' => Msd_File::getChmod($checkDir),
|
||||
'exists' => $checkExists,
|
||||
'writable' => $checkWritable,
|
||||
);
|
||||
$this->view->status = $creationStatus;
|
||||
}
|
||||
if (!in_array(false, $creationStatus)) {
|
||||
$config->set('dynamic.configFile', 'mysqldumper');
|
||||
$config->saveConfigToSession();
|
||||
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step3'), null, true);
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
}
|
||||
$this->view->lang = $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 3 - Enter administrative user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function step3Action()
|
||||
{
|
||||
$lang = Msd_Language::getInstance();
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$language = $config->get('config.interface.language');
|
||||
$form = new Application_Form_Install_User();
|
||||
$this->view->stepInfo = array(
|
||||
'language' => $language,
|
||||
'firstStepOK' => true,
|
||||
'secondStepOK' => true,
|
||||
'stepInfo' => array(
|
||||
'number' => 3,
|
||||
'description' => $lang->getTranslator()->_('L_AUTHENTICATE'),
|
||||
)
|
||||
);
|
||||
if ($this->_request->isPost()) {
|
||||
$postData = $this->_request->getParams();
|
||||
$form->getElement('pass_confirm')->getValidator('Identical')
|
||||
->setToken($postData['pass']);
|
||||
if ($form->isValid($postData)) {
|
||||
$ini = new Msd_Ini();
|
||||
$ini->set('name', $postData['user'], '0');
|
||||
$ini->set('pass', md5($postData['pass']), '0');
|
||||
$ini->save(APPLICATION_PATH . DS . 'configs' . DS . 'users.ini');
|
||||
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step4'), null, true);
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
}
|
||||
}
|
||||
$this->view->form = $form;
|
||||
$this->view->lang = $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 4 - Enter database params
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function step4Action()
|
||||
{
|
||||
$lang = Msd_Language::getInstance();
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$language = $config->get('config.interface.language');
|
||||
$this->view->stepInfo = array(
|
||||
'language' => $language,
|
||||
'firstStepOK' => true,
|
||||
'secondStepOK' => true,
|
||||
'thirdStepOK' => true,
|
||||
'stepInfo' => array(
|
||||
'number' => 4,
|
||||
'description' => $lang->getTranslator()->_('L_DBPARAMETER'),
|
||||
)
|
||||
);
|
||||
|
||||
if ($this->_request->isPost()) {
|
||||
$options = array(
|
||||
'host' => $this->_getParam('host'),
|
||||
'user' => $this->_getParam('user'),
|
||||
'pass' => $this->_getParam('pass'),
|
||||
'manual' => $this->_getParam('manual'),
|
||||
'port' => $this->_getParam('port'),
|
||||
'socket' => $this->_getParam('socket'),
|
||||
);
|
||||
$saveParam = $this->_getParam('save');
|
||||
$config->set('config.dbuser', $options);
|
||||
if ($saveParam !== null && $saveParam == 1) {
|
||||
$config->set('config.general.title', 'MySQLDumper');
|
||||
$config->set('config.dbuser.defaultDb', $this->_getParam('defaultDb'));
|
||||
$config->save('mysqldumper');
|
||||
unset($_SESSION['msd_lang']);
|
||||
unset($_SESSION['msd_install']);
|
||||
$redirectUrl = $this->view->url(array('controller' => 'index', 'action' => 'index', null, true));
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
} else {
|
||||
$dbAdapter = Msd_Db::getAdapter($options);
|
||||
try {
|
||||
$this->view->databases = $dbAdapter->getDatabaseNames();
|
||||
$this->view->success = true;
|
||||
$config->set('config.dbuser', $options);
|
||||
if (!$this->version->checkMysqlVersion()) {
|
||||
$this->_forward(
|
||||
'badversion',
|
||||
'install',
|
||||
'default',
|
||||
array(
|
||||
'message' => 'L_MYSQL_VERSION_TOO_OLD'
|
||||
)
|
||||
);
|
||||
}
|
||||
$config->saveConfigToSession();
|
||||
} catch (Msd_Exception $e) {
|
||||
$this->view->errorMessage = $e->getMessage();
|
||||
$this->view->success = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->view->lang = $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax action for loading language packs
|
||||
*
|
||||
* @return string Json response
|
||||
*/
|
||||
public function ajaxAction()
|
||||
{
|
||||
Zend_Layout::getMvcInstance()->disableLayout();
|
||||
Zend_Controller_Front::getInstance()->setParam('noViewRenderer', true);
|
||||
$this->_response->setHeader('Content-Type', 'text/javascript');
|
||||
$language = $this->_request->getParam('lang');
|
||||
$lang = Msd_Language::getInstance();
|
||||
$version = new Msd_Version();
|
||||
$files = array(
|
||||
'lang' => ':language' . DS . 'lang.php',
|
||||
'flag' => ':language' . DS . 'flag.gif'
|
||||
);
|
||||
if ($language === null) {
|
||||
if (!isset($_SESSION['langlist'])) {
|
||||
$languages = $lang->getAvailableLanguages();
|
||||
$_SESSION['langlist'] = array_keys($languages);
|
||||
}
|
||||
rsort($_SESSION['langlist']);
|
||||
$language = array_pop($_SESSION['langlist']);
|
||||
}
|
||||
if ($language === null) {
|
||||
unset($_SESSION['langlist']);
|
||||
echo json_encode('done');
|
||||
return;
|
||||
}
|
||||
$update = new Msd_Update(
|
||||
APPLICATION_PATH . DS . 'configs' .
|
||||
DS . 'update.ini'
|
||||
);
|
||||
$update->setUpdateParam('language', $language);
|
||||
$update->setUpdateParam('version', $version->getMsdVersion());
|
||||
$updateResult = $update->doUpdate('language', $files);
|
||||
if (!($updateResult === true)) {
|
||||
switch ($updateResult['action']) {
|
||||
case 'connection':
|
||||
$message = array('L_UPDATE_CONNECTION_FAILED',
|
||||
$updateResult['server']);
|
||||
break;
|
||||
case 'saveresponse':
|
||||
$message = array('L_UPDATE_ERROR_RESPONSE',
|
||||
$updateResult['status']);
|
||||
break;
|
||||
case 'createfile':
|
||||
$message = array('L_WRONG_RIGHTS',
|
||||
$updateResult['file'],
|
||||
'0777');
|
||||
break;
|
||||
case 'getrequest':
|
||||
$message = array('L_UPDATE_ERROR_RESPONSE',
|
||||
$updateResult['status']);
|
||||
break;
|
||||
default:
|
||||
$message = '';
|
||||
}
|
||||
|
||||
if ($message !== '') {
|
||||
$this->view
|
||||
->popUpMessage()
|
||||
->addMessage(
|
||||
'update-message',
|
||||
'L_LOGIN',
|
||||
$message,
|
||||
array(
|
||||
'modal' => true,
|
||||
'dialogClass' => 'error'
|
||||
)
|
||||
);
|
||||
$updateResult['message'] = (string)$this->view->popUpMessage();
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(
|
||||
array(
|
||||
'language' => $language,
|
||||
'success' => ($updateResult === true) ? true : false,
|
||||
'error' => ($updateResult === true) ? '' : $updateResult
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP or MySQL version requirements are not met.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function badversionAction()
|
||||
{
|
||||
$translator = Msd_Language::getInstance()->getTranslator();
|
||||
$messageId = $this->_request->get('message');
|
||||
$message = $translator->_($messageId);
|
||||
if ($messageId == 'L_PHP_VERSION_TOO_OLD') {
|
||||
$this->view->message = sprintf(
|
||||
$message,
|
||||
$this->version->getRequiredPhpVersion(),
|
||||
PHP_VERSION
|
||||
);
|
||||
} else {
|
||||
$dbObject = Msd_Db::getAdapter();
|
||||
$this->view->message = sprintf(
|
||||
$message,
|
||||
$dbObject->getServerInfo(),
|
||||
$this->version->getRequiredMysqlVersion()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
112
application/controllers/LogController.php
Normale Datei
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Log Controller
|
||||
*
|
||||
* Controller to handle actions triggered on log screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class LogController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Delete a log file
|
||||
*
|
||||
* @param string $logType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteLogAction($logType)
|
||||
{
|
||||
$log = Msd_Log::getInstance();
|
||||
$log->delete($logType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show log
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$logType = $this->_getParam('log', Msd_Log::PHP);
|
||||
$logger = new Msd_Log;
|
||||
$log = $logger->getFile($logType);
|
||||
$reverse = $this->_getParam('reverse', 1);
|
||||
$offset = $this->_getParam('offset', 0);
|
||||
$delete = $this->_getParam('delete');
|
||||
|
||||
if ($delete != null) {
|
||||
$log->delete($logType);
|
||||
$this->_redirect('/log/index/log/' . $logType);
|
||||
}
|
||||
|
||||
$sortIcon = $this->view->getIcon('ArrowDown', '', 16);
|
||||
if ($reverse == 0) {
|
||||
$sortIcon = $this->view->getIcon('ArrowUp', '', 16);
|
||||
}
|
||||
$this->view->sortIcon = $sortIcon;
|
||||
$this->view->log = $log;
|
||||
$this->view->assign(
|
||||
array(
|
||||
'sortIcon' => $sortIcon,
|
||||
'SORT_ORDER' => $reverse == 0 ? 1 : 0
|
||||
)
|
||||
);
|
||||
$this->view->offset = $offset;
|
||||
$this->view->log = $logger;
|
||||
$this->view->activeLog = $logType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render log view and return as ajax response
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxAction()
|
||||
{
|
||||
$logType = $this->_getParam('log', Msd_Log::PHP);
|
||||
$reverse = $this->_getParam('reverse', 0);
|
||||
$page = $this->_getParam('offset', 1);
|
||||
$entriesPerPage =
|
||||
$this->view->config->get('config.interface.recordsPerPage');
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$logger = Msd_Log::getInstance();
|
||||
$lines = $logger->read($logType, $reverse);
|
||||
$pagination = $this->_getPaginator($lines, $page, $entriesPerPage);
|
||||
$this->view->log = $logType;
|
||||
$this->view->reverse = ($reverse == 1) ? 0 : 1;
|
||||
$this->view->page = $page;
|
||||
$this->view->entriesPerPage = $entriesPerPage;
|
||||
$this->view->logEntries = $pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Paginator
|
||||
*
|
||||
* @param array $lines
|
||||
* @param int $offset
|
||||
*
|
||||
* @return Zend_Paginator
|
||||
*/
|
||||
private function _getPaginator($lines, $offset, $entriesPerPage = 20)
|
||||
{
|
||||
$pagination = new Zend_Paginator(
|
||||
new Zend_Paginator_Adapter_Array($lines)
|
||||
);
|
||||
$pagination->setPageRange(20);
|
||||
$pagination->setCurrentPageNumber($offset)
|
||||
->setDefaultItemCountPerPage($entriesPerPage);
|
||||
return $pagination;
|
||||
}
|
||||
}
|
||||
|
24
application/controllers/RestoreController.php
Normale Datei
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Restore controller
|
||||
*
|
||||
* Controller to handle actions triggered on restore screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class RestoreController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
}
|
||||
}
|
485
application/controllers/SqlController.php
Normale Datei
|
@ -0,0 +1,485 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Sql Controller
|
||||
*
|
||||
* Controller to handle actions an SQLBrowser screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class SqlController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Db-handle
|
||||
* @var Msd_Db
|
||||
*/
|
||||
private $_db;
|
||||
|
||||
/**
|
||||
* Init
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->_db = Msd_Db::getAdapter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show list of databases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_forward('show.databases');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show list of databases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showDatabasesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer('databases/show-databases');
|
||||
$databases = $this->_db->getDatabases(true);
|
||||
$dbNames = $this->_db->getDatabaseNames();
|
||||
$dbActual = $this->view->config->get('dynamic.dbActual');
|
||||
//Fallback to first found db if actual db doesn't exist
|
||||
if (!in_array($dbActual, $dbNames)) {
|
||||
$dbActual = $dbNames[0];
|
||||
}
|
||||
$this->_setDynamicParams($dbActual);
|
||||
$this->view->dbInfos = $databases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show list of all tables of selected database
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer('tables/show-tables');
|
||||
$pageNum = $this->_getParam('offset', 1);
|
||||
$itemCountPerPage = $this->view->config->get(
|
||||
'config.interface.recordsPerPage'
|
||||
);
|
||||
|
||||
$dbActual = $this->_getParam(
|
||||
'database',
|
||||
$this->view->config->get('dynamic.dbActual')
|
||||
);
|
||||
if ($this->_getParam('dbName') !== null) {
|
||||
$dbActual = base64_decode($this->_getParam('dbName'));
|
||||
}
|
||||
$this->_db->selectDb($dbActual);
|
||||
$this->_setDynamicParams($dbActual);
|
||||
$paginatorAdapter = new Zend_Paginator_Adapter_Array(
|
||||
$this->_db->getTableStatus()
|
||||
);
|
||||
$paginator = new Zend_Paginator($paginatorAdapter);
|
||||
|
||||
$paginator->setDefaultItemCountPerPage($itemCountPerPage);
|
||||
$paginator->setCurrentPageNumber($pageNum);
|
||||
|
||||
$this->view->tables = $paginator;
|
||||
$this->view->page = $pageNum;
|
||||
$this->view->startEntry = $itemCountPerPage * ($pageNum - 1) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show data of selected table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showTableDataAction()
|
||||
{
|
||||
$this->_getDynamicParams();
|
||||
$dbName = $this->view->config->get('dynamic.dbActual');
|
||||
$offset = (int)$this->_getParam('offset', 0);
|
||||
$limit = $this->view->config->get('config.interface.recordsPerPage');
|
||||
$this->_db->selectDb($dbName);
|
||||
$tableName = $this->view->config->get('dynamic.tableActual');
|
||||
try {
|
||||
$this->view->columns = $this->_db->getTableColumns($tableName);
|
||||
$tables = $this->_db->getTableStatus($tableName);
|
||||
} catch (Exception $e) {
|
||||
// selected table not found - fall back to first found table
|
||||
$tables = $this->_db->getTableStatus();
|
||||
if (isset($tables[0]['TABLE_NAME'])) {
|
||||
$tableName = $tables[0]['TABLE_NAME'];
|
||||
$this->view->columns = $this->_db->getTableColumns($tableName);
|
||||
} else {
|
||||
// the selected database has no tables
|
||||
$this->view->noTables = true;
|
||||
$tables = array();
|
||||
$tableName = '';
|
||||
}
|
||||
}
|
||||
$this->view->config->set('dynamic.tableActual', $tableName);
|
||||
if (!empty($tables)) {
|
||||
$query = sprintf(
|
||||
'SELECT SQL_CALC_FOUND_ROWS * FROM `%s` LIMIT %s, %s',
|
||||
$tableName,
|
||||
$offset,
|
||||
$limit
|
||||
);
|
||||
$this->view->data = $this->_db->query($query);
|
||||
}
|
||||
$this->view->table = $tableName;
|
||||
$this->view->tables = $tables;
|
||||
$this->view->database = $dbName;
|
||||
$this->view->offset = $offset;
|
||||
$this->render('tables/show-table-data');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new table for the selected database
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createTableAction()
|
||||
{
|
||||
$this->render('tables/create-table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of records
|
||||
*
|
||||
* //TODO unused at this moment - need to decide if we use this for
|
||||
* table information schema, because showing the nr of records takes too
|
||||
* long if done in one page request!
|
||||
* //TODO create clean http headers for response
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxShowRecordcountAction()
|
||||
{
|
||||
Zend_Layout::getMvcInstance()->disableLayout();
|
||||
Zend_Controller_Front::getInstance()->setParam('noViewRenderer', true);
|
||||
$dbName = $this->_getParam('dbName');
|
||||
$tableName = $this->_getParam('tableName');
|
||||
$records = $this->_db->getNrOfRowsBySelectCount($tableName, $dbName);
|
||||
echo $records;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new database
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createDatabaseAction()
|
||||
{
|
||||
$this->_helper->viewRenderer('databases/create-database');
|
||||
$collations = $this->_db->getCollations();
|
||||
$this->view->charsets = array_keys($collations);
|
||||
$this->view->collations = $collations;
|
||||
$this->view->defaultCollations = $this->_db->getDefaultCollations();
|
||||
$defaults = array(
|
||||
'dbName' => '',
|
||||
'dbCharset' => 'utf8',
|
||||
'dbCollation' => 'utf8_general_ci',
|
||||
);
|
||||
$newDbInfo = $this->_request->getParam('newDbInfo', $defaults);
|
||||
if ($this->_request->isPost()) {
|
||||
$errorInfo = array();
|
||||
try {
|
||||
$dbCreated = $this->_db->createDatabase(
|
||||
$newDbInfo['dbName'],
|
||||
$newDbInfo['dbCharset'],
|
||||
$newDbInfo['dbCollation']
|
||||
);
|
||||
if (!$dbCreated) {
|
||||
$errorInfo = $this->_db->getLastError();
|
||||
} else {
|
||||
//db created - refresh db list for menu
|
||||
$this->view->config->set(
|
||||
'dynamic.dbActual',
|
||||
$newDbInfo['dbName']
|
||||
);
|
||||
$this->_refreshDbList('create.database');
|
||||
}
|
||||
} catch (Msd_Exception $e) {
|
||||
$dbCreated = false;
|
||||
$errorInfo = array(
|
||||
'code' => $e->getCode(),
|
||||
'message' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
$this->view->dbCreated = $dbCreated;
|
||||
$this->view->errorInfo = $errorInfo;
|
||||
|
||||
}
|
||||
$this->view->newDbInfo = $newDbInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops databases and set a result array for the view renderer.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function dropDatabaseAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
if ($this->_request->isPost()) {
|
||||
//selection of db names given
|
||||
$databases = $this->_request->getParam('dbNames', array());
|
||||
$databases = array_map('base64_decode', $databases);
|
||||
} else {
|
||||
//link for one db clicked
|
||||
$databases = $this->_request->getParam('dbName', '');
|
||||
if ($databases == '') {
|
||||
return;
|
||||
}
|
||||
$databases = base64_decode($databases);
|
||||
}
|
||||
$databaseModel = new Application_Model_Databases($this->_db);
|
||||
$dropResults = $databaseModel->dropDatabases($databases);
|
||||
$this->view->actionResults = $dropResults;
|
||||
$this->view->executedAction = 'L_DELETE_DATABASE';
|
||||
$this->_refreshDbList();
|
||||
$this->_forward('index', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncates (empties) a database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function truncateDatabaseAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$databases = $this->_request->getParam('dbNames', array());
|
||||
$databases = array_map('base64_decode', $databases);
|
||||
if (!empty($databases)) {
|
||||
$databaseModel = new Application_Model_Databases($this->_db);
|
||||
$truncateResult = array();
|
||||
foreach ($databases as $database) {
|
||||
$res = $databaseModel->truncateDatabase($database);
|
||||
$truncateResult = array_merge($truncateResult, $res);
|
||||
}
|
||||
$this->view->actionResults = $truncateResult;
|
||||
$this->view->executedAction = 'L_SQL_EMPTYDB';
|
||||
}
|
||||
$this->_forward('index', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimize selected tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function optimizeTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$tables = $this->_request->getParam('tables', array());
|
||||
$optimizeResults = array();
|
||||
$this->view->action = $this->view->lang->L_OPTIMIZE;
|
||||
$database = $this->view->config->get('dynamic.dbActual');
|
||||
$this->_db->selectDb($database);
|
||||
if ($this->_request->isPost() && !empty($tables)) {
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
$optimizeResults[] = $this->_db->optimizeTable($tableName);
|
||||
}
|
||||
|
||||
$this->view->actionResult = $optimizeResults;
|
||||
}
|
||||
$this->view->selectedTables = $tables;
|
||||
$this->_forward('show.tables', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyze selected tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function analyzeTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$tables = $this->_request->getParam('tables', array());
|
||||
$analyzeResults = array();
|
||||
$this->view->action = $this->view->lang->L_ANALYZE;
|
||||
$database = $this->view->config->get('dynamic.dbActual');
|
||||
$this->_db->selectDb($database);
|
||||
if ($this->_request->isPost() && !empty($tables)) {
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
$analyzeResults[] = $this->_db->analyzeTable($tableName);
|
||||
}
|
||||
|
||||
$this->view->actionResult = $analyzeResults;
|
||||
}
|
||||
$this->view->selectedTables = $tables;
|
||||
$this->_forward('show.tables', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check selected tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$tables = $this->_request->getParam('tables', array());
|
||||
$analyzeResults = array();
|
||||
$this->view->action = $this->view->lang->L_ANALYZE;
|
||||
$database = $this->view->config->get('dynamic.dbActual');
|
||||
$this->_db->selectDb($database);
|
||||
if ($this->_request->isPost() && !empty($tables)) {
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
$analyzeResults[] = $this->_db->checkTable($tableName);
|
||||
}
|
||||
|
||||
$this->view->actionResult = $analyzeResults;
|
||||
}
|
||||
$this->view->selectedTables = $tables;
|
||||
$this->_forward('show.tables', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Repair selected tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function repairTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$tables = $this->_request->getParam('tables', array());
|
||||
$analyzeResults = array();
|
||||
$this->view->action = $this->view->lang->L_ANALYZE;
|
||||
$database = $this->view->config->get('dynamic.dbActual');
|
||||
$this->_db->selectDb($database);
|
||||
if ($this->_request->isPost() && !empty($tables)) {
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
$analyzeResults[] = $this->_db->repairTable($tableName);
|
||||
}
|
||||
|
||||
$this->view->actionResult = $analyzeResults;
|
||||
}
|
||||
$this->view->selectedTables = $tables;
|
||||
$this->_forward('show.tables', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncate selected tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function emptyTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$tables = $this->_request->getParam('tables', array());
|
||||
$truncateResults = array();
|
||||
$this->view->action = $this->view->lang->L_TRUNCATE;
|
||||
$database = $this->view->config->get('dynamic.dbActual');
|
||||
$this->_db->selectDb($database);
|
||||
if ($this->_request->isPost() && !empty($tables)) {
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
$res = $this->_db->truncateTable($tableName);
|
||||
}
|
||||
$this->view->actionResult = $truncateResults;
|
||||
}
|
||||
$this->view->selectedTables = $tables;
|
||||
$this->_forward('show.tables', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show sqlbox and handel queries
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sqlboxAction()
|
||||
{
|
||||
$this->_helper->viewRenderer('sqlbox/sqlbox');
|
||||
$sqlboxModel = new Application_Model_Sqlbox();
|
||||
$this->view->tableSelectBox = $sqlboxModel->getTableSelectBox();
|
||||
$request = $this->getRequest();
|
||||
$config = $this->view->config;
|
||||
$query = '';
|
||||
if ($lastQuery = $config->get('dynamic.sqlboxQuery')) {
|
||||
$query = $lastQuery;
|
||||
}
|
||||
if ($request->isPost()) {
|
||||
$query = $request->getParam('sqltextarea', '');
|
||||
$config->set('dynamic.sqlboxQuery', $query);
|
||||
$query = trim($query);
|
||||
if ($query > '') {
|
||||
$parser = new Msd_Sqlparser($query);
|
||||
$query = $parser->parse();
|
||||
$this->_db->selectDb($config->get('dynamic.dbActual'));
|
||||
try {
|
||||
$res = $this->_db->query($query, Msd_Db::ARRAY_ASSOC);
|
||||
$this->view->resultset = $res;
|
||||
} catch (Exception $e) {
|
||||
$this->view->errorMessage = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_setDynamicParams();
|
||||
$this->view->boxcontent = $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload database list after deleting or adding database(s)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _refreshDbList()
|
||||
{
|
||||
$databases = $this->_db->getDatabaseNames();
|
||||
$this->view->config->set('dynamic.databases', $databases);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set actual database and table
|
||||
*
|
||||
* @param bool|string $dbActual The actually selected database
|
||||
* @param string $tableActual The actually selected table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _setDynamicParams($dbActual = false, $tableActual = '')
|
||||
{
|
||||
if ($dbActual === false) {
|
||||
$dbActual = $this->view->config->get('dynamic.dbActual');
|
||||
}
|
||||
$this->view->config->set('dynamic.dbActual', $dbActual);
|
||||
$this->view->config->set('dynamic.tableActual', $tableActual);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get get/post params and set them to dynamic config
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _getDynamicParams()
|
||||
{
|
||||
$params = $this->_request->getParams();
|
||||
if (isset($params['dbName'])) {
|
||||
$dbName = base64_decode($params['dbName']);
|
||||
$this->view->config->set('dynamic.dbActual', $dbName);
|
||||
}
|
||||
|
||||
if (isset($params['tableName'])) {
|
||||
$dbName = base64_decode($params['tableName']);
|
||||
$this->view->config->set('dynamic.tableActual', $dbName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
145
application/controllers/SqlServerController.php
Normale Datei
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Sqlserver Controller
|
||||
*
|
||||
* Controller to handle actions an SQLBrowser screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class SqlServerController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Init
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->db = Msd_Db::getAdapter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Index action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_forward('show.variables');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show list of MySQL Variables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showVariablesAction()
|
||||
{
|
||||
$selectedGroup = $this->getRequest()->getParam('group', '');
|
||||
$variables = $this->db->getVariables();
|
||||
$groups = Msd_Html::getPrefixArray($variables);
|
||||
$this->view->groupOptions =
|
||||
Msd_Html::getHtmlOptions($groups, $selectedGroup);
|
||||
if ($selectedGroup > '') {
|
||||
foreach ($variables as $key => $val) {
|
||||
if (substr($key, 0, strlen($selectedGroup)) != $selectedGroup) {
|
||||
unset($variables[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->view->variables = $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show status values of MySQL-Server
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showStatusAction()
|
||||
{
|
||||
$selectedGroup = $this->getRequest()->getParam('group', '');
|
||||
$variables = $this->db->getGlobalStatus();
|
||||
$groups = Msd_Html::getPrefixArray($variables);
|
||||
$this->view->groupOptions =
|
||||
Msd_Html::getHtmlOptions($groups, $selectedGroup);
|
||||
if ($selectedGroup > '') {
|
||||
foreach ($variables as $key => $val) {
|
||||
if (substr($key, 0, strlen($selectedGroup)) != $selectedGroup) {
|
||||
unset($variables[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->view->variables = $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show process list
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showProcesslistAction()
|
||||
{
|
||||
$this->getProcesslistAction(false);
|
||||
$interval = $this->view->config
|
||||
->get('config.interface.refreshProcesslist');
|
||||
if ($interval < 2) {
|
||||
$interval = 2;
|
||||
}
|
||||
$this->view->interval = $interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render process list
|
||||
*
|
||||
* @param boolean $disableLayout Whether to disable the layout
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getProcesslistAction($disableLayout = true)
|
||||
{
|
||||
if ($disableLayout) {
|
||||
$this->_helper->layout()->disableLayout();
|
||||
}
|
||||
$processes = $this->db->query('SHOW PROCESSLIST', Msd_Db::ARRAY_ASSOC);
|
||||
$this->view->processes = $processes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render process list
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function killProcessAction()
|
||||
{
|
||||
$processId = $this->getRequest()->getParam('processId', 0);
|
||||
try {
|
||||
$this->db->query('KILL ' . $processId, Msd_Db::ARRAY_ASSOC);
|
||||
} catch (Msd_Exception $e) {
|
||||
//echo $e->getMessage().' '.$e->getCode();
|
||||
//TODO return message to client
|
||||
}
|
||||
$this->_forward('show.processlist');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all known character sets
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showCharsetsAction()
|
||||
{
|
||||
$this->view->collations = $this->db->getCollations();
|
||||
$this->view->charsets = $this->db->getCharsets();
|
||||
}
|
||||
}
|
||||
|
585
application/forms/Config/Email.php
Normale Datei
|
@ -0,0 +1,585 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Forms_Config
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create form to input e-mail data in configuration
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Forms_Config
|
||||
*/
|
||||
class Application_Form_Config_Email extends Zend_Form_SubForm
|
||||
{
|
||||
/**
|
||||
* Language translator
|
||||
* @var Msd_Language
|
||||
*/
|
||||
protected $_lang;
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
* @var Msd_Configuration
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* Add elements to form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->_config = Msd_Configuration::getInstance();
|
||||
$this->_lang = Msd_Language::getInstance();
|
||||
$this->setDisableLoadDefaultDecorators(true);
|
||||
$this->setDecorators(array('SubForm'));
|
||||
$this->addDisplayGroupPrefixPath(
|
||||
'Msd_Form_Decorator',
|
||||
'Msd/Form/Decorator/'
|
||||
);
|
||||
$this->setDisplayGroupDecorators(array('DisplayGroup'));
|
||||
$this->_addActivateButton();
|
||||
$this->_addSender();
|
||||
$this->_addRecipient();
|
||||
$this->_addButtonAddRecipientCc();
|
||||
|
||||
// add Recipients CC
|
||||
$ccElements = $this->_setRecipientCc(
|
||||
$this->_config->get('config.email.RecipientCc')
|
||||
);
|
||||
|
||||
$this->_addAttachement();
|
||||
$this->_addEmailProgram();
|
||||
|
||||
// create and add display group
|
||||
$elements = array(
|
||||
'sendEmail',
|
||||
'SenderAddress',
|
||||
'SenderName',
|
||||
'RecipientAddress',
|
||||
'RecipientName',
|
||||
'AddCc');
|
||||
// add cc-recipients
|
||||
if (count($ccElements)>0) {
|
||||
$elements = array_merge(
|
||||
$elements,
|
||||
$ccElements
|
||||
);
|
||||
}
|
||||
$elements = array_merge(
|
||||
$elements,
|
||||
array(
|
||||
'attachBackup',
|
||||
'Maxsize',
|
||||
'MaxsizeUnit',
|
||||
'Program'
|
||||
)
|
||||
);
|
||||
$this->addDisplayGroup(
|
||||
$elements,
|
||||
'email',
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('DisplayGroup'),
|
||||
'legend' => $this->_lang->getTranslator()->_('L_CONFIG_EMAIL')
|
||||
)
|
||||
);
|
||||
|
||||
$elements = array(
|
||||
'SendmailCall'
|
||||
);
|
||||
$this->addDisplayGroup(
|
||||
$elements,
|
||||
'sendmailConfig',
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('DisplayGroup'),
|
||||
'legend' => $this->_lang->getTranslator()->_('L_SENDMAIL'),
|
||||
'class' => 'sendmailConfig',
|
||||
)
|
||||
);
|
||||
|
||||
$elements = array(
|
||||
'SMTPHost',
|
||||
'SMTPPort',
|
||||
'SMTPUserAuth',
|
||||
'SMTPUser',
|
||||
'SMTPPassword',
|
||||
'SMTPUseSSL',
|
||||
);
|
||||
$this->addDisplayGroup(
|
||||
$elements,
|
||||
'smtpConfig',
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('DisplayGroup'),
|
||||
'legend' => $this->_lang->getTranslator()->_('L_SMTP'),
|
||||
'class' => 'smtpConfig',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add e-mail activate button to form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addActivateButton()
|
||||
{
|
||||
//Button send email
|
||||
$this->addElement(
|
||||
'radio',
|
||||
'sendEmail',
|
||||
array(
|
||||
'class' => 'radio toggler',
|
||||
'label' => 'L_SEND_MAIL_FORM',
|
||||
'onclick' => "myToggle(this, 'y', 'emailToggle');",
|
||||
'listsep' => ' ',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'multiOptions' => array(
|
||||
'y' => 'L_YES',
|
||||
'n' => 'L_NO',
|
||||
),
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Add Cc-Recipients
|
||||
*
|
||||
* @param array $configRecipientCc All Cc-Recipients
|
||||
*
|
||||
* @return array Element names to add to display group
|
||||
*/
|
||||
private function _setRecipientCc($recipientsCc)
|
||||
{
|
||||
if ($recipientsCc === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (count($recipientsCc) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$elements = array();
|
||||
//$i = 0;
|
||||
foreach ($recipientsCc as $i => $recipient) {
|
||||
//Recipient CC email
|
||||
$this->addElement(
|
||||
'text',
|
||||
'RecipientCc_'.$i.'_Address',
|
||||
array(
|
||||
'class' => 'text emailToggle',
|
||||
'label' => 'L_EMAIL_CC',
|
||||
'listsep' => ' ',
|
||||
'size' => 30,
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('LineStart'),
|
||||
'validators' => array('EmailAddress'),
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
//CC name
|
||||
$this->addElement(
|
||||
'text',
|
||||
'RecipientCc_'.$i.'_Name',
|
||||
array(
|
||||
'class' => 'text emailToggle',
|
||||
'label' => 'L_NAME',
|
||||
'listsep' => ' ',
|
||||
'size' => 30,
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('LineMiddle'),
|
||||
)
|
||||
);
|
||||
|
||||
//button delete recipient
|
||||
$confirmDelete = sprintf(
|
||||
$this->_lang->getTranslator()->_('L_CONFIRM_RECIPIENT_DELETE'),
|
||||
$recipient['Name']
|
||||
);
|
||||
$confirmDelete = Msd_Html::getJsQuote($confirmDelete, true);
|
||||
$this->addElement(
|
||||
'button',
|
||||
'DeleteCc_'.$i,
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'content' =>
|
||||
$this->getView()->getIcon('delete') . ' ' .
|
||||
$this->_lang->getTranslator()->_('L_DELETE'),
|
||||
'decorators' => array('LineEnd'),
|
||||
'escape' => false,
|
||||
'label' => '',
|
||||
'class' => 'Formbutton emailToggle',
|
||||
'onclick' =>
|
||||
'if (!confirm(\'Ha\')) return false;'
|
||||
.' deleteEmailReciptientCc(\'' . $i .'\');',
|
||||
)
|
||||
);
|
||||
|
||||
$elements = array_merge(
|
||||
$elements,
|
||||
array(
|
||||
'RecipientCc_'.$i.'_Address',
|
||||
'RecipientCc_'.$i.'_Name',
|
||||
'DeleteCc_'.$i,
|
||||
)
|
||||
);
|
||||
$i++;
|
||||
}
|
||||
return $elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds line with sender inputs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addSender()
|
||||
{
|
||||
//Sender email
|
||||
$this->addElement(
|
||||
'text',
|
||||
'SenderAddress',
|
||||
array(
|
||||
'class' => 'text emailToggle',
|
||||
'label' => 'L_EMAIL_SENDER',
|
||||
'size' => 30,
|
||||
'listsep' => ' ',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('LineStart'),
|
||||
'validators' => array(
|
||||
new Zend_Validate_NotEmpty(Zend_Validate_NotEmpty::STRING),
|
||||
'EmailAddress'
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
//Sender name
|
||||
$this->addElement(
|
||||
'text',
|
||||
'SenderName',
|
||||
array(
|
||||
'class' => 'text emailToggle',
|
||||
'label' => 'L_NAME',
|
||||
'size' => 30,
|
||||
'listsep' => ' ',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('LineEnd'),
|
||||
'validators' => array('NotEmpty'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add button to add a cc-recipient
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addButtonAddRecipientCc()
|
||||
{
|
||||
$this->addElement(
|
||||
'button',
|
||||
'AddCc',
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'content' =>
|
||||
$this->getView()->getIcon('plus') . ' ' .
|
||||
$this->_lang->getTranslator()->_('L_ADD_RECIPIENT'),
|
||||
'decorators' => array('Default'),
|
||||
'escape' => false,
|
||||
'label' => '',
|
||||
'class' => 'Formbutton emailToggle',
|
||||
'onclick' => "addEmailReciptientCc();",
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Add line with recipient name and e-mail
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addRecipient()
|
||||
{
|
||||
|
||||
//Recipient email
|
||||
$this->addElement(
|
||||
'text',
|
||||
'RecipientAddress',
|
||||
array(
|
||||
'class' => 'text emailToggle',
|
||||
'label' => 'L_EMAIL_RECIPIENT',
|
||||
'size' => 30,
|
||||
'listsep' => ' ',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('LineStart'),
|
||||
'validators' => array('EmailAddress'),
|
||||
)
|
||||
);
|
||||
|
||||
//Recipient name
|
||||
$this->addElement(
|
||||
'text',
|
||||
'RecipientName',
|
||||
array(
|
||||
'class' => 'text emailToggle',
|
||||
'label' => 'L_NAME',
|
||||
'size' => 30,
|
||||
'listsep' => ' ',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('LineEnd'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add line attachement and -size to form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addAttachement()
|
||||
{
|
||||
|
||||
//Attach backup
|
||||
$this->addElement(
|
||||
'radio',
|
||||
'attachBackup',
|
||||
array(
|
||||
'class' => 'radio emailToggle toggler',
|
||||
'label' => 'L_ATTACH_BACKUP',
|
||||
'onclick' => "myToggle(this, 'y', 'attachToggle');",
|
||||
'listsep' => ' ',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'multiOptions' => array(
|
||||
'y' => 'L_YES',
|
||||
'n' => 'L_NO',
|
||||
),
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
|
||||
//Max filesize
|
||||
$this->addElement(
|
||||
'text',
|
||||
'Maxsize',
|
||||
array(
|
||||
'class' => 'text right emailToggle attachToggle',
|
||||
'size' => 6,
|
||||
'maxlength' => 6,
|
||||
'label' => 'L_EMAIL_MAXSIZE',
|
||||
'listsep' => ' ',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('LineStart'),
|
||||
'validators' => array('Digits'),
|
||||
)
|
||||
);
|
||||
|
||||
//Max filesize unit
|
||||
$this->addElement(
|
||||
'select',
|
||||
'MaxsizeUnit',
|
||||
array(
|
||||
'class' => 'select emailToggle attachToggle',
|
||||
'listsep' => ' ',
|
||||
'multiOptions' => array(
|
||||
'kb' => 'L_UNIT_KB',
|
||||
'mb' => 'L_UNIT_MB',
|
||||
),
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('LineEnd'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add select for e-mail program
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addEmailProgram()
|
||||
{
|
||||
//Mail program
|
||||
$this->addElement(
|
||||
'select',
|
||||
'Program',
|
||||
array(
|
||||
'class' => 'select emailToggle',
|
||||
'label' => 'L_MAILPROGRAM',
|
||||
'id' => 'toggleEmailSettings',
|
||||
'listsep' => ' ',
|
||||
'multiOptions' => array(
|
||||
'php' => 'L_PHPMAIL',
|
||||
'sendmail' => 'L_SENDMAIL',
|
||||
'smtp' => 'L_SMTP'
|
||||
),
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('Default'),
|
||||
'onchange' => 'toggleEmailProgram();',
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'text',
|
||||
'SendmailCall',
|
||||
array(
|
||||
'class' => 'text',
|
||||
'label' => $this->_lang->getTranslator()->_('L_CALL'),
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'text',
|
||||
'SMTPHost',
|
||||
array(
|
||||
'class' => 'text',
|
||||
'label' => $this->_lang->getTranslator()->_('L_SMTP_HOST'),
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'text',
|
||||
'SMTPPort',
|
||||
array(
|
||||
'class' => 'text',
|
||||
'label' => $this->_lang->getTranslator()->_('L_SMTP_PORT'),
|
||||
'validators' => array('Digits'),
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'radio',
|
||||
'SMTPUserAuth',
|
||||
array(
|
||||
'class' => 'radio toggler',
|
||||
'label' => $this->_lang->getTranslator()->_('L_AUTHORIZE'),
|
||||
'listsep' => ' ',
|
||||
'multiOptions' => array(
|
||||
'y' => 'L_YES',
|
||||
'n' => 'L_NO',
|
||||
),
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('Default'),
|
||||
'onclick' => "myToggle(this, 'y', 'SMTPAuthToggle');",
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'text',
|
||||
'SMTPUser',
|
||||
array(
|
||||
'class' => 'text SMTPAuthToggle',
|
||||
'label' => $this->_lang->getTranslator()->_('L_USERNAME'),
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('Default'),
|
||||
'rowclass' => 'SMTPAuth',
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'text',
|
||||
'SMTPPassword',
|
||||
array(
|
||||
'class' => 'text SMTPAuthToggle',
|
||||
'label' => $this->_lang->getTranslator()->_('L_PASSWORD'),
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('Default'),
|
||||
'rowclass' => 'SMTPAuth',
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'radio',
|
||||
'SMTPUseSSL',
|
||||
array(
|
||||
'class' => 'radio',
|
||||
'label' => $this->_lang->getTranslator()->_('L_USE_SSL'),
|
||||
'listsep' => ' ',
|
||||
'multiOptions' => array(
|
||||
'y' => 'L_YES',
|
||||
'n' => 'L_NO',
|
||||
),
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts an multi array from flat element names and values
|
||||
*
|
||||
* @param array $data The values to extract index and values from
|
||||
*
|
||||
* @return array The converted array
|
||||
*/
|
||||
public function getValidValues($data)
|
||||
{
|
||||
$values = parent::getValidValues($data, true);
|
||||
$newArray = array();
|
||||
while (false !== (list($key, $value) = each($values))) {
|
||||
if (substr($key, 0, 18) != 'email_RecipientCc_') {
|
||||
continue;
|
||||
}
|
||||
list($prefix, $index, $fieldKey) = explode('_', $key);
|
||||
if (!isset($values['email_Recipient'])) {
|
||||
$values[$prefix] = array();
|
||||
}
|
||||
if (!isset($newArray[$index])) {
|
||||
$newArray[$index] = array();
|
||||
}
|
||||
$newArray[$index][$fieldKey] = $value;
|
||||
unset($values[$key]);
|
||||
}
|
||||
|
||||
$values['email_RecipientCc'] = array_values($newArray);
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default values
|
||||
*
|
||||
* @param $defaults
|
||||
*
|
||||
* @return Zend_Form
|
||||
*/
|
||||
public function setDefaults($defaults)
|
||||
{
|
||||
if (isset($defaults['email']['RecipientCc'])) {
|
||||
$recipientCc = array();
|
||||
while (false !== (list($recipientCcId, $recipientCcData) =
|
||||
each($defaults['email']['RecipientCc']))) {
|
||||
foreach ($recipientCcData as $key => $value) {
|
||||
$recipientCc['RecipientCc_' .
|
||||
$recipientCcId . '_' . $key] = $value;
|
||||
}
|
||||
}
|
||||
unset($defaults['email']['RecipientCc']);
|
||||
$defaults['email'] = array_merge(
|
||||
$defaults['email'],
|
||||
$recipientCc
|
||||
);
|
||||
}
|
||||
return parent::setDefaults($defaults);
|
||||
}
|
||||
/**
|
||||
* Set input default value
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDefault($name, $value)
|
||||
{
|
||||
$name = str_replace('.', '_', $name);
|
||||
parent::setDefault($name, $value);
|
||||
}
|
||||
|
||||
}
|
398
application/forms/Config/Ftp.php
Normale Datei
|
@ -0,0 +1,398 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Forms_Config
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create form to input ftp data on configuration screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Forms_Config
|
||||
*/
|
||||
class Application_Form_Config_Ftp extends Zend_Form_SubForm
|
||||
{
|
||||
/**
|
||||
* Msd Translator
|
||||
* @var Msd_Language
|
||||
*/
|
||||
protected $_lang;
|
||||
/**
|
||||
* Init form and add all elements
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$this->_lang = Msd_Language::getInstance();
|
||||
$this->setDisableLoadDefaultDecorators(true);
|
||||
$this->setDecorators(array('SubForm'));
|
||||
$this->addDisplayGroupPrefixPath(
|
||||
'Msd_Form_Decorator',
|
||||
'Msd/Form/Decorator/'
|
||||
);
|
||||
$this->setDisplayGroupDecorators(array('DisplayGroup'));
|
||||
$this->_addButtonFtpAdd();
|
||||
|
||||
$ftpConfig = $config->get('config.ftp');
|
||||
$ftpKeys = array_keys($ftpConfig);
|
||||
foreach ($ftpKeys as $ftpConnectionId) {
|
||||
$this->_addRadioActivated($ftpConnectionId);
|
||||
$this->_addInputTimeout($ftpConnectionId);
|
||||
$this->_addCheckboxPassiveMode($ftpConnectionId);
|
||||
$this->_addCheckboxSsl($ftpConnectionId);
|
||||
$this->_addInputServerAndPort($ftpConnectionId);
|
||||
$this->_addInputUserAndPass($ftpConnectionId);
|
||||
$this->_addInputPath($ftpConnectionId);
|
||||
$this->_addButtonsTestAndDelete($ftpConnectionId);
|
||||
|
||||
$legend = $this->_lang->getTranslator()->_('L_FTP_CONNECTION')
|
||||
. ' ' . ($ftpConnectionId + 1);
|
||||
$this->addDisplayGroup(
|
||||
array(
|
||||
'ftp_' . $ftpConnectionId . '_use',
|
||||
'ftp_' . $ftpConnectionId . '_timeout',
|
||||
'ftp_' . $ftpConnectionId . '_passiveMode',
|
||||
'ftp_' . $ftpConnectionId . '_ssl',
|
||||
'ftp_' . $ftpConnectionId . '_server',
|
||||
'ftp_' . $ftpConnectionId . '_port',
|
||||
'ftp_' . $ftpConnectionId . '_user',
|
||||
'ftp_' . $ftpConnectionId . '_pass',
|
||||
'ftp_' . $ftpConnectionId . '_dir',
|
||||
'ftpCheck' . $ftpConnectionId,
|
||||
'ftpDelete' . $ftpConnectionId,
|
||||
),
|
||||
'ftp' . $ftpConnectionId,
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('DisplayGroup'),
|
||||
'legend' => $legend,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add button "Add ftp connection"
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addButtonFtpAdd()
|
||||
{
|
||||
$this->addElement(
|
||||
'button',
|
||||
'headElement',
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'content' =>
|
||||
$this->getView()->getIcon('plus') . ' ' .
|
||||
$this->_lang->getTranslator()->_('L_FTP_ADD_CONNECTION'),
|
||||
'decorators' => array('Default'),
|
||||
'escape' => false,
|
||||
'label' => '',
|
||||
'class' => 'Formbutton',
|
||||
'onclick' => "addFtpConnection();",
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add radio "ftp activated"
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addRadioActivated($index)
|
||||
{
|
||||
$this->addElement(
|
||||
'radio',
|
||||
'ftp_' . $index . '_use',
|
||||
array(
|
||||
'class' => 'radio toggler',
|
||||
'label' => 'L_FTP_TRANSFER',
|
||||
'onclick' => "myToggle(this, 'y', 'ftpToggle" . $index . "');",
|
||||
'listsep' => ' ',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'multiOptions' => array(
|
||||
'y' => 'L_ACTIVATED',
|
||||
'n' => 'L_NOT_ACTIVATED',
|
||||
),
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add input "ftp timeout"
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addInputTimeout($index)
|
||||
{
|
||||
$this->addElement(
|
||||
'text',
|
||||
'ftp_' . $index . '_timeout',
|
||||
array(
|
||||
'class' => 'text ftpToggle' . $index,
|
||||
'label' => 'L_FTP_TIMEOUT',
|
||||
'secondLabel' => 'L_SECONDS',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'size' => 3,
|
||||
'maxlength' => 3,
|
||||
'decorators' => array('DoubleLabel'),
|
||||
'validators' => array('Digits'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add checkbox "passive mode"
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addCheckboxPassiveMode($index)
|
||||
{
|
||||
$this->addElement(
|
||||
'checkbox',
|
||||
'ftp_' . $index . '_passiveMode',
|
||||
array(
|
||||
'class' => 'checkbox ftpToggle' . $index,
|
||||
'label' => 'L_FTP_CHOOSE_MODE',
|
||||
'secondLabel' => 'L_FTP_PASSIVE',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'checkedValue' => 'y',
|
||||
'uncheckedValue' => 'n',
|
||||
'decorators' => array('DoubleLabel'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add checkbox "ssl"
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addCheckboxSsl($index)
|
||||
{
|
||||
$this->addElement(
|
||||
'checkbox',
|
||||
'ftp_' . $index . '_ssl',
|
||||
array(
|
||||
'class' => 'checkbox ftpToggle' . $index,
|
||||
'label' => 'L_FTP_SSL',
|
||||
'secondLabel' => 'L_FTP_USESSL',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'checkedValue' => 'y',
|
||||
'uncheckedValue' => 'n',
|
||||
'decorators' => array('DoubleLabel'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add input "server"
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addInputServerAndPort($index)
|
||||
{
|
||||
$this->addElement(
|
||||
'text',
|
||||
'ftp_' . $index . '_server',
|
||||
array(
|
||||
'class' => 'text ftpToggle' . $index,
|
||||
'label' => 'L_FTP_SERVER',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'text',
|
||||
'ftp_' . $index . '_port',
|
||||
array(
|
||||
'class' => 'text ftpToggle' . $index,
|
||||
'label' => 'L_FTP_PORT',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'size' => 4,
|
||||
'maxlength' => 5,
|
||||
'validators' => array('Digits'),
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Add input "user"
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addInputUserAndPass($index)
|
||||
{
|
||||
$this->addElement(
|
||||
'text',
|
||||
'ftp_' . $index . '_user',
|
||||
array(
|
||||
'class' => 'text ftpToggle' . $index,
|
||||
'label' => 'L_FTP_USER',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'size' => 60,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'password',
|
||||
'ftp_' . $index . '_pass',
|
||||
array(
|
||||
'class' => 'text ftpToggle' . $index,
|
||||
'label' => 'L_FTP_PASS',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'size' => 60,
|
||||
'decorators' => array('Default'),
|
||||
'renderPassword' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add input server
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addInputPath($index)
|
||||
{
|
||||
$this->addElement(
|
||||
'text',
|
||||
'ftp_' . $index . '_dir',
|
||||
array(
|
||||
'class' => 'text ftpToggle' . $index,
|
||||
'label' => 'L_DIR',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'size' => 60,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Button "Test connection"
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addButtonsTestAndDelete($index)
|
||||
{
|
||||
$this->addElement(
|
||||
'button',
|
||||
'ftpCheck' . $index,
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'content' =>
|
||||
$this->getView()->getIcon('Connect', '', 16) . ' ' .
|
||||
$this->_lang->getTranslator()->_('L_TESTCONNECTION'),
|
||||
'decorators' => array('LineStart'),
|
||||
'escape' => false,
|
||||
'label' => '',
|
||||
'class' => 'Formbutton ftpToggle' . $index,
|
||||
'onclick' => "alert('checkConnection(" .
|
||||
$index . ")');",
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'button',
|
||||
'ftpDelete' . $index,
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'content' =>
|
||||
$this->getView()->getIcon('delete') . ' ' .
|
||||
$this->_lang->getTranslator()->_('L_FTP_CONNECTION_DELETE'),
|
||||
'decorators' => array('LineEnd'),
|
||||
'escape' => false,
|
||||
'label' => '',
|
||||
'class' => 'Formbutton',
|
||||
'onclick' => "deleteFtpConnection(" .
|
||||
$index . ");",
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get valid values
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getValidValues($data)
|
||||
{
|
||||
$values = parent::getValidValues($data, true);
|
||||
while (false !== (list($key, $value) = each($values))) {
|
||||
if (substr($key, 0, 4) != 'ftp_') {
|
||||
continue;
|
||||
}
|
||||
list(, $ftpId, $ftpKey) = explode('_', $key);
|
||||
if (!isset($values[$ftpId])) {
|
||||
$values[$ftpId] = array();
|
||||
}
|
||||
$values[$ftpId][$ftpKey] = $value;
|
||||
unset($values[$key]);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default values
|
||||
*
|
||||
* @param array $defaults
|
||||
*
|
||||
* @return Zend_Form
|
||||
*/
|
||||
public function setDefaults($defaults)
|
||||
{
|
||||
if (!empty($defaults['ftp'])) {
|
||||
$ftp = array();
|
||||
while (
|
||||
false !== (list($ftpId, $ftpData) = each($defaults['ftp']))
|
||||
) {
|
||||
foreach ($ftpData as $ftpKey => $ftpValue) {
|
||||
$ftp['ftp_' . $ftpId . '_' . $ftpKey] = $ftpValue;
|
||||
}
|
||||
}
|
||||
$defaults['ftp'] = $ftp;
|
||||
}
|
||||
return parent::setDefaults($defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set input default value
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*/
|
||||
public function setDefault($name, $value)
|
||||
{
|
||||
$name = 'ftp_'.str_replace('.', '_', $name);
|
||||
parent::setDefault($name, $value);
|
||||
}
|
||||
}
|
35
application/forms/Config/autodelete.ini
Normale Datei
|
@ -0,0 +1,35 @@
|
|||
prefixPath.decorator.path = "Msd/Form/Decorator/"
|
||||
prefixPath.decorator.prefix = "Msd_Form_Decorator"
|
||||
decorators.subform.decorator = SubForm
|
||||
disableLoadDefaultDecorators = true
|
||||
options.id = autodelete
|
||||
;----------------------------------------------------
|
||||
; legend - Auto delete
|
||||
;----------------------------------------------------
|
||||
; Activate AutoDelete
|
||||
elements.Activated.type = radio
|
||||
elements.Activated.options.class = radio toggler
|
||||
elements.Activated.options.label = L_AUTODELETE
|
||||
elements.Activated.options.multiOptions.y = L_YES
|
||||
elements.Activated.options.multiOptions.n = L_NO
|
||||
elements.Activated.options.onclick = "myToggle(this, 'y', 'autodeleteToggle');"
|
||||
elements.Activated.options.listsep = " "
|
||||
elements.Activated.options.decorators.default = Default
|
||||
elements.Activated.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Max Filesize
|
||||
elements.PreserveBackups.type = text
|
||||
elements.PreserveBackups.options.label = L_NUMBER_OF_FILES_FORM
|
||||
elements.PreserveBackups.options.secondLabel = L_BACKUPS
|
||||
elements.PreserveBackups.options.class = text right autodeleteToggle
|
||||
elements.PreserveBackups.options.size = 3
|
||||
elements.PreserveBackups.options.maxlength = 3
|
||||
elements.PreserveBackups.options.validators.digits = Digits
|
||||
elements.PreserveBackups.options.decorators.default = DoubleLabel
|
||||
elements.PreserveBackups.options.disableLoadDefaultDecorators = true
|
||||
|
||||
displayGroups.autodelete.options.legend = L_CONFIG_AUTODELETE
|
||||
displayGroups.autodelete.options.disableLoadDefaultDecorators = true
|
||||
displayGroups.autodelete.options.decorators.displaygroup.decorator = DisplayGroup
|
||||
displayGroups.autodelete.elements.0 = Activated
|
||||
displayGroups.autodelete.elements.1 = PreserveBackups
|
68
application/forms/Config/cronscript.ini
Normale Datei
|
@ -0,0 +1,68 @@
|
|||
prefixPath.decorator.path = "Msd/Form/Decorator/"
|
||||
prefixPath.decorator.prefix = "Msd_Form_Decorator"
|
||||
elementPrefixPath.validate.prefix = "Msd_Validate"
|
||||
elementPrefixPath.validate.path = "Msd/Validate/"
|
||||
decorators.subform.decorator = SubForm
|
||||
disableLoadDefaultDecorators = true
|
||||
options.id = cronscript
|
||||
;----------------------------------------------------
|
||||
; legend - Perl
|
||||
;----------------------------------------------------
|
||||
; Perl extension
|
||||
elements.perlExtension.type = radio
|
||||
elements.perlExtension.options.class = radio
|
||||
elements.perlExtension.options.label = L_CRON_EXTENDER
|
||||
elements.perlExtension.options.multiOptions.pl = .pl
|
||||
elements.perlExtension.options.multiOptions.cgi = .cgi
|
||||
elements.perlExtension.options.listsep = " "
|
||||
elements.perlExtension.options.decorators.default = Default
|
||||
elements.perlExtension.options.disableLoadDefaultDecorators = true
|
||||
|
||||
; Perl path
|
||||
elements.perlPath.type = text
|
||||
elements.perlPath.options.class = text
|
||||
elements.perlPath.options.label = L_CRON_EXECPATH
|
||||
elements.perlPath.options.size = 60
|
||||
elements.perlPath.options.decorators.default = Default
|
||||
elements.perlPath.options.validators.accessible.validator = File_Accessible
|
||||
elements.perlPath.options.validators.accessible.options.pathPrefix = ""
|
||||
elements.perlPath.options.validators.accessible.options.accessTypes = dir,read
|
||||
elements.perlPath.options.disableLoadDefaultDecorators = true
|
||||
|
||||
; Text output
|
||||
elements.perlTextOutput.type = radio
|
||||
elements.perlTextOutput.options.class = radio
|
||||
elements.perlTextOutput.options.label = L_CRON_PRINTOUT
|
||||
elements.perlTextOutput.options.multiOptions.y = L_ACTIVATED
|
||||
elements.perlTextOutput.options.multiOptions.n = L_NOT_ACTIVATED
|
||||
elements.perlTextOutput.options.listsep = " "
|
||||
elements.perlTextOutput.options.decorators.default = Default
|
||||
elements.perlTextOutput.options.disableLoadDefaultDecorators = true
|
||||
|
||||
; complete text output
|
||||
elements.perlTextOutputComplete.type = radio
|
||||
elements.perlTextOutputComplete.options.class = radio
|
||||
elements.perlTextOutputComplete.options.label = L_CRON_COMPLETELOG
|
||||
elements.perlTextOutputComplete.options.multiOptions.y = L_ACTIVATED
|
||||
elements.perlTextOutputComplete.options.multiOptions.n = L_NOT_ACTIVATED
|
||||
elements.perlTextOutputComplete.options.listsep = " "
|
||||
elements.perlTextOutputComplete.options.decorators.default = Default
|
||||
elements.perlTextOutputComplete.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Comment
|
||||
elements.perlFileComment.type = text
|
||||
elements.perlFileComment.options.class = text
|
||||
elements.perlFileComment.options.label = L_CRON_COMMENT
|
||||
elements.perlFileComment.options.size = 60
|
||||
elements.perlFileComment.options.decorators.default = Default
|
||||
elements.perlFileComment.options.disableLoadDefaultDecorators = true
|
||||
|
||||
displayGroups.email.options.legend = L_CONFIG_CRONPERL
|
||||
displayGroups.email.options.disableLoadDefaultDecorators = true
|
||||
displayGroups.email.options.decorators.displaygroup.decorator = DisplayGroup
|
||||
displayGroups.email.elements.0 = perlExtension
|
||||
displayGroups.email.elements.1 = perlPath
|
||||
displayGroups.email.elements.2 = perlTextOutput
|
||||
displayGroups.email.elements.3 = perlTextOutputComplete
|
||||
displayGroups.email.elements.4 = perlFileComment
|
||||
|
70
application/forms/Config/dbuser.ini
Normale Datei
|
@ -0,0 +1,70 @@
|
|||
prefixPath.decorator.path = "Msd/Form/Decorator/"
|
||||
prefixPath.decorator.prefix = "Msd_Form_Decorator"
|
||||
decorators.subform.decorator = SubForm
|
||||
disableLoadDefaultDecorators = true
|
||||
options.id = dbuser
|
||||
;----------------------------------------------------
|
||||
; legend - db-user
|
||||
;----------------------------------------------------
|
||||
|
||||
; user
|
||||
elements.user.type = text
|
||||
elements.user.options.class = text
|
||||
elements.user.options.label = L_DB_USER
|
||||
elements.user.options.size = 30
|
||||
elements.user.options.decorators.default = Default
|
||||
elements.user.options.disableLoadDefaultDecorators = true
|
||||
|
||||
; password
|
||||
elements.pass.type = password
|
||||
elements.pass.options.class = text
|
||||
elements.pass.options.label = L_DB_PASS
|
||||
elements.pass.options.renderPassword = true;
|
||||
elements.pass.options.decorators.default = Default
|
||||
elements.pass.options.disableLoadDefaultDecorators = true
|
||||
|
||||
; host
|
||||
elements.host.type = text
|
||||
elements.host.options.class = text
|
||||
elements.host.options.label = L_DB_HOST
|
||||
elements.host.options.size = 30
|
||||
elements.host.options.decorators.default = Default
|
||||
elements.host.options.disableLoadDefaultDecorators = true
|
||||
|
||||
; defaultDb
|
||||
elements.defaultDb.type = select
|
||||
elements.defaultDb.options.class = select
|
||||
elements.defaultDb.options.label = L_DB_DEFAULT
|
||||
elements.defaultDb.options.decorators.default = Default
|
||||
elements.defaultDb.options.disableLoadDefaultDecorators = true
|
||||
|
||||
; port
|
||||
elements.port.type = text
|
||||
elements.port.options.label = L_PORT
|
||||
elements.port.options.secondLabel = L_INSTALL_HELP_PORT
|
||||
elements.port.options.class = text
|
||||
elements.port.options.size = 5
|
||||
elements.port.options.maxlength = 5
|
||||
elements.port.options.validators.digits = Digits
|
||||
elements.port.options.decorators.default = DoubleLabel
|
||||
elements.port.options.disableLoadDefaultDecorators = true
|
||||
|
||||
; socket
|
||||
elements.socket.type = text
|
||||
elements.socket.options.label = L_SOCKET
|
||||
elements.socket.options.secondLabel = L_INSTALL_HELP_SOCKET
|
||||
elements.socket.options.class = text
|
||||
elements.socket.options.size = 30
|
||||
elements.socket.options.maxlength = 60
|
||||
elements.socket.options.decorators.default = DoubleLabel
|
||||
elements.socket.options.disableLoadDefaultDecorators = true
|
||||
|
||||
displayGroups.dbuser.options.legend = L_DBPARAMETER
|
||||
displayGroups.dbuser.options.disableLoadDefaultDecorators = true
|
||||
displayGroups.dbuser.options.decorators.displaygroup.decorator = DisplayGroup
|
||||
displayGroups.dbuser.elements.0 = user
|
||||
displayGroups.dbuser.elements.1 = pass
|
||||
displayGroups.dbuser.elements.2 = host
|
||||
displayGroups.dbuser.elements.3 = defaultDb
|
||||
displayGroups.dbuser.elements.4 = port
|
||||
displayGroups.dbuser.elements.5 = socket
|
114
application/forms/Config/email.ini
Normale Datei
|
@ -0,0 +1,114 @@
|
|||
prefixPath.decorator.path = "Msd/Form/Decorator/"
|
||||
prefixPath.decorator.prefix = "Msd_Form_Decorator"
|
||||
decorators.subform.decorator = SubForm
|
||||
disableLoadDefaultDecorators = true
|
||||
options.id = email
|
||||
;----------------------------------------------------
|
||||
; legend - E-Mail
|
||||
;----------------------------------------------------
|
||||
; Send E-Mail
|
||||
elements.sendEmail.type = radio
|
||||
elements.sendEmail.options.class = radio
|
||||
elements.sendEmail.options.label = L_SEND_MAIL_FORM
|
||||
elements.sendEmail.options.multiOptions.y = L_YES
|
||||
elements.sendEmail.options.multiOptions.n = L_NO
|
||||
elements.sendEmail.options.listsep = " "
|
||||
elements.sendEmail.options.decorators.default = Default
|
||||
elements.sendEmail.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Sender address
|
||||
elements.emailSenderAddress.type = text
|
||||
elements.emailSenderAddress.options.label = L_EMAIL_SENDER
|
||||
elements.emailSenderAddress.options.class = text
|
||||
elements.emailSenderAddress.options.decorators.default = LineStart
|
||||
elements.emailSenderAddress.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Sender name
|
||||
elements.emailSenderName.type = text
|
||||
elements.emailSenderName.options.label = L_NAME
|
||||
elements.emailSenderName.options.class = text
|
||||
elements.emailSenderName.options.decorators.default = LineEnd
|
||||
elements.emailSenderName.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Recipient address
|
||||
elements.emailRecipientAddress.type = text
|
||||
elements.emailRecipientAddress.options.label = L_EMAIL_RECIPIENT
|
||||
elements.emailRecipientAddress.options.class = text
|
||||
elements.emailRecipientAddress.options.decorators.default = LineStart
|
||||
elements.emailRecipientAddress.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Recipient name
|
||||
elements.emailRecipientName.type = text
|
||||
elements.emailRecipientName.options.label = L_NAME
|
||||
elements.emailRecipientName.options.class = text
|
||||
elements.emailRecipientName.options.decorators.default = LineEnd
|
||||
elements.emailRecipientName.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;CC-Recipient address
|
||||
elements.emailRecipientCcAddress.type = text
|
||||
elements.emailRecipientCcAddress.options.label = L_EMAIL_CC
|
||||
elements.emailRecipientCcAddress.options.class = text
|
||||
elements.emailRecipientCcAddress.options.decorators.default = LineStart
|
||||
elements.emailRecipientCcAddress.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;CC-Recipient name
|
||||
elements.emailRecipientCcName.type = text
|
||||
elements.emailRecipientCcName.options.label = L_NAME
|
||||
elements.emailRecipientCcName.options.class = text
|
||||
elements.emailRecipientCcName.options.decorators.default = LineEnd
|
||||
elements.emailRecipientCcName.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Attach backup
|
||||
elements.attachBackup.type = radio
|
||||
elements.attachBackup.options.class = radio
|
||||
elements.attachBackup.options.label = L_ATTACH_BACKUP
|
||||
elements.attachBackup.options.multiOptions.y = L_YES
|
||||
elements.attachBackup.options.multiOptions.n = L_NO
|
||||
elements.attachBackup.options.listsep = " "
|
||||
elements.attachBackup.options.decorators.default = Default
|
||||
elements.attachBackup.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Max Filesize
|
||||
elements.emailMaxsize.type = text
|
||||
elements.emailMaxsize.options.label = L_EMAIL_MAXSIZE
|
||||
elements.emailMaxsize.options.class = text right
|
||||
elements.emailMaxsize.options.size = 6
|
||||
elements.emailMaxsize.options.maxlength = 6
|
||||
elements.emailMaxsize.options.validators.digits = Digits
|
||||
elements.emailMaxsize.options.decorators.default = LineStart
|
||||
elements.emailMaxsize.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Max filessie unit
|
||||
elements.emailMaxsizeUnit.type = select
|
||||
elements.emailMaxsizeUnit.options.class = select
|
||||
elements.emailMaxsizeUnit.options.multiOptions.kb = L_UNIT_KB
|
||||
elements.emailMaxsizeUnit.options.multiOptions.mb = L_UNIT_MB
|
||||
elements.emailMaxsizeUnit.options.decorators.default = LineEnd
|
||||
elements.emailMaxsizeUnit.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Mail programm
|
||||
elements.emailProgram.type = select
|
||||
elements.emailProgram.options.class = select
|
||||
elements.emailProgram.options.label = L_MAILPROGRAM
|
||||
elements.emailProgram.options.multiOptions.php = L_PHPMAIL
|
||||
elements.emailProgram.options.multiOptions.sendmail = L_SENDMAIL
|
||||
elements.emailProgram.options.multiOptions.smtp = L_SMTP
|
||||
elements.emailProgram.options.decorators.default = Default
|
||||
elements.emailProgram.options.disableLoadDefaultDecorators = true
|
||||
|
||||
|
||||
displayGroups.email.options.legend = L_CONFIG_EMAIL
|
||||
displayGroups.email.options.disableLoadDefaultDecorators = true
|
||||
displayGroups.email.options.decorators.displaygroup.decorator = DisplayGroup
|
||||
displayGroups.email.elements.0 = sendEmail
|
||||
displayGroups.email.elements.1 = emailSenderAddress
|
||||
displayGroups.email.elements.2 = emailSenderName
|
||||
displayGroups.email.elements.3 = emailRecipientAddress
|
||||
displayGroups.email.elements.4 = emailRecipientName
|
||||
displayGroups.email.elements.5 = emailRecipientCcAddress
|
||||
displayGroups.email.elements.6 = emailRecipientCcName
|
||||
displayGroups.email.elements.7 = attachBackup
|
||||
displayGroups.email.elements.8 = emailMaxsize
|
||||
displayGroups.email.elements.9 = emailMaxsizeUnit
|
||||
displayGroups.email.elements.10 = emailProgram
|
||||
|
172
application/forms/Config/general.ini
Normale Datei
|
@ -0,0 +1,172 @@
|
|||
prefixPath.decorator.path = "Msd/Form/Decorator/"
|
||||
prefixPath.decorator.prefix = "Msd_Form_Decorator"
|
||||
decorators.subform.decorator = SubForm
|
||||
disableLoadDefaultDecorators = true
|
||||
options.id = general
|
||||
;----------------------------------------------------
|
||||
; legend - General
|
||||
;----------------------------------------------------
|
||||
;Selected Tab
|
||||
elements.selectedTab.type = hidden
|
||||
elements.selectedTab.value = 0
|
||||
elements.selectedTab.options.decorators.default = Default
|
||||
elements.selectedTab.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Dynamic param used as placeholder for different actions
|
||||
elements.param.type = hidden
|
||||
elements.param.value = 0
|
||||
elements.param.options.decorators.default = Default
|
||||
elements.param.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Title of configuration
|
||||
elements.title.type = hidden
|
||||
elements.title.value = 0
|
||||
elements.title.options.decorators.default = Default
|
||||
elements.title.options.disableLoadDefaultDecorators = true
|
||||
|
||||
; MSD-Mode
|
||||
elements.mode.type = radio
|
||||
elements.mode.options.class = radio
|
||||
elements.mode.options.label = L_MSD_MODE
|
||||
elements.mode.options.multiOptions.easy = L_MODE_EASY
|
||||
elements.mode.options.multiOptions.expert = L_MODE_EXPERT
|
||||
elements.mode.options.decorators.default = Default
|
||||
elements.mode.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Max Filesize
|
||||
elements.logMaxsize.type = text
|
||||
elements.logMaxsize.options.label = L_LOG_MAXSIZE
|
||||
elements.logMaxsize.options.class = text right
|
||||
elements.logMaxsize.options.size = 6
|
||||
elements.logMaxsize.options.maxlength = 6
|
||||
elements.logMaxsize.options.validators.digits = Digits
|
||||
elements.logMaxsize.options.decorators.default = LineStart
|
||||
elements.logMaxsize.options.disableLoadDefaultDecorators = true
|
||||
|
||||
elements.logUnit.type = select
|
||||
elements.logUnit.options.class = select
|
||||
elements.logUnit.options.multiOptions.kb = L_UNIT_KB
|
||||
elements.logUnit.options.multiOptions.mb = L_UNIT_MB
|
||||
elements.logUnit.options.decorators.default = LineEnd
|
||||
elements.logUnit.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Speed
|
||||
elements.minspeed.type = text
|
||||
elements.minspeed.options.label = L_SPEED
|
||||
elements.minspeed.options.class = text right
|
||||
elements.minspeed.options.size = 6
|
||||
elements.minspeed.options.maxlength = 6
|
||||
elements.minspeed.options.validators.digits = Digits
|
||||
elements.minspeed.options.decorators.default = LineStart
|
||||
elements.minspeed.options.disableLoadDefaultDecorators = true
|
||||
|
||||
elements.maxspeed.type = text
|
||||
elements.maxspeed.options.label = L_TO
|
||||
elements.maxspeed.options.class = text right
|
||||
elements.maxspeed.options.size = 6
|
||||
elements.maxspeed.options.maxlength = 6
|
||||
elements.maxspeed.options.validators.digits = Digits
|
||||
elements.maxspeed.options.decorators.default = LineEnd
|
||||
elements.maxspeed.options.disableLoadDefaultDecorators = true
|
||||
|
||||
displayGroups.general.options.legend = L_GENERAL
|
||||
displayGroups.general.options.disableLoadDefaultDecorators = true
|
||||
displayGroups.general.options.decorators.displaygroup.decorator = DisplayGroup
|
||||
displayGroups.general.elements.0 = selectedTab
|
||||
displayGroups.general.elements.1 = title
|
||||
displayGroups.general.elements.2 = param
|
||||
displayGroups.general.elements.3 = mode
|
||||
displayGroups.general.elements.4 = logMaxsize
|
||||
displayGroups.general.elements.5 = logUnit
|
||||
displayGroups.general.elements.6 = minspeed
|
||||
displayGroups.general.elements.7 = maxspeed
|
||||
|
||||
;----------------------------------------------------
|
||||
; legend - Backup
|
||||
;----------------------------------------------------
|
||||
|
||||
;Gzip
|
||||
elements.gzip.type = radio
|
||||
elements.gzip.options.class = radio
|
||||
elements.gzip.options.label = L_GZIP
|
||||
elements.gzip.options.multiOptions.y = L_YES
|
||||
elements.gzip.options.multiOptions.n = L_NO
|
||||
elements.gzip.options.listsep = " "
|
||||
elements.gzip.options.decorators.default = Default
|
||||
elements.gzip.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Multipart
|
||||
elements.multipart.type = radio
|
||||
elements.multipart.options.class = radio toggler
|
||||
elements.multipart.options.label = L_MULTI_PART
|
||||
elements.multipart.options.multiOptions.y = L_YES
|
||||
elements.multipart.options.multiOptions.n = L_NO
|
||||
elements.multipart.options.onclick = "myToggle(this, 'y', 'multipartToggle');"
|
||||
elements.multipart.options.listsep = " "
|
||||
elements.multipart.options.decorators.default = Default
|
||||
elements.multipart.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Multipart size
|
||||
elements.multipartSize.type = text
|
||||
elements.multipartSize.options.label = L_MULTIPART_SIZE
|
||||
elements.multipartSize.options.class = text right multipartToggle
|
||||
elements.multipartSize.options.size = 3
|
||||
elements.multipartSize.options.maxlength = 3
|
||||
elements.multipartSize.options.validators.digits = Digits
|
||||
elements.multipartSize.options.decorators.default = LineStart
|
||||
elements.multipartSize.options.disableLoadDefaultDecorators = true
|
||||
|
||||
elements.multipartSizeUnit.type = select
|
||||
elements.multipartSizeUnit.options.class = select multipartToggle
|
||||
elements.multipartSizeUnit.options.multiOptions.kb = L_UNIT_KB
|
||||
elements.multipartSizeUnit.options.multiOptions.mb = L_UNIT_MB
|
||||
elements.multipartSizeUnit.options.decorators.default = LineEnd
|
||||
elements.multipartSizeUnit.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Optimize Tables
|
||||
elements.optimize.type = radio
|
||||
elements.optimize.options.class = radio
|
||||
elements.optimize.options.label = L_OPTIMIZE_TABLES
|
||||
elements.optimize.options.multiOptions.y = L_YES
|
||||
elements.optimize.options.multiOptions.n = L_NO
|
||||
elements.optimize.options.listsep = " "
|
||||
elements.optimize.options.decorators.default = Default
|
||||
elements.optimize.options.disableLoadDefaultDecorators = true
|
||||
|
||||
displayGroups.backup.options.legend = L_DUMP
|
||||
displayGroups.backup.options.disableLoadDefaultDecorators = true
|
||||
displayGroups.backup.options.decorators.displaygroup.decorator = DisplayGroup
|
||||
displayGroups.backup.elements.0 = gzip
|
||||
displayGroups.backup.elements.1 = multipart
|
||||
displayGroups.backup.elements.2 = multipartSize
|
||||
displayGroups.backup.elements.3 = multipartSizeUnit
|
||||
displayGroups.backup.elements.4 = optimize
|
||||
|
||||
;----------------------------------------------------
|
||||
; legend - Restore
|
||||
;----------------------------------------------------
|
||||
|
||||
;Error handling
|
||||
elements.errorHandling.type = radio
|
||||
elements.errorHandling.options.class = radio
|
||||
elements.errorHandling.options.label = L_ERRORHANDLING_RESTORE
|
||||
elements.errorHandling.options.multiOptions.c = L_EHRESTORE_CONTINUE
|
||||
elements.errorHandling.options.multiOptions.s = L_EHRESTORE_STOP
|
||||
elements.errorHandling.options.decorators.default = Default
|
||||
elements.errorHandling.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Delete Db before restore
|
||||
elements.dbDelete.type = radio
|
||||
elements.dbDelete.options.class = radio
|
||||
elements.dbDelete.options.label = L_EMPTY_DB_BEFORE_RESTORE
|
||||
elements.dbDelete.options.multiOptions.y = L_YES
|
||||
elements.dbDelete.options.multiOptions.n = L_NO
|
||||
elements.dbDelete.options.listsep = " "
|
||||
elements.dbDelete.options.decorators.default = Default
|
||||
elements.dbDelete.options.disableLoadDefaultDecorators = true
|
||||
|
||||
displayGroups.restore.options.legend = L_RESTORE
|
||||
displayGroups.restore.options.disableLoadDefaultDecorators = true
|
||||
displayGroups.restore.options.decorators.displaygroup.decorator = DisplayGroup
|
||||
displayGroups.restore.elements.0 = errorHandling
|
||||
displayGroups.restore.elements.1 = dbDelete
|
118
application/forms/Config/interface.ini
Normale Datei
|
@ -0,0 +1,118 @@
|
|||
prefixPath.decorator.path = "Msd/Form/Decorator/"
|
||||
prefixPath.decorator.prefix = "Msd_Form_Decorator"
|
||||
decorators.subform.decorator = SubForm
|
||||
disableLoadDefaultDecorators = true
|
||||
options.id = interface
|
||||
;----------------------------------------------------
|
||||
; legend - Interface
|
||||
;----------------------------------------------------
|
||||
; Language
|
||||
elements.language.type = select
|
||||
elements.language.options.class = select
|
||||
elements.language.options.label = L_LANGUAGE
|
||||
elements.language.options.decorators.default = Default
|
||||
elements.language.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Theme
|
||||
elements.theme.type = select
|
||||
elements.theme.options.class = select
|
||||
elements.theme.options.label = L_THEME
|
||||
elements.theme.options.decorators.default = Default
|
||||
elements.theme.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Position of notification window
|
||||
elements.notificationWindowPosition.type = select
|
||||
elements.notificationWindowPosition.options.class = select
|
||||
elements.notificationWindowPosition.options.label = L_POSITION_NOTIFICATIONS
|
||||
elements.notificationWindowPosition.options.multiOptions.topLeft = L_POSITION_TL
|
||||
elements.notificationWindowPosition.options.multiOptions.topCenter = L_POSITION_TC
|
||||
elements.notificationWindowPosition.options.multiOptions.topRight = L_POSITION_TR
|
||||
elements.notificationWindowPosition.options.multiOptions.middleLeft = L_POSITION_ML
|
||||
elements.notificationWindowPosition.options.multiOptions.middleCenter = L_POSITION_MC
|
||||
elements.notificationWindowPosition.options.multiOptions.middleRight = L_POSITION_MR
|
||||
elements.notificationWindowPosition.options.multiOptions.bottomLeft = L_POSITION_BL
|
||||
elements.notificationWindowPosition.options.multiOptions.bottomCenter = L_POSITION_BC
|
||||
elements.notificationWindowPosition.options.multiOptions.bottomRight = L_POSITION_BR
|
||||
elements.notificationWindowPosition.options.decorators.default = Default
|
||||
elements.notificationWindowPosition.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Show server caption
|
||||
elements.showServerCaption.type = radio
|
||||
elements.showServerCaption.options.class = radio
|
||||
elements.showServerCaption.options.label = L_SERVERCAPTION
|
||||
elements.showServerCaption.options.multiOptions.y = L_YES
|
||||
elements.showServerCaption.options.multiOptions.n = L_NO
|
||||
elements.showServerCaption.options.listsep = " "
|
||||
elements.showServerCaption.options.decorators.default = Default
|
||||
elements.showServerCaption.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Show tooltips
|
||||
elements.showTooltips.type = radio
|
||||
elements.showTooltips.options.class = radio
|
||||
elements.showTooltips.options.label = L_SHOW_TOOLTIPS
|
||||
elements.showTooltips.options.multiOptions.y = L_YES
|
||||
elements.showTooltips.options.multiOptions.n = L_NO
|
||||
elements.showTooltips.options.listsep = " "
|
||||
elements.showTooltips.options.decorators.default = Default
|
||||
elements.showTooltips.options.disableLoadDefaultDecorators = true
|
||||
|
||||
displayGroups.interface.options.legend = L_CONFIG_INTERFACE
|
||||
displayGroups.interface.options.disableLoadDefaultDecorators = true
|
||||
displayGroups.interface.options.decorators.displaygroup.decorator = DisplayGroup
|
||||
displayGroups.interface.elements.0 = language
|
||||
displayGroups.interface.elements.1 = theme
|
||||
displayGroups.interface.elements.2 = notificationWindowPosition
|
||||
displayGroups.interface.elements.3 = showServerCaption
|
||||
displayGroups.interface.elements.4 = showTooltips
|
||||
|
||||
;----------------------------------------------------
|
||||
; legend - SQLBrowser
|
||||
;----------------------------------------------------
|
||||
;SQLBox height
|
||||
elements.sqlboxHeight.type = text
|
||||
elements.sqlboxHeight.options.label = L_SQLBOXHEIGHT
|
||||
elements.sqlboxHeight.options.secondLabel = L_UNIT_PIXEL
|
||||
elements.sqlboxHeight.options.class = text right
|
||||
elements.sqlboxHeight.options.size = 4
|
||||
elements.sqlboxHeight.options.maxlength = 4
|
||||
elements.sqlboxHeight.options.validators.digits = Digits
|
||||
elements.sqlboxHeight.options.decorators.default = DoubleLabel
|
||||
elements.sqlboxHeight.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Records per page
|
||||
elements.recordsPerPage.type = text
|
||||
elements.recordsPerPage.options.label = L_SQLLIMIT
|
||||
elements.recordsPerPage.options.class = text right
|
||||
elements.recordsPerPage.options.size = 4
|
||||
elements.recordsPerPage.options.maxlength = 4
|
||||
elements.recordsPerPage.options.decorators.default = Default
|
||||
elements.recordsPerPage.options.validators.digits = Digits
|
||||
elements.recordsPerPage.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Default SQLBrowser view mode
|
||||
elements.sqlbrowserViewMode.type = radio
|
||||
elements.sqlbrowserViewMode.options.class = radio
|
||||
elements.sqlbrowserViewMode.options.label = L_SQLBOX
|
||||
elements.sqlbrowserViewMode.options.multiOptions.standard = L_SQL_VIEW_STANDARD
|
||||
elements.sqlbrowserViewMode.options.multiOptions.compact = L_SQL_VIEW_COMPACT
|
||||
elements.sqlbrowserViewMode.options.decorators.default = Default
|
||||
elements.sqlbrowserViewMode.options.disableLoadDefaultDecorators = true
|
||||
|
||||
;Refresh time for process list
|
||||
elements.refreshProcesslist.type = text
|
||||
elements.refreshProcesslist.options.label = L_REFRESHTIME_PROCESSLIST
|
||||
elements.refreshProcesslist.options.secondLabel = L_SECONDS
|
||||
elements.refreshProcesslist.options.class = text right
|
||||
elements.refreshProcesslist.options.size = 4
|
||||
elements.refreshProcesslist.options.maxlength = 4
|
||||
elements.refreshProcesslist.options.validators.digits = Digits
|
||||
elements.refreshProcesslist.options.decorators.default = DoubleLabel
|
||||
elements.refreshProcesslist.options.disableLoadDefaultDecorators = true
|
||||
|
||||
displayGroups.sqlbrowser.options.legend = L_SQL_BROWSER
|
||||
displayGroups.sqlbrowser.options.disableLoadDefaultDecorators = true
|
||||
displayGroups.sqlbrowser.options.decorators.displaygroup.decorator = DisplayGroup
|
||||
displayGroups.sqlbrowser.elements.0 = sqlboxHeight
|
||||
displayGroups.sqlbrowser.elements.1 = recordsPerPage
|
||||
displayGroups.sqlbrowser.elements.2 = sqlbrowserViewMode
|
||||
displayGroups.sqlbrowser.elements.3 = refreshProcesslist
|
101
application/forms/Install/User.php
Normale Datei
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Installation
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create form to input Msd-User and password at istallation
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Installation
|
||||
*/
|
||||
class Application_Form_Install_User extends Zend_Form
|
||||
{
|
||||
/**
|
||||
* Init form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$translator = Msd_Language::getInstance()->getTranslator();
|
||||
$this->addPrefixPath(
|
||||
'Msd_Form_Decorator',
|
||||
'Msd/Form/Decorator/',
|
||||
'decorator'
|
||||
);
|
||||
$this->setDisableLoadDefaultDecorators(true);
|
||||
$this->setDecorators(array('FormElements'));
|
||||
$this->addElement(
|
||||
'text',
|
||||
'user',
|
||||
array(
|
||||
'class' => 'text',
|
||||
'rowclass' => 'row-even',
|
||||
'label' => $translator->_('L_USERNAME'),
|
||||
'required' => true,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'password',
|
||||
'pass',
|
||||
array(
|
||||
'class' => 'text',
|
||||
'rowclass' => 'row-odd',
|
||||
'label' => $translator->_('L_PASSWORD'),
|
||||
'required' => true,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
$identical =
|
||||
new Zend_Validate_Identical($this->getElement('pass')->getValue());
|
||||
$this->addElement(
|
||||
'password',
|
||||
'pass_confirm',
|
||||
array(
|
||||
'class' => 'text',
|
||||
'rowclass' => 'row-even',
|
||||
'label' => $translator->_('L_PASSWORD_REPEAT'),
|
||||
'required' => true,
|
||||
'decorators' => array('Default'),
|
||||
'validators' => array(
|
||||
$identical,
|
||||
),
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'text',
|
||||
'strength',
|
||||
array(
|
||||
'class' => 'text',
|
||||
'id' => 'scorebar',
|
||||
'disabled' => 'disabled',
|
||||
'rowclass' => 'row-odd',
|
||||
'label' => $translator->_('L_PASSWORD_STRENGTH'),
|
||||
'decorators' => array('Default')
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'button',
|
||||
'send',
|
||||
array(
|
||||
'class' => 'Formbutton',
|
||||
'rowclass' => 'row-even',
|
||||
'type' => 'submit',
|
||||
'label' => '',
|
||||
'value' => '',
|
||||
'content' => $this->getView()->getIcon('save') . ' '
|
||||
. $translator->_('L_SAVE'),
|
||||
'escape' => false,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
102
application/forms/Login.php
Normale Datei
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Login
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Create login form
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Login
|
||||
*/
|
||||
class Application_Form_Login extends Zend_Form
|
||||
{
|
||||
/**
|
||||
* Init form and add all elements
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$translator = Msd_Language::getInstance()->getTranslator();
|
||||
$this->addPrefixPath(
|
||||
'Msd_Form_Decorator',
|
||||
'Msd/Form/Decorator/',
|
||||
'decorator'
|
||||
);
|
||||
$this->setDisableLoadDefaultDecorators(true);
|
||||
$this->setDecorators(array('FormElements'));
|
||||
$this->addElement(
|
||||
'text',
|
||||
'user',
|
||||
array(
|
||||
'class' => 'text',
|
||||
'label' => $translator->_('L_USERNAME'),
|
||||
'required' => true,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'password',
|
||||
'pass',
|
||||
array(
|
||||
'class' => 'text',
|
||||
'label' => $translator->_('L_PASSWORD'),
|
||||
'required' => true,
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'checkbox',
|
||||
'autologin',
|
||||
array(
|
||||
'class' => 'checkbox',
|
||||
'label' => $translator->_('L_LOGIN_AUTOLOGIN'),
|
||||
'decorators' => array('Default'),
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
'button',
|
||||
'send',
|
||||
array(
|
||||
'class' => 'Formbutton',
|
||||
'label' => '',
|
||||
'value' => $translator->_('L_LOGIN'),
|
||||
'decorators' => array('Default'),
|
||||
'content' =>
|
||||
$this->getView()->getIcon('Key', '', 16) . ' ' .
|
||||
$translator->_('L_LOGIN'),
|
||||
'escape' => false,
|
||||
'onclick' => '$(forms[0].submit());'
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'submit',
|
||||
'dummySend',
|
||||
array(
|
||||
'class' => 'invisible',
|
||||
'label' => '',
|
||||
'decorators' => array('Default')
|
||||
)
|
||||
);
|
||||
|
||||
$this->addDisplayGroupPrefixPath(
|
||||
'Msd_Form_Decorator',
|
||||
'Msd/Form/Decorator/'
|
||||
);
|
||||
$this->setDisplayGroupDecorators(array('DisplayGroup'));
|
||||
$this->addDisplayGroup(
|
||||
array('user', 'pass', 'autologin', 'dummySend', 'send'),
|
||||
'login',
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array('DisplayGroup'),
|
||||
'legend' => $translator->_('L_AUTHENTICATE')
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
BIN
application/language/ar/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 134 B |
1216
application/language/ar/lang.php
Normale Datei
BIN
application/language/bg_BG/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 152 B |
1046
application/language/bg_BG/lang.php
Normale Datei
BIN
application/language/cs/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 982 B |
1215
application/language/cs/lang.php
Normale Datei
BIN
application/language/da/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 97 B |
1016
application/language/da/lang.php
Normale Datei
BIN
application/language/de/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 115 B |
1114
application/language/de/lang.php
Normale Datei
BIN
application/language/de_CH/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 1,1 KiB |
1032
application/language/de_CH/lang.php
Normale Datei
BIN
application/language/de_LU/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 232 B |
1021
application/language/de_LU/lang.php
Normale Datei
BIN
application/language/el/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 627 B |
1486
application/language/el/lang.php
Normale Datei
BIN
application/language/en/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 127 B |
1021
application/language/en/lang.php
Normale Datei
BIN
application/language/es/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 106 B |
1110
application/language/es/lang.php
Normale Datei
BIN
application/language/fa/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 620 B |
1261
application/language/fa/lang.php
Normale Datei
BIN
application/language/fr/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 128 B |
1133
application/language/fr/lang.php
Normale Datei
BIN
application/language/hr/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 592 B |
1021
application/language/hr/lang.php
Normale Datei
BIN
application/language/it/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 128 B |
1067
application/language/it/lang.php
Normale Datei
36
application/language/lang_list.php
Normale Datei
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Languages
|
||||
* @version $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
// Language name in its own language.
|
||||
$lang['en']='English';
|
||||
$lang['de']='Deutsch';
|
||||
$lang['es']='Español';
|
||||
$lang['fr']='Français';
|
||||
$lang['it']='Italiano';
|
||||
$lang['nl']='Nederlands';
|
||||
$lang['sv_SE']='Svenska';
|
||||
$lang['pt_BR']='Portuguese - BR';
|
||||
$lang['tr']='Türkçe';
|
||||
$lang['da']='Dansk';
|
||||
$lang['de_LU']='Luxemburg';
|
||||
$lang['pl']='Polski';
|
||||
$lang['de_CH']='Schweizer Deutsch';
|
||||
$lang['ar']='Arabic';
|
||||
$lang['vi_VN']='Tiếng Việt';
|
||||
$lang['el']='Ελληνικά';
|
||||
$lang['ro']='Rumänisch';
|
||||
$lang['sk']='Slovakia';
|
||||
$lang['fa']='Persian (Farsi)';
|
||||
$lang['ru']='Русский';
|
||||
$lang['cs']='Czech';
|
||||
$lang['sl']='Slovenščina';
|
||||
$lang['bg_BG']='Български';
|
||||
$lang['hr'] = 'Hrvatski';
|
BIN
application/language/nl/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 93 B |
1045
application/language/nl/lang.php
Normale Datei
BIN
application/language/pl/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 428 B |
1024
application/language/pl/lang.php
Normale Datei
BIN
application/language/pt_BR/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 180 B |
1064
application/language/pt_BR/lang.php
Normale Datei
BIN
application/language/ro/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 211 B |
1032
application/language/ro/lang.php
Normale Datei
BIN
application/language/ru/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 109 B |
1156
application/language/ru/lang.php
Normale Datei
BIN
application/language/sk/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 110 B |
1054
application/language/sk/lang.php
Normale Datei
BIN
application/language/sl/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 892 B |
1021
application/language/sl/lang.php
Normale Datei
BIN
application/language/sv_SE/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 97 B |
1011
application/language/sv_SE/lang.php
Normale Datei
BIN
application/language/tr/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 937 B |
1037
application/language/tr/lang.php
Normale Datei
BIN
application/language/vi_VN/flag.gif
Normale Datei
Nachher Breite: | Höhe: | Größe: 336 B |
1133
application/language/vi_VN/lang.php
Normale Datei
90
application/models/Config/FormValidator.php
Normale Datei
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Config
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Config Validator
|
||||
*
|
||||
* Model to validate configuration values set in config form
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Config
|
||||
*/
|
||||
|
||||
class Application_Model_Config_FormValidator
|
||||
{
|
||||
/**
|
||||
* Config data to validate
|
||||
* @var array
|
||||
*/
|
||||
private $_configData = array();
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param array $configData The data to validate
|
||||
*/
|
||||
public function __construct($configData)
|
||||
{
|
||||
// unset values we only used for form handling
|
||||
unset(
|
||||
$configData['general']['selectedTab'],
|
||||
$configData['general']['param']
|
||||
);
|
||||
$this->_configData = $configData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate config data
|
||||
*
|
||||
* Checks database connection params.
|
||||
* If connection is successfull the values are saved to the config file.
|
||||
*
|
||||
* @param Zend_View $view The view of the form for adding messages
|
||||
*/
|
||||
public function validate(Zend_View $view)
|
||||
{
|
||||
$saveConfig = false;
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$translator = Msd_Language::getInstance()->getTranslator();
|
||||
$db = Msd_Db::getAdapter($this->_configData['dbuser']);
|
||||
try {
|
||||
$db->getServerInfo();
|
||||
$saveConfig = true;
|
||||
} catch (Msd_Exception $e) {
|
||||
$msg = $translator->_('L_ERROR').' (' . $e->getCode().') ';
|
||||
$msg .= $e->getMessage();
|
||||
$view->popUpMessage()->addMessage(
|
||||
'db-access-error',
|
||||
'L_ERROR',
|
||||
$msg,
|
||||
array(
|
||||
'modal' => true,
|
||||
'dialogClass' => 'error',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($saveConfig) {
|
||||
$config->save(
|
||||
$config->get('dynamic.configFile'),
|
||||
$this->_configData
|
||||
);
|
||||
$view->popUpMessage()->addMessage(
|
||||
'save-config',
|
||||
'L_NOTICE',
|
||||
array('L_SAVE_SUCCESS', $config->get('dynamic.configFile')),
|
||||
array(
|
||||
'modal' => true,
|
||||
'dialogClass' => 'notice'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
249
application/models/Databases.php
Normale Datei
|
@ -0,0 +1,249 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Sql
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Database management
|
||||
*
|
||||
* Model to manage the databases (CREATE, "TRUNCATE" and DROP).
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Sqlbox
|
||||
*/
|
||||
class Application_Model_Databases
|
||||
{
|
||||
/**
|
||||
* @var Msd_Db_MysqlCommon Connection to database.
|
||||
*/
|
||||
private $_db = null;
|
||||
|
||||
/**
|
||||
* @var string Name of the current database.
|
||||
*/
|
||||
private $_dbName = '';
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Msd_Db $db)
|
||||
{
|
||||
$this->_db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops databases. The names are given in the argument.
|
||||
*
|
||||
* @param array|string $databaseNames
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function dropDatabases($databaseNames)
|
||||
{
|
||||
if (is_string($databaseNames)) {
|
||||
$databaseNames = (array) $databaseNames;
|
||||
}
|
||||
$dropSql = 'DROP DATABASE `%s`;';
|
||||
$results = array();
|
||||
foreach ($databaseNames as $databaseName) {
|
||||
$errorInfo = array();
|
||||
$dropQuery = sprintf(
|
||||
$dropSql,
|
||||
$databaseName
|
||||
);
|
||||
try {
|
||||
$result = $this->_db->query(
|
||||
$dropQuery,
|
||||
Msd_Db::SIMPLE
|
||||
);
|
||||
if (!$result) {
|
||||
$errorInfo = $this->_db->getLastError();
|
||||
}
|
||||
} catch (Msd_Exception $e) {
|
||||
$result = false;
|
||||
$errorInfo = array(
|
||||
'code' => $e->getCode(),
|
||||
'message' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
$results[$databaseName][] = array(
|
||||
'result' => $result,
|
||||
'query' => $dropQuery,
|
||||
'errorInfo' => $errorInfo,
|
||||
);
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the stored procedures. Returns an array in format
|
||||
* ROUTINE_NAME => ROUTINE_TYPE.
|
||||
*
|
||||
* @param string $dbName Name of the database
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function _getStoredProcedures($dbName)
|
||||
{
|
||||
$routinesMeta = $this->_db->getStoredProcedures($dbName);
|
||||
$routines = array();
|
||||
foreach ($routinesMeta as $routine) {
|
||||
$routines[$routine['ROUTINE_NAME']] = $routine['ROUTINE_TYPE'];
|
||||
}
|
||||
return $routines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to drop all stored routines.
|
||||
*
|
||||
* @param array $routines Array with the routine names.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function dropRoutines($routines)
|
||||
{
|
||||
$results = array();
|
||||
$dropSql = 'DROP %s `%s`.`%s`;';
|
||||
foreach ($routines as $routineName => $routineType) {
|
||||
$dropQuery = sprintf(
|
||||
$dropSql,
|
||||
$routineType,
|
||||
$this->_dbName,
|
||||
$routineName
|
||||
);
|
||||
$errorInfo = array();
|
||||
try {
|
||||
$result = $this->_db->query($dropQuery, Msd_Db::SIMPLE);
|
||||
if (!$result) {
|
||||
$errorInfo = $this->_db->getLastError();
|
||||
}
|
||||
} catch (Msd_Exception $e) {
|
||||
$result = false;
|
||||
$errorInfo = array(
|
||||
'code' => $e->getCode(),
|
||||
'message' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
$results[$this->_dbName][] = array(
|
||||
'result' => $result,
|
||||
'query' => $dropQuery,
|
||||
'errorInfo' => $errorInfo,
|
||||
);
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to drop all views.
|
||||
*
|
||||
* @param array $views Array with the names of the views
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function dropViews($views)
|
||||
{
|
||||
$results = array();
|
||||
$dropSql = 'DROP VIEW `%s`.`%s`;';
|
||||
foreach ($views as $view) {
|
||||
$dropQuery = sprintf($dropSql, $this->_dbName, $view);
|
||||
$errorInfo = array();
|
||||
try {
|
||||
$result = $this->_db->query($dropQuery, Msd_Db::SIMPLE);
|
||||
if (!$result) {
|
||||
$errorInfo = $this->_db->getLastError();
|
||||
}
|
||||
} catch (Msd_Exception $e) {
|
||||
$result = false;
|
||||
$errorInfo = array(
|
||||
'code' => $e->getCode(),
|
||||
'message' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
$results[$this->_dbName][] = array(
|
||||
'result' => $result,
|
||||
'query' => $dropQuery,
|
||||
'errorInfo' => $errorInfo,
|
||||
);
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to drop all tables.
|
||||
*
|
||||
* @param array $tables Array with table names to drop
|
||||
* @return array
|
||||
*/
|
||||
public function dropTables($tables)
|
||||
{
|
||||
$results = array();
|
||||
$dropSql = 'DROP TABLE `%s`.`%s`;';
|
||||
foreach ($tables as $table) {
|
||||
$errorInfo = array();
|
||||
$dropQuery = sprintf($dropSql, $this->_dbName, $table);
|
||||
try {
|
||||
$result = $this->_db->query($dropQuery, Msd_Db::SIMPLE);
|
||||
if (!$result) {
|
||||
$errorInfo = $this->_db->getLastError();
|
||||
}
|
||||
} catch (Msd_Exception $e) {
|
||||
$result = false;
|
||||
$errorInfo = array(
|
||||
'code' => $e->getCode(),
|
||||
'message' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
$results[$this->_dbName][] = array(
|
||||
'result' => $result,
|
||||
'query' => $dropQuery,
|
||||
'errorInfo' => $errorInfo,
|
||||
);
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncates a database. It drops all stored routines, views and tables
|
||||
* (in that order).
|
||||
*
|
||||
* @param string $databaseName Name of the database
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function truncateDatabase($databaseName)
|
||||
{
|
||||
$this->_dbName = $databaseName;
|
||||
$routines = $this->_getStoredProcedures($databaseName);
|
||||
$procResults = $this->dropRoutines($routines);
|
||||
$views = $this->_db->getViews($databaseName);
|
||||
$viewsResults = $this->dropViews(array_keys($views));
|
||||
$tables = $this->_db->getTablesMeta($databaseName);
|
||||
$tablesResults = $this->dropTables(array_keys($tables));
|
||||
|
||||
$results = array();
|
||||
if (array_key_exists($databaseName, $procResults)) {
|
||||
foreach ($procResults[$databaseName] as $procResult) {
|
||||
$results[$databaseName][] = $procResult;
|
||||
}
|
||||
}
|
||||
if (array_key_exists($databaseName, $viewsResults)) {
|
||||
foreach ($viewsResults[$databaseName] as $viewsResult) {
|
||||
$results[$databaseName][] = $viewsResult;
|
||||
}
|
||||
}
|
||||
if (array_key_exists($databaseName, $tablesResults)) {
|
||||
foreach ($tablesResults[$databaseName] as $tablesResult) {
|
||||
$results[$databaseName][] = $tablesResult;
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
33
application/models/Sqlbox.php
Normale Datei
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Sql
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Config Validator
|
||||
*
|
||||
* Model to validate configuration values set in config form
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Sqlbox
|
||||
*/
|
||||
class Application_Model_Sqlbox
|
||||
{
|
||||
public function getTableSelectBox()
|
||||
{
|
||||
$this->_db = Msd_Db::getAdapter();
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$db = $config->get('dynamic.dbActual');
|
||||
$tableNames = $this->_db->getTables($db);
|
||||
$options = array();
|
||||
foreach ($tableNames as $table) {
|
||||
$options[$table] = $table;
|
||||
}
|
||||
return Msd_Html::getHtmlOptions($options, '');
|
||||
}
|
||||
}
|
31
application/modules/sqlbrowser/controllers/IndexController.php
Normale Datei
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Sql Controller
|
||||
*
|
||||
* Controller to handle actions on SQLBrowser screen
|
||||
*
|
||||
* @package MySQLDumper_Modules
|
||||
* @subpackage SqlBrowser
|
||||
*/
|
||||
class Sqlbrowser_IndexController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
/**
|
||||
* Index Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
28
application/modules/sqlbrowser/views/scripts/error/error.phtml
Normale Datei
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>MySQLDumper Error Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>An error occurred</h1>
|
||||
<h2><?php echo $this->message ?></h2>
|
||||
|
||||
<?php if (isset($this->exception)): ?>
|
||||
|
||||
<h3>Exception information:</h3>
|
||||
<p>
|
||||
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
|
||||
</p>
|
||||
|
||||
<h3>Stack trace:</h3>
|
||||
<pre><?php echo $this->exception->getTraceAsString() ?>
|
||||
</pre>
|
||||
|
||||
<h3>Request Parameters:</h3>
|
||||
<pre><?php echo var_export($this->request->getParams(), true) ?>
|
||||
</pre>
|
||||
<?php endif ?>
|
||||
|
||||
</body>
|
||||
</html>
|
5
application/modules/sqlbrowser/views/scripts/index/index.phtml
Normale Datei
|
@ -0,0 +1,5 @@
|
|||
huhu 2
|
||||
<?php
|
||||
echo $this->byteOutput(265472347);
|
||||
|
||||
?>
|
67
application/plugins/DeviceCheck.php
Normale Datei
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Plugins
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Check for mobile client and set the right paths and layout.
|
||||
*
|
||||
* @package MySQLDumper_Plugins
|
||||
* @subpackage MobileCheck
|
||||
*/
|
||||
class Application_Plugin_DeviceCheck extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
/**
|
||||
* Set view path to mobile if user agent string is a mobile one
|
||||
*
|
||||
* @param object
|
||||
* @see Zend_Controller_Plugin_Abstract::dispatchLoopStartup()
|
||||
* @return void
|
||||
*/
|
||||
public function dispatchLoopStartup(
|
||||
Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$userAgentString = $request->getHeader('user-agent');
|
||||
|
||||
if (Zend_Http_UserAgent_Mobile::match($userAgentString, $_SERVER)) {
|
||||
//@todo make a layoutchanger class from this
|
||||
$this->_setMobileLayout();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new layout, new view path and helpers for mobile layout
|
||||
* @return void
|
||||
*/
|
||||
protected function _setMobileLayout()
|
||||
{
|
||||
$config = new Zend_Config_Ini(
|
||||
APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV
|
||||
);
|
||||
$mvc = Zend_Layout::getMvcInstance();
|
||||
|
||||
//Set Layout for mobile
|
||||
$mvc->setLayout('mobile');
|
||||
|
||||
$view = new Zend_View();
|
||||
$view->setScriptPath(APPLICATION_PATH . '/views/mobile/scripts/');
|
||||
|
||||
//Get all view helpers from application.ini and add them to new view
|
||||
foreach ($config->resources->view->helperPath as
|
||||
$helperPrefix =>$helperPath) {
|
||||
$view->addHelperPath($helperPath, $helperPrefix);
|
||||
}
|
||||
|
||||
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
|
||||
'viewRenderer'
|
||||
);
|
||||
$viewRenderer->setView($view);
|
||||
}
|
||||
}
|
46
application/plugins/LoginCheck.php
Normale Datei
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Plugins
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Check log in of user and redirect to log in form if user is not logged in.
|
||||
*
|
||||
* @package MySQLDumper_Plugins
|
||||
* @subpackage LoginCheck
|
||||
*/
|
||||
class Application_Plugin_LoginCheck extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$controllerName = $request->getControllerName();
|
||||
if (
|
||||
($request->getActionName() == 'login' &&
|
||||
$controllerName == 'index') ||
|
||||
$controllerName == 'install' ||
|
||||
$controllerName == 'error'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
$user = new Msd_User();
|
||||
if (!$user->isLoggedIn()) {
|
||||
// redirect to login form if user is not logged in
|
||||
$frontController = Zend_Controller_Front::getInstance();
|
||||
$view = new Zend_View;
|
||||
$frontController->getResponse()->setRedirect(
|
||||
$view->url(
|
||||
array(
|
||||
'controller' => 'index',
|
||||
'action' => 'login',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
43
application/views/helpers/AbsoluteUrl.php
Normale Datei
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Helper for returning the absolute URL including scheme and serveraddress
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_AbsoluteUrl extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Build an absolute URL (@see Zend_View_Helper_Url::url())
|
||||
* @param array $urlOptions
|
||||
* @param null $name
|
||||
* @param bool $reset
|
||||
* @param bool $encode
|
||||
* @return string
|
||||
*/
|
||||
public function absoluteUrl(
|
||||
array $urlOptions = array(),
|
||||
$name = null,
|
||||
$reset = false,
|
||||
$encode = true
|
||||
)
|
||||
{
|
||||
$serverUrlViewHelper = new Zend_View_Helper_ServerUrl();
|
||||
$urlViewHelper = new Zend_View_Helper_Url();
|
||||
$url = $urlViewHelper->url($urlOptions, $name, $reset, $encode);
|
||||
|
||||
$absoluteUrl = $serverUrlViewHelper->serverUrl($url);
|
||||
|
||||
return $absoluteUrl;
|
||||
}
|
||||
}
|
49
application/views/helpers/AjaxLoad.php
Normale Datei
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load additional content via ajax
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_AjaxLoad extends Zend_View_Helper_Abstract
|
||||
{
|
||||
|
||||
/**
|
||||
* Call an ajax action from view
|
||||
*
|
||||
* Renders a view snippet which fires the ajax call. The response will
|
||||
* replace the innerHtml of the given DOM-Id.
|
||||
*
|
||||
* @param array $ajaxOptions Options for ajax call (Controller, Action,
|
||||
* Params to hand over to action)
|
||||
* @param array $viewOptions Options to be printed to screen (showThrobber)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function ajaxLoad($ajaxOptions, $viewOptions = null)
|
||||
{
|
||||
$viewRenderer = Zend_Controller_Action_HelperBroker::
|
||||
getStaticHelper('viewRenderer');
|
||||
$viewRenderer->initView();
|
||||
$view = $viewRenderer->view;
|
||||
$view->domId = str_replace('.', '-', uniqid('', true));
|
||||
foreach ($ajaxOptions as $key => $val) {
|
||||
$view->$key = $val;
|
||||
}
|
||||
$view->ajaxOptions = $ajaxOptions;
|
||||
$view->viewOptions = $viewOptions;
|
||||
return $view->render('helper/ajax-load.phtml');
|
||||
}
|
||||
|
||||
}
|
||||
|
49
application/views/helpers/ByteOutput.php
Normale Datei
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Human readable byte output
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_ByteOutput extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Humanize byte output
|
||||
*
|
||||
* @param int $bytes
|
||||
* @param int $precision
|
||||
* @param boolean $useHTML
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function byteOutput($bytes, $precision = 2, $useHtml = true)
|
||||
{
|
||||
$unitsLong = array('Bytes', 'KiloBytes', 'MegaBytes', 'GigaBytes',
|
||||
'TeraBytes', 'PetaBytes', 'ExaBytes', 'YottaBytes');
|
||||
$unitsShort = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB');
|
||||
for ($level = 0; $bytes >= 1024; $level++) {
|
||||
$bytes /= 1024;
|
||||
}
|
||||
if (!is_numeric($bytes) || !isset($unitsShort[$level])) {
|
||||
return $bytes;
|
||||
}
|
||||
$pattern = '<span class="explain tooltip" title="%s">%s</span>';
|
||||
$suffix = sprintf($pattern, $unitsLong[$level], $unitsShort[$level]);
|
||||
if (!$useHtml) {
|
||||
$suffix = strip_tags($suffix);
|
||||
}
|
||||
$ret = sprintf("%01." . $precision . "f", round($bytes, $precision));
|
||||
return trim($ret . ' ' . $suffix);
|
||||
}
|
||||
|
||||
}
|
44
application/views/helpers/Filesize.php
Normale Datei
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Output human readable byte output
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_Filesize extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public $view;
|
||||
public function setView(Zend_View_Interface $view)
|
||||
{
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output human readable filesize
|
||||
*
|
||||
* @param string $filename Filename to read size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function filesize($file)
|
||||
{
|
||||
$size = 0;
|
||||
if (is_readable($file)) {
|
||||
$size = filesize($file);
|
||||
}
|
||||
$size = $this->view->byteOutput($size);
|
||||
return $size;
|
||||
}
|
||||
|
||||
}
|
26
application/views/helpers/GetConfigTitle.php
Normale Datei
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get name of configuration
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_GetConfigTitle extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function getConfigTitle($configName)
|
||||
{
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$configData = $config->loadConfiguration($configName, false);
|
||||
return $configData->general->title;
|
||||
}
|
||||
}
|
35
application/views/helpers/GetFreeDiskspace.php
Normale Datei
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get free disk space
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_GetFreeDiskspace extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Get free diskspace
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFreeDiskspace()
|
||||
{
|
||||
$lang = Msd_Language::getInstance()->getTranslator();
|
||||
$ret = $lang->_('L_NOTAVAIL');
|
||||
$dfs = @diskfreespace(APPLICATION_PATH);
|
||||
if ($dfs) {
|
||||
$ret = $this->view->byteOutput($dfs);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
86
application/views/helpers/GetIcon.php
Normale Datei
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get img-tag for icon
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Get html-img-tag for icon image
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $title
|
||||
* @param int $size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIcon($name, $title='', $size='')
|
||||
{
|
||||
static $baseUrl = false;
|
||||
if (!$baseUrl) {
|
||||
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
|
||||
}
|
||||
$icons = self::_getIconFilenames();
|
||||
if (!isset($icons[$name])) {
|
||||
throw new Msd_Exception(
|
||||
'GetIcon: unknown icon \''.$name .'\' requested'
|
||||
);
|
||||
}
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$img = '<img src="'.$baseUrl.'/%s/%s" alt="%s" title="%s" />';
|
||||
if ($size>'') {
|
||||
$img = '<img src="'.$baseUrl.'/%s/%sx%s/%s" alt="%s" title="%s" />';
|
||||
$ret = sprintf(
|
||||
$img,
|
||||
$config->get('paths.iconpath'),
|
||||
$size,
|
||||
$size,
|
||||
$icons[$name],
|
||||
$title, $title
|
||||
);
|
||||
} else {
|
||||
$ret = sprintf(
|
||||
$img,
|
||||
$config->get('paths.iconpath'),
|
||||
$icons[$name],
|
||||
$title,
|
||||
$title
|
||||
);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default values from defaultConfig.ini
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
private function _getIconFilenames ()
|
||||
{
|
||||
static $icons = false;
|
||||
if (!$icons) {
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$file = realpath(
|
||||
APPLICATION_PATH . DS . '..' . DS . 'public'
|
||||
. DS . $config->get('paths.iconpath') . DS . 'icon.ini'
|
||||
);
|
||||
$iconsIni = new Zend_Config_Ini($file, 'icons');
|
||||
$icons = $iconsIni->toArray();
|
||||
unset($iconsIni);
|
||||
}
|
||||
return $icons;
|
||||
}
|
||||
|
||||
}
|
80
application/views/helpers/GetIconSrc.php
Normale Datei
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get img source
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_GetIconSrc extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Get path of an image
|
||||
*
|
||||
* @param string $name
|
||||
* @param int $size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIconSrc($name, $size='')
|
||||
{
|
||||
static $baseUrl = false;
|
||||
if (!$baseUrl) {
|
||||
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
|
||||
}
|
||||
$icons = self::_getIconFilenames();
|
||||
if (!isset($icons[$name])) {
|
||||
throw new Msd_Exception(
|
||||
'GetIconSrc: unknown icon \''.$name . '\' requested'
|
||||
);
|
||||
}
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$img = $baseUrl.'/%s/%s';
|
||||
if ($size>'') {
|
||||
$img = $baseUrl.'/%s/%sx%s/%s';
|
||||
$ret = sprintf(
|
||||
$img,
|
||||
$config->get('paths.iconpath'),
|
||||
$size,
|
||||
$size,
|
||||
$icons[$name]
|
||||
);
|
||||
} else {
|
||||
$ret = sprintf(
|
||||
$img, $config->get('paths.iconpath'), $icons[$name]
|
||||
);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default values from defaultConfig.ini
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
private function _getIconFilenames ()
|
||||
{
|
||||
static $icons = false;
|
||||
if (!$icons) {
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$file = realpath(
|
||||
APPLICATION_PATH . DS . '..' . DS . 'public'
|
||||
. DS . $config->get('paths.iconpath') . DS .'icon.ini'
|
||||
);
|
||||
$iconsIni = new Zend_Config_Ini($file, 'icons');
|
||||
$icons = $iconsIni->toArray();
|
||||
unset($iconsIni);
|
||||
}
|
||||
return $icons;
|
||||
}
|
||||
|
||||
}
|
34
application/views/helpers/GetServerProtocol.php
Normale Datei
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get server protocol
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_GetServerProtocol extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Get server protocol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getServerProtocol()
|
||||
{
|
||||
if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
|
||||
return 'https://';
|
||||
} else {
|
||||
return 'http://';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
32
application/views/helpers/GetUsername.php
Normale Datei
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get name of currently logged in user
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_GetUsername extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Get name of currently logged in user
|
||||
*
|
||||
* @param string $time
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
$auth =Zend_Auth::getInstance()->getIdentity();
|
||||
return $auth['name'];
|
||||
}
|
||||
}
|
35
application/views/helpers/IsTableOptimizable.php
Normale Datei
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check if engine of table supports optimization
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_IsTableOptimizable extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Detect if the table engine allwos optimization.
|
||||
*
|
||||
* @param string $tableEngine The engine of the table
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isTableOptimizable($tableEngine)
|
||||
{
|
||||
$optimizable = array('MyISAM', 'InnoDB', 'ARCHIVE');
|
||||
if (in_array($tableEngine, $optimizable)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
31
application/views/helpers/JsEscape.php
Normale Datei
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Escape quotes in strings placed inside javascript alerts or confirms
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_JsEscape extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Escape quotes
|
||||
*
|
||||
* @param string $text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function jsEscape($text)
|
||||
{
|
||||
return str_replace('\'', '\\\'', $text);
|
||||
}
|
||||
}
|
105
application/views/helpers/Menu.php
Normale Datei
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Renders the menu
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_Menu extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Renders the menu
|
||||
*
|
||||
* @param Msd_Version $version Msd_Version object
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function menu(Msd_Version $version)
|
||||
{
|
||||
$front = Zend_Controller_Front::getInstance();
|
||||
$request = $front->getRequest();
|
||||
if ($request->getActionName() == 'login') {
|
||||
// reset menu state. Maybe user logs in again and has blended out
|
||||
// the menu before.
|
||||
$this->_resetMenuState();
|
||||
//don't render menu when we show the login form
|
||||
return;
|
||||
}
|
||||
$view = $this->view;
|
||||
$view->databases = $this->_getDatabases();
|
||||
$view->showMenu = $this->_isMenuShown();
|
||||
$view->msdVersion = $version->getMsdVersion();
|
||||
$menu = $view->render('index/menu.phtml');
|
||||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of databases
|
||||
*
|
||||
* Returns the list of accessable databases for actual user. If no database
|
||||
* is selected, set first one as active and use it.
|
||||
*
|
||||
* @return array Numeric array with names of databases
|
||||
*/
|
||||
private function _getDatabases()
|
||||
{
|
||||
$actualDb = $this->view->config->get('dynamic.dbActual');
|
||||
$databases = $this->view->config->get('dynamic.databases');
|
||||
$dbo = Msd_Db::getAdapter();
|
||||
if (empty($databases) || $dbo->selectDb($actualDb) !== true) {
|
||||
// couldn't connect to db - refresh db-list
|
||||
$databases = $dbo->getDatabaseNames();
|
||||
// if database was deleted or is not accessible by user
|
||||
// fallback to default db
|
||||
$defaultDb = $this->view->config->get('config.dbuser.defaultDb');
|
||||
if ($defaultDb != '') {
|
||||
$actualDb = $defaultDb;
|
||||
if ($dbo->selectDb($actualDb) !== true) {
|
||||
// couldn't connect to default db - fallback to first found
|
||||
$actualDb = $databases[0];
|
||||
$dbo->selectDb($actualDb);
|
||||
}
|
||||
}
|
||||
$this->view->config->set('dynamic.dbActual', $actualDb);
|
||||
$this->view->config->set('dynamic.databases', $databases);
|
||||
}
|
||||
return $databases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if menu must be shown or hidden.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
private function _isMenuShown()
|
||||
{
|
||||
$menu = new Zend_Session_Namespace('menu');
|
||||
if (!isset($menu->showMenu)) {
|
||||
$menu->showMenu = 1;
|
||||
};
|
||||
return (int) $menu->showMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set menu state to "show".
|
||||
*
|
||||
* Actual menu state is saved to session
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _resetMenuState()
|
||||
{
|
||||
$menu = new Zend_Session_Namespace('menu');
|
||||
$menu->showMenu = 1;
|
||||
}
|
||||
}
|
34
application/views/helpers/NumberFormat.php
Normale Datei
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a number
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_NumberFormat extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Format a number and return string ready to output
|
||||
*
|
||||
* @param float $nr Number to format
|
||||
* @param int $precision Precision defaults to 0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function numberFormat($number, $precision = 0)
|
||||
{
|
||||
$number = round($number, $precision);
|
||||
$ret = number_format($number, $precision, ',', '.');
|
||||
return $ret;
|
||||
}
|
||||
}
|
49
application/views/helpers/Out.php
Normale Datei
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Convert output to HTML
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_Out extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Helper to convert common values to HTML output
|
||||
*
|
||||
* Escape values
|
||||
* Conditionally convert NULL values to "NULL" as string.
|
||||
* Conditionally surround value with a HTML tag.
|
||||
*
|
||||
* @param string $value The value that may be converted
|
||||
* @param boolean $ouputNull Whether to convert NULL values to string NULL
|
||||
* @param string $decorator Decorate output with this HTML-Tag
|
||||
*
|
||||
* @return string HTML-Text ready to print to screen
|
||||
*/
|
||||
public function out($value, $outputNull = false, $decorator = '')
|
||||
{
|
||||
$ret = $this->view->escape($value);
|
||||
if ($outputNull === true && is_null($value)) {
|
||||
$ret = 'NULL';
|
||||
}
|
||||
if ($decorator > '') {
|
||||
/*
|
||||
* '%1$s means: Use the same value as in the first appearance of
|
||||
* '%s' is used.
|
||||
*/
|
||||
$ret = sprintf('<%s>'.$ret.'</%1$s>', $decorator);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
254
application/views/helpers/Paginator.php
Normale Datei
|
@ -0,0 +1,254 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Build a paginator.
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_Paginator extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Types for the buttons in the view script.
|
||||
* The type depends on the current mode.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_buttonTypes = array(
|
||||
'form' => 'submit',
|
||||
'js' => 'button',
|
||||
'url' => 'button',
|
||||
);
|
||||
|
||||
/**
|
||||
* Defaults for the options. This array is used to fill missing options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_defaults = array(
|
||||
'currentPage' => 1,
|
||||
'pageCount' => 1,
|
||||
'urlParam' => 'pageNr',
|
||||
'baseUrl' => '',
|
||||
'mode' => 'form',
|
||||
'actions' => array(
|
||||
'first' => '',
|
||||
'prev' => '',
|
||||
'next' => '',
|
||||
'last' => '',
|
||||
'change' => '',
|
||||
),
|
||||
'method' => 'post',
|
||||
'enctype' => 'multipart/form-data',
|
||||
);
|
||||
|
||||
/**
|
||||
* Builds a paginator depending on the given options.
|
||||
*
|
||||
* <code>
|
||||
* <?php
|
||||
* $options = array(
|
||||
* 'currentPage', // Number of the currently selected page.
|
||||
* 'pageCount', // Number of total pages.
|
||||
* 'urlParam', // Name of the url parameter which gets the new selected page number.
|
||||
* 'baseUrl', // Base URL for form action and buttons. urlParam and new page number will be appended.
|
||||
* 'mode', // Mode, in which the paginator operates (can be "form", "url" or "js")
|
||||
* 'actions' => array( // JS code for the buttons in "js" mode and JS code for the text input field.
|
||||
* 'first', // The string ":PAGE:" will be replaced with the target page number.
|
||||
* 'prev',
|
||||
* 'next',
|
||||
* 'last',
|
||||
* 'change', // If you want to call a JS function with the new page number as parameter
|
||||
* ), // use "myFunc(this.value);".
|
||||
* 'method', // Value for "method" HTML attribute of the "form" tag.
|
||||
* 'enctype', // Value for "enctype" HTML attribute of the "form" tag.
|
||||
* );
|
||||
* ?>
|
||||
* <code>
|
||||
*
|
||||
* @param array $options Options for the paginator
|
||||
*
|
||||
* @return string HTML code for view script inclusion
|
||||
*/
|
||||
public function paginator(array $options)
|
||||
{
|
||||
$view = clone $this->view;
|
||||
$view->clearVars();
|
||||
|
||||
$options = array_merge($this->_defaults, $options);
|
||||
|
||||
$buttons = $this->_getButtons($options);
|
||||
$onChange = $this->_getOnChange($options['mode'], $options['baseUrl'], $options['urlParam']);
|
||||
if ($options['mode'] == 'js') {
|
||||
$onChange = $this->_getOnChange($options['mode'], $options['actions']['change'], $options['urlParam']);
|
||||
}
|
||||
|
||||
$viewData = array(
|
||||
'currentPage' => $options['currentPage'],
|
||||
'pageCount' => $options['pageCount'],
|
||||
'urlParam' => $options['urlParam'],
|
||||
'onChange' => $onChange,
|
||||
'buttonType' => $this->_buttonTypes[$options['mode']],
|
||||
'first' => $buttons['first'],
|
||||
'prev' => $buttons['prev'],
|
||||
'next' => $buttons['next'],
|
||||
'last' => $buttons['last'],
|
||||
'formEncType' => $options['enctype'],
|
||||
'formAction' => $options['baseUrl'],
|
||||
'formMethod' => $options['method'],
|
||||
);
|
||||
|
||||
$view->assign($viewData);
|
||||
return $view->render('helper/paginator.phtml');
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the information for the buttons (first page, previous page, next page and last page).
|
||||
*
|
||||
* @param array $options Button options
|
||||
*
|
||||
* @return array Information for the view script
|
||||
*/
|
||||
protected function _getButtons(array $options)
|
||||
{
|
||||
$buttons = array();
|
||||
$buttons['first'] = $this->_getButtonInfo(
|
||||
(bool) ($options['currentPage'] <= 1)
|
||||
);
|
||||
$buttons['first']['icon'] = 'First' . $buttons['first']['icon'];
|
||||
$buttons['first']['click'] = $this->_getButtonClick(
|
||||
$options['mode'],
|
||||
array(
|
||||
'targetPage' => 1,
|
||||
'onClick' => $options['actions']['first'],
|
||||
'baseUrl' => $options['baseUrl'],
|
||||
'urlParam' => $options['urlParam'],
|
||||
)
|
||||
);
|
||||
|
||||
$buttons['prev'] = $this->_getButtonInfo(
|
||||
(bool) ($options['currentPage'] <= 1)
|
||||
);
|
||||
$buttons['prev']['icon'] = 'Back' . $buttons['prev']['icon'];
|
||||
$buttons['prev']['click'] = $this->_getButtonClick(
|
||||
$options['mode'],
|
||||
array(
|
||||
'targetPage' => $options['currentPage'] - 1,
|
||||
'onClick' => $options['actions']['prev'],
|
||||
'baseUrl' => $options['baseUrl'],
|
||||
'urlParam' => $options['urlParam'],
|
||||
)
|
||||
);
|
||||
|
||||
$buttons['next'] = $this->_getButtonInfo(
|
||||
(bool) ($options['currentPage'] >= $options['pageCount'])
|
||||
);
|
||||
$buttons['next']['icon'] = 'Forward' . $buttons['next']['icon'];
|
||||
$buttons['next']['click'] = $this->_getButtonClick(
|
||||
$options['mode'],
|
||||
array(
|
||||
'targetPage' => $options['currentPage'] + 1,
|
||||
'onClick' => $options['actions']['next'],
|
||||
'baseUrl' => $options['baseUrl'],
|
||||
'urlParam' => $options['urlParam'],
|
||||
)
|
||||
);
|
||||
|
||||
$buttons['last'] = $this->_getButtonInfo(
|
||||
(bool) ($options['currentPage'] >= $options['pageCount'])
|
||||
);
|
||||
$buttons['last']['icon'] = 'Last' . $buttons['last']['icon'];
|
||||
$buttons['last']['click'] = $this->_getButtonClick(
|
||||
$options['mode'],
|
||||
array(
|
||||
'targetPage' => $options['pageCount'],
|
||||
'onClick' => $options['actions']['last'],
|
||||
'baseUrl' => $options['baseUrl'],
|
||||
'urlParam' => $options['urlParam'],
|
||||
)
|
||||
);
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the basic info for a button (disabled status and disabled suffix for buttons icon)
|
||||
*
|
||||
* @param bool $disabled Status of the button
|
||||
*
|
||||
* @return array Basic info about the button
|
||||
*/
|
||||
protected function _getButtonInfo($disabled)
|
||||
{
|
||||
return array(
|
||||
'disabled' => $disabled ? ' disabled="disabled"' : '',
|
||||
'icon' => $disabled ? 'Disabled' : '',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the javascript code for the HTML attribute "onclick".
|
||||
*
|
||||
* @param string $mode Current paginator mode (can be "form", "url" or "js")
|
||||
* @param array $options Options for the "onclick" attribute
|
||||
*
|
||||
* @return string JS-Code for the "onclick" attribute
|
||||
*/
|
||||
protected function _getButtonClick($mode, array $options)
|
||||
{
|
||||
$onClick = '';
|
||||
|
||||
if ($mode == 'form') {
|
||||
$onClick = "$(this).parent().children('select').val(" . $options['targetPage'] . "); "
|
||||
. "$(this).parent().parent()[0].submit();";
|
||||
}
|
||||
|
||||
if ($mode == 'url') {
|
||||
$onClick = "window.location.href = '" . rtrim($options['baseUrl'], '/')
|
||||
. "/{$options['urlParam']}/{$options['targetPage']}/';";
|
||||
}
|
||||
|
||||
if ($mode == 'js') {
|
||||
$onClick = str_replace(':PAGE:', $options['targetPage'], $options['onClick']);
|
||||
}
|
||||
|
||||
return $onClick;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the Javascript code for "onchange" HTML attribute.
|
||||
* This code is used for the combobox.
|
||||
*
|
||||
* @param string $mode Current paginator mode (can be "form", "url" or "js")
|
||||
* @param string $baseUrl Base URL or Javascript code for the event.
|
||||
* @param string $urlParam Name of the URL param. Its value will set to the entered page.
|
||||
*
|
||||
* @return string JS-Code for the "onchange" HTML attribute.
|
||||
*/
|
||||
protected function _getOnChange($mode, $baseUrl = '', $urlParam = '')
|
||||
{
|
||||
$onChange = "";
|
||||
if ($mode == 'form') {
|
||||
$onChange = "$(this).parent().parent()[0].submit();";
|
||||
}
|
||||
|
||||
if ($mode == 'url') {
|
||||
$onChange = "window.location.href = '" . rtrim($baseUrl, '/') . "/$urlParam/' + this.value + '/';";
|
||||
}
|
||||
|
||||
if ($mode == 'js') {
|
||||
$onChange = "$baseUrl";
|
||||
}
|
||||
|
||||
return $onChange;
|
||||
}
|
||||
}
|
178
application/views/helpers/PopUpMessage.php
Normale Datei
|
@ -0,0 +1,178 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Displayment of messages
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_PopUpMessage extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Stores the information about the messages to display.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_messages = array();
|
||||
|
||||
/**
|
||||
* Mapping of Msd_Config position to jquery ui param
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_positions = array(
|
||||
'topLeft' => array('left','top'),
|
||||
'topCenter' => array('center','top'),
|
||||
'topRight' => array('right','top'),
|
||||
'middleLeft' => array('left','center'),
|
||||
'middleCenter' => array('center','center'),
|
||||
'middleRight' => array('right','center'),
|
||||
'bottomLeft' => array('left','bottom'),
|
||||
'bottomCenter' => array('center','bottom'),
|
||||
'bottomRight' => array('right','bottom'),
|
||||
);
|
||||
|
||||
/**
|
||||
* returns the instance of this view helper.
|
||||
*
|
||||
* @return Zend_View_Helper_PopUpMessage
|
||||
*/
|
||||
public function popUpMessage()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new message to the stack.
|
||||
*
|
||||
* @param string $messageId Dom-Id of the dialog
|
||||
* @param string $title Title for the dialog
|
||||
* @param string|array $message Message to display
|
||||
* @param array $options Additional options for the dialog box
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addMessage($messageId, $title, $message, $options = array())
|
||||
{
|
||||
$lang = Msd_Language::getInstance();
|
||||
$translator = $lang->getTranslator();
|
||||
$optionKeys = array_keys($options);
|
||||
if (!in_array('buttons', $optionKeys)) {
|
||||
$options['buttons'] = array(
|
||||
'L_OK' => 'function() {$(this).dialog(\'close\');}'
|
||||
);
|
||||
}
|
||||
$translatedButtons = array();
|
||||
foreach ($options['buttons'] as $key => $value) {
|
||||
$translatedButtons[ucfirst($translator->_($key))] = $value;
|
||||
}
|
||||
$options['buttons'] = $translatedButtons;
|
||||
if (!in_array('dialogClass', $optionKeys)) {
|
||||
$options['dialogClass'] = 'info';
|
||||
}
|
||||
if (!in_array('position', $optionKeys)) {
|
||||
$options['position'] = $this->_getDefaultPosition();
|
||||
}
|
||||
$options['title'] = $translator->_($title);
|
||||
if (!empty($message)) {
|
||||
if (is_array($message)) {
|
||||
$message[0] = $translator->_($message[0]);
|
||||
$message = call_user_func_array('sprintf', $message);
|
||||
} else {
|
||||
$message = $translator->_($message);
|
||||
}
|
||||
}
|
||||
$this->_messages[$messageId] = array(
|
||||
'message' => $message,
|
||||
'params' => $options,
|
||||
'attribs' => array(
|
||||
'id' => $messageId,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the dialogs.
|
||||
*
|
||||
* Add "OnLoad" scripts to jQuery and create the HTML-Output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$messages = array();
|
||||
foreach ($this->_messages as $messageInfo) {
|
||||
$html = '<div class="nodisplay"';
|
||||
foreach ($messageInfo['attribs'] as $attribName => $attribValue) {
|
||||
$html .= ' ' . $attribName . '="' . $attribValue . '"';
|
||||
}
|
||||
$html .= '>' . $messageInfo['message'] . '</div>';
|
||||
$javascript = sprintf(
|
||||
'%s(\'#%s\').dialog(%s);',
|
||||
ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(),
|
||||
$messageInfo['attribs']['id'],
|
||||
$this->_renderOptions($messageInfo['params'])
|
||||
);
|
||||
$this->view->jQuery()->addOnLoad($javascript);
|
||||
$messages[] = $html;
|
||||
}
|
||||
return implode("\n", $messages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the dialog options.
|
||||
*
|
||||
* This will return modified but valid JSON.
|
||||
*
|
||||
* @param array $options Dialog options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _renderOptions($options)
|
||||
{
|
||||
$json = '{';
|
||||
$opts = array();
|
||||
foreach ($options as $key => $value) {
|
||||
$jsonOpt = $key . ': ';
|
||||
if (is_array($value)) {
|
||||
$jsonOpt .= $this->_renderOptions($value);
|
||||
} elseif (is_bool($value)) {
|
||||
$jsonOpt .= $value === true ? 'true':'false';
|
||||
} elseif (
|
||||
is_numeric($value) || strpos($value, 'function') !== false
|
||||
) {
|
||||
$jsonOpt .= $value;
|
||||
} else {
|
||||
$jsonOpt .= '"' . $value . '"';
|
||||
}
|
||||
$opts[] = $jsonOpt;
|
||||
}
|
||||
$json .= implode(',', $opts) . '}';
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get position of notification window from config and mapt to jQueryUi
|
||||
*
|
||||
* @return array Array containing jQuerUi-params
|
||||
*/
|
||||
private function _getDefaultPosition()
|
||||
{
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$position = $config->get('config.interface.notificationWindowPosition');
|
||||
if (isset($this->_positions[$position])) {
|
||||
$position = $this->_positions[$position];
|
||||
}
|
||||
return $position;
|
||||
}
|
||||
}
|
||||
|
26
application/views/helpers/SqlHeadNavi.php
Normale Datei
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Renders the SqlBrowser head naviagtion menu
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_SqlHeadNavi extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function sqlHeadNavi()
|
||||
{
|
||||
$view = $this->view;
|
||||
return $view->render('sql/sql-head-navi.phtml');
|
||||
}
|
||||
|
||||
}
|