From 70fc0b5c5cad643e23634438906c6920b4143210 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ <olivier@olivierperez.fr> Date: Sun, 18 Jan 2015 17:03:47 +0100 Subject: [PATCH] Logs have now a specific page in administration --- admin/index.php | 19 +++++++++++++++++++ admin/logs.php | 28 ++++++++++++++++++++++++++++ admin/migration.php | 18 ++++++++++++++++++ admin/polls.php | 1 - tpl/admin/index.tpl | 5 +++++ tpl/admin/logs.tpl | 5 +++++ tpl/admin/polls.tpl | 3 --- 7 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 admin/logs.php create mode 100644 tpl/admin/logs.tpl diff --git a/admin/index.php b/admin/index.php index 2d98b7e7..28014efd 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,5 +1,24 @@ <?php +/** + * This software is governed by the CeCILL-B license. If a copy of this license + * is not distributed with this file, you can obtain one at + * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt + * + * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ + * Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft) + * + * ============================= + * + * Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence + * ne se trouve pas avec ce fichier vous pouvez l'obtenir sur + * http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt + * + * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ + * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) + */ + require_once '../app/inc/init.php'; $smarty->assign('title', _('Administration')); +$smarty->assign('logsAreReadable', is_readable('../' . LOG_FILE)); $smarty->display('admin/index.tpl'); \ No newline at end of file diff --git a/admin/logs.php b/admin/logs.php new file mode 100644 index 00000000..e4be44d9 --- /dev/null +++ b/admin/logs.php @@ -0,0 +1,28 @@ +<?php +/** + * This software is governed by the CeCILL-B license. If a copy of this license + * is not distributed with this file, you can obtain one at + * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt + * + * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ + * Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft) + * + * ============================= + * + * Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence + * ne se trouve pas avec ce fichier vous pouvez l'obtenir sur + * http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt + * + * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ + * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) + */ + +require_once '../app/inc/init.php'; + +ob_start(); +is_readable('../' . LOG_FILE) ? readfile('../' . LOG_FILE) : null; +$content = ob_get_clean(); + +$smarty->assign('title', _('Administration')); +$smarty->assign('logs', $content); +$smarty->display('admin/logs.tpl'); \ No newline at end of file diff --git a/admin/migration.php b/admin/migration.php index cade588b..8bb2d3e6 100644 --- a/admin/migration.php +++ b/admin/migration.php @@ -1,4 +1,22 @@ <?php +/** + * This software is governed by the CeCILL-B license. If a copy of this license + * is not distributed with this file, you can obtain one at + * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt + * + * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ + * Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft) + * + * ============================= + * + * Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence + * ne se trouve pas avec ce fichier vous pouvez l'obtenir sur + * http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt + * + * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ + * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) + */ + use Framadate\Migration\From_0_0_to_0_8_Migration; use Framadate\Migration\From_0_8_to_0_9_Migration; use Framadate\Migration\From_0_9_to_0_9_1_Migration; diff --git a/admin/polls.php b/admin/polls.php index 71502e5b..57c12700 100644 --- a/admin/polls.php +++ b/admin/polls.php @@ -73,7 +73,6 @@ $smarty->assign('count', $count); $smarty->assign('page', $page); $smarty->assign('pages', ceil($count / POLLS_PER_PAGE)); $smarty->assign('poll_to_delete', $poll_to_delete); -$smarty->assign('log_file', is_readable('../' . LOG_FILE) ? LOG_FILE : null); $smarty->assign('crsf', $securityService->getToken('admin')); $smarty->display('admin/polls.tpl'); diff --git a/tpl/admin/index.tpl b/tpl/admin/index.tpl index 11bf4b7b..26841f3c 100644 --- a/tpl/admin/index.tpl +++ b/tpl/admin/index.tpl @@ -8,5 +8,10 @@ <div class="col-md-6 col-xs-12"> <a href="./migration.php"><h2>{_('Migration')}</h2></a> </div> + {if $logsAreReadable} + <div class="col-md-6 col-xs-12"> + <a href="./logs.php"><h2>{_('Logs')}</h2></a> + </div> + {/if} </div> {/block} \ No newline at end of file diff --git a/tpl/admin/logs.tpl b/tpl/admin/logs.tpl new file mode 100644 index 00000000..51eec0af --- /dev/null +++ b/tpl/admin/logs.tpl @@ -0,0 +1,5 @@ +{extends 'admin/admin_page.tpl'} + +{block 'admin_main'} +<pre>{$logs}</pre> +{/block} \ No newline at end of file diff --git a/tpl/admin/polls.tpl b/tpl/admin/polls.tpl index 59414b00..58d442f7 100644 --- a/tpl/admin/polls.tpl +++ b/tpl/admin/polls.tpl @@ -19,9 +19,6 @@ <div class="panel panel-default"> <div class="panel-heading"> {$polls|count} {_('polls in the database at this time')} - {if $log_file} - <a role="button" class="btn btn-default btn-xs pull-right" href="{$log_file|resource}">{_('Logs')}</a> - {/if} </div> -- GitLab