From f7b996c37914340010adedd03f5c014dd756d3f1 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Sun, 10 Dec 2006 21:44:28 +0000 Subject: [PATCH] Strip HTML for hyperlink creation from core git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12002 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/page_header.php | 10 +++++----- functions/strings.php | 8 ++++++-- plugins/listcommands/functions.php | 10 ++++++---- templates/default/hyperlink.tpl | 32 ++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 templates/default/hyperlink.tpl diff --git a/functions/page_header.php b/functions/page_header.php index b00acdca..3bd771f3 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -147,11 +147,8 @@ EOS; * @param string target the target frame for this link */ function makeInternalLink($path, $text, $target='') { - global $base_uri; + global $base_uri, $oTemplate; // sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION); - if ($target != '') { - $target = " target=\"$target\""; - } // This is an inefficient hook and is only used by // one plugin that still needs to patch this code, @@ -162,7 +159,10 @@ function makeInternalLink($path, $text, $target='') { // //do_hook('internal_link', $text); - return ''.$text.''; + $oTemplate->assign('uri', $base_uri . $path); + $oTemplate->assign('text', $text); + $oTemplate->assign('target', $target); + return $oTemplate->fetch('hyperlink.tpl'); } /** diff --git a/functions/strings.php b/functions/strings.php index 28e9bfa0..2bc4d55c 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -792,7 +792,8 @@ function quoteimap($str) { * @since 1.4.2 */ function makeComposeLink($url, $text = null, $target='') { - global $compose_new_win,$javascript_on, $compose_width, $compose_height; + global $compose_new_win, $javascript_on, $compose_width, + $compose_height, $oTemplate; if(!$text) { $text = _("Compose"); @@ -811,7 +812,10 @@ function makeComposeLink($url, $text = null, $target='') { if($javascript_on) { sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION); $compuri = SM_BASE_URI.$url; - return "$text"; + $oTemplate->assign('uri', 'javascript:void(0)'); + $oTemplate->assign('text', $text); + $oTemplate->assign('onclick', "comp_in_new('$compuri','$compose_width','$compose_height')"); + return $oTemplate->fetch('hyperlink.tpl'); } // otherwise, just open new window using regular HTML diff --git a/plugins/listcommands/functions.php b/plugins/listcommands/functions.php index 93106964..adb7b49d 100644 --- a/plugins/listcommands/functions.php +++ b/plugins/listcommands/functions.php @@ -19,7 +19,7 @@ * internal function that builds mailing list links */ function plugin_listcommands_menu_do() { - global $passed_id, $passed_ent_id, $color, $mailbox, $message, $startMessage; + global $passed_id, $passed_ent_id, $color, $mailbox, $message, $startMessage, $oTemplate; /** * Array of commands we can deal with from the header. The Reply option @@ -63,13 +63,15 @@ function plugin_listcommands_menu_do() { $links[] = makeComposeLink($url, $fieldsdescr['reply']); } } else if ($proto == 'href') { - $links[] = '' - . $fieldsdescr[$cmd] . ''; + $oTemplate->assign('uri', $act); + $oTemplate->assign('target', '_blank'); + $oTemplate->assign('text', $fieldsdescr[$cmd]); + $output = $oTemplate->fetch('hyperlink.tpl'); + $links[] = $output; } } if (count($links) > 0) { - global $oTemplate; $oTemplate->assign('links', $links); $output = $oTemplate->fetch('plugins/listcommands/read_body_header.tpl'); return array('read_body_header' => $output); diff --git a/templates/default/hyperlink.tpl b/templates/default/hyperlink.tpl new file mode 100644 index 00000000..65359931 --- /dev/null +++ b/templates/default/hyperlink.tpl @@ -0,0 +1,32 @@ +> -- 2.25.1