fixed array saving bug
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
This commit is contained in:
@ -69,8 +69,10 @@ class Model {
|
||||
{
|
||||
if(isset($this->data[$field]))
|
||||
{
|
||||
if($options['type']=='array')
|
||||
if($options['type']=='array' && is_array($this->data[$field]))
|
||||
$GLOBALS['redis']->hset($this->dbTable.':'.$this->id,$field,json_encode($this->data[$field]));
|
||||
else if($options['type']=='array' && !is_array($this->data[$field]))
|
||||
$GLOBALS['redis']->hset($this->dbTable.':'.$this->id,$field,json_encode([]));
|
||||
else
|
||||
{
|
||||
$GLOBALS['redis']->hset($this->dbTable.':'.$this->id,$field,$this->data[$field]);
|
||||
@ -101,9 +103,10 @@ class Model {
|
||||
case 'float': $value = floatval($value);break;
|
||||
case 'double': $value = doubleval($value);break;
|
||||
case 'array':
|
||||
$value = json_decode($value,true);
|
||||
if($value===null)
|
||||
if(!$value)
|
||||
$value = [];
|
||||
else if(is_string($value))
|
||||
$value = json_decode($value,true);
|
||||
break;
|
||||
}
|
||||
$this->data[$key] = $value;
|
||||
|
@ -246,8 +246,11 @@ function pictshareUploadImage($path,$hash=false)
|
||||
function partial($name,$variables=[])
|
||||
{
|
||||
$templatefile = ROOT.DS.'templates'.DS.'partials'.DS.$name;
|
||||
|
||||
//render template by running include
|
||||
return template($name,$variables);
|
||||
}
|
||||
|
||||
function template($templatefile,$variables=[])
|
||||
{
|
||||
ob_start();
|
||||
if(is_array($variables))
|
||||
extract($variables);
|
||||
|
Reference in New Issue
Block a user