@@ -114,7 +114,10 @@ |
||
| 114 | 114 | break; |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | - if (true) $valid = $value; |
|
| 117 | + if (true) |
|
| 118 | + { |
|
| 119 | + $valid = $value; |
|
| 120 | + } |
|
| 118 | 121 | //error_log(__METHOD__."() $form_name: ".array2string($value_in).' --> '.array2string($value)); |
| 119 | 122 | } |
| 120 | 123 | } |
@@ -86,7 +86,10 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $parts = explode('.',$c_name); |
| 89 | - if($name == $parts[count($parts)-1]) return $c_template; |
|
| 89 | + if($name == $parts[count($parts)-1]) |
|
| 90 | + { |
|
| 91 | + return $c_template; |
|
| 92 | + } |
|
| 90 | 93 | } |
| 91 | 94 | } |
| 92 | 95 | // Template not found, try again with content expansion |
@@ -106,7 +109,10 @@ discard block |
||
| 106 | 109 | return false; |
| 107 | 110 | } |
| 108 | 111 | $reader = new XMLReader(); |
| 109 | - if (!$reader->open(self::rel2path($path))) return false; |
|
| 112 | + if (!$reader->open(self::rel2path($path))) |
|
| 113 | + { |
|
| 114 | + return false; |
|
| 115 | + } |
|
| 110 | 116 | |
| 111 | 117 | while($reader->read()) |
| 112 | 118 | { |
@@ -208,7 +214,10 @@ discard block |
||
| 208 | 214 | { |
| 209 | 215 | $url = Api\Vfs::download_url($path); |
| 210 | 216 | |
| 211 | - if ($url[0] == '/') $url = Api\Framework::link($url); |
|
| 217 | + if ($url[0] == '/') |
|
| 218 | + { |
|
| 219 | + $url = Api\Framework::link($url); |
|
| 220 | + } |
|
| 212 | 221 | |
| 213 | 222 | // mtime postfix has to use '?download=', as our WebDAV treats everything else literal and not ignore them like Apache for static files! |
| 214 | 223 | $url .= '?download='.filemtime($path); |
@@ -231,7 +240,10 @@ discard block |
||
| 231 | 240 | { |
| 232 | 241 | $cname =& $params[0]; |
| 233 | 242 | $old_cname = $params[0]; |
| 234 | - if ($this->attrs['content']) $cname = self::form_name($cname, $this->attrs['content'], $params[1]); |
|
| 243 | + if ($this->attrs['content']) |
|
| 244 | + { |
|
| 245 | + $cname = self::form_name($cname, $this->attrs['content'], $params[1]); |
|
| 246 | + } |
|
| 235 | 247 | |
| 236 | 248 | // Check for template from content, and run over it |
| 237 | 249 | // templates included via template tag have their name to load them from in attribute "template" |
@@ -65,7 +65,10 @@ discard block |
||
| 65 | 65 | foreach($tabs as &$tab) |
| 66 | 66 | { |
| 67 | 67 | $template= clone Template::instance($tab['template']); |
| 68 | - if($tab['id']) $template->attrs['content'] = $tab['id']; |
|
| 68 | + if($tab['id']) |
|
| 69 | + { |
|
| 70 | + $template->attrs['content'] = $tab['id']; |
|
| 71 | + } |
|
| 69 | 72 | $this->children[1]->children[] = $template; |
| 70 | 73 | $tab['url'] = Template::rel2url($template->rel_path); |
| 71 | 74 | //$this->tabs[] = $tab; |
@@ -112,7 +115,10 @@ discard block |
||
| 112 | 115 | { |
| 113 | 116 | $value = self::get_array($content, $form_name); |
| 114 | 117 | $valid =& self::get_array($validated, $form_name, true); |
| 115 | - if (true) $valid = $value; |
|
| 118 | + if (true) |
|
| 119 | + { |
|
| 120 | + $valid = $value; |
|
| 121 | + } |
|
| 116 | 122 | } |
| 117 | 123 | } |
| 118 | 124 | } |
@@ -150,7 +150,10 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | protected function action($attr, $action, array &$attrs) |
| 152 | 152 | { |
| 153 | - if (self::DEBUG) error_log(__METHOD__."('$attr', ".array2string($action).')'); |
|
| 153 | + if (self::DEBUG) |
|
| 154 | + { |
|
| 155 | + error_log(__METHOD__."('$attr', ".array2string($action).')'); |
|
| 156 | + } |
|
| 154 | 157 | // action is an assignment |
| 155 | 158 | if (is_scalar($action) || is_null($action)) |
| 156 | 159 | { |
@@ -160,7 +163,10 @@ discard block |
||
| 160 | 163 | $replace = array(); |
| 161 | 164 | foreach($attrs as $a => $v) |
| 162 | 165 | { |
| 163 | - if (is_scalar($v) || is_null($v)) $replace['@'.$a] = $v; |
|
| 166 | + if (is_scalar($v) || is_null($v)) |
|
| 167 | + { |
|
| 168 | + $replace['@'.$a] = $v; |
|
| 169 | + } |
|
| 164 | 170 | } |
| 165 | 171 | $action = strtr($action, $replace); |
| 166 | 172 | // now replace with non-scalar value, eg. if values is an array: "@value", "@value[key] or "@value[@key]" |
@@ -170,7 +176,10 @@ discard block |
||
| 170 | 176 | } |
| 171 | 177 | } |
| 172 | 178 | $attrs[$attr] = $action; |
| 173 | - if (self::DEBUG) error_log(__METHOD__."('$attr', ".array2string($action).") attrs['$attr'] = ".array2string($action).', attrs='.array2string($attrs)); |
|
| 179 | + if (self::DEBUG) |
|
| 180 | + { |
|
| 181 | + error_log(__METHOD__."('$attr', ".array2string($action).") attrs['$attr'] = ".array2string($action).', attrs='.array2string($attrs)); |
|
| 182 | + } |
|
| 174 | 183 | } |
| 175 | 184 | // action is a serverside callback |
| 176 | 185 | elseif(is_array($action) && isset($action['__callback__'])) |
@@ -218,7 +227,10 @@ discard block |
||
| 218 | 227 | $attrs[$attr] = $actions; |
| 219 | 228 | $actions = array($attr => $actions); |
| 220 | 229 | } |
| 221 | - if (self::DEBUG) error_log(__METHOD__."(attr='$attr', action=".array2string($action).") attrs['$attr']=='{$attrs[$attr]}' --> running actions"); |
|
| 230 | + if (self::DEBUG) |
|
| 231 | + { |
|
| 232 | + error_log(__METHOD__."(attr='$attr', action=".array2string($action).") attrs['$attr']=='{$attrs[$attr]}' --> running actions"); |
|
| 233 | + } |
|
| 222 | 234 | foreach($actions as $attr => $action) |
| 223 | 235 | { |
| 224 | 236 | $this->action($attr, $action, $attrs); |
@@ -148,9 +148,15 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function get_contact($value, array $attrs) |
| 150 | 150 | { |
| 151 | - if (is_array($value) && !(array_key_exists('app',$value) && array_key_exists('id', $value))) return $value; |
|
| 151 | + if (is_array($value) && !(array_key_exists('app',$value) && array_key_exists('id', $value))) |
|
| 152 | + { |
|
| 153 | + return $value; |
|
| 154 | + } |
|
| 152 | 155 | |
| 153 | - if(is_array($value) && array_key_exists('app', $value) && array_key_exists('id', $value)) $value = $value['id']; |
|
| 156 | + if(is_array($value) && array_key_exists('app', $value) && array_key_exists('id', $value)) |
|
| 157 | + { |
|
| 158 | + $value = $value['id']; |
|
| 159 | + } |
|
| 154 | 160 | switch($attrs['type']) |
| 155 | 161 | { |
| 156 | 162 | case 'contact-account': |
@@ -162,7 +168,11 @@ discard block |
||
| 162 | 168 | // fall-through |
| 163 | 169 | case 'contact-value': |
| 164 | 170 | default: |
| 165 | - if (substr($value,0,12) == 'addressbook:') $value = substr($value,12); // link-entry syntax |
|
| 171 | + if (substr($value,0,12) == 'addressbook:') |
|
| 172 | + { |
|
| 173 | + $value = substr($value,12); |
|
| 174 | + } |
|
| 175 | + // link-entry syntax |
|
| 166 | 176 | if (!($contact = $this->contacts->read($value))) |
| 167 | 177 | { |
| 168 | 178 | $contact = array(); |
@@ -49,7 +49,10 @@ discard block |
||
| 49 | 49 | $old_cname = $params[0]; |
| 50 | 50 | $old_expand = $params[1]; |
| 51 | 51 | |
| 52 | - if ($this->id && $this->type != 'groupbox') $cname = self::form_name($cname, $this->id, $params[1]); |
|
| 52 | + if ($this->id && $this->type != 'groupbox') |
|
| 53 | + { |
|
| 54 | + $cname = self::form_name($cname, $this->id, $params[1]); |
|
| 55 | + } |
|
| 53 | 56 | if ($expand['cname'] !== $cname && $cname) |
| 54 | 57 | { |
| 55 | 58 | $expand['cont'] =& self::get_array(self::$request->content, $cname); |
@@ -121,10 +124,13 @@ discard block |
||
| 121 | 124 | // need to break if fname ends in [] as get_array() will ignore it and returns whole array |
| 122 | 125 | // for an id like "run[$row_cont[appname]]" |
| 123 | 126 | substr($fname, -2) != '[]' && |
| 124 | - ($value = self::get_array(self::$request->content, $fname)) !== null) // null = not found (can be false!) |
|
| 127 | + ($value = self::get_array(self::$request->content, $fname)) !== null) |
|
| 128 | + { |
|
| 129 | + // null = not found (can be false!) |
|
| 125 | 130 | { |
| 126 | 131 | //error_log(__METHOD__."($widget,$cname) $this autorepeating row $expand[row] because of $check_widget->id = '$fname' is ".array2string($value)); |
| 127 | 132 | unset($value); |
| 133 | + } |
|
| 128 | 134 | return true; |
| 129 | 135 | } |
| 130 | 136 | } |
@@ -29,10 +29,13 @@ |
||
| 29 | 29 | public function beforeSendToClient($cname, array $expand=null) |
| 30 | 30 | { |
| 31 | 31 | $matches = null; |
| 32 | - if ($cname == '$row') // happens eg. with custom-fields: $cname='$row', this->id='#something' |
|
| 32 | + if ($cname == '$row') |
|
| 33 | + { |
|
| 34 | + // happens eg. with custom-fields: $cname='$row', this->id='#something' |
|
| 33 | 35 | { |
| 34 | 36 | $form_name = $this->id; |
| 35 | 37 | } |
| 38 | + } |
|
| 36 | 39 | // happens with fields in nm-header: $cname='nm', this->id='${row}[something]' or '{$row}[something]' |
| 37 | 40 | elseif (preg_match('/(\${row}|{\$row})\[([^]]+)\]$/', $this->id, $matches)) |
| 38 | 41 | { |
@@ -58,10 +58,12 @@ |
||
| 58 | 58 | is_array($value) && count($value) == 1 || |
| 59 | 59 | // check === true, as get_array() ignores a "[]" postfix and returns array() eg. for a not existing $row_cont[id] in "delete[$row_cont[id]]" |
| 60 | 60 | $value == true |
| 61 | - ) |
|
| 62 | - { |
|
| 61 | + ) { |
|
| 63 | 62 | $valid =& self::get_array($validated, $form_name, true); |
| 64 | - if (true) $valid = is_array($value) ? $value : 'pressed'; |
|
| 63 | + if (true) |
|
| 64 | + { |
|
| 65 | + $valid = is_array($value) ? $value : 'pressed'; |
|
| 66 | + } |
|
| 65 | 67 | |
| 66 | 68 | // recorded pressed button globally, was in the template object before, put now as static on this object |
| 67 | 69 | if ($this->type == 'cancel' || $form_name == 'cancel' || substr($form_name,-10) == '[cancel]') |
@@ -88,7 +88,10 @@ discard block |
||
| 88 | 88 | return false; // return |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if ($this->id) $cname = self::form_name($cname, $this->id, $expand); |
|
| 91 | + if ($this->id) |
|
| 92 | + { |
|
| 93 | + $cname = self::form_name($cname, $this->id, $expand); |
|
| 94 | + } |
|
| 92 | 95 | if ($expand['cname'] !== $cname && $cname) |
| 93 | 96 | { |
| 94 | 97 | $expand['cont'] =& self::get_array(self::$request->content, $cname); |
@@ -202,10 +205,13 @@ discard block |
||
| 202 | 205 | // need to break if fname ends in [] as get_array() will ignore it and returns whole array |
| 203 | 206 | // for an id like "run[$row_cont[appname]]" |
| 204 | 207 | substr($fname, -2) != '[]' && |
| 205 | - ($value = self::get_array(self::$request->content,$fname)) !== null) // null = not found (can be false!) |
|
| 208 | + ($value = self::get_array(self::$request->content,$fname)) !== null) |
|
| 209 | + { |
|
| 210 | + // null = not found (can be false!) |
|
| 206 | 211 | { |
| 207 | 212 | //error_log(__METHOD__."('$cname', ) $this autorepeating row $expand[row] because of $child->id = '$fname' is ".array2string($value)); |
| 208 | 213 | unset($value); |
| 214 | + } |
|
| 209 | 215 | return true; |
| 210 | 216 | } |
| 211 | 217 | } |