Merge pull request #15815 from artfulrobot/issue-1108-fix-unsubscribe
[civicrm-core.git] / CRM / Core / Page / Inline / Help.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 * @package CRM
ca5cec67 14 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
15 * $Id$
16 *
17 */
18
19/**
20 * This loads a smarty help file via ajax and returns as html
21 */
22class CRM_Core_Page_Inline_Help {
518fa0ee 23
00be9182 24 public function run() {
6a488035
TO
25 $args = $_REQUEST;
26 if (!empty($args['file']) && strpos($args['file'], '..') === FALSE) {
27 $file = $args['file'] . '.hlp';
6eea17da 28 $additionalTPLFile = $args['file'] . '.extra.hlp';
6a488035
TO
29 $smarty = CRM_Core_Smarty::singleton();
30 $smarty->assign('id', $args['id']);
31 CRM_Utils_Array::remove($args, 'file', 'class_name', 'type', 'q', 'id');
32 foreach ($args as &$arg) {
33 $arg = strip_tags($arg);
34 }
35 $smarty->assign('params', $args);
6eea17da 36
23d7e1c1 37 $output = $smarty->fetch($file);
6eea17da
E
38 $extraoutput = '';
39 if ($smarty->template_exists($additionalTPLFile)) {
6eea17da 40 $extraoutput .= trim($smarty->fetch($additionalTPLFile));
23d7e1c1
CW
41 // Allow override param to replace default text e.g. {hlp id='foo' override=1}
42 if ($smarty->get_template_vars('override_help_text')) {
43 $output = '';
44 }
6eea17da 45 }
23d7e1c1 46 exit($output . $extraoutput);
6a488035
TO
47 }
48 }
96025800 49
6a488035 50}