function createLinks() { $basepath = "./"; // Current working Directory as absolute path $extensions = array("php", "html"); // Scan for these $subdirectories = scanDirectories($basepath); foreach ($subdirectories as $directory) { if ($file = loadIndex($basepath . $directory, $extensions)) { // Locate index for each subdirectory echo "<li><a href=" . $basepath . $directory . "/" . $file . "> {$directory} </a></li>"; // generate link as list item } } }
serviceLoading(); /* *Checking what kind of client is accesing to choose *the right kernel */ $index = indexRequested(); if ($index !== false) { loadIndex($index); } elseif (clientMobile()) { if (mobileWithWebkit()) { loadIndex('iphone'); } else { loadIndex('mobile'); } } else { loadIndex('browser'); } function loadIndex($index) { //If some index has been loaded, return false because indexes can't be mixed if (defined('INDEX_TYPE')) { define('INDEX_BASE', './../'); return false; } define('INDEX_BASE', './'); //Include the file with the __FILE__ secure $myPath = dirname(realpath(__FILE__)) . '/'; $rPath = realpath($myPath . '/' . $index . '/index.php'); if (is_readable($rPath)) { require_once $rPath; return true;