Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         news
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version      	$Id: install.php 1587 2012-01-24 23:19:06Z darkviper $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/news/install.php $
14
 * @lastmodified    $Date: 2012-01-25 00:19:06 +0100 (Wed, 25 Jan 2012) $
15
 *
16
 */
17
/* -------------------------------------------------------- */
18
// Must include code to stop this file being accessed directly
19
require_once( dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
20
if(!defined('WB_PATH')) { throw new IllegalFileException(); }
21
/* -------------------------------------------------------- */
22
	$sDefaultSql = dirname(__FILE__).'/install.sql';
23
	if (is_readable($sDefaultSql)) {
24
// create needet database tables and set default records
25
		if ($database->SqlImport($sDefaultSql, TABLE_PREFIX)) {
26
// Make news post access files dir
27
			require_once(WB_PATH.'/framework/functions.php');
28
			if(make_dir(WB_PATH.PAGES_DIRECTORY.'/posts')) {
29
				// Add a index.php file to prevent directory spoofing
30
				$sResponse  = $_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently';
31
				$sContent =
32
					'<?php'."\n".
33
					'// *** This file is generated by WebsiteBaker Ver.'.VERSION."\n".
34
					'// *** Creation date: '.date('c')."\n".
35
					'// *** Do not modify this file manually'."\n".
36
					'// *** WB will rebuild this file from time to time!!'."\n".
37
					'// *************************************************'."\n".
38
					"\t".'header(\''.$sResponse.'\');'."\n".
39
					"\t".'header(\'Location: ../index.php\');'."\n".
40
					'// *************************************************'."\n";
41
				$sFilename = WB_PATH.PAGES_DIRECTORY.'/posts/index.php';
42
				file_put_contents($sFilename, $sContent);
43
				change_mode($sFilename, 'file');
44
			}
45
		}
46
	}
47
/* **** END INSTALL ********************************************************* */
(15-15/33)