From: Joey Schulze Date: Tue, 28 Feb 2017 21:51:41 +0000 (+0100) Subject: Empty sceleton X-Git-Url: https://git.infodrom.org/?p=infodrom%2Fmusiikki-web.git;a=commitdiff_plain;h=0365c06631c01041835e6060da5157e52b3dfebc Empty sceleton --- 0365c06631c01041835e6060da5157e52b3dfebc diff --git a/class/autoloader.class.php b/class/autoloader.class.php new file mode 100644 index 0000000..5d080bc --- /dev/null +++ b/class/autoloader.class.php @@ -0,0 +1,27 @@ +loadValues($path); + } + + private function loadValues($path) + { + if (!is_readable($path)) + throw new Exception('Cannot open config file ' . $path); + + $f = fopen($path, 'r'); + if ($f === false) + throw new Exception('Cannot open config file ' . $path); + + while (($line = fgets($f)) !== false) { + $line = trim($line); + if (substr($line,0,1) == '#') continue; + if (!strlen($line)) continue; + + $parts = explode('=', $line, 2); + $this->values[$parts[0]] = $parts[1]; + } + + fclose($f); + } + + public function get($name) + { + if (!array_key_exists($name, $this->values)) + return NULL; + + return $this->values[$name]; + } +} diff --git a/class/template.class.php b/class/template.class.php new file mode 100644 index 0000000..d8178ac --- /dev/null +++ b/class/template.class.php @@ -0,0 +1,36 @@ +render($data); + } + + public function __construct($template) + { + $this->template = $template; + $this->templatePath = __DIR__ . '/../' . static::DIR . '/' . $this->template . '.phtml'; + + if (!is_readable($this->templatePath)) + throw new Exception("Template {$this->template} not found"); + } + + public function render(array $data=array()) + { + foreach ($data as $key => $value) + $$key = $value; + + ob_start(); // Output Buffer einschalten + include($this->templatePath); + $renderedText = ob_get_contents(); + ob_end_clean(); // Output Buffer beenden + + return $renderedText; + } +} diff --git a/class/utilities.class.php b/class/utilities.class.php new file mode 100644 index 0000000..1da847b --- /dev/null +++ b/class/utilities.class.php @@ -0,0 +1,39 @@ +', $path); + + $base = substr($path,0,-3); + $minfile = $base . '.min.js'; + + if (!file_exists($minfile)) + return sprintf('', $path); + + if (filemtime($minfile) > filemtime($path)) + return sprintf('', $minfile); + + return sprintf('', $path); + } + + public static function formatCSS($path) + { + if (substr($path,-4) != '.css' || substr($path,-8) == '.min.css') + return sprintf('', $path); + + $base = substr($path,0,-4); + $minfile = $base . '.min.css'; + + if (!file_exists($minfile)) + return sprintf('', $path); + + if (filemtime($minfile) > filemtime($path)) + return sprintf('', $minfile); + + return sprintf('', $path); + } + +} diff --git a/html/favicon.ico b/html/favicon.ico new file mode 100644 index 0000000..5e6f322 Binary files /dev/null and b/html/favicon.ico differ diff --git a/html/index.php b/html/index.php new file mode 100644 index 0000000..0b228f7 --- /dev/null +++ b/html/index.php @@ -0,0 +1,5 @@ +render([]); diff --git a/html/musiikki.css b/html/musiikki.css new file mode 100644 index 0000000..e69de29 diff --git a/html/musiikki.js b/html/musiikki.js new file mode 100644 index 0000000..e69de29