public function processRequest(MMapRequest $request, MMapResponse $response) { ob_start('mb_output_handler'); MMapManager::startSession(); MMapManager::checkSessionExpiration(); $username = $request->issetPOST('username') ? $request->getPOST('username') : ''; $password = $request->issetPOST('password') ? $request->getPOST('password') : ''; $loginPage = $request->issetPOST('loginPage') ? $request->getPOST('loginPage') : ''; $subject = new Subject(); $loginContext = new LoginContext('eyeos-login', $subject); $cred = new EyeosPasswordCredential(); $cred->setUsername($username); $cred->setPassword($password, true); $subject->getPrivateCredentials()->append($cred); try { $loginContext->login(); $memoryManager = MemoryManager::getInstance(); Kernel::enterSystemMode(); $memoryManager->set('isExternLogin', 1); $memoryManager->set('username', $username); $memoryManager->set('password', $password); $memoryManager->set('loginPage', $loginPage); Kernel::exitSystemMode(); header("Location: index.php"); } catch (Exception $e) { header("Location:" . $loginPage . "?errorLogin=1"); } }
/** * @throws EyeSessionExpiredException */ public static function checkSessionExpiration() { Kernel::enterSystemMode(); $regenerated = MemoryManager::getInstance()->get('regenerated', 1); Kernel::exitSystemMode(); if ($regenerated == 1) { MemoryManager::getInstance()->reset(); throw new EyeSessionExpiredException('Session expired.'); } }
public static function __run(AppExecutionContext $context, MMapResponse $response) { $myMemoryManager = MemoryManager::getInstance(); Kernel::enterSystemMode(); $isExternLogin = $myMemoryManager->get('isExternLogin'); $loginPage = $myMemoryManager->get('loginPage'); Kernel::exitSystemMode(); $context->getArgs()->append($isExternLogin); if ($isExternLogin) { $context->getArgs()->append($loginPage); } }
public static function __run(AppExecutionContext $context, MMapResponse $response) { $memoryManager = MemoryManager::getInstance(); Kernel::enterSystemMode(); $isExternLogin = $memoryManager->get('isExternLogin'); Kernel::exitSystemMode(); $list = new ArrayList(); $list->append($isExternLogin); if ($isExternLogin) { Kernel::enterSystemMode(); $username = $memoryManager->get('username'); $password = $memoryManager->get('password'); Kernel::exitSystemMode(); $list->append($username); $list->append($password); } $context->setArgs($list); $response->appendToBody('eyeos.isRegisterActive=' . self::isRegisterActive() . ';'); }
public function processRequest(MMapRequest $request, MMapResponse $response) { $urlName = $request->getGET('download'); if (is_array($urlName)) { exit; } $urlShare = new UrlShare(); $urlShare->setName($urlName); $urlShareController = UrlShareController::getInstance(); $urlShare = current($urlShareController->searchUrl($urlShare)); if ($urlShare) { if ($urlShare->getExpirationDate() < time()) { self::renderErrorMessage($response, 'Url Expired'); return; } $file = new UrlFile(); $file->setId($urlShare->getFileId()); $urlShareController->readFile($file); if ($file) { $fileName = basename($file->getPath()); $currentFile = FSI::getFile($file->getPath()); $size = $currentFile->getSize(); $unim = array('B', 'KB', 'MB', 'GB', 'TB', 'PB'); $c = 0; while ($size >= 1024) { $c++; $size = $size / 1024; } $size = number_format($size, $c ? 2 : 0, ',', '.') . ' ' . $unim[$c]; if ($request->issetGET('wrongPassword')) { $wrongPassword = $request->getGET('wrongPassword'); } else { $wrongPassword = 0; } Kernel::exitSystemMode(); self::renderFoundFile($fileName, $size, $urlName, $response, $urlShare->getPassword(), $wrongPassword); } else { self::renderErrorMessage($response, 'File not available'); } } else { self::renderErrorMessage($response, 'File not available'); } }
/** * Change the LoginContext associated with an existing process * * @param int $pid * @param LoginContext $loginContext * @throws EyeInvalidArgumentException If the arguments are incorrect * @throws EyeProcException If there is no such process with the given pid */ public function setProcessLoginContext($pid, LoginContext $loginContext) { $processTable = $this->getProcessesTable(); if (!isset($processTable[$pid])) { throw new EyeProcException('Process $proc with PID ' . $pid . ' not found.'); } $processTable[$pid]->setLoginContext($loginContext); if ($this->currentProcess->getPid() == $pid) { $this->currentProcess = $processTable[$pid]; } Kernel::enterSystemMode(); $this->memoryManager->set('processTable', $processTable); Kernel::exitSystemMode(); $this->fireEvent('loginContextChanged', new ProcEvent($processTable[$pid])); }