Now using absolute paths

This commit is contained in:
OptimusCrime
2014-10-16 19:15:37 +02:00
parent 10c89b9ca3
commit 5847a621e8
2 changed files with 13 additions and 3 deletions

9
base.php Executable file
View File

@@ -0,0 +1,9 @@
<?php
/*
*
* File: base.php
* Description: Keeps track of absolute path to files, to ease development
*
*/
define('ZOFF_BASE_PATH', dirname(__FILE__));

View File

@@ -55,7 +55,8 @@
*/
// Require the autoloader
require 'vendor/autoload.php';
require 'base.php';
require ZOFF_BASE_PATH . '/vendor/autoload.php';
// New instance of smarty
$template = new Smarty();
@@ -68,13 +69,13 @@ $template->right_delimiter = ']]';
if (!isset($_GET['q'])) {
// Not in a room, fetch active rooms
$dir = scandir('./lists');
$dir = scandir(ZOFF_BASE_PATH . '/lists');
$channels = [];
$time = 60 * 60 * 24 * 3;
foreach ($dir as $files) {
if (strpos($files, '.json') !== false) {
if (time() - filemtime('./lists/' . $files) < $time) {
if (time() - filemtime(ZOFF_BASE_PATH . '/lists/' . $files) < $time) {
$channels[] = ucfirst(str_replace('.json', '', $files));
}
}