XOOPS  2.6.0
install.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
31 {
33  // data for table 'group'
34  $group_handler = $xoops->getHandlerGroup();
35  // create admin group
36  $obj = $group_handler->create();
37  $obj->setVar("name", addslashes(SystemLocale::WEBMASTERS));
38  $obj->setVar("description", addslashes(SystemLocale::WEBMASTERS_OF_THIS_SITE));
39  $obj->setVar("group_type", 'Admin');
40  if (!$group_handler->insert($obj)) {
41  echo $xoops->alert('error', $obj->getHtmlErrors());
42  }
43  // create registered users group
44  $obj = $group_handler->create();
45  $obj->setVar("name", addslashes(SystemLocale::REGISTERED_USERS));
46  $obj->setVar("description", addslashes(SystemLocale::REGISTERED_USERS_GROUP));
47  $obj->setVar("group_type", 'User');
48  if (!$group_handler->insert($obj)) {
49  echo $xoops->alert('error', $obj->getHtmlErrors());
50  }
51  // create anonymous users group
52  $obj = $group_handler->create();
53  $obj->setVar("name", addslashes(SystemLocale::ANONYMOUS_USERS));
54  $obj->setVar("description", addslashes(SystemLocale::ANONYMOUS_USERS_GROUP));
55  $obj->setVar("group_type", 'Anonymous');
56  if (!$group_handler->insert($obj)) {
57  echo $xoops->alert('error', $obj->getHtmlErrors());
58  }
59  // data for table 'groups_users_link'
60 
61  // data for table 'group_permission'
62  $groupperm_handler = $xoops->getHandlerGroupPerm();
63  for ($i = 2; $i <= 3; ++$i) {
64  $obj = $groupperm_handler->create();
65  $obj->setVar("gperm_groupid", $i);
66  $obj->setVar("gperm_itemid", '1');
67  $obj->setVar("gperm_modid", '1');
68  $obj->setVar("gperm_name", 'module_read');
69  if (!$groupperm_handler->insert($obj)) {
70  echo $xoops->alert('error', $obj->getHtmlErrors());
71  }
72  }
73  for ($i = 1; $i <= 17; ++$i) {
74  $obj = $groupperm_handler->create();
75  $obj->setVar("gperm_groupid", '1');
76  $obj->setVar("gperm_itemid", $i);
77  $obj->setVar("gperm_modid", '1');
78  $obj->setVar("gperm_name", 'module_read');
79  if (!$groupperm_handler->insert($obj)) {
80  echo $xoops->alert('error', $obj->getHtmlErrors());
81  }
82  }
83  // Make system block visible
84  $blockmodulelink_handler = $xoops->getHandlerBlockmodulelink();
85  $block_handler = new XoopsBlockHandler($xoops->db());
86  $blocks = $block_handler->getByModule(1);
87  foreach ($blocks as $block) {
88  if (in_array($block->getVar('template'), array(
89  'system_block_user.tpl',
90  'system_block_login.tpl',
91  'system_block_mainmenu.tpl'
92  ))
93  ) {
94  $block->setVar('visible', 1);
95  $block_handler->insert($block, true);
96 
97  $blockmodulelink = $blockmodulelink_handler->create();
98  $blockmodulelink->setVar('block_id', $block->getVar('bid'));
99  $blockmodulelink->setVar('module_id', 0); //show on all pages
100  $blockmodulelink_handler->insert($blockmodulelink);
101 
102  for ($i = 2; $i <= 3; ++$i) {
103  $obj = $groupperm_handler->create();
104  $obj->setVar("gperm_groupid", $i);
105  $obj->setVar("gperm_itemid", $block->id());
106  $obj->setVar("gperm_modid", '1');
107  $obj->setVar("gperm_name", 'block_read');
108  if (!$groupperm_handler->insert($obj)) {
109  echo $xoops->alert('error', $obj->getHtmlErrors());
110  }
111  }
112  }
113  }
114  // default theme
115  $tplset_handler = $xoops->getHandlerTplset();
116  $obj = $tplset_handler->create();
117  $obj->setVar("tplset_name", 'default');
118  $obj->setVar("tplset_desc", 'XOOPS Default Template Set');
119  $obj->setVar("tplset_credits", '');
120  $obj->setVar("tplset_created", time());
121  if (!$tplset_handler->insert($obj)) {
122  echo $xoops->alert('error', $obj->getHtmlErrors());
123  }
124  // user admin
125 
126  // data for table 'groups_users_link'
127  $types = array(\PDO::PARAM_INT, \PDO::PARAM_INT);
128  $data = array('groupid' => 1, 'uid' => 1);
129  $xoops->db()->insertPrefix('groups_users_link', $data, $types);
130  $data = array('groupid' => 2, 'uid' => 1);
131  $xoops->db()->insertPrefix('groups_users_link', $data, $types);
132 }
getByModule($moduleid, $asobject=true)
Definition: block.php:658
const WEBMASTERS_OF_THIS_SITE
Definition: en_US.php:410
const WEBMASTERS
Definition: en_US.php:409
xoops_module_install_system(&$module)
Definition: install.php:30
$i
Definition: dialog.php:68
static getInstance()
Definition: Xoops.php:160
const ANONYMOUS_USERS_GROUP
Definition: en_US.php:36
const ANONYMOUS_USERS
Definition: en_US.php:35
$xoops
Definition: admin.php:25
const REGISTERED_USERS_GROUP
Definition: en_US.php:368
const REGISTERED_USERS
Definition: en_US.php:367
$module
Definition: main.php:52