/** * Stores the permission data in the database. * * To be used after changing permission attributes with the set methods. * * @access public * @return void */ public function store() { if (!is_int($this->id)) { return false; } // Update the permission in the database return $this->dataAccess("UPDATE domain_permissions\n SET name=" . $this->dataAccess->formatText($this->name) . ",\n title=" . $this->dataAccess->formatText($this->title) . ",\n description=" . $this->dataAccess->formatText($this->description) . ",\n catalog=" . $this->dataAccess->formatText($this->catalog) . ",\n application=" . $this->dataAccess->formatText($this->application) . "\n WHERE id={$this->id}"); }
public function checkIfOptionEnabled($option, $domainId) { $result = true; $subCheck = $this->rootDA->execute('SELECT optionname FROM applications_options_disabled ' . 'WHERE applicationid=' . (int) $this->id . ' AND domainid=' . (int) $domainId . ' AND optionname=' . $this->rootDA->formatText($option)); if ($subCheck->getNumberRows()) { $result = false; } $subCheck->free(); return $result; }
public function getPageInstanceBlocks() { if (!$this->isValid()) { return false; } $pagesParamsQuery = $this->domainDa->execute("SELECT blocks\n FROM innomedia_pages\n WHERE page=" . $this->domainDa->formatText($this->module . '/' . $this->page) . " AND id={$this->id}"); if ($pagesParamsQuery->getNumberRows() > 0) { return json_decode($pagesParamsQuery->getFields('blocks'), true); } return array(); }
/** * 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; }
/** * Updates the page path for the children tree pages of a page. * * @param integer $pageId */ public function updatePageChildrenTreePaths($pageId) { $children = $this->getPageChildren($pageId); if (count($children) > 0) { $parentPath = $this->generatePath($pageId); foreach ($children as $child) { // Retrieves current page name. $pageQuery = $this->dataAccess->execute('SELECT page_path ' . 'FROM innomedia_pages_tree ' . 'WHERE page_id=' . $child); $pageName = basename($pageQuery->getFields('page_path')); // Updates page path. $this->dataAccess->execute('UPDATE innomedia_pages_tree ' . 'SET page_path=' . $this->dataAccess->formatText($parentPath . '/' . $pageName) . ' ' . 'WHERE page_id=' . $child); $this->updatePageChildrenTreePaths($child); } } }
/** * Updates the account information. */ public function update($name, $host = 'localhost', $port = '80', $path = '', $username = '', $password = '', $proxy = '', $proxyPort = '') { $result = false; $hook = new \Innomatic\Process\Hook($this->dataAccess, 'innomatic', 'webservicesaccount.update'); if ($hook->callHooks('calltime', $this, array('name' => $name, 'host' => $host, 'port' => $port, 'path' => $path, 'username' => $username, 'password' => $password)) == \Innomatic\Process\Hook::RESULT_OK) { if ($this->mId) { if (strlen($name)) { $result = $this->dataAccess->execute('UPDATE webservices_accounts ' . 'SET ' . 'name=' . $this->dataAccess->formatText($name) . ',' . 'host=' . $this->dataAccess->formatText($host) . ',' . 'path=' . $this->dataAccess->formatText($path) . ',' . 'port=' . $this->dataAccess->formatText($port) . ',' . 'username='******',' . 'password='******',' . 'proxy=' . $this->dataAccess->formatText($proxy) . ',' . 'proxyport=' . $this->dataAccess->formatText($proxyPort) . ' ' . 'WHERE id=' . (int) $this->mId); if ($result) { if ($hook->callHooks('accountudpated', $this, array('name' => $name, 'host' => $host, 'port' => $port, 'path' => $path, 'username' => $username, 'password' => $password, 'id' => $this->mId)) != \Innomatic\Process\Hook::RESULT_OK) { $result = false; } } else { $result = WebServicesAccount::UPDATE_UNABLE_TO_UPDATE_ACCOUNT; } } else { $result = WebServicesAccount::UPDATE_EMPTY_ACCOUNT_NAME; } } else { $result = WebServicesAccount::REMOVE_EMPTY_ACCOUNT_ID; } } return $result; }
/** * Updates the component. * * @param integer $updatemode Update mode (Application::UPDATE_MODE_* constants) * @param array $params Parameters in the component definition * @param string $domainprescript Full path of an optional PHP script to be executed * before proceeding with the component update * @param string $domainpostscript Full path of an optional PHP script to be executed * after proceeding with the component update * @access public * @return void */ public function update($updatemode, $params, $domainprescript = '', $domainpostscript = '') { $result = false; if ($this->getIsDomain() or isset($params['override']) and $params['override'] == self::OVERRIDE_DOMAIN) { $domainsquery = $this->rootda->execute('SELECT * FROM domains'); $modquery = $this->rootda->execute('SELECT id FROM applications WHERE appid=' . $this->rootda->formatText($this->appname)); $appid = $modquery->getFields('id'); } switch ($updatemode) { case Application::UPDATE_MODE_ADD: if ($this->install($params)) { $result = true; if ($this->getIsDomain() or isset($params['override']) and $params['override'] == self::OVERRIDE_DOMAIN) { if ($domainsquery->getNumberRows() > 0) { while (!$domainsquery->eof) { $domaindata = $domainsquery->getFields(); // Check if the application is enabled for the current iteration domain $actquery = $this->rootda->execute('SELECT * FROM applications_enabled WHERE domainid=' . (int) $domaindata['id'] . ' AND applicationid=' . (int) $appid); if ($actquery->getNumberRows()) { // Enable the component for the current iteration domain if (!$this->enable($domainsquery->getFields('id'), $params)) { $result = false; } } $actquery->free(); $domainsquery->moveNext(); } } } } break; case Application::UPDATE_MODE_REMOVE: // Disables the component for each domain, before uninstalling it if ($this->getIsDomain() or isset($params['override']) and $params['override'] == self::OVERRIDE_DOMAIN) { if ($domainsquery->getNumberRows() > 0) { while (!$domainsquery->eof) { $domaindata = $domainsquery->getFields(); $actquery = $this->rootda->execute('SELECT * FROM applications_enabled WHERE domainid=' . (int) $domaindata['id'] . ' AND applicationid=' . (int) $appid); if ($actquery->getNumberRows()) { // Disable the component for the current iteration domain if (!$this->disable($domainsquery->getFields('id'), $params)) { $result = false; } } $actquery->free(); $domainsquery->moveNext(); } } } if ($this->uninstall($params)) { $result = true; } break; case Application::UPDATE_MODE_CHANGE: if ($this->doUpdateAction($params)) { $result = true; if ($this->getIsDomain() or isset($params['override']) and $params['override'] == self::OVERRIDE_DOMAIN) { if ($domainsquery->getNumberRows() > 0) { while (!$domainsquery->eof) { $domaindata = $domainsquery->getFields(); $actquery = $this->rootda->execute('SELECT * FROM applications_enabled WHERE domainid=' . (int) $domaindata['id'] . ' AND applicationid=' . (int) $appid); if ($actquery->getNumberRows()) { $this->container->startDomain($domaindata['domainid']); $this->domainda = $this->container->getCurrentDomain()->getDataAccess(); if (strlen($domainprescript) and file_exists($domainprescript)) { include $domainprescript; } if (!$this->doUpdateDomainAction($domainsquery->getFields('id'), $params)) { $result = false; } if (strlen($domainpostscript) and file_exists($domainpostscript)) { include $domainpostscript; } $this->container->stopDomain(); } $actquery->free(); $domainsquery->moveNext(); } } } } break; default: $log = $this->container->getLogger(); $log->logEvent('innomatic.applications.applicationcomponent.update', 'Invalid update mode', \Innomatic\Logging\Logger::ERROR); break; } if ($this->getIsDomain() or isset($params['override']) and $params['override'] == self::OVERRIDE_DOMAIN) { $domainsquery->free(); $modquery->free(); } return $result; }