Server IP : 103.119.228.120 / Your IP : 3.15.239.0 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/hendraso/public_html/Additional/smarty3/plugins/ |
Upload File : |
<?php /** * Smarty plugin * * @package Smarty * @subpackage PluginsFunction */ /** * Smarty {mailto} function plugin * * Type: function<br> * Name: mailto<br> * Date: May 21, 2002 * Purpose: automate mailto address link creation, and optionally encode them.<br> * Params: * <pre> * - address - (required) - e-mail address * - text - (optional) - text to display, default is address * - encode - (optional) - can be one of: * * none : no encoding (default) * * javascript : encode with javascript * * javascript_charcode : encode with javascript charcode * * hex : encode with hexidecimal (no javascript) * - cc - (optional) - address(es) to carbon copy * - bcc - (optional) - address(es) to blind carbon copy * - subject - (optional) - e-mail subject * - newsgroups - (optional) - newsgroup(s) to post to * - followupto - (optional) - address(es) to follow up to * - extra - (optional) - extra tags for the href link * </pre> * Examples: * <pre> * {mailto address="me@domain.com"} * {mailto address="me@domain.com" encode="javascript"} * {mailto address="me@domain.com" encode="hex"} * {mailto address="me@domain.com" subject="Hello to you!"} * {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"} * {mailto address="me@domain.com" extra='class="mailto"'} * </pre> * * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto} * (Smarty online manual) * @version 1.2 * @author Monte Ohrt <monte at ohrt dot com> * @author credits to Jason Sweat (added cc, bcc and subject functionality) * @param array $params parameters * @param Smarty_Internal_Template $template template object * @return string */ function smarty_function_mailto($params, $template) { static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true); $extra = ''; if (empty($params['address'])) { trigger_error("mailto: missing 'address' parameter",E_USER_WARNING); return; } else { $address = $params['address']; } $text = $address; // netscape and mozilla do not decode %40 (@) in BCC field (bug?) // so, don't encode it. $search = array('%40', '%2C'); $replace = array('@', ','); $mail_parms = array(); foreach ($params as $var => $value) { switch ($var) { case 'cc': case 'bcc': case 'followupto': if (!empty($value)) $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value)); break; case 'subject': case 'newsgroups': $mail_parms[] = $var . '=' . rawurlencode($value); break; case 'extra': case 'text': $$var = $value; default: } } if ($mail_parms) { $address .= '?' . join('&', $mail_parms); } $encode = (empty($params['encode'])) ? 'none' : $params['encode']; if (!isset($_allowed_encoding[$encode])) { trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex", E_USER_WARNING); return; } // FIXME: (rodneyrehm) document.write() excues me what? 1998 has passed! if ($encode == 'javascript') { $string = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');'; $js_encode = ''; for ($x = 0, $_length = strlen($string); $x < $_length; $x++) { $js_encode .= '%' . bin2hex($string[$x]); } return '<script type="text/javascript">eval(unescape(\'' . $js_encode . '\'))</script>'; } elseif ($encode == 'javascript_charcode') { $string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; for ($x = 0, $y = strlen($string); $x < $y; $x++) { $ord[] = ord($string[$x]); } $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n" . "{document.write(String.fromCharCode(" . implode(',', $ord) . "))" . "}\n" . "</script>\n"; return $_ret; } elseif ($encode == 'hex') { preg_match('!^(.*)(\?.*)$!', $address, $match); if (!empty($match[2])) { trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.",E_USER_WARNING); return; } $address_encode = ''; for ($x = 0, $_length = strlen($address); $x < $_length; $x++) { if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[$x])) { $address_encode .= '%' . bin2hex($address[$x]); } else { $address_encode .= $address[$x]; } } $text_encode = ''; for ($x = 0, $_length = strlen($text); $x < $_length; $x++) { $text_encode .= '&#x' . bin2hex($text[$x]) . ';'; } $mailto = "mailto:"; return '<a href="' . $mailto . $address_encode . '" ' . $extra . '>' . $text_encode . '</a>'; } else { // no encoding return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; } }