Project

General

Profile

« Previous | Next » 

Revision 1821

Added by Dietmar about 12 years ago

! forgot to upload the /install/save.php

View differences:

branches/2.8.x/CHANGELOG
13 13

  
14 14

  
15 15

  
16
16 Nov-2012 Build 1821 Dietmar Woellbrink (Luisehahne)
17
! forgot to upload the /install/save.php
16 18
16 Nov-2012 Build 1820 Dietmar Woellbrink (Luisehahne)
17 19
+ added sql folder including  websitebaker.sql, wb_search.sql
18 20
! update /install/save.php, will now created the tables with $database->SqlImport() 
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1820');
54
if(!defined('REVISION')) define('REVISION', '1821');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/install/save.php
295 295
"define('WB_URL', '$wb_url');\n".
296 296
"define('ADMIN_DIRECTORY', 'admin'); // no leading/trailing slash or backslash!! A simple directory only!!\n".
297 297
"\n".
298
"require_once(dirname(__FILE__).'/framework/initialize.php');\n".
299
"\n";
298
"require_once(dirname(__FILE__).'/framework/initialize.php');\n";
300 299

  
301 300
$config_filename = '../config.php';
302 301
// Check if the file exists and is writable first.
......
329 328
define('ADMIN_URL', $wb_url.'/'.ADMIN_DIRECTORY);
330 329

  
331 330
// Check if the user has entered a correct path
332
if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
333
	set_error('It appears the Absolute path that you entered is incorrect');
334
}
331
    if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
332
    	set_error('It appears the Absolute path that you entered is incorrect');
333
    }
335 334
	$sSqlUrl = DB_TYPE.'://'.DB_USERNAME.':'.DB_PASSWORD.'@'.DB_HOST.'/'.DB_NAME;
336 335
	$database = WbDatabase::getInstance();
337 336
	$database->doConnect($sSqlUrl);
......
350 349
			$this->error=$message;
351 350
		}
352 351
	}
353
// Include WB functions file
354
	require_once(WB_PATH.'/framework/functions.php');
355
// Re-connect to the database, this time using in-build database class
356
	require_once(WB_PATH.'/framework/class.login.php');
357
// Check if we should install tables
358 352

  
359
	$sql = 'SHOW TABLES LIKE \''.str_replace('_', '\_', TABLE_PREFIX).'%\'';
360
	$aTables = array();
361
	if(($oTables = $database->query($sql))) {
362
		while($aTable = $oTables->fetchRow()) {
363
			$aTables[] = $aTable[0];
364
		}
365
	}
366
	$sTableList = implode(', ', $aTables);
367
	if($sTableList != '') {
368
		$database->query('DROP TABLE '.$sTableList);
369
	}
370
	// Try installing tables
371
	// Pages table
372
	$pages = 'CREATE TABLE `'.TABLE_PREFIX.'pages` ( `page_id` INT NOT NULL auto_increment,'
373
				. ' `parent` INT NOT NULL DEFAULT \'0\','
374
				. ' `root_parent` INT NOT NULL DEFAULT \'0\','
375
				. ' `level` INT NOT NULL DEFAULT \'0\','
376
				. ' `link` VARCHAR( 255 ) NOT NULL,'
377
				. ' `target` VARCHAR( 7 ) NOT NULL DEFAULT \'\' ,'
378
				. ' `page_title` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
379
				. ' `page_icon` VARCHAR( 512 ) NOT NULL DEFAULT \'\' ,'
380
				. ' `menu_title` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
381
				. ' `menu_icon_0` VARCHAR( 512 ) NOT NULL DEFAULT \'\' ,'
382
				. ' `menu_icon_1` VARCHAR( 512 ) NOT NULL DEFAULT \'\' ,'
383
				. ' `tooltip` VARCHAR( 512 ) NOT NULL DEFAULT \'\' ,'
384
				. ' `description` TEXT NOT NULL ,'
385
				. ' `keywords` TEXT NOT NULL ,'
386
				. ' `page_trail` VARCHAR( 255 ) NOT NULL  ,'
387
				. ' `template` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
388
				. ' `visibility` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
389
				. ' `position` INT NOT NULL DEFAULT \'0\','
390
				. ' `menu` INT NOT NULL DEFAULT \'1\','
391
				. ' `language` VARCHAR( 5 ) NOT NULL DEFAULT \'\' ,'
392
				. ' `page_code` INT NOT NULL DEFAULT \'0\','
393
				. ' `searching` INT NOT NULL DEFAULT \'0\','
394
				. ' `admin_groups` VARCHAR( 512 ) NOT NULL DEFAULT \'1\' ,'
395
				. ' `admin_users` VARCHAR( 512 ) NOT NULL ,'
396
				. ' `viewing_groups` VARCHAR( 512 ) NOT NULL DEFAULT \'1\' ,'
397
				. ' `viewing_users` VARCHAR( 512 ) NOT NULL ,'
398
				. ' `modified_when` INT NOT NULL DEFAULT \'0\','
399
				. ' `modified_by` INT NOT NULL  DEFAULT \'0\','
400
				. ' `custom01` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
401
				. ' `custom02` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
402
				. ' PRIMARY KEY ( `page_id` ) '
403
				. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
404
	if(!$database->query($pages)) {
405
	}
353
//  core tables structure and some default values
354
    $sSqlFileName = dirname(__FILE__).'/sql/websitebaker.sql';
355
    if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
406 356

  
407
	// Sections table
408
	$pages = 'CREATE TABLE `'.TABLE_PREFIX.'sections` ( `section_id` INT NOT NULL auto_increment,'
409
	       . ' `page_id` INT NOT NULL DEFAULT \'0\','
410
	       . ' `position` INT NOT NULL DEFAULT \'0\','
411
	       . ' `module` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
412
	       . ' `block` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
413
	       . ' `publ_start` VARCHAR( 255 ) NOT NULL DEFAULT \'0\' ,'
414
	       . ' `publ_end` VARCHAR( 255 ) NOT NULL DEFAULT \'0\' ,'
415
	       . ' PRIMARY KEY ( `section_id` ) '
416
	       . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
417
	$database->query($pages);
418

  
419 357
	require(ADMIN_PATH.'/interface/version.php');
420 358

  
421
	// Settings table
422
	$settings='CREATE TABLE `'.TABLE_PREFIX.'settings` ( `setting_id` INT NOT NULL auto_increment,'
423
		. ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
424
		. ' `value` TEXT NOT NULL ,'
425
		. ' PRIMARY KEY ( `setting_id` ) '
426
		. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
427
	$database->query($settings);
428

  
429 359
	$settings_rows=	"INSERT INTO `".TABLE_PREFIX."settings` "
430 360
	." (setting_id, name, value) VALUES "
431 361
	." ( 1, 'wb_version', '".VERSION."'),"
......
490 420
	." (60, 'page_extended', 'true'),"
491 421
	." (61, 'modules_upgrade_list', 'news,wysiwyg,form'),"
492 422
	." (62, 'system_locked', '0')";
493
	$database->query($settings_rows);
423
	if(!$database->query($settings_rows)) { set_error($database->get_error()); }
494 424

  
495
	// Users table
496
	$users = 'CREATE TABLE `'.TABLE_PREFIX.'users` ( `user_id` INT NOT NULL auto_increment,'
497
	       . ' `group_id` INT NOT NULL DEFAULT \'0\','
498
	       . ' `groups_id` VARCHAR( 255 ) NOT NULL DEFAULT \'0\','
499
	       . ' `active` INT NOT NULL DEFAULT \'0\','
500
	       . ' `username` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
501
	       . ' `password` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
502
	       . ' `confirm_code` VARCHAR( 32 ) NOT NULL DEFAULT \'\','
503
	       . ' `confirm_timeout` INT NOT NULL DEFAULT \'0\','
504
	       . ' `remember_key` VARCHAR( 255 ) NOT NULL DEFAULT \'\','
505
	       . ' `last_reset` INT NOT NULL DEFAULT \'0\','
506
	       . ' `display_name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
507
	       . ' `email` TEXT NOT NULL ,'
508
	       . ' `timezone` INT NOT NULL DEFAULT \'0\','
509
	       . ' `date_format` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
510
	       . ' `time_format` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
511
	       . ' `language` VARCHAR( 5 ) NOT NULL DEFAULT \'' .$default_language .'\' ,'
512
	       . ' `home_folder` TEXT NOT NULL ,'
513
	       . ' `login_when` INT NOT NULL  DEFAULT \'0\','
514
	       . ' `login_ip` VARCHAR( 15 ) NOT NULL DEFAULT \'\' ,'
515
	       . ' PRIMARY KEY ( `user_id` ) '
516
	       . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
517
	$database->query($users);
425
// Admin user
426
    $insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` VALUES (1, 1, '1', 1, '$admin_username', '".md5($admin_password)."', '', 0, '', 0, 'Administrator', '$admin_email', 0, '', '', '$default_language', '', 0, '');";
427
	if(!$database->query($insert_admin_user)) { set_error($database->get_error()); }
518 428

  
519
	// Groups table
520
	$groups = 'CREATE TABLE `'.TABLE_PREFIX.'groups` ( `group_id` INT NOT NULL auto_increment,'
521
	        . ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
522
	        . ' `system_permissions` TEXT NOT NULL ,'
523
	        . ' `module_permissions` TEXT NOT NULL ,'
524
	        . ' `template_permissions` TEXT NOT NULL ,'
525
	        . ' PRIMARY KEY ( `group_id` ) '
526
	        . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
527
	$database->query($groups);
429
// Search settings table structure and default values
430
    $sSqlFileName = dirname(__FILE__).'/sql/wb_search.sql';
431
    if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
528 432

  
529
	// Search settings table
530
	$search = 'CREATE TABLE `'.TABLE_PREFIX.'search` ( `search_id` INT NOT NULL auto_increment,'
531
	        . ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
532
	        . ' `value` TEXT NOT NULL ,'
533
	        . ' `extra` TEXT NOT NULL ,'
534
	        . ' PRIMARY KEY ( `search_id` ) '
535
	        . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
536
	$database->query($search);
433
// Include WB functions file
434
	require_once(WB_PATH.'/framework/functions.php');
435
// Re-connect to the database, this time using in-build database class
436
	require_once(WB_PATH.'/framework/class.login.php');
537 437

  
538
	// Addons table
539
	$addons = 'CREATE TABLE `'.TABLE_PREFIX.'addons` ( '
540
			.'`addon_id` INT NOT NULL auto_increment ,'
541
			.'`type` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
542
			.'`directory` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
543
			.'`name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
544
			.'`description` TEXT NOT NULL ,'
545
			.'`function` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
546
			.'`version` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
547
			.'`platform` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
548
			.'`author` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
549
			.'`license` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
550
			.' PRIMARY KEY ( `addon_id` ) '
551
			.' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
552
	$database->query($addons);
553

  
554
	// Insert default data
555

  
556
	// Admin group
557
	$full_system_permissions  = 'access,addons,admintools,admintools_view,groups,groups_add,groups_delete,groups_modify,groups_view,';
558
	$full_system_permissions .= 'languages,languages_install,languages_uninstall,languages_view,media,media_create,media_delete,media_rename,media_upload,media_view,';
559
	$full_system_permissions .= 'modules,modules_advanced,modules_install,modules_uninstall,modules_view,pages,pages_add,pages_add_l0,pages_delete,pages_intro,pages_modify,pages_settings,pages_view,';
560
	$full_system_permissions .= 'preferences,preferences_view,settings,settings_advanced,settings_basic,settings_view,templates,templates_install,templates_uninstall,templates_view,users,users_add,users_delete,users_modify,users_view';
561
	$insert_admin_group = "INSERT INTO `".TABLE_PREFIX."groups` VALUES ('1', 'Administrators', '$full_system_permissions', '', '')";
562
	$database->query($insert_admin_group);
563
	// Admin user
564
	$insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` (user_id,group_id,groups_id,active,username,password,email,display_name) VALUES ('1','1','1','1','$admin_username','".md5($admin_password)."','$admin_email','Administrator')";
565
	$database->query($insert_admin_user);
566

  
567
	// Search header
568
	$search_header = addslashes('
569
<h1>[TEXT_SEARCH]</h1>
570

  
571
<form name="searchpage" action="[WB_URL]/search/index.php" method="get">
572
<table cellpadding="3" cellspacing="0" border="0" width="500">
573
<tr>
574
<td>
575
<input type="hidden" name="search_path" value="[SEARCH_PATH]" />
576
<input type="text" name="string" value="[SEARCH_STRING]" style="width: 100%;" />
577
</td>
578
<td width="150">
579
<input type="submit" value="[TEXT_SEARCH]" style="width: 100%;" />
580
</td>
581
</tr>
582
<tr>
583
<td colspan="2">
584
<input type="radio" name="match" id="match_all" value="all"[ALL_CHECKED] />
585
<label for="match_all">[TEXT_ALL_WORDS]</label>
586
<input type="radio" name="match" id="match_any" value="any"[ANY_CHECKED] />
587
<label for="match_any">[TEXT_ANY_WORDS]</label>
588
<input type="radio" name="match" id="match_exact" value="exact"[EXACT_CHECKED] />
589
<label for="match_exact">[TEXT_EXACT_MATCH]</label>
590
</td>
591
</tr>
592
</table>
593

  
594
</form>
595

  
596
<hr />
597
	');
598
	$insert_search_header = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'header', '$search_header', '')";
599
	$database->query($insert_search_header);
600
	// Search footer
601
	$search_footer = addslashes('');
602
	$insert_search_footer = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'footer', '$search_footer', '')";
603
	$database->query($insert_search_footer);
604
	// Search results header
605
	$search_results_header = addslashes(''.
606
'[TEXT_RESULTS_FOR] \'<b>[SEARCH_STRING]</b>\':
607
<table cellpadding="2" cellspacing="0" border="0" width="100%" style="padding-top: 10px;">');
608
	$insert_search_results_header = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'results_header', '$search_results_header', '')";
609
	$database->query($insert_search_results_header);
610
	// Search results loop
611
	$search_results_loop = addslashes(''.
612
'<tr style="background-color: #F0F0F0;">
613
<td><a href="[LINK]">[TITLE]</a></td>
614
<td align="right">[TEXT_LAST_UPDATED_BY] [DISPLAY_NAME] ([USERNAME]) [TEXT_ON] [DATE]</td>
615
</tr>
616
<tr><td colspan="2" style="text-align: justify; padding-bottom: 5px;">[DESCRIPTION]</td></tr>
617
<tr><td colspan="2" style="text-align: justify; padding-bottom: 10px;">[EXCERPT]</td></tr>');
618

  
619
	$insert_search_results_loop = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'results_loop', '$search_results_loop', '')";
620
	$database->query($insert_search_results_loop);
621
	// Search results footer
622
	$search_results_footer = addslashes("</table>");
623
	$insert_search_results_footer = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'results_footer', '$search_results_footer', '')";
624
	$database->query($insert_search_results_footer);
625
	// Search no results
626
	$search_no_results = addslashes('<tr><td><p>[TEXT_NO_RESULTS]</p></td></tr>');
627
	$insert_search_no_results = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'no_results', '$search_no_results', '')";
628
	$database->query($insert_search_no_results);
629
	// Search module-order
630
	$search_module_order = addslashes('faqbaker,manual,wysiwyg');
631
	$insert_search_module_order = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'module_order', '$search_module_order', '')";
632
	$database->query($insert_search_module_order);
633
	// Search max lines of excerpt
634
	$search_max_excerpt = addslashes('5');
635
	$insert_search_max_excerpt = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'max_excerpt', '$search_max_excerpt', '')";
636
	$database->query($insert_search_max_excerpt);
637
	// max time to search per module
638
	$search_time_limit = addslashes('0');
639
	$insert_search_time_limit = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'time_limit', '$search_time_limit', '')";
640
	$database->query($insert_search_time_limit);
641
	// some config-elements
642
	$database->query("INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'cfg_enable_old_search', 'true', '')");
643
	$database->query("INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'cfg_search_keywords', 'true', '')");
644
	$database->query("INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'cfg_search_description', 'true', '')");
645
	$database->query("INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'cfg_show_description', 'true', '')");
646
	$database->query("INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'cfg_enable_flush', 'false', '')");
647
	// Search template
648
	$database->query("INSERT INTO `".TABLE_PREFIX."search` (name) VALUES ('template')");
649

  
650 438
	require_once(WB_PATH.'/framework/initialize.php');
651 439
	// Include the PclZip class file (thanks to
652 440
	require_once(WB_PATH.'/include/pclzip/pclzip.lib.php');
......
690 478
		}
691 479
	}
692 480

  
693
	// Check if there was a database error
481
// Check if there was a database error
694 482
	if($database->is_error()) {
695 483
		set_error($database->get_error());
696 484
	}
697 485

  
698
if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY )) ) {  }
699
if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY.'/home' )) ) {  }
700
if ( sizeof(createFolderProtectFile( WB_PATH.PAGES_DIRECTORY )) ) {  }
486
    if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY )) ) {  }
487
    if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY.'/home' )) ) {  }
488
    if ( sizeof(createFolderProtectFile( WB_PATH.PAGES_DIRECTORY )) ) {  }
701 489

  
702 490
// end of if install_tables
703 491

  
......
707 495

  
708 496
// Log the user in and go to Website Baker Administration
709 497
$thisApp = new Login(
710
		array(
711
				"MAX_ATTEMPS" => "50",
712
				"WARNING_URL" => $ThemeUrl."/warning.html",
713
				"USERNAME_FIELDNAME" => 'admin_username',
714
				"PASSWORD_FIELDNAME" => 'admin_password',
715
				"REMEMBER_ME_OPTION" => SMART_LOGIN,
716
				"MIN_USERNAME_LEN" => "2",
717
				"MIN_PASSWORD_LEN" => "3",
718
				"MAX_USERNAME_LEN" => "30",
719
				"MAX_PASSWORD_LEN" => "30",
720
				'LOGIN_URL' => ADMIN_URL."/login/index.php",
721
				'DEFAULT_URL' => ADMIN_URL."/start/index.php",
722
				'TEMPLATE_DIR' => $ThemePath,
723
				'TEMPLATE_FILE' => 'loginBox.htt',
724
				'FRONTEND' => false,
725
				'FORGOTTEN_DETAILS_APP' => ADMIN_URL."/login/forgot/index.php",
726
				'USERS_TABLE' => TABLE_PREFIX."users",
727
				'GROUPS_TABLE' => TABLE_PREFIX."groups",
728
		)
498
	array(
499
			"MAX_ATTEMPS" => "50",
500
			"WARNING_URL" => $ThemeUrl."/warning.html",
501
			"USERNAME_FIELDNAME" => 'admin_username',
502
			"PASSWORD_FIELDNAME" => 'admin_password',
503
			"REMEMBER_ME_OPTION" => SMART_LOGIN,
504
			"MIN_USERNAME_LEN" => "2",
505
			"MIN_PASSWORD_LEN" => "3",
506
			"MAX_USERNAME_LEN" => "30",
507
			"MAX_PASSWORD_LEN" => "30",
508
			'LOGIN_URL' => ADMIN_URL."/login/index.php",
509
			'DEFAULT_URL' => ADMIN_URL."/start/index.php",
510
			'TEMPLATE_DIR' => $ThemePath,
511
			'TEMPLATE_FILE' => 'loginBox.htt',
512
			'FRONTEND' => false,
513
			'FORGOTTEN_DETAILS_APP' => ADMIN_URL."/login/forgot/index.php",
514
			'USERS_TABLE' => TABLE_PREFIX."users",
515
			'GROUPS_TABLE' => TABLE_PREFIX."groups",
516
	)
729 517
);

Also available in: Unified diff