Index: branches/RC/core/install/upgrades.sql
===================================================================
diff -u -N -r11612 -r11623
--- branches/RC/core/install/upgrades.sql	(.../upgrades.sql)	(revision 11612)
+++ branches/RC/core/install/upgrades.sql	(.../upgrades.sql)	(revision 11623)
@@ -951,7 +951,6 @@
 UPDATE ConfigurationAdmin SET prompt = 'la_config_PathToWebsite' WHERE VariableName = 'Site_Path';
 
 # ===== v 5.0.0 =====
-
 CREATE TABLE StopWords (
   StopWordId int(11) NOT NULL auto_increment,
   StopWord varchar(255) NOT NULL default '',
@@ -961,6 +960,11 @@
 
 INSERT INTO StopWords VALUES (90, '~'),(152, 'on'),(157, 'see'),(156, 'put'),(128, 'and'),(154, 'or'),(155, 'other'),(153, 'one'),(126, 'as'),(127, 'at'),(125, 'are'),(91, '!'),(92, '@'),(93, '#'),(94, '$'),(95, '%'),(96, '^'),(97, '&'),(98, '*'),(99, '('),(100, ')'),(101, '-'),(102, '_'),(103, '='),(104, '+'),(105, '['),(106, '{'),(107, ']'),(108, '}'),(109, '\\'),(110, '|'),(111, ';'),(112, ':'),(113, ''''),(114, '"'),(115, '<'),(116, '.'),(117, '>'),(118, '/'),(119, '?'),(120, 'ah'),(121, 'all'),(122, 'also'),(123, 'am'),(124, 'an'),(151, 'of'),(150, 'note'),(149, 'not'),(148, 'no'),(147, 'may'),(146, 'its'),(145, 'it'),(144, 'is'),(143, 'into'),(142, 'in'),(141, 'had'),(140, 'has'),(139, 'have'),(138, 'from'),(137, 'form'),(136, 'for'),(135, 'end'),(134, 'each'),(133, 'can'),(132, 'by'),(130, 'be'),(131, 'but'),(129, 'any'),(158, 'that'),(159, 'the'),(160, 'their'),(161, 'there'),(162, 'these'),(163, 'they'),(164, 'this'),(165, 'through'),(166, 'thus'),(167, 'to'),(168, 'two'),(169, 'too'),(170, 'up'),(171, 'where'),(172, 'which'),(173, 'with'),(174, 'were'),(175, 'was'),(176, 'you'),(177, 'yet');
 
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:stop_words.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:stop_words.add', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:stop_words.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:stop_words.delete', 11, 1, 1, 0);
+
 INSERT INTO ConfigurationAdmin VALUES ('CheckStopWords', 'la_Text_Website', 'la_config_CheckStopWords', 'checkbox', '', '', 10.29, 0, 0);
 INSERT INTO ConfigurationValues VALUES (DEFAULT, 'CheckStopWords', '0', 'In-Portal', 'in-portal:configure_general');
 
@@ -987,6 +991,11 @@
   KEY PortalUserId (PortalUserId)
 );
 
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.add', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.delete', 11, 1, 1, 0);
+
 ALTER TABLE EmailQueue
 	ADD MailingId INT UNSIGNED NOT NULL,
 	ADD INDEX (MailingId);
@@ -1100,25 +1109,36 @@
   PRIMARY KEY  (FormId)
 );
 
-UPDATE Events SET Module = 'Core:Category' WHERE Event = 'FORM.SUBMITTED';
+UPDATE Events SET Module = 'Core:Category', Description = 'la_event_FormSubmitted' WHERE Event = 'FORM.SUBMITTED';
 
 DELETE FROM PersistantSessionData WHERE VariableName LIKE '%img%';
 UPDATE Modules SET TemplatePath = Path WHERE TemplatePath <> '';
 
 UPDATE ConfigurationValues SET VariableValue = '/platform/designs/general' WHERE VariableName = 'cms_DefaultDesign';
 UPDATE ConfigurationValues SET ModuleOwner = 'In-Portal', Section = 'in-portal:configure_categories' WHERE VariableName = 'cms_DefaultDesign';
-UPDATE ConfigurationAdmin SET DisplayOrder = 10.29 WHERE VariableName = 'cms_DefaultDesign';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.15 WHERE VariableName = 'cms_DefaultDesign';
 
-UPDATE Phrase SET Module = 'Core' WHERE Phrase IN ('la_Hide', 'la_Show', 'la_fld_Requied', 'la_col_Modified');
+UPDATE Phrase SET Phrase = 'la_Regular' WHERE Phrase = 'la_regular';
+UPDATE Phrase SET Module = 'Core' WHERE Phrase IN ('la_Hide', 'la_Show', 'la_fld_Requied', 'la_col_Modified', 'la_col_Referer', 'la_Regular');
 UPDATE Phrase SET Phrase = 'la_title_Editing_E-mail' WHERE Phrase = 'la_title_editing_e-mail';
 
 ALTER TABLE Phrase ADD UNIQUE (LanguageId, Phrase);
 
-ALTER TABLE CustomField ADD IsRequired TINYINT(3) UNSIGNED;
+ALTER TABLE CustomField ADD IsRequired tinyint(3) unsigned NOT NULL default '0';
 
-DELETE FROM Permissions WHERE (Permission LIKE 'proj-cms:structure%') OR (Permission IN ('proj-cms:submissions', 'proj-base:users_management'));
+DELETE FROM Permissions
+WHERE
+	(Permission LIKE 'proj-cms:structure%') OR
+	(Permission LIKE 'proj-cms:submissions%') OR
+	(Permission LIKE 'proj-base:users%') OR
+	(Permission LIKE 'proj-base:system_variables%') OR
+	(Permission LIKE 'proj-base:email_settings%') OR
+	(Permission LIKE 'proj-base:other_settings%') OR
+	(Permission LIKE 'proj-base:sysconfig%');
+
 UPDATE Permissions SET Permission = REPLACE(Permission, 'proj-cms:browse', 'in-portal:browse_site');
 UPDATE Permissions SET Permission = REPLACE(Permission, 'proj-cms:', 'in-portal:');
+UPDATE Permissions SET Permission = REPLACE(Permission, 'proj-base:', 'in-portal:');
 
 ALTER TABLE CategoryItems ADD INDEX (ItemResourceId);
 ALTER TABLE CategoryItems
@@ -1134,7 +1154,100 @@
 DELETE FROM ConfigurationAdmin WHERE VariableName LIKE 'PerPage_Pages%';
 DELETE FROM ConfigurationValues WHERE VariableName LIKE 'PerPage_Pages%';
 
-UPDATE Modules SET Version = '5.0.0' WHERE Name = 'In-Portal';
-
 INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:website_setting_folder.view', 11, 1, 1, 0);
 INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:user_setting_folder.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_advanced.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_advanced.edit', 11, 1, 1, 0);
+
+#INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spelling_dictionary.delete', 11, 1, 1, 0);
+#INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spelling_dictionary.edit', 11, 1, 1, 0);
+#INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spelling_dictionary.add', 11, 1, 1, 0);
+#INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:spelling_dictionary.view', 11, 1, 1, 0);
+
+UPDATE ConfigurationValues
+SET ModuleOwner = 'In-Portal', Section = 'in-portal:configure_general'
+WHERE ModuleOwner = 'Proj-Base' AND Section IN ('proj-base:system_variables', 'proj-base:email_settings');
+
+UPDATE ConfigurationValues
+SET ModuleOwner = 'In-Portal', Section = 'in-portal:configure_advanced'
+WHERE ModuleOwner = 'Proj-Base' AND Section IN ('proj-base:other_settings', 'proj-base:sysconfig');
+
+UPDATE ConfigurationAdmin SET heading = 'la_Text_General' WHERE VariableName IN ('AdvancedUserManagement', 'RememberLastAdminTemplate');
+UPDATE ConfigurationAdmin SET heading = 'la_Text_Website' WHERE VariableName IN ('UseToolbarLabels', 'KeepSessionOnBrowserClose');
+UPDATE ConfigurationAdmin SET heading = 'la_Text_smtp_server', prompt = 'la_prompt_AdminMailFrom', ValueList = 'size="40"', DisplayOrder = 30.07 WHERE VariableName = 'Smtp_AdminMailFrom';
+UPDATE ConfigurationAdmin SET heading = 'la_Text_Website', DisplayOrder = 10.221 WHERE VariableName = 'UsePopups';
+UPDATE ConfigurationAdmin SET heading = 'la_Text_Website', DisplayOrder = 10.222 WHERE VariableName = 'UseDoubleSorting';
+UPDATE ConfigurationAdmin SET heading = 'la_Text_Website', DisplayOrder = 10.31 WHERE VariableName = 'MenuFrameWidth';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.20 WHERE VariableName = 'UseToolbarLabels';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.27 WHERE VariableName = 'KeepSessionOnBrowserClose';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.011 WHERE VariableName = 'AdvancedUserManagement';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.21 WHERE VariableName = 'UseSmallHeader';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.22 WHERE VariableName = 'UseColumnFreezer';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.23 WHERE VariableName = 'TrimRequiredFields';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.25 WHERE VariableName = 'UseChangeLog';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.25 WHERE VariableName = 'AutoRefreshIntervals';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.14 WHERE VariableName = 'RememberLastAdminTemplate';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.28 WHERE VariableName = 'ForceImageMagickResize';
+UPDATE ConfigurationAdmin SET DisplayOrder = 50.01 WHERE VariableName = 'CSVExportDelimiter';
+UPDATE ConfigurationAdmin SET DisplayOrder = 50.02 WHERE VariableName = 'CSVExportEnclosure';
+UPDATE ConfigurationAdmin SET DisplayOrder = 50.03 WHERE VariableName = 'CSVExportSeparator';
+UPDATE ConfigurationAdmin SET DisplayOrder = 50.04 WHERE VariableName = 'CSVExportEncoding';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.13 WHERE VariableName = 'FilenameSpecialCharReplacement';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.14 WHERE VariableName = 'YahooApplicationId';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.15 WHERE VariableName = 'DefaultSettingsUserId';
+
+UPDATE ConfigurationValues
+SET VariableValue = 1, ModuleOwner = 'In-Portal:Users', Section = 'in-portal:configure_users'
+WHERE VariableName = 'RememberLastAdminTemplate';
+
+UPDATE ConfigurationValues
+SET ModuleOwner = 'In-Portal:Users', Section = 'in-portal:configure_users'
+WHERE VariableName IN ('AdvancedUserManagement', 'DefaultSettingsUserId');
+
+INSERT INTO ConfigurationAdmin VALUES ('Search_MinKeyword_Length', 'la_Text_General', 'la_config_Search_MinKeyword_Length', 'text', NULL, NULL, 10.19, 0, 0);
+UPDATE ConfigurationValues SET Section = 'in-portal:configure_categories' WHERE VariableName = 'Search_MinKeyword_Length';
+
+UPDATE ConfigurationAdmin SET heading = 'la_title_General' WHERE heading = 'la_Text_General';
+
+UPDATE ConfigurationAdmin
+SET ValueList = '=+,<SQL>SELECT DestName AS OptionName, DestId AS OptionValue FROM <PREFIX>StdDestinations WHERE COALESCE(DestParentId, 0) = 0 ORDER BY OptionName</SQL>'
+WHERE VariableName = 'User_Default_Registration_Country';
+
+UPDATE ConfigurationValues
+SET ModuleOwner = 'In-Portal', Section = 'in-portal:configure_advanced'
+WHERE VariableName IN (
+	'Site_Path', 'SiteNameSubTitle', 'CookieSessions', 'SessionCookieName', 'SessionTimeout', 'SessionReferrerCheck',
+	'SystemTagCache', 'SocketBlockingMode', 'SSL_URL', 'AdminSSL_URL', 'Require_SSL', 'Force_HTTP_When_SSL_Not_Required',
+	'UseModRewrite', 'UseModRewriteWithSSL', 'UseJSRedirect', 'UseCronForRegularEvent', 'ErrorTemplate',
+	'NoPermissionTemplate', 'UseOutputCompression', 'OutputCompressionLevel', 'UseToolbarLabels', 'UseSmallHeader',
+	'UseColumnFreezer', 'TrimRequiredFields', 'UsePageHitCounter', 'UseChangeLog', 'AutoRefreshIntervals',
+	'KeepSessionOnBrowserClose', 'ForceImageMagickResize', 'CheckStopWords', 'ResizableFrames', 'Config_Server_Time',
+	'Config_Site_Time', 'Smtp_Server', 'Smtp_Port', 'Smtp_Authenticate', 'Smtp_User', 'Smtp_Pass', 'Smtp_DefaultHeaders',
+	'MailFunctionHeaderSeparator', 'MailingListQueuePerStep', 'MailingListSendPerStep', 'Backup_Path',
+	'CSVExportDelimiter', 'CSVExportEnclosure', 'CSVExportSeparator', 'CSVExportEncoding'
+);
+
+DELETE FROM ConfigurationValues WHERE VariableName IN (
+	'Columns_Category', 'Perpage_Archive', 'debug', 'Perpage_User', 'Perpage_LangEmail', 'Default_FromAddr',
+	'email_replyto', 'email_footer', 'Default_Theme', 'Default_Language', 'User_SortField', 'User_SortOrder',
+	'Suggest_MinInterval', 'SubCat_ListCount', 'Timeout_Rating', 'Perpage_Relations', 'Group_SortField',
+	'Group_SortOrder', 'Default_FromName', 'Relation_LV_Sortfield', 'ampm_time', 'Perpage_Template',
+	'Perpage_Phrase', 'Perpage_Sessionlist', 'Perpage_Items', 'GuestSessions', 'Perpage_Email',
+	'LinksValidation_LV_Sortfield', 'CustomConfig_LV_Sortfield', 'Event_LV_SortField', 'Theme_LV_SortField',
+	'Template_LV_SortField', 'Lang_LV_SortField', 'Phrase_LV_SortField', 'LangEmail_LV_SortField',
+	'CustomData_LV_SortField', 'Summary_SortField', 'Session_SortField', 'SearchLog_SortField', 'Perpage_StatItem',
+	'Perpage_Groups', 'Perpage_Event', 'Perpage_BanRules', 'Perpage_SearchLog', 'Perpage_LV_lang',
+	'Perpage_LV_Themes', 'Perpage_LV_Catlist', 'Perpage_Reviews', 'Perpage_Modules', 'Perpage_Grouplist',
+	'Perpage_Images', 'EmailsL_SortField', 'Perpage_EmailsL', 'Perpage_CustomData', 'Perpage_Review',
+	'SearchRel_DefaultIncrease', 'SearchRel_DefaultKeyword', 'SearchRel_DefaultPop', 'SearchRel_DefaultRating',
+	'Category_Highlight_OpenTag', 'Category_Highlight_CloseTag', 'DomainSelect', 'MetaKeywords', 'MetaDescription',
+	'Config_Name', 'Config_Company', 'Config_Reg_Number', 'Config_Website_Name', 'Config_Web_Address',
+	'Smtp_SendHTML', 'ProjCMSAllowManualFilenames'
+);
+
+DELETE FROM ConfigurationAdmin WHERE VariableName IN ('Domain_Detect', 'Server_Name', 'ProjCMSAllowManualFilenames');
+
+DROP TABLE SuggestMail;
+
+DELETE FROM Modules WHERE Name = 'Proj-Base';
+UPDATE Modules SET Version = '5.0.0', Loaded = 1 WHERE Name = 'In-Portal';
\ No newline at end of file
