Semantics.

This commit is contained in:
Lars Jung 2014-05-30 22:55:31 +02:00
parent 0d6410de8e
commit 25d84fe3df
6 changed files with 31 additions and 31 deletions

View File

@ -2,8 +2,8 @@
modulejs.define('core/settings', ['config', '_'], function (config, _) {
return _.extend({}, config.options, {
appHref: config.setup.APP_URL,
rootHref: config.setup.ROOT_URL,
currentHref: config.setup.CURRENT_URL
appHref: config.setup.APP_HREF,
rootHref: config.setup.ROOT_HREF,
currentHref: config.setup.CURRENT_HREF
});
});

View File

@ -37,7 +37,7 @@ modulejs.define('info', ['$', 'config'], function ($, config) {
setValue(this, values[$(this).data('id')]);
});
$('.idx-file .value').text(setup['INDEX_URL']);
$('.idx-file .value').text(setup['INDEX_HREF']);
$('.test.php .result').text(setup['PHP_VERSION']);
};

View File

@ -45,13 +45,13 @@ class App {
}
}
return normalize_path(ROOT_URL . implode("/", $encoded_parts), $trailing_slash);
return normalize_path(ROOT_HREF . implode("/", $encoded_parts), $trailing_slash);
}
public function to_path($url) {
$rel_url = substr($url, strlen(ROOT_URL));
$rel_url = substr($url, strlen(ROOT_HREF));
return normalize_path(ROOT_PATH . "/" . rawurldecode($rel_url));
}
@ -174,7 +174,7 @@ class App {
if ($folder->get_parent($cache)) {
$html .= "<tr>";
$html .= "<td class='fb-i'><img src='" . APP_URL . "client/images/fallback/parent.png' alt='folder-parent'/></td>";
$html .= "<td class='fb-i'><img src='" . APP_HREF . "client/images/fallback/parent.png' alt='folder-parent'/></td>";
$html .= "<td class='fb-n'><a href='..'>Parent Directory</a></td>";
$html .= "<td class='fb-d'></td>";
$html .= "<td class='fb-s'></td>";
@ -185,7 +185,7 @@ class App {
$type = $item->is_folder ? "folder" : "file";
$html .= "<tr>";
$html .= "<td class='fb-i'><img src='" . APP_URL . "client/images/fallback/" . $type . ".png' alt='" . $type . "'/></td>";
$html .= "<td class='fb-i'><img src='" . APP_HREF . "client/images/fallback/" . $type . ".png' alt='" . $type . "'/></td>";
$html .= "<td class='fb-n'><a href='" . $item->url . "'>" . basename($item->path) . "</a></td>";
$html .= "<td class='fb-d'>" . date("Y-m-d H:i", $item->date) . "</td>";
$html .= "<td class='fb-s'>" . ($item->size !== null ? intval($item->size / 1000) . " KB" : "" ) . "</td>";

View File

@ -15,7 +15,7 @@ class Thumb {
$this->app = $app;
$this->thumbs_path = CACHE_PATH . "/" . Thumb::$THUMB_CACHE;
$this->thumbs_href = CACHE_URL . Thumb::$THUMB_CACHE;
$this->thumbs_href = CACHE_HREF . Thumb::$THUMB_CACHE;
}

View File

@ -1,5 +1,5 @@
- var url = "<?= APP_URL ?>"
- var app_href = "<?= APP_HREF ?>"
- var fallback = "<?= FALLBACK ?>"
doctype 5
@ -15,15 +15,15 @@ html.no-js.browser( lang="en" )
title index · styled with {{pkg.name}} {{pkg.version}} ({{pkg.url}})
meta( name="description", content="index styled with {{pkg.name}} {{pkg.version}} ({{pkg.url}})" )
meta( name="viewport", content="width=device-width" )
link( rel="shortcut icon", href!="#{url}client/images/app-16x16.ico" )
link( rel="apple-touch-icon-precomposed", type="image/png", href!="#{url}client/images/app-48x48.png" )
link( rel="apple-touch-icon-precomposed", sizes="57x57", type="image/png", href!="#{url}client/images/app-57x57.png" )
link( rel="apple-touch-icon-precomposed", sizes="72x72", type="image/png", href!="#{url}client/images/app-72x72.png" )
link( rel="apple-touch-icon-precomposed", sizes="114x114", type="image/png", href!="#{url}client/images/app-114x114.png" )
link( rel="apple-touch-icon-precomposed", sizes="144x144", type="image/png", href!="#{url}client/images/app-144x144.png" )
link( rel="shortcut icon", href!="#{app_href}client/images/app-16x16.ico" )
link( rel="apple-touch-icon-precomposed", type="image/png", href!="#{app_href}client/images/app-48x48.png" )
link( rel="apple-touch-icon-precomposed", sizes="57x57", type="image/png", href!="#{app_href}client/images/app-57x57.png" )
link( rel="apple-touch-icon-precomposed", sizes="72x72", type="image/png", href!="#{app_href}client/images/app-72x72.png" )
link( rel="apple-touch-icon-precomposed", sizes="114x114", type="image/png", href!="#{app_href}client/images/app-114x114.png" )
link( rel="apple-touch-icon-precomposed", sizes="144x144", type="image/png", href!="#{app_href}client/images/app-144x144.png" )
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:300italic,700italic,300,700" )
link( rel="stylesheet", href!="#{url}client/css/styles.css" )
script( src!="#{url}client/js/scripts.js" )
link( rel="stylesheet", href!="#{app_href}client/css/styles.css" )
script( src!="#{app_href}client/js/scripts.js" )
body

View File

@ -43,26 +43,26 @@ function setup() {
if (SERVER_NAME === "lighttpd") {
$script_name = preg_replace("#^.*?//#", "/", $script_name);
}
define("APP_URL", normalize_path(dirname(dirname(dirname($script_name))), true));
define("APP_HREF", normalize_path(dirname(dirname(dirname($script_name))), true));
define("APP_PATH", normalize_path(dirname(dirname(dirname(dirname(__FILE__)))), false));
define("ROOT_URL", normalize_path(dirname(APP_URL), true));
define("ROOT_HREF", normalize_path(dirname(APP_HREF), true));
define("ROOT_PATH", normalize_path(dirname(APP_PATH), false));
$url_parts = parse_url(getenv("REQUEST_URI"));
$cur_url = normalize_path($url_parts["path"], true);
$rel_url = substr($cur_url, strlen(ROOT_URL));
$cur_path = normalize_path(ROOT_PATH . "/" . rawurldecode($rel_url));
if (!is_dir($cur_path)) {
$cur_url = normalize_path(dirname($cur_url), true);
$cur_path = normalize_path(dirname($cur_path), false);
$uri_parts = parse_url(getenv("REQUEST_URI"));
$current_href = normalize_path($uri_parts["path"], true);
$rel_href = substr($current_href, strlen(ROOT_HREF));
$current_path = normalize_path(ROOT_PATH . "/" . rawurldecode($rel_href));
if (!is_dir($current_path)) {
$current_href = normalize_path(dirname($current_href), true);
$current_path = normalize_path(dirname($current_path), false);
}
define("CURRENT_URL", $cur_url);
define("CURRENT_PATH", $cur_path);
define("CURRENT_HREF", $current_href);
define("CURRENT_PATH", $current_path);
define("INDEX_URL", normalize_path(APP_URL . "server/php/index.php", false));
define("INDEX_HREF", normalize_path(APP_HREF . "server/php/index.php", false));
define("CACHE_URL", normalize_path(APP_URL . "cache", true));
define("CACHE_HREF", normalize_path(APP_HREF . "cache", true));
define("CACHE_PATH", normalize_path(APP_PATH . "/cache", false));
define("HAS_WRITABLE_CACHE", @is_writable(CACHE_PATH));