Changeset 1661 in ExiteCMS for trunk/setup.php
- Timestamp:
- 08/21/08 18:31:24 (4 years ago)
- File:
-
- 1 edited
-
trunk/setup.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/setup.php
r1660 r1661 113 113 $locales_file = PATH_ROOT."files/locales/".(defined('LP_LOCALE')?LP_LOCALE:"en").".".$locale_name.".php"; 114 114 if (file_exists($locales_file)) { 115 require_once $locales_file; 115 require $locales_file; 116 } else { 117 die("locales file $locales_file not found!"); 116 118 } 117 119 return; … … 126 128 $msg = "<div style='font-family:Verdana;font-size:14px;text-align:center;'><b>".(empty($locale['403'])?"Unable to run the ExiteCMS setup":$locale['403']).":<br /><br /><font style='color:red;'>"; 127 129 $msg .= $error."</font></b><br /><br />"; 128 $msg .= $error."</font></b><br /><br />";129 130 if ($wiki) { 130 if (empty($locale['404' )) {131 if (empty($locale['404'])) { 131 132 $msg .= "Please consult our <a href='http://exitecms.exite.eu/modules/wiki/index.php?wakka=Setup'>Wiki</a> "; 132 133 } else { 133 $msg = sprintf($locale['404'], "http://exitecms.exite.eu/modules/wiki/index.php?wakka=Setup");134 } 135 } 136 $msg .= $tip."</div>";134 $msg .= sprintf($locale['404'], "http://exitecms.exite.eu/modules/wiki/index.php?wakka=Setup"); 135 } 136 } 137 $msg .=" ". $tip."</div>"; 137 138 die($msg); 138 139 } … … 182 183 183 184 // load the language pack file, to get some initial info about the language 184 require PATH_ADMIN."tools/language_pack_".$localeset.".php";185 require_once PATH_ADMIN."tools/language_pack_".$localeset.".php"; 185 186 186 187 // load the locale for this module 188 $locale = array(); 187 189 locale_load("main.setup"); 188 190 … … 193 195 194 196 // parameter validation 195 $step = (isset($_GET['step']) ? $_GET['step'] : "0"); 196 $variables['step'] = $step; 197 $step = (isset($_POST['step']) ? $_POST['step'] : "0"); 197 198 198 199 // check if the cache directories are writeable … … 230 231 if ($step == "1") { 231 232 // verify the user input: hostname 232 $db_host = stripinput($_POST['db_host']);233 $db_host = isset($_POST['db_host']) ? stripinput($_POST['db_host']) : ""; 233 234 $variables['db_host'] = $db_host; 234 if ( $empty($db_host) || !preg_match("/^[-0-9\.A-Z_@]+$/i", $db_host)) {235 $error .= $locale['417']."<br /> \n";235 if (empty($db_host) || !preg_match("/^[-0-9\.A-Z_@]+$/i", $db_host)) { 236 $error .= $locale['417']."<br /><br />\n"; 236 237 } 237 238 // verify the user input: username 238 $db_user = stripinput($_POST['db_user']);239 $db_user = isset($_POST['db_user']) ? stripinput($_POST['db_user']) : ""; 239 240 $variables['db_user'] = $db_user; 240 if ($empty($db_user) || !preg_match("/^[-0-9A-Z_@]+$/i", $db_user)) { 241 $error .= $locale['418']."<br />\n"; 242 } 241 if (empty($db_user) || !preg_match("/^[-0-9A-Z_@]+$/i", $db_user)) { 242 $error .= $locale['418']."<br /><br />\n"; 243 243 } 244 244 // verify the user input: password 245 $db_pass = stripinput($_POST['db_pass']);245 $db_pass = isset($_POST['db_pass']) ? stripinput($_POST['db_pass']) : ""; 246 246 $variables['db_pass'] = $db_pass; 247 if ($empty($db_pass) || !preg_match("/^[-0-9A-Z_@]+$/i", $db_pass)) { 248 $error .= $locale['419']."<br />\n"; 249 } 247 if (empty($db_pass) || !preg_match("/^[-0-9A-Z_@]+$/i", $db_pass)) { 248 $error .= $locale['419']."<br /><br />\n"; 250 249 } 251 250 // verify the user input: database name 252 $db_name = stripinput($_POST['db_name']);251 $db_name = isset($_POST['db_name']) ? stripinput($_POST['db_name']) : ""; 253 252 $variables['db_name'] = $db_name; 254 if ($empty($db_name) || !preg_match("/^[-0-9A-Z_@]$/i", $db_name)) { 255 $error .= $locale['427']."<br />\n"; 256 } 253 if (empty($db_name) || !preg_match("/^[-0-9A-Z_@]+$/i", $db_name)) { 254 $error .= $locale['427']."<br /><br />\n"; 257 255 } 258 256 // verify the user input: table prefix 259 $db_prefix = stripinput($_POST['db_prefix']);257 $db_prefix = isset($_POST['db_prefix']) ? stripinput($_POST['db_prefix']) : ""; 260 258 $variables['db_prefix'] = $db_prefix; 261 259 if (!preg_match("/^[-0-9A-Z_@]*$/i", $db_prefix)) { 262 $error .= $locale['428']."<br />\n"; 263 } 260 $error .= $locale['428']."<br /><br />\n"; 264 261 } 265 262 // verify a connection to the database server can be made … … 267 264 $db_connect = @mysql_connect($db_host, $db_user, $db_pass); 268 265 if (!$db_connect) { 269 $error .= $locale['4 29']."<br />\n";266 $error .= $locale['401']."<br />".$locale['429']."<br /><br />\n"; 270 267 } 271 268 } … … 274 271 $db_select = @mysql_select_db($db_name); 275 272 if (!$db_select) { 276 $error .= sprintf($locale['434'],$db_name)."<br /> \n";273 $error .= sprintf($locale['434'],$db_name)."<br /><br />\n"; 277 274 } 278 275 } … … 281 278 $result = dbquery("CREATE TABLE ".$db_prefix."_test (test TINYINT(1) NOT NULL) ENGINE = MYISAM"); 282 279 if (!$result) { 283 $error .= sprintf($locale['435'],$db_name)."<br /> \n";280 $error .= sprintf($locale['435'],$db_name)."<br /><br />\n"; 284 281 } else { 285 282 $result = dbquery("DROP TABLE ".$db_prefix."_test"); … … 296 293 "."$"."db_prefix="."\"".$_POST['db_prefix']."\""."; 297 294 298 // user database settings 295 // user database settings (may be shared with another ExiteCMS DB) 299 296 "."$"."user_db_host="."\"".$_POST['db_host']."\""."; 300 297 "."$"."user_db_user="."\"".$_POST['db_user']."\""."; … … 310 307 fclose($temp); 311 308 } 309 } 310 if (!empty($error)) { 311 $step = 0; 312 312 } 313 313 } … … 360 360 $link = dbconnect($db_host, $db_user, $db_pass, $db_name); 361 361 $basedir = substr($_SERVER['PHP_SELF'], 0, -9); 362 $username = stripinput($_POST['username']); 363 $password1 = stripinput($_POST['password1']); 364 $password2 = stripinput($_POST['password2']); 365 $email = stripinput($_POST['email']); 362 $username = isset($_POST['username']) ? stripinput($_POST['username']) : ""; 363 $variables['username'] = $username; 364 $password1 = isset($_POST['password1']) ? stripinput($_POST['password1']) : ""; 365 $variables['password1'] = $password1; 366 $password2 = isset($_POST['password2']) ? stripinput($_POST['password2']) : ""; 367 $variables['password2'] = $password2; 368 $email = isset($_POST['email']) ? stripinput($_POST['email']) : ""; 369 $variables['email'] = $email; 366 370 if (!preg_match("/^[-0-9A-Z_@\s]+$/i", $username)) $error .= $locale['450']."<br /><br />\n"; 367 371 if (preg_match("/^[0-9A-Z@]{6,20}$/i", $password1)) { … … 378 382 require_once PATH_INCLUDES."dbsetup_include.php"; 379 383 380 if ($error == "") { 384 if ($error != "") { 385 386 $step = 1; 387 388 } else { 381 389 382 390 // create the admin rights field for the webmaster, based on all admin modules available … … 472 480 $variables['error'] = $error; 473 481 482 $variables['step'] = $step; 483 474 484 // define the setup body panel variables 475 485 $template_panels[] = array('type' => 'body', 'name' => 'setup', 'template' => 'main.setup.tpl', 'locale' => "main.setup");
Note: See TracChangeset
for help on using the changeset viewer.
