public function executesettheme($eventData) { $userCfg = new UserSettings(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess(), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getUserId()); $userCfg->setKey('wui-theme', $eventData['theme']); if (User::isAdminUser(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getUserName(), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDomainId())) { $domainCfg = new DomainSettings(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess()); $domainCfg->EditKey('wui-theme', $eventData['theme']); } $wui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui'); $wui->setTheme($eventData['theme']); \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('Location', WuiEventsCall::buildEventsCallString('', array(array('view', 'default', ''), array('action', 'settheme2', '')))); }
protected function findWelcomeFile($path) { if (substr($path, -1) != '/') { $path .= '/'; } reset($this->welcomeFiles); foreach ($this->welcomeFiles as $welcomefile) { if (file_exists(substr(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome(), 0, -1) . $path . $welcomefile . '.php')) { return $welcomefile; } } return null; }
public function doGet(\Innomatic\Webapp\WebAppRequest $req, \Innomatic\Webapp\WebAppResponse $res) { // identify the requested resource path $resource = substr(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome(), 0, -1) . '/root' . $req->getPathInfo(); $ignore_lock = false; // make sure that this path exists on disk switch (substr($resource, strrpos($resource, '/') + 1)) { /* case 'main': case 'menu': case 'logo': break; */ case 'unlock': $ignore_lock = true; break; default: if (substr($resource, -1, 1) != '/' and !file_exists($resource . '.php') and !is_dir($resource . '-panel')) { $res->sendError(\Innomatic\Webapp\WebAppResponse::SC_NOT_FOUND, $req->getRequestURI()); return; } } // Bootstraps Innomatic $innomatic = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); if ($ignore_lock) { $innomatic->setLockOverride(true); } // Sets Innomatic base URL $baseUrl = ''; $webAppPath = $req->getUrlPath(); if (!is_null($webAppPath) && $webAppPath != '/') { $baseUrl = $req->generateControllerPath($webAppPath, true); } $innomatic->setBaseUrl($baseUrl); $innomatic->setInterface(\Innomatic\Core\InnomaticContainer::INTERFACE_WEB); $home = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome(); $innomatic->bootstrap($home, $home . 'core/conf/innomatic.ini'); if ($innomatic->getState() == \Innomatic\Core\InnomaticContainer::STATE_SETUP) { $innomatic->abort('Setup phase'); } if (!headers_sent()) { // Starts output compression. if ($innomatic->getConfig()->value('CompressedOutputBuffering') == '1') { ini_set('zlib.output_compression', 'on'); ini_set('zlib.output_compression_level', 6); } } \Innomatic\Desktop\Controller\DesktopFrontController::instance('\\Innomatic\\Desktop\\Controller\\DesktopFrontController')->execute(\Innomatic\Core\InnomaticContainer::MODE_ROOT, $resource); }
public function doGet(\Innomatic\Webapp\WebAppRequest $req, \Innomatic\Webapp\WebAppResponse $res) { // Start Innomatic $innomatic = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); $innomatic->setInterface(\Innomatic\Core\InnomaticContainer::INTERFACE_EXTERNAL); $root = \Innomatic\Core\RootContainer::instance('\\Innomatic\\Core\\RootContainer'); $innomatic_home = $root->getHome() . 'innomatic/'; $innomatic->bootstrap($innomatic_home, $innomatic_home . 'core/conf/innomatic.ini'); // Start Innomatic domain \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->startDomain(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getName()); // Innomedia page $scope_page = 'frontend'; // Check if the page exists in the page tree $pageSearch = PageTree::findPageByPath(substr($req->getPathInfo(), 1)); if ($pageSearch === false) { // This is a static page (excluding the home page). $location = explode('/', $req->getPathInfo()); $module_name = isset($location[1]) ? $location[1] : ''; $page_name = isset($location[2]) ? $location[2] : ''; $pageId = isset($location[3]) ? $location[3] : 0; } else { // This is the home page or a content page. $module_name = $pageSearch['module']; $page_name = $pageSearch['page']; $pageId = $pageSearch['page_id']; } // Define Innomatic context $home = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome(); $context = Context::instance('\\Innomedia\\Context'); $context->setRequest($req)->setResponse($res)->process(); // Build Innomedia page $page = new Page($module_name, $page_name, $pageId, $scope_page); $page->parsePage(); // Check if the page is valid if (!$page->isValid()) { $res->sendError(\Innomatic\Webapp\WebAppResponse::SC_NOT_FOUND, $req->getRequestURI()); } else { $page->build(); } }
/** * Parses webapp configuration. */ protected function parseConfig($xmlconfig) { $container = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer'); if ($container->useDefaults() or !$container->isKey('webapps.cache_config') or $container->getKey('webapps.cache_config')) { $cache_dir = $this->getVarDir() . 'cache/'; if (false and file_exists($cache_dir . 'WebAppConfig.ser')) { $cfg = unserialize(file_get_contents($cache_dir . 'WebAppConfig.ser')); } else { $cfg = simplexml_load_file($xmlconfig); if (!is_dir($cache_dir)) { @mkdir($cache_dir); } // TODO: Sistemare //@file_put_contents($cache_dir.'WebAppConfig.ser', serialize($cfg)); } } else { $cfg = simplexml_load_file($xmlconfig); } $this->displayName = sprintf('%s', $cfg->displayname); $this->description = sprintf('%s', $cfg->description); foreach ($cfg->contextparam as $param) { $this->parameters[sprintf('%s', $param->paramname)] = sprintf('%s', $param->paramvalue); } foreach ($cfg->mimemapping as $mimemapping) { $this->mimeMappings[sprintf('%s', $mimemapping->extension)] = sprintf('%s', $mimemapping->mimetype); } foreach ($cfg->handlermapping as $handlermapping) { $this->handlerMappings[sprintf('%s', $handlermapping->urlpattern)] = sprintf('%s', $handlermapping->handlername); } foreach ($cfg->welcomefilelist as $welcomefile) { $this->welcomeFiles[] = sprintf('%s', $welcomefile->welcomefile); } foreach ($cfg->handler as $handler) { $name = sprintf('%s', $handler->handlername); $this->handlers[$name]['class'] = sprintf('%s', $handler->handlerclass); foreach ($handler->initparam as $params) { $this->handlers[$name]['params'][sprintf('%s', $params->paramname)] = sprintf('%s', $params->paramvalue); } } }
public function doGet(WebAppRequest $req, WebAppResponse $res) { // Start Innomatic and Tenant $innomatic = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); $innomatic->setInterface(\Innomatic\Core\InnomaticContainer::INTERFACE_EXTERNAL); $root = \Innomatic\Core\RootContainer::instance('\\Innomatic\\Core\\RootContainer'); $innomatic_home = $root->getHome() . 'innomatic/'; $innomatic->bootstrap($innomatic_home, $innomatic_home . 'core/conf/innomatic.ini'); $innomatic->startDomain(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getName()); $request_uri = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getRequest()->getUrlPath(true) . '/_xajax/call.xajax'; $xajax = Xajax::instance('Xajax', $request_uri); // Set debug mode if ($innomatic->getState() == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) { $xajax->debugOn(); } $xajax->setLogFile($innomatic->getHome() . 'core/log/ajax.log'); $cfg = XajaxConfig::getInstance(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp(), \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome() . 'core/conf/ajax.xml'); if (isset($cfg->functions)) { foreach ($cfg->functions as $name => $functionData) { $xajax->registerExternalFunction(array($name, $functionData['classname'], $functionData['method']), $functionData['classfile']); } } $xajax->processRequests(); }
protected function generateSourceBegin() { $dashboard_id = ''; $prefs_id = ''; $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); // Check if Innomatic is in setup phase if (!($container->getState() == \Innomatic\Core\InnomaticContainer::STATE_SETUP)) { // Check if Innomatic is in root or domain mode if (!$container->isDomainStarted()) { // Root mode $root_db = $container->getDataAccess(); $groups_query = $root_db->execute('SELECT * FROM root_panels_groups ORDER BY name'); $num_groups = $groups_query->getNumberRows(); $tabs = array(); $tab_pages = array(); if ($num_groups > 0) { $cont_a = 0; unset($el); while (!$groups_query->eof) { $group_apps = false; $group_data = $groups_query->getFields(); if (strlen($group_data['catalog'])) { $tmp_locale = new LocaleCatalog($group_data['catalog'], $container->getLanguage()); $el[$group_data['id']]['groupname'] = $tmp_locale->getStr($group_data['name']); } else { $el[$group_data['id']]['groupname'] = $group_data['name']; } $pagesquery = $root_db->execute('SELECT * FROM root_panels WHERE groupid=' . $group_data['id'] . ' ORDER BY name'); if ($pagesquery) { $pagesnum = $pagesquery->getNumberRows(); if ($pagesnum > 0) { $group_apps = true; $cont_b = 0; while (!$pagesquery->eof) { $pagedata = $pagesquery->getFields(); if (strlen($pagedata['catalog']) > 0) { $tmploc = new LocaleCatalog($pagedata['catalog'], $container->getLanguage()); $descstr = $tmploc->getStr($pagedata['name']); } $tmp_eventscall = new \Innomatic\Wui\Dispatch\WuiEventsCall($pagedata['name']); $tmp_eventscall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', '')); if (strlen($pagedata['themeicontype'])) { $imageType = $pagedata['themeicontype']; } else { $imageType = 'icons'; } strlen($pagedata['themeicon']) and isset($this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']]) ? $imageUrl = $this->mThemeHandler->mIconsBase . $this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']]['base'] . '/' . $imageType . '/' . $this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']]['file'] : ($imageUrl = $pagedata['iconfile']); $el[$group_data['id']]['groupelements'][$cont_b]['name'] = $descstr; $el[$group_data['id']]['groupelements'][$cont_b]['image'] = $imageUrl; $el[$group_data['id']]['groupelements'][$cont_b]['action'] = $tmp_eventscall->getEventsCallString(); $el[$group_data['id']]['groupelements'][$cont_b]['themesized'] = 'true'; unset($tmp_eventscall); $cont_b++; $pagesquery->moveNext(); } } } // TODO Check if this section is for compatibility only - and remove it if ($group_data['name'] == 'innomatic') { $pagesquery = $root_db->execute('SELECT * FROM root_panels WHERE groupid=0 OR groupid IS NULL ORDER BY name'); if ($pagesquery) { $pagesnum = $pagesquery->getNumberRows(); if ($pagesnum > 0) { $group_apps = true; while (!$pagesquery->eof) { $pagedata = $pagesquery->getFields(); if (strlen($pagedata['catalog']) > 0) { $tmploc = new LocaleCatalog($pagedata['catalog'], $container->getLanguage()); $descstr = $tmploc->getStr($pagedata['name']); } $tmp_eventscall = new \Innomatic\Wui\Dispatch\WuiEventsCall($pagedata['name']); $tmp_eventscall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', '')); $el[$group_data['id']]['groupelements'][$cont_b]['name'] = $descstr; $el[$group_data['id']]['groupelements'][$cont_b]['image'] = $pagedata['iconfile']; $el[$group_data['id']]['groupelements'][$cont_b]['action'] = $tmp_eventscall->getEventsCallString(); $el[$group_data['id']]['groupelements'][$cont_b]['themesized'] = 'true'; unset($tmp_eventscall); $cont_b++; $pagesquery->moveNext(); } } } } $groups_query->moveNext(); if ($group_apps) { $cont_a++; } else { unset($el[$group_data['id']]); } } } } else { // Domain mode $tmpperm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($container->getCurrentDomain()->getDataAccess(), $container->getCurrentUser()->getGroup()); $tabs = array(); $tab_pages = array(); $groupsquery = $container->getCurrentDomain()->getDataAccess()->execute('SELECT * FROM domain_panels_groups ORDER BY name'); $numgroups = $groupsquery->getNumberRows(); if ($numgroups > 0) { $prefs_id = 0; $tools_id = 0; $dashboard_id = 0; $cont = 0; unset($el); while (!$groupsquery->eof) { $group_apps = false; $groupdata = $groupsquery->getFields(); if ($tmpperm->check($groupdata['id'], 'group') != \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { switch ($groupdata['name']) { case 'tools': $tools_id = $groupdata['id']; break; case 'preferences': $prefs_id = $groupdata['id']; break; case 'dashboard': $dashboard_id = $groupdata['id']; break; } if (strlen($groupdata['catalog']) > 0) { $tmploc = new LocaleCatalog($groupdata['catalog'], $container->getCurrentUser()->getLanguage()); $descstr = $tmploc->getStr($groupdata['name']); $el[$groupdata['id']]['groupname'] = $descstr; } else { $el[$group_data['id']]['groupname'] = $groupdata['name']; } $pagesquery = $container->getCurrentDomain()->getDataAccess()->execute('SELECT * FROM domain_panels WHERE groupid = ' . $groupdata['id'] . ' AND (hidden != ' . $container->getCurrentDomain()->getDataAccess()->formatText($container->getCurrentDomain()->getDataAccess()->fmttrue) . ' OR hidden IS NULL) ORDER BY name'); $pagesnum = $pagesquery->getNumberRows(); if ($pagesnum > 0) { $group_apps = true; $contb = 0; while (!$pagesquery->eof) { $pagedata = $pagesquery->getFields(); if ($tmpperm->check($pagedata['id'], 'page') != \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { if (strlen($pagedata['catalog']) > 0) { $tmploc = new LocaleCatalog($pagedata['catalog'], $container->getCurrentUser()->getLanguage()); $descstr = $tmploc->getStr($pagedata['name']); $tmp_eventscall = new \Innomatic\Wui\Dispatch\WuiEventsCall($pagedata['name']); $tmp_eventscall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', '')); if (strlen($pagedata['themeicontype'])) { $imageType = $pagedata['themeicontype']; } else { $imageType = 'apps'; } (strlen($pagedata['themeicon']) and isset($this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']])) ? $imageUrl = $this->mThemeHandler->mIconsBase . $this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']]['base'] . '/' . $imageType . '/' . $this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']]['file'] : ($imageUrl = $pagedata['iconfile']); $el[$groupdata['id']]['groupelements'][$contb]['name'] = $descstr; $el[$groupdata['id']]['groupelements'][$contb]['image'] = $imageUrl; $el[$groupdata['id']]['groupelements'][$contb]['action'] = $tmp_eventscall->getEventsCallString(); $el[$groupdata['id']]['groupelements'][$contb]['themesized'] = 'true'; unset($tmp_eventscall); } } $pagesquery->movenext(); $contb++; } } } // $cont++; if ($group_apps) { $cont++; } else { unset($el[$groupdata['id']]); } $groupsquery->movenext(); } //if ($prefs_id != 0) {} } } $menu = ''; // Dashboard is always the first menu if (isset($el[$dashboard_id])) { $menu .= '.|' . $el[$dashboard_id]['groupname'] . "\n"; foreach ($el[$dashboard_id]['groupelements'] as $panel) { $menu .= '..|' . $panel['name'] . '|' . $panel['action'] . "\n"; } } // Build the menu list foreach ($el as $id => $group) { // Skip dashboard and preferences menu if ($id == $prefs_id or $id == $dashboard_id) { continue; } $menu .= '.|' . $group['groupname'] . "\n"; foreach ($group['groupelements'] as $panel) { $menu .= '..|' . $panel['name'] . '|' . $panel['action'] . "\n"; } } // Preferences is always the last menu if (isset($el[$prefs_id])) { $menu .= '.|' . $el[$prefs_id]['groupname'] . "\n"; foreach ($el[$prefs_id]['groupelements'] as $panel) { $menu .= '..|' . $panel['name'] . '|' . $panel['action'] . "\n"; } } $registry = \Innomatic\Util\Registry::instance(); if (!$registry->isGlobalObject('singleton xlayersmenu')) { $mid = new \Innomatic\Wui\Widgets\Layersmenu\XLayersMenu(); $registry->setGlobalObject('singleton xlayersmenu', $mid); } else { $mid = $registry->getGlobalObject('singleton xlayersmenu'); } // Menu parameters $mid->libdir = $container->getHome() . 'core/lib/'; $mid->libwww = $container->getBaseUrl(false) . '/shared/'; $mid->tpldir = $container->getHome() . 'core/conf/layersmenu/'; $mid->imgdir = $this->mThemeHandler->mStyleDir; $mid->imgwww = $this->mThemeHandler->mStyleBase . $this->mThemeHandler->mStyleName . '/'; $mid->setMenuStructureString($menu); $mid->setDownArrowImg(basename($this->mThemeHandler->mStyle['arrowdownshadow'])); $mid->setForwardArrowImg(basename($this->mThemeHandler->mStyle['arrowrightshadow'])); $mid->parseStructureForMenu($this->mName); $mid->newHorizontalMenu($this->mName); } // User data if ($container->isDomainStarted()) { $user_data = $container->getCurrentUser()->getUserData(); $user_name = $user_data['fname'] . ' ' . $user_data['lname']; $domain_name = $container->getCurrentDomain()->domaindata['domainname']; $logout_events_call = new \Innomatic\Wui\Dispatch\WuiEventsCall(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getRequest()->getUrlPath() . '/'); $innomatic_menu_locale = new LocaleCatalog('innomatic::domain_menu', $container->getCurrentUser()->getLanguage()); } else { // In root mode we show generic user data $user_name = 'root'; $domain_name = 'Innomatic'; $logout_events_call = new \Innomatic\Wui\Dispatch\WuiEventsCall(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getRequest()->getUrlPath() . '/root'); $innomatic_menu_locale = new LocaleCatalog('innomatic::root_menu', $container->getLanguage()); } $logout_events_call->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('login', 'logout', '')); // Check the environment type and set the title and the header bar color switch ($container->getEnvironment()) { case \Innomatic\Core\InnomaticContainer::ENVIRONMENT_DEVELOPMENT: // Development environment $domain_name .= ' (' . $innomatic_menu_locale->getStr('environment_development') . ')'; $env_class = 'headerbar_dev'; break; case \Innomatic\Core\InnomaticContainer::ENVIRONMENT_INTEGRATION: // Integration environment $domain_name .= ' (' . $innomatic_menu_locale->getStr('environment_integration') . ')'; $env_class = 'headerbar_integration'; break; case \Innomatic\Core\InnomaticContainer::ENVIRONMENT_STAGING: // Staging environment $domain_name .= ' (' . $innomatic_menu_locale->getStr('environment_staging') . ')'; $env_class = 'headerbar_staging'; break; case \Innomatic\Core\InnomaticContainer::ENVIRONMENT_PRODUCTION: // Production environment $env_class = 'headerbar'; break; } // HTML $charset = 'UTF-8'; // $block = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n"; // $block = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' . "\n"; $block = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n"; $block .= "<html>\n"; $block .= "<head>\n"; // WUI javascript $block .= '<script language="JavaScript" type="text/javascript" src="' . $container->getBaseUrl(false) . '/shared/wui.js"></script>' . "\n"; $block .= "<script language=\"JavaScript\" type=\"text/javascript\" src=\"" . $container->getBaseUrl(false) . '/shared/' . "layersmenu.js\"></script>\n"; // WUI style $block .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $this->mThemeHandler->mStyle['css'] . "\">\n"; // JQuery $block .= '<link href="' . $container->getBaseUrl(false) . '/shared/jquery/css/jquery-ui-1.10.3.custom.min.css" rel="stylesheet">' . "\n"; $block .= '<script language="JavaScript" type="text/javascript" src="' . $container->getBaseUrl(false) . '/shared/jquery/js/jquery-1.9.1.js"></script>' . "\n"; $block .= '<script language="JavaScript" type="text/javascript" src="' . $container->getBaseUrl(false) . '/shared/jquery/js/jquery-ui-1.10.3.custom.min.js"></script>' . "\n"; $block .= '<link href="' . $container->getBaseUrl(false) . '/shared/jquery/css/jquery_validation_errors.css" rel="stylesheet">' . "\n"; $block .= '<script language="JavaScript" type="text/javascript" src="' . $container->getBaseUrl(false) . '/shared/jquery/js/jquery.validate.js"></script>' . "\n"; // Favicon $block .= '<link rel="shortcut icon" href="' . $container->getBaseUrl(false) . '/favicon.png" type="image/png"/>' . "\n"; // PNG Behavior // @todo Consider removing support for PNG behavior $block .= "<style type=\"text/css\">\nimg {\nbehavior: url(\"" . $container->getBaseUrl(false) . '/shared/' . "pngbehavior.htc\");\n}\n</style>\n"; // Page title $block .= "<title>" . \Innomatic\Wui\Wui::utf8_entities($this->mArgs['title']) . "</title>\n"; // Optional inline javascript code $block .= (isset($this->mArgs['javascript']) and strlen($this->mArgs['javascript'])) ? "<script language=\"JavaScript\">\n<!--\n" . $this->mArgs['javascript'] . "\n//-->\n</script>\n" : ''; // Content type $block .= '<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '">' . "\n"; $block .= '<meta name="MSSmartTagsPreventParsing" content="true">' . "\n"; // Optional auto refresh if ($this->mArgs['refresh']) { $block .= '<meta http-equiv="refresh" content="' . $this->mArgs['refresh'] . '">' . "\n"; } $block .= "</head>\n"; $block .= '<body bgcolor="' . $this->mThemeHandler->mColorsSet['pages']['bgcolor'] . '"'; if (isset($this->mArgs['background']) and strlen($this->mArgs['background'])) { $block .= ' style="background-image: url(\'' . $this->mArgs['background'] . '\');'; if (isset($this->mArgs['horizbackground']) and $this->mArgs['horizbackground'] == 'true') { $block .= ' background-repeat: repeat-x;'; } $block .= '"'; } $block .= ">\n"; $block .= '<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="' . $this->mArgs['valign'] . '" align="' . $this->mArgs['align'] . '" style="height: 100%;">' . "\n"; if ($this->mArgs['border'] == 'true') { if (!($container->getState() == \Innomatic\Core\InnomaticContainer::STATE_SETUP)) { $menu_header = (isset($GLOBALS['gEnv']['runtime']['wui_menu']['header']) ? '' : $mid->MakeHeader()) . $mid->getMenu($this->mName); $menu_footer = $mid->MakeFooter(); } else { $menu_header = $menu_footer = ''; } $block .= "<table class=\"page\" border=\"0\" style=\"border-bottom: 0px solid " . $this->mThemeHandler->mColorsSet['pages']['border'] . ";\" width=\"100%\" cellspacing=\"0\" cellpadding=\"10\">\n" . '<thead id="page-thead" class="page"><tr class="' . $env_class . '">' . "\n" . "<td style=\"width: 100%; align: center; padding-left: 16px;\" align=\"left\">" . "<a href=\"" . $container->getBaseUrl(false) . "\"><img src=\"" . $this->mThemeHandler->mStyle['titlelogo'] . "\" align=\"left\" width=\"25\" height=\"25\" style=\"margin-right: 15px;\" border=\"0\" alt=\"Innomatic\"></a>" . "<span nowrap class=\"headerbar\" style=\"white-space: nowrap;\">" . $domain_name . '</span></td>' . '<td align="right" valign="middle" nowrap style="white-space: nowrap; padding-right: 10px;">' . '<table border="0" style="margin: 0px; padding: 0px;" cellpadding="0" cellspacing="0"><tr>'; if (!($container->getState() == \Innomatic\Core\InnomaticContainer::STATE_SETUP)) { $block .= '<td><span class="headerbar" style="white-space: nowrap;">' . $user_name . "</span></td>"; if ($container->isDomainStarted() == true) { // Tray bar items $domain_da = $container->getCurrentDomain()->getDataAccess(); $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($domain_da, $container->getCurrentUser()->getGroup()); // Extract the list of all the tray bar items $traybar_items_query = $domain_da->execute('SELECT * FROM domain_traybar_items ORDER BY name'); while (!$traybar_items_query->eof) { $panel = $traybar_items_query->getFields('panel'); // Do not show traybar items tied to a panel when the panel is not accessible to the current user if (strlen($panel)) { $node_id = $perm->getNodeIdFromFileName($panel); if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) == \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $traybar_items_query->moveNext(); continue; } } $class_name = $traybar_items_query->getFields('class'); if (class_exists($class_name)) { $traybar_item = new $class_name(); $traybar_item->prepare(); $block .= '<td style="padding-left: 15px;">' . $traybar_item->getHtml() . '</td>'; } $traybar_items_query->moveNext(); } } // Logout button $block .= '<td><a href="' . $logout_events_call->getEventsCallString() . '" alt="' . $innomatic_menu_locale->getStr('logout') . '"><img width="25" height="25" align="right" style="margin-left: 15px;" src="' . $this->mThemeHandler->mStyle['logout'] . '" alt="' . $innomatic_menu_locale->getStr('logout') . '" /></a></td>'; } // Menu and toolbar $block .= "</tr></table></td></tr>" . "<tr><td colspan=\"2\" style=\"border-bottom: 1px solid #cccccc; margin: 0px; padding: 0px; width: 100%; height: 45px; background-color: " . $this->mThemeHandler->mColorsSet['titlebars']['bgcolor'] . ";\" align=\"left\" valign=\"middle\" nowrap style=\"white-space: nowrap\">" . $menu_header . '</td></tr>' . "<tr><td id=\"sub-top-menu\" class=\"table-container\" colspan=\"2\" style=\"border-bottom: 1px solid #cccccc; margin: 0px; padding: 0px; height: 45px; background-color: white;\" align=\"left\" valign=\"middle\" nowrap style=\"white-space: nowrap\">" . "<table cellspacing=\"0\" cellpadding=\"0\" style=\"margin: 0px; padding: 4px;\"><tr><td>{[wui-titlebar-title]}{[wui-toolbars]}" . '</tr></table></td></tr><tr>' . '</thead><tbody id="page-tbody" class="page">' . "<td valign=\"top\" colspan=\"2\" style=\"\">\n"; // @todo Refactor and remove the globals $GLOBALS['gEnv']['runtime']['wui_menu']['header'] = true; $GLOBALS['gEnv']['runtime']['wui_menu']['footer'] = $menu_footer; } return $block; }
<?php /** * Innomatic * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE. * * @copyright 1999-2014 Innomatic Company * @license http://www.innomatic.io/license/ New BSD License * @link http://www.innomatic.io */ // Saves webapp home. $webAppHome = getcwd() . '/'; // Checks if this receiver script has been called directly. if ($webAppHome == dirname(__FILE__) . '/') { // Redirects to innomatic webapp. header('Location: innomatic/'); exit; } // Starts the Root Container. require_once dirname(__FILE__) . '/innomatic/core/classes/innomatic/core/RootContainer.php'; $rootContainer = \Innomatic\Core\RootContainer::instance('\\Innomatic\\Core\\RootContainer'); // Starts the WebAppContainer. $container = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer'); // Starts the WebApp. This is where all the real stuff is done. $container->startWebApp($webAppHome); // Stops the Root Container so that the instance is marked as cleanly exited. $rootContainer->stop();
/** * Gets the Innomatic webapp base URL, similar to the Domain webapp URL * field. Since the innomatic webapp lacks the Domain webapp URL field and * the getBaseUrl() method determines the URL assuming that the active * webapp is innomatic itself, this method has been added in order to * obtain the innomatic webapp public URL. * * The base URL is automatically discovered during Innomatic setup and is * stored inside innomatic.ini configuration file in InnomaticBaseUrl key. * * @return string */ public function getExternalBaseUrl() { // If already set, returns it. if (!empty($this->externalBaseUrl)) { return $this->externalBaseUrl; } // Not already set, so reads it from the configuration file. $this->externalBaseUrl = $this->config->value('InnomaticBaseUrl'); // Should be empty only during setup phase. if (empty($this->externalBaseUrl)) { $this->externalBaseUrl = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getRequest()->getRequestURL(); // Checks if the URL contains the setup layout frames names // and strips them away. switch (substr($this->externalBaseUrl, -5)) { case '/main': // break was intentionally omitted // break was intentionally omitted case '/logo': // break was intentionally omitted // break was intentionally omitted case '/menu': $this->externalBaseUrl = substr($this->externalBaseUrl, 0, -4); break; } } return $this->externalBaseUrl; }
public function run($webApp = '') { // Change current directory to the legacy stack. $platformHome = getcwd(); // @todo Must get innomatic_legacy path from configuration. chdir($platformHome . '/../innomatic_legacy/innomatic'); // Saves webapp home. $webAppHome = getcwd() . (strlen($webApp) ? '/../' . $webApp . '/' : '/'); // Start the legacy Root Container and the legacy autoloader. require_once getcwd() . '/core/classes/innomatic/core/RootContainer.php'; $rootContainer = \Innomatic\Core\RootContainer::instance('\\Innomatic\\Core\\RootContainer'); // Add the Symfony service container $rootContainer->setServiceContainer($this->container); // Starts the WebAppContainer. $container = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer'); ob_start(); // Starts the WebApp. This is where all the real stuff is done. $container->startWebApp($webAppHome); $result = ob_get_contents(); ob_end_clean(); // Stops the Root Container so that the instance is marked as cleanly exited. $rootContainer->stop(); chdir($platformHome); return $result; }
/** * Generate an HTML directory list showing the contents of the directory matching * the path following the webapp pattern. * * @todo I really would like to see this method refactored...it is very procedural!! * @todo instroduce ResourceInfo or some object handler for the resource we are working with * * NOTE: I am unsure how to proceed when the webapp path is not '/'. Tomcat leaves it * off for the links on each listing, which interrupts the browsing cycle. If I add it * in each time, then pages which would otherwise be caught by other webapps reveal their code, * such as PSP files. */ public function renderListing($request, $webAppPath, $path, $resource) { $container = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer'); $processor = $container->getProcessor(); $contextPath = $request->getUrlPath(); // build our base context path with the controller info //$basePath = $request->generateControllerPath($contextPath) . $webAppPath; $basePath = $processor->generateControllerPath($contextPath); // directories should end in a '/' if (substr($path, strlen($path) - 1) != '/') { $path .= '/'; } $out = '<html>'; $out .= '<head>'; $out .= '<title>Directory Listing For ' . $path . '</title>'; $out .= '<STYLE><!-- h1 { font-family: Tahoma,Arial,sans-serif; color: white; background-color: #525D76; font-size: 22px; } h2 { font-family: Tahoma,Arial,sans-serif; color: white; background-color: #525D76; font-size: 16px; } h3 { font-family: Tahoma,Arial,sans-serif; color: white; background-color: #525D76; font-size: 14px; } body { font-family: Tahoma,Arial,sans-serif; color: black; background-color: white; } b { font-family: Tahoma,Arial,sans-serif; color: white; background-color: #525D76; } p { font-family: Tahoma,Arial,sans-serif; background: white; color: black; font-size: 12px; } a { color: black; } a.name { color: black; } hr { color : #525D76; } th { font-size: 17px; } --></STYLE>'; $out .= '</head>'; $out .= '<body>'; $out .= '<h1>Directory Listing For ' . $path . '</h1>'; $out .= '<hr size="1" noshade="noshade" />'; $out .= '<table width="100%" cellspacing="0" cellpadding="5">'; $out .= '<tr>'; $out .= '<th style="text-align: left;">Filename</th>'; $out .= '<th style="text-align: center;">Size</th>'; $out .= '<th style="text-align: right;">Last Modified</th>'; $out .= '</tr>'; $shade = false; // if the path is not '/', then we have a parent if ($path != '/') { $parentPath = substr($path, 0, strrpos(rtrim($path, '/'), '/') + 1); $out .= '<tr>'; $out .= '<td style="text-align: left;"><a href="' . $basePath . $parentPath . '"><tt>'; $out .= '[Up to parent directory]'; $out .= '</tt></a></td>'; $out .= '<td style="text-align: right;"><tt>'; $out .= '</tt></td>'; $out .= '<td style="text-align: right;"><tt>'; $out .= gmdate('D, d M Y H:i:s T', filemtime($resource)); $out .= '</tt></td>'; $out .= '</tr>'; $shade = true; } // TODO sistemare $receiver = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getInitParameter('receiverfile'); if (!strlen($receiver)) { $receiver = 'index.php'; } $dh = opendir($resource); while (($child = readdir($dh)) !== false) { // don't accept parent, self, or special protected directories if (preg_match(';^(\\.|\\.\\.|core|setup|setup|\\.htaccess)$;i', $child)) { continue; } // don't allow the controller to be seen // @todo make the controller script a constant!! if ($path == '/' && $child == $receiver) { continue; } $childResource = $resource . DIRECTORY_SEPARATOR . $child; // add trailing slash for directories if (is_dir($childResource)) { $child .= '/'; } $out .= '<tr' . ($shade ? ' style="background-color: #EEEEEE;"' : '') . '>'; $out .= '<td style="text-align: left;"><a href="' . $basePath . $path . $child . '"><tt>'; $out .= $child; $out .= '</tt></a></td>'; $out .= '<td style="text-align: right;"><tt>'; $out .= is_file($childResource) ? $this->renderSize(filesize($childResource)) : ''; $out .= '</tt></td>'; $out .= '<td style="text-align: right;"><tt>'; $out .= gmdate('D, d M Y H:i:s T', filemtime($childResource)); $out .= '</tt></td>'; $out .= '</tr>'; $shade = !$shade; } closedir($dh); $out .= '</table>'; $out .= '<hr size="1" noshade="noshade" />'; $out .= '<h3>' . $request->getServerName() . '</h3>'; $out .= '</body>'; $out .= '</html>'; return $out; }
/** * Prefix the context path, our webapp emulator and append the request * parameters to the redirection string before calling sendRedirect. * * @param $request WebAppRequest * @param $redirectPath string * @return string */ protected function getURL(\Innomatic\Webapp\WebAppRequest $request, $redirectPath) { $result = ''; $container = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer'); $processor = $container->getProcessor(); $webAppPath = $request->getUrlPath(); if (!is_null($webAppPath) && $webAppPath != '/') { $result = $request->generateControllerPath($webAppPath, true); } $result .= '/webservices' . $redirectPath; $query = $request->getQueryString(); if (!is_null($query)) { $result .= '?' . $query; } return $result; }
function tenant_login_login($eventData) { $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); $username = $eventData['username']; // Handle the case when the root user tries to login from the tenant login form if (strcmp($username, 'root') === 0) { require_once 'innomatic/desktop/auth/DesktopRootAuthenticatorHelper.php'; \Innomatic\Desktop\Auth\root_login_login($eventData); $response = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse(); $response->sendRedirect($container->getBaseUrl(false) . '/root/'); $response->flushBuffer(); return; } $domainId = \Innomatic\Domain\User\User::extractDomainID($username); // Checks it it can find the domain by hostname if (!strlen($domainId)) { $domainId = \Innomatic\Domain\Domain::getDomainByHostname(); if (strlen($domainId)) { $username .= '@' . $domainId; } } // If no domain is found when in Multi Tenant edition, it must be reauth without // checking database, since no Domain can be accessed. if (!strlen($domainId)) { DesktopDomainAuthenticatorHelper::doAuth(true); } $tmpDomain = new \Innomatic\Domain\Domain($container->getDataAccess(), $domainId, null); $domainDA = $tmpDomain->getDataAccess(); $userQuery = $domainDA->execute('SELECT * FROM domain_users WHERE username='******' AND password='******'password']))); // Check if the user/password couple exists if ($userQuery->getNumberRows()) { // Check if the user is not disabled if ($userQuery->getFields('disabled') == $container->getDataAccess()->fmttrue) { DesktopDomainAuthenticatorHelper::doAuth(true, 'userdisabled'); } else { // Login ok, set the session key \Innomatic\Desktop\Controller\DesktopFrontController::instance('\\Innomatic\\Desktop\\Controller\\DesktopFrontController')->session->put('INNOMATIC_AUTH_USER', $username); $innomaticSecurity = new \Innomatic\Security\SecurityManager(); $innomaticSecurity->logAccess($username, false, false, $_SERVER['REMOTE_ADDR']); unset($innomaticSecurity); } } else { DesktopDomainAuthenticatorHelper::doAuth(true); } // unset( $INNOMATIC_ROOT_AUTH_USER ); }
public static function getDomainByHostname($hostname = '') { $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); if ($container->getEdition() == \Innomatic\Core\InnomaticContainer::EDITION_SINGLETENANT) { return false; } if (!strlen($hostname) and $container->getInterface() != \Innomatic\Core\InnomaticContainer::INTERFACE_WEB) { return false; } if (!strlen($hostname)) { $hostname = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getRequest()->getServerName(); } // Is it still empty? if (!strlen($hostname)) { return false; } $pos = strpos($hostname, '.'); if ($pos === false) { $domain_guess = $hostname; } else { $domain_guess = substr($hostname, 0, $pos); } if (!strlen($domain_guess)) { return false; } $domain_query = $container->getDataAccess()->execute('SELECT domainid FROM domains WHERE domainid=' . $container->getDataAccess()->formatText($domain_guess)); if ($domain_query->getNumberRows() == 1) { return $domain_guess; } return false; }
$next_action->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'setedition', '')); $next_action->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'edition', '')); $next_button = new WuiButton('nextbutton', array('label' => $innomaticLocale->getStr('next_button'), 'horiz' => 'true', 'formsubmit' => 'edition', 'image' => $container->getBaseUrl(false) . '/shared/' . 'icons/subway/icons/arrowright.png', 'width' => '20', 'height' => '20', 'action' => $next_action->getEventsCallString())); $wui_vgroup2 = new WuiVertgroup('vgroup2'); $wui_vgroup2->addChild($wui_form); $wui_vgroup2->addChild(new WuiHorizBar('hr')); $wui_vgroup2->addChild($next_button); \Innomatic\Setup\InnomaticSetup::check_log($wui_vgroup2); $wuiMainFrame->addChild($wui_vgroup2); $wuiTitleBar->mArgs['title'] .= ' - ' . $innomaticLocale->getStr('edition_title'); } else { if (!file_exists($container->getHome() . 'core/temp/setup_dataaccessdriverscreated')) { @touch($container->getHome() . 'core/temp/setup_creatingdataaccessdrivers', time()); $next_action = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $next_action->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'createdataaccessdrivers', '')); \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->sendRedirect($next_action->getEventsCallString()); } elseif (!file_exists($container->getHome() . 'core/temp/setup_dbcreated')) { @touch($container->getHome() . 'core/temp/setup_creatingdb', time()); $wuiTitleBar->mArgs['title'] .= ' - ' . $innomaticLocale->getStr('dbcreation_title'); $wui_vgroup = new WuiVertgroup('vgroup'); $wui_vgroup->addChild(new WuiLabel('phaselabel', array('label' => $innomaticLocale->getStr('dbcreation_phase_label')))); $wui_domain_grid = new WuiGrid('dbgrid', array('rows' => '6', 'cols' => '2')); $wui_domain_grid->addChild(new WuiLabel('dbtype_label', array('label' => $innomaticLocale->getStr('dbtype_label') . ' (*)')), 0, 0); $wui_domain_grid->addChild(new WuiComboBox('dbtype', array('disp' => 'action', 'elements' => \Innomatic\Dataaccess\DataAccessFactory::getDrivers())), 0, 1); $wui_domain_grid->addChild(new WuiLabel('dbname_label', array('label' => $innomaticLocale->getStr('dbname_label') . ' (*)')), 1, 0); $wui_domain_grid->addChild(new WuiString('dbname', array('disp' => 'action', 'value' => 'innomatic_root')), 1, 1); $wui_domain_grid->addChild(new WuiLabel('dbhost_label', array('label' => $innomaticLocale->getStr('dbhost_label') . ' (*)')), 2, 0); $wui_domain_grid->addChild(new WuiString('dbhost', array('disp' => 'action', 'value' => 'localhost')), 2, 1); $wui_domain_grid->addChild(new WuiLabel('dbport_label', array('label' => $innomaticLocale->getStr('dbport_label'))), 3, 0); $wui_domain_grid->addChild(new WuiString('dbport', array('disp' => 'action')), 3, 1); $wui_domain_grid->addChild(new WuiLabel('dbuser_label', array('label' => $innomaticLocale->getStr('dbuser_label') . ' (*)')), 4, 0);
public function setPredefinedTags($block) { // Base tags $block->set('receiver', $this->context->getRequest()->getUrlPath(true)); $block->set('baseurl', $this->context->getRequest()->getUrlPath(false) . '/'); $block->set('module', $this->getModule()); $block->set('page', $this); // Internal page name $block->set('page_name', $this->getName()); // Set page parameters as tags $pageParams = $this->getParameters(); foreach ($pageParams as $paramName => $paramValue) { $block->set('page_' . $paramName, $paramValue); } // Ajax support $xajax = \Innomatic\Ajax\Xajax::instance('\\Innomatic\\Ajax\\Xajax', $this->context->getRequest()->getUrlPath(false) . '/ajax/'); $xajax->ajaxLoader = false; $xajax->setLogFile($this->context->getHome() . 'core/log/ajax.log'); // Set debug mode if (\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getState() == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) { $xajax->debugOn(); } // Register Ajax calls parsing the ajax.xml configuration file if (file_exists(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome() . 'core/conf/ajax.xml')) { $cfg = \Innomatic\Ajax\XajaxConfig::getInstance(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp(), \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome() . 'core/conf/ajax.xml'); if (isset($cfg->functions)) { foreach ($cfg->functions as $name => $functionData) { $xajax->registerExternalFunction(array($name, $functionData['classname'], $functionData['method']), $functionData['classfile']); } } } // Build the base javascript for ajax $xajax_js = $xajax->getJavascript($this->context->getRequest()->getUrlPath(false) . '/' . 'shared/javascript', 'xajax.js'); // Setup calls. if ($this->context->countRegisteredAjaxSetupCalls() > 0) { $setup_calls = $this->context->getRegisteredAjaxSetupCalls(); $xajax_js .= '<script type="text/javascript">' . "\n"; foreach ($setup_calls as $call) { $xajax_js .= $call . ";\n"; } $xajax_js .= '</script>' . "\n"; } $block->set('xajax_js', $xajax_js); return $this; }
public function viewAccessDomain($eventData) { $innomaticCore = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); $domainquery = $innomaticCore->getDataAccess()->execute('SELECT domainid FROM domains WHERE id=' . $eventData['domainid']); DesktopFrontController::instance('\\Innomatic\\Desktop\\Controller\\DesktopFrontController')->session->put('INNOMATIC_AUTH_USER', \Innomatic\Domain\User\User::getAdminUsername($domainquery->getFields('domainid'))); \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('Location', $innomaticCore->getBaseUrl() . '/'); }
public function render() { if (!$this->mBuilt) { $this->Build(); } if ($this->mBuilt) { \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('P3P', 'CP="CUR ADM OUR NOR STA NID"'); echo $this->mLayout; return true; } else { $log = $this->container->getLogger(); $log->logEvent('innomatic.wui.wui.render', 'Unable to render wui', \Innomatic\Logging\Logger::ERROR); throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::UNABLE_TO_RENDER); } return false; }
public function isUrlRewriteOn() { return \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getInitParameter('useRewrite') == 'true' ? true : false; /* if (substr($_SERVER['REQUEST_URI'], 0, strlen($_SERVER['SCRIPT_NAME'])) == $_SERVER['SCRIPT_NAME'] or $_SERVER['REQUEST_URI'].self::RECEIVER == $_SERVER['SCRIPT_NAME']) { return false; } else { return false; } */ }
/** * Launches a panel in the domain desktop. * * If the panel name is one "main" then * no real panel is launched, a domain desktop layout file is included. * * Domain desktop layout files are stored in the folder * core/classes/innomatic/desktop/layout/domain. * * @param string $resource Panel name. */ public function executeDomain($resource) { // Check if this is the default page and if the user is allowed to access the dashboard if (substr($resource, -1, 1) == '/') { $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($this->container->getCurrentDomain()->getDataAccess(), $this->container->getCurrentUser()->getGroup()); $node_id = $perm->getNodeIdFromFileName('dashboard'); if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) != \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $resource = $resource . 'dashboard'; } } if (substr($resource, -1, 1) != '/') { // Must exit if the user called a page for which he isn't enabled // if (!isset($perm)) { $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($this->container->getCurrentDomain()->getDataAccess(), $this->container->getCurrentUser()->getGroup()); } $desktopPanel = basename($resource); if ($this->container->getState() == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) { $dump = \Innomatic\Debug\InnomaticDump::instance('\\Innomatic\\Debug\\InnomaticDump'); $dump->desktopApplication = $desktopPanel; $dump->sessionId = $this->session->getId(); } switch ($desktopPanel) { case 'index': break; default: $node_id = $perm->getNodeIdFromFileName($desktopPanel); if ($node_id) { if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) == \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $adloc = new \Innomatic\Locale\LocaleCatalog('innomatic::authentication', $this->container->getCurrentUser()->getLanguage()); $this->container->abort($adloc->getStr('nopageauth')); } } else { $adloc = new \Innomatic\Locale\LocaleCatalog('innomatic::authentication', $this->container->getCurrentUser()->getLanguage()); $this->container->abort($adloc->getStr('nopageauth')); } } if (is_dir($resource . '-panel')) { $panelHome = $resource . '-panel/'; $panelName = basename($resource); $controllerClassName = ucfirst($panelName) . 'PanelController'; // Checks if view file and definition exist if (!(include_once $panelHome . $controllerClassName . '.php')) { throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_CONTROLLER_FILE); } if (!class_exists($controllerClassName, true)) { throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_CONTROLLER_CLASS); } $controller = new $controllerClassName(\Innomatic\Core\InnomaticContainer::MODE_DOMAIN, $panelName); $this->container->setPanelController($controller); } else { switch ($desktopPanel) { case 'menu': include 'innomatic/desktop/layout/domain/' . $desktopPanel . '.php'; break; default: include $resource . '.php'; } } } else { if (strlen($this->session->get('INNOMATIC_AUTH_USER'))) { \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('P3P', 'CP="CUR ADM OUR NOR STA NID"'); include 'innomatic/desktop/layout/domain/index.php'; } } }
/** * Overwrites webapp skeleton with a new one. * The previous skeleton is not deleted, it is only overwritten. * * @param string $webappName * @param string $skeletonName * @return bool */ public static function applyNewSkeleton($webappName, $skeletonName) { $home = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getHome(); // Checks that the webapp name doesn't contain a malicious path. if (\Innomatic\Security\SecurityManager::isAboveBasePath($home . $webappName, $home)) { return false; } // Strips any path info from the skeleton name. $skeletonName = basename($skeletonName); // Checks if the given skeleton exits, otherwise uses default one. if (!is_dir($home . 'innomatic/core/conf/skel/webapps/' . $skeletonName . '-skel/')) { return false; } // Copies the skeleton to the webapp directory, overwriting previos skeleton. return \Innomatic\Io\Filesystem\DirectoryUtils::dirCopy($home . 'innomatic/core/conf/skel/webapps/' . $skeletonName . '-skel/', $home . $webappName . '/'); }
/** * Processes and initializes the context. * * @return void */ public function process() { // Initialize the session. $this->session = new \Innomatic\Php\PHPSession(); $this->session->start(); // Set 'session.gc_maxlifetime' and 'session.cookie_lifetime' to the value // defined by the 'sessionLifetime' parameter in web.xml. $lifetime = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getInitParameter('sessionLifetime'); if ($lifetime !== false) { $this->session->setLifeTime($lifetime); } // Check if the locale has been passed as parameter. if ($this->request->parameterExists('innomedia_setlocale')) { // Store the locale into the session. $this->session->put('innomedia_locale', $this->request->getParameter('innomedia_setlocale')); } // Retrieve the locale from the session, if set. if ($this->session->isValid('innomedia_locale')) { $this->locales[] = $this->session->get('innomedia_locale'); } // Add the locales supported by the web agent. $this->locales = array_merge($this->locales, $this->request->getLocales()); }
function pass_settheme($eventData) { global $wuiMainStatus, $innomaticLocale, $wuiPageGlobal; $log = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLogger(); $appCfg = new \Innomatic\Application\ApplicationSettings('innomatic'); $appCfg->setKey('wui-root-theme', $eventData['theme']); $wui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui'); $wui->setTheme($eventData['theme']); $log->logEvent('Innomatic', 'Changed Innomatic theme', \Innomatic\Logging\Logger::NOTICE); \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('Location', \Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default', ''), array('action', 'settheme2', '')))); }
public function __destruct() { // Flushes the xajax call function list cache. $ajax_cfg = new \Innomatic\Ajax\XajaxConfig(); $ajax_cfg->flushCache(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()); }
$next_action->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'setedition', '')); $next_action->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'edition', '')); $next_button = new WuiButton('nextbutton', array('label' => $innomaticLocale->getStr('next_button'), 'horiz' => 'true', 'formsubmit' => 'edition', 'image' => $container->getBaseUrl(false) . '/shared/' . 'icons/crystalflat/actions/forward.png', 'action' => $next_action->getEventsCallString())); $wui_vgroup2 = new WuiVertgroup('vgroup2'); $wui_vgroup2->addChild($wui_form); $wui_vgroup2->addChild(new WuiHorizBar('hr')); $wui_vgroup2->addChild($next_button); \Innomatic\Setup\InnomaticSetup::check_log($wui_vgroup2); $wuiMainFrame->addChild($wui_vgroup2); $wuiTitleBar->mArgs['title'] .= ' - ' . $innomaticLocale->getStr('edition_title'); } else { if (!file_exists($container->getHome() . 'core/temp/setup_dataaccessdriverscreated')) { @touch($container->getHome() . 'core/temp/setup_creatingdataaccessdrivers', time()); $next_action = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $next_action->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'createdataaccessdrivers', '')); \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('Location', $next_action->getEventsCallString()); } elseif (!file_exists($container->getHome() . 'core/temp/setup_dbcreated')) { @touch($container->getHome() . 'core/temp/setup_creatingdb', time()); $wuiTitleBar->mArgs['title'] .= ' - ' . $innomaticLocale->getStr('dbcreation_title'); $wui_vgroup = new WuiVertgroup('vgroup'); $wui_vgroup->addChild(new WuiLabel('phaselabel', array('label' => $innomaticLocale->getStr('dbcreation_phase_label')))); $wui_domain_grid = new WuiGrid('dbgrid', array('rows' => '6', 'cols' => '2')); $wui_domain_grid->addChild(new WuiLabel('dbtype_label', array('label' => $innomaticLocale->getStr('dbtype_label') . ' (*)')), 0, 0); $wui_domain_grid->addChild(new WuiComboBox('dbtype', array('disp' => 'action', 'elements' => \Innomatic\Dataaccess\DataAccessFactory::getDrivers())), 0, 1); $wui_domain_grid->addChild(new WuiLabel('dbname_label', array('label' => $innomaticLocale->getStr('dbname_label') . ' (*)')), 1, 0); $wui_domain_grid->addChild(new WuiString('dbname', array('disp' => 'action', 'value' => 'innomatic_root')), 1, 1); $wui_domain_grid->addChild(new WuiLabel('dbhost_label', array('label' => $innomaticLocale->getStr('dbhost_label') . ' (*)')), 2, 0); $wui_domain_grid->addChild(new WuiString('dbhost', array('disp' => 'action', 'value' => 'localhost')), 2, 1); $wui_domain_grid->addChild(new WuiLabel('dbport_label', array('label' => $innomaticLocale->getStr('dbport_label'))), 3, 0); $wui_domain_grid->addChild(new WuiString('dbport', array('disp' => 'action')), 3, 1); $wui_domain_grid->addChild(new WuiLabel('dbuser_label', array('label' => $innomaticLocale->getStr('dbuser_label') . ' (*)')), 4, 0);