public function remove() { $result = false; if ($this->rootdataaccess) { if (strlen($this->setname)) { if (\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getState() != \Innomatic\Core\InnomaticContainer::STATE_SETUP) { $cached_item = new \Innomatic\Datatransfer\Cache\CachedItem($this->rootdataaccess, 'innomatic', 'wuicolorsset-' . $this->setname); $cached_item->Destroy(); } $result = $this->rootdataaccess->execute('DELETE FROM wui_colorssets WHERE name=' . $this->rootdataaccess->formatText($this->setname)); } } return $result; }
public function remove() { $result = false; if ($this->mrRootDb) { if (strlen($this->mStyleName)) { if (\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getState() != \Innomatic\Core\InnomaticContainer::STATE_SETUP) { $cached_item = new \Innomatic\Datatransfer\Cache\CachedItem($this->mrRootDb, 'innomatic', 'wuistyle-' . $this->mStyleName); $cached_item->Destroy(); } $result = $this->mrRootDb->execute('DELETE FROM wui_styles WHERE name=' . $this->mrRootDb->formatText($this->mStyleName)); } } return $result; }
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; }
/** * Lists the available application versions. * * @param integer $repId Repository id. * @param integer $applicationId Application id. * @param bool $refresh Set to true if a cache refresh is requested. * @access public * @return array */ public function listAvailableApplicationVersions($repId, $applicationId, $refresh = false) { $result = false; $cachedItem = new \Innomatic\Datatransfer\Cache\CachedItem($this->dataAccess, 'appcentral-client', 'repository_application_versions-' . $this->id . '-' . $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->client->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->log->logEvent(['root' => ''], 'innomatic.appcentralremoteserver.listavailableapplications', 'Not an array from server', \Innomatic\Logging\Logger::ERROR); } } else { $this->log->logEvent(['root' => ''], 'innomatic.appcentralremoteserver.listavailableapplications', 'Error in response from server: ' . $xmlrpcResp->faultString(), \Innomatic\Logging\Logger::ERROR); } } else { $this->log->logEvent(['root' => ''], 'innomatic.appcentralremoteserver.listavailableapplications', 'Invalid response from server', \Innomatic\Logging\Logger::ERROR); } } return $result; }
/** * Clears the current item cache. * * @access public * @return boolean */ public function cleanCache() { // Extract all the cache objects for the current item id $cache_query = $this->mrRootDb->execute('SELECT itemid' . ' FROM cache_items' . ' WHERE application=' . $this->mrRootDb->formatText('innowork-core') . ' AND itemid LIKE ' . $this->mrRootDb->formatText('itemtypesearch-' . $this->mItemType . '%')); // Delete the cached objects for the current item id while (!$cache_query->eof) { $cached_item = new \Innomatic\Datatransfer\Cache\CachedItem($this->mrRootDb, 'innowork-core', $cache_query->getFields('itemid')); $cached_item->destroy(); $cache_query->moveNext(); } $cache_query->free(); return true; }
public function cleanCache() { $cache_query = $this->rootDA->execute('SELECT itemid' . ' FROM cache_items' . ' WHERE application=' . $this->rootDA->formatText('innowork-core') . ' AND itemid LIKE ' . $this->rootDA->formatText('itemtypesearch-' . $this->mItemType . '%')); while (!$cache_query->eof) { $cached_item = new \Innomatic\Datatransfer\Cache\CachedItem($this->rootDA, 'innowork-core', $cache_query->getFields('itemid')); $cached_item->destroy(); $cache_query->moveNext(); } $cache_query->free(); return true; }