Index: branches/5.1.x/install.php =================================================================== diff -u -N -r13194 -r13577 --- branches/5.1.x/install.php (.../install.php) (revision 13194) +++ branches/5.1.x/install.php (.../install.php) (revision 13577) @@ -1,6 +1,6 @@ Init(); - if ($application->RecallVar('user_id') != -1) { + if ($application->RecallVar('user_id') != USER_ROOT) { die('restricted access!'); } Index: branches/5.1.x/units/private_messages/private_messages_config.php =================================================================== diff -u -N -r13155 -r13577 --- branches/5.1.x/units/private_messages/private_messages_config.php (.../private_messages_config.php) (revision 13155) +++ branches/5.1.x/units/private_messages/private_messages_config.php (.../private_messages_config.php) (revision 13577) @@ -1,6 +1,6 @@ '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: branches/5.1.x/units/topics/topics_config.php =================================================================== diff -u -N -r13548 -r13577 --- branches/5.1.x/units/topics/topics_config.php (.../topics_config.php) (revision 13548) +++ branches/5.1.x/units/topics/topics_config.php (.../topics_config.php) (revision 13577) @@ -1,6 +1,6 @@ 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: branches/5.1.x/units/polls/polls_config.php =================================================================== diff -u -N -r13548 -r13577 --- branches/5.1.x/units/polls/polls_config.php (.../polls_config.php) (revision 13548) +++ branches/5.1.x/units/polls/polls_config.php (.../polls_config.php) (revision 13577) @@ -1,6 +1,6 @@ '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: branches/5.1.x/units/poll_comments/poll_comments_config.php =================================================================== diff -u -N -r13155 -r13577 --- branches/5.1.x/units/poll_comments/poll_comments_config.php (.../poll_comments_config.php) (revision 13155) +++ branches/5.1.x/units/poll_comments/poll_comments_config.php (.../poll_comments_config.php) (revision 13577) @@ -1,6 +1,6 @@ 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: branches/5.1.x/units/posts/posts_config.php =================================================================== diff -u -N -r13548 -r13577 --- branches/5.1.x/units/posts/posts_config.php (.../posts_config.php) (revision 13548) +++ branches/5.1.x/units/posts/posts_config.php (.../posts_config.php) (revision 13577) @@ -1,6 +1,6 @@ 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: branches/5.1.x/units/polls/poll_eh.php =================================================================== diff -u -N -r13094 -r13577 --- branches/5.1.x/units/polls/poll_eh.php (.../poll_eh.php) (revision 13094) +++ branches/5.1.x/units/polls/poll_eh.php (.../poll_eh.php) (revision 13577) @@ -1,6 +1,6 @@ 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: branches/5.1.x/units/poll_comments/poll_comment_eh.php =================================================================== diff -u -N -r13094 -r13577 --- branches/5.1.x/units/poll_comments/poll_comment_eh.php (.../poll_comment_eh.php) (revision 13094) +++ branches/5.1.x/units/poll_comments/poll_comment_eh.php (.../poll_comment_eh.php) (revision 13577) @@ -1,6 +1,6 @@ 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;