XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
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 */
29 require_once './include/common.inc.php';
30 defined('XOOPS_INSTALL') or die('XOOPS Installation wizard die');
31 
33 $pageHasHelp = false;
34 
35 $vars =& $_SESSION['settings'];
36 
37 include_once "../mainfile.php";
38 include_once './class/dbmanager.php';
39 $dbm = new db_manager();
40 
41 if (!$dbm->isConnectable()) {
42  $wizard->redirectToPage('dbsettings');
43  exit();
44 }
45 $res = $dbm->query("SELECT COUNT(*) FROM " . $dbm->db->prefix("users"));
46 if (!$res) {
47  $wizard->redirectToPage('dbsettings');
48  exit();
49 }
50 
51 list ($count) = $dbm->db->fetchRow( $res );
52 $process = $count ? '' : 'insert';
53 $update = false;
54 
55 extract($_SESSION['siteconfig'], EXTR_SKIP);
56 if ($state = xoDiagIfWritable('include/license.php')) {
57  if (!is_writable('../include/license.php')) {
58  }
59 }
60 
61 if ($process && is_writable('../include/license.php')) {
62  include_once './include/makedata.php';
63  //$cm = 'dummy';
64  $wizard->loadLangFile('install2');
65  $language = $wizard->language;
66 
67  $result = $dbm->queryFromFile('./sql/' . XOOPS_DB_TYPE . '.data.sql');
68  $result = $dbm->queryFromFile('./language/' . $language . '/' . XOOPS_DB_TYPE . '.lang.data.sql');
69  $group = make_groups( $dbm );
70  $result = make_data( $dbm, $adminname, $adminpass, $adminmail, $language, $group );
71  $content = '<div class="x2-note successMsg">' . DATA_INSERTED . "</div><br />" . $dbm->report();
72  // Writes License Key
73  $content .= '<div class="x2-note successMsg">' . sprintf(LICENSE_IS_WRITEABLE, $state) . "</div>";
74  $content .= '<div class="x2-note successMsg">' . write_key() . "</div><br />";
75 } else if ($update) {
76  $sql = "UPDATE " . $dbm->db->prefix("users") . " SET `uname` = '" . addslashes($adminname) . "', `email` = '" . addslashes($adminmail) . "', `user_regdate` = '" . time() . "', `pass` = '" . md5($adminpass) . "', `last_login` = '" . time() . "' WHERE uid = 1";
77  $dbm->db->queryF($sql);
78  $content = '';
79 } else if ( !is_writable( '../include/license.php' ) ) {
80  include_once './include/makedata.php';
81  //$cm = 'dummy';
82  $wizard->loadLangFile('install2');
83 
84  $content .= '<div class="x2-note errorMsg">' . sprintf(LICENSE_NOT_WRITEABLE, $state) . "</div>";
85 } else {
86  $content = "<div class='x2-note confirmMsg'>" . DATA_ALREADY_INSERTED . "</div>";
87 }
88 
89 setcookie('xo_install_user', '', null, null, null);
90 if (!empty( $_SESSION['settings']['authorized'] ) && !empty($adminname) && !empty($adminpass)) {
91  setcookie('xo_install_user', addslashes($adminname) . '-' . md5(md5($adminpass) . XOOPS_DB_NAME . XOOPS_DB_PASS . XOOPS_DB_PREFIX), null, null, null);
92 }
93 
94 include './include/install_tpl.php';
95 ?>