Index: branches/5.2.x/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r15016 -r15045 --- branches/5.2.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 15016) +++ branches/5.2.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 15045) @@ -1,6 +1,6 @@ Application->isAdmin) { + if ( !$this->Application->isAdmin ) { $event->setEventParam('same_special', true); } return parent::getPerPage($event); } /** - * Set's correct page for list - * based on data provided with event + * Set's correct page for list based on data provided with event * * @param kEvent $event - * @access private - * @see OnListBuild + * @return void + * @access protected + * @see kDBEventHandler::OnListBuild() */ - function SetPagination(&$event) + protected function SetPagination(kEvent &$event) { parent::SetPagination($event); Index: branches/5.2.x/core/units/reviews/reviews_event_handler.php =================================================================== diff -u -N -r14989 -r15045 --- branches/5.2.x/core/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 14989) +++ branches/5.2.x/core/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 15045) @@ -1,6 +1,6 @@ getObject(); /* @var $object kDBList */ // get PerPage (forced -> session -> config -> 10) - $object->SetPerPage( $this->getPerPage($event) ); + $object->SetPerPage($this->getPerPage($event)); // main lists on Front-End have special get parameter for page $page = $object->isMainList() ? $this->Application->GetVar('page') : false; - if (!$page) { + if ( !$page ) { // page is given in "env" variable for given prefix $page = $this->Application->GetVar($event->getPrefixSpecial() . '_Page'); } - if (!$page && $event->Special) { + if ( !$page && $event->Special ) { // when not part of env, then variables like "prefix.special_Page" are // replaced (by PHP) with "prefix_special_Page", so check for that too $page = $this->Application->GetVar($event->getPrefixSpecial(true) . '_Page'); } - if (!$object->isMainList()) { + if ( !$object->isMainList() ) { // main lists doesn't use session for page storing $this->Application->StoreVarDefault($event->getPrefixSpecial() . '_Page', 1, true); // true for optional - if (!$page) { - if ($this->Application->RewriteURLs()) { + if ( !$page ) { + if ( $this->Application->RewriteURLs() ) { // when page not found by prefix+special, then try to search it without special at all $page = $this->Application->GetVar($event->Prefix . '_Page'); - if (!$page) { + if ( !$page ) { // page not found in request -> get from session $page = $this->Application->RecallVar($event->Prefix . '_Page'); } - if ($page) { + if ( $page ) { // page found in request -> store in session $this->Application->StoreVar($event->getPrefixSpecial() . '_Page', $page, true); //true for optional } @@ -1866,9 +1866,9 @@ // (such case is also processed in kDBList::Query method) $pages = $object->GetTotalPages(); - if ($page > $pages) { + if ( $page > $pages ) { $page = 1; - $this->Application->StoreVar($event->getPrefixSpecial().'_Page', 1, true); + $this->Application->StoreVar($event->getPrefixSpecial() . '_Page', 1, true); } } } @@ -2669,16 +2669,16 @@ } /** - * Set's correct sorting for list - * based on data provided with event + * Set's correct sorting for list based on data provided with event * * @param kEvent $event - * @access private - * @see OnListBuild + * @return void + * @access protected + * @see kDBEventHandler::OnListBuild() */ - function SetSorting(&$event) + protected function SetSorting(kEvent &$event) { - if (!$this->Application->isAdmin) { + if ( !$this->Application->isAdmin ) { $event->setEventParam('same_special', true); } @@ -2690,10 +2690,11 @@ * * @param kEvent $event * @return int + * @access protected */ - function getPerPage(&$event) + protected function getPerPage(kEvent &$event) { - if (!$this->Application->isAdmin) { + if ( !$this->Application->isAdmin ) { $event->setEventParam('same_special', true); } Index: branches/5.2.x/core/units/forms/form_submissions/form_submissions_eh.php =================================================================== diff -u -N -r14989 -r15045 --- branches/5.2.x/core/units/forms/form_submissions/form_submissions_eh.php (.../form_submissions_eh.php) (revision 14989) +++ branches/5.2.x/core/units/forms/form_submissions/form_submissions_eh.php (.../form_submissions_eh.php) (revision 15045) @@ -1,6 +1,6 @@ Application->GetVar($event->getPrefixSpecial(true) . '_PerPage'); $event->SetRedirectParam($event->getPrefixSpecial() . '_PerPage', $per_page); $event->SetRedirectParam('pass', 'all,' . $event->getPrefixSpecial()); - if (!$this->Application->isAdminUser) { + if ( !$this->Application->isAdminUser ) { $list_helper =& $this->Application->recallObject('ListHelper'); /* @var $list_helper ListHelper */ $this->_passListParams($event, 'per_page'); - - /*if ($per_page != $list_helper->getDefaultPerPage($event->Prefix)) { - $event->SetRedirectParam('per_page', $per_page); - }*/ } } /** * Occurs when page is changed (only for hooking) * * @param kEvent $event + * @return void + * @access protected */ - function OnSetPage(&$event) + protected function OnSetPage(kEvent &$event) { $page = $this->Application->GetVar($event->getPrefixSpecial(true) . '_Page'); $event->SetRedirectParam($event->getPrefixSpecial() . '_Page', $page); $event->SetRedirectParam('pass', 'all,' . $event->getPrefixSpecial()); - if (!$this->Application->isAdminUser) { - /*if ($page > 1) { - $event->SetRedirectParam('page', $page); - }*/ - + if ( !$this->Application->isAdminUser ) { $this->_passListParams($event, 'page'); } } @@ -825,8 +821,10 @@ * * @param kEvent $event * @param string $skip_var + * @return void + * @access protected */ - function _passListParams(&$event, $skip_var) + protected function _passListParams(&$event, $skip_var) { $param_names = array_diff(Array ('page', 'per_page', 'sort_by'), Array ($skip_var)); @@ -838,25 +836,25 @@ switch ($param_name) { case 'page': - if ($value > 1) { + if ( $value > 1 ) { $event->SetRedirectParam('page', $value); } break; case 'per_page': - if ($value > 0) { - if ($value != $list_helper->getDefaultPerPage($event->Prefix)) { + if ( $value > 0 ) { + if ( $value != $list_helper->getDefaultPerPage($event->Prefix) ) { $event->SetRedirectParam('per_page', $value); } } break; case 'sort_by': $event->setPseudoClass('_List'); - $object =& $event->getObject( Array ('main_list' => 1) ); + $object =& $event->getObject(Array ('main_list' => 1)); /* @var $object kDBList */ - if ($list_helper->hasUserSorting($object)) { + if ( $list_helper->hasUserSorting($object) ) { $event->SetRedirectParam('sort_by', $value); } break; @@ -865,40 +863,40 @@ } /** - * Set's correct page for list - * based on data provided with event + * Set's correct page for list based on data provided with event * * @param kEvent $event - * @access private - * @see OnListBuild + * @return void + * @access protected + * @see kDBEventHandler::OnListBuild() */ - function SetPagination(&$event) + protected function SetPagination(kEvent &$event) { $object =& $event->getObject(); /* @var $object kDBList */ // get PerPage (forced -> session -> config -> 10) - $object->SetPerPage( $this->getPerPage($event) ); + $object->SetPerPage($this->getPerPage($event)); // main lists on Front-End have special get parameter for page $page = $object->isMainList() ? $this->Application->GetVar('page') : false; - if (!$page) { + if ( !$page ) { // page is given in "env" variable for given prefix $page = $this->Application->GetVar($event->getPrefixSpecial() . '_Page'); } - if (!$page && $event->Special) { + if ( !$page && $event->Special ) { // when not part of env, then variables like "prefix.special_Page" are // replaced (by PHP) with "prefix_special_Page", so check for that too $page = $this->Application->GetVar($event->getPrefixSpecial(true) . '_Page'); } - if (!$object->isMainList()) { + if ( !$object->isMainList() ) { // main lists doesn't use session for page storing $this->Application->StoreVarDefault($event->getPrefixSpecial() . '_Page', 1, true); // true for optional - if ($page) { + if ( $page ) { // page found in request -> store in session $this->Application->StoreVar($event->getPrefixSpecial() . '_Page', $page, true); //true for optional } @@ -912,7 +910,7 @@ // (such case is also processed in kDBList::Query method) $pages = $object->GetTotalPages(); - if ($page > $pages) { + if ( $page > $pages ) { $page = 1; $this->Application->StoreVar($event->getPrefixSpecial() . '_Page', 1, true); } @@ -927,20 +925,21 @@ * * @param kEvent $event * @return int + * @access protected */ - function getPerPage(&$event) + protected function getPerPage(kEvent &$event) { $object =& $event->getObject(); /* @var $object kDBList */ $per_page = $event->getEventParam('per_page'); - if ($per_page) { + if ( $per_page ) { // per-page is passed as tag parameter to PrintList, InitList, etc. $config_mapping = $this->Application->getUnitOption($event->Prefix, 'ConfigMapping'); // 2. per-page setting is stored in configuration variable - if ($config_mapping) { + if ( $config_mapping ) { // such pseudo per-pages are only defined in templates directly switch ($per_page) { case 'short_list': @@ -956,27 +955,27 @@ return $per_page; } - if (!$per_page && $object->isMainList()) { + if ( !$per_page && $object->isMainList() ) { // main lists on Front-End have special get parameter for per-page $per_page = $this->Application->GetVar('per_page'); } - if (!$per_page) { + if ( !$per_page ) { // per-page is given in "env" variable for given prefix $per_page = $this->Application->GetVar($event->getPrefixSpecial() . '_PerPage'); } - if (!$per_page && $event->Special) { + if ( !$per_page && $event->Special ) { // when not part of env, then variables like "prefix.special_PerPage" are // replaced (by PHP) with "prefix_special_PerPage", so check for that too $per_page = $this->Application->GetVar($event->getPrefixSpecial(true) . '_PerPage'); } - if (!$object->isMainList()) { + if ( !$object->isMainList() ) { // per-page given in env and not in main list $view_name = $this->Application->RecallVar($event->getPrefixSpecial() . '_current_view'); - if ($per_page) { + if ( $per_page ) { // per-page found in request -> store in session and persistent session $this->setListSetting($event, 'PerPage', $per_page); } @@ -986,15 +985,15 @@ } } - if (!$per_page) { + if ( !$per_page ) { // per page wan't found in request/session/persistent session $list_helper =& $this->Application->recallObject('ListHelper'); /* @var $list_helper ListHelper */ // allow to override default per-page value from tag $default_per_page = $event->getEventParam('default_per_page'); - if (!is_numeric($default_per_page)) { + if ( !is_numeric($default_per_page) ) { $default_per_page = 10; } @@ -1005,14 +1004,14 @@ } /** - * Set's correct sorting for list - * based on data provided with event + * Set's correct sorting for list based on data provided with event * * @param kEvent $event - * @access private - * @see OnListBuild + * @return void + * @access protected + * @see kDBEventHandler::OnListBuild() */ - function SetSorting(&$event) + protected function SetSorting(kEvent &$event) { $event->setPseudoClass('_List'); @@ -1038,8 +1037,8 @@ $tag_sort_by = $event->getEventParam('sort_by'); - if ($tag_sort_by) { - if ($tag_sort_by == 'random') { + if ( $tag_sort_by ) { + if ( $tag_sort_by == 'random' ) { $object->AddOrderField('RAND()', ''); } else { @@ -1057,7 +1056,7 @@ $sorting_prefix = array_key_exists($event->Special, $list_sortings) ? $event->Special : ''; $sorting_configs = $this->Application->getUnitOption($event->Prefix, 'ConfigMapping'); - if ($sorting_configs && array_key_exists('DefaultSorting1Field', $sorting_configs)) { + if ( $sorting_configs && array_key_exists('DefaultSorting1Field', $sorting_configs) ) { // sorting defined in configuration variables overrides one from unit config $list_sortings[$sorting_prefix]['Sorting'] = Array ( $this->Application->ConfigValue($sorting_configs['DefaultSorting1Field']) => $this->Application->ConfigValue($sorting_configs['DefaultSorting1Dir']), @@ -1112,15 +1111,15 @@ * @return string|Array * @access protected */ - protected function getListSetting(&$event, $variable_name) + protected function getListSetting(kEvent &$event, $variable_name) { $view_name = $this->Application->RecallVar($event->getPrefixSpecial() . '_current_view'); $storage_prefix = $event->getEventParam('same_special') ? $event->Prefix : $event->getPrefixSpecial(); // get sorting from persistent session $variable_value = $this->Application->RecallPersistentVar($storage_prefix . '_' . $variable_name . '.' . $view_name, ALLOW_DEFAULT_SETTINGS); - /*if (!$variable_value) { + /*if ( !$variable_value ) { // get sorting from session $variable_value = $this->Application->RecallVar($storage_prefix . '_' . $variable_name); }*/ @@ -1141,7 +1140,7 @@ * @return void * @access protected */ - protected function setListSetting(&$event, $variable_name, $variable_value = null) + protected function setListSetting(kEvent &$event, $variable_name, $variable_value = null) { $view_name = $this->Application->RecallVar($event->getPrefixSpecial() . '_current_view'); // $this->Application->StoreVar($event->getPrefixSpecial() . '_' . $variable_name, $variable_value, true); //true for optional @@ -1162,8 +1161,10 @@ * Add filters found in session * * @param kEvent $event + * @return void + * @access protected */ - function AddFilters(&$event) + protected function AddFilters(kEvent &$event) { $object =& $event->getObject(); /* @var $object kDBList */ @@ -1218,7 +1219,7 @@ $group_key = 0; $group_count = count($filter_menu['Groups']); - while ( $group_key < $group_count ) { + while ($group_key < $group_count) { $group_info = $filter_menu['Groups'][$group_key]; $temp_filter->setType(constant('kDBList::FLT_TYPE_' . $group_info['mode']));