@@ -102,7 +102,7 @@ |
||
102 | 102 | if (is_string($value)) { |
103 | 103 | $this->_headers[$header] = trim($value); |
104 | 104 | } |
105 | - if ( strtolower($header) == 'from' |
|
105 | + if (strtolower($header) == 'from' |
|
106 | 106 | || strtolower($header) == 'reply-to' |
107 | 107 | || strtolower($header) == 'to') { |
108 | 108 | $this->_headers[$header] = $this->_encode_address_field($value); |
@@ -252,9 +252,9 @@ |
||
252 | 252 | break; |
253 | 253 | case 'delete': |
254 | 254 | if (empty($_POST['guids'])) { |
255 | - throw new midcom_error('Invalid request'); |
|
256 | - } |
|
257 | - break; |
|
255 | + throw new midcom_error('Invalid request'); |
|
256 | + } |
|
257 | + break; |
|
258 | 258 | default: |
259 | 259 | throw new midcom_error('Invalid request'); |
260 | 260 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $images = $qb->execute(); |
64 | 64 | $failed = 0; |
65 | 65 | foreach ($images as $image) { |
66 | - if ( !$image->generate_image('thumbnail', $this->_config->get('thumbnail_filter')) |
|
66 | + if (!$image->generate_image('thumbnail', $this->_config->get('thumbnail_filter')) |
|
67 | 67 | || !$image->generate_image('image', $this->_config->get('image_filter'))) { |
68 | 68 | $failed++; |
69 | 69 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | //Fall-through |
246 | 246 | case 'create': |
247 | - if ( !isset($_POST['title']) |
|
247 | + if (!isset($_POST['title']) |
|
248 | 248 | || !isset($_POST['description']) |
249 | 249 | || !isset($_POST['position'])) { |
250 | 250 | throw new midcom_error('Invalid request'); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $attachment->title = $_POST['title']; |
268 | 268 | $attachment->mimetype = $file['type']; |
269 | 269 | $attachment->parentguid = $image->guid; |
270 | - if ( !$attachment->create() |
|
270 | + if (!$attachment->create() |
|
271 | 271 | || !$attachment->copy_from_file($file['tmp_name'])) { |
272 | 272 | throw new midcom_error('Failed to create attachment: ' . midcom_connection::get_error_string()); |
273 | 273 | } |
@@ -148,7 +148,8 @@ |
||
148 | 148 | try { |
149 | 149 | $this->$function(); |
150 | 150 | $this->_response->success = true; |
151 | - } catch (midcom_error $e) { |
|
151 | + } |
|
152 | + catch (midcom_error $e) { |
|
152 | 153 | $this->_response->success = false; |
153 | 154 | $this->_response->error = $e->getMessage(); |
154 | 155 | } |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | try { |
43 | 43 | $folder = midcom_db_topic::get_cached($this->topic); |
44 | - } catch (midcom_error $e) { |
|
44 | + } |
|
45 | + catch (midcom_error $e) { |
|
45 | 46 | $e->log(); |
46 | 47 | } |
47 | 48 | $folder->delete_attachment(self::FOLDER_THUMBNAIL); |
@@ -51,7 +52,8 @@ discard block |
||
51 | 52 | { |
52 | 53 | try { |
53 | 54 | return new midcom_db_attachment($this->$type); |
54 | - } catch (midcom_error $e) { |
|
55 | + } |
|
56 | + catch (midcom_error $e) { |
|
55 | 57 | $e->log(); |
56 | 58 | return false; |
57 | 59 | } |
@@ -150,7 +150,7 @@ |
||
150 | 150 | $rows = $mc->get_rows(['id', 'name', 'guid'], 'id'); |
151 | 151 | |
152 | 152 | foreach ($images as $image) { |
153 | - if ( !isset($rows[$image->attachment]) |
|
153 | + if (!isset($rows[$image->attachment]) |
|
154 | 154 | || !isset($rows[$image->image]) |
155 | 155 | || !isset($rows[$image->thumbnail])) { |
156 | 156 | continue; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | public function write_acls(midcom_core_dbaobject $object, $owner_id, $accesstype) |
17 | 17 | { |
18 | - if ( empty($owner_id) |
|
18 | + if (empty($owner_id) |
|
19 | 19 | || empty($accesstype)) { |
20 | 20 | return false; |
21 | 21 | } |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | |
64 | 64 | if ($privileges) { |
65 | 65 | foreach ($privileges as $privilege) { |
66 | - if ( !empty($needed_privileges[$privilege->privilegename]) |
|
66 | + if (!empty($needed_privileges[$privilege->privilegename]) |
|
67 | 67 | && $needed_privileges[$privilege->privilegename]['assignee'] == $privilege->assignee |
68 | 68 | && $needed_privileges[$privilege->privilegename]['value'] == $privilege->value) { |
69 | 69 | unset($needed_privileges[$privilege->privilegename]); |
70 | 70 | continue; |
71 | 71 | } |
72 | 72 | // Clear old ACLs applying to others than current user or selected owner group |
73 | - if ( $privilege->assignee != midcom::get()->auth->user->id |
|
73 | + if ($privilege->assignee != midcom::get()->auth->user->id |
|
74 | 74 | && $privilege->assignee != $owner_id) { |
75 | 75 | if (is_array($privilege->assignee)) { |
76 | 76 | $assignee_key = $privilege->assignee['identifier']; |
@@ -77,7 +77,7 @@ |
||
77 | 77 | echo '<select class="filter_input" onchange="document.forms[\'' . $this->name . '_filter\'].submit();" name="' . $this->name . '">'; |
78 | 78 | |
79 | 79 | foreach ($options as $option) { |
80 | - echo '<option value="' . $option['id'] . '"'; |
|
80 | + echo '<option value="' . $option['id'] . '"'; |
|
81 | 81 | if ($option['selected'] == true) { |
82 | 82 | echo " selected=\"selected\""; |
83 | 83 | } |
@@ -77,9 +77,9 @@ |
||
77 | 77 | $filter_id = $this->_identifier . '_' . $filtername; |
78 | 78 | $user = midcom::get()->auth->user->get_storage(); |
79 | 79 | |
80 | - if ( isset($_POST['unset_filter']) |
|
80 | + if (isset($_POST['unset_filter']) |
|
81 | 81 | && $_POST['unset_filter'] == $filter_id) { |
82 | - if ( $user->get_parameter("org_openpsa_core_filter", $filter_id) |
|
82 | + if ($user->get_parameter("org_openpsa_core_filter", $filter_id) |
|
83 | 83 | && !$user->delete_parameter("org_openpsa_core_filter", $filter_id)) { |
84 | 84 | $message_content = sprintf( |
85 | 85 | $l10n->get('the handed filter for %s could not be set as parameter'), |
@@ -55,7 +55,8 @@ |
||
55 | 55 | $guid = $parts[1]; |
56 | 56 | try { |
57 | 57 | $attachments[$parts[0]] = midcom_db_attachment::get_cached($guid); |
58 | - } catch (midcom_error $e) { |
|
58 | + } |
|
59 | + catch (midcom_error $e) { |
|
59 | 60 | $e->log(); |
60 | 61 | } |
61 | 62 | } |
@@ -35,31 +35,31 @@ |
||
35 | 35 | return $output; |
36 | 36 | } |
37 | 37 | |
38 | - /** |
|
39 | - * @param midcom_core_dbaobject $object The object we're working on |
|
40 | - * @param string $field The schema field name |
|
41 | - * @return midcom_db_attachment[] List of attachments, indexed by identifier |
|
42 | - */ |
|
43 | - public static function get_dm2_attachments($object, $field) |
|
44 | - { |
|
45 | - $attachments = []; |
|
46 | - $identifiers = explode(',', $object->get_parameter('midcom.helper.datamanager2.type.blobs', 'guids_' . $field)); |
|
47 | - if (empty($identifiers)) { |
|
48 | - return $attachments; |
|
49 | - } |
|
50 | - foreach ($identifiers as $identifier) { |
|
51 | - $parts = explode(':', $identifier); |
|
52 | - if (sizeof($parts) != 2) { |
|
53 | - continue; |
|
54 | - } |
|
55 | - $guid = $parts[1]; |
|
56 | - try { |
|
57 | - $attachments[$parts[0]] = midcom_db_attachment::get_cached($guid); |
|
58 | - } catch (midcom_error $e) { |
|
59 | - $e->log(); |
|
60 | - } |
|
61 | - } |
|
38 | + /** |
|
39 | + * @param midcom_core_dbaobject $object The object we're working on |
|
40 | + * @param string $field The schema field name |
|
41 | + * @return midcom_db_attachment[] List of attachments, indexed by identifier |
|
42 | + */ |
|
43 | + public static function get_dm2_attachments($object, $field) |
|
44 | + { |
|
45 | + $attachments = []; |
|
46 | + $identifiers = explode(',', $object->get_parameter('midcom.helper.datamanager2.type.blobs', 'guids_' . $field)); |
|
47 | + if (empty($identifiers)) { |
|
48 | + return $attachments; |
|
49 | + } |
|
50 | + foreach ($identifiers as $identifier) { |
|
51 | + $parts = explode(':', $identifier); |
|
52 | + if (sizeof($parts) != 2) { |
|
53 | + continue; |
|
54 | + } |
|
55 | + $guid = $parts[1]; |
|
56 | + try { |
|
57 | + $attachments[$parts[0]] = midcom_db_attachment::get_cached($guid); |
|
58 | + } catch (midcom_error $e) { |
|
59 | + $e->log(); |
|
60 | + } |
|
61 | + } |
|
62 | 62 | |
63 | - return $attachments; |
|
64 | - } |
|
63 | + return $attachments; |
|
64 | + } |
|
65 | 65 | } |
@@ -35,7 +35,8 @@ |
||
35 | 35 | try { |
36 | 36 | midcom::get()->dbfactory->get_object_by_guid($param->name); |
37 | 37 | $tried[$param->name] = true; |
38 | - } catch (midcom_error $e) { |
|
38 | + } |
|
39 | + catch (midcom_error $e) { |
|
39 | 40 | $tried[$param->name] = false; |
40 | 41 | } |
41 | 42 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function merge($obj1, $obj2, $merge_mode) |
47 | 47 | { |
48 | - if ( $merge_mode !== 'all' |
|
48 | + if ($merge_mode !== 'all' |
|
49 | 49 | && $merge_mode !== 'future') { |
50 | 50 | debug_add("invalid mode {$merge_mode}", MIDCOM_LOG_ERROR); |
51 | 51 | throw new midcom_error('invalid merge mode'); |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | if (!empty($conf['duplicate_check'])) { |
88 | 88 | $dup = $this->check_duplicate($results, $result, $conf['duplicate_check']); |
89 | 89 | |
90 | - if ( is_object($dup) |
|
90 | + if (is_object($dup) |
|
91 | 91 | || $dup === false) { |
92 | - if ( !is_object($dup) |
|
92 | + if (!is_object($dup) |
|
93 | 93 | || !array_key_exists($dup->id, $todelete)) { |
94 | 94 | $todelete[$result->id] = $result; |
95 | 95 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | } |
100 | 100 | } |
101 | - if ( $needs_update |
|
101 | + if ($needs_update |
|
102 | 102 | && !$result->update()) { |
103 | 103 | throw new midcom_error("Failed to update {$classname} #{$result->id}, errstr: " . midcom_connection::get_error_string()); |
104 | 104 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | foreach ($results as $result) { |
150 | - if ( $result->$field === $object->$field |
|
150 | + if ($result->$field === $object->$field |
|
151 | 151 | && $result->id !== $object->id) { |
152 | 152 | return $result; |
153 | 153 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $changed = false; |
166 | 166 | foreach ($person2 as $property => $value) { |
167 | 167 | // Copy only simple properties not marked to be skipped missing from person1 |
168 | - if ( empty($person2->$property) |
|
168 | + if (empty($person2->$property) |
|
169 | 169 | || !empty($person1->$property) |
170 | 170 | || isset($skip_properties[$property]) |
171 | 171 | || !is_scalar($value)) { |