Index: branches/unlabeled/unlabeled-1.20.2/core/units/general/helpers/permissions_helper.php =================================================================== diff -u -r6705 -r6842 --- branches/unlabeled/unlabeled-1.20.2/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6705) +++ branches/unlabeled/unlabeled-1.20.2/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6842) @@ -337,7 +337,7 @@ */ function CheckPermission($name, $type = 1, $cat_id = null) { - $user_id = $this->Application->GetVar('u_id'); + $user_id = $this->Application->RecallVar('user_id'); return $this->CheckUserPermission($user_id, $name, $type, $cat_id); } @@ -379,7 +379,7 @@ WHERE (PermId = '.$perm_id.') AND (CategoryId = '.$cat_id.')'; $view_filters = Array(); - if ($user_id == $this->Application->GetVar('u_id')) { + if ($user_id == $this->Application->RecallVar('user_id')) { $groups = explode(',', $this->Application->RecallVar('UserGroups')); } else { // checking not current user @@ -450,7 +450,7 @@ return 2; } - if ($owner_id == $this->Application->GetVar('u_id')) { + if ($owner_id == $this->Application->RecallVar('user_id')) { // user is item's OWNER -> check this permissions first $live_modify = $this->CheckPermission($perm_prefix.'.OWNER.MODIFY', ptCATEGORY, $category_id); if ($live_modify) { Index: branches/unlabeled/unlabeled-1.166.4/core/kernel/application.php =================================================================== diff -u -r6687 -r6842 --- branches/unlabeled/unlabeled-1.166.4/core/kernel/application.php (.../application.php) (revision 6687) +++ branches/unlabeled/unlabeled-1.166.4/core/kernel/application.php (.../application.php) (revision 6842) @@ -1535,8 +1535,8 @@ /** * Checks if user is logged in, and creates * user object if so. User object can be recalled - * later using "u" prefix. Also you may - * get user id by getting "u_id" variable. + * later using "u.current" prefix_special. Also you may + * get user id by getting "u.current_id" variable. * * @access private */ @@ -1545,11 +1545,18 @@ $session =& $this->recallObject('Session'); $user_id = $session->GetField('PortalUserId'); if (!$user_id && $user_id != -1) $user_id = -2; + $this->SetVar('u.current_id', $user_id); + + if (!$this->IsAdmin()) { + // needed for "profile edit", "registration" forms ON FRONT ONLY $this->SetVar('u_id', $user_id); + } + $this->StoreVar('user_id', $user_id); if ($this->GetVar('expired') == 1) { - $user =& $this->recallObject('u'); + // this parameter is set only from admin + $user =& $this->recallObject('u.current'); $user->SetError('ValidateLogin', 'session_expired', 'la_text_sess_expired'); } @@ -2088,8 +2095,6 @@ function LoggedIn() { $user_id = $this->Application->RecallVar('user_id'); -// $user =& $this->recallObject('u'); -// $user_id = $user->GetID(); $ret = $user_id > 0; if ($this->IsAdmin() && ($user_id == -1)) { Index: branches/unlabeled/unlabeled-1.21.2/admin/include/mainscript.php =================================================================== diff -u -r4927 -r6842 --- branches/unlabeled/unlabeled-1.21.2/admin/include/mainscript.php (.../mainscript.php) (revision 4927) +++ branches/unlabeled/unlabeled-1.21.2/admin/include/mainscript.php (.../mainscript.php) (revision 6842) @@ -453,8 +453,8 @@ frm.name = "fake_form"; frm.id = "fake_form"; frm.method = "post"; - - theBody[0].insertBefore(frm, theBody[0].nextSibling); +// theBody[0].insertBefore(frm, theBody[0].nextSibling); + theBody[0].appendChild(frm); addField(frm, 'hidden', 'submit_done', 1); addField(frm, 'hidden', 'destform', ''); return document.getElementById('fake_form'); Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/login.tpl =================================================================== diff -u -r6734 -r6842 --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/login.tpl (.../login.tpl) (revision 6734) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/login.tpl (.../login.tpl) (revision 6842) @@ -42,8 +42,8 @@ - -

+ +

Index: branches/unlabeled/unlabeled-1.10.2/core/units/categories/categories_item.php =================================================================== diff -u -r6094 -r6842 --- branches/unlabeled/unlabeled-1.10.2/core/units/categories/categories_item.php (.../categories_item.php) (revision 6094) +++ branches/unlabeled/unlabeled-1.10.2/core/units/categories/categories_item.php (.../categories_item.php) (revision 6842) @@ -7,7 +7,7 @@ if (!$this->Validate()) return false; $this->SetDBField('ResourceId', $this->Application->NextResourceId()); - $this->SetDBField('CreatedById', $this->Application->GetVar('u_id') ); + $this->SetDBField('CreatedById', $this->Application->RecallVar('user_id') ); $this->SetDBField('CreatedOn_date', adodb_mktime() ); $this->SetDBField('CreatedOn_time', adodb_mktime() ); Index: branches/unlabeled/unlabeled-1.39.8/core/kernel/event_manager.php =================================================================== diff -u -r6441 -r6842 --- branches/unlabeled/unlabeled-1.39.8/core/kernel/event_manager.php (.../event_manager.php) (revision 6441) +++ branches/unlabeled/unlabeled-1.39.8/core/kernel/event_manager.php (.../event_manager.php) (revision 6842) @@ -272,7 +272,7 @@ $event_handler =& $this->Application->recallObject($event->Prefix.'_EventHandler'); $event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix)); - if (($this->Application->GetVar('u_id') == -1) || $event_handler->CheckPermission($event)) { + if (($this->Application->RecallVar('user_id') == -1) || $event_handler->CheckPermission($event)) { $this->HandleEvent($event); } Index: branches/unlabeled/unlabeled-1.34.2/core/units/general/cat_dbitem.php =================================================================== diff -u -r6588 -r6842 --- branches/unlabeled/unlabeled-1.34.2/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 6588) +++ branches/unlabeled/unlabeled-1.34.2/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 6842) @@ -50,7 +50,7 @@ $this->SetDBField('Modified', adodb_mktime() ); if ($this->mode != 't' && !$this->Application->IsAdmin()) { - $this->SetDBField('CreatedById', $this->Application->GetVar('u_id')); + $this->SetDBField('CreatedById', $this->Application->RecallVar('user_id')); } if ($this->useFilenames) { @@ -77,7 +77,7 @@ { $this->VirtualFields['ResourceId'] = Array(); $this->SetDBField('Modified', adodb_mktime() ); - $this->SetDBField('ModifiedById', $this->Application->GetVar('u_id')); + $this->SetDBField('ModifiedById', $this->Application->RecallVar('user_id')); if ($this->useFilenames) { $this->checkFilename(); Index: branches/unlabeled/unlabeled-1.54.2/kernel/include/usersession.php =================================================================== diff -u -r6783 -r6842 --- branches/unlabeled/unlabeled-1.54.2/kernel/include/usersession.php (.../usersession.php) (revision 6783) +++ branches/unlabeled/unlabeled-1.54.2/kernel/include/usersession.php (.../usersession.php) (revision 6842) @@ -475,7 +475,7 @@ { $application =& kApplication::Instance(); $application->setVisitField('PortalUserId', $this->Get('PortalUserId') ); - $application->SetVar('u_id', $this->Get('PortalUserId')); + $application->SetVar('u.current_id', $this->Get('PortalUserId')); } // unset($this->CurrentUser); Index: branches/unlabeled/unlabeled-1.79.4/core/kernel/db/db_event_handler.php =================================================================== diff -u -r6757 -r6842 --- branches/unlabeled/unlabeled-1.79.4/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 6757) +++ branches/unlabeled/unlabeled-1.79.4/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 6842) @@ -611,8 +611,13 @@ $tag_sort_by = $event->getEventParam('sort_by'); if ($tag_sort_by) { + if ($tag_sort_by == 'random') { + $by = 'RAND()'; + $dir = ''; + } + else { list($by, $dir) = explode(',', $tag_sort_by); - if ($by == 'random') $by = 'RAND()'; + } $object->AddOrderField($by, $dir); } Index: branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php =================================================================== diff -u -r6794 -r6842 --- branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6794) +++ branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6842) @@ -41,7 +41,7 @@ } if (!$this->Application->IsAdmin()) { - $user_id = $this->Application->GetVar('u_id'); + $user_id = $this->Application->RecallVar('user_id'); $items_info = $this->Application->GetVar($event->getPrefixSpecial(true)); if ($event->Name == 'OnCreate' && $user_id == -2) { @@ -104,7 +104,8 @@ */ function OnLogin(&$event) { - $object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); + $prefix_special = $this->Application->IsAdmin() ? 'u.current' : 'u'; // "u" used on front not to change theme + $object =& $this->Application->recallObject($prefix_special, null, Array('skip_autoload' => true)); $password = $this->Application->GetVar('password'); if(!$password) @@ -136,7 +137,7 @@ $session =& $this->Application->recallObject('Session'); $session->SetField('PortalUserId', $user_id); // $session->SetField('GroupList', implode(',', $groups) ); - $this->Application->SetVar('u_id', $user_id); + $this->Application->SetVar('u.current_id', $user_id); $this->Application->StoreVar('user_id', $user_id); $this->processLoginRedirect($event, $password); @@ -167,7 +168,7 @@ $session =& $this->Application->recallObject('Session'); $session->SetField('PortalUserId', $user_id); $session->SetField('GroupList', implode(',', $groups) ); - $this->Application->SetVar('u_id', $user_id); + $this->Application->SetVar('u.current_id', $user_id); $this->Application->StoreVar('user_id', $user_id); $this->Application->setVisitField('PortalUserId', $user_id); @@ -290,9 +291,9 @@ $session =& $this->Application->recallObject('Session'); $session->SetField('PortalUserId', -2); - $this->Application->SetVar('u_id', -2); + $this->Application->SetVar('u.current_id', -2); $this->Application->StoreVar('user_id', -2); - $object =& $this->Application->recallObject('u'); + $object =& $this->Application->recallObject('u.current', null, Array('skip_autoload' => true)); $object->Load(-2); $this->Application->DestroySession(); @@ -355,7 +356,7 @@ function autoLoginUser(&$event) { $object =& $event->getObject(); - $this->Application->SetVar('u_id', $object->GetID() ); + $this->Application->SetVar('u.current_id', $object->GetID() ); if($object->GetDBField('Status') == STATUS_ACTIVE && !$this->Application->ConfigValue('User_Password_Auto')) { @@ -458,7 +459,7 @@ parent::OnCreate($event); - $this->Application->SetVar('u_id', $object->getID() ); + $this->Application->SetVar('u.current_id', $object->getID() ); // for affil:OnRegisterAffiliate after hook $this->setNextTemplate($event); @@ -552,14 +553,16 @@ $friend_email = $this->Application->GetVar('friend_email'); $friend_name = $this->Application->GetVar('friend_email'); + // used for error reporting only -> rewrite code + theme (by Alex) + $object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too + if (preg_match("/^[_a-zA-Z0-9-\.]+@[a-zA-Z0-9-\.]+\.[a-z]{2,4}$/", $friend_email)) { - $send_params = array(); $send_params['to_email']=$friend_email; $send_params['to_name']=$friend_name; - $user_id = $this->Application->GetVar('u_id'); + $user_id = $this->Application->RecallVar('user_id'); $email_event = &$this->Application->EmailEventUser('SITE.SUGGEST', $user_id, $send_params); if ($email_event->status == erSUCCESS){ @@ -569,21 +572,17 @@ else { // $event->redirect_params = array('opener' => 's', 'pass' => 'all'); // $event->redirect = $this->Application->GetVar('template_fail'); - $object =& $this->Application->recallObject('u'); + $object->ErrorMsgs['send_error'] = $this->Application->Phrase('lu_email_send_error'); $object->FieldErrors['Email']['pseudo'] = 'send_error'; $event->status = erFAIL; - } } else { - $object =& $this->Application->recallObject('u'); $object->ErrorMsgs['invalid_email'] = $this->Application->Phrase('lu_InvalidEmail'); $object->FieldErrors['Email']['pseudo'] = 'invalid_email'; $event->status = erFAIL; } - - } /** @@ -608,8 +607,8 @@ $event->redirect = false; } - function OnSubscribeQuery(&$event){ - + function OnSubscribeQuery(&$event) + { $user_email = $this->Application->GetVar('subscriber_email'); if ( preg_match("/^[_a-zA-Z0-9-\.]+@[a-zA-Z0-9-\.]+\.[a-z]{2,4}$/", $user_email) ){ @@ -619,29 +618,20 @@ if( $object->Load(array('Email'=>$user_email)) ){ $group_info = $this->GetGroupInfo($object->GetID()); - if($group_info){ - $event->redirect = $this->Application->GetVar('unsubscribe_template'); - } - else { - $event->redirect = $this->Application->GetVar('subscribe_template'); - } + $event->redirect = $this->Application->GetVar($group_info ? 'unsubscribe_template' : 'subscribe_template'); } else { $event->redirect = $this->Application->GetVar('subscribe_template'); $this->Application->StoreVar('SubscriberEmail', $user_email); } - } else { - - $object =& $this->Application->recallObject('u'); + // used for error reporting only -> rewrite code + theme (by Alex) + $object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too $object->ErrorMsgs['invalid_email'] = $this->Application->Phrase('lu_InvalidEmail'); $object->FieldErrors['SubscribeEmail']['pseudo'] = 'invalid_email'; $event->status = erFAIL; - } - - //subscribe_query_ok_template } @@ -736,10 +726,12 @@ } - function OnForgotPassword(&$event){ - + function OnForgotPassword(&$event) + { $user_object = &$this->Application->recallObject('u.forgot', null, Array('skip_autoload' => true)); - $user_current_object = &$this->Application->recallObject('u'); + + // used for error reporting only -> rewrite code + theme (by Alex) + $user_current_object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too $username = $this->Application->GetVar('username'); $email = $this->Application->GetVar('email'); @@ -843,12 +835,14 @@ } - function OnResetPasswordConfirmed(&$event){ - + function OnResetPasswordConfirmed(&$event) + { $passed_key = $this->Application->GetVar('user_key'); $user_object = &$this->Application->recallObject('u.forgot'); - $user_current_object = &$this->Application->recallObject('u'); + + // used for error reporting only -> rewrite code + theme (by Alex) + $user_current_object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true));// TODO: change theme too if (strlen(trim($passed_key)) == 0) { $event->redirect_params = array('opener' => 's', 'pass' => 'all'); Index: branches/unlabeled/unlabeled-1.8.2/kernel/units/reviews/reviews_event_handler.php =================================================================== diff -u -r6796 -r6842 --- branches/unlabeled/unlabeled-1.8.2/kernel/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 6796) +++ branches/unlabeled/unlabeled-1.8.2/kernel/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 6842) @@ -84,7 +84,7 @@ if($event->getEventParam('type') == 'current_user') { - $user_id = $this->Application->GetVar('u_id') ? $this->Application->GetVar('u_id') : -2; + $user_id = $this->getUserID(); $ip = $_SERVER['REMOTE_ADDR']; $object =& $event->getObject( Array('skip_autoload' => true) ); $product_info = $object->getLinkedInfo(); @@ -102,7 +102,7 @@ */ function OnAddReview(&$event) { - $user_id = ($this->Application->GetVar('u_id') == 0) ? -2 : $this->Application->GetVar('u_id'); + $user_id = $this->getUserID(); $event->redirect_params = Array('pass' => 'all,p'); $object =& $event->getObject( Array('skip_autoload' => true) ); @@ -183,6 +183,22 @@ $object->ErrorMsgs['too_frequent'] = $this->Application->Phrase('lu_ferror_review_duplicate'); } } + + /** + * Returns current user id for reviews, for logic ask Kostja T. + * + * @return int + */ + function getUserID() + { + $user_id = $this->Application->RecallVar('user_id'); + + if ($user_id == 0) { + $user_id = -2; + } + + return $user_id; + } } ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.13.10/kernel/units/visits/visits_tag_processor.php =================================================================== diff -u -r3724 -r6842 --- branches/unlabeled/unlabeled-1.13.10/kernel/units/visits/visits_tag_processor.php (.../visits_tag_processor.php) (revision 3724) +++ branches/unlabeled/unlabeled-1.13.10/kernel/units/visits/visits_tag_processor.php (.../visits_tag_processor.php) (revision 6842) @@ -41,7 +41,7 @@ $affil_table = $this->Application->getUnitOption('affil', 'TableName'); $affil_idfield = $this->Application->getUnitOption('affil', 'IDField'); - $sql = 'SELECT '.$affil_idfield.' FROM '.$affil_table.' WHERE PortalUserId = '.$this->Application->GetVar('u_id'); + $sql = 'SELECT '.$affil_idfield.' FROM '.$affil_table.' WHERE PortalUserId = '.$this->Application->RecallVar('user_id'); $affiliate_id = $this->Conn->GetOne($sql); $sql = 'SELECT COUNT(ord.OrderId) AS OrderCount Index: branches/unlabeled/unlabeled-1.8.2/core/units/reviews/reviews_event_handler.php =================================================================== diff -u -r6796 -r6842 --- branches/unlabeled/unlabeled-1.8.2/core/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 6796) +++ branches/unlabeled/unlabeled-1.8.2/core/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 6842) @@ -84,7 +84,7 @@ if($event->getEventParam('type') == 'current_user') { - $user_id = $this->Application->GetVar('u_id') ? $this->Application->GetVar('u_id') : -2; + $user_id = $this->getUserID(); $ip = $_SERVER['REMOTE_ADDR']; $object =& $event->getObject( Array('skip_autoload' => true) ); $product_info = $object->getLinkedInfo(); @@ -102,7 +102,7 @@ */ function OnAddReview(&$event) { - $user_id = ($this->Application->GetVar('u_id') == 0) ? -2 : $this->Application->GetVar('u_id'); + $user_id = $this->getUserID(); $event->redirect_params = Array('pass' => 'all,p'); $object =& $event->getObject( Array('skip_autoload' => true) ); @@ -183,6 +183,22 @@ $object->ErrorMsgs['too_frequent'] = $this->Application->Phrase('lu_ferror_review_duplicate'); } } + + /** + * Returns current user id for reviews, for logic ask Kostja T. + * + * @return int + */ + function getUserID() + { + $user_id = $this->Application->RecallVar('user_id'); + + if ($user_id == 0) { + $user_id = -2; + } + + return $user_id; + } } ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.13.10/core/units/visits/visits_tag_processor.php =================================================================== diff -u -r3724 -r6842 --- branches/unlabeled/unlabeled-1.13.10/core/units/visits/visits_tag_processor.php (.../visits_tag_processor.php) (revision 3724) +++ branches/unlabeled/unlabeled-1.13.10/core/units/visits/visits_tag_processor.php (.../visits_tag_processor.php) (revision 6842) @@ -41,7 +41,7 @@ $affil_table = $this->Application->getUnitOption('affil', 'TableName'); $affil_idfield = $this->Application->getUnitOption('affil', 'IDField'); - $sql = 'SELECT '.$affil_idfield.' FROM '.$affil_table.' WHERE PortalUserId = '.$this->Application->GetVar('u_id'); + $sql = 'SELECT '.$affil_idfield.' FROM '.$affil_table.' WHERE PortalUserId = '.$this->Application->RecallVar('user_id'); $affiliate_id = $this->Conn->GetOne($sql); $sql = 'SELECT COUNT(ord.OrderId) AS OrderCount Index: branches/unlabeled/unlabeled-1.14.2/core/units/users/users_tag_processor.php =================================================================== diff -u -r6102 -r6842 --- branches/unlabeled/unlabeled-1.14.2/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 6102) +++ branches/unlabeled/unlabeled-1.14.2/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 6842) @@ -72,16 +72,19 @@ return $id_part_1.$id_part_2.$id_part_3; } - function ForgottenPassword($params){ + function ForgottenPassword($params) + { return $this->Application->GetVar('ForgottenPassword'); } - function TestCodeIsValid($param){ - + function TestCodeIsValid($params) + { $passed_key = $this->Application->GetVar('user_key'); $user_object = &$this->Application->recallObject('u.forgot'); - $user_current_object = &$this->Application->recallObject('u'); + + // used for error reporting only -> rewrite code + theme (by Alex) + $user_current_object = &$this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too if (strlen(trim($passed_key)) == 0) { @@ -91,8 +94,7 @@ } - if($user_object->Load(array('PwResetConfirm'=>$passed_key))) - { + if ($user_object->Load(array('PwResetConfirm'=>$passed_key))) { $exp_time = $user_object->GetDBField('PwRequestTime') + 3600; if ($exp_time > adodb_mktime()) { @@ -104,11 +106,11 @@ return false; } - } else { + } + else { $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid'); $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid'; return false; - } return true; Index: branches/unlabeled/unlabeled-1.17.2/kernel/units/visits/visits_event_handler.php =================================================================== diff -u -r6630 -r6842 --- branches/unlabeled/unlabeled-1.17.2/kernel/units/visits/visits_event_handler.php (.../visits_event_handler.php) (revision 6630) +++ branches/unlabeled/unlabeled-1.17.2/kernel/units/visits/visits_event_handler.php (.../visits_event_handler.php) (revision 6842) @@ -43,7 +43,7 @@ if($types == 'myvisitors') { - $user_id = $this->Application->GetVar('u_id'); + $user_id = $this->Application->RecallVar('user_id'); $object->addFilter('myitems_user1','au.PortalUserId = '.$user_id); $object->addFilter('myitems_user2','au.PortalUserId >0'); //$object->AddGroupByField('VisitDate'); @@ -53,7 +53,7 @@ if($types == 'myvisitororders' && $event->Special == 'incommerce') { - $user_id = $this->Application->GetVar('u_id'); + $user_id = $this->Application->RecallVar('user_id'); $object->addFilter('myitems_orders','ord.OrderId IS NOT NULL'); $object->addFilter('myitems_user1','au.PortalUserId = '.$user_id); $object->addFilter('myitems_user2','au.PortalUserId >0'); Index: branches/unlabeled/unlabeled-1.17.2/core/units/visits/visits_event_handler.php =================================================================== diff -u -r6630 -r6842 --- branches/unlabeled/unlabeled-1.17.2/core/units/visits/visits_event_handler.php (.../visits_event_handler.php) (revision 6630) +++ branches/unlabeled/unlabeled-1.17.2/core/units/visits/visits_event_handler.php (.../visits_event_handler.php) (revision 6842) @@ -43,7 +43,7 @@ if($types == 'myvisitors') { - $user_id = $this->Application->GetVar('u_id'); + $user_id = $this->Application->RecallVar('user_id'); $object->addFilter('myitems_user1','au.PortalUserId = '.$user_id); $object->addFilter('myitems_user2','au.PortalUserId >0'); //$object->AddGroupByField('VisitDate'); @@ -53,7 +53,7 @@ if($types == 'myvisitororders' && $event->Special == 'incommerce') { - $user_id = $this->Application->GetVar('u_id'); + $user_id = $this->Application->RecallVar('user_id'); $object->addFilter('myitems_orders','ord.OrderId IS NOT NULL'); $object->addFilter('myitems_user1','au.PortalUserId = '.$user_id); $object->addFilter('myitems_user2','au.PortalUserId >0'); Index: branches/unlabeled/unlabeled-1.5.2/kernel/units/reviews/reviews_tag_processor.php =================================================================== diff -u -r6134 -r6842 --- branches/unlabeled/unlabeled-1.5.2/kernel/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 6134) +++ branches/unlabeled/unlabeled-1.5.2/kernel/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 6842) @@ -52,7 +52,7 @@ function AlreadyReviewed($params) { - $user_id = ($this->Application->GetVar('u_id') == 0) ? -2 : $this->Application->GetVar('u_id'); + $user_id = $this->getUserID(); $object =& $this->getObject( Array('skip_autoload' => true) ); $product_info = $object->getLinkedInfo(); @@ -89,6 +89,22 @@ return 0; } } + + /** + * Returns current user id for reviews, for logic ask Kostja T. + * + * @return int + */ + function getUserID() + { + $user_id = $this->Application->RecallVar('user_id'); + + if ($user_id == 0) { + $user_id = -2; + } + + return $user_id; + } } Index: branches/unlabeled/unlabeled-1.25.2/core/units/categories/categories_event_handler.php =================================================================== diff -u -r6649 -r6842 --- branches/unlabeled/unlabeled-1.25.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 6649) +++ branches/unlabeled/unlabeled-1.25.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 6842) @@ -114,7 +114,7 @@ } $object->addFilter('perm_filter', 'PermId = 1'); // check for CATEGORY.VIEW permission - if ($this->Application->GetVar('u_id') != -1) { + if ($this->Application->RecallVar('user_id') != -1) { // apply permission filters to all users except "root" $groups = explode(',',$this->Application->RecallVar('UserGroups')); foreach ($groups as $group) { Index: branches/unlabeled/unlabeled-1.68.2/core/units/general/cat_event_handler.php =================================================================== diff -u -r6794 -r6842 --- branches/unlabeled/unlabeled-1.68.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6794) +++ branches/unlabeled/unlabeled-1.68.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6842) @@ -319,7 +319,7 @@ } // add permission filter - if ($this->Application->GetVar('u_id') == -1) { + if ($this->Application->RecallVar('user_id') == -1) { // for "root" CATEGORY.VIEW permission is checked for items lists too $view_perm = 1; } @@ -418,7 +418,7 @@ { case 'favorites': $fav_table = $this->Application->getUnitOption('fav','TableName'); - $user_id =& $this->Application->GetVar('u_id'); + $user_id =& $this->Application->RecallVar('user_id'); $sql = 'SELECT DISTINCT f.ResourceId FROM '.$fav_table.' f @@ -731,8 +731,7 @@ { unset($field_list[$key]); continue; // ignoring having type clauses in simple search - /*$user_object =& $this->Application->recallObject('u'); - $user_groups = $this->Application->RecallVar('UserGroups'); + /*$user_groups = $this->Application->RecallVar('UserGroups'); $having_list[$key] = str_replace('{PREFIX}', TABLE_PREFIX, $exploded[1]); $join_clause = str_replace('{PREFIX}', TABLE_PREFIX, $search_config[$field]['JoinClause']); $join_clause = str_replace('{USER_GROUPS}', $user_groups, $join_clause); @@ -901,7 +900,6 @@ $lang = $this->Application->GetVar('m_lang'); $object =& $event->getObject(); $object->SetPage(1); - $user_object =& $this->Application->recallObject('u'); $product_table = $this->Application->getUnitOption('p', 'TableName'); $search_keywords = $this->Application->GetVar('value'); // will not be changed @@ -1628,7 +1626,7 @@ if ($event->status == erSUCCESS) { $object =& $event->getObject(); - $object->SetDBField('CreatedById', $this->Application->GetVar('u_id')); + $object->SetDBField('CreatedById', $this->Application->RecallVar('user_id')); } } Index: branches/unlabeled/unlabeled-1.5.2/core/units/reviews/reviews_tag_processor.php =================================================================== diff -u -r6134 -r6842 --- branches/unlabeled/unlabeled-1.5.2/core/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 6134) +++ branches/unlabeled/unlabeled-1.5.2/core/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 6842) @@ -52,7 +52,7 @@ function AlreadyReviewed($params) { - $user_id = ($this->Application->GetVar('u_id') == 0) ? -2 : $this->Application->GetVar('u_id'); + $user_id = $this->getUserID(); $object =& $this->getObject( Array('skip_autoload' => true) ); $product_info = $object->getLinkedInfo(); @@ -89,6 +89,22 @@ return 0; } } + + /** + * Returns current user id for reviews, for logic ask Kostja T. + * + * @return int + */ + function getUserID() + { + $user_id = $this->Application->RecallVar('user_id'); + + if ($user_id == 0) { + $user_id = -2; + } + + return $user_id; + } }