Location: PHPKode > projects > O - OpenSource GroupWare > osgw/config/install_data.php
<?php
/**************************************************************************
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   @Authors:	Ryan Thompson(hide@address.com)
***************************************************************************/
$service['no_session'] = TRUE;
require('../config.inc.php');


$handle = opendir('../');
while (false !== ($d = readdir($handle))) 
{
	if(!in_array($d, $system_dirs) && is_dir($root_dir. "/".$d))
	{

		if($handle2 = @opendir($root_dir ."/$d/config/data"))
		{
			while (false !== ($file = readdir($handle2))) 
			{
				if(!in_array($file, $system_dirs) && !strstr($file, '~'))
				{
				
					require_once("$root_dir/$d/config/data/$file");
					$table = rtrim($file, '.php');
					foreach($data AS $value)
					{
						$columns = NULL;
						$text = NULL;
						foreach($value AS $column => $record_data)
						{
							//echo key($column);
							$columns .= $column .", ";
							$text .= "'$record_data', ";
			
						}
						$sql = "INSERT INTO $table (". rtrim($columns, ', ') .") 
							VALUES (".  rtrim($text, ', ') . ")";
							$db->query($sql);
		
					}
				}				
			}
		}
	}
}

closedir($handle);
			
header('Location: ./general_config.php');
Return current item: O - OpenSource GroupWare