install.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default');
  2. -- TABLE: PROFILES
  3. CREATE TABLE IF NOT EXISTS `bx_persons_data` (
  4. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  5. `author` int(10) unsigned NOT NULL,
  6. `added` int(11) NOT NULL,
  7. `changed` int(11) NOT NULL,
  8. `picture` int(11) NOT NULL,
  9. `cover` int(11) NOT NULL,
  10. `fullname` varchar(255) NOT NULL,
  11. `description` text NOT NULL,
  12. `public_subscriptions` tinyint(4) NOT NULL DEFAULT '0',
  13. `public_subscribed_me` tinyint(4) NOT NULL DEFAULT '0',
  14. `views` int(11) NOT NULL default '0',
  15. `favorites` int(11) NOT NULL default '0',
  16. `reports` int(11) NOT NULL default '0',
  17. `featured` int(11) NOT NULL default '0',
  18. `allow_view_to` int(11) NOT NULL DEFAULT '3',
  19. PRIMARY KEY (`id`),
  20. FULLTEXT KEY `search_fields` (`fullname`,`description`)
  21. );
  22. -- TABLE: STORAGES & TRANSCODERS
  23. CREATE TABLE IF NOT EXISTS `bx_persons_pictures` (
  24. `id` int(11) NOT NULL AUTO_INCREMENT,
  25. `profile_id` int(10) unsigned NOT NULL,
  26. `remote_id` varchar(128) NOT NULL,
  27. `path` varchar(255) NOT NULL,
  28. `file_name` varchar(255) NOT NULL,
  29. `mime_type` varchar(128) NOT NULL,
  30. `ext` varchar(32) NOT NULL,
  31. `size` int(11) NOT NULL,
  32. `added` int(11) NOT NULL,
  33. `modified` int(11) NOT NULL,
  34. `private` int(11) NOT NULL,
  35. PRIMARY KEY (`id`),
  36. UNIQUE KEY `remote_id` (`remote_id`)
  37. );
  38. CREATE TABLE IF NOT EXISTS `bx_persons_pictures_resized` (
  39. `id` int(11) NOT NULL AUTO_INCREMENT,
  40. `profile_id` int(10) unsigned NOT NULL,
  41. `remote_id` varchar(128) NOT NULL,
  42. `path` varchar(255) NOT NULL,
  43. `file_name` varchar(255) NOT NULL,
  44. `mime_type` varchar(128) NOT NULL,
  45. `ext` varchar(32) NOT NULL,
  46. `size` int(11) NOT NULL,
  47. `added` int(11) NOT NULL,
  48. `modified` int(11) NOT NULL,
  49. `private` int(11) NOT NULL,
  50. PRIMARY KEY (`id`),
  51. UNIQUE KEY `remote_id` (`remote_id`)
  52. );
  53. -- TABLE: VIEWS
  54. CREATE TABLE IF NOT EXISTS `bx_persons_views_track` (
  55. `object_id` int(11) NOT NULL default '0',
  56. `viewer_id` int(11) NOT NULL default '0',
  57. `viewer_nip` int(11) unsigned NOT NULL default '0',
  58. `date` int(11) NOT NULL default '0',
  59. KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
  60. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  61. -- TABLE: favorites
  62. CREATE TABLE IF NOT EXISTS `bx_persons_favorites_track` (
  63. `object_id` int(11) NOT NULL default '0',
  64. `author_id` int(11) NOT NULL default '0',
  65. `date` int(11) NOT NULL default '0',
  66. KEY `id` (`object_id`,`author_id`)
  67. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  68. -- TABLE: reports
  69. CREATE TABLE IF NOT EXISTS `bx_persons_reports` (
  70. `object_id` int(11) NOT NULL default '0',
  71. `count` int(11) NOT NULL default '0',
  72. UNIQUE KEY `object_id` (`object_id`)
  73. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  74. CREATE TABLE IF NOT EXISTS `bx_persons_reports_track` (
  75. `id` int(11) NOT NULL AUTO_INCREMENT,
  76. `object_id` int(11) NOT NULL default '0',
  77. `author_id` int(11) NOT NULL default '0',
  78. `author_nip` int(11) unsigned NOT NULL default '0',
  79. `type` varchar(32) NOT NULL default '',
  80. `text` text NOT NULL default '',
  81. `date` int(11) NOT NULL default '0',
  82. PRIMARY KEY (`id`),
  83. KEY `report` (`object_id`, `author_nip`)
  84. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  85. -- TABLE: metas
  86. CREATE TABLE IF NOT EXISTS `bx_persons_meta_keywords` (
  87. `object_id` int(10) unsigned NOT NULL,
  88. `keyword` varchar(255) NOT NULL,
  89. KEY `object_id` (`object_id`),
  90. KEY `keyword` (`keyword`)
  91. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  92. -- STORAGES & TRANSCODERS
  93. INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
  94. ('bx_persons_pictures', @sStorageEngine, '', 360, 2592000, 3, 'bx_persons_pictures', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
  95. ('bx_persons_pictures_resized', @sStorageEngine, '', 360, 2592000, 3, 'bx_persons_pictures_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
  96. INSERT INTO `sys_objects_transcoder` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES
  97. ('bx_persons_icon', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
  98. ('bx_persons_thumb', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
  99. ('bx_persons_avatar', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
  100. ('bx_persons_picture', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
  101. ('bx_persons_cover', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
  102. ('bx_persons_cover_thumb', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0');
  103. INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
  104. ('bx_persons_icon', 'Resize', 'a:3:{s:1:"w";s:2:"32";s:1:"h";s:2:"32";s:13:"square_resize";s:1:"1";}', '0'),
  105. ('bx_persons_thumb', 'Resize', 'a:3:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";}', '0'),
  106. ('bx_persons_avatar', 'Resize', 'a:3:{s:1:"w";s:2:"96";s:1:"h";s:2:"96";s:13:"square_resize";s:1:"1";}', '0'),
  107. ('bx_persons_picture', 'Resize', 'a:3:{s:1:"w";s:4:"1024";s:1:"h";s:4:"1024";s:13:"square_resize";s:1:"0";}', '0'),
  108. ('bx_persons_cover', 'Resize', 'a:1:{s:1:"w";s:4:"1024";}', '0'),
  109. ('bx_persons_cover_thumb', 'Resize', 'a:3:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";}', '0');
  110. -- FORMS
  111. INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
  112. ('bx_person', 'bx_persons', '_bx_persons_form_profile', '', 'a:1:{s:7:\"enctype\";s:19:\"multipart/form-data\";}', 'bx_persons_data', 'id', '', '', 'do_submit', '', 0, 1, 'BxPersonsFormEntry', 'modules/boonex/persons/classes/BxPersonsFormEntry.php');
  113. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  114. ('bx_person', 'bx_person_add', 'bx_persons', 0, '_bx_persons_form_profile_display_add'),
  115. ('bx_person', 'bx_person_delete', 'bx_persons', 0, '_bx_persons_form_profile_display_delete'),
  116. ('bx_person', 'bx_person_edit', 'bx_persons', 0, '_bx_persons_form_profile_display_edit'),
  117. ('bx_person', 'bx_person_edit_cover', 'bx_persons', 0, '_bx_persons_form_profile_display_edit_cover'),
  118. ('bx_person', 'bx_person_view', 'bx_persons', 1, '_bx_persons_form_profile_display_view'),
  119. ('bx_person', 'bx_person_view_full', 'bx_persons', 1, '_bx_persons_form_profile_display_view_full');
  120. 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
  121. ('bx_person', 'bx_persons', 'allow_view_to', 3, '', 0, 'custom', '_bx_persons_form_profile_input_sys_allow_view_to', '_bx_persons_form_profile_input_allow_view_to', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  122. ('bx_person', 'bx_persons', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_persons_form_profile_input_sys_delete_confirm', '_bx_persons_form_profile_input_delete_confirm', '_bx_persons_form_profile_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_persons_form_profile_input_delete_confirm_error', '', '', 1, 0),
  123. ('bx_person', 'bx_persons', 'do_submit', '_bx_persons_form_profile_input_submit', '', 0, 'submit', '_bx_persons_form_profile_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  124. ('bx_person', 'bx_persons', 'description', '', '', 0, 'textarea', '_bx_persons_form_profile_input_sys_desc', '_bx_persons_form_profile_input_desc', '', 0, 0, 0, '', '', '', '', '', '', 'XssMultiline', '', 1, 1),
  125. ('bx_person', 'bx_persons', 'fullname', '', '', 0, 'text', '_bx_persons_form_profile_input_sys_fullname', '_bx_persons_form_profile_input_fullname', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_persons_form_profile_input_fullname_err', 'Xss', '', 1, 0),
  126. ('bx_person', 'bx_persons', 'cover', 'a:1:{i:0;s:21:"bx_persons_cover_crop";}', 'a:1:{s:21:"bx_persons_cover_crop";s:24:"_sys_uploader_crop_title";}', 0, 'files', '_bx_persons_form_profile_input_sys_cover', '_bx_persons_form_profile_input_cover', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  127. ('bx_person', 'bx_persons', 'picture', 'a:1:{i:0;s:23:"bx_persons_picture_crop";}', 'a:1:{s:23:"bx_persons_picture_crop";s:24:"_sys_uploader_crop_title";}', 0, 'files', '_bx_persons_form_profile_input_sys_picture', '_bx_persons_form_profile_input_picture', '', 0, 0, 0, '', '', '', '', '', '_bx_persons_form_profile_input_picture_err', '', '', 1, 0),
  128. ('bx_person', 'bx_persons', 'public_subscriptions', 1, '', 0, 'checkbox', '_bx_persons_form_profile_input_sys_public_subscriptions', '_bx_persons_form_profile_input_public_subscriptions', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  129. ('bx_person', 'bx_persons', 'public_subscribed_me', 1, '', 0, 'checkbox', '_bx_persons_form_profile_input_sys_public_subscribed_me', '_bx_persons_form_profile_input_public_subscribed_me', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0);
  130. INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  131. ('bx_person_add', 'picture', 2147483647, 1, 1),
  132. ('bx_person_add', 'fullname', 2147483647, 1, 2),
  133. ('bx_person_add', 'description', 2147483647, 1, 3),
  134. ('bx_person_add', 'allow_view_to', 2147483647, 1, 4),
  135. ('bx_person_add', 'public_subscriptions', 2147483647, 1, 5),
  136. ('bx_person_add', 'public_subscribed_me', 2147483647, 1, 6),
  137. ('bx_person_add', 'do_submit', 2147483647, 1, 7),
  138. ('bx_person_delete', 'cover', 2147483647, 0, 0),
  139. ('bx_person_delete', 'picture', 2147483647, 0, 0),
  140. ('bx_person_delete', 'delete_confirm', 2147483647, 1, 0),
  141. ('bx_person_delete', 'do_submit', 2147483647, 1, 1),
  142. ('bx_person_delete', 'fullname', 2147483647, 0, 2),
  143. ('bx_person_edit', 'picture', 2147483647, 1, 1),
  144. ('bx_person_edit', 'fullname', 2147483647, 1, 2),
  145. ('bx_person_edit', 'description', 2147483647, 1, 3),
  146. ('bx_person_edit', 'allow_view_to', 2147483647, 1, 4),
  147. ('bx_person_edit', 'public_subscriptions', 2147483647, 1, 5),
  148. ('bx_person_edit', 'public_subscribed_me', 2147483647, 1, 6),
  149. ('bx_person_edit', 'do_submit', 2147483647, 1, 7),
  150. ('bx_person_edit_cover', 'delete_confirm', 2147483647, 0, 1),
  151. ('bx_person_edit_cover', 'fullname', 2147483647, 0, 2),
  152. ('bx_person_edit_cover', 'picture', 2147483647, 0, 3),
  153. ('bx_person_edit_cover', 'cover', 2147483647, 1, 7),
  154. ('bx_person_edit_cover', 'do_submit', 2147483647, 1, 8),
  155. ('bx_person_view', 'delete_confirm', 2147483647, 0, 3),
  156. ('bx_person_view', 'picture', 2147483647, 0, 4),
  157. ('bx_person_view', 'cover', 2147483647, 0, 5),
  158. ('bx_person_view', 'do_submit', 2147483647, 0, 6),
  159. ('bx_person_view', 'fullname', 2147483647, 1, 7),
  160. ('bx_person_view', 'description', 2147483647, 0, 8),
  161. ('bx_person_view_full', 'fullname', 2147483647, 1, 1),
  162. ('bx_person_view_full', 'description', 2147483647, 1, 2);
  163. -- STUDIO PAGE & WIDGET
  164. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  165. (3, 'bx_persons', '_bx_persons', '_bx_persons', 'bx_persons@modules/boonex/persons/|std-icon.svg');
  166. SET @iPageId = LAST_INSERT_ID();
  167. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  168. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  169. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  170. (@iPageId, 'bx_persons', '{url_studio}module.php?name=bx_persons', '', 'bx_persons@modules/boonex/persons/|std-icon.svg', '_bx_persons', '', '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";}');
  171. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  172. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));