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 
12 use Xoops\Core\Yaml;
13 
21 {
23  $xoops->header();
24 $lang_rank_titles = array(
25  'dummy',
33 );
34  $filedata = <<<EOT
35 -
36  rank_id: 1
37  rank_title: "{$lang_rank_titles[1]}"
38  rank_min: 0
39  rank_max: 20
40  rank_special: 0
41  rank_image: "ranks/rank3e632f95e81ca.gif"
42 -
43  rank_id: 2
44  rank_title: "{$lang_rank_titles[2]}"
45  rank_min: 21
46  rank_max: 40
47  rank_special: 0
48  rank_image: "ranks/rank3dbf8e94a6f72.gif"
49 -
50  rank_id: 3
51  rank_title: "{$lang_rank_titles[3]}"
52  rank_min: 41
53  rank_max: 70
54  rank_special: 0
55  rank_image: "ranks/rank3dbf8e9e7d88d.gif"
56 -
57  rank_id: 4
58  rank_title: "{$lang_rank_titles[4]}"
59  rank_min: 71
60  rank_max: 150
61  rank_special: 0
62  rank_image: "ranks/rank3dbf8ea81e642.gif"
63 -
64  rank_id: 5
65  rank_title: "{$lang_rank_titles[5]}"
66  rank_min: 151
67  rank_max: 10000
68  rank_special: 0
69  rank_image: "ranks/rank3dbf8eb1a72e7.gif"
70 -
71  rank_id: 6
72  rank_title: "{$lang_rank_titles[6]}"
73  rank_min: 0
74  rank_max: 0
75  rank_special: 1
76  rank_image: "ranks/rank3dbf8edf15093.gif"
77 -
78  rank_id: 7
79  rank_title: "{$lang_rank_titles[7]}"
80  rank_min: 0
81  rank_max: 0
82  rank_special: 1
83  rank_image: "ranks/rank3dbf8ee8681cd.gif"
84 EOT;
85 
86  $tablerows = Yaml::load($filedata);
87 
88  $dbm = $xoops->db();
89  $count = $dbm->fetchColumn('SELECT COUNT(*) FROM ' . $dbm->prefix("ranks"));
90  if ($count<1) {
91  $dbm->beginTransaction();
92  foreach ($tablerows as $row) {
93  $dbm->insertPrefix('ranks', $row);
94  }
95  $dbm->commit();
96  }
97  return true;
98 }
const _MI_RANK_TITLE_5
Definition: modinfo.php:37
xoops_module_install_userrank($module)
Definition: install.php:20
const _MI_RANK_TITLE_7
Definition: modinfo.php:39
const _MI_RANK_TITLE_2
Definition: modinfo.php:34
static getInstance()
Definition: Xoops.php:160
const _MI_RANK_TITLE_3
Definition: modinfo.php:35
$xoops
Definition: admin.php:25
$module
Definition: main.php:52
const _MI_RANK_TITLE_4
Definition: modinfo.php:36
const _MI_RANK_TITLE_1
Definition: modinfo.php:33
const _MI_RANK_TITLE_6
Definition: modinfo.php:38