install.sql 11 KB

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