/** * Processes the input of the administration interface for Langstring * * @return void */ public function processAdminUI() { // Init values. $result = null; if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) { parent::processAdminUI(); $generateur_form_select = new FormSelectGenerator(); $sql = "SELECT * FROM content_langstring_entries WHERE content_langstring_entries.langstrings_id = '{$this->id}'"; $this->mBd->execSql($sql, $result, false); if ($result != null) { while (list($key, $value) = each($result)) { $language = $generateur_form_select->getResult("langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_language", null); if (empty($language)) { $language = ''; $languageSQL = 'NULL'; } else { $languageSQL = "'" . $language . "'"; } if (!empty($_REQUEST["langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_erase"]) && $_REQUEST["langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_erase"] == true) { $this->mBd->execSqlUpdate("DELETE FROM content_langstring_entries WHERE langstrings_id = '{$this->id}' AND langstring_entries_id='{$value['langstring_entries_id']}'", FALSE); // Create new cache object. $_cache = new Cache('langstrings_' . $this->id . '_substring_' . $language . '_string', $this->id); // Check if caching has been enabled. if ($_cache->isCachingEnabled) { // Remove old cached data. $_cache->eraseCachedData(); } } else { // Strip HTML tags ! $string = $_REQUEST["langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_string"]; $string = $this->mBd->escapeString(strip_tags($string, $this->allowed_html_tags)); // If PEAR::HTML_Safe is available strips down all potentially dangerous content $_HtmlSafe = new HtmlSafe(); if ($_HtmlSafe->isHtmlSafeEnabled) { // Add "embed" and "object" to the default set of dangerous tags $_HtmlSafe->setDeleteTags(array("embed", "object"), true); // Strip HTML $string = $_HtmlSafe->parseHtml($string); } if ($value['value'] != $string || $language != $value['locales_id']) { $this->mBd->execSqlUpdate("UPDATE content_langstring_entries SET locales_id = {$languageSQL} , value = '{$string}' WHERE langstrings_id = '{$this->id}' AND langstring_entries_id='{$value['langstring_entries_id']}'", FALSE); $this->touch(); // Create new cache object. $_cache = new Cache('langstrings_' . $this->id . '_substring_' . $language . '_string', $this->id); // Check if caching has been enabled. if ($_cache->isCachingEnabled) { // Remove old cached data. $_cache->eraseCachedData(); // Save data into cache. $_cache->saveCachedData($string); } } } } } //Nouvelles chaƮne(s) self::processNewUI($this->id, false); } }
/** * Uses HTML_Safe to * remove dangerous tags from html string * * HTML_Safe class removes body, header * leaves only what is inside body tag, (unless body and * html are added to allowed tags) * but will also work if there is no body tag at all. * * @return object of this class */ public function safeHtml(array $aAllowedTags = array()) { $ret = $this->string; if ($this->isHtml()) { $oHS = new HtmlSafe(); if (!empty($aAllowedTags)) { $oHS->setAllowedTags($aAllowedTags); } $ret = $oHS->parse($this->string); d('after safeHtml(): ' . $ret); } return $this->handleReturn($ret); }