XOOPS  2.6.0
page_tablesfill.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 
27 require_once __DIR__ . '/include/common.inc.php';
28 
29 
31 
32 // setup legacy db support
34 
35 /* @var $wizard XoopsInstallWizard */
36 $wizard = $_SESSION['wizard'];
37 
38 $settings = $_SESSION['settings'];
39 
40 $language = $wizard->language;
41 $xoops->setConfig('locale', $language);
42 $xoops->loadLocale();
43 
44 $dbm = $xoops->db();
45 $count = $dbm->fetchColumn('SELECT COUNT(*) FROM ' . $dbm->prefix("users"));
46 $process = $count ? false : true;
47 $update = false;
48 
49 $siteconfig = $_SESSION['siteconfig'];
50 $adminname = $siteconfig['adminname'];
51 $adminpass = $siteconfig['adminpass'];
52 $adminmail = $siteconfig['adminmail'];
53 
54 
55 $wizard->loadLangFile('install2');
56 $temp = password_hash($adminpass, PASSWORD_DEFAULT);
57 $regdate = time();
58 if ($process) {
59  $dbm->insertPrefix(
60  'users',
61  array(
62  //'uid' => 1, // mediumint(8) unsigned NOT NULL auto_increment,
63  'name' => '', // varchar(60) NOT NULL default '',
64  'uname' => $adminname, // varchar(25) NOT NULL default '',
65  'email' => $adminmail, // varchar(60) NOT NULL default '',
66  'url' => XOOPS_URL, // varchar(100) NOT NULL default '',
67  'user_avatar' => 'blank.gif', // varchar(30) NOT NULL default 'blank.gif',
68  'user_regdate' => $regdate, // int(10) unsigned NOT NULL default '0',
69  'user_icq' => '', // varchar(15) NOT NULL default '',
70  'user_from' => '', // varchar(100) NOT NULL default '',
71  'user_sig' => '', // tinytext,
72  'user_viewemail' => 1, // tinyint(1) unsigned NOT NULL default '0',
73  'actkey' => '', // varchar(8) NOT NULL default '',
74  'user_aim' => '', // varchar(18) NOT NULL default '',
75  'user_yim' => '', // varchar(25) NOT NULL default '',
76  'user_msnm' => '', // varchar(100) NOT NULL default '',
77  'pass' => $temp, // varchar(255) NOT NULL default '',
78  'posts' => 0, // mediumint(8) unsigned NOT NULL default '0',
79  'attachsig' => 0, // tinyint(1) unsigned NOT NULL default '0',
80  'rank' => 7, // smallint(5) unsigned NOT NULL default '0',
81  'level' => 5, // tinyint(3) unsigned NOT NULL default '1',
82  'theme' => 'default', // varchar(100) NOT NULL default '',
83  'timezone_offset' => 0.0, // float(3,1) NOT NULL default '0.0',
84  'last_login' => $regdate, // int(10) unsigned NOT NULL default '0',
85  'umode' => 'flat', // varchar(10) NOT NULL default '',
86  'uorder' => 0, // tinyint(1) unsigned NOT NULL default '0',
87  'notify_method' => 1, // tinyint(1) NOT NULL default '1',
88  'notify_mode' => 0, // tinyint(1) NOT NULL default '0',
89  'user_occ' => '', // varchar(100) NOT NULL default '',
90  'bio' => '', // tinytext,
91  'user_intrest' => '', // varchar(150) NOT NULL default '',
92  'user_mailok' => 0, // tinyint(1) unsigned NOT NULL default '1',
93  )
94  );
95  $content = '<div class="x2-note successMsg">' . DATA_INSERTED . '</div>';
96 } elseif ($update) {
97  $dbm->updatePrefix(
98  'user',
99  array(
100  'uname' => $adminname,
101  'email' => $adminmail,
102  'user_regdate' => $regdate,
103  'pass' => $temp,
104  'last_login' => $regdate,
105  ),
106  array(
107  'id' => 1,
108  )
109  );
110  $content = '';
111 } else {
112  $content = "<div class='x2-note confirmMsg'>" . DATA_ALREADY_INSERTED . "</div>";
113 }
114 
115 setcookie('xo_install_user', '', null, null, null);
116 if (isset( $settings['authorized'] ) && !empty($adminname) && !empty($adminpass)) {
117  setcookie(
118  'xo_install_user',
119  addslashes($adminname) . '-' . md5($temp . XOOPS_DB_NAME . XOOPS_DB_PASS . XOOPS_DB_PREFIX),
120  null,
121  null,
122  null
123  );
124 }
125 
126 $_SESSION['pageHasHelp'] = false;
127 $_SESSION['pageHasForm'] = false;
128 $_SESSION['content'] = $content;
129 include XOOPS_INSTALL_PATH . '/include/install_tpl.php';
$language
const DATA_ALREADY_INSERTED
Definition: install.php:141
static getInstance()
Definition: Xoops.php:160
$siteconfig
if(isset($settings['authorized'])&&!empty($adminname)&&!empty($adminpass)) $_SESSION['pageHasHelp']
$settings
$GLOBALS['xoopsDB']
const XOOPS_DB_NAME
Definition: secure.dist.php:42
const XOOPS_DB_PASS
Definition: secure.dist.php:38
const XOOPS_INSTALL_PATH
Definition: common.inc.php:33
$regdate
$adminname
const XOOPS_DB_PREFIX
Definition: secure.dist.php:26
$process
const DATA_INSERTED
Definition: install.php:142
$adminpass
$adminmail