/** * TuiyoControllerSystemTools::saveConfig() * Saves User aswell as profile configuration Data; * @return void */ public function saveConfig() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $type = JRequest::getVar('configType', null, 'post', 'string'); $key = JRequest::getVar('configKey', null, 'post', 'string'); $referer = JRequest::getVar("HTTP_REFERER", null, "SERVER"); //Referer //We must know the type and name of the email if (empty($type) || empty($key)) { JError::raiseError(TUIYO_SERVER_ERROR, _('You did not specify the config key, or type')); return false; } $document = $GLOBALS['API']->get("document"); $auth = $GLOBALS['API']->get('authentication'); $resp = array("code" => TUIYO_OK, "msg" => _("Your template parameters have been saved"), "error" => null); //Request authentication $auth->requireAuthentication(); $user = $GLOBALS['API']->get('user', null); $params = JRequest::getVar('params', array(), 'post', 'array'); $path = TUIYO_CONFIG; print_R($params); switch ($type) { case "system": $return = TuiyoParameter::saveParams($params, $key, "system"); break; default: JError::raiseError(TUIYO_SERVER_ERROR, _('Invalid config type')); return false; break; } //Notice messages; $msg = "{$key} {$type} data saved successfully"; $mType = "notice"; if (!$return) { $msg = "{$key} {$type} could not be saved"; $mType = "error"; } //$document->enqueMessage( $msg , $mType ); $this->setRedirect($referer, $msg, $mType); $this->redirect(); }