Fixed icon path after saving configuration.
Dieser Commit ist enthalten in:
Ursprung
4f36119278
Commit
88791f1a9c
9 geänderte Dateien mit 235 neuen und 124 gelöschten Zeilen
|
|
@ -3,14 +3,14 @@
|
|||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Bootstrap class
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @package MySQLDumper
|
||||
*/
|
||||
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
{
|
||||
|
|
@ -24,7 +24,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
/**
|
||||
* Start session
|
||||
*
|
||||
* Anyhing else is set in configs/application.ini
|
||||
* Anything else is set in configs/application.ini
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -34,8 +34,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
Zend_Session::start();
|
||||
|
||||
// check if server has magic quotes enabled and normalize params
|
||||
if ( (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() == 1)) {
|
||||
$_POST = Bootstrap::stripslashes_deep($_POST);
|
||||
if ((function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() == 1)) {
|
||||
$_POST = Bootstrap::stripSlashesDeep($_POST);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -49,6 +49,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
{
|
||||
$dynamicConfig = new Msd_Config_Dynamic();
|
||||
$configFile = $dynamicConfig->getParam('configFile', 'mysqldumper.ini');
|
||||
Msd_Registry::setConfigFilename($configFile);
|
||||
$config = new Msd_Config(
|
||||
'Default',
|
||||
array('directories' => realpath(APPLICATION_PATH . '/../work/config'))
|
||||
|
|
@ -65,9 +66,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
*
|
||||
* @return string|array
|
||||
*/
|
||||
public static function stripslashes_deep($value)
|
||||
public static function stripSlashesDeep($value)
|
||||
{
|
||||
$value = is_array($value) ? array_map('Bootstrap::stripslashes_deep', $value) : stripslashes($value);
|
||||
$value = is_array($value) ? array_map(array('Bootstrap', 'stripSlashesDeep'), $value) : stripslashes($value);
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,23 +3,24 @@
|
|||
* 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$
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Config Controller
|
||||
* Config Controller.
|
||||
*
|
||||
* Controller to handle actions triggered on configuration screen
|
||||
* Controller to handle actions triggered on configuration screen.
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class ConfigController extends Msd_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Active jQuery tab Id
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_activeTab = 'tab_general';
|
||||
|
|
@ -61,7 +62,7 @@ class ConfigController extends Msd_Controller_Action
|
|||
$formGeneral = $this->_getSubformIni('general');
|
||||
$elementTitle = $formGeneral->getElement('title');
|
||||
$elementTitle->setValue(
|
||||
$this->view->config->getParam('general.title')
|
||||
$this->_config->getParam('general.title')
|
||||
);
|
||||
|
||||
$form->addSubForm($formGeneral, 'general');
|
||||
|
|
@ -151,10 +152,10 @@ class ConfigController extends Msd_Controller_Action
|
|||
$elementClass .= ' ' . 'inputError';
|
||||
$formElement->setAttrib('class', $elementClass);
|
||||
$message[] = $formElement->getLabel() . ': ' .
|
||||
$this->view->lang->translateZendId(
|
||||
$messageId,
|
||||
$messageText
|
||||
);
|
||||
$this->view->lang->translateZendId(
|
||||
$messageId,
|
||||
$messageText
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -184,9 +185,9 @@ class ConfigController extends Msd_Controller_Action
|
|||
|
||||
// set dynamic actual database if it's changed in the panel
|
||||
if ($this->_request->isPost()) {
|
||||
$actualDb = $this->view->dynamicConfig->getParam('dbActual');
|
||||
$actualDb = $this->_dynamicConfig->getParam('dbActual');
|
||||
if (isset($_POST['defaultDb']) && ($_POST['defaultDb'] != $actualDb)) {
|
||||
$this->view->dynamicConfig->setParam('dbActual', $_POST['defaultDb']);
|
||||
$this->_dynamicConfig->setParam('dbActual', $_POST['defaultDb']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -196,14 +197,14 @@ class ConfigController extends Msd_Controller_Action
|
|||
/**
|
||||
* Read ini file and create subform
|
||||
*
|
||||
* @param string $subform
|
||||
* @param string $subForm
|
||||
*
|
||||
* @return Zend_Form_SubForm
|
||||
*/
|
||||
private function _getSubformIni($subform)
|
||||
private function _getSubformIni($subForm)
|
||||
{
|
||||
$subFormIni = new Zend_Config_Ini(APPLICATION_PATH . '/forms/Config/' . $subform . '.ini');
|
||||
$options = array('displayGroupPrefixPath' => $subform . '_');
|
||||
$subFormIni = new Zend_Config_Ini(APPLICATION_PATH . '/forms/Config/' . $subForm . '.ini');
|
||||
$options = array('displayGroupPrefixPath' => $subForm . '_');
|
||||
return new Zend_Form_SubForm($subFormIni, $options);
|
||||
}
|
||||
|
||||
|
|
@ -214,7 +215,7 @@ class ConfigController extends Msd_Controller_Action
|
|||
*/
|
||||
public function addRecipientCcAction()
|
||||
{
|
||||
$recipientsCc = $this->view->config->Param('email.RecipientCc');
|
||||
$recipientsCc = $this->_config->Param('email.RecipientCc');
|
||||
if ($recipientsCc === null) {
|
||||
$recipientsCc = array();
|
||||
}
|
||||
|
|
@ -222,7 +223,7 @@ class ConfigController extends Msd_Controller_Action
|
|||
$recipientsCc[$index]['Name'] = '';
|
||||
$recipientsCc[$index]['Address'] = '';
|
||||
$recipientsCc = array_values($recipientsCc);
|
||||
$this->view->config->setParam('email.RecipientCc', $recipientsCc);
|
||||
$this->_config->setParam('email.RecipientCc', $recipientsCc);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
|
|
@ -233,12 +234,12 @@ class ConfigController extends Msd_Controller_Action
|
|||
*/
|
||||
public function deleteRecipientCcAction()
|
||||
{
|
||||
$recipientToDelete = (int)$this->_request->getPost('param');
|
||||
$recipientsCc = $this->view->config->getParam('email.RecipientCc');
|
||||
$recipientToDelete = (int) $this->_request->getPost('param');
|
||||
$recipientsCc = $this->_config->getParam('email.RecipientCc');
|
||||
if (isset($recipientsCc[$recipientToDelete])) {
|
||||
unset($recipientsCc[$recipientToDelete]);
|
||||
}
|
||||
$this->view->config->setParam('email.RecipientCc', $recipientsCc);
|
||||
$this->_config->setParam('email.RecipientCc', $recipientsCc);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
|
|
@ -249,7 +250,7 @@ class ConfigController extends Msd_Controller_Action
|
|||
*/
|
||||
public function addFtpConnectionAction()
|
||||
{
|
||||
$ftpConfig = $this->view->config->getParam('ftp');
|
||||
$ftpConfig = $this->_config->getParam('ftp');
|
||||
$index = 0;
|
||||
if (!empty($ftpConfig)) {
|
||||
$index = max(array_keys($ftpConfig)) + 1;
|
||||
|
|
@ -266,7 +267,7 @@ class ConfigController extends Msd_Controller_Action
|
|||
'dir' => "/"
|
||||
);
|
||||
$ftpConfig[$index] = $default;
|
||||
$this->view->config->setParam('ftp', $ftpConfig);
|
||||
$this->_config->setParam('ftp', $ftpConfig);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
|
|
@ -277,14 +278,14 @@ class ConfigController extends Msd_Controller_Action
|
|||
*/
|
||||
public function deleteFtpConnectionAction()
|
||||
{
|
||||
$index = (int)$this->_request->getPost('param');
|
||||
$ftpConfig = $this->view->config->getParam('ftp');
|
||||
$index = (int) $this->_request->getPost('param');
|
||||
$ftpConfig = $this->_config->getParam('ftp');
|
||||
if (count($ftpConfig) > 1) {
|
||||
if (isset($ftpConfig[$index])) {
|
||||
unset($ftpConfig[$index]);
|
||||
sort($ftpConfig);
|
||||
}
|
||||
$this->view->config->setParam('ftp', $ftpConfig);
|
||||
$this->_config->setParam('ftp', $ftpConfig);
|
||||
}
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
|
@ -301,7 +302,7 @@ class ConfigController extends Msd_Controller_Action
|
|||
if ($this->_request->isPost()) {
|
||||
|
||||
$postData = $this->_request->getPost();
|
||||
$index = (int)$this->_request->getPost('param');
|
||||
$index = (int) $this->_request->getPost('param');
|
||||
|
||||
// fetch the required params
|
||||
$server = $postData['ftp_' . $index . '_server'];
|
||||
|
|
@ -330,7 +331,6 @@ class ConfigController extends Msd_Controller_Action
|
|||
// got resource?
|
||||
if (!is_resource($ftpStream)) {
|
||||
$message = sprintf($translator->_('L_FTP_CONNECTION_ERROR'), $server, $port);
|
||||
|
||||
// connection ok? let's try to login
|
||||
} else if (!ftp_login($ftpStream, $user, $password)) {
|
||||
$message = sprintf($translator->_('L_FTP_LOGIN_ERROR'), $user);
|
||||
|
|
@ -339,7 +339,6 @@ class ConfigController extends Msd_Controller_Action
|
|||
if ($mode == 'y') {
|
||||
ftp_pasv($ftpStream, true);
|
||||
}
|
||||
|
||||
// login ok? let's set/change the ftp upload directory
|
||||
} else if (!ftp_chdir($ftpStream, $directory)) {
|
||||
$message = sprintf($translator->_('L_CHANGEDIRERROR'));
|
||||
|
|
@ -350,12 +349,11 @@ class ConfigController extends Msd_Controller_Action
|
|||
// ftp directory exists and chmod ok? let's test the ftp transfer with a test file
|
||||
} else if (!ftp_put($ftpStream, $targetFolder . $name, $filename, FTP_ASCII)) {
|
||||
$message = sprintf($translator->_('L_FTP_FILE_TRANSFER_ERROR'), $name);
|
||||
|
||||
} else {
|
||||
$upload = true;
|
||||
$message = sprintf($translator->_('L_FTP_FILE_TRANSFER_SUCCESS'), $name)
|
||||
. '<br /><br />' .
|
||||
$translator->_('L_FTP_OK');
|
||||
. '<br /><br />' .
|
||||
$translator->_('L_FTP_OK');
|
||||
|
||||
// delete the test file after a successful transfer test
|
||||
if (file_exists($targetFolder . $name)) {
|
||||
|
|
@ -409,7 +407,7 @@ class ConfigController extends Msd_Controller_Action
|
|||
foreach ($elements as $element) {
|
||||
$element = str_replace($group . '_', '', $element);
|
||||
$element = str_replace('_', '.', $element);
|
||||
$value = $this->view->config->getParam($group . '.' . $element);
|
||||
$value = $this->_config->getParam($group . '.' . $element);
|
||||
if (is_array($value)) {
|
||||
list (, $key) = explode('.', $element);
|
||||
$subForm->setDefault($element, $value[$key]);
|
||||
|
|
@ -463,7 +461,7 @@ class ConfigController extends Msd_Controller_Action
|
|||
*/
|
||||
private function _addNonConfigurableConfigParams($configData)
|
||||
{
|
||||
$configData['systemDatabases'] = $this->view->config->getParam('systemDatabases');
|
||||
$configData['systemDatabases'] = $this->_config->getParam('systemDatabases');
|
||||
return $configData;
|
||||
}
|
||||
|
||||
|
|
@ -486,7 +484,7 @@ class ConfigController extends Msd_Controller_Action
|
|||
$smtpConfig = $emailForm->getDisplayGroup('smtpConfig');
|
||||
$sendmailVisibility = false;
|
||||
$smtpVisibility = false;
|
||||
switch ($this->view->config->getParam('email.Program')) {
|
||||
switch ($this->_config->getParam('email.Program')) {
|
||||
case 'sendmail':
|
||||
$sendmailVisibility = true;
|
||||
break;
|
||||
|
|
@ -497,7 +495,7 @@ class ConfigController extends Msd_Controller_Action
|
|||
$sendmailConfig->addAttribs(
|
||||
array(
|
||||
'style' => 'display:'
|
||||
. $visibilityMap[$sendmailVisibility] . ';',
|
||||
. $visibilityMap[$sendmailVisibility] . ';',
|
||||
)
|
||||
);
|
||||
$smtpConfig->addAttribs(
|
||||
|
|
|
|||
|
|
@ -19,6 +19,13 @@
|
|||
|
||||
class Application_Model_Config_FormValidator
|
||||
{
|
||||
/**
|
||||
* Current configuration.
|
||||
*
|
||||
* @var Msd_Config|null
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* Config data to validate
|
||||
* @var array
|
||||
|
|
@ -32,6 +39,7 @@ class Application_Model_Config_FormValidator
|
|||
*/
|
||||
public function __construct($configData)
|
||||
{
|
||||
$this->_config = Msd_Registry::getConfig();
|
||||
// unset values we only used for form handling
|
||||
unset(
|
||||
$configData['general']['selectedTab'],
|
||||
|
|
@ -51,7 +59,6 @@ class Application_Model_Config_FormValidator
|
|||
public function validateAndSaveConfig(Zend_View $view)
|
||||
{
|
||||
$saveConfig = false;
|
||||
$config = Msd_Registry::getConfig();
|
||||
$translator = Msd_Language::getInstance()->getTranslator();
|
||||
$db = Msd_Db::getAdapter($this->_configData['dbuser']);
|
||||
try {
|
||||
|
|
@ -72,13 +79,14 @@ class Application_Model_Config_FormValidator
|
|||
}
|
||||
|
||||
if ($saveConfig) {
|
||||
$config->setConfig($this->_configData);
|
||||
$saved = $config->save();
|
||||
$this->_config->setConfig($this->_configData);
|
||||
$saved = $this->_config->save();
|
||||
$this->_config->load(Msd_Registry::getConfigFilename());
|
||||
if ($saved === true) {
|
||||
$view->popUpMessage()->addMessage(
|
||||
'save-config',
|
||||
'L_NOTICE',
|
||||
array('L_SAVE_SUCCESS', $view->config->getParam('general.title')),
|
||||
array('L_SAVE_SUCCESS', $this->_config->getParam('general.title')),
|
||||
array(
|
||||
'modal' => true,
|
||||
'dialogClass' => 'notice'
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* @package MySQLDumper
|
||||
* @subpackage View_Helpers
|
||||
*/
|
||||
class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
|
||||
class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Get html-img-tag for icon image
|
||||
|
|
@ -26,7 +26,7 @@ class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIcon($name, $title='', $size='')
|
||||
public function getIcon($name, $title = '', $size = null)
|
||||
{
|
||||
static $baseUrl = false;
|
||||
if (!$baseUrl) {
|
||||
|
|
@ -35,13 +35,13 @@ class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
|
|||
$icons = self::_getIconFilenames();
|
||||
if (!isset($icons[$name])) {
|
||||
throw new Msd_Exception(
|
||||
'GetIcon: unknown icon \''.$name .'\' requested'
|
||||
'GetIcon: unknown icon \'' . $name . '\' requested'
|
||||
);
|
||||
}
|
||||
$img = '<img src="'.$baseUrl.'/%s/%s" alt="%s" title="%s" />';
|
||||
$img = '<img src="' . $baseUrl . '/%s/%s" alt="%s" title="%s" />';
|
||||
$config = Msd_Registry::getConfig();
|
||||
if ($size>'') {
|
||||
$img = '<img src="'.$baseUrl.'/%s/%sx%s/%s" alt="%s" title="%s" />';
|
||||
if ($size !== null) {
|
||||
$img = '<img src="' . $baseUrl . '/%s/%sx%s/%s" alt="%s" title="%s" />';
|
||||
$ret = sprintf(
|
||||
$img,
|
||||
$config->getParam('paths.iconPath'),
|
||||
|
|
@ -67,20 +67,19 @@ class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
|
|||
*
|
||||
* @return object
|
||||
*/
|
||||
private function _getIconFilenames ()
|
||||
private function _getIconFilenames()
|
||||
{
|
||||
static $icons = false;
|
||||
if (!$icons) {
|
||||
$config = $this->view->config;
|
||||
$file = realpath(
|
||||
$config = $this->view->config;
|
||||
$file = realpath(
|
||||
APPLICATION_PATH . '/../public/'
|
||||
. $config->getParam('paths.iconPath') . '/icon.ini'
|
||||
);
|
||||
$iconsIni = new Zend_Config_Ini($file, 'icons');
|
||||
$icons = $iconsIni->toArray();
|
||||
$icons = $iconsIni->toArray();
|
||||
unset($iconsIni);
|
||||
}
|
||||
return $icons;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren