From d3da6108119aa4770051787d63394bad5032d2e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Bernigaud?= <come.bernigaud@opensides.be> Date: Wed, 16 Apr 2014 11:43:58 +0200 Subject: [PATCH] Fixes #3090 using CACHE_DIR for the auth file instead of /tmp --- setup/class_setupStep_Welcome.inc | 25 +++++++++++-------------- setup/setup_welcome.tpl | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/setup/class_setupStep_Welcome.inc b/setup/class_setupStep_Welcome.inc index bdf2cead0..2cc76ba2b 100644 --- a/setup/class_setupStep_Welcome.inc +++ b/setup/class_setupStep_Welcome.inc @@ -1,9 +1,8 @@ <?php - /* This code is part of FusionDirectory (http://www.fusiondirectory.org/) Copyright (C) 2007 Fabian Hickert - Copyright (C) 2011-2013 FusionDirectory + Copyright (C) 2011-2014 FusionDirectory This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,11 +24,13 @@ class Step_Welcome extends setup_step var $languages = array(); var $attributes = array(); var $header_image = "images/setup/welcome.png"; + var $authPath; function Step_Welcome() { $this->is_enabled = TRUE; $this->is_active = TRUE; + $this->authPath = CACHE_DIR.'/fusiondirectory.auth'; $this->update_strings(); } @@ -45,8 +46,8 @@ class Step_Welcome extends setup_step $smarty = get_smarty(); $smarty->assign('auth_id', session_id()); - $smarty->assign("path",'/tmp/fusiondirectory.auth'); - return($smarty->fetch(get_template_path("setup_welcome.tpl",TRUE,dirname(__FILE__)))); + $smarty->assign("path", $this->authPath); + return $smarty->fetch(get_template_path("setup_welcome.tpl", TRUE, dirname(__FILE__))); } function save_object() @@ -54,21 +55,17 @@ class Step_Welcome extends setup_step $id = ""; /* Get auth ID from file */ - $path = '/tmp/fusiondirectory.auth'; - if (file_exists($path) && is_readable($path)){ - $contents= file($path); - $id= chop($contents[0]); + if (file_exists($this->authPath) && is_readable($this->authPath)) { + $contents = file($this->authPath); + $id = chop($contents[0]); } /* Continue if we've the correct ID */ - if ($id == session_id()){ - $this->is_completed = true; + if ($id == session_id()) { + $this->is_completed = TRUE; } else { - $this->is_completed = false; + $this->is_completed = FALSE; } - } } - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/setup/setup_welcome.tpl b/setup/setup_welcome.tpl index 4f12abc10..ba02d21db 100644 --- a/setup/setup_welcome.tpl +++ b/setup/setup_welcome.tpl @@ -25,7 +25,7 @@ <b>{t}To continue...{/t}</b> </p> <p> - {t}For security reasons you need to authenticate for the installation by creating the file '/tmp/fusiondirectory.auth', containing the current session ID on the servers local filesystem. This can be done by executing the following command:{/t} + {t 1=$path}For security reasons you need to authenticate for the installation by creating the file '%1', containing the current session ID on the servers local filesystem. This can be done by executing the following command:{/t} </p> <tt> echo -n <b>{$auth_id}</b> > {$path} -- GitLab