Project

General

Profile

« Previous | Next » 

Revision 168

Added by ryan about 19 years ago

Added addons loading code

View differences:

save.php
478 478
	// Addons table
479 479
	$addons = 'CREATE TABLE `'.TABLE_PREFIX.'addons` ( '
480 480
	.'`addon_id` INT NOT NULL auto_increment ,'
481
	.'`type` VARCHAR( 255 ) NOT NULL ,'
481 482
	.'`directory` VARCHAR( 255 ) NOT NULL ,'
482 483
	.'`name` VARCHAR( 255 ) NOT NULL ,'
483 484
	.'`description` TEXT NOT NULL ,'
484
	.'`type` VARCHAR( 255 ) NOT NULL ,'
485 485
	.'`function` VARCHAR( 255 ) NOT NULL ,'
486 486
	.'`version` VARCHAR( 255 ) NOT NULL ,'
487 487
	.'`platform` VARCHAR( 255 ) NOT NULL ,'
......
574 574
	$wb = new wb();
575 575
	
576 576
	// Install add-ons
577
	if(!file_exists(WB_PATH.'/install/addons')) {
578
	require(WB_PATH.'/modules/wysiwyg/install.php');
579
	require(WB_PATH.'/modules/code/install.php');
580
	require(WB_PATH.'/modules/news/install.php');
581
	require(WB_PATH.'/modules/form/install.php');
582
	require(WB_PATH.'/modules/wrapper/install.php');
583
	} else {
577
	if(file_exists(WB_PATH.'/install/modules')) {
578
		// Unpack pre-packaged modules
584 579
		
585 580
	}
581
	if(file_exists(WB_PATH.'/install/templates')) {
582
		// Unpack pre-packaged templates
583
		
584
	}
585
	if(file_exists(WB_PATH.'/install/languages')) {
586
		// Unpack pre-packaged languages
587
		
588
	}
589
	// Load addons into DB
590
	$dirs['modules'] = WB_PATH.'/modules/';
591
	$dirs['templates'] = WB_PATH.'/templates/';
592
	$dirs['language'] = WB_PATH.'/languages/';
593
	foreach($dirs AS $type => $dir) {
594
		if($handle = opendir($dir)) {
595
			while(false !== ($file = readdir($handle))) {
596
				if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
597
					// Get addon type
598
					if($type == 'module') {
599
						load_module($dir.'/'.$file, true);
600
					} elseif($type == 'templates') {
601
						load_template($dir.'/'.$file);
602
					} elseif($type == 'language') {
603
						load_language($dir.'/'.$file);
604
					}
605
				}
606
			}
607
		closedir($handle);
608
		}
609
	}
586 610
	
587 611
	// Check if there was a database error
588 612
	if($database->is_error()) {
......
614 638
							)
615 639
					);
616 640

  
617
?>

641
?>

Also available in: Unified diff