1
0
Fork 0
Dieser Commit ist enthalten in:
DSB 2011-06-10 21:55:32 +00:00
Ursprung 2b21070b1a
Commit f7a7c71f86
1583 geänderte Dateien mit 454759 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -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);
}
}

Datei anzeigen

@ -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',
)
)
);
}
}
}