Forráskód Böngészése

Upgrade script from 11.0.4 to 12.0.0-B1

Alex Trofimov 5 éve
szülő
commit
cc8a7dd7a6

+ 9 - 0
upgrade/files/11.0.4-12.0.0.B1/check.php

@@ -0,0 +1,9 @@
+<?php
+
+$mixCheckResult = 'Update can not be applied';
+
+$sVer = $this->oDb->getOne("SELECT `version` FROM `sys_modules` WHERE `name` = 'system'");
+if ('11.0.4' == $sVer)
+    $mixCheckResult = true;
+
+return $mixCheckResult;

+ 94 - 0
upgrade/files/11.0.4-12.0.0.B1/script.php

@@ -0,0 +1,94 @@
+<?php
+
+    if (!$this->oDb->isFieldExists('sys_acl_levels_members', 'State'))
+        $this->oDb->query("ALTER TABLE `sys_acl_levels_members` ADD `State` varchar(16) NOT NULL default '' AFTER `DateExpires`");
+
+
+    if (!$this->oDb->isFieldExists('sys_badges', 'fontcolor'))
+        $this->oDb->query("ALTER TABLE `sys_badges` ADD `fontcolor` varchar(32) NOT NULL default '' AFTER `color`");
+
+
+    if (!$this->oDb->isFieldExists('sys_objects_report', 'module'))
+        $this->oDb->query("ALTER TABLE `sys_objects_report` ADD `module` varchar(32) NOT NULL default '' AFTER `name`");
+    $this->oDb->query("UPDATE `sys_objects_report` SET `module` = 'system' WHERE `name` = 'sys_cmts'");
+
+
+    if (!$this->oDb->isFieldExists('sys_objects_report', 'object_comment'))
+        $this->oDb->query("ALTER TABLE `sys_objects_report` ADD `object_comment` varchar(64) NOT NULL AFTER `base_url`");
+
+
+    if (!$this->oDb->isFieldExists('sys_objects_favorite', 'table_lists'))
+        $this->oDb->query("ALTER TABLE `sys_objects_favorite` ADD `table_lists` varchar(32) NOT NULL AFTER `table_track`");
+
+
+    if (!$this->oDb->isFieldExists('sys_objects_feature', 'module'))
+        $this->oDb->query("ALTER TABLE `sys_objects_feature` ADD `module` varchar(32) NOT NULL default '' AFTER `name`");
+
+
+    if (!$this->oDb->isFieldExists('sys_objects_form', 'parent_form'))
+        $this->oDb->query("ALTER TABLE `sys_objects_form` ADD `parent_form` varchar(64) NOT NULL DEFAULT '' AFTER `active`");
+
+
+    if (!$this->oDb->isFieldExists('sys_form_inputs', 'privacy'))
+        $this->oDb->query("ALTER TABLE `sys_form_inputs` ADD `privacy` tinyint(4) NOT NULL DEFAULT '0' AFTER `html`");
+
+
+    if (!$this->oDb->isFieldExists('sys_form_inputs', 'rateable') && $this->oDb->isFieldExists('sys_form_inputs', 'privacy'))
+        $this->oDb->query("ALTER TABLE `sys_form_inputs` ADD `rateable` varchar(32) NOT NULL DEFAULT '' AFTER `privacy`");
+
+
+    if (!$this->oDb->isFieldExists('sys_menu_items', 'markers'))
+        $this->oDb->query("ALTER TABLE `sys_menu_items` ADD `markers` text NOT NULL AFTER `addon`");
+
+
+    if (!$this->oDb->isFieldExists('sys_objects_grid', 'show_total_count'))
+        $this->oDb->query("ALTER TABLE `sys_objects_grid` ADD `show_total_count` tinyint(4) NOT NULL DEFAULT '1' AFTER `responsive`");
+
+
+    if (!$this->oDb->isFieldExists('sys_objects_page', 'sticky_columns'))
+        $this->oDb->query("ALTER TABLE `sys_objects_page` ADD `sticky_columns` tinyint(4) NOT NULL DEFAULT '0' AFTER `layout_id`");
+    $this->oDb->query("UPDATE `sys_objects_page` SET `sticky_columns` = 1 WHERE `object` = 'sys_home'");
+
+
+    if (!$this->oDb->isFieldExists('sys_objects_page', 'inj_head'))
+        $this->oDb->query("ALTER TABLE `sys_objects_page` ADD `inj_head` text NOT NULL AFTER `cache_editable`");
+
+
+    if (!$this->oDb->isFieldExists('sys_objects_page', 'inj_footer') && $this->oDb->isFieldExists('sys_objects_page', 'inj_head'))
+        $this->oDb->query("ALTER TABLE `sys_objects_page` ADD `inj_footer` text NOT NULL AFTER `inj_head`");
+
+
+    if (!$this->oDb->isFieldExists('sys_pages_blocks', 'submenu'))
+        $this->oDb->query("ALTER TABLE `sys_pages_blocks` ADD `submenu` varchar(64) NOT NULL DEFAULT '' AFTER `designbox_id`");
+
+
+    if (!$this->oDb->isFieldExists('sys_pages_blocks', 'tabs') && $this->oDb->isFieldExists('sys_pages_blocks', 'submenu'))
+        $this->oDb->query("ALTER TABLE `sys_pages_blocks` ADD `tabs` tinyint(4) NOT NULL DEFAULT '0' AFTER `submenu`");
+    $this->oDb->query("UPDATE `sys_pages_blocks` SET `tabs` = 1 WHERE `module` = 'system' AND `title_system` IN('_sys_page_block_title_sys_create_post', '_sys_page_block_title_sys_create_post_context', '_sys_page_block_title_sys_create_post_public')");
+
+
+    if (!$this->oDb->isFieldExists('sys_pages_blocks', 'async') && $this->oDb->isFieldExists('sys_pages_blocks', 'tabs'))
+        $this->oDb->query("ALTER TABLE `sys_pages_blocks` ADD `async` int(11) NOT NULL DEFAULT '0' AFTER `tabs`");
+    $this->oDb->query("UPDATE `sys_pages_blocks` SET `async` = 4 WHERE `module` = 'system' AND `title_system` IN('_sys_page_block_title_sys_create_post', '_sys_page_block_title_sys_create_post_context', '_sys_page_block_title_sys_create_post_public')");
+
+
+    if (!$this->oDb->isFieldExists('sys_objects_live_updates', 'init'))
+        $this->oDb->query("ALTER TABLE `sys_objects_live_updates` ADD `init` tinyint(4) NOT NULL DEFAULT '0' AFTER `name`");
+
+
+    if (!$this->oDb->isFieldExists('sys_std_widgets', 'type'))
+        $this->oDb->query("ALTER TABLE `sys_std_widgets` ADD `type` varchar(32) NOT NULL default '' AFTER `module`");
+
+
+    if (!$this->oDb->isFieldExists('sys_std_widgets', 'featured'))
+        $this->oDb->query("ALTER TABLE `sys_std_widgets` ADD `featured` tinyint(4) unsigned NOT NULL default '0' AFTER `cnt_actions`");
+
+
+    if ($this->oDb->isFieldExists('sys_std_widgets', 'bookmark'))
+        $this->oDb->query("ALTER TABLE `sys_std_widgets` DROP `bookmark`");
+
+    $aPathInfo = pathinfo(__FILE__);
+    $sWidgetsSqlPath = $aPathInfo['dirname'] . '/widgets.sql';
+    $this->oDb->executeSQL($sWidgetsSqlPath);
+
+    return true;

+ 638 - 0
upgrade/files/11.0.4-12.0.0.B1/sql.sql

@@ -0,0 +1,638 @@
+
+-- Email templates
+
+DELETE FROM `sys_email_templates` WHERE `Name` = 't_PasswordReset';
+
+-- Settings: hidden
+
+UPDATE `sys_options` SET `check` = 'Segment', `check_params` = 'a:2:{s:3:"min";i:1;s:3:"max";i:10;}', `check_error` = '_adm_stg_cpt_option_sys_template_cache_image_max_size_err' WHERE `name` = 'sys_template_cache_image_max_size';
+
+
+DELETE FROM `sys_options` WHERE `name` IN('sys_logs_storage_default', 'sys_default_curl_timeout');
+
+SET @iCategoryIdHidden = (SELECT `id` FROM `sys_options_categories` WHERE `name` = 'hidden');
+
+INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_params`, `check_error`, `order`) VALUES
+(@iCategoryIdHidden, 'sys_logs_storage_default', '_adm_stg_cpt_option_sys_logs_storage_default', 'Folder', 'select', 'Folder,PHPLog,STDErr', '', '', '', 130),
+(@iCategoryIdHidden, 'sys_default_curl_timeout', '_adm_stg_cpt_option_sys_default_curl_timeout', '10', 'digit', '', '', '', '', 140);
+
+-- Settings: security
+
+DELETE FROM `sys_options` WHERE `name` IN('sys_security_block_content_after_n_reports');
+
+SET @iCategoryIdSecurity = (SELECT `id` FROM `sys_options_categories` WHERE `name` = 'security');
+
+INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
+(@iCategoryIdSecurity, 'sys_security_block_content_after_n_reports', '_adm_stg_cpt_option_sys_security_block_content_after_n_reports', '0', 'digit', '', '', '', 35);
+
+-- Settings: storage
+
+UPDATE `sys_options` SET `extra` = 'Local,S3,S3v4,S3v4alt' WHERE `name` = 'sys_storage_default';
+
+DELETE FROM `sys_options` WHERE `name` IN('sys_storage_s3_endpoint', 'sys_storage_s3_sig_ver', 'sys_storage_s3_region');
+
+SET @iCategoryIdStorage = (SELECT `id` FROM `sys_options_categories` WHERE `name` = 'storage');
+
+INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
+(@iCategoryIdStorage, 'sys_storage_s3_endpoint', '_adm_stg_cpt_option_sys_storage_s3_endpoint', '', 'digit', '', '', '', 6),
+(@iCategoryIdStorage, 'sys_storage_s3_sig_ver', '_adm_stg_cpt_option_sys_storage_s3_sig_ver', 'v2', 'select', 'v2,v4', '', '', 7),
+(@iCategoryIdStorage, 'sys_storage_s3_region', '_adm_stg_cpt_option_sys_storage_s3_region', '', 'digit', '', '', '', 8);
+
+
+-- Settings: account
+
+UPDATE `sys_options` SET `extra` = 'Local,S3,S3v4,S3v4alt' WHERE `name` = 'sys_storage_default';
+
+DELETE FROM `sys_options` WHERE `name` IN('sys_account_activation_2fa_lifetime', 'sys_account_reset_password_key_lifetime', 'sys_account_reset_password_redirect', 'sys_account_reset_password_redirect_custom');
+
+SET @iCategoryIdAccount = (SELECT `id` FROM `sys_options_categories` WHERE `name` = 'account');
+
+INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
+(@iCategoryIdAccount, 'sys_account_activation_2fa_lifetime', '_adm_stg_cpt_option_sys_account_2fa_lifetime', '0', 'digit', '', '', '', 14),
+(@iCategoryIdAccount, 'sys_account_reset_password_key_lifetime', '_adm_stg_cpt_option_sys_account_reset_password_key_lifetime', '259200', 'digit', '', '', '', 30),
+(@iCategoryIdAccount, 'sys_account_reset_password_redirect', '_adm_stg_cpt_option_sys_account_reset_password_redirect', 'home', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:35:"get_options_reset_password_redirect";s:5:"class";s:18:"BaseServiceAccount";}', '', '', 31),
+(@iCategoryIdAccount, 'sys_account_reset_password_redirect_custom', '_adm_stg_cpt_option_sys_account_reset_password_redirect_custom', '', 'digit', '', '', '', 32);
+
+
+-- Settings: location
+
+SET @iTypeId = (SELECT `id` FROM `sys_options_types` WHERE `name` = 'system' LIMIT 1);
+
+DELETE FROM `sys_options_categories` WHERE `name` = 'location';
+INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `hidden`, `order`) VALUES (@iTypeId, 'location', '_adm_stg_cpt_category_location', 0, 20);
+SET @iCategoryIdLocation = LAST_INSERT_ID();
+
+UPDATE `sys_options` SET `category_id` = @iCategoryIdLocation WHERE `name` = 'sys_maps_api_key';
+
+DELETE FROM `sys_options` WHERE `name` IN('sys_location_field_default', 'sys_location_map_default', 'sys_location_map_zoom_default', 'sys_nominatim_server', 'sys_nominatim_email', 'sys_location_leaflet_provider');
+INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
+(@iCategoryIdLocation, 'sys_location_field_default', '_adm_stg_cpt_option_sys_location_field_default', 'sys_plain', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:34:"get_options_location_field_default";s:5:"class";s:13:"TemplServices";}', '', '', 10),
+(@iCategoryIdLocation, 'sys_location_map_default', '_adm_stg_cpt_option_sys_location_map_default', 'sys_leaflet', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:32:"get_options_location_map_default";s:5:"class";s:13:"TemplServices";}', '', '', 12),
+
+(@iCategoryIdLocation, 'sys_location_map_zoom_default', '_adm_stg_cpt_option_sys_location_map_zoom_default', '7', 'digit', '', '', '', 20),
+
+(@iCategoryIdLocation, 'sys_nominatim_server', '_adm_stg_cpt_option_sys_nominatim_server', 'https://nominatim.openstreetmap.org', 'digit', '', '', '', 40),
+(@iCategoryIdLocation, 'sys_nominatim_email', '_adm_stg_cpt_option_sys_nominatim_email', '', 'digit', '', '', '', 42),
+
+(@iCategoryIdLocation, 'sys_location_leaflet_provider', '_adm_stg_cpt_option_sys_location_leaflet_provider', 'OpenStreetMap.Mapnik', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:42:"get_options_location_leaflet_get_providers";s:5:"class";s:13:"TemplServices";}', '', '', 50);
+
+-- ACL
+
+DELETE `sys_acl_actions`, `sys_acl_matrix` FROM `sys_acl_actions`, `sys_acl_matrix` WHERE `sys_acl_matrix`.`IDAction` = `sys_acl_actions`.`ID` AND `sys_acl_actions`.`Module` = 'system' AND `Name` IN('comments pin', 'set form fields privacy');
+DELETE FROM `sys_acl_actions` WHERE `Module` = 'system' AND `Name` IN('comments pin', 'set form fields privacy');
+
+INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
+('system', 'comments pin', NULL, '_sys_acl_action_comments_pin', '', 1, 3);
+SET @iIdActionCmtPin = LAST_INSERT_ID();
+
+INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
+('system', 'set form fields privacy', NULL, '_sys_acl_action_set_form_fields_privacy', '_sys_acl_action_set_form_fields_privacy_desc', 0, 3);
+SET @iIdActionSetFormFieldsPrivacy = LAST_INSERT_ID();
+
+SET @iUnauthenticated = 1;
+SET @iAccount = 2;
+SET @iStandard = 3;
+SET @iUnconfirmed = 4;
+SET @iPending = 5;
+SET @iSuspended = 6;
+SET @iModerator = 7;
+SET @iAdministrator = 8;
+SET @iPremium = 9;
+
+INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
+
+-- comments pin
+(@iModerator, @iIdActionCmtPin),
+(@iAdministrator, @iIdActionCmtPin),
+
+-- set form fields privacy
+(@iAccount, @iIdActionSetFormFieldsPrivacy),
+(@iStandard, @iIdActionSetFormFieldsPrivacy),
+(@iUnconfirmed, @iIdActionSetFormFieldsPrivacy),
+(@iPending, @iIdActionSetFormFieldsPrivacy),
+(@iModerator, @iIdActionSetFormFieldsPrivacy),
+(@iAdministrator, @iIdActionSetFormFieldsPrivacy),
+(@iPremium, @iIdActionSetFormFieldsPrivacy);
+
+
+-- Vote objects
+
+DELETE FROM `sys_objects_vote` WHERE `Name` IN('sys_form_fields_votes', 'sys_form_fields_reaction');
+INSERT INTO `sys_objects_vote` (`Name`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES 
+('sys_form_fields_votes', 'sys_form_fields_votes', 'sys_form_fields_votes_track', '604800', '1', '1', '0', '1', 'sys_form_fields_ids', 'id', 'author_id', 'rate', 'votes', '', ''),
+('sys_form_fields_reaction', 'sys_form_fields_reaction', 'sys_form_fields_reaction_track', '604800', '1', '1', '1', '1', 'sys_form_fields_ids', 'id', 'author_id', 'rrate', 'rvotes', 'BxTemplVoteReactions', '');
+
+-- Votes and reactions for form fields
+
+CREATE TABLE IF NOT EXISTS `sys_form_fields_votes` (
+  `object_id` int(11) NOT NULL default '0',
+  `count` int(11) NOT NULL default '0',
+  `sum` int(11) NOT NULL default '0',
+  UNIQUE KEY `object_id` (`object_id`)
+);
+
+CREATE TABLE IF NOT EXISTS `sys_form_fields_votes_track` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `object_id` int(11) NOT NULL default '0',
+  `author_id` int(11) NOT NULL default '0',
+  `author_nip` int(11) unsigned NOT NULL default '0',
+  `value` tinyint(4) NOT NULL default '0',
+  `date` int(11) NOT NULL default '0',
+  PRIMARY KEY (`id`),
+  KEY `vote` (`object_id`, `author_nip`)
+);
+
+CREATE TABLE IF NOT EXISTS `sys_form_fields_reaction` (
+  `object_id` int(11) NOT NULL default '0',
+  `reaction` varchar(32) NOT NULL default '',
+  `count` int(11) NOT NULL default '0',
+  `sum` int(11) NOT NULL default '0',
+  UNIQUE KEY `reaction` (`object_id`, `reaction`)
+);
+
+CREATE TABLE IF NOT EXISTS `sys_form_fields_reaction_track` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `object_id` int(11) NOT NULL default '0',
+  `author_id` int(11) NOT NULL default '0',
+  `author_nip` int(11) unsigned NOT NULL default '0',
+  `reaction` varchar(32) NOT NULL default '',
+  `value` tinyint(4) NOT NULL default '0',
+  `date` int(11) NOT NULL default '0',
+  PRIMARY KEY (`id`),
+  KEY `vote` (`object_id`, `author_nip`)
+);
+
+-- Privacy
+
+DELETE FROM `sys_objects_privacy` WHERE `object` = 'sys_form_inputs_allow_view_to';
+INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES
+('sys_form_inputs_allow_view_to', 'system', 'view', '_sys_privacy_forms_input_allow_view_to', '3', 'sys_form_inputs_privacy', 'id', 'author_id', '', '');
+
+-- Uploader
+
+DELETE FROM `sys_objects_uploader` WHERE `object` = 'sys_video_recording';
+INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `override_class_file`) VALUES
+('sys_video_recording', 1, 'BxTemplUploaderVideoRecording', '');
+
+-- Forms
+
+DELETE FROM `sys_objects_form` WHERE `object` IN('sys_favorite', 'sys_labels');
+INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
+('sys_favorite', 'system', '_sys_form_favorite', 'favorite.php', 'a:3:{s:2:"id";s:0:"";s:4:"name";s:0:"";s:5:"class";s:19:"bx-favorite-do-form";}', 'submit', '', 'id', '', '', '', 0, 1, '', ''),
+('sys_labels', 'system', '_sys_form_labels', 'label.php', '', 'do_submit', '', '', '', '', '', 0, 1, 'BxTemplLabelForm', '');
+
+DELETE FROM `sys_form_displays` WHERE `display_name` IN('sys_forgot_password_reset', 'sys_favorite_add', 'sys_favorite_list_edit', 'sys_labels_select');
+INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
+('sys_forgot_password_reset', 'system', 'sys_forgot_password', '_sys_form_display_forgot_password_reset', 0),
+('sys_favorite_add', 'system', 'sys_favorite', '_sys_form_display_favorite_add', 0),
+('sys_favorite_list_edit', 'system', 'sys_favorite', '_sys_form_display_favorite_list_edit', 0),
+('sys_labels_select', 'system', 'sys_labels', '_sys_form_labels_display_select', 0);
+
+DELETE FROM `sys_form_inputs` WHERE `object` = 'sys_account' AND `name` = 'phone';
+DELETE FROM `sys_form_inputs` WHERE `object` = 'sys_forgot_password' AND `name` IN ('key', 'password');
+DELETE FROM `sys_form_inputs` WHERE `object` = 'sys_comment' AND `name` IN ('cmt_controls', 'cmt_cancel');
+DELETE FROM `sys_form_inputs` WHERE `object` = 'sys_favorite' AND `name` IN ('sys', 'list_id', 'object_id', 'action', 'id', 'list', 'new_list', 'title', 'allow_view_favorite_list_to', 'submit');
+DELETE FROM `sys_form_inputs` WHERE `object` = 'sys_labels' AND `name` IN ('name', 'action', 'search', 'list', 'controls', 'do_submit', 'do_cancel');
+
+INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
+('sys_account', 'system', 'phone', '', '', 0, 'text', '_sys_form_login_input_caption_system_phone', '_sys_form_login_input_phone', '_sys_form_login_input_phone_info', 1, 0, 0, '', '', '', 'PhoneExist', '', '_sys_form_login_input_phone_error_format', 'Xss', '', 1, 0),
+
+('sys_forgot_password', 'system', 'key', '', '', 0, 'hidden', '_sys_form_forgot_password_input_caption_system_key', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_forgot_password', 'system', 'password', '', '', 0, 'password', '_sys_form_forgot_password_input_caption_system_password', '_sys_form_forgot_password_input_caption_password', '', 1, 0, 0, '', '', '', 'Preg', 'a:1:{s:4:"preg";s:38:"~^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{8,}~";}', '_sys_form_account_input_password_error', 'Xss', '', 1, 0),
+
+('sys_comment', 'system', 'cmt_controls', '', 'cmt_submit,cmt_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_comment', 'system', 'cmt_cancel', '_sys_form_comment_input_cancel', '', 0, 'button', '_sys_form_comment_input_caption_system_cmt_cancel', '', '', 0, 0, 0, 'a:1:{s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 0, 0),
+
+('sys_favorite', 'system', 'sys', '', '', 0, 'hidden', '_sys_form_favorite_input_caption_system_sys', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_favorite', 'system', 'list_id', '', '', 0, 'hidden', '_sys_form_favorite_input_caption_system_list_id', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_favorite', 'system', 'object_id', '', '', 0, 'hidden', '_sys_form_favorite_input_caption_system_object_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
+('sys_favorite', 'system', 'action', '', '', 0, 'hidden', '_sys_form_favorite_input_caption_system_action', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_favorite', 'system', 'id', '', '', 0, 'hidden', '_sys_form_favorite_input_caption_system_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
+('sys_favorite', 'system', 'list', '', '#!sys_report_types', 0, 'checkbox_set', '_sys_form_favorite_input_caption_system_list', '_sys_form_favorite_input_caption_list', '', 1, 0, 0, '', '', '', 'Avail', '', '_Please select value', 'Xss', '', 1, 0),
+('sys_favorite', 'system', 'new_list', '_sys_form_favorite_input_caption_button_new_list', '', 0, 'button', '', '', '', 0, 0, 0, 'a:1:{s:7:"onclick";s:25:"{js_object}.showNewList()";}', '', '', '', '', '', 'Xss', '', 1, 0),
+('sys_favorite', 'system', 'title', '', '', 0, 'text', '_sys_form_favorite_input_caption_system_title', '_sys_form_favorite_input_caption_title', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('sys_favorite', 'system', 'allow_view_favorite_list_to', '', '', 0, 'custom', '_sys_form_favorite_input_caption_system_allow_view_to', '_sys_form_favorite_input_caption_allow_view_to', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
+('sys_favorite', 'system', 'submit', '_sys_form_favorite_input_caption_submit', '', 0, 'submit', '_sys_form_favorite_input_caption_system_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+
+('sys_labels', 'system', 'name', '', '', 0, 'hidden', '_sys_form_labels_input_caption_system_name', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_labels', 'system', 'action', '', '', 0, 'hidden', '_sys_form_labels_input_caption_system_action', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_labels', 'system', 'search', '', '', 0, 'custom', '_sys_form_labels_input_caption_system_search', '_sys_form_labels_input_caption_search', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_labels', 'system', 'list', '', '', 0, 'custom', '_sys_form_labels_input_caption_system_list', '_sys_form_labels_input_caption_list', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_labels', 'system', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_labels', 'system', 'do_submit', '_sys_form_labels_input_caption_do_submit', '', 0, 'submit', '_sys_form_labels_input_caption_system_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_labels', 'system', 'do_cancel', '_sys_form_labels_input_caption_do_cancel', '', 0, 'button', '_sys_form_labels_input_caption_system_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 0, 0);
+
+UPDATE `sys_form_inputs` SET `checker_func` = 'ProfileName' WHERE `object` = 'sys_account' AND `name` = 'name';
+
+CREATE TABLE IF NOT EXISTS `sys_form_inputs_privacy` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `input_id` int(11) unsigned NOT NULL default '0',
+  `author_id` int(11) unsigned NOT NULL default '0',
+  `allow_view_to` varchar(16) NOT NULL DEFAULT '3',
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `input` (`input_id`,`author_id`)
+);
+
+
+UPDATE `sys_form_display_inputs` SET `order` = 2 WHERE `display_name` = 'sys_login_step3' AND `input_name` = 'do_checkcode' AND `order` = 3;
+UPDATE `sys_form_display_inputs` SET `order` = 3 WHERE `display_name` = 'sys_login_step3' AND `input_name` = 'back' AND `order` = 2;
+
+DELETE FROM `sys_form_display_inputs` WHERE `display_name` = 'sys_account_create' AND `input_name` = 'phone';
+INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
+('sys_account_create', 'phone', 2147483647, 0, 3);
+
+
+DELETE FROM `sys_form_display_inputs` WHERE `display_name` = 'sys_forgot_password_reset';
+INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
+('sys_forgot_password_reset', 'key', 2147483647, 1, 1),
+('sys_forgot_password_reset', 'password', 2147483647, 1, 2),
+('sys_forgot_password_reset', 'captcha', 2147483647, 1, 3),
+('sys_forgot_password_reset', 'do_submit', 2147483647, 1, 4);
+
+
+DELETE FROM `sys_form_display_inputs` WHERE `display_name` = 'sys_comment_edit' AND `input_name` IN('cmt_controls', 'cmt_cancel');
+INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
+('sys_comment_edit', 'cmt_controls', 2147483647, 1, 8),
+('sys_comment_edit', 'cmt_cancel', 2147483647, 1, 10);
+UPDATE `sys_form_display_inputs` SET `order` = 9 WHERE `display_name` = 'sys_comment_edit' AND `input_name` = 'cmt_submit';
+
+
+DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('sys_favorite_add', 'sys_favorite_list_edit');
+INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
+('sys_favorite_add', 'sys', 2147483647, 1, 1),
+('sys_favorite_add', 'object_id', 2147483647, 1, 2),
+('sys_favorite_add', 'action', 2147483647, 1, 3),
+('sys_favorite_add', 'id', 2147483647, 0, 4),
+('sys_favorite_add', 'list', 2147483647, 1, 5),
+('sys_favorite_add', 'new_list', 2147483647, 1, 6),
+('sys_favorite_add', 'title', 2147483647, 1, 7),
+('sys_favorite_add', 'allow_view_favorite_list_to', 2147483647, 1, 8),
+('sys_favorite_add', 'submit', 2147483647, 1, 9),
+
+('sys_favorite_list_edit', 'sys', 2147483647, 1, 1),
+('sys_favorite_list_edit', 'list_id', 2147483647, 1, 2),
+('sys_favorite_list_edit', 'object_id', 2147483647, 1, 3),
+('sys_favorite_list_edit', 'action', 2147483647, 1, 4),
+('sys_favorite_list_edit', 'title', 2147483647, 1, 5),
+('sys_favorite_list_edit', 'allow_view_favorite_list_to', 2147483647, 1, 6),
+('sys_favorite_list_edit', 'submit', 2147483647, 1, 7);
+
+DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('sys_labels_select');
+INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
+('sys_labels_select', 'name', 2147483647, 1, 1),
+('sys_labels_select', 'action', 2147483647, 1, 2),
+('sys_labels_select', 'search', 2147483647, 1, 3),
+('sys_labels_select', 'list', 2147483647, 1, 4),
+('sys_labels_select', 'controls', 2147483647, 1, 5),
+('sys_labels_select', 'do_submit', 2147483647, 1, 6),
+('sys_labels_select', 'do_cancel', 2147483647, 1, 7);
+
+CREATE TABLE IF NOT EXISTS `sys_form_fields_ids` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `object_form` varchar(64) NOT NULL default '',
+  `module` varchar(32) NOT NULL,
+  `field_name` varchar(255) NOT NULL default '',
+  `content_id` int(11) NOT NULL DEFAULT '0',
+  `author_id` int(10) NOT NULL DEFAULT '0',
+  `nested_content_id` int(10) NOT NULL default '0',
+  `rate` float NOT NULL default '0',
+  `votes` int(11) NOT NULL default '0',
+  `rrate` float NOT NULL DEFAULT '0',
+  `rvotes` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
+  KEY `system_form_fields_id` (`object_form`, `content_id`, `nested_content_id`)
+);
+
+-- Predefined lists
+
+DELETE FROM `sys_form_pre_lists` WHERE `key` = 'sys_studio_widget_types';
+INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`, `extendable`) VALUES
+('sys_studio_widget_types', '_sys_pre_lists_studio_widget_types', 'system', '0', '0');
+
+DELETE FROM `sys_form_pre_values` WHERE `Key` = 'sys_studio_widget_types';
+INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`, `Data`) VALUES
+('sys_studio_widget_types', '', 1, '_sys_pre_lists_studio_widget_types_library', '', 'a:1:{s:4:"icon";s:15:"lmi-library.svg";}'),
+('sys_studio_widget_types', 'appearance', 2, '_sys_pre_lists_studio_widget_types_appearance', '', 'a:1:{s:4:"icon";s:18:"lmi-appearance.svg";}'),
+('sys_studio_widget_types', 'structure', 3, '_sys_pre_lists_studio_widget_types_structure', '', 'a:1:{s:4:"icon";s:17:"lmi-structure.svg";}'),
+('sys_studio_widget_types', 'content', 4, '_sys_pre_lists_studio_widget_types_content', '', 'a:1:{s:4:"icon";s:15:"lmi-content.svg";}'),
+('sys_studio_widget_types', 'users', 5, '_sys_pre_lists_studio_widget_types_users', '', 'a:1:{s:4:"icon";s:13:"lmi-users.svg";}'),
+('sys_studio_widget_types', 'configuration', 6, '_sys_pre_lists_studio_widget_types_configuration', '', 'a:1:{s:4:"icon";s:21:"lmi-configuration.svg";}'),
+('sys_studio_widget_types', 'extensions', 7, '_sys_pre_lists_studio_widget_types_extensions', '', 'a:1:{s:4:"icon";s:18:"lmi-extensions.svg";}'),
+('sys_studio_widget_types', 'integrations', 8, '_sys_pre_lists_studio_widget_types_integrations', '', 'a:1:{s:4:"icon";s:20:"lmi-integrations.svg";}'),
+('sys_studio_widget_types', 'favorites', 9, '_sys_pre_lists_studio_widget_types_favorites', '', 'a:1:{s:4:"icon";s:17:"lmi-favorites.svg";}');
+
+-- Menus
+
+SET @iMaxIdTemplate = (SELECT IFNULL(MAX(`id`), 0) FROM `sys_menu_templates`);
+
+UPDATE `sys_menu_templates` SET `id` = @iMaxIdTemplate + 1 WHERE `id` = 18 AND `template` != 'menu_main_submenu_more_auto.html';
+UPDATE `sys_menu_templates` SET `id` = @iMaxIdTemplate + 2 WHERE `id` = 25 AND `template` != 'menu_block_submenu_hor.html';
+UPDATE `sys_menu_templates` SET `id` = @iMaxIdTemplate + 3 WHERE `id` = 26 AND `template` != 'menu_block_submenu_ver.html';
+
+DELETE FROM `sys_menu_templates` WHERE `id` IN(18, 25, 26);
+INSERT INTO `sys_menu_templates` (`id`, `template`, `title`, `visible`) VALUES
+(18, 'menu_main_submenu_more_auto.html', '_sys_menu_template_title_main_submenu_more_auto', 8),
+(25, 'menu_block_submenu_hor.html', '_sys_menu_template_title_block_submenu_hor', 1),
+(26, 'menu_block_submenu_ver.html', '_sys_menu_template_title_block_submenu_ver', 1);
+
+DELETE FROM `sys_objects_menu` WHERE `object` IN ('sys_favorite_list', 'sys_studio_account_popup');
+INSERT INTO `sys_objects_menu` (`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
+('sys_favorite_list', '_sys_menu_title_favorite_list', 'sys_favorite_list', 'system', 9, 0, 1, '', ''),
+('sys_studio_account_popup', '_sys_menu_title_studio_account_popup', 'sys_studio_account_popup', 'system', 4, 0, 1, 'BxTemplStudioMenuAccountPopup', '');
+
+DELETE FROM `sys_menu_sets` WHERE `set_name` IN('sys_favorite_list', 'sys_studio_account_popup');
+INSERT INTO `sys_menu_sets` (`set_name`, `module`, `title`, `deletable`) VALUES
+('sys_favorite_list', 'system', '_sys_menu_set_title_sys_favorite_list', 0),
+('sys_studio_account_popup', 'system', '_sys_menu_set_title_studio_account_popup', 0);
+
+DELETE FROM `sys_menu_items` WHERE `set_name` = 'sys_site' AND `name` = 'more-auto';
+INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES
+('sys_site', 'system', 'more-auto', '_sys_menu_item_title_system_more_auto', '_sys_menu_item_title_more_auto', 'javascript:void(0)', '', '', 'ellipsis-v', '', 2147483647, 1, 0, 9999);
+
+UPDATE `sys_menu_items` SET `visible_for_levels` = 2147483646 WHERE `set_name` = 'sys_toolbar_member' AND `name` = 'add-content' AND `visible_for_levels` = 510;
+UPDATE `sys_menu_items` SET `visible_for_levels` = 2147483646 WHERE `set_name` = 'sys_toolbar_member' AND `name` = 'account' AND `visible_for_levels` = 510;
+
+DELETE FROM `sys_menu_items` WHERE `set_name` = 'sys_cmts_item_manage' AND `name` IN('item-pin', 'item-unpin');
+INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES
+('sys_cmts_item_manage', 'system', 'item-pin', '_sys_menu_item_title_system_cmts_item_pin', '_sys_menu_item_title_cmts_item_pin', 'javascript:void(0)', 'javascript:{js_object}.cmtPin(this, {content_id}, 1)', '_self', 'thumbtack', '', 2147483647, 1, 0, 0),
+('sys_cmts_item_manage', 'system', 'item-unpin', '_sys_menu_item_title_system_cmts_item_unpin', '_sys_menu_item_title_cmts_item_unpin', 'javascript:void(0)', 'javascript:{js_object}.cmtPin(this, {content_id}, 0)', '_self', 'thumbtack', '', 2147483647, 1, 0, 0);
+
+UPDATE `sys_menu_items` SET `onclick` = 'bx_menu_popup(''sys_cmts_item_manage'', this, {''id'':''sys_cmts_item_manage_{cmt_system}_{cmt_id}'', ''removeOnClose'':1}, {cmt_system:''{cmt_system}'', cmt_object_id:{cmt_object_id}, cmt_id:{cmt_id}});' WHERE `set_name` = 'sys_cmts_item_actions' AND `name` = 'item-more';
+
+DELETE FROM `sys_menu_items` WHERE `set_name` = 'sys_favorite_list';
+INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `submenu_popup`, `visible_for_levels`, `visibility_custom`, `active`, `copyable`, `editable`, `order`) VALUES 
+('sys_favorite_list', 'system', 'edit', '', '_sys_menu_item_title_favorite_list_edit', 'javascript:void(0)', 'javascript:{js_object}.cmtEdit(this, {list_id})', '', 'edit', '', '', 0, 2147483646, '', 1, 0, 1, 1),
+('sys_favorite_list', 'system', 'delete', '', '_sys_menu_item_title_wiki_favorite_list_delete', 'javascript:void(0)', 'javascript:{js_object}.cmtDelete(this, {list_id})', '', 'times', '', '', 0, 2147483646, '', 1, 0, 1, 2);
+
+DELETE FROM `sys_menu_items` WHERE `set_name` = 'sys_studio_account_popup';
+INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `editable`, `order`) VALUES
+('sys_studio_account_popup', 'system', 'account', '_sys_menu_item_title_system_sa_account', '_sys_menu_item_title_sa_account', '{member_url}', '', '', 'ami-account.svg', '', 2147483647, 1, 0, 0, 1),
+('sys_studio_account_popup', 'system', 'edit', '_sys_menu_item_title_system_sa_edit', '_sys_menu_item_title_sa_edit', 'javascript:void(0)', '{js_object}.clickEdit(this);', '', 'ami-edit.svg', '', 2147483647, 1, 0, 0, 2),
+('sys_studio_account_popup', 'system', 'language', '_sys_menu_item_title_system_sa_language', '_sys_menu_item_title_sa_language', 'javascript:void(0)', 'bx_menu_popup(''sys_switch_language_popup'', this);', '', 'ami-language.svg', '', 2147483647, 1, 0, 0, 3),
+('sys_studio_account_popup', 'system', 'logout', '_sys_menu_item_title_system_sa_logout', '_sys_menu_item_title_sa_logout', '{url_root}logout.php', '{js_object}.clickLogout(this);', '', 'ami-logout.svg', '', 2147483647, 1, 0, 0, 4);
+
+-- Grids
+
+DELETE FROM `sys_objects_grid` WHERE `object` IN('sys_studio_roles', 'sys_studio_roles_actions');
+INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `field_id`, `field_order`, `field_active`, `paginate_url`, `paginate_per_page`, `paginate_simple`, `paginate_get_start`, `paginate_get_per_page`, `filter_fields`, `filter_fields_translatable`, `filter_mode`, `sorting_fields`, `sorting_fields_translatable`, `override_class_name`, `override_class_file`) VALUES
+('sys_studio_roles', 'Sql', 'SELECT * FROM `sys_std_roles` WHERE 1 ', 'sys_std_roles', 'id', 'order', 'active', '', 100, NULL, 'start', '', 'name', 'title,description', 'auto', '', '', 'BxTemplStudioRolesLevels', ''),
+('sys_studio_roles_actions', 'Sql', 'SELECT *, ''0'' AS `active` FROM `sys_std_roles_actions` WHERE 1 ', 'sys_std_roles_actions', 'id', '', 'active', '', 20, NULL, 'start', '', 'name', 'title,description', 'auto', '', '', 'BxTemplStudioRolesActions', '');
+
+DELETE FROM `sys_grid_fields` WHERE `object` IN('sys_studio_roles', 'sys_studio_roles_actions');
+INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
+('sys_studio_roles', 'order', '', '1%', 0, 0, '', 1),
+('sys_studio_roles', 'switcher', '', '5%', 0, 0, '', 2),
+('sys_studio_roles', 'title', '_adm_rl_txt_title', '24%', 1, 0, '', 3),
+('sys_studio_roles', 'description', '_adm_rl_txt_description', '35%', 1, 32, '', 4),
+('sys_studio_roles', 'actions_list', '_adm_rl_txt_actions', '15%', 0, 0, '', 5),
+('sys_studio_roles', 'actions', '', '20%', 0, 0, '', 6),
+
+('sys_studio_roles_actions', 'switcher', '', '10%', 0, 0, '', 1),
+('sys_studio_roles_actions', 'title', '_adm_rl_txt_title', '40%', 1, 32, '', 2),
+('sys_studio_roles_actions', 'description', '_adm_rl_txt_description', '50%', 1, 48, '', 3);
+
+DELETE FROM `sys_grid_actions` WHERE `object` IN('sys_studio_roles');
+INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
+('sys_studio_roles', 'independent', 'add', '_adm_rl_btn_role_add', '', 0, 0, 1),
+('sys_studio_roles', 'single', 'edit', '_adm_rl_btn_role_edit', 'pencil-alt', 1, 0, 1),
+('sys_studio_roles', 'single', 'delete', '_adm_rl_btn_role_delete', 'remove', 1, 1, 2);
+
+-- Pages
+
+DELETE FROM `sys_objects_page` WHERE `object` = 'sys_search_keyword';
+INSERT INTO `sys_objects_page` (`object`, `uri`, `title_system`, `title`, `module`, `cover`, `layout_id`, `submenu`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
+('sys_search_keyword', 'search-keyword', '_sys_page_title_system_search_keyword', '_sys_page_title_search_keyword', 'system', 1, 5, '', 2147483647, 1, 'searchKeyword.php', '', '', '', 0, 1, 0, '', '');
+
+CREATE TABLE IF NOT EXISTS `sys_pages_content_placeholders` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `module` varchar(32) NOT NULL,
+  `title` varchar(255) NOT NULL,
+  `template` varchar(255) NOT NULL,
+  `order` int(11) NOT NULL,
+  PRIMARY KEY (`id`)
+);
+
+TRUNCATE TABLE `sys_pages_content_placeholders`;
+
+INSERT INTO `sys_pages_content_placeholders` (`id`, `module`, `title`, `template`, `order`) VALUES
+(1, 'system', '_sys_page_content_ph_loading_indicator', 'block_async_loading_indicator.html', 1),
+(2, 'system', '_sys_page_content_ph_text', 'block_async_text.html', 2),
+(3, 'system', '_sys_page_content_ph_image', 'block_async_image.html', 3),
+(4, 'system', '_sys_page_content_ph_create_post', 'block_async_create_post.html', 4),
+(100, 'system', '_sys_page_content_ph_profile_units', 'block_async_profile_units.html', 100),
+(110, 'system', '_sys_page_content_ph_text_units_list', 'block_async_text_units_list.html', 110),
+(120, 'system', '_sys_page_content_ph_text_units_gallery', 'block_async_text_units_gallery.html', 120);
+
+UPDATE `sys_pages_blocks` SET `designbox_id` = 11 WHERE `module` = 'system' AND `title_system` IN('_sys_page_block_title_sys_create_post', '_sys_page_block_title_sys_create_post_context', '_sys_page_block_title_sys_create_post_public');
+
+UPDATE `sys_pages_blocks` SET `designbox_id` = 13 WHERE `object` = 'sys_forgot_password' AND `title` IN('_sys_page_block_title_forgot_password');
+
+DELETE FROM `sys_pages_blocks` WHERE `object` = 'sys_search_keyword' AND `title` IN('_sys_page_block_title_search_keyword_form', '_sys_page_block_title_search_keyword_result');
+INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
+('sys_search_keyword', 1, 'system', '', '_sys_page_block_title_search_keyword_form', 13, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:19:"search_keyword_form";s:6:"params";a:0:{}s:5:"class";s:13:"TemplServices";}', 0, 1, 1, 1),
+('sys_search_keyword', 1, 'system', '', '_sys_page_block_title_search_keyword_result', 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:21:"search_keyword_result";s:6:"params";a:0:{}s:5:"class";s:13:"TemplServices";}', 0, 1, 1, 1);
+
+-- Logs objects
+
+CREATE TABLE IF NOT EXISTS `sys_objects_logs` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `object` varchar(64) NOT NULL,
+  `module` varchar(32) NOT NULL,
+  `logs_storage` varchar(32) NOT NULL,
+  `title` varchar(255) NOT NULL,
+  `active` tinyint(4) NOT NULL DEFAULT '1',
+  `class_name` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+);
+
+TRUNCATE TABLE `sys_objects_logs`;
+
+INSERT INTO `sys_objects_logs` (`object`, `module`, `logs_storage`, `title`, `active`, `class_name`, `class_file`) VALUES
+('sys_debug', 'system', 'Auto', '_sys_log_debug', 1, '', ''),
+('sys_twilio', 'system', 'Auto', '_sys_log_twilio', 1, '', ''),
+('sys_push', 'system', 'Auto', '_sys_log_push', 1, '', ''),
+('sys_payments', 'system', 'Auto', '_sys_log_payments', 1, '', '');
+
+-- Location field objects
+
+CREATE TABLE IF NOT EXISTS `sys_objects_location_field` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `object` varchar(64) NOT NULL,
+  `module` varchar(32) NOT NULL,
+  `title` varchar(255) NOT NULL,
+  `class_name` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+);
+
+TRUNCATE TABLE `sys_objects_location_field`;
+
+INSERT INTO `sys_objects_location_field` (`object`, `module`, `title`, `class_name`, `class_file`) VALUES
+('sys_google', 'system', '_sys_location_field_google', 'BxDolLocationFieldGoogle', ''),
+('sys_plain', 'system', '_sys_location_field_plain', 'BxDolLocationFieldNominatim', '');
+
+-- Location map objects
+
+CREATE TABLE IF NOT EXISTS `sys_objects_location_map` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `object` varchar(64) NOT NULL,
+  `module` varchar(32) NOT NULL,
+  `title` varchar(255) NOT NULL,
+  `class_name` varchar(255) NOT NULL,
+  `class_file` varchar(255) NOT NULL,
+  PRIMARY KEY (`id`)
+);
+
+TRUNCATE TABLE `sys_objects_location_map`;
+
+INSERT INTO `sys_objects_location_map` (`object`, `module`, `title`, `class_name`, `class_file`) VALUES
+('sys_google_static', 'system', '_sys_location_map_google_static', 'BxDolLocationMapGoogleStatic', ''),
+('sys_leaflet', 'system', '_sys_location_map_leaflet', 'BxDolLocationMapLeaflet', '');
+
+-- Preloader
+
+DELETE FROM `sys_preloader` WHERE `module` = 'system' AND `type` = 'js_system' AND `content` IN('BxDolForm.js', 'BxDolNestedForm.js');
+INSERT INTO `sys_preloader`(`module`, `type`, `content`, `active`, `order`) VALUES
+('system', 'js_system', 'BxDolForm.js', 1, 42),
+('system', 'js_system', 'BxDolNestedForm.js', 1, 43);
+
+-- Studio roles
+
+CREATE TABLE IF NOT EXISTS `sys_std_roles` (
+  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(64) NOT NULL default '',
+  `title` varchar(255) NOT NULL,
+  `description` varchar(255) NOT NULL default '',
+  `active` tinyint(4) NOT NULL DEFAULT '1',
+  `order` int(11) NOT NULL default '0',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `name` (`name`),
+  FULLTEXT KEY `searchable` (`title`, `description`)
+);
+
+TRUNCATE TABLE `sys_std_roles`;
+
+INSERT INTO `sys_std_roles` (`id`, `name`, `title`, `description`, `active`, `order`) VALUES
+(1, 'master', '_adm_rl_txt_role_master', '_adm_rl_txt_role_master_dsc', 1, 1),
+(2, 'operator', '_adm_rl_txt_role_operator', '_adm_rl_txt_role_operator_dsc', 1, 2);
+
+CREATE TABLE IF NOT EXISTS `sys_std_roles_actions` (
+  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(64) NOT NULL default '',
+  `title` varchar(255) NOT NULL,
+  `description` varchar(255) NOT NULL,
+  PRIMARY KEY  (`id`),
+  FULLTEXT KEY `searchable` (`title`, `description`)
+);
+
+TRUNCATE TABLE `sys_std_roles_actions`;
+
+CREATE TABLE IF NOT EXISTS `sys_std_roles_actions2roles` (  
+  `role_id` int(11) unsigned NOT NULL default '0',
+  `action_id` int(11) unsigned NOT NULL default '0',
+  PRIMARY KEY  (`role_id`, `action_id`)
+);
+
+TRUNCATE TABLE `sys_std_roles_actions2roles`;
+
+INSERT INTO `sys_std_roles_actions` (`name`, `title`, `description`) VALUES
+('manage roles', '_adm_rl_txt_action_manage_roles', '_adm_rl_txt_action_manage_roles_dsc');
+SET @iIdActionManageRoles = LAST_INSERT_ID();
+
+INSERT INTO `sys_std_roles_actions` (`name`, `title`, `description`) VALUES
+('manage apps', '_adm_rl_txt_action_manage_apps', '_adm_rl_txt_action_manage_apps_dsc');
+SET @iIdActionManageApps = LAST_INSERT_ID();
+
+INSERT INTO `sys_std_roles_actions` (`name`, `title`, `description`) VALUES
+('use appearance', '_adm_rl_txt_action_use_appearance', '_adm_rl_txt_action_use_appearance_dsc');
+SET @iIdActionUseAppearance = LAST_INSERT_ID();
+
+INSERT INTO `sys_std_roles_actions` (`name`, `title`, `description`) VALUES
+('use structure', '_adm_rl_txt_action_use_structure', '_adm_rl_txt_action_use_structure_dsc');
+SET @iIdActionUseStructure = LAST_INSERT_ID();
+
+INSERT INTO `sys_std_roles_actions` (`name`, `title`, `description`) VALUES
+('use content', '_adm_rl_txt_action_use_content', '_adm_rl_txt_action_use_content_dsc');
+SET @iIdActionUseContent = LAST_INSERT_ID();
+
+INSERT INTO `sys_std_roles_actions` (`name`, `title`, `description`) VALUES
+('use users', '_adm_rl_txt_action_use_users', '_adm_rl_txt_action_use_users_dsc');
+SET @iIdActionUseUsers = LAST_INSERT_ID();
+
+INSERT INTO `sys_std_roles_actions` (`name`, `title`, `description`) VALUES
+('use configuration', '_adm_rl_txt_action_use_configuration', '_adm_rl_txt_action_use_configuration_dsc');
+SET @iIdActionUseConfiguration = LAST_INSERT_ID();
+
+INSERT INTO `sys_std_roles_actions` (`name`, `title`, `description`) VALUES
+('use extensions', '_adm_rl_txt_action_use_extensions', '_adm_rl_txt_action_use_extensions_dsc');
+SET @iIdActionUseExtensions = LAST_INSERT_ID();
+
+INSERT INTO `sys_std_roles_actions` (`name`, `title`, `description`) VALUES
+('use integrations', '_adm_rl_txt_action_use_integrations', '_adm_rl_txt_action_use_integrations_dsc');
+SET @iIdActionUseIntegrations = LAST_INSERT_ID();
+
+SET @iMaster = 1;
+SET @iOperator = 2;
+
+INSERT INTO `sys_std_roles_actions2roles` (`role_id`, `action_id`) VALUES
+
+-- manage roles
+(@iMaster, @iIdActionManageRoles),
+(@iMaster, @iIdActionManageApps),
+
+-- use appearance
+(@iMaster, @iIdActionUseAppearance),
+(@iOperator, @iIdActionUseAppearance),
+
+-- use structure
+(@iMaster, @iIdActionUseStructure),
+(@iOperator, @iIdActionUseStructure),
+
+-- use content
+(@iMaster, @iIdActionUseContent),
+(@iOperator, @iIdActionUseContent),
+
+-- use users
+(@iMaster, @iIdActionUseUsers),
+(@iOperator, @iIdActionUseUsers),
+
+-- use configuration
+(@iMaster, @iIdActionUseConfiguration),
+(@iOperator, @iIdActionUseConfiguration),
+
+-- use extensions
+(@iMaster, @iIdActionUseExtensions),
+(@iOperator, @iIdActionUseExtensions),
+
+-- use integrations
+(@iMaster, @iIdActionUseIntegrations),
+(@iOperator, @iIdActionUseIntegrations);
+
+CREATE TABLE IF NOT EXISTS `sys_std_roles_members` (
+  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `account_id` int(11) unsigned NOT NULL default '0',
+  `role` int(11) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `account` (`account_id`)
+);
+
+-- Studio widgets
+
+CREATE TABLE IF NOT EXISTS `sys_std_widgets_bookmarks` (
+  `widget_id` int(11) unsigned NOT NULL default '0',
+  `profile_id` int(11) unsigned NOT NULL default '0',
+  `bookmark` tinyint(4) unsigned NOT NULL default '0',
+  UNIQUE KEY `bookmark` (`widget_id`, `profile_id`)
+);
+
+UPDATE `sys_std_pages` SET `index` = 3 WHERE `name` = 'home';
+
+-- Roles
+
+INSERT INTO `sys_std_roles_members` (`account_id`, `role`) SELECT `id`, 1 FROM `sys_accounts` WHERE `role` = 3 AND `password` != '' AND `locked` = 0;
+
+
+-- Last step is to update current version
+
+UPDATE `sys_modules` SET `version` = '12.0.0-B1' WHERE (`version` = '11.0.4') AND `name` = 'system';

+ 50 - 0
upgrade/files/11.0.4-12.0.0.B1/widgets.sql

@@ -0,0 +1,50 @@
+
+DELETE FROM `sys_std_pages` WHERE `name` = 'builder_roles';
+INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
+(3, 'builder_roles', '_adm_page_cpt_builder_roles', '_adm_page_cpt_builder_roles', 'wi-bld-roles.svg');
+SET @iIdBuilderRoles = LAST_INSERT_ID();
+
+SET @iIdSettings = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'settings' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'configuration', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdSettings;
+
+SET @iIdStore = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'store' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'extensions', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdStore;
+
+SET @iIdDashboard = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'dashboard' LIMIT 1);
+UPDATE `sys_std_widgets` SET `featured` = 1, `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdDashboard;
+
+SET @iIdDesigner = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'designer' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'appearance', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdDesigner;
+
+SET @iIdPolyglot = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'polyglot' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'appearance', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdPolyglot;
+
+SET @iIdBuilderPages = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'builder_pages' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'structure', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdBuilderPages;
+
+SET @iIdBuilderMenus = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'builder_menus' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'structure', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdBuilderMenus;
+
+SET @iIdBuilderForms = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'builder_forms' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'structure', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdBuilderForms;
+
+SET @iIdBuilderPermissions = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'builder_permissions' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'configuration', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdBuilderPermissions;
+
+SET @iIdHome = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home' LIMIT 1);
+SET @iIdBuilderRolesWidget = (SELECT `id` FROM `sys_std_widgets` WHERE `module` = 'system' AND `url` = '{url_studio}builder_roles.php' LIMIT 1);
+DELETE FROM `sys_std_widgets` WHERE `id` = @iIdBuilderRolesWidget;
+DELETE FROM `sys_std_pages_widgets` WHERE `widget_id` = @iIdBuilderRolesWidget;
+INSERT INTO `sys_std_widgets`(`page_id`, `module`, `type`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
+(@iIdBuilderRoles, 'system', 'configuration', '{url_studio}builder_roles.php', '', 'wi-bld-roles.svg', '_adm_wgt_cpt_builder_roles', '', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}');
+INSERT INTO `sys_std_pages_widgets`(`page_id`, `widget_id`, `order`) VALUES(@iIdHome, LAST_INSERT_ID(), 11);
+
+SET @iIdManagerStorages = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'storages' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'content', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdManagerStorages;
+
+SET @iIdAudit = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'audit' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'extensions', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdAudit;
+
+SET @iIdBadges = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'badges' LIMIT 1);
+UPDATE `sys_std_widgets` SET `type` = 'structure', `cnt_actions` = 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}' WHERE `page_id` = @iIdBadges;
+