@@ -55,7 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | $http_client = new org_openpsa_httplib(); |
| 57 | 57 | $http_client->set_param('timeout', 300); |
| 58 | -if ( !empty($_SERVER['PHP_AUTH_USER']) |
|
| 58 | +if (!empty($_SERVER['PHP_AUTH_USER']) |
|
| 59 | 59 | && !empty($_SERVER['PHP_AUTH_PW'])) { |
| 60 | 60 | $http_client->basicauth['user'] = $_SERVER['PHP_AUTH_USER']; |
| 61 | 61 | $http_client->basicauth['password'] = $_SERVER['PHP_AUTH_PW']; |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | { |
| 464 | 464 | // Complete fields |
| 465 | 465 | $this->indexed = time(); |
| 466 | - if ( $this->author == '' |
|
| 466 | + if ($this->author == '' |
|
| 467 | 467 | && isset($this->creator->name)) { |
| 468 | 468 | $this->author = $this->creator->name; |
| 469 | 469 | } |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | public function read_metadata_from_object($object) |
| 607 | 607 | { |
| 608 | 608 | // Published is set to non-empty value, use it as creation data |
| 609 | - if ( !empty($object->metadata->published) |
|
| 609 | + if (!empty($object->metadata->published) |
|
| 610 | 610 | && !preg_match('/0{1,4}-0{1,2}0{1,2}\s+0{1,2}:0{1,2}:0{1,2}/', $object->metadata->published)) { |
| 611 | 611 | $this->created = $this->read_unixtime($object->metadata->published); |
| 612 | 612 | } elseif (isset($object->metadata->created)) { |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | return @strtotime($stamp); |
| 646 | 646 | } |
| 647 | 647 | // Unix timestamp |
| 648 | - return (int)$stamp; |
|
| 648 | + return (int) $stamp; |
|
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /** |
@@ -680,7 +680,8 @@ |
||
| 680 | 680 | { |
| 681 | 681 | try { |
| 682 | 682 | return midcom_db_person::get_cached($id); |
| 683 | - } catch (midcom_error $e) { |
|
| 683 | + } |
|
| 684 | + catch (midcom_error $e) { |
|
| 684 | 685 | return false; |
| 685 | 686 | } |
| 686 | 687 | } |
@@ -63,7 +63,8 @@ |
||
| 63 | 63 | |
| 64 | 64 | try { |
| 65 | 65 | $attachment = new midcom_db_attachment($guid); |
| 66 | - } catch (midcom_error $e) { |
|
| 66 | + } |
|
| 67 | + catch (midcom_error $e) { |
|
| 67 | 68 | $e->log(); |
| 68 | 69 | return "<span class=\"missing_photo\" title=\"{$guid}\">{$fulltag}</span>{$after}"; |
| 69 | 70 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | return $this->render_link($parts[1], $parts[2]) . $after; |
| 224 | 224 | |
| 225 | 225 | // Macro [something: <data>] (for example [abbr: BOFH - Bastard Operator From Hell] or [photo: <GUID>]) |
| 226 | - case ( preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
| 226 | + case (preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
| 227 | 227 | && method_exists($this, "_run_macro_{$macro_parts[1]}")): |
| 228 | 228 | $method = "_run_macro_{$macro_parts[1]}"; |
| 229 | 229 | return $this->$method($macro_parts[2], $match[0], $after); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $folder = $wikipage_match['latest_parent']; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ( isset($folder[MIDCOM_NAV_OBJECT]) |
|
| 259 | + if (isset($folder[MIDCOM_NAV_OBJECT]) |
|
| 260 | 260 | && $folder[MIDCOM_NAV_OBJECT]->can_do('midgard:create')) { |
| 261 | 261 | $workflow = $this->get_workflow('datamanager'); |
| 262 | 262 | return "<a href=\"{$folder[MIDCOM_NAV_ABSOLUTEURL]}create/?wikiword={$wikipage_match['remaining_path']}\" " . $workflow->render_attributes() . " class=\"wiki_missing\" title=\"" . $this->_l10n->get('click to create') . "\">{$text}</a>"; |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $links[$parts[1]] = $parts[2]; |
| 292 | 292 | } |
| 293 | 293 | // Ignore macros [something: <data>] (for example [abbr: BOFH - Bastard Operator From Hell] or [photo: <GUID>]) |
| 294 | - elseif ( !preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
| 294 | + elseif (!preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
| 295 | 295 | || !method_exists($this, "_run_macro_{$macro_parts[1]}")) { |
| 296 | 296 | // MediaWiki-style link [wikipage] (no text) |
| 297 | 297 | $links[$fulltext] = $fulltext; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $etag = trim($parser->data['headers']['etag']); |
| 102 | 102 | |
| 103 | 103 | $feed_etag = $this->_feed->get_parameter('net.nemein.rss', 'etag'); |
| 104 | - if ( !empty($feed_etag) |
|
| 104 | + if (!empty($feed_etag) |
|
| 105 | 105 | && $feed_etag == $etag) { |
| 106 | 106 | // Feed hasn't changed, skip updating |
| 107 | 107 | debug_add("Feed {$this->_feed->url} has not changed since " . date('c', $this->_feed->latestfetch), MIDCOM_LOG_WARN); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $guid = $item->get_id(); |
| 188 | 188 | $title = $item->get_title(); |
| 189 | 189 | |
| 190 | - if ( ( empty($title) |
|
| 190 | + if ((empty($title) |
|
| 191 | 191 | || trim($title) == '...') |
| 192 | 192 | && empty($guid)) { |
| 193 | 193 | // Something wrong with this entry, skip it |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $meta_values['published'] = $article_date; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - if ( $this->apply_values($article, $values, $meta_values) |
|
| 258 | + if ($this->apply_values($article, $values, $meta_values) |
|
| 259 | 259 | && !$article->update()) { |
| 260 | 260 | return false; |
| 261 | 261 | } |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | private function find_author(net_nemein_rss_parser_item $item) |
| 285 | 285 | { |
| 286 | 286 | // Try to figure out item author |
| 287 | - if ( $this->_feed->forceauthor |
|
| 287 | + if ($this->_feed->forceauthor |
|
| 288 | 288 | && $this->_feed->defaultauthor) { |
| 289 | 289 | // Feed has a "default author" set, use it |
| 290 | 290 | return new midcom_db_person($this->_feed->defaultauthor); |
| 291 | 291 | } |
| 292 | 292 | $author = $this->match_item_author($item); |
| 293 | 293 | $fallback_person_id = 1; |
| 294 | - if ( !$author |
|
| 294 | + if (!$author |
|
| 295 | 295 | || $author->id == $fallback_person_id) { |
| 296 | 296 | if ($this->_feed->defaultauthor) { |
| 297 | 297 | // Feed has a "default author" set, use it |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | - if ( !empty($author_info['username']) |
|
| 480 | + if (!empty($author_info['username']) |
|
| 481 | 481 | && $person = midcom::get()->auth->get_user_by_name($author_info['username'])) { |
| 482 | 482 | return $person->get_storage(); |
| 483 | 483 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $qb->add_constraint('name', '<>', ''); |
| 47 | 47 | |
| 48 | 48 | // Unless in Auto-Index mode or the index article is hidden, we skip the index article. |
| 49 | - if ( !$this->_config->get('autoindex') |
|
| 49 | + if (!$this->_config->get('autoindex') |
|
| 50 | 50 | && !$this->_config->get('indexinnav')) { |
| 51 | 51 | $qb->add_constraint('name', '<>', 'index'); |
| 52 | 52 | } |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | $qb = midcom::get()->dbfactory->new_query_builder($this->config['type_config']['mapping_class_name']); |
| 100 | 100 | $qb->add_constraint($this->config['type_config']['master_fieldname'], '=', $this->get_master_foreign_key()); |
| 101 | 101 | |
| 102 | - if ( $this->config['type_config']['sortable'] |
|
| 102 | + if ($this->config['type_config']['sortable'] |
|
| 103 | 103 | && preg_match('/^(ASC|DESC)/i', $this->config['type_config']['sortable_sort_order'], $regs)) { |
| 104 | 104 | $order = strtoupper($regs[1]); |
| 105 | 105 | $qb->add_order('metadata.score', $order); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $this->content .= "{$this->abstract}\n"; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if (! $this->title) { |
|
| 140 | + if (!$this->title) { |
|
| 141 | 141 | $this->title = $this->document_url; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | if (!empty($field->vars['value'])) { |
| 179 | 179 | //only index the first attachment for now |
| 180 | 180 | $attachment = array_shift($field->vars['value']); |
| 181 | - if ( !$attachment instanceof \midcom_db_attachment |
|
| 181 | + if (!$attachment instanceof \midcom_db_attachment |
|
| 182 | 182 | && !empty($attachment['object'])) { |
| 183 | 183 | //This is the form edit case |
| 184 | 184 | //@todo: In create case, nothing is found currently |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | private function resolve_auto_method($name) |
| 264 | 264 | { |
| 265 | - if ( $name == 'abstract' |
|
| 265 | + if ($name == 'abstract' |
|
| 266 | 266 | || $name == 'title' |
| 267 | 267 | || $name == 'author') { |
| 268 | 268 | return $name; |
@@ -66,7 +66,8 @@ discard block |
||
| 66 | 66 | try { |
| 67 | 67 | $person1 = new org_openpsa_contacts_person_dba($param->parentguid); |
| 68 | 68 | $person2 = new org_openpsa_contacts_person_dba($param->name); |
| 69 | - } catch (midcom_error $e) { |
|
| 69 | + } |
|
| 70 | + catch (midcom_error $e) { |
|
| 70 | 71 | $i++; |
| 71 | 72 | continue; |
| 72 | 73 | } |
@@ -137,7 +138,8 @@ discard block |
||
| 137 | 138 | try { |
| 138 | 139 | $merger = new org_openpsa_contacts_duplicates_merge('person', $this->_config); |
| 139 | 140 | $merger->merge_delete($person1, $person2); |
| 140 | - } catch (midcom_error $e) { |
|
| 141 | + } |
|
| 142 | + catch (midcom_error $e) { |
|
| 141 | 143 | // TODO: Localize |
| 142 | 144 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.contacts'), 'Merge failed, errstr: ' . $e->getMessage(), 'error'); |
| 143 | 145 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | private function load_next() |
| 42 | 42 | { |
| 43 | - $i =& $this->_request_data['loop_i']; |
|
| 43 | + $i = & $this->_request_data['loop_i']; |
|
| 44 | 44 | while ($i < 100) { |
| 45 | 45 | debug_add("Loop iteration {$i}"); |
| 46 | 46 | $qb = new midgard_query_builder('midgard_parameter'); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | continue; |
| 69 | 69 | } |
| 70 | 70 | // Make sure we actually have enough rights to do this |
| 71 | - if ( !$person1->can_do('midgard:update') |
|
| 71 | + if (!$person1->can_do('midgard:update') |
|
| 72 | 72 | || !$person1->can_do('midgard:delete') |
| 73 | 73 | || !$person2->can_do('midgard:update') |
| 74 | 74 | || !$person2->can_do('midgard:delete')) { |
@@ -77,14 +77,14 @@ discard block |
||
| 77 | 77 | continue; |
| 78 | 78 | } |
| 79 | 79 | // Extra sanity check (in case of semi-successful not-duplicate mark) |
| 80 | - if ( $person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) |
|
| 80 | + if ($person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) |
|
| 81 | 81 | || $person2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person1->guid)) { |
| 82 | 82 | debug_add("It seems these two (#{$person1->id} and #{$person2->id}) have also marked as not duplicates, some cleanup might be a good thing", MIDCOM_LOG_WARN); |
| 83 | 83 | $i++; |
| 84 | 84 | continue; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - $this->_request_data['probability'] = (float)$param->value; |
|
| 87 | + $this->_request_data['probability'] = (float) $param->value; |
|
| 88 | 88 | $this->_request_data['person1'] = $person1; |
| 89 | 89 | $this->_request_data['person2'] = $person2; |
| 90 | 90 | break; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if ($keep == 'both') { |
| 103 | 103 | $option1->require_do('midgard:update'); |
| 104 | 104 | $option2->require_do('midgard:update'); |
| 105 | - if ( $option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
| 105 | + if ($option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
| 106 | 106 | && $option2->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option1->guid, time())) { |
| 107 | 107 | // Clear the possible duplicate parameters |
| 108 | 108 | $option1->delete_parameter('org.openpsa.contacts.duplicates:possible_duplicate', $option2->guid); |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | } else { |
| 122 | 122 | if ($keep == $option1->guid) { |
| 123 | - $person1 =& $option1; |
|
| 124 | - $person2 =& $option2; |
|
| 123 | + $person1 = & $option1; |
|
| 124 | + $person2 = & $option2; |
|
| 125 | 125 | } elseif ($keep == $option2->guid) { |
| 126 | - $person1 =& $option2; |
|
| 127 | - $person2 =& $option1; |
|
| 126 | + $person1 = & $option2; |
|
| 127 | + $person2 = & $option1; |
|
| 128 | 128 | } else { |
| 129 | 129 | throw new midcom_error('Something weird happened (basically we got bogus data)'); |
| 130 | 130 | } |
@@ -380,7 +380,8 @@ discard block |
||
| 380 | 380 | try { |
| 381 | 381 | $cmd = midcom::get()->config->get('utility_imagemagick_base') . "identify " . escapeshellarg($filename); |
| 382 | 382 | $this->_run_command($cmd); |
| 383 | - } catch (midcom_error $e) { |
|
| 383 | + } |
|
| 384 | + catch (midcom_error $e) { |
|
| 384 | 385 | return false; |
| 385 | 386 | } |
| 386 | 387 | return true; |
@@ -406,7 +407,8 @@ discard block |
||
| 406 | 407 | debug_add("EXIF information missing or without orientation tag. Skipping.", MIDCOM_LOG_INFO); |
| 407 | 408 | return; |
| 408 | 409 | } |
| 409 | - } catch (Exception $e) { |
|
| 410 | + } |
|
| 411 | + catch (Exception $e) { |
|
| 410 | 412 | debug_add("Could not read EXIF data: " . $e->getMessage() . ", skipping.", MIDCOM_LOG_WARN); |
| 411 | 413 | return; |
| 412 | 414 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | debug_add("The File {$filename} is not writable.", MIDCOM_LOG_ERROR); |
| 191 | 191 | return false; |
| 192 | 192 | } |
| 193 | - if ( !empty($this->_filename) |
|
| 193 | + if (!empty($this->_filename) |
|
| 194 | 194 | && $this->_filename !== $filename) { |
| 195 | 195 | $this->_tmpfiles[] = $this->_filename; |
| 196 | 196 | } |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | $tmpfile = null; |
| 416 | 416 | $imagesize = getimagesize($this->_filename); |
| 417 | 417 | |
| 418 | - if ( $imagesize[2] == IMAGETYPE_JPEG |
|
| 418 | + if ($imagesize[2] == IMAGETYPE_JPEG |
|
| 419 | 419 | && $this->_jpegtran_available()) { |
| 420 | 420 | /* jpegtran */ |
| 421 | 421 | $operations = [ |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | while ($rotate > 360) { |
| 475 | 475 | $rotate -= 360; |
| 476 | 476 | } |
| 477 | - if ( $rotate == 0 |
|
| 477 | + if ($rotate == 0 |
|
| 478 | 478 | || $rotate == 360) { |
| 479 | 479 | debug_add("Rotate is {$rotate}, we're happy as-is."); |
| 480 | 480 | return; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | $imagesize = getimagesize($this->_filename); |
| 485 | 485 | |
| 486 | 486 | // Try lossless jpegtran rotation if possible |
| 487 | - if ( $imagesize[2] == IMAGETYPE_JPEG |
|
| 487 | + if ($imagesize[2] == IMAGETYPE_JPEG |
|
| 488 | 488 | && ($rotate % 90 == 0) |
| 489 | 489 | && $this->_jpegtran_available()) { |
| 490 | 490 | $tmpfile = $this->_get_tempfile(); |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | */ |
| 615 | 615 | public function fill($x = null, $y = null, $color = null, $gravity = 'center') |
| 616 | 616 | { |
| 617 | - if ( empty($x) |
|
| 617 | + if (empty($x) |
|
| 618 | 618 | || empty($y) |
| 619 | 619 | || empty($color)) { |
| 620 | 620 | //This is a bit silly, but here for backwards compatibility... |