From 768cc19bbc10954eac1b8738324c778597d75f17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Dec 2017 15:07:06 +0100 Subject: [PATCH] Fix protection on tpl to avoid direct url call --- htdocs/core/tpl/bloc_comment.tpl.php | 8 ++++++++ htdocs/core/tpl/card_presend.tpl.php | 9 ++++++++- htdocs/core/tpl/commonfields_add.tpl.php | 8 ++++++++ htdocs/core/tpl/commonfields_edit.tpl.php | 8 ++++++++ htdocs/core/tpl/commonfields_view.tpl.php | 8 ++++++++ htdocs/core/tpl/extrafields_add.tpl.php | 8 ++++++++ htdocs/core/tpl/extrafields_edit.tpl.php | 8 ++++++++ htdocs/core/tpl/extrafields_list_print_fields.tpl.php | 8 ++++++++ htdocs/core/tpl/extrafields_list_search_input.tpl.php | 8 ++++++++ htdocs/core/tpl/extrafields_list_search_param.tpl.php | 8 ++++++++ htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 8 ++++++++ htdocs/core/tpl/extrafields_list_search_title.tpl.php | 8 ++++++++ htdocs/core/tpl/filemanager.tpl.php | 8 ++++++++ htdocs/core/tpl/onlinepaymentlinks.tpl.php | 7 +++++++ 14 files changed, 111 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/bloc_comment.tpl.php b/htdocs/core/tpl/bloc_comment.tpl.php index 48b0e0c990f..473c42eb42f 100644 --- a/htdocs/core/tpl/bloc_comment.tpl.php +++ b/htdocs/core/tpl/bloc_comment.tpl.php @@ -1,4 +1,12 @@ load("mails"); diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index 7179719e7db..5e1f02489f9 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -20,6 +20,14 @@ * $conf * $langs */ + +// Protection to avoid direct call of template +if (empty($conf) || ! is_object($conf)) +{ + print "Error, template page can't be called as URL"; + exit; +} + ?> attribute_label) && count($extrafields->attribute_label)) { diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index 8a65021b240..c3e3effc05d 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -1,4 +1,12 @@ attribute_label) && count($extrafields->attribute_label)) { diff --git a/htdocs/core/tpl/extrafields_list_search_param.tpl.php b/htdocs/core/tpl/extrafields_list_search_param.tpl.php index 9bb6fefe8b0..6cda8721dcd 100644 --- a/htdocs/core/tpl/extrafields_list_search_param.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_param.tpl.php @@ -1,4 +1,12 @@ $val) { diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index ed4fae40213..7006a54351b 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -1,4 +1,12 @@ $val) { diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php index bfda64d8464..8b986b1e4e6 100644 --- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_title.tpl.php @@ -1,4 +1,12 @@ attribute_label) && count($extrafields->attribute_label)) { diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index d47853cbe5a..4399b62851a 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -17,6 +17,14 @@ * Output code for the filemanager * $module must be defined ('ecm', 'medias', ...) */ + +// Protection to avoid direct call of template +if (empty($conf) || ! is_object($conf)) +{ + print "Error, template page can't be called as URL"; + exit; +} + ?> diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index 8650ab4110d..27ba8b994b4 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -15,6 +15,13 @@ * along with this program. If not, see . */ +// Protection to avoid direct call of template +if (empty($conf) || ! is_object($conf)) +{ + print "Error, template page can't be called as URL"; + exit; +} + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; print '';