public function dispatch() { $fileName = Wax_Request::getInstance()->getRequestUri(); $fileName = str_replace('/@@/', '', $fileName); $fileName = str_replace('/', '', $fileName); $filePath = $this->_iconPath . $fileName . '.' . $this->_defaultExt; $readFile = file_get_contents($filePath); Wax_Response::getInstance()->setHeader('Content-Type', 'image/' . $this->_defaultExt)->appendBody($readFile)->sendResponse(); }
public function dispatch() { $fileName = Wax_Request::getInstance()->getRequestUri(); $fileName = str_replace('/@JavaScript/', '', $fileName); $fileName = str_replace('/', '', $fileName); $fileName = str_replace('_', '/', $fileName); $filePathModules = $this->_modulesPath . $fileName . '.' . $this->_defaultExt; $filePathLibrary = $this->_libraryPath . $fileName . '.' . $this->_defaultExt; if (file_exists($filePathModules)) { $readFile = file_get_contents($filePathModules); } elseif (file_exists($filePathLibrary)) { $readFile = file_get_contents($filePathLibrary); } else { $readFile = ''; } Wax_Response::getInstance()->setHeader('Content-Type', 'text/javascript')->appendBody($readFile)->sendResponse(); }
public static function start() { if (self::$_sessionStarted) { return; } self::$_sessionStarted = true; self::$_sessionDestroyed = false; $requestSID = Wax_Request::getInstance()->SID; if (!empty($requestSID)) { self::$_idSesiones = $requestSID; } elseif (isset($_COOKIE['Standard8_Session_SID'])) { self::$_idSesiones = $_COOKIE['Standard8_Session_SID']; } if (strlen(self::$_idSesiones) > 0) { self::$_data = Wax_Db::select()->from(array('s' => TABLE_SESIONES), array('fecha'))->where('id_sesiones', self::$_idSesiones)->joinInner(array('p' => TABLE_PERSONAS), 'p.id_personas = s.id_personas', array('usuario', 'clave'))->query()->fetchRow(); if (empty(self::$_data)) { self::destroy(); } } }
<?php error_reporting(E_ALL | E_STRICT); $rootPath = '../'; include_once $rootPath . 'includes/config.php'; include_once $rootPath . 'includes/constants.php'; set_include_path(get_include_path() . PATH_SEPARATOR . LIBRARY_PATH . PATH_SEPARATOR . MODULES_PATH); include_once 'Wax/Factory.php'; Wax_Factory::includeClass('Wax_Request'); Wax_Factory::includeClass('Wax_Response'); $requestURI = Wax_Request::getInstance()->getRequestUri(); if (strncmp($requestURI, '/@@/', 4) == 0) { Wax_Factory::includeClass('Wax_Controller_Icon'); Wax_Controller_Icon::getInstance()->setIconPath(ICON_PATH)->dispatch(); } elseif (strncmp($requestURI, '/@JavaScript/', 5) == 0) { Wax_Factory::includeClass('Wax_Controller_JavaScript'); Wax_Controller_JavaScript::getInstance()->setModulesPath(MODULES_PATH)->setLibraryPath(LIBRARY_PATH)->dispatch(); } elseif (strncmp($requestURI, '/~', 2) == 0) { Wax_Factory::includeClass('Wax_Controller_Profile'); Wax_Controller_Profile::getInstance()->setProfileClass(array('Standard8', 'Personas_Perfil'))->dispatch(); } else { Wax_Factory::includeClass('Wax_Controller_Front'); Wax_Factory::includeClass('Wax_Session'); Wax_Factory::includeClass('Wax_Db'); Wax_Factory::includeClass('Standard8_Config'); Wax_Factory::includeClass('Standard8_Session'); Wax_Factory::includeClass('Standard8_Uri'); Wax_Session::start(); Wax_Locale::setLocalePath(LOCALE_PATH); Wax_Locale::__init(); Wax_Db::open($dbConfig);
public function dispatch() { if ($this->_dispatched) { return; } $this->_dispatched = true; $requestURI = Wax_Request::getInstance()->getRequestUri(); if (strpos($requestURI, '?') !== false) { $requestURI = substr($requestURI, 0, strpos($requestURI, '?')); } $requestURI = explode('/', $requestURI); $parameters = array(); $title = array(); $classInstance = null; $serverName = Wax_Request::getInstance()->getServer('SERVER_NAME'); $serverName = explode('.', $serverName); if ($serverName[0] != 'standard8') { $currentModule = ucfirst($serverName[0]); } else { $currentModule = $this->_moduleDefault; } if (strlen($this->_moduleBase) > 0 && strlen($this->_classBase) > 0) { $classBase = $this->instanceClass(null, array($this->_moduleBase, $this->_classBase)); } if ((strlen($this->_classForce) == 0 || sizeof($this->_classForce) == 0) && is_array($requestURI) && sizeof($requestURI) > 0) { foreach ($requestURI as $key => $value) { if (strlen($value) == 0) { unset($requestURI[$key]); } } for ($i = sizeof($requestURI); $i > 0; $i--) { $continue = true; $filePath = str_replace(' ', '/', ucwords(implode(' ', $requestURI))); $fileName = $this->_binaryPath . '' . $currentModule . '/' . $filePath . '.php'; if (file_exists($fileName)) { if (include_once $fileName) { $className = implode('_', $requestURI); if (class_exists($className)) { if ($classBase) { $classReflection = new ReflectionClass($className); $classConstructor = $classReflection->getConstructor(); $classConstructorParams = $classConstructor->getParameters(); if (sizeof($classConstructorParams) == 0) { $continue = false; } elseif (isset($classConstructorParams[0])) { if ($classConstructorParams[0]->getClass()->name != $this->_classBase) { $continue = false; } } } if ($continue) { $title[] = implode(' :: ', $requestURI); $classParam = array($currentModule, $className); $classInstance = $this->instanceClass($classBase, $classParam, $parameters); if ($classInstance === true) { return true; } elseif ($classInstance === false) { $classInstance = null; } } } } } array_unshift($parameters, array_pop($requestURI)); } } # Wax_Document::$head->setTitle($title, ' :: '); if (strlen($this->_moduleBase) > 0 && strlen($this->_classBase) > 0) { if ($classBase) { if (strlen($this->_moduleForce) > 0 && strlen($this->_classForce) > 0) { $classForce = $this->instanceClass($classBase, array($this->_moduleForce, $this->_classForce)); if ($classForce) { if (method_exists($classBase, 'appendContent')) { $classBase->appendContent($classForce); } else { $classBase->appendChild($classForce); } } } elseif (isset($classInstance) && !is_null($classInstance)) { if (method_exists($classBase, 'appendContent')) { $classBase->appendContent($classInstance); } else { $classBase->appendChild($classInstance); } } elseif (strlen($this->_moduleDefault) > 0 && strlen($this->_classDefault) > 0) { $classDefault = $this->instanceClass($classBase, array($this->_moduleDefault, $this->_classDefault)); if ($classDefault) { if (method_exists($classBase, 'appendContent')) { $classBase->appendContent($classDefault); } else { $classBase->appendChild($classDefault); } } } Wax_Document::$body->appendChild($classBase); } } elseif (isset($classInstance) && !is_null($classInstance)) { Wax_Document::$body->appendChild($classInstance); } Wax_Response::getInstance()->appendBody(Wax_Document::__toString())->sendResponse(); return true; }