/** * resets the portal state to the default one * @author radu */ public function executeResetPortalState() { $config = $this->hasRequestParameter('config') ? $this->getRequestParameter('config') : false; if ($config) { $config = json_decode($config); $content = get_object_vars($config->content); unset($config->content); $config->content[$config->layoutItem] = $content; unset($content); $afPortalStateObj = afPortalStatePeer::deleteByIdXml($config->idXml); /*$result=array('message'=>'Portal state was saved successfuly!');*/ $result = array(); } else { $result = array('message' => 'There was an error while sending the data!'); } $result = json_encode($result); return $this->renderText($result); }
public function validateXmlDocument($cli = false) { if ($this->cache_only) { $this->putCache(); return array("INFO", null); } $obj = $this->inCache(); if (!$obj || $obj->getSignature() != $this->hash) { try { if (!@$this->document->schemaValidate($this->schema)) { $errors = libxml_get_errors(); if (!empty($errors)) { throw new XmlValidatorException($errors, 0, $cli); } } } catch (Exception $e) { if ($cli) { return array("ERROR", $e); } throw $e; } $this->putCache($obj); if ($this->idxml) { afPortalStatePeer::deleteByIdXml($this->idxml); } } $this->is_valid = true; return $cli ? array("INFO", null) : true; }