<?PHP

/**************************************
    Webutler V3.0 - www.webutler.de
    Copyright (c) 2008 - 2014
    Autor: Sven Zinke
    Free for any use
    Lizenz: GPL
**************************************/

require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/includes/loader.php';

$webutlerckplugin = new WebutlerAdminClass;
$webutlerckplugin->config = $webutler_config;
$webutlerckplugin->langconf = $webutler_langconf;

if(!$webutlerckplugin->checkadmin())
    exit('no access');


header('Content-type: application/javascript');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP 1.1
header('Cache-Control: post-check=0, pre-check=0, false'); // HTTP 1.0
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Pragma: no-cache');


$errorpage = '';
$directory = $webutlerckplugin->config['server_path'].'/content/pages';
if($webutlerckplugin->config['ownerrorpage'] != '' && file_exists($directory.'/'.$webutlerckplugin->config['ownerrorpage']))
    $errorpage = $webutlerckplugin->config['ownerrorpage'];

$handle = opendir($directory);
echo "var InternPagesSelectBox = new Array( new Array( '', '' )";
while(($file = readdir($handle)) !== false)
{
	$extension = substr($file, strrpos($file, '.'));
	$extension = strtolower($extension);

	if($file != '.' && $file != '..' && $file != '.htaccess' && $extension != '.bak' && $extension != '.tmp' && $file != $errorpage)
	{
		echo ", new Array( '".$file."', 'index.php?page=".$file."' )";
	}
}
echo " );\n";
closedir($handle);


?>
