C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\xoops\html\_install\makedata.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
// $Id: makedata.php,v 1.20.24.8 2005/07/15 01:41:16 phppp Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <http://www.xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //

include_once './class/dbmanager.php';

// RMV
// TODO: Shouldn't we insert specific field names??  That way we can use
// the defaults specified in the database...!!!! (and don't have problem
// of missing fields in install file, when add new fields to database)

function make_groups(&$dbm){
    
$gruops['XOOPS_GROUP_ADMIN'] = $dbm->insert('groups'" VALUES (0, '".addslashes(_INSTALL_WEBMASTER)."', '".addslashes(_INSTALL_WEBMASTERD)."', 'Admin')");
    
$gruops['XOOPS_GROUP_USERS'] = $dbm->insert('groups'" VALUES (0, '".addslashes(_INSTALL_REGUSERS)."', '".addslashes(_INSTALL_REGUSERSD)."', 'User')");
    
$gruops['XOOPS_GROUP_ANONYMOUS'] = $dbm->insert('groups'" VALUES (0, '".addslashes(_INSTALL_ANONUSERS)."', '".addslashes(_INSTALL_ANONUSERSD)."', 'Anonymous')");

    if(!
$gruops['XOOPS_GROUP_ADMIN'] || !$gruops['XOOPS_GROUP_USERS'] || !$gruops['XOOPS_GROUP_ANONYMOUS']){
        return 
false;
    }

    return 
$gruops;
}

function 
make_data(&$dbm, &$cm$adminname$adminpass$adminmail$language$gruops){

    
$myts =& textSanitizer::getInstance();
    
//$xoopsDB =& Database::getInstance();
    //$dbm = new db_manager;

    
$tables = array();

    
// data for table 'groups_users_link'

    
$dbm->insert('groups_users_link'" VALUES (0, ".$gruops['XOOPS_GROUP_ADMIN'].", 1)");
    
$dbm->insert('groups_users_link'" VALUES (0, ".$gruops['XOOPS_GROUP_USERS'].", 1)");

    
// data for table 'group_permission'

    
$dbm->insert("group_permission"" VALUES (0,".$gruops['XOOPS_GROUP_ADMIN'].",1,1,'module_admin')");
    
$dbm->insert("group_permission"" VALUES (0,".$gruops['XOOPS_GROUP_ADMIN'].",1,1, 'module_read')");
    
$dbm->insert("group_permission"" VALUES (0,".$gruops['XOOPS_GROUP_USERS'].",1,1,'module_read')");
    
$dbm->insert("group_permission"" VALUES (0,".$gruops['XOOPS_GROUP_ANONYMOUS'].",1,1,'module_read')");

    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",1,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",2,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",3,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",4,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",5,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",6,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",7,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",8,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",9,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",10,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",11,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",12,1,'system_admin')");
   
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",13,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",14,1,'system_admin')");
    
$dbm->insert("group_permission"" VALUES(0,".$gruops['XOOPS_GROUP_ADMIN'].",15,1,'system_admin')");

    
// data for table 'banner'

    
$dbm->insert("banner"" (bid, cid, imptotal, impmade, clicks, imageurl, clickurl, date) VALUES (1, 1, 0, 1, 0, '".XOOPS_URL."/images/banners/xoops_banner.gif', 'http://www.xoops.org/', 1008813250)");
    
$dbm->insert("banner"" (bid, cid, imptotal, impmade, clicks, imageurl, clickurl, date) VALUES (2, 1, 0, 1, 0, '".XOOPS_URL."/images/banners/xoops_banner_2.gif', 'http://www.xoops.org/', 1008813250)");
    
$dbm->insert("banner"" (bid, cid, imptotal, impmade, clicks, imageurl, clickurl, date) VALUES (3, 1, 0, 1, 0, '".XOOPS_URL."/images/banners/banner.swf', 'http://www.xoops.org/', 1008813250)");

    
// default theme

    
$time time();
    
$dbm->insert('tplset'" VALUES (1, 'default', 'XOOPS Default Template Set', '', ".$time.")");

    
// system modules

    
if ( file_exists('../modules/system/language/'.$language.'/modinfo.php') ) {
        include 
'../modules/system/language/'.$language.'/modinfo.php';
    } else {
        include 
'../modules/system/language/english/modinfo.php';
        
$language 'english';
    }

    
$modversion = array();
    include_once 
'../modules/system/xoops_version.php';
    
$time time();

    
// data for table 'users'

    /*
    $temp = md5($adminpass);
    $regdate = time();
    //$dbadminname= addslashes($adminname);
    // RMV-NOTIFY (updated for extra columns in user table)
    $member_handler =& xoops_gethandler('member');
    $user =& $member_handler->createUser();
    $user->setVar('uid', 1);
    $user->setVar('uname', addslashes($adminname));
    $user->setVar('name', addslashes($adminname)); //set real name to username for now
    $user->setVar('email', addslashes($adminmail));
    $user->setVar('user_avatar', 'blank.gif');
    $user->setVar('pass', $temp);
    $user->setVar('rank', 7);
    $user->setVar('level', 5);
    if (!$member_handler->insertUser($user)) {
        echo $user->getHtmlErrors();
    }
    */

    
return $gruops;
}
?>