equal
deleted
inserted
replaced
87 return $site_key; |
87 return $site_key; |
88 } |
88 } |
89 |
89 |
90 function stg_load_schema() |
90 function stg_load_schema() |
91 { |
91 { |
92 global $db, $dbdriver, $installer_version; |
92 global $db, $dbdriver, $installer_version, $lang_id, $languages; |
93 static $sql_parser = false; |
93 static $sql_parser = false; |
94 |
94 |
95 if ( is_object($sql_parser) ) |
95 if ( is_object($sql_parser) ) |
96 return $sql_parser->parse(); |
96 return $sql_parser->parse(); |
97 |
97 |
111 catch ( Exception $e ) |
111 catch ( Exception $e ) |
112 { |
112 { |
113 echo "<pre>$e</pre>"; |
113 echo "<pre>$e</pre>"; |
114 return false; |
114 return false; |
115 } |
115 } |
|
116 |
|
117 $wkt = ENANO_ROOT . "/language/{$languages[$lang_id]['dir']}/install/mainpage-default.wkt"; |
|
118 if ( !file_exists( $wkt ) ) |
|
119 { |
|
120 echo '<div class="error-box">Error: could not locate wikitext for main page (' . $wkt . ')</div>'; |
|
121 return false; |
|
122 } |
|
123 $wkt = @file_get_contents($wkt); |
|
124 if ( empty($wkt) ) |
|
125 return false; |
|
126 |
|
127 $wkt = $db->escape($wkt); |
116 |
128 |
117 $vars = array( |
129 $vars = array( |
118 'TABLE_PREFIX' => $_POST['table_prefix'], |
130 'TABLE_PREFIX' => $_POST['table_prefix'], |
119 'SITE_NAME' => $db->escape($_POST['site_name']), |
131 'SITE_NAME' => $db->escape($_POST['site_name']), |
120 'SITE_DESC' => $db->escape($_POST['site_desc']), |
132 'SITE_DESC' => $db->escape($_POST['site_desc']), |
126 'ADMIN_USER' => $db->escape($_POST['username']), |
138 'ADMIN_USER' => $db->escape($_POST['username']), |
127 'ADMIN_PASS' => $admin_pass, |
139 'ADMIN_PASS' => $admin_pass, |
128 'ADMIN_EMAIL' => $db->escape($_POST['email']), |
140 'ADMIN_EMAIL' => $db->escape($_POST['email']), |
129 'REAL_NAME' => '', // This has always been stubbed. |
141 'REAL_NAME' => '', // This has always been stubbed. |
130 'ADMIN_EMBED_PHP' => strval(AUTH_DISALLOW), |
142 'ADMIN_EMBED_PHP' => strval(AUTH_DISALLOW), |
131 'UNIX_TIME' => strval(time()) |
143 'UNIX_TIME' => strval(time()), |
|
144 'MAIN_PAGE_CONTENT' => $wkt |
132 ); |
145 ); |
133 |
146 |
134 $sql_parser->assign_vars($vars); |
147 $sql_parser->assign_vars($vars); |
135 return $sql_parser->parse(); |
148 return $sql_parser->parse(); |
136 } |
149 } |
277 # Don't rewrite if the user requested a real directory or file |
290 # Don't rewrite if the user requested a real directory or file |
278 RewriteCond %{REQUEST_FILENAME} !-f |
291 RewriteCond %{REQUEST_FILENAME} !-f |
279 RewriteCond %{REQUEST_FILENAME} !-d |
292 RewriteCond %{REQUEST_FILENAME} !-d |
280 |
293 |
281 # Main rule - short and sweet |
294 # Main rule - short and sweet |
282 RewriteRule (.*) index.php?title=\$1 |
295 RewriteRule (.*) index.php?title=\$1 [L,QSA] |
283 |
296 |
284 EOF; |
297 EOF; |
285 fwrite($hh, $hhc); |
298 fwrite($hh, $hhc); |
286 fclose($hh); |
299 fclose($hh); |
287 } |
300 } |
308 $lang_local->import( ENANO_ROOT . "/language/{$lang_info['dir']}/tools.json" ); |
321 $lang_local->import( ENANO_ROOT . "/language/{$lang_info['dir']}/tools.json" ); |
309 $lang_local->import( ENANO_ROOT . "/language/{$lang_info['dir']}/admin.json" ); |
322 $lang_local->import( ENANO_ROOT . "/language/{$lang_info['dir']}/admin.json" ); |
310 |
323 |
311 return true; |
324 return true; |
312 } |
325 } |
|
326 |
|
327 function stg_init_logs() |
|
328 { |
|
329 global $db, $session, $paths, $template, $plugins; // Common objects |
|
330 global $installer_version; |
|
331 |
|
332 $q = $db->sql_query('INSERT INTO ' . table_prefix . 'logs(log_type,action,time_id,date_string,author,page_text,edit_summary) VALUES(\'security\', \'install_enano\', ' . time() . ', \'' . enano_date('d M Y h:i a') . '\', \'' . $db->escape($_POST['admin_user']) . '\', \'' . $db->escape(enano_version()) . '\', \'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\');'); |
|
333 if ( !$q ) |
|
334 { |
|
335 echo '<p><tt>MySQL return: ' . $db->sql_error() . '</tt></p>'; |
|
336 return false; |
|
337 } |
|
338 |
|
339 return true; |
|
340 } |
|
341 |