/*******************************************************************************
* KNDirList 0.3.0 *
* Web directory listing tool *
* (c) Lucas "Drom" Lommer 2005 *
* Released under terms of GNU/GPL licence v2 only - www.gnu.org *
* *
* This script is free software and is avaible "AS IS" and there is NO WARRANTY *
* *
* Note: All system paths must be inserted with slash ("/") at the end *
*******************************************************************************/
// If path was set by URL bar, redirect
if ($goto) {
$locationToGo = 'Location: index.php?openDir='.$gotoURL;
if ($showTree) $locationToGo .= '&showTree=true';
Header ($locationToGo);
}
// Paths
global $sysDir;
$sysDir = '.kndirlist/'; // System directory name (this is root for other paths)
global $sysUID;
$sysUID = $sysDir.'UI/'; // UI subdirectory
global $sysSTD;
$sysSTD = $sysDir.'std_fn/'; // Standard function subdirectory
global $sysICO;
$sysICO = $sysDir.'graphics/'; // graphics subdirectory
// Application data
global $appRData;
$appRData[name] = 'KNDirList';
$appRData[version] = '0.3.0a3';
$appRData[author] = 'Lucas "Drom" Lommer';
$appRData[authormail] = 'drom@kdyne.net';
$appRData[headcopy] = 'Copyright © 2005 '.$appRData[author].', Released undes terms of GNU/GPL licence v2';
$appRData[copy] = ''.$appRData[version].' (c) '.$appRData[author].', 2005
Released under terms of GNU/GPL licence - www.gnu.org
This script is free software and is avaible "AS IS" and there is NO WARRANTY
Get the source code';
// Create global library variables
global $libName;
global $libInfo;
global $libVers;
global $libDate;
global $libCopy;
// Localization
global $gl_lang;
$gl_lang = 'en';
// UI params
global $uiParam;
$uiParam[width] = '99%';
$uiParam[panels] = '1';
global $uiPanel;
$uiPanel = 'icons';
// Messages
global $msg;
$msg[0]['en'] = 'Directory';
// Initialization
global $runLog;
$runLog = false;
global $viewDir;
if (!$openDir) $openDir = './'; // Open root if directory not selected
if ((SubStr($openDir, -1) != '/') and ($openDir != 'about:')) $openDir .= '/'; // Test slash
if ((StrPos($openDir, '../')) or ($openDir == '../')) Header ("Location: index.php?openDir=./"); // Preven open parent directory
//if ($openDir{0} == '/') Header ("Location: index.php?openDir=./"); // Preven open parent directory
if ($openDir == 'about:') {
if (!$openDir) $openDir = './';
$openHelp = 'help';
}
else $viewDir = $openDir;
global $viewHelp;
if ($openHelp) {
$viewHelp = $openHelp;
}
global $tree;
if ($showTree) $tree = true;
else $tree = false;
// Directory informations
global $dirStats;
// Object loader
function loadInternalObject($objectName, $failPolicy) {
// Register global variables
global $sysDir;
global $sysUID;
global $sysSTD;
global $sysICO;
global $appRData;
global $libName;
global $libInfo;
global $libVers;
global $libDate;
global $libCopy;
global $gl_lang;
global $uiParam;
global $uiPanel;
global $msg;
global $runLog;
global $viewDir;
global $viewHelp;
global $tree;
global $dirStats;
if (File_exists($objectName)) {
@require $objectName;
return 'Ok';
}
else {
switch ($failPolicy) {
case 'report':
return 'Error :: Unable to load object "'.$objectName.'".
'.Chr(13);
break;
case 'fatal':
return 'Fatal Error :: Unable to load object "'.$objectName.'".
'.Chr(13);
break;
default:
return 'Warning :: Unable to get load status for object "'.$objectName.'".
'.Chr(13);
break;
}
}
}
// Load functions
@$loadResult = loadInternalObject($sysSTD.'std_bf.php', 'fatal'); // Standard Base Functions
if ($loadResult != 'Ok') $runLog .= $loadResult;
@$loadResult = loadInternalObject($sysSTD.'std_dhf.php', 'fatal'); // Standard Directory Handle Function
if ($loadResult != 'Ok') $runLog .= $loadResult;
@$loadResult = loadInternalObject($sysSTD.'std_fsf.php', 'fatal'); // Standard File System Functions
if ($loadResult != 'Ok') $runLog .= $loadResult;
@$loadResult = loadInternalObject($sysSTD.'std_upd.php', 'report'); // Standard checking new version routines
if ($loadResult != 'Ok') $runLog .= $loadResult;
@$loadResult = loadInternalObject($sysSTD.'std_uio.php', 'fatal'); // Standard UI objects
if ($loadResult != 'Ok') $runLog .= $loadResult;
// Create UI
@$loadResult = loadInternalObject($sysUID.'ui_head.php', 'report'); // XHTML head && CSS
if ($loadResult != 'Ok') $runLog .= $loadResult;
echo '