예제 #1
0
 public function initTheme()
 {
     $result = false;
     if (strlen($this->mTheme)) {
         $innomatic = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
         if ($this->mTheme == 'default') {
             $this->mTheme = \Innomatic\Wui\Wui::DEFAULT_THEME;
         }
         if ($this->mTheme != 'userdefined') {
             if (file_exists($innomatic->getHome() . 'core/conf/themes/' . $this->mTheme . '_wuitheme.ini')) {
                 $this->mThemeFile = $innomatic->getHome() . 'core/conf/themes/' . $this->mTheme . '_wuitheme.ini';
             } else {
                 $this->mTheme = \Innomatic\Wui\Wui::DEFAULT_THEME;
                 $this->mThemeFile = $innomatic->getHome() . 'core/conf/themes/' . \Innomatic\Wui\Wui::DEFAULT_THEME . '_wuitheme.ini';
             }
             $cfg_file = @parse_ini_file($this->mThemeFile);
             if ($cfg_file !== false) {
                 $this->mIconsSetName = $cfg_file['THEME.ICONSSET'];
                 $this->mColorsSetName = $cfg_file['THEME.COLORSSET'];
                 $this->mStyleName = $cfg_file['THEME.STYLE'];
             } else {
                 $log = $innomatic->getLogger();
                 $log->LogEvent('innomatic.wuithemes.wuitheme.inittheme', 'Unable to open theme configuration file ' . $this->mThemeFile, \Innomatic\Logging\Logger::ERROR);
             }
         } else {
             $this->mIconsSetName = $this->mUserSettings['iconsset'];
             $this->mColorsSetName = $this->mUserSettings['colorsset'];
             $this->mStyleName = $this->mUserSettings['stylename'];
         }
         $this->mIconsSetBase = $innomatic->getExternalBaseUrl() . '/shared/icons/' . $this->mIconsSetName . '/';
         $this->mIconsBase = $innomatic->getExternalBaseUrl() . '/shared/icons/';
         $this->mIconsSetDir = $innomatic->getHome() . 'shared/icons/' . $this->mIconsSetName . '/';
         $this->mStyleBase = $innomatic->getExternalBaseUrl() . '/shared/styles/';
         $this->mStyleDir = $innomatic->getHome() . 'shared/styles/' . $this->mStyleName . '/';
         $wui_colors = new WuiColorsSet($this->mrRootDb, $this->mColorsSetName);
         $wui_icons = new WuiIconsSet($this->mrRootDb, $this->mIconsSetName);
         $wui_style = new WuiStyle($this->mrRootDb, $this->mStyleName);
         if ($innomatic->getState() != \Innomatic\Core\InnomaticContainer::STATE_SETUP) {
             $cached_iconsset = new \Innomatic\Datatransfer\Cache\CachedItem($this->mrRootDb, 'innomatic', 'wuiiconsset-' . $this->mIconsSetName);
             $cached_colorsset = new \Innomatic\Datatransfer\Cache\CachedItem($this->mrRootDb, 'innomatic', 'wuicolorsset-' . $this->mColorsSetName);
             $cached_style = new \Innomatic\Datatransfer\Cache\CachedItem($this->mrRootDb, 'innomatic', 'wuistyle-' . $this->mStyleName);
             $this->mIconsSet = unserialize($cached_iconsset->Retrieve());
             $this->mColorsSet = unserialize($cached_colorsset->Retrieve());
             $this->mStyle = unserialize($cached_style->Retrieve());
         }
         if (!$this->mIconsSet or !$this->mColorsSet or !$this->mStyle) {
             if (\Innomatic\Wui\Wui::DEFAULT_THEME == $this->mTheme) {
                 $this->mColorsSet = $wui_colors->getColorsSet();
                 $this->mIconsSet = $wui_icons->getIconsSet();
                 $this->mStyle = $wui_style->getStyle();
             } else {
                 $def_cfg_file = @parse_ini_file($innomatic->getHome() . 'core/conf/themes/' . \Innomatic\Wui\Wui::DEFAULT_THEME . '_wuitheme.ini');
                 if ($def_cfg_file !== false) {
                     $def_icons_set_name = $def_cfg_file['THEME.ICONSSET'];
                     $def_colors_set_name = $def_cfg_file['THEME.COLORSSET'];
                     $def_style_name = $def_cfg_file['THEME.STYLE'];
                 } else {
                     $log = $innomatic->getLogger();
                     $log->LogEvent('innomatic.wuithemes.wuitheme.inittheme', 'Unable to open default theme configuration file ' . $innomatic->getHome() . 'core/conf/themes/' . \Innomatic\Wui\Wui::DEFAULT_THEME . '_wuitheme.ini', \Innomatic\Logging\Logger::ERROR);
                 }
                 $wui_def_colors = new WuiColorsSet($this->mrRootDb, $def_colors_set_name);
                 $wui_def_icons = new WuiIconsSet($this->mrRootDb, $def_icons_set_name);
                 $wui_def_style = new WuiStyle($this->mrRootDb, $def_style_name);
                 $this->mColorsSet = $this->DefOpts($wui_def_colors->getColorsSet(), $wui_colors->getColorsSet());
                 $this->mIconsSet = $this->DefOpts($wui_def_icons->getIconsSet(), $wui_icons->getIconsSet());
                 $this->mStyle = $this->DefOpts($wui_def_style->getStyle(), $wui_style->getStyle());
             }
             while (list($style_name, $style_item) = each($this->mStyle)) {
                 $this->mStyle[$style_name] = $this->mStyleBase . $style_item['base'] . '/' . $style_item['value'];
             }
             if ($innomatic->getState() != \Innomatic\Core\InnomaticContainer::STATE_SETUP) {
                 $cached_iconsset->Store(serialize($this->mIconsSet));
                 $cached_colorsset->Store(serialize($this->mColorsSet));
                 $cached_style->Store(serialize($this->mStyle));
             }
         }
     }
     return $result;
 }
 public function ListAvailableApplicationVersions($repId, $applicationId, $refresh = false)
 {
     $result = false;
     $cachedItem = new \Innomatic\Datatransfer\Cache\CachedItem($this->mrRootDb, 'appcentral-client', 'repository_application_versions-' . $this->mId . '-' . $repId . '-' . $applicationId);
     $goon = true;
     if (!$refresh) {
         $cacheContent = $cachedItem->Retrieve();
         if ($cacheContent != false) {
             $goon = false;
             $result = unserialize($cacheContent);
         }
     }
     if ($goon) {
         $xmlrpcMessage = new \Innomatic\Webservices\Xmlrpc\XmlRpcMsg('appcentral-server.list_available_application_versions', array(new \Innomatic\Webservices\Xmlrpc\XmlRpcVal($repId, 'int'), new \Innomatic\Webservices\Xmlrpc\XmlRpcVal($applicationId, 'int')));
         $xmlrpcResp = $this->mXClient->Send($xmlrpcMessage);
         if ($xmlrpcResp) {
             if (!$xmlrpcResp->FaultCode()) {
                 $xv = \Innomatic\Webservices\Xmlrpc\php_xmlrpc_decode($xmlrpcResp->Value());
                 if (is_array($xv)) {
                     $cachedItem->Store(serialize($xv));
                     $result = $xv;
                 } else {
                     $this->mLogCenter->logEvent(array('root' => ''), 'appcentral-client.appcentral-client.appcentralremoteserver.listavailableapplications', 'Not an array from server', \Innomatic\Logging\Logger::ERROR);
                 }
             } else {
                 $this->mLogCenter->logEvent(array('root' => ''), 'appcentral-client.appcentral-client.appcentralremoteserver.listavailableapplications', 'Error in response from server: ' . $xmlrpcResp->FaultString(), \Innomatic\Logging\Logger::ERROR);
             }
         } else {
             $this->mLogCenter->logEvent(array('root' => ''), 'appcentral-client.appcentral-client.appcentralremoteserver.listavailableapplications', 'Invalid response from server', \Innomatic\Logging\Logger::ERROR);
         }
     }
     return $result;
 }