@@ -28,7 +28,7 @@ |
||
28 | 28 | new type\radiocheckselect, |
29 | 29 | new type\subform, |
30 | 30 | new type\select, |
31 | - new type\tinymce, |
|
31 | + new type\tinymce, |
|
32 | 32 | new type\toolbar, |
33 | 33 | ); |
34 | 34 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | public function transform($array) |
21 | 21 | { |
22 | - if (!is_array($array) ) { |
|
22 | + if (!is_array($array)) { |
|
23 | 23 | throw new TransformationFailedException('Expected an array.'); |
24 | 24 | } |
25 | 25 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | $title = $this->data['midcom_services_auth_access_denied_title']; |
4 | 4 | $login_warning = $this->data['midcom_services_auth_access_denied_login_warning']; |
5 | 5 | |
6 | -midcom::get()->head->add_stylesheet(MIDCOM_STATIC_URL.'/midcom.services.auth/style.css'); |
|
6 | +midcom::get()->head->add_stylesheet(MIDCOM_STATIC_URL . '/midcom.services.auth/style.css'); |
|
7 | 7 | ?> |
8 | 8 | <!DOCTYPE html> |
9 | 9 | <html lang="<?php echo midcom::get()->i18n->get_current_language(); ?>"> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | $title = $this->data['midcom_services_auth_show_login_page_title']; |
3 | 3 | $login_warning = $this->data['midcom_services_auth_show_login_page_login_warning']; |
4 | 4 | |
5 | -midcom::get()->head->add_stylesheet(MIDCOM_STATIC_URL.'/midcom.services.auth/style.css'); |
|
5 | +midcom::get()->head->add_stylesheet(MIDCOM_STATIC_URL . '/midcom.services.auth/style.css'); |
|
6 | 6 | ?> |
7 | 7 | <!DOCTYPE html> |
8 | 8 | <html lang="<?php echo midcom::get()->i18n->get_current_language(); ?>"> |
@@ -312,17 +312,17 @@ |
||
312 | 312 | private static $_privileges_cache = array(); |
313 | 313 | |
314 | 314 | /** |
315 | - * Internal cache of the content privileges of users on content objects, this is |
|
316 | - * an associative array using a combination of the user identifier and the object's |
|
317 | - * guid as index. The privileges for the anonymous user use the magic |
|
318 | - * EVERYONE as user identifier. |
|
319 | - * |
|
320 | - * This must not be merged with the class-wide privileges_cache, because otherwise |
|
321 | - * class_default_privileges for child objects might be overridden by parent default |
|
322 | - * privileges |
|
323 | - * |
|
324 | - * @var Array |
|
325 | - */ |
|
315 | + * Internal cache of the content privileges of users on content objects, this is |
|
316 | + * an associative array using a combination of the user identifier and the object's |
|
317 | + * guid as index. The privileges for the anonymous user use the magic |
|
318 | + * EVERYONE as user identifier. |
|
319 | + * |
|
320 | + * This must not be merged with the class-wide privileges_cache, because otherwise |
|
321 | + * class_default_privileges for child objects might be overridden by parent default |
|
322 | + * privileges |
|
323 | + * |
|
324 | + * @var Array |
|
325 | + */ |
|
326 | 326 | private static $_content_privileges_cache = array(); |
327 | 327 | |
328 | 328 | /** |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $cache_id = $user_id . '::' . $object_guid; |
519 | 519 | |
520 | 520 | if (!array_key_exists($cache_id, self::$_privileges_cache)) { |
521 | - if ( empty($object_guid) |
|
521 | + if (empty($object_guid) |
|
522 | 522 | || empty($object_class)) { |
523 | 523 | /* No idea if there should be some special log message written */ |
524 | 524 | return array(); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | midcom::get()->auth->acl->_internal_sudo = $previous_sudo; |
631 | 631 | // <== out of SUDO |
632 | 632 | |
633 | - if ( $parent_guid == $guid |
|
633 | + if ($parent_guid == $guid |
|
634 | 634 | || !mgd_is_guid($parent_guid)) { |
635 | 635 | $base_privileges = array(); |
636 | 636 | } else { |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | // Determine parent ownership |
642 | 642 | $is_owner = false; |
643 | 643 | $last_owner_scope = -1; |
644 | - if ( array_key_exists('midgard:owner', $base_privileges) |
|
644 | + if (array_key_exists('midgard:owner', $base_privileges) |
|
645 | 645 | && $base_privileges['midgard:owner'] == MIDCOM_PRIVILEGE_ALLOW) { |
646 | 646 | $is_owner = true; |
647 | 647 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | |
682 | 682 | $valid_privileges[$scope][$privilege->privilegename] = $privilege->value; |
683 | 683 | |
684 | - if ( $privilege->privilegename == 'midgard:owner' |
|
684 | + if ($privilege->privilegename == 'midgard:owner' |
|
685 | 685 | && $scope > $last_owner_scope) { |
686 | 686 | $is_owner = ($privilege->value == MIDCOM_PRIVILEGE_ALLOW); |
687 | 687 | $last_owner_scope = $scope; |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | $content_privilege = null; |
893 | 893 | |
894 | 894 | foreach ($object_privileges as $privilege) { |
895 | - if ( $privilege->privilegename != $privilegename |
|
895 | + if ($privilege->privilegename != $privilegename |
|
896 | 896 | || $privilege->scope <= $last_scope |
897 | 897 | || !$privilege->does_privilege_apply($user_id)) { |
898 | 898 | continue; |
@@ -903,10 +903,10 @@ discard block |
||
903 | 903 | } |
904 | 904 | |
905 | 905 | //owner privileges override everything but person privileges, so we have to cross-check those here |
906 | - if ( $privilegename != 'midgard:owner' |
|
906 | + if ($privilegename != 'midgard:owner' |
|
907 | 907 | && $last_scope < MIDCOM_PRIVILEGE_SCOPE_OWNER) { |
908 | 908 | $owner_privileges = $this->get_owner_default_privileges(); |
909 | - if ( array_key_exists($privilegename, $owner_privileges) |
|
909 | + if (array_key_exists($privilegename, $owner_privileges) |
|
910 | 910 | && $this->_load_content_privilege('midgard:owner', $guid, $class, $user_id) |
911 | 911 | && self::$_content_privileges_cache[$cache_id]['midgard:owner']) { |
912 | 912 | self::$_content_privileges_cache[$cache_id][$privilegename] = ($owner_privileges[$privilegename] == MIDCOM_PRIVILEGE_ALLOW); |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | midcom::get()->auth->acl->_internal_sudo = $previous_sudo; |
931 | 931 | // <== out of SUDO |
932 | 932 | |
933 | - if ( $parent_guid == $guid |
|
933 | + if ($parent_guid == $guid |
|
934 | 934 | || !mgd_is_guid($parent_guid)) { |
935 | 935 | return false; |
936 | 936 | } |
@@ -474,7 +474,7 @@ |
||
474 | 474 | { |
475 | 475 | return |
476 | 476 | ( |
477 | - $this->string_exists($string, $this->_language) |
|
477 | + $this->string_exists($string, $this->_language) |
|
478 | 478 | || $this->string_exists($string, $this->_fallback_language) |
479 | 479 | ); |
480 | 480 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | self::$_localedb[$this->_library] = array(); |
150 | 150 | } |
151 | 151 | |
152 | - $this->_stringdb =& self::$_localedb[$this->_library]; |
|
152 | + $this->_stringdb = & self::$_localedb[$this->_library]; |
|
153 | 153 | |
154 | 154 | $this->set_language(midcom::get()->i18n->get_current_language()); |
155 | 155 | $this->set_charset(midcom::get()->i18n->get_current_charset()); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $data = $this->parse_data(file($filename), $lang, $filename); |
219 | 219 | |
220 | 220 | // get site-specific l10n |
221 | - $component_locale = midcom_helper_misc::get_snippet_content_graceful("conf:/" . $this->_component_name . '/l10n/'. $this->database . '.' . $lang . '.txt'); |
|
221 | + $component_locale = midcom_helper_misc::get_snippet_content_graceful("conf:/" . $this->_component_name . '/l10n/' . $this->database . '.' . $lang . '.txt'); |
|
222 | 222 | if (!empty($component_locale)) { |
223 | 223 | $data = array_merge($data, $this->parse_data(explode("\n", $component_locale), $lang, $component_locale)); |
224 | 224 | } |
@@ -58,7 +58,6 @@ |
||
58 | 58 | * @property string $revisor The person that modified the object, read-only. |
59 | 59 | * @property integer $approved The time of approval of the object, or 0 if not approved. Set automatically through approve/unapprove. |
60 | 60 | * @property string $approver The person that approved/unapproved the object. Set automatically through approve/unapprove. |
61 | - |
|
62 | 61 | * @package midcom.helper |
63 | 62 | */ |
64 | 63 | class midcom_helper_metadata |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // Check if we have metadata schema defined in the schemadb specific for the object's schema or component |
227 | 227 | $object_schema = $object->get_parameter('midcom.helper.datamanager2', 'schema_name'); |
228 | 228 | $component_schema = str_replace('.', '_', midcom_core_context::get()->get_key(MIDCOM_CONTEXT_COMPONENT)); |
229 | - if ( $object_schema == '' |
|
229 | + if ($object_schema == '' |
|
230 | 230 | || !isset($schemadb[$object_schema])) { |
231 | 231 | if (isset($schemadb[$component_schema])) { |
232 | 232 | // No specific metadata schema for object, fall back to component-specific metadata schema |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | } else { |
446 | 446 | $value = (int) $this->__metadata->$key->format('U'); |
447 | 447 | } |
448 | - } elseif ( empty($this->__metadata->$key) |
|
448 | + } elseif (empty($this->__metadata->$key) |
|
449 | 449 | || $this->__metadata->$key == '0000-00-00 00:00:00') { |
450 | 450 | $value = 0; |
451 | 451 | } else { |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | $now = time(); |
535 | - if ( $this->get('schedulestart') |
|
535 | + if ($this->get('schedulestart') |
|
536 | 536 | && $this->get('schedulestart') > $now) { |
537 | 537 | return false; |
538 | 538 | } |
539 | - if ( $this->get('scheduleend') |
|
539 | + if ($this->get('scheduleend') |
|
540 | 540 | && $this->get('scheduleend') < $now) { |
541 | 541 | return false; |
542 | 542 | } |
@@ -554,9 +554,9 @@ discard block |
||
554 | 554 | public function is_object_visible_onsite() |
555 | 555 | { |
556 | 556 | return |
557 | - ( ( midcom::get()->config->get('show_hidden_objects') |
|
557 | + ((midcom::get()->config->get('show_hidden_objects') |
|
558 | 558 | || $this->is_visible()) |
559 | - && ( midcom::get()->config->get('show_unapproved_objects') |
|
559 | + && (midcom::get()->config->get('show_unapproved_objects') |
|
560 | 560 | || $this->is_approved()) |
561 | 561 | ); |
562 | 562 | } |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $object = $source; |
644 | 644 | $guid = $source->guid; |
645 | 645 | } elseif (is_array($source)) { |
646 | - if ( !array_key_exists(MIDCOM_NAV_GUID, $source) |
|
646 | + if (!array_key_exists(MIDCOM_NAV_GUID, $source) |
|
647 | 647 | || is_null($source[MIDCOM_NAV_GUID])) { |
648 | 648 | debug_print_r('We got an invalid input, cannot return metadata:', $source); |
649 | 649 | return false; |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | $guid = $source; |
655 | 655 | } |
656 | 656 | |
657 | - if ( is_null($object) |
|
657 | + if (is_null($object) |
|
658 | 658 | && mgd_is_guid($guid)) { |
659 | 659 | try { |
660 | 660 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | } |
690 | 690 | |
691 | 691 | // Lock was created by the user, return "not locked" |
692 | - if ( !empty(midcom::get()->auth->user->guid) |
|
692 | + if (!empty(midcom::get()->auth->user->guid) |
|
693 | 693 | && $this->get('locker') === midcom::get()->auth->user->guid) { |
694 | 694 | return false; |
695 | 695 | } |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | { |
708 | 708 | midcom::get()->auth->require_do('midgard:update', $this->__object); |
709 | 709 | |
710 | - if ( is_object($this->__object) |
|
710 | + if (is_object($this->__object) |
|
711 | 711 | && $this->__object->lock()) { |
712 | 712 | $this->_cache = array(); |
713 | 713 | return true; |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | */ |
725 | 725 | public function can_unlock() |
726 | 726 | { |
727 | - return ( $this->__object->can_do('midcom:unlock') |
|
727 | + return ($this->__object->can_do('midcom:unlock') |
|
728 | 728 | || midcom::get()->auth->can_user_do('midcom:unlock', null, 'midcom_services_auth', 'midcom')); |
729 | 729 | } |
730 | 730 | |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | */ |
736 | 736 | public function unlock() |
737 | 737 | { |
738 | - if ( $this->can_unlock() |
|
738 | + if ($this->can_unlock() |
|
739 | 739 | && is_object($this->__object) |
740 | 740 | && $this->__object->unlock()) { |
741 | 741 | $this->_cache = array(); |
@@ -658,7 +658,8 @@ |
||
658 | 658 | && mgd_is_guid($guid)) { |
659 | 659 | try { |
660 | 660 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
661 | - } catch (midcom_error $e) { |
|
661 | + } |
|
662 | + catch (midcom_error $e) { |
|
662 | 663 | debug_add("Failed to create a metadata instance for the GUID {$guid}: " . $e->getMessage(), MIDCOM_LOG_WARN); |
663 | 664 | debug_print_r("Source was:", $source); |
664 | 665 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @var array |
37 | 37 | */ |
38 | - var $jsevents=null; |
|
38 | + var $jsevents = null; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Whether to show field title or not. |
@@ -407,7 +407,7 @@ |
||
407 | 407 | |
408 | 408 | $parent = $parent->get_parent_group(); |
409 | 409 | } |
410 | - */ |
|
410 | + */ |
|
411 | 411 | $this->_inheritance_chains[$id] = $inheritance_chain; |
412 | 412 | } |
413 | 413 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | private function _load_from_string($id, $person_class) |
214 | 214 | { |
215 | 215 | // Don't even try with the magic assignees |
216 | - if ( 'ANONYMOUS' === $id |
|
216 | + if ('ANONYMOUS' === $id |
|
217 | 217 | || 'EVERYONE' === $id |
218 | 218 | || 'USERS' === $id |
219 | 219 | || 'OWNER' === $id |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $this->_inheritance_chains = array(); |
362 | 362 | |
363 | 363 | foreach ($this->_direct_groups as $id => $group) { |
364 | - $this->_all_groups[$id] =& $this->_direct_groups[$id]; |
|
364 | + $this->_all_groups[$id] = & $this->_direct_groups[$id]; |
|
365 | 365 | $inheritance_chain = array($group->id); |
366 | 366 | /** |
367 | 367 | * FIXME: Parent group members should inherit permissions from |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | } |
491 | 491 | // We scan through our groups looking for a midgard group with the right name |
492 | 492 | foreach ($this->_all_groups as $group_object) { |
493 | - if ( midcom::get()->dbfactory->is_a($group_object, 'midcom_core_group') |
|
493 | + if (midcom::get()->dbfactory->is_a($group_object, 'midcom_core_group') |
|
494 | 494 | && $group_object->get_storage()->name == $group) { |
495 | 495 | return true; |
496 | 496 | } |
@@ -180,7 +180,8 @@ discard block |
||
180 | 180 | } |
181 | 181 | try { |
182 | 182 | $this->_storage = new $person_class($id); |
183 | - } catch (midgard_error_exception $e) { |
|
183 | + } |
|
184 | + catch (midgard_error_exception $e) { |
|
184 | 185 | debug_add("Failed to retrieve the person ID {$id}: " . $e->getMessage(), MIDCOM_LOG_INFO); |
185 | 186 | throw new midcom_error_midgard($e, $id); |
186 | 187 | } |
@@ -228,7 +229,8 @@ discard block |
||
228 | 229 | if (mgd_is_guid($id)) { |
229 | 230 | try { |
230 | 231 | return new $person_class($id); |
231 | - } catch (midgard_error_exception $e) { |
|
232 | + } |
|
233 | + catch (midgard_error_exception $e) { |
|
232 | 234 | debug_add("Failed to retrieve the person GUID {$id}: " . $e->getMessage(), MIDCOM_LOG_INFO); |
233 | 235 | throw new midcom_error_midgard($e, $id); |
234 | 236 | } |