28 abstract public function loadView($viewName, $pData = NULL, $asString =
false);
30 abstract public function config($hasHeader =
true);
32 abstract protected function showConfMessage($content, $type, $title, $url, $responseElement, $data, $attributes = NULL): HtmlMessage;
34 abstract protected function showSimpleMessage($content, $type, $title=null,$icon =
"info", $timeout = NULL, $staticName = null): HtmlMessage;
38 if ($hasHeader ===
true){
39 $this->getHeader (
"config" );
42 $this->jquery->compile ( $this->view );
49 echo $this->jquery->compile($this->view);
56 if(isset($postValues[
"lbl-ck-div-de-database-input-cache"])){
57 unset($postValues[
"lbl-ck-div-de-database-input-cache"]);
58 if(!(isset($postValues[
"database-cache"]) &&
UString::isNotNull($postValues[
"database-cache"]))){
59 $postValues[
"database-cache"]=
false;
62 $postValues[
"database-cache"]=
false;
64 $postValues[
"debug"]=isset($postValues[
"debug"]);
65 $postValues[
"test"]=isset($postValues[
"test"]);
66 $postValues[
"templateEngineOptions-cache"]=isset($postValues[
"templateEngineOptions-cache"]);
68 foreach ($postValues as $key=>$value){
69 if(strpos($key,
"-")===
false){
72 list($k1,$k2)=explode(
"-", $key);
73 if(!isset($result[$k1])){
76 $result[$k1][$k2]=$value;
79 $content=
"<?php\nreturn ".UArray::asPhpArray($result,
"array",1,
true).
";";
82 $this->
showSimpleMessage(
"The configuration file has been successfully modified!",
"positive",
"check square",null,
"msgConfig");
84 $this->
showSimpleMessage(
"Impossible to write the configuration file.",
"negative",
"warning circle",null,
"msgConfig");
87 $this->
showSimpleMessage(
"Your configuration contains errors.<br>The configuration file has not been saved.",
"negative",
"warning circle",null,
"msgConfig");
97 $value=$_POST[
"_value"];
98 $result[
"result"]=$callback($value);
99 echo json_encode($result);
106 $array=eval(
"return ".$value.
";");
107 return is_array($array);
108 }
catch(\ParseError $e){
118 return file_exists($base.DS.$folder.DS.$value);
126 $class=new \ReflectionClass($value);
127 return $class->isSubclassOf($parent);
128 }
catch(\ReflectionException $e){
134 $search = array(chr(145),
146 return str_replace($search,
$replace, $string);
151 $db=
new Database($postValues[
"database-type"], $postValues[
"database-dbName"],$postValues[
"database-serverName"],$postValues[
"database-port"],$postValues[
"database-user"],$postValues[
"database-password"]);
154 $connected=$db->isConnected();
155 }
catch(\Exception $e){
156 $errorMsg=$e->getMessage();
157 $msg=((mb_detect_encoding($errorMsg,
"UTF-8, ISO-8859-1, ISO-8859-15",
"CP1252")) !==
"UTF-8") ? utf8_encode($this->
convert_smart_quotes($errorMsg)) : ($errorMsg);
160 $icon=
"exclamation triangle red";
162 $icon=
"check square green";
164 $icon=$this->jquery->semantic()->htmlIcon(
"db-status", $icon);
166 $icon->addPopup(
"Error",$msg);
168 $icon->addPopup(
"Success",
"Connexion is ok!");
170 $this->jquery->execAtLast(
'$("#db-status").popup("show");');
172 echo $this->jquery->compile($this->view);
static isPost()
Returns true if the request is sent by the POST method.
showConfMessage($content, $type, $title, $url, $responseElement, $data, $attributes=NULL)
loadView($viewName, $pData=NULL, $asString=false)
static asJSON()
Sets the response content-type to application/json.
convert_smart_quotes($string)
formConfig($hasHeader=true)
static post($key, $default=NULL)
Returns the value of the $key variable passed by the post method or $default if the $key variable doe...
static isValidCode($code)
static saveConfig($content)
_checkCondition($callback)
showSimpleMessage($content, $type, $title=null, $icon="info", $timeout=NULL, $staticName=null)
static getApplicationDir()
submitConfig($partial=true)