public function getControllerUrl($class = 'Index') { $urlOptions = array('class' => $this->_class, 'componentController' => $class, 'action' => ''); $router = Kwf_Controller_Front::getInstance()->getWebRouter(); if (Zend_Registry::isRegistered('testRootComponentClass')) { $urlOptions['root'] = Zend_Registry::get('testRootComponentClass'); $name = 'kwf_test_componentedit'; } else { $name = 'componentedit'; } return $router->assemble($urlOptions, $name, true); }
public function getMenuUrl() { if (!$this->_menuUrl) { $id = $this->getResourceId(); $id = explode('_', $id); if ($id[0] == 'kwf' || $id[0] == 'vkwf') { return Kwf_Controller_Front::getInstance()->getRouter()->assemble(array('module' => $id[1], 'controller' => $id[2]), $id[0] . '_' . $id[1], true); } else { return Kwf_Controller_Front::getInstance()->getRouter()->assemble(array('module' => $id[0], 'controller' => $id[1]), 'admin', true); } } return $this->_menuUrl; }
protected function _getLogBody() { $user = "******"; try { if (Zend_Registry::get('userModel') && ($u = Zend_Registry::get('userModel')->getAuthedUser())) { $userName = $u->__toString(); $user = "******"; } } catch (Exception $e) { $user = "******"; } $exception = $this->getException(); $body = ''; $body .= $this->_format('Exception', get_class($exception)); $body .= $this->_format('Thrown', $exception->getFile() . ':' . $exception->getLine()); $body .= $this->_format('Message', $exception->getMessage()); $body .= $this->_format('ExceptionDetail', $exception->__toString()); $body .= $this->_format('REQUEST_URI', isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '(none)'); $body .= $this->_format('HTTP_REFERER', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '(none)'); $body .= $this->_format('User', $user); $body .= $this->_format('Time', date('H:i:s')); if (isset($_SERVER['HTTP_USER_AGENT'])) { $body .= $this->_format('_USERAGENT', $_SERVER['HTTP_USER_AGENT']); } $body .= $this->_format('_GET', print_r($_GET, true)); $body .= $this->_format('_POST', print_r($_POST, true)); $body .= $this->_format('_SERVER', print_r($_SERVER, true)); $body .= $this->_format('_FILES', print_r($_FILES, true)); if (isset($_SESSION)) { $body .= $this->_format('_SESSION', print_r($_SESSION, true)); } try { $request = Kwf_Controller_Front::getInstance()->getRequest(); if ($request && $request instanceof Zend_Controller_Request_Http) { $rawBody = $request->getRawBody(); if ($rawBody) { if (defined('JSON_PRETTY_PRINT') && substr($rawBody, 0, 1) == '{' && is_object(json_decode($rawBody)) && json_last_error() == JSON_ERROR_NONE) { $rawBody = json_encode(json_decode($rawBody), JSON_PRETTY_PRINT); } $body .= $this->_format('RawBody', $rawBody); } } } catch (Exception $e) { } return $body; }
private function _getRedirectBackUrl() { $redirectBackUrl = Kwf_Controller_Front::getInstance()->getRouter()->assemble(array('controller' => 'login', 'action' => 'redirect-callback'), 'kwf_user'); $redirectBackUrl = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $redirectBackUrl; return $redirectBackUrl; }
<?php chdir(dirname(__FILE__) . '/tests'); set_include_path('.' . PATH_SEPARATOR . realpath(getcwd() . '/..')); define('VENDOR_PATH', '../vendor'); require 'Kwf/Setup.php'; Kwf_Setup::setUp(); if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'] == '/') { echo Kwf_Registry::get('config')->application->kwf->name . ' ' . Kwf_Registry::get('config')->application->kwf->version; exit; } $front = Kwf_Controller_Front::getInstance(); $front->addControllerDirectory(KWF_PATH . '/tests', 'kwf_test'); $front->addControllerDirectory(KWF_PATH . '/tests/controller', 'tests_controller'); $router = $front->getRouter(); if ($router instanceof Kwf_Controller_Router) { //für selenium-tests von sachen die im kwf liegen $router->AddRoute('kwf_test', new Zend_Controller_Router_Route('/kwf/test/:controller/:action', array('module' => 'kwf_test', 'action' => 'index'))); $router->AddRoute('kwf_kwctest', new Zend_Controller_Router_Route_Regex('kwf/kwctest/([^/]+)/(.*)', array('module' => 'tests_controller', 'controller' => 'render-component', 'action' => 'index', 'url' => ''), array('root' => 1, 'url' => 2))); $router->AddRoute('kwf_test_componentedit', new Zend_Controller_Router_Route('/kwf/componentedittest/:root/:class/:componentController/:action', array('module' => 'component_test', 'controller' => 'component_test', 'action' => 'index'))); } $front->setBaseUrl(''); $response = $front->dispatch(); $response->sendResponse();