Index: in-news/units/articles/articles_event_handler.php =================================================================== --- in-news/units/articles/articles_event_handler.php (revision 13557) +++ in-news/units/articles/articles_event_handler.php (working copy) @@ -300,7 +300,7 @@ $object->SetDBField('EndOn_time', $expiration_time); $object->SetDBField('Status', STATUS_ACTIVE); $object->SetDBField('Author', 'root'); - $object->SetDBField('CreatedById', -1); + $object->SetDBField('CreatedById', USER_ROOT); $status = $object->isLoaded() ? $object->Update() : $object->Create(); } while (($current_node =& $current_node->NextSibling())); @@ -392,7 +392,7 @@ $object->SetDBField('EndOn_time', $expiration_time); $object->SetDBField('Status', STATUS_ACTIVE); $object->SetDBField('Author', 'root'); - $object->SetDBField('CreatedById', -1); + $object->SetDBField('CreatedById', USER_ROOT); $status = $object->isLoaded() ? $object->Update() : $object->Create(); } while (($current_node =& $current_node->NextSibling())); Index: in-news/units/articles/articles_config.php =================================================================== --- in-news/units/articles/articles_config.php (revision 13557) +++ in-news/units/articles/articles_config.php (working copy) @@ -346,7 +346,7 @@ 'CalculatedFields' => Array ( '' => Array ( - 'UserName' => 'IF (ISNULL(u.Login), IF (%1$s.CreatedById = -1, "root", IF (%1$s.CreatedById = -2, "Guest", "n/a")), u.Login)', + 'UserName' => 'IF (ISNULL(u.Login), IF (%1$s.CreatedById = ' . USER_ROOT . ', "root", IF (%1$s.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), u.Login)', 'CategoryId' => TABLE_PREFIX.'%3$sCategoryItems.CategoryId', 'Filename' => TABLE_PREFIX.'%3$sCategoryItems.Filename', 'CategoryFilename' => TABLE_PREFIX.'Category.NamedParentPath', @@ -410,7 +410,7 @@ 'Hits' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%d', 'not_null' => 1, 'default' => 0), 'CachedRating' => Array ('type' => 'string', 'default' => 0), 'CachedVotesQty' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), - 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (-1 => 'root', -2 => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1, 'required' => 1, 'default' => -1), + 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1, 'required' => 1, 'default' => USER_ROOT), 'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'Status' => Array ( 'type' => 'int', @@ -444,7 +444,7 @@ 'HotItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2), 'Archived' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 2 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0), 'Modified' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'), - 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (-1 => 'root', -2 => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1, 'default' => -1), + 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1, 'default' => USER_ROOT), 'OrgId' => Array ('type' => 'int', 'default' => null), 'MetaKeywords' => Array ('type' => 'string', 'default' => null), 'MetaDescription' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null), Index: in-news/install.php =================================================================== --- in-news/install.php (revision 13557) +++ in-news/install.php (working copy) @@ -34,7 +34,7 @@ $application =& kApplication::Instance(); $application->Init(); - if ($application->RecallVar('user_id') != -1) { + if ($application->RecallVar('user_id') != USER_ROOT) { die('restricted access!'); } Index: in-link/units/listings/listings_config.php =================================================================== --- in-link/units/listings/listings_config.php (revision 13557) +++ in-link/units/listings/listings_config.php (working copy) @@ -106,7 +106,7 @@ 'CalculatedFields' => Array ( '' => Array ( 'LinkName' => 'CONCAT(item_table.Name, " (", item_table.Url, ")")', - 'LinkOwner' => 'IF (ISNULL(u.Login), IF (item_table.CreatedById = -1, "root", IF (item_table.CreatedById = -2, "Guest", "n/a")), u.Login)', + 'LinkOwner' => 'IF (ISNULL(u.Login), IF (item_table.CreatedById = ' . USER_ROOT . ', "root", IF (item_table.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), u.Login)', ), ), 'Fields' => Array ( @@ -114,21 +114,21 @@ 'ListingTypeId' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', - 'options_sql' => 'SELECT %s - FROM '.TABLE_PREFIX.'ListingTypes + 'options_sql' => 'SELECT %s + FROM '.TABLE_PREFIX.'ListingTypes ORDER BY Name', 'option_key_field' => 'ListingTypeId', 'option_title_field' => 'Name', 'default' => 0, ), 'ItemResourceId' => Array ( 'type' => 'int', - 'required' => 1, 'unique' => Array ('ItemResourceId'), 'default' => null, + 'required' => 1, 'unique' => Array ('ItemResourceId'), 'default' => null, 'error_field' => 'LinkName', ), 'PurchasedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'), 'ExpiresOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#', 'required' =>1), 'Status' => Array ( - 'type' => 'int', + 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2, Index: in-link/units/links/links_config.php =================================================================== --- in-link/units/links/links_config.php (revision 13557) +++ in-link/units/links/links_config.php (working copy) @@ -410,7 +410,7 @@ 'CalculatedFields' => Array ( '' => Array ( - 'UserName' => 'IF (ISNULL(u.Login), IF (%1$s.CreatedById = -1, "root", IF (%1$s.CreatedById = -2, "Guest", "n/a")), u.Login)', + 'UserName' => 'IF (ISNULL(u.Login), IF (%1$s.CreatedById = ' . USER_ROOT . ', "root", IF (%1$s.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), u.Login)', 'CategoryId' => TABLE_PREFIX.'%3$sCategoryItems.CategoryId', 'Filename' => TABLE_PREFIX.'%3$sCategoryItems.Filename', 'CategoryFilename' => TABLE_PREFIX.'Category.NamedParentPath', @@ -478,8 +478,8 @@ 'CachedRating' => Array ('type' => 'string', 'not_null' => 1, 'formatter' => 'kFormatter', 'default' => 0), 'CachedVotesQty' => Array ('type' => 'int', 'formatter' => 'kFormatter', 'not_null' => 1, 'default' => 0), 'CachedReviewsQty' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), - 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (-1 => 'root', -2 => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1, 'default' => -1), - 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (-1 => 'root', -2 => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1, 'default' => -1), + 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1, 'default' => USER_ROOT), + 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1, 'default' => USER_ROOT), 'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'Status' => Array ( 'type' => 'int', Index: in-link/install.php =================================================================== --- in-link/install.php (revision 13557) +++ in-link/install.php (working copy) @@ -34,7 +34,7 @@ $application =& kApplication::Instance(); $application->Init(); - if ($application->RecallVar('user_id') != -1) { + if ($application->RecallVar('user_id') != USER_ROOT) { die('restricted access!'); } Index: in-commerce/units/products/products_event_handler.php =================================================================== --- in-commerce/units/products/products_event_handler.php (revision 13557) +++ in-commerce/units/products/products_event_handler.php (working copy) @@ -555,7 +555,7 @@ $event->redirect = $this->Application->GetVar('success_template'); $object =& $event->getObject(); - $user_id = ($this->Application->RecallVar('user_id') == 0) ? -2 : $this->Application->RecallVar('user_id'); + $user_id = $this->Application->RecallVar('user_id'); $sql = ' SELECT * FROM '.TABLE_PREFIX.'SpamControl WHERE ItemResourceId='.$object->GetDBField('ResourceId').' Index: in-commerce/units/orders/orders_tag_processor.php =================================================================== --- in-commerce/units/orders/orders_tag_processor.php (revision 13557) +++ in-commerce/units/orders/orders_tag_processor.php (working copy) @@ -841,7 +841,7 @@ function UserFound($params) { - $virtual_users = Array(-1,-2, 0); + $virtual_users = Array(USER_ROOT, USER_GUEST, 0); $object =& $this->getObject($params); return !in_array( $object->GetDBField( $params['user_field'] ) , $virtual_users ); } Index: in-commerce/units/orders/orders_event_handler.php =================================================================== --- in-commerce/units/orders/orders_event_handler.php (revision 13558) +++ in-commerce/units/orders/orders_event_handler.php (working copy) @@ -1099,7 +1099,7 @@ // get user $user_id = $this->Application->RecallVar('user_id'); if (!$user_id) { - $user_id = -2; // Guest + $user_id = USER_GUEST; } $object->SetDBField('PortalUserId', $user_id); @@ -1243,7 +1243,10 @@ $ses_user = $this->Application->RecallVar('user_id'); if ($order->GetDBField('PortalUserId') != $ses_user) { - if ($ses_user == 0) $ses_user = -2; //Guest + if ($ses_user == 0) { + $ses_user = USER_GUEST; + } + $order->SetDBField('PortalUserId', $ses_user); // since CheckUser is called in OnBeforeItemUpdate, we don't need to call udpate here, just set the field } Index: in-commerce/units/orders/orders_config.php =================================================================== --- in-commerce/units/orders/orders_config.php (revision 13557) +++ in-commerce/units/orders/orders_config.php (working copy) @@ -246,7 +246,7 @@ 'CalculatedFields' => Array ( '' => Array ( - 'CustomerName' => 'IF( ISNULL(u.Login), IF (%1$s.PortalUserId = -1, \'root\', IF (%1$s.PortalUserId = -2, \'Guest\', \'n/a\')), CONCAT(u.FirstName,\' \',u.LastName) )', + 'CustomerName' => 'IF( ISNULL(u.Login), IF (%1$s.PortalUserId = ' . USER_ROOT . ', \'root\', IF (%1$s.PortalUserId = ' . USER_GUEST . ', \'Guest\', \'n/a\')), CONCAT(u.FirstName,\' \',u.LastName) )', 'Username' => 'IF( ISNULL(u.Login),\'root\',u.Login)', 'OrderNumber' => 'CONCAT(LPAD(Number,6,"0"),\'-\',LPAD(SubNumber,3,"0") )', 'SubtotalWithoutDiscount' => '(SubTotal + DiscountTotal)', @@ -314,7 +314,7 @@ 'not_null' => 1, 'default' => 0, ), 'OrderDate' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#'), - 'PortalUserId' =>Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' =>Array (-1=> 'root',-2=> 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'required' =>1, 'not_null' =>1, 'default' =>-1), + 'PortalUserId' =>Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' =>Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'required' =>1, 'not_null' =>1, 'default' =>-1), 'OrderIP' => Array ('type' => 'string', 'not_null' => 1, 'default' => '', 'filter_type' => 'like'), 'UserComment' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL), 'AdminComment' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL), @@ -355,14 +355,14 @@ 'PaymentType' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', - 'options_sql' => 'SELECT %s - FROM ' . TABLE_PREFIX . 'PaymentTypes - WHERE Status = 1 + 'options_sql' => 'SELECT %s + FROM ' . TABLE_PREFIX . 'PaymentTypes + WHERE Status = 1 ORDER BY Priority DESC, Name ASC', 'option_key_field' => 'PaymentTypeId', 'option_title_field' => 'Description', 'not_null' => 1, 'default' => 0 ), - + 'PaymentAccount' => Array ('type' => 'string', 'not_null' => 1, 'cardtype_field' => 'PaymentCardType', 'default' => '', 'filter_type' => 'like'), 'PaymentNameOnCard' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''), 'PaymentCCExpDate' => Array ('type' => 'string', 'formatter' => 'kCCDateFormatter', 'month_field' => 'PaymentCCExpMonth', 'year_field' => 'PaymentCCExpYear', 'not_null' => 1, 'default' => ''), @@ -377,7 +377,7 @@ 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'option_key_field' => 'DestAbbr', - 'option_title_field' => 'Translation', + 'option_title_field' => 'Translation', ), 'ShippingAddress1' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''), 'ShippingAddress2' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''), @@ -400,8 +400,8 @@ 'ShippingType' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', - 'options_sql' => 'SELECT %s - FROM ' . TABLE_PREFIX . 'ShippingType + 'options_sql' => 'SELECT %s + FROM ' . TABLE_PREFIX . 'ShippingType WHERE Status = 1', 'option_key_field' => 'ShippingID', 'option_title_field' => 'Name', @@ -491,8 +491,8 @@ 'LineEndings' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'Windows', 2 => 'UNIX'), 'default' => 1), 'LineEndingsInside' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'CRLF', 2 => 'LF'), 'default' => 2), 'IncludeFieldTitles' => Array ( - 'type' => 'int', - 'formatter' => 'kOptionsFormatter', + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1, ), @@ -500,8 +500,8 @@ 'AvailableColumns' => Array ('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array ()), 'ExportPresets' => Array ('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array ()), 'ExportSavePreset' => Array ( - 'type' => 'int', - 'formatter' => 'kOptionsFormatter', + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0, ), Index: in-commerce/units/gateways/gw_classes/authorizenet.php =================================================================== --- in-commerce/units/gateways/gw_classes/authorizenet.php (revision 13557) +++ in-commerce/units/gateways/gw_classes/authorizenet.php (working copy) @@ -82,7 +82,7 @@ { $gw_responce = unserialize( $item_data['GWResult1'] ); - if( ($item_data['PortalUserId'] != $gw_responce['customer_id']) && ($gw_repsponce['customer_id'] != -2 && !$this->Application->isAdmin)) return false; + if( ($item_data['PortalUserId'] != $gw_responce['customer_id']) && ($gw_repsponce['customer_id'] != USER_GUEST && !$this->Application->isAdmin)) return false; if( ( strtolower($gw_responce['transaction_type']) == 'auth_only') ) { Index: in-commerce/units/coupons/coupons_config.php =================================================================== --- in-commerce/units/coupons/coupons_config.php (revision 13557) +++ in-commerce/units/coupons/coupons_config.php (working copy) @@ -140,7 +140,7 @@ 'LastUsedBy' => Array ( 'type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), - 'options' => Array (-1 => 'root', -2 => 'Guest'), + 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'PortalUser WHERE `%s` = \'%s\'','left_key_field'=>'PortalUserId', 'left_title_field' => 'Login', 'required' => 0, 'default' => null, Index: in-commerce/units/affiliates/affiliates_config.php =================================================================== --- in-commerce/units/affiliates/affiliates_config.php (revision 13557) +++ in-commerce/units/affiliates/affiliates_config.php (working copy) @@ -165,7 +165,7 @@ 'Fields' => Array( 'AffiliateId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), - 'PortalUserId' => Array('type' => 'int', 'unique'=>Array('PortalUserId'), 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!', 'unique' => '!la_affiliate_already_exists!'), 'options' => Array(-1 => 'root', -2 => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'required' => 1, 'not_null' => 1, 'default' => 0, ), + 'PortalUserId' => Array('type' => 'int', 'unique'=>Array('PortalUserId'), 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!', 'unique' => '!la_affiliate_already_exists!'), 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'required' => 1, 'not_null' => 1, 'default' => 0, ), 'AffiliatePlanId' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options_sql'=>'SELECT Name, AffiliatePlanId FROM '.TABLE_PREFIX.'AffiliatePlans WHERE Enabled = 1 ORDER BY Name', 'option_key_field'=>'AffiliatePlanId', 'option_title_field'=>'Name', 'not_null' => 1, 'default' => 0), 'AccumulatedAmount' => Array('type' => 'double', 'formatter'=>'kFormatter', 'format'=>'%.02f', 'not_null' => '1','default' => '0.00'), 'AmountToPay' => Array('type' => 'double', 'formatter'=>'kFormatter', 'format'=>'%.02f', 'not_null' => '1','default' => '0.00'), Index: in-commerce/install.php =================================================================== --- in-commerce/install.php (revision 13557) +++ in-commerce/install.php (working copy) @@ -33,7 +33,7 @@ $application =& kApplication::Instance(); $application->Init(); - if ($application->RecallVar('user_id') != -1) { + if ($application->RecallVar('user_id') != USER_ROOT) { die('restricted access!'); } Index: in-bulletin/units/topics/topics_config.php =================================================================== --- in-bulletin/units/topics/topics_config.php (revision 13557) +++ in-bulletin/units/topics/topics_config.php (working copy) @@ -305,7 +305,7 @@ 'CalculatedFields' => Array ( '' => Array ( - 'UserName' => 'IF (ISNULL(u.Login), IF (%1$s.OwnerId = -1, "root", IF (%1$s.OwnerId = -2, "Guest", "n/a")), u.Login)', + 'UserName' => 'IF (ISNULL(u.Login), IF (%1$s.OwnerId = ' . USER_ROOT . ', "root", IF (%1$s.OwnerId = ' . USER_GUEST . ', "Guest", "n/a")), u.Login)', 'CategoryId' => TABLE_PREFIX.'%3$sCategoryItems.CategoryId', 'Filename' => TABLE_PREFIX.'%3$sCategoryItems.Filename', 'PrimaryCat' => TABLE_PREFIX.'%3$sCategoryItems.PrimaryCat', @@ -399,24 +399,24 @@ 'OwnerId' => Array ( 'type' => 'int', 'formatter' => 'kLEFTFormatter', - 'options' => Array (-1 => 'root', -2 => 'Guest'), + 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'PortalUser WHERE `%s` = \'%s\' ', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), - 'required' => 1, 'not_null' => 1, 'default' => -1, + 'required' => 1, 'not_null' => 1, 'default' => USER_ROOT, ), 'ModifiedById' => Array ( 'type' => 'int', 'formatter' => 'kLEFTFormatter', - 'options' => Array (-1 => 'root', -2 => 'Guest'), + 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'PortalUser WHERE `%s` = \'%s\' ', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), - 'required' => 1, 'not_null' => 1, 'default' => -1, + 'required' => 1, 'not_null' => 1, 'default' => USER_ROOT, ), 'ResourceId' => Array ('type' => 'int', 'default' => null), 'TopicType' => Array ( @@ -481,7 +481,7 @@ 'CachedNavbar' => Array ('type' => 'string', 'default' => ''), 'LastPoster' => Array ('type' => 'string', 'default' => ''), - 'LastPosterId' => Array ('type' => 'int', 'default' => -2), + 'LastPosterId' => Array ('type' => 'int', 'default' => USER_GUEST), 'PostingText' => Array ( 'type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, Index: in-bulletin/units/private_messages/private_messages_config.php =================================================================== --- in-bulletin/units/private_messages/private_messages_config.php (revision 13557) +++ in-bulletin/units/private_messages/private_messages_config.php (working copy) @@ -76,8 +76,8 @@ 'Body' => 'pmb.Body', 'Options' => 'pmb.Options', - 'FromName' => 'IF (ISNULL(from_user.Login), IF (%1$s.FromId = -1, "root", IF (%1$s.FromId = -2, "Guest", "n/a")), from_user.Login)', - 'ToName' => 'IF (ISNULL(to_user.Login), IF (%1$s.ToId = -1, "root", IF (%1$s.ToId = -2, "Guest", "n/a")), to_user.Login)', + 'FromName' => 'IF (ISNULL(from_user.Login), IF (%1$s.FromId = ' . USER_ROOT . ', "root", IF (%1$s.FromId = ' . USER_GUEST . ', "Guest", "n/a")), from_user.Login)', + 'ToName' => 'IF (ISNULL(to_user.Login), IF (%1$s.ToId = ' . USER_ROOT . ', "root", IF (%1$s.ToId = ' . USER_GUEST . ', "Guest", "n/a")), to_user.Login)', 'FromFullName' => 'TRIM(CONCAT(from_user.FirstName, " ", from_user.LastName))', 'ToFullName' => 'TRIM(CONCAT(to_user.FirstName, " ", to_user.LastName))', Index: in-bulletin/units/posts/posts_config.php =================================================================== --- in-bulletin/units/posts/posts_config.php (revision 13557) +++ in-bulletin/units/posts/posts_config.php (working copy) @@ -64,7 +64,7 @@ 'CalculatedFields' => Array ( '' => Array ( - 'UserName' => 'IF (ISNULL(u.Login), IF (%1$s.CreatedById = -1, "root", IF (%1$s.CreatedById = -2, "Guest", "n/a")), u.Login)', + 'UserName' => 'IF (ISNULL(u.Login), IF (%1$s.CreatedById = ' . USER_ROOT . ', "root", IF (%1$s.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), u.Login)', 'AltName' => 'img.AltName', 'SameImages' => 'img.SameImages', @@ -87,8 +87,8 @@ 'GraphicsUrl' => Array ('type' => 'string', 'max_len' => 255, 'default' => NULL), 'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'), 'Modified' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL), - 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(-1 => 'root', -2 => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'default' => NULL), - 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(-1 => 'root', -2 => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'default' => NULL), + 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'default' => NULL), + 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'default' => NULL), 'TopicId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'ResourceId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'ReplyTo' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), Index: in-bulletin/units/polls/polls_config.php =================================================================== --- in-bulletin/units/polls/polls_config.php (revision 13557) +++ in-bulletin/units/polls/polls_config.php (working copy) @@ -131,7 +131,7 @@ 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes',), 'use_phrases' => 1, 'default' => 1, 'not_null' => 1, - ), + ), 'AllowMultipleVotings' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', @@ -156,7 +156,7 @@ 'CalculatedFields' => Array ( '' => Array ( -// 'DaysLeft' => 'IF( ISNULL(%1$s.EndDate), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, %1$s.PosterAlias, \'n/a\')), \'Never\' )', +// 'DaysLeft' => 'IF( ISNULL(%1$s.EndDate), IF (%1$s.CreatedById = ' . USER_ROOT . ', \'root\', IF (%1$s.CreatedById = ' . USER_GUEST . ', %1$s.PosterAlias, \'n/a\')), \'Never\' )', ), ), Index: in-bulletin/units/polls/poll_eh.php =================================================================== --- in-bulletin/units/polls/poll_eh.php (revision 13557) +++ in-bulletin/units/polls/poll_eh.php (working copy) @@ -112,7 +112,7 @@ } if (!$voted) { - $user_id = $this->Application->LoggedIn()? $this->Application->RecallVar('user_id') : '-2'; + $user_id = $this->Application->RecallVar('user_id'); $fields_hash = Array ( 'PollId' => $object->GetID(), 'AnswerId' => $poll_answer_id, Index: in-bulletin/units/poll_comments/poll_comments_config.php =================================================================== --- in-bulletin/units/poll_comments/poll_comments_config.php (revision 13557) +++ in-bulletin/units/poll_comments/poll_comments_config.php (working copy) @@ -61,10 +61,10 @@ 'AnswerId' => Array ('type' => 'int', 'default' => NULL), 'CreatedById' => Array ('type' => 'int', 'formatter'=>'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), - 'options' => Array(-1 => 'root', -2 => 'Guest'), + 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', - 'required' => 1, 'not_null' => 1, 'default' => -2), + 'required' => 1, 'not_null' => 1, 'default' => USER_GUEST), 'GuestName' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''), 'GuestEmail' => Array('type' => 'string', 'max_len' => 255, 'formatter'=>'kFormatter', 'regexp'=>'/^(' . REGEX_EMAIL_USER . '@' . REGEX_EMAIL_DOMAIN . ')$/i', 'sample_value' => 'email@domain.com', 'not_null' => '1', 'default' => '', 'error_msgs' => Array('invalid_format'=>'!la_invalid_email!', 'unique'=>'!lu_email_already_exist!'),'required' => 0 ), 'CommentBody' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL, 'required' => 1), @@ -81,7 +81,7 @@ 'CalculatedFields' => Array ( '' => Array ( - 'CommentedByUser' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', + 'CommentedByUser' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = ' . USER_ROOT . ', \'root\', IF (%1$s.CreatedById = ' . USER_GUEST . ', \'Guest\', \'n/a\')), pu.Login )', ), ), Index: in-bulletin/units/poll_comments/poll_comment_eh.php =================================================================== --- in-bulletin/units/poll_comments/poll_comment_eh.php (revision 13557) +++ in-bulletin/units/poll_comments/poll_comment_eh.php (working copy) @@ -32,7 +32,7 @@ function OnAfterConfigRead(&$event) { - if ($this->Application->RecallVar('user_id') == '-2') { // Guest + if ($this->Application->RecallVar('user_id') == USER_GUEST) { // make Guest Name and Email required for guests $fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); $fields['GuestName']['required'] = 1; Index: in-bulletin/install.php =================================================================== --- in-bulletin/install.php (revision 13557) +++ in-bulletin/install.php (working copy) @@ -34,7 +34,7 @@ $application =& kApplication::Instance(); $application->Init(); - if ($application->RecallVar('user_id') != -1) { + if ($application->RecallVar('user_id') != USER_ROOT) { die('restricted access!'); } Index: in-auction/notify.php =================================================================== --- in-auction/notify.php (revision 13557) +++ in-auction/notify.php (working copy) @@ -24,7 +24,7 @@ $application =& kApplication::Instance(); $application->Init(); - $application->StoreVar('user_id', -1); // root + $application->StoreVar('user_id', USER_ROOT); $application->HandleEvent($event, 'l-ebay:OnStoreToLog'); Index: in-auction/new_token_reject.php =================================================================== --- in-auction/new_token_reject.php (revision 13557) +++ in-auction/new_token_reject.php (working copy) @@ -23,7 +23,7 @@ $application =& kApplication::Instance(); $application->Init(); - $application->StoreVar('user_id', -1); // root + $application->StoreVar('user_id', USER_ROOT); $application->HandleEvent($event, 'ebay-sections:OnNewTokenReject'); Index: in-auction/new_token_accept.php =================================================================== --- in-auction/new_token_accept.php (revision 13557) +++ in-auction/new_token_accept.php (working copy) @@ -23,7 +23,7 @@ $application =& kApplication::Instance(); $application->Init(); - $application->StoreVar('user_id', -1); // root + $application->StoreVar('user_id', USER_ROOT); if ($application->ConfigValue('eBay_UseFetchToken') == 1) Index: in-auction/install.php =================================================================== --- in-auction/install.php (revision 13557) +++ in-auction/install.php (working copy) @@ -33,7 +33,7 @@ $application =& kApplication::Instance(); $application->Init(); - if ($application->RecallVar('user_id') != -1) { + if ($application->RecallVar('user_id') != USER_ROOT) { die('restricted access!'); } Index: in-auction/hitcounter.php =================================================================== --- in-auction/hitcounter.php (revision 13557) +++ in-auction/hitcounter.php (working copy) @@ -23,7 +23,7 @@ $application =& kApplication::Instance(); $application->Init(); - $application->StoreVar('user_id', -1); // root + $application->StoreVar('user_id', USER_ROOT); $application->HandleEvent($event, 'l-ebay:OnHitAuction'); Index: in-auction/cron.php =================================================================== --- in-auction/cron.php (revision 13557) +++ in-auction/cron.php (working copy) @@ -24,7 +24,7 @@ $application =& kApplication::Instance(); $application->Init(); - $application->StoreVar('user_id', -1); // root + $application->StoreVar('user_id', USER_ROOT); $application->HandleEvent($event, 'l-ebay:OnListItems'); Index: custom/install.php =================================================================== --- custom/install.php (revision 13557) +++ custom/install.php (working copy) @@ -22,7 +22,7 @@ $application =& kApplication::Instance(); $application->Init(); - if ($application->RecallVar('user_id') != -1) { + if ($application->RecallVar('user_id') != USER_ROOT) { die('restricted access!'); }