public function processRequest(MMapRequest $request, MMapResponse $response) { ob_start('mb_output_handler'); MMapManager::startSession(); //check if the session has expired MMapManager::checkSessionExpiration(); $return = null; $dataManager = DataManager::getInstance(); // restore current process using checknum $myProcManager = ProcManager::getInstance(); $myProcess = $myProcManager->getProcessByChecknum($request->getGET('checknum')); $myProcManager->setCurrentProcess($myProcess); $appDesc = new EyeosApplicationDescriptor($myProcess->getName()); $POST = $request->getPOST(); $params = array(); if (isset($POST['params'])) { $params = $dataManager->doInput($POST['params']); } else { if ($request->issetGET('params')) { $params = $request->getGET('params'); } } $methodName = $request->getGET('message'); // calling an ExecModule if (strpos($methodName, '__') === 0) { $moduleName = explode('_', substr($methodName, 2)); $methodName = $moduleName[1]; //ex: "FileChooser" $moduleName = $moduleName[0]; //ex: "browsePath" $return = call_user_func_array(array($appDesc->getApplicationClassName(), '__callModule'), array($moduleName, $methodName, $params)); } else { if ($appDesc->isJavascriptOnlyApplication()) { $return = call_user_func(array('EyeosJavascriptApplicationExecutable', $methodName), $params); } else { $return = call_user_func(array($appDesc->getApplicationClassName(), $methodName), $params); } } //try to force mime type. If there is a previous mime type defined at application level //this have no effect if (!headers_sent()) { $response->getHeaders()->append('Content-type:text/plain'); } if ($response->getBodyRenderer() === null && $response->getBody() == '') { $response->setBodyRenderer(new DataManagerBodyRenderer($return)); } }
public static function createLink($params) { $structure = array(); $structure['app'] = $params[0]; $structure['type'] = 'application'; //we need to fill $structure['icon'] with the application icon! $app = new EyeosApplicationDescriptor(utf8_basename($params[0])); $icon = FSI::toExternalUrl($app->getMeta()->get('eyeos.application.iconUrl')); $structure['icon'] = str_replace('eyeos/extern/', 'index.php?extern=', $icon); $linkName = utf8_basename($params[0]); $info = pathinfo($linkName); if (!isset($info['extension']) || $info['extension'] != 'lnk') { $linkName .= '.lnk'; } $path = 'home:///Desktop/'; $text = json_encode($structure); $newFile = FSI::getFile($path . '/' . $linkName); $newFile->createNewFile(); $newFile->putContents($text); $newfile = FSI::getFile($path . '/' . $linkName); $meta = $newfile->getMeta(); $meta->set('iconPositionX', $params[1]); $meta->set('iconPositionY', $params[2]); $newfile->setMeta($meta); $return = array('class' => get_class($newfile), 'type' => $newfile->isDirectory() ? 'folder' : ($newfile->isLink() ? 'link' : 'file'), 'extension' => utf8_strtoupper($newfile->getExtension()), 'size' => $newfile->isDirectory() ? 0 : $newfile->getSize(), 'permissions' => $newfile->getPermissions(false), 'owner' => $newfile->getOwner(), 'group' => $newfile->getGroup(), 'absolutepath' => $newfile->getAbsolutePath(), 'meta' => $newfile->getMeta()->getAll()); if ($return['extension'] == 'LNK') { $return['content'] = $newfile->getContents(); } $return['name'] = $newfile->getName() != '/' ? $newfile->getName() : $return['absolutepath']; if ($newfile instanceof EyeosAbstractVirtualFile) { $return['virtual'] = 'true'; } else { $return['virtual'] = 'false'; } return $return; }
public function getPath() { return parent::getPath() . '/mobile'; }
public function searchApplication($input) { $directory = new DirectoryIterator(EYE_ROOT . '/' . APPS_DIR); $searchResults = array(); foreach ($directory as $fileInfo) { $fileInfoName = $fileInfo->getFilename(); if ($fileInfo->isDir() && $fileInfoName[0] != '.') { if (!empty($input)) { $app = new EyeosApplicationDescriptor($fileInfoName); $meta = $app->getMeta(); if (stristr($fileInfoName, $input) || stristr($meta->get('eyeos.application.name'), $input) || stristr($meta->get('eyeos.application.description'), $input)) { $searchResults[] = $app; } } else { $searchResults[] = new EyeosApplicationDescriptor($fileInfoName); } } } return $searchResults; }