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 static function __run(AppExecutionContext $context, MMapResponse $response) { $args = $context->getArgs(); if (!isset($args[0]) || !is_string($args[0])) { throw new EyeMissingArgumentException('Missing filename to open.'); } try { $file = FSI::getFile($args[0]); } catch (Exception $e) { throw new EyeInvalidArgumentException('args[0] must be a valid path to a file.', 0, $e); } $appName = false; if ($file->isDirectory()) { $appName = 'files'; } else { $extension = utf8_strtolower($file->getExtension()); // TODO: Currently hard-coded here but in the future associations will be read from a DB. // We must have general entries, common to all the users of the system, that will be used // as default, and then user-customized entries with a higher priority on the general ones. switch ($extension) { // // VIEWER // case 'jpg': case 'gif': case 'jpeg': case 'png': case 'htm': case 'html': case 'flv': case 'm4a': case 'mp3': $appName = 'viewer'; break; // // EDITOR // // // EDITOR // case 'txt': case 'xml': case 'ini': case 'js': case 'sql': case 'log': $appName = 'femto'; break; } } // Association found: execute matching application if ($appName) { $myProcess = ProcManager::getInstance()->getCurrentProcess(); // prepare context and execute application $currentAppDesc = new EyeosApplicationDescriptor($appName); $appContext = new AppExecutionContext(); $appContext->setParentProcess($myProcess); $appContext->setApplicationDescriptor($currentAppDesc); $appContext->setArgs(clone $args); MMapGetApp::getInstance()->processRequest(MMapManager::getCurrentRequest(), $response, $appContext); // Kill our process $context->setExecuteJavascript(false); ProcManager::getInstance()->kill($myProcess); return; } // Otherwise, show the OpenWith dialog }