install.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. `views` int(11) NOT NULL default '0',
  13. `favorites` int(11) NOT NULL default '0',
  14. `reports` int(11) NOT NULL default '0',
  15. `allow_view_to` int(11) NOT NULL DEFAULT '3',
  16. PRIMARY KEY (`id`),
  17. FULLTEXT KEY `search_fields` (`fullname`,`description`)
  18. );
  19. -- TABLE: STORAGES & TRANSCODERS
  20. CREATE TABLE IF NOT EXISTS `bx_persons_pictures` (
  21. `id` int(11) NOT NULL AUTO_INCREMENT,
  22. `profile_id` int(10) unsigned NOT NULL,
  23. `remote_id` varchar(255) NOT NULL,
  24. `path` varchar(255) NOT NULL,
  25. `file_name` varchar(255) NOT NULL,
  26. `mime_type` varchar(128) NOT NULL,
  27. `ext` varchar(32) NOT NULL,
  28. `size` int(11) NOT NULL,
  29. `added` int(11) NOT NULL,
  30. `modified` int(11) NOT NULL,
  31. `private` int(11) NOT NULL,
  32. PRIMARY KEY (`id`),
  33. UNIQUE KEY `remote_id` (`remote_id`)
  34. );
  35. CREATE TABLE IF NOT EXISTS `bx_persons_pictures_resized` (
  36. `id` int(11) NOT NULL AUTO_INCREMENT,
  37. `profile_id` int(10) unsigned NOT NULL,
  38. `remote_id` varchar(255) NOT NULL,
  39. `path` varchar(255) NOT NULL,
  40. `file_name` varchar(255) NOT NULL,
  41. `mime_type` varchar(128) NOT NULL,
  42. `ext` varchar(32) NOT NULL,
  43. `size` int(11) NOT NULL,
  44. `added` int(11) NOT NULL,
  45. `modified` int(11) NOT NULL,
  46. `private` int(11) NOT NULL,
  47. PRIMARY KEY (`id`),
  48. UNIQUE KEY `remote_id` (`remote_id`)
  49. );
  50. -- TABLE: VIEWS
  51. CREATE TABLE IF NOT EXISTS `bx_persons_views_track` (
  52. `object_id` int(11) NOT NULL default '0',
  53. `viewer_id` int(11) NOT NULL default '0',
  54. `viewer_nip` int(11) unsigned NOT NULL default '0',
  55. `date` int(11) NOT NULL default '0',
  56. KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
  57. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  58. -- TABLE: favorites
  59. CREATE TABLE IF NOT EXISTS `bx_persons_favorites_track` (
  60. `object_id` int(11) NOT NULL default '0',
  61. `author_id` int(11) NOT NULL default '0',
  62. `date` int(11) NOT NULL default '0',
  63. KEY `id` (`object_id`,`author_id`)
  64. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  65. -- TABLE: reports
  66. CREATE TABLE IF NOT EXISTS `bx_persons_reports` (
  67. `object_id` int(11) NOT NULL default '0',
  68. `count` int(11) NOT NULL default '0',
  69. UNIQUE KEY `object_id` (`object_id`)
  70. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  71. CREATE TABLE IF NOT EXISTS `bx_persons_reports_track` (
  72. `id` int(11) NOT NULL AUTO_INCREMENT,
  73. `object_id` int(11) NOT NULL default '0',
  74. `author_id` int(11) NOT NULL default '0',
  75. `author_nip` int(11) unsigned NOT NULL default '0',
  76. `type` varchar(32) NOT NULL default '',
  77. `text` text NOT NULL default '',
  78. `date` int(11) NOT NULL default '0',
  79. PRIMARY KEY (`id`),
  80. KEY `report` (`object_id`, `author_nip`)
  81. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  82. -- TABLE: metas
  83. CREATE TABLE IF NOT EXISTS `bx_persons_meta_keywords` (
  84. `object_id` int(10) unsigned NOT NULL,
  85. `keyword` varchar(255) NOT NULL,
  86. KEY `object_id` (`object_id`),
  87. KEY `keyword` (`keyword`)
  88. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  89. -- STORAGES & TRANSCODERS
  90. 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
  91. ('bx_persons_pictures', @sStorageEngine, '', 360, 2592000, 3, 'bx_persons_pictures', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
  92. ('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);
  93. INSERT INTO `sys_objects_transcoder` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES
  94. ('bx_persons_icon', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
  95. ('bx_persons_thumb', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
  96. ('bx_persons_avatar', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
  97. ('bx_persons_picture', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
  98. ('bx_persons_cover', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
  99. ('bx_persons_cover_thumb', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0');
  100. INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
  101. ('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'),
  102. ('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'),
  103. ('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'),
  104. ('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'),
  105. ('bx_persons_cover', 'Resize', 'a:1:{s:1:"w";s:4:"1024";}', '0'),
  106. ('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');
  107. -- FORMS
  108. 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
  109. ('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');
  110. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  111. ('bx_person', 'bx_person_add', 'bx_persons', 0, '_bx_persons_form_profile_display_add'),
  112. ('bx_person', 'bx_person_delete', 'bx_persons', 0, '_bx_persons_form_profile_display_delete'),
  113. ('bx_person', 'bx_person_edit', 'bx_persons', 0, '_bx_persons_form_profile_display_edit'),
  114. ('bx_person', 'bx_person_edit_cover', 'bx_persons', 0, '_bx_persons_form_profile_display_edit_cover'),
  115. ('bx_person', 'bx_person_view', 'bx_persons', 1, '_bx_persons_form_profile_display_view'),
  116. ('bx_person', 'bx_person_view_full', 'bx_persons', 1, '_bx_persons_form_profile_display_view_full');
  117. 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
  118. ('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),
  119. ('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),
  120. ('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),
  121. ('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),
  122. ('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),
  123. ('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),
  124. ('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);
  125. INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  126. ('bx_person_add', 'delete_confirm', 2147483647, 0, 3),
  127. ('bx_person_add', 'cover', 2147483647, 0, 4),
  128. ('bx_person_add', 'picture', 2147483647, 1, 5),
  129. ('bx_person_add', 'fullname', 2147483647, 1, 6),
  130. ('bx_person_add', 'description', 2147483647, 1, 8),
  131. ('bx_person_add', 'allow_view_to', 2147483647, 1, 9),
  132. ('bx_person_add', 'do_submit', 2147483647, 1, 10),
  133. ('bx_person_delete', 'cover', 2147483647, 0, 0),
  134. ('bx_person_delete', 'picture', 2147483647, 0, 0),
  135. ('bx_person_delete', 'delete_confirm', 2147483647, 1, 0),
  136. ('bx_person_delete', 'do_submit', 2147483647, 1, 1),
  137. ('bx_person_delete', 'fullname', 2147483647, 0, 2),
  138. ('bx_person_edit', 'delete_confirm', 2147483647, 0, 2),
  139. ('bx_person_edit', 'cover', 2147483647, 0, 3),
  140. ('bx_person_edit', 'picture', 2147483647, 1, 5),
  141. ('bx_person_edit', 'fullname', 2147483647, 1, 6),
  142. ('bx_person_edit', 'description', 2147483647, 1, 7),
  143. ('bx_person_edit', 'allow_view_to', 2147483647, 1, 8),
  144. ('bx_person_edit', 'do_submit', 2147483647, 1, 9),
  145. ('bx_person_edit_cover', 'delete_confirm', 2147483647, 0, 1),
  146. ('bx_person_edit_cover', 'fullname', 2147483647, 0, 2),
  147. ('bx_person_edit_cover', 'picture', 2147483647, 0, 3),
  148. ('bx_person_edit_cover', 'cover', 2147483647, 1, 7),
  149. ('bx_person_edit_cover', 'do_submit', 2147483647, 1, 8),
  150. ('bx_person_view', 'delete_confirm', 2147483647, 0, 3),
  151. ('bx_person_view', 'picture', 2147483647, 0, 4),
  152. ('bx_person_view', 'cover', 2147483647, 0, 5),
  153. ('bx_person_view', 'do_submit', 2147483647, 0, 6),
  154. ('bx_person_view', 'fullname', 2147483647, 1, 7),
  155. ('bx_person_view', 'description', 2147483647, 0, 8),
  156. ('bx_person_view_full', 'fullname', 2147483647, 1, 1),
  157. ('bx_person_view_full', 'description', 2147483647, 1, 2);
  158. -- STUDIO PAGE & WIDGET
  159. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  160. (3, 'bx_persons', '_bx_persons', '_bx_persons', 'bx_persons@modules/boonex/persons/|std-icon.svg');
  161. SET @iPageId = LAST_INSERT_ID();
  162. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  163. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  164. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  165. (@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";}');
  166. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  167. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));