15include_once
'./class/dbmanager.php';
22function make_groups( &$dbm ) {
24 $gruops[
'XOOPS_GROUP_ADMIN'] = $dbm->insert(
'groups',
" VALUES (0, '" . addslashes( _INSTALL_WEBMASTER ) .
"', '" . addslashes( _INSTALL_WEBMASTERD ) .
"', 'Admin')" );
25 $gruops[
'XOOPS_GROUP_USERS'] = $dbm->insert(
'groups',
" VALUES (0, '" . addslashes( _INSTALL_REGUSERS ) .
"', '" . addslashes( _INSTALL_REGUSERSD ) .
"', 'User')" );
26 $gruops[
'XOOPS_GROUP_ANONYMOUS'] = $dbm->insert(
'groups',
" VALUES (0, '" . addslashes( _INSTALL_ANONUSERS ) .
"', '" . addslashes( _INSTALL_ANONUSERSD ) .
"', 'Anonymous')" );
28 if ( ! $gruops[
'XOOPS_GROUP_ADMIN'] || ! $gruops[
'XOOPS_GROUP_USERS'] || ! $gruops[
'XOOPS_GROUP_ANONYMOUS'] ) {
35function make_data( &$dbm, &$cm, $adminname, $adminpass, $adminmail, $language, $gruops, $timezone ) {
40 $dbm->insert(
'banner',
" (bid, cid, imptotal, impmade, clicks, imageurl, clickurl, date, htmlcode) VALUES (1, 1, 0, 1, 0, '" . XOOPS_URL .
"/images/banners/banner.png', 'https://github.com/xoopscube/legacy', 1008813250, '')" );
45 $dbm->insert(
'tplset',
" VALUES (1, 'default', 'Default Template Set', '', " . $time .
')' );
49 $dbm->insert(
'config',
" VALUES (1, 0, 1, 'sitename', '_MD_AM_SITENAME', 'Web Application Platform', '_MD_AM_SITENAMEDSC', 'textbox', 'text', 0)" );
50 $dbm->insert(
'config',
" VALUES (2, 0, 1, 'slogan', '_MD_AM_SLOGAN', 'Just Use it!', '_MD_AM_SLOGANDSC', 'textbox', 'text', 2)" );
51 $dbm->insert(
'config',
" VALUES (3, 0, 1, 'language', '_MD_AM_LANGUAGE', '" . addslashes( $language ) .
"', '_MD_AM_LANGUAGEDSC', 'language', 'other', 4)" );
52 $dbm->insert(
'config',
" VALUES (4, 0, 1, 'startpage', '_MD_AM_STARTPAGE', '--', '_MD_AM_STARTPAGEDSC', 'startpage', 'other', 6)" );
55 date_default_timezone_set( $timezone );
57 $time_diff_val = date(
'O' );
58 $time_diff = (float) ( $time_diff_val[0] . ( substr( $time_diff_val, 1, 2 ) + substr( $time_diff_val, 3, 2 ) / 60 ) );
59 $dbm->insert(
'config',
" VALUES (5, 0, 1, 'server_TZ', '_MD_AM_SERVERTZ', '" . $time_diff .
"', '_MD_AM_SERVERTZDSC', 'timezone', 'float', 8)" );
60 $dbm->insert(
'config',
" VALUES (6, 0, 1, 'default_TZ', '_MD_AM_DEFAULTTZ', '" . $time_diff .
"', '_MD_AM_DEFAULTTZDSC', 'timezone', 'float', 10)" );
61 $dbm->insert(
'config',
" VALUES (7, 0, 1, 'theme_set', '_MD_AM_DTHEME', 'xcl_default', '_MD_AM_DTHEMEDSC', 'theme', 'other', 12)" );
62 $dbm->insert(
'config',
" VALUES (8, 0, 1, 'anonymous', '_MD_AM_ANONNAME', '" . addslashes( _INSTALL_ANON ) .
"', '_MD_AM_ANONNAMEDSC', 'textbox', 'text', 15)" );
63 $dbm->insert(
'config',
" VALUES (9, 0, 1, 'gzip_compression', '_MD_AM_USEGZIP', '0', '_MD_AM_USEGZIPDSC', 'yesno', 'int', 16)" );
64 $dbm->insert(
'config',
" VALUES (11, 0, 1, 'session_expire', '_MD_AM_SESSEXPIRE', '15', '_MD_AM_SESSEXPIREDSC', 'textbox', 'int', 22)" );
65 $dbm->insert(
'config',
" VALUES (13, 0, 1, 'debug_mode', '_MD_AM_DEBUGMODE', '1', '_MD_AM_DEBUGMODEDSC', 'select', 'int', 24)" );
66 $dbm->insert(
'config',
" VALUES (14, 0, 1, 'my_ip', '_MD_AM_MYIP', '127.0.0.1', '_MD_AM_MYIPDSC', 'textbox', 'text', 29)" );
67 $dbm->insert(
'config',
" VALUES (15, 0, 1, 'use_ssl', '_MD_AM_USESSL', '0', '_MD_AM_USESSLDSC', 'yesno', 'int', 30)" );
68 $dbm->insert(
'config',
" VALUES (16, 0, 1, 'session_name', '_MD_AM_SESSNAME', 'xcl_wap_session', '_MD_AM_SESSNAMEDSC', 'textbox', 'text', 20)" );
69 $dbm->insert(
'config',
" VALUES (30, 0, 1, 'adminmail', '_MD_AM_ADMINML', '" . addslashes( $adminmail ) .
"', '_MD_AM_ADMINMLDSC', 'textbox', 'text', 3)" );
70 $dbm->insert(
'config',
" VALUES (32, 0, 1, 'com_mode', '_MD_AM_COMMODE', 'nest', '_MD_AM_COMMODEDSC', 'select', 'text', 34)" );
71 $dbm->insert(
'config',
" VALUES (33, 0, 1, 'com_order', '_MD_AM_COMORDER', '0', '_MD_AM_COMORDERDSC', 'select', 'int', 36)" );
72 $dbm->insert(
'config',
" VALUES (37, 0, 1, 'bad_ips', '_MD_AM_BADIPS', '" . addslashes( serialize( [
'127.0.0.1' ] ) ) .
"', '_MD_AM_BADIPSDSC', 'textarea', 'array', 42)" );
73 $dbm->insert(
'config',
" VALUES (40, 0, 4, 'censor_enable', '_MD_AM_DOCENSOR', '0', '_MD_AM_DOCENSORDSC', 'yesno', 'int', 0)" );
74 $dbm->insert(
'config',
" VALUES (41, 0, 4, 'censor_words', '_MD_AM_CENSORWRD', '" . addslashes( serialize( [
77 ] ) ) .
"', '_MD_AM_CENSORWRDDSC', 'textarea', 'array', 1)" );
78 $dbm->insert(
'config',
" VALUES (42, 0, 4, 'censor_replace', '_MD_AM_CENSORRPLC', '#OOPS#', '_MD_AM_CENSORRPLCDSC', 'textbox', 'text', 2)" );
79 $dbm->insert(
'config',
" VALUES (44, 0, 5, 'enable_search', '_MD_AM_DOSEARCH', '1', '_MD_AM_DOSEARCHDSC', 'yesno', 'int', 0)" );
80 $dbm->insert(
'config',
" VALUES (45, 0, 5, 'keyword_min', '_MD_AM_MINSEARCH', '5', '_MD_AM_MINSEARCHDSC', 'textbox', 'int', 1)" );
81 $dbm->insert(
'config',
" VALUES (47, 0, 1, 'enable_badips', '_MD_AM_DOBADIPS', '0', '_MD_AM_DOBADIPSDSC', 'yesno', 'int', 40)" );
82 $dbm->insert(
'config',
" VALUES (48, 0, 1, 'cool_uri', '_MD_AM_COOLURI', '0', '_MD_AM_COOLURIDSC', 'yesno', 'int', 17)" );
83 $dbm->insert(
'config',
" VALUES (53, 0, 1, 'use_mysession', '_MD_AM_USEMYSESS', '0', '_MD_AM_USEMYSESSDSC', 'yesno', 'int', 19)" );
84 $dbm->insert(
'config',
" VALUES (57, 0, 1, 'theme_fromfile', '_MD_AM_THEMEFILE', '1', '_MD_AM_THEMEFILEDSC', 'yesno', 'int', 13)" );
85 $dbm->insert(
'config',
" VALUES (58, 0, 1, 'closesite', '_MD_AM_CLOSESITE', '1', '_MD_AM_CLOSESITEDSC', 'yesno', 'int', 26)" );
86 $dbm->insert(
'config',
" VALUES (59, 0, 1, 'closesite_okgrp', '_MD_AM_CLOSESITEOK', '" . addslashes( serialize( [
'1' ] ) ) .
"', '_MD_AM_CLOSESITEOKDSC', 'group_multi', 'array', 27)" );
87 $dbm->insert(
'config',
" VALUES (60, 0, 1, 'closesite_text', '_MD_AM_CLOSESITETXT', '" . _INSTALL_L165 .
"', '_MD_AM_CLOSESITETXTDSC', 'textarea', 'text', 28)" );
88 $dbm->insert(
'config',
" VALUES (61, 0, 1, 'sslpost_name', '_MD_AM_SSLPOST', 'wap_ssl', '_MD_AM_SSLPOSTDSC', 'textbox', 'text', 31)" );
89 $dbm->insert(
'config',
" VALUES (62, 0, 1, 'module_cache', '_MD_AM_MODCACHE', '', '_MD_AM_MODCACHEDSC', 'module_cache', 'array', 50)" );
90 $dbm->insert(
'config',
" VALUES (63, 0, 1, 'template_set', '_MD_AM_DTPLSET', 'default', '_MD_AM_DTPLSETDSC', 'tplset', 'other', 14)" );
92 $dbm->insert(
'config',
" VALUES (64,0,6,'mailmethod','_MD_AM_MAILERMETHOD','mail','_MD_AM_MAILERMETHODDESC','select','text',4)" );
93 $dbm->insert(
'config',
" VALUES (65,0,6,'smtphost','_MD_AM_SMTPHOST','a:1:{i:0;s:0:\"\";}', '_MD_AM_SMTPHOSTDESC','textarea','array',6)" );
94 $dbm->insert(
'config',
" VALUES (66,0,6,'smtpuser','_MD_AM_SMTPUSER','','_MD_AM_SMTPUSERDESC','textbox','text',7)" );
95 $dbm->insert(
'config',
" VALUES (67,0,6,'smtppass','_MD_AM_SMTPPASS','','_MD_AM_SMTPPASSDESC','password','text',8)" );
96 $dbm->insert(
'config',
" VALUES (68,0,6,'sendmailpath','_MD_AM_SENDMAILPATH','/usr/sbin/sendmail','_MD_AM_SENDMAILPATHDESC','textbox','text',5)" );
97 $dbm->insert(
'config',
" VALUES (69,0,6,'from','_MD_AM_MAILFROM','','_MD_AM_MAILFROMDESC','textbox','text', 1)" );
98 $dbm->insert(
'config',
" VALUES (70,0,6,'fromname','_MD_AM_MAILFROMNAME','','_MD_AM_MAILFROMNAMEDESC','textbox','text',2)" );
99 $dbm->insert(
'config',
" VALUES (71,0,1,'sslloginlink', '_MD_AM_SSLLINK', 'https://', '_MD_AM_SSLLINKDSC', 'textbox', 'text', 33)" );
100 $dbm->insert(
'config',
" VALUES (72,0,1,'theme_set_allowed', '_MD_AM_THEMEOK', '" . serialize( [
'xcl_default',
'bs5-starter' ] ) .
"', '_MD_AM_THEMEOKDSC', 'theme_multi', 'array', 13)" );
102 $dbm->insert(
'config',
" VALUES (73,0,6,'fromuid','_MD_AM_MAILFROMUID','1','_MD_AM_MAILFROMUIDDESC','user','int',3)" );
105 $temp = md5( $adminpass );
107 $dbm->insert(
'users',
" VALUES (1,'','" . addslashes( $adminname ) .
"','" . addslashes( $adminmail ) .
"','" . XOOPS_URL .
"/','blank.gif','" . $regdate .
"','','','',1,'','','','','" . $temp .
"',0,0,7,5,'xcl_default','" . $time_diff .
"'," . time() .
",'thread',0,1,0,'','','',0)" );
111 $dbm->insert(
'groups_users_link',
' VALUES (0, ' . $gruops[
'XOOPS_GROUP_ADMIN'] .
', 1)' );
112 $dbm->insert(
'groups_users_link',
' VALUES (0, ' . $gruops[
'XOOPS_GROUP_USERS'] .
', 1)' );
132function installModule( &$dbm, $mid, $module, $module_name, $language =
'english', &$groups ) {
133 if ( file_exists(
"../modules/{$module}/language/{$language}/modinfo.php" ) ) {
134 include
"../modules/{$module}/language/{$language}/modinfo.php";
136 include
"../modules/{$module}/language/english/modinfo.php";
137 $language =
'english';
141 require_once
"../modules/{$module}/xoops_version.php";
148 $hasconfig = isset( $modversion[
'config'] ) ? 1 : 0;
150 if ( isset( $modversion[
'hasMain'] ) && ( 1 === $modversion[
'hasMain'] ) ) {
153 $dbm->insert(
'modules',
" VALUES ({$mid}, '" . constant( $module_name ) .
"', 100, " . $time .
", 0, 1, '{$module}', {$hasmain}, 1, 0, {$hasconfig}, 0, 0)" );
159 if ( isset( $modversion[
'sqlfile'][
'mysql'] ) ) {
160 $dbm->queryFromFile(
"../modules/{$module}/" . $modversion[
'sqlfile'][
'mysql'] );
163 if ( is_array( $modversion[
'templates'] ) && count( $modversion[
'templates'] ) > 0 ) {
164 foreach ( $modversion[
'templates'] as $tplfile ) {
165 if ( $fp = fopen(
"../modules/{$module}/templates/" . $tplfile[
'file'],
'r' ) ) {
166 $newtplid = $dbm->insert(
'tplfile',
" VALUES (0, {$mid}, '{$module}', 'default', '" . addslashes( $tplfile[
'file'] ) .
"', '" . addslashes( $tplfile[
'description'] ) .
"', " . $time .
', ' . $time .
", 'module')" );
168 if ( filesize(
"../modules/{$module}/templates/" . $tplfile[
'file'] ) > 0 ) {
169 $tplsource = fread( $fp, filesize(
"../modules/{$module}/templates/" . $tplfile[
'file'] ) );
174 $dbm->insert(
'tplsource',
' (tpl_id, tpl_source) VALUES (' . $newtplid .
", '" . addslashes( $tplsource ) .
"')" );
179 if ( is_array( $modversion[
'blocks'] ) && count( $modversion[
'blocks'] ) > 0 ) {
180 foreach ( $modversion[
'blocks'] as $func_num => $newblock ) {
181 if ( $fp = fopen(
'../modules/{$module}/templates/blocks/' . $newblock[
'template'],
'rb' ) ) {
185 if ( in_array( $newblock[
'template'], [
186 'system_block_user.html',
187 'system_block_login.html',
188 'system_block_mainmenu.html'
194 $options = ! isset( $newblock[
'options'] ) ?
'' : trim( $newblock[
'options'] );
195 $edit_func = ! isset( $newblock[
'edit_func'] ) ?
'' : trim( $newblock[
'edit_func'] );
196 $newbid = $dbm->insert(
'newblocks',
" VALUES (0, {$mid}, " . $func_num .
", '" . addslashes( $options ) .
"', '" . addslashes( $newblock[
'name'] ) .
"', '" . addslashes( $newblock[
'name'] ) .
"', '', 0, 0, " . $visible .
", 'S', 'H', 1, '{$module}', '" . addslashes( $newblock[
'file'] ) .
"', '" . addslashes( $newblock[
'show_func'] ) .
"', '" . addslashes( $edit_func ) .
"', '" . addslashes( $newblock[
'template'] ) .
"', 0, " . $time .
')'
199 $newtplid = $dbm->insert(
'tplfile',
' VALUES (0, ' . $newbid .
", '{$module}', 'default', '" . addslashes( $newblock[
'template'] ) .
"', '" . addslashes( $newblock[
'description'] ) .
"', " . $time .
', ' . $time .
", 'block')" );
201 if ( filesize(
"../modules/{$module}/templates/blocks/" . $newblock[
'template'] ) > 0 ) {
202 $tplsource = fread( $fp, filesize(
"../modules/{$module}/templates/blocks/" . $newblock[
'template'] ) );
207 $dbm->insert(
'tplsource',
' (tpl_id, tpl_source) VALUES (' . $newtplid .
", '" . addslashes( $tplsource ) .
"')" );
209 $dbm->insert(
'group_permission',
' VALUES (0, ' . $groups[
'XOOPS_GROUP_ADMIN'] .
', ' . $newbid .
", 1, 'block_read')" );
211 $dbm->insert(
'group_permission',
' VALUES (0, ' . $groups[
'XOOPS_GROUP_USERS'] .
', ' . $newbid .
", 1, 'block_read')" );
212 $dbm->insert(
'group_permission',
' VALUES (0, ' . $groups[
'XOOPS_GROUP_ANONYMOUS'] .
', ' . $newbid .
", 1, 'block_read')" );
220 if ( isset( $modversion[
'config'] ) ) {
222 foreach ( $modversion[
'config'] as $configInfo ) {
226 $name = $configInfo[
'name'];
227 $title = $configInfo[
'title'];
228 $desc = $configInfo[
'description'];
229 $formtype = $configInfo[
'formtype'];
230 $valuetype = $configInfo[
'valuetype'];
231 $default = $configInfo[
'default'];
233 if (
'array' == $valuetype ) {
234 $default = serialize( explode(
'|', trim( $default ) ) );
237 $conf_id = $dbm->insert(
'config',
" VALUES (0, {$mid}, 0, '{$name}', '{$title}', '{$default}', '{$desc}', '{$formtype}', '{$valuetype}', {$count})" );
239 if ( isset( $configInfo[
'options'] ) && is_array( $configInfo[
'options'] ) ) {
240 foreach ( $configInfo[
'options'] as $key => $value ) {
241 $dbm->insert(
'configoption',
" VALUES (0, '{$key}', '{$value}', {$conf_id})" );