Exemplo n.º 1
0
 public static function load()
 {
     if (self::$instance !== NULL) {
         delete(self::$instance);
         self::$instance = NULL;
     }
     $request_url = get_request_url();
     $parts = parse_url($request_url);
     $request_uri = strtolower($parts['path']);
     /* Normalize Path */
     $path = remove_ext($request_uri);
     if (empty($path) || $path == "/" || $path == "/index" || $path == "/home") {
         $path = "/start";
         //later: do landing Page
     } else {
         //remove index from right
         $rm = "/index";
         $len = strlen($rm);
         if (substr($path, $len * -1) == $rm) {
             $path = substr($path, 0, strlen($path) - $len);
         }
     }
     $request_cmd = $path;
     //create the commando
     $dir = 'pages' . $path;
     $cmd = array();
     //default to read index.html
     $error = !(path2cmd($dir . '.php', $cmd) || path2cmd($dir . '.html', $cmd) || path2cmd($dir . '/index.php', $cmd) || path2cmd($dir . '/index.html', $cmd));
     $data = array("request_url" => $request_url, "request_uri" => $request_uri, "request_cmd" => $request_cmd, "cmd" => $cmd);
     $classname = "StaticPage";
     $classfile = "php/static.php";
     /*check if a *.php page is requested and exists*/
     if (!$error) {
         $path = $cmd["path"];
         if (!$error && preg_match("/^(.*)\\.(php)\$/i", $path)) {
             $classname = ucfirst($cmd["filename"]) . "Page";
             $classfile = $path;
             $data["modified"] = filemtime($classfile);
         }
     }
     require_once $classfile;
     $page = new $classname($data, $error);
     self::$instance = $page;
     return self::$instance;
 }
function ParseMapDir($mappath)
{
    global $maps, $srcpath;
    $mapfiles = glob("{$srcpath}/{$mappath}/*.*");
    foreach ($mapfiles as $map) {
        $basename = remove_ext(basename($map));
        $noext = remove_ext($map);
        if (isset($maps[$basename])) {
            continue;
        }
        if (file_exists("{$noext}.png")) {
            $maps[$basename] = "{$noext}.png";
            continue;
        }
        $srcimg = getvgui($basename, $mappath);
        if ($srcimg) {
            $maps[$basename] = $srcimg;
        }
    }
}
Exemplo n.º 3
0
//if there are no files in the current directory
//Sort the folders and files array -done
//Icons
if ($view_mode == 0) {
    $files_icons_array = icons($files['name'], $view_mode);
    $folder_icon = $view_mode == 0 ? '<img border="0" src="dirLIST_files/icons_large/folder.png">' : '<img src="dirLIST_files/icons/folder.gif"> ';
} elseif ($view_mode == 1 && $file_icons) {
    $files_icons_array = icons($files['name'], $view_mode);
    $folder_icon = $view_mode == 0 ? '<img border="0" src="dirLIST_files/icons_large/folder.png">' : '<img src="dirLIST_files/icons/folder.gif"> ';
}
//Icons -done
//Hide file extensions if enabled
$files['name_with_ext'] = $files['name'];
if ($hide_file_ext == 1) {
    foreach ($files['name'] as $key => $val) {
        $files['name'][$key] = remove_ext($val);
    }
}
//Hide file extensions if enabled -done
if (!empty($folders['name']) || !empty($files['name'])) {
    ?>

<table width="<?php 
    echo $table_width;
    ?>
" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="320" rowspan="2" valign="top"><?php 
    if ($legend == 1) {
        ?>
            <table class="table_border" width="320" border="0" cellpadding="2" cellspacing="2">
Exemplo n.º 4
0
 * @author Rowan Seymour
 * @copyright This source is distributed under the GPL
 * @file The lists page
 * @modifications Cyril Maguire
 */
/* Gutama plugin package
 * @version 1.6
 * @date	01/10/2013
 * @author	Cyril MAGUIRE
*/
include 'inc/gutuma.php';
gu_init();
gu_theme_start();
// Import CSV into new list if one has been uploaded
if (isset($_FILES['import_file'])) {
    $name = remove_ext(basename($_FILES['import_file']['name']));
    if ($_FILES['import_file']['type'] == 'text/csv') {
        $csv = $_FILES['import_file']['tmp_name'];
        if ($list = gu_list::import_csv($name, $csv)) {
            if ($list->update()) {
                gu_success(t('List <b><i>%</i></b> imported from CSV file', array($name)));
            }
        }
        // Delete file
        if (is_file($csv)) {
            unlink($csv);
        }
    } else {
        gu_error(t('Uploaded file is not a csv file'));
    }
}
Exemplo n.º 5
0
$url = '';
// Handle subdomains.
handle_subdomains();
// Append the url part to $path.
$url .= $_GET['url'];
// Send 'Cache-Control' header.
header_cache($url);
// Load the modules.
load_modules($modules);
// If $path is a directory
if (is_dir(DIR_PUB . $url)) {
    // include its default file.
    read_file($url . DEFAULT_FILE);
    // If nothing was found, redirect to 404 error page.
    redirect(404, ERROR_404, $url);
} elseif (file_exists(DIR_PUB . $url)) {
    // check if there its file extension is unnecessary.
    remove_ext($url);
    // If nothing was found,
    read_file_ext($url);
} elseif (strrpos($url, DEFAULT_FILE) === ($diff = strlen($url) - strlen(DEFAULT_FILE))) {
    // redirect to dir/.
    redirect(301, substr($url, 0, $diff));
} elseif (isset($redir[$url])) {
    // redirect according to $redirect
    redirect(301, $redir[$url], FALSE, strpos($goto, '//') != FALSE);
} else {
    read_file($url);
    // If nothing was found, redirect to 404 error page.
    redirect(404, ERROR_404, $url);
}