INSERT INTO ConfigurationAdmin VALUES ('User_LoggedInGroup', 'la_Text_General', 'la_users_assign_all_to', 'select', NULL, '0=lu_none,<SQL>SELECT GroupId as OptionName, Name as OptionValue FROM <PREFIX>PortalGroup WHERE Enabled=1 AND Personal=0</SQL>', 3, 1);
INSERT INTO ConfigurationValues VALUES ('User_LoggedInGroup', '15', 'In-Portal:Users', 'in-portal:configure_users');

INSERT INTO ConfigurationAdmin VALUES ('User_MembershipExpirationReminder', 'la_Text_General', 'la_MembershipExpirationReminder', 'text', NULL , '', '5', '1');
INSERT INTO ConfigurationValues VALUES ('User_MembershipExpirationReminder', '10', 'In-Portal:Users', 'in-portal:configure_users');

ALTER TABLE StylesheetSelectors ADD UNIQUE UniqueIdName (StylesheetId,SelectorName);

DELETE FROM StylesheetSelectors WHERE StylesheetId = 8 AND SelectorName LIKE '.calendar%';

INSERT INTO StylesheetSelectors VALUES (169, 8, 'Calendar''s selected days', '.calendar tbody .selected', 'a:0:{}', '', 1, 'font-weight: bold;\r\nbackground-color: #9ED7ED;\r\nborder: 1px solid #83B2C5;', 0);
INSERT INTO StylesheetSelectors VALUES (170, 8, 'Calendar''s weekends', '.calendar .weekend', 'a:0:{}', '', 1, 'color: #990000;', 0);
INSERT INTO StylesheetSelectors VALUES (171, 8, 'Calendar''s highlighted day', '.calendar tbody .hilite', 'a:0:{}', '', 1, 'background-color: #f6f6f6;\r\nborder: 1px solid #83B2C5 !important;', 0);
INSERT INTO StylesheetSelectors VALUES (172, 8, 'Calendar''s top and bottom titles', '.calendar .title', 'a:0:{}', '', 1, 'color: #FFFFFF;\r\nbackground-color: #62A1DE;\r\nborder: 1px solid #107DC5;\r\nborder-top: 0px;\r\npadding: 1px;', 0);
INSERT INTO StylesheetSelectors VALUES (173, 8, 'Calendar''s control buttons', '.calendar .calendar_button', 'a:0:{}', '', 1, 'color: black;\r\nfont-size: 12px;\r\nbackground-color: #eeeeee;', 0);
INSERT INTO StylesheetSelectors VALUES (174, 8, 'Calendar''s day names', '.calendar thead .name', 'a:0:{}', '', 1, 'background-color: #DEEEF6;\r\nborder-bottom: 1px solid #000000;', 0);
INSERT INTO StylesheetSelectors VALUES (175, 8, 'Calendar''s days', '.calendar tbody .day', 'a:0:{}', '', 1, 'text-align: right;\r\npadding: 2px 4px 2px 2px;\r\nwidth: 2em;\r\nborder: 1px solid #fefefe;', 0);

ALTER TABLE UserGroup ADD MembershipExpires INT UNSIGNED DEFAULT NULL AFTER GroupId;
ALTER TABLE UserGroup ADD ExpirationReminderSent TINYINT DEFAULT '0' NOT NULL;

INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('CATEGORY.VIEW', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('CATEGORY.ADD', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('CATEGORY.DELETE', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('CATEGORY.ADD.PENDING', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('CATEGORY.MODIFY', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('FAVORITES', -1, 0, 0, 0);

INSERT INTO Events VALUES ('', 'USER.MEMBERSHIP_EXPIRED', '1', '0', 'In-Portal:Users', 'la_event_user.membership_expired', '0');
INSERT INTO Events VALUES ('', 'USER.MEMBERSHIP_EXPIRED', '1', '0', 'In-Portal:Users', 'la_event_user.membership_expired', '1');
INSERT INTO Events VALUES ('', 'USER.MEMBERSHIP_EXPIRATION_NOTICE', '1', '0', 'In-Portal:Users', 'la_event_user.membership_expiration_notice', '0');
INSERT INTO Events VALUES ('', 'USER.MEMBERSHIP_EXPIRATION_NOTICE', '1', '0', 'In-Portal:Users', 'la_event_user.membership_expiration_notice', '1');

ALTER TABLE UserGroup ADD MembershipExpires INT UNSIGNED DEFAULT NULL AFTER GroupId;
ALTER TABLE PersistantSessionData ADD PRIMARY KEY (PortalUserId, VariableName);

UPDATE Modules SET Version = '1.1.1' WHERE Name = 'In-Portal';