Moved configfile to own folder

This commit is contained in:
kolaente 2017-05-08 11:43:02 +02:00 committed by konrad
parent afcfb78250
commit 0f6b63e8ad
5 changed files with 29 additions and 10 deletions

View File

@ -1,5 +1,5 @@
<?php
if (file_exists('../inc/config.yml'))
if (file_exists('../config/config.yml'))
{
header('Location: index.php');
exit;
@ -247,7 +247,7 @@ RewriteRule ^(.*)$ /index.php?$1 [QSA,L]
}
//Write Config
$configfile = Yaml::dump($CONFIG);
if (file_put_contents('../inc/config.yml', $configfile))
if (file_put_contents('../config/config.yml', $configfile))
{
echo msg('success', 'Configfile was successfully created.');
} else

View File

@ -203,11 +203,11 @@ if (isset($_GET['update']))
//Update Version in Config File - only if we don't update an app
if (!isset($_GET['appUpdate']))
{
$config = Yaml::parse(file_get_contents('../inc/config.yml', FILE_USE_INCLUDE_PATH));
$config = Yaml::parse(file_get_contents('../config/config.yml', FILE_USE_INCLUDE_PATH));
$config['Versioning']['version'] = $version_remote->version;
$config['Versioning']['version_num'] = $version_remote->versionNum;
$configfile = Yaml::dump($config);
if (!file_put_contents('../inc/config.yml', $configfile))
if (!file_put_contents('../config/config.yml', $configfile))
{
echo msg('fail', $lang->get('general_config_fail'));
}

View File

@ -16,14 +16,18 @@ class apps
$i = 1;
$appdir = 'apps/';
//When the appdir wasn't found after 20 iterations, throw an error to prevent endless searching
while(!file_exists($appdir) && $i<21)
//When the appdir wasn't found after 30 iterations, throw an error to prevent endless searching
while(!file_exists($appdir) && $i<31)
{
$appdir = '../' . $appdir;
$i++;
}
if(!file_exists($appdir)) echo 'Could not find App dir.';
if(!file_exists($appdir))
{
echo 'Could not find app dir. (Too many iterations)';
exit;
}
//Loop through the apps
if ($handle = opendir($appdir))

View File

@ -5,9 +5,24 @@ date_default_timezone_set('Europe/Berlin');
//Parse Config
$config = [];
//Get Folderdepth
$cfg_path = 'config/config.yml';
$i = 0; // To prevent endless searching
while(!file_exists($cfg_path) && $i < 31)
{
$cfg_path = '../'.$cfg_path;
$i++;
}
if(!file_exists($cfg_path))
{
echo 'Could not find config file. (Too many iterations)';
exit;
}
require_once 'libs/YAML/autoload.php';
use Symfony\Component\Yaml\Yaml;
$config = Yaml::parse(file_get_contents('config.yml', FILE_USE_INCLUDE_PATH));
$config = Yaml::parse(file_get_contents($cfg_path));
if(file_exists(empty($config)))
{
echo 'Error finding config file.';

View File

@ -1,7 +1,7 @@
<?php
//Check if installed
if (file_exists('inc/config.yml'))
if (file_exists('config/config.yml'))
{
//Require Libs
require_once 'inc/libs/Smarty/Smarty.class.php';
@ -96,7 +96,7 @@ if (file_exists('inc/config.yml'))
}
//Build Copyright
$founded = date('Y', filemtime('inc/config.yml'));
$founded = date('Y', filemtime('config/config.yml'));
$copy = $founded;
if ($founded != date('Y'))
{