diff --git a/file.php b/file.php index d62d588eb5942b0c0c1f5639ba22cf511f3a8884..ed0a4465e845f90377e05905c53d9b1b37962f58 100644 --- a/file.php +++ b/file.php @@ -51,7 +51,7 @@ if ($file->verifySignature($_GET['signature'], $_GET['expires'])) { // Download the file.. $file->download(@$_GET['disposition'] ?: false, $_GET['expires']); } - catch (Exception $x) { + catch (Exception $ex) { Http::response(500, 'Unable to find that file: '.$ex->getMessage()); } } diff --git a/include/class.forms.php b/include/class.forms.php index 318adbbc12b4f3053921f9b13d63f8e10cfa3718..180057e81c3b6ee2c3d340cd6815abb4063c5390 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -1582,15 +1582,19 @@ class ChoiceField extends FormField { $value = JsonDataParser::parse($value) ?: $value; // CDATA table may be built with comma-separated key,value,key,value - if (is_string($value)) { + if (is_string($value) && strpos($value, ',')) { $values = array(); $choices = $this->getChoices(); - foreach (explode(',', $value) as $V) { + $vals = explode(',', $value); + foreach ($vals as $V) { if (isset($choices[$V])) $values[$V] = $choices[$V]; } if (array_filter($values)) $value = $values; + elseif($vals) + list($value) = $vals; + } $config = $this->getConfiguration(); if (!$config['multiselect'] && is_array($value) && count($value) < 2) { diff --git a/include/class.orm.php b/include/class.orm.php index a928f222c9d3a7a84e5ecdd054630e33602c63f7..626f78eb1b65f69025e5a8e5db3019d553d506e4 100644 --- a/include/class.orm.php +++ b/include/class.orm.php @@ -396,9 +396,10 @@ class VerySimpleModel { } function __isset($field) { - return array_key_exists($field, $this->ht) + return ($this->ht && array_key_exists($field, $this->ht)) || isset(static::$meta['joins'][$field]); } + function __unset($field) { if ($this->__isset($field)) unset($this->ht[$field]); diff --git a/include/class.page.php b/include/class.page.php index 920c2ee88ecfd3cd06c3eb8bf36756bad487c76f..157ad43cdc30d1add90b0270f331d821038feacc 100644 --- a/include/class.page.php +++ b/include/class.page.php @@ -319,7 +319,7 @@ class Page extends VerySimpleModel { return false; } // New translations (?) - foreach ($vars['trans'] as $lang=>$parts) { + foreach ($vars['trans'] ?: array() as $lang=>$parts) { $content = array('name' => @$parts['title'], 'body' => Format::sanitize(@$parts['body'])); if (!array_filter($content)) continue;