Project

General

Profile

« Previous | Next » 

Revision 1684

Added by Dietmar over 12 years ago

! update upgrade-script, now don't overwrite existings values in settings
+ add field tooltip to table pages in installer
! change some module tool_icon.png (Tks to Stefek)
! add date_time string to backup_droplets.zip
- search and comment out founded require_once(WB_PATH."/framework/class.database.php");
- this will be never needed anymore and produce errors
! rename class.msg_queue.php in msgQueue.php to work with autokoader
+ add function format_message to class.wb.php

View differences:

save.php
332 332
	set_error('It appears the Absolute path that you entered is incorrect');
333 333
}
334 334

  
335
// Try connecting to database	
335
// Try connecting to database
336 336
if(!@mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD)) {
337 337
	set_error('Database host name, username and/or password incorrect. MySQL Error:<br />'.mysql_error());
338 338
}
......
393 393
	// Addons table
394 394
	$addons = "DROP TABLE IF EXISTS `".TABLE_PREFIX."addons`";
395 395
	$database->query($addons);
396
				
396

  
397 397
	// Try installing tables
398
	
398

  
399 399
	// Pages table
400 400
	$pages = 'CREATE TABLE `'.TABLE_PREFIX.'pages` ( `page_id` INT NOT NULL auto_increment,'
401
	       . ' `parent` INT NOT NULL DEFAULT \'0\','
402
	       . ' `root_parent` INT NOT NULL DEFAULT \'0\','
403
	       . ' `level` INT NOT NULL DEFAULT \'0\','
404
	       . ' `link` VARCHAR( 255 ) NOT NULL,'
405
	       . ' `target` VARCHAR( 7 ) NOT NULL DEFAULT \'\' ,'
406
	       . ' `page_title` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
407
		   . ' `page_icon` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
408
	       . ' `menu_title` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
409
		   . ' `menu_icon_0` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
410
		   . ' `menu_icon_1` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
411
	       . ' `description` TEXT NOT NULL ,'
412
	       . ' `keywords` TEXT NOT NULL ,'
413
	       . ' `page_trail` VARCHAR( 255 ) NOT NULL  ,'
414
	       . ' `template` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
415
	       . ' `visibility` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
416
	       . ' `position` INT NOT NULL DEFAULT \'0\','
417
	       . ' `menu` INT NOT NULL DEFAULT \'0\','
418
	       . ' `language` VARCHAR( 5 ) NOT NULL DEFAULT \'\' ,'
419
	       . ' `page_code` INT NOT NULL DEFAULT \'0\','
420
	       . ' `searching` INT NOT NULL DEFAULT \'0\','
421
	       . ' `admin_groups` VARCHAR( 512 ) NOT NULL DEFAULT \'1\' ,'
422
	       . ' `admin_users` VARCHAR( 512 ) NOT NULL ,'
423
	       . ' `viewing_groups` VARCHAR( 512 ) NOT NULL DEFAULT \'1\' ,'
424
	       . ' `viewing_users` VARCHAR( 512 ) NOT NULL ,'
425
	       . ' `modified_when` INT NOT NULL DEFAULT \'0\','
426
	       . ' `modified_by` INT NOT NULL  DEFAULT \'0\','
427
	       . ' PRIMARY KEY ( `page_id` ) '
428
	       . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
401
				. ' `parent` INT NOT NULL DEFAULT \'0\','
402
				. ' `root_parent` INT NOT NULL DEFAULT \'0\','
403
				. ' `level` INT NOT NULL DEFAULT \'0\','
404
				. ' `link` VARCHAR( 255 ) NOT NULL,'
405
				. ' `target` VARCHAR( 7 ) NOT NULL DEFAULT \'\' ,'
406
				. ' `page_title` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
407
				. ' `page_icon` VARCHAR( 512 ) NOT NULL DEFAULT \'\' ,'
408
				. ' `menu_title` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
409
				. ' `menu_icon_0` VARCHAR( 512 ) NOT NULL DEFAULT \'\' ,'
410
				. ' `menu_icon_1` VARCHAR( 512 ) NOT NULL DEFAULT \'\' ,'
411
				. ' `tooltip` VARCHAR( 512 ) NOT NULL DEFAULT \'\' ,'
412
				. ' `description` TEXT NOT NULL ,'
413
				. ' `keywords` TEXT NOT NULL ,'
414
				. ' `page_trail` VARCHAR( 255 ) NOT NULL  ,'
415
				. ' `template` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
416
				. ' `visibility` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
417
				. ' `position` INT NOT NULL DEFAULT \'0\','
418
				. ' `menu` INT NOT NULL DEFAULT \'0\','
419
				. ' `language` VARCHAR( 5 ) NOT NULL DEFAULT \'\' ,'
420
				. ' `page_code` INT NOT NULL DEFAULT \'0\','
421
				. ' `searching` INT NOT NULL DEFAULT \'0\','
422
				. ' `admin_groups` VARCHAR( 512 ) NOT NULL DEFAULT \'1\' ,'
423
				. ' `admin_users` VARCHAR( 512 ) NOT NULL ,'
424
				. ' `viewing_groups` VARCHAR( 512 ) NOT NULL DEFAULT \'1\' ,'
425
				. ' `viewing_users` VARCHAR( 512 ) NOT NULL ,'
426
				. ' `modified_when` INT NOT NULL DEFAULT \'0\','
427
				. ' `modified_by` INT NOT NULL  DEFAULT \'0\','
428
				. ' PRIMARY KEY ( `page_id` ) '
429
				. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
429 430
	if(!$database->query($pages)) {
430 431
	}
431
	
432

  
432 433
	// Sections table
433 434
	$pages = 'CREATE TABLE `'.TABLE_PREFIX.'sections` ( `section_id` INT NOT NULL auto_increment,'
434 435
	       . ' `page_id` INT NOT NULL DEFAULT \'0\','
......
436 437
	       . ' `module` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
437 438
	       . ' `block` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
438 439
	       . ' `publ_start` VARCHAR( 255 ) NOT NULL DEFAULT \'0\' ,'
439
	       . ' `publ_end` VARCHAR( 255 ) NOT NULL DEFAULT \'0\' ,' 
440
	       . ' `publ_end` VARCHAR( 255 ) NOT NULL DEFAULT \'0\' ,'
440 441
	       . ' PRIMARY KEY ( `section_id` ) '
441 442
	       . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
442 443
	$database->query($pages);
443 444

  
444 445
	require(ADMIN_PATH.'/interface/version.php');
445
	
446

  
446 447
	// Settings table
447 448
	$settings='CREATE TABLE `'.TABLE_PREFIX.'settings` ( `setting_id` INT NOT NULL auto_increment,'
448 449
		. ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
......
490 491
	." ('search', 'public'),"
491 492
	." ('page_extension', '.php'),"
492 493
	." ('page_spacer', '-'),"
493
	." ('dev_infos', 'true'),"
494
	." ('dev_infos', 'false'),"
494 495
	." ('pages_directory', '/pages'),"
495 496
	." ('page_icon_dir', '/templates/*/title_images'),"
496 497
	." ('rename_files_on_upload', 'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx'),"
......
509 510
	." ('secure_form_module', ''),"
510 511
	." ('mediasettings', '')";
511 512
	$database->query($settings_rows);
512
	
513

  
513 514
	// Users table
514 515
	$users = 'CREATE TABLE `'.TABLE_PREFIX.'users` ( `user_id` INT NOT NULL auto_increment,'
515 516
	       . ' `group_id` INT NOT NULL DEFAULT \'0\','
......
531 532
	       . ' PRIMARY KEY ( `user_id` ) '
532 533
	       . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
533 534
	$database->query($users);
534
	
535

  
535 536
	// Groups table
536 537
	$groups = 'CREATE TABLE `'.TABLE_PREFIX.'groups` ( `group_id` INT NOT NULL auto_increment,'
537 538
	        . ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
......
541 542
	        . ' PRIMARY KEY ( `group_id` ) '
542 543
	        . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
543 544
	$database->query($groups);
544
	
545

  
545 546
	// Search settings table
546 547
	$search = 'CREATE TABLE `'.TABLE_PREFIX.'search` ( `search_id` INT NOT NULL auto_increment,'
547 548
	        . ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
......
550 551
	        . ' PRIMARY KEY ( `search_id` ) '
551 552
	        . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
552 553
	$database->query($search);
553
	
554

  
554 555
	// Addons table
555 556
	$addons = 'CREATE TABLE `'.TABLE_PREFIX.'addons` ( '
556 557
			.'`addon_id` INT NOT NULL auto_increment ,'
......
568 569
	$database->query($addons);
569 570

  
570 571
	// Insert default data
571
	
572

  
572 573
	// Admin group
573 574
	$full_system_permissions = 'pages,pages_view,pages_add,pages_add_l0,pages_settings,pages_modify,pages_intro,pages_delete,media,media_view,media_upload,media_rename,media_delete,media_create,addons,modules,modules_view,modules_install,modules_uninstall,templates,templates_view,templates_install,templates_uninstall,languages,languages_view,languages_install,languages_uninstall,settings,settings_basic,settings_advanced,access,users,users_view,users_add,users_modify,users_delete,groups,groups_view,groups_add,groups_modify,groups_delete,admintools';
574 575
	$insert_admin_group = "INSERT INTO `".TABLE_PREFIX."groups` VALUES ('1', 'Administrators', '$full_system_permissions', '', '')";
......
576 577
	// Admin user
577 578
	$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')";
578 579
	$database->query($insert_admin_user);
579
	
580

  
580 581
	// Search header
581 582
	$search_header = addslashes('
582 583
<h1>[TEXT_SEARCH]</h1>
......
668 669
	// Install add-ons
669 670
	if(file_exists(WB_PATH.'/install/modules')) {
670 671
		// Unpack pre-packaged modules
671
			
672

  
672 673
	}
673 674
	if(file_exists(WB_PATH.'/install/templates')) {
674 675
		// Unpack pre-packaged templates
675
		
676

  
676 677
	}
677 678
	if(file_exists(WB_PATH.'/install/languages')) {
678 679
		// Unpack pre-packaged languages
679
		
680

  
680 681
	}
681 682

  
682 683
	$admin=new admin_dummy('Start','',false,false);
......
708 709
		closedir($handle);
709 710
		}
710 711
	}
711
	
712

  
712 713
	// Check if there was a database error
713 714
	if($database->is_error()) {
714 715
		set_error($database->get_error());
715 716
	}
716 717

  
717
// end of if install_tables	
718
// end of if install_tables
718 719
} else {
719 720
	/**
720 721
	 *	DB - Exists
......
723 724
	 */
724 725
	$requested_tables = array("pages","sections","settings","users","groups","search","addons");
725 726
	for($i=0;$i<count($requested_tables);$i++) $requested_tables[$i] = $table_prefix.$requested_tables[$i];
726
	
727

  
727 728
	$result = mysql_list_tables( DB_NAME );
728 729
	$all_tables = array();
729 730
	for($i=0; $i < mysql_num_rows($result); $i++) $all_tables[] = mysql_table_name($result, $i);
......
734 735
			$missing_tables[] = $temp_table;
735 736
		}
736 737
	}
737
	
738

  
738 739
	/**
739
	 *	If one or more needed tables are missing, so 
740
	 *	If one or more needed tables are missing, so
740 741
	 *	we can't go on and have to display an error
741 742
	 */
742 743
	if ( count($missing_tables) > 0 ) {
743 744
		$error_message  = "One or more tables are missing in the selected database <b><font color='#990000'>".DB_NAME."</font></b>.<br />";
744 745
		$error_message .= "Please install the missing tables or choose 'install tables' as recommend.<br />";
745 746
		$error_message .= "Missing tables are: <b>".implode(", ", $missing_tables)."</b>";
746
		
747

  
747 748
		set_error( $error_message );
748 749
	}
749
	
750

  
750 751
	/**
751 752
	 *	Try to get some default settings ...
752 753
	 */
......
759 760
		'SMART_LOGIN'	=> false
760 761
	);
761 762
	foreach($vars as $k => $v) if (!defined($k)) define($k, $v);
762
	
763

  
763 764
	if (!isset($MESSAGE)) include (WB_PATH."/languages/".LANGUAGE.".php");
764
	
765

  
765 766
	/**
766 767
	 *	The important part ...
767 768
	 *	Is there an valid user?
......
776 777
	 	 */
777 778
	 	set_error ("Unkown user. Please use a valid username.");
778 779
	} else {
779
	 	
780

  
780 781
		$data = $result->fetchRow();
781 782
	 	/**
782 783
	 	 *	Does the password match

Also available in: Unified diff