@@ -81,9 +81,9 @@ |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | usort($results, function ($a, $b) use ($query) { |
| 84 | - similar_text($query, $a["label"], $percent_a); |
|
| 85 | - similar_text($query, $b["label"], $percent_b); |
|
| 86 | - return $percent_a === $percent_b ? 0 : ($percent_a > $percent_b ? -1 : 1); |
|
| 84 | + similar_text($query, $a["label"], $percent_a); |
|
| 85 | + similar_text($query, $b["label"], $percent_b); |
|
| 86 | + return $percent_a === $percent_b ? 0 : ($percent_a > $percent_b ? -1 : 1); |
|
| 87 | 87 | }); |
| 88 | 88 | |
| 89 | 89 | // switch regular JSON response handling off |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | $this->attrs['allowFreeEntries'] = true; |
| 46 | 46 | |
| 47 | - if($xml) { |
|
| 47 | + if ($xml) { |
|
| 48 | 48 | parent::__construct($xml); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if ($type == "account") |
| 65 | 65 | { |
| 66 | 66 | // Only search if a query was provided - don't search for all accounts |
| 67 | - if($query) |
|
| 67 | + if ($query) |
|
| 68 | 68 | { |
| 69 | 69 | $options['account_type'] = $_REQUEST['account_type']; |
| 70 | 70 | $links = Api\Accounts::link_query($query, $options); |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | $links = Api\Link::query($app, $query, $options); |
| 76 | 76 | } |
| 77 | 77 | $results = array(); |
| 78 | - foreach($links as $id => $name) |
|
| 78 | + foreach ($links as $id => $name) |
|
| 79 | 79 | { |
| 80 | 80 | $results[] = array('id' => $id, 'label' => $name); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - usort($results, function ($a, $b) use ($query) { |
|
| 83 | + usort($results, function($a, $b) use ($query) { |
|
| 84 | 84 | similar_text($query, $a["label"], $percent_a); |
| 85 | 85 | similar_text($query, $b["label"], $percent_b); |
| 86 | 86 | return $percent_a === $percent_b ? 0 : ($percent_a > $percent_b ? -1 : 1); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | public static function ajax_email() |
| 103 | 103 | { |
| 104 | 104 | // If no mail app access, use link system -> addressbook |
| 105 | - if(!$GLOBALS['egw_info']['apps']['mail']) |
|
| 105 | + if (!$GLOBALS['egw_info']['apps']['mail']) |
|
| 106 | 106 | { |
| 107 | 107 | $_REQUEST['app'] = 'addressbook-email'; |
| 108 | 108 | return self::ajax_search(); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @param array $content |
| 121 | 121 | * @param array &$validated=array() validated content |
| 122 | 122 | */ |
| 123 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
| 123 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
| 124 | 124 | { |
| 125 | 125 | $form_name = self::form_name($cname, $this->id, $expand); |
| 126 | 126 | |
@@ -130,39 +130,39 @@ discard block |
||
| 130 | 130 | $value = $value_in = self::get_array($content, $form_name); |
| 131 | 131 | $allowed = Select::selOptions($form_name); |
| 132 | 132 | |
| 133 | - foreach((array) $value as $key => $val) |
|
| 133 | + foreach ((array)$value as $key => $val) |
|
| 134 | 134 | { |
| 135 | - if(count($allowed) && !$this->attrs['allowFreeEntries'] && !array_key_exists($val,$allowed)) |
|
| 135 | + if (count($allowed) && !$this->attrs['allowFreeEntries'] && !array_key_exists($val, $allowed)) |
|
| 136 | 136 | { |
| 137 | - self::set_validation_error($form_name,lang("'%1' is NOT allowed ('%2')!",$val,implode("','",array_keys($allowed))),''); |
|
| 137 | + self::set_validation_error($form_name, lang("'%1' is NOT allowed ('%2')!", $val, implode("','", array_keys($allowed))), ''); |
|
| 138 | 138 | unset($value[$key]); |
| 139 | 139 | } |
| 140 | - if($this->type == 'taglist-email' && $this->attrs['include_lists'] && is_numeric($val)) |
|
| 140 | + if ($this->type == 'taglist-email' && $this->attrs['include_lists'] && is_numeric($val)) |
|
| 141 | 141 | { |
| 142 | 142 | $lists = $GLOBALS['egw']->contacts->get_lists(Api\Acl::READ); |
| 143 | - if(!array_key_exists($val, $lists)) |
|
| 143 | + if (!array_key_exists($val, $lists)) |
|
| 144 | 144 | { |
| 145 | - self::set_validation_error($form_name,lang("'%1' is NOT allowed ('%2')!",$val,implode("','",array_keys($lists))),''); |
|
| 145 | + self::set_validation_error($form_name, lang("'%1' is NOT allowed ('%2')!", $val, implode("','", array_keys($lists))), ''); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | - else if($this->type == 'taglist-email' && !preg_match(Url::EMAIL_PREG, $val) && |
|
| 149 | - !($this->attrs['domainOptional'] && preg_match (Taglist::EMAIL_PREG_NO_DOMAIN, $val)) && |
|
| 148 | + else if ($this->type == 'taglist-email' && !preg_match(Url::EMAIL_PREG, $val) && |
|
| 149 | + !($this->attrs['domainOptional'] && preg_match(Taglist::EMAIL_PREG_NO_DOMAIN, $val)) && |
|
| 150 | 150 | // Allow merge placeholders. Might be a better way to do this though. |
| 151 | - !preg_match('/{{.+}}|\$\$.+\$\$/',$val) |
|
| 151 | + !preg_match('/{{.+}}|\$\$.+\$\$/', $val) |
|
| 152 | 152 | ) |
| 153 | 153 | { |
| 154 | - self::set_validation_error($form_name,lang("'%1' has an invalid format",$val),''); |
|
| 154 | + self::set_validation_error($form_name, lang("'%1' has an invalid format", $val), ''); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | if ($ok && $value === '' && $this->attrs['needed']) |
| 158 | 158 | { |
| 159 | - self::set_validation_error($form_name,lang('Field must not be empty !!!',$value),''); |
|
| 159 | + self::set_validation_error($form_name, lang('Field must not be empty !!!', $value), ''); |
|
| 160 | 160 | } |
| 161 | - if(array_key_exists('multiple', $this->attrs) && $this->attrs['multiple'] == false) |
|
| 161 | + if (array_key_exists('multiple', $this->attrs) && $this->attrs['multiple'] == false) |
|
| 162 | 162 | { |
| 163 | 163 | $value = array_shift($value); |
| 164 | 164 | } |
| 165 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 165 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 166 | 166 | // returning null instead of array(), as array() will be overwritten by etemplate_new::complete_array_merge() |
| 167 | 167 | // with preserved old content and therefore user can not empty a taglist |
| 168 | 168 | if (true) $valid = $value ? $value : null; |
@@ -44,7 +44,8 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | $this->attrs['allowFreeEntries'] = true; |
| 46 | 46 | |
| 47 | - if($xml) { |
|
| 47 | + if($xml) |
|
| 48 | + { |
|
| 48 | 49 | parent::__construct($xml); |
| 49 | 50 | } |
| 50 | 51 | } |
@@ -80,7 +81,8 @@ discard block |
||
| 80 | 81 | $results[] = array('id' => $id, 'label' => $name); |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | - usort($results, function ($a, $b) use ($query) { |
|
| 84 | + usort($results, function ($a, $b) use ($query) |
|
| 85 | + { |
|
| 84 | 86 | similar_text($query, $a["label"], $percent_a); |
| 85 | 87 | similar_text($query, $b["label"], $percent_b); |
| 86 | 88 | return $percent_a === $percent_b ? 0 : ($percent_a > $percent_b ? -1 : 1); |
@@ -149,8 +151,7 @@ discard block |
||
| 149 | 151 | !($this->attrs['domainOptional'] && preg_match (Taglist::EMAIL_PREG_NO_DOMAIN, $val)) && |
| 150 | 152 | // Allow merge placeholders. Might be a better way to do this though. |
| 151 | 153 | !preg_match('/{{.+}}|\$\$.+\$\$/',$val) |
| 152 | - ) |
|
| 153 | - { |
|
| 154 | + ) { |
|
| 154 | 155 | self::set_validation_error($form_name,lang("'%1' has an invalid format",$val),''); |
| 155 | 156 | } |
| 156 | 157 | } |
@@ -165,7 +166,10 @@ discard block |
||
| 165 | 166 | $valid =& self::get_array($validated, $form_name, true); |
| 166 | 167 | // returning null instead of array(), as array() will be overwritten by etemplate_new::complete_array_merge() |
| 167 | 168 | // with preserved old content and therefore user can not empty a taglist |
| 168 | - if (true) $valid = $value ? $value : null; |
|
| 169 | + if (true) |
|
| 170 | + { |
|
| 171 | + $valid = $value ? $value : null; |
|
| 172 | + } |
|
| 169 | 173 | //error_log(__METHOD__."() $form_name: ".array2string($value_in).' --> '.array2string($value).', allowed='.array2string($allowed)); |
| 170 | 174 | } |
| 171 | 175 | } |