本文整理汇总了PHP中safe_htmlspecialchars函数的典型用法代码示例。如果您正苦于以下问题:PHP safe_htmlspecialchars函数的具体用法?PHP safe_htmlspecialchars怎么用?PHP safe_htmlspecialchars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了safe_htmlspecialchars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_tabbar
function print_tabbar($maxwidth = 4)
{
global $page;
if ($page['tabs']) {
$tabbar = $page['tabs'];
$len = count($tabbar);
$selected = $page['tabselected'];
$tabbar2 = array();
for ($i = 0; $i < $len; $i++) {
$tabbar2[] = $i != $selected ? "<li><a href=\"" . safe_htmlspecialchars($tabbar[$i]['link']) . "\">" . safe_htmlspecialchars($tabbar[$i]['title']) . "</a></li>\n" : "<li class=\"active\"><a href=\"#\">" . safe_htmlspecialchars($tabbar[$i]['title']) . "</a></li>\n";
}
if ($len > $maxwidth) {
// && $len - $selected > $maxwidth
if ($selected < $maxwidth) {
$tabbar = array_splice($tabbar2, 0, $maxwidth);
array_splice($tabbar2, count($tabbar2), 0, $tabbar);
}
// else 3 rows menu
}
echo "<ul class=\"tabs\">\n";
$i = 0;
foreach ($tabbar2 as $v) {
if ($i > 0 && ($len - $i) % $maxwidth == 0) {
echo "</ul><br clear=\"all\"><ul class=\"tabs\">\n";
}
echo $v;
$i++;
}
echo "</ul>";
}
}
示例2: tpl_menu
function tpl_menu()
{
global $page, $mibewroot, $errors, $current_locale;
?>
<li>
<h2><b><?php
echo getlocal("lang.choose");
?>
</b></h2>
<ul class="locales">
<?php
foreach ($page['localeLinks'] as $id => $title) {
?>
<li<?php
menuloc($id);
?>
><a href="?locale=<?php
echo urlencode($id);
?>
"><?php
echo safe_htmlspecialchars($title);
?>
</a></li>
<?php
}
?>
</ul>
</li>
<?php
}
示例3: format_rss_text
function format_rss_text($text)
{
$text = format_text(trim($text), 1, 0, 1);
$text = strip_tags($text);
$text = safe_htmlspecialchars($text);
$text = cut_at_word($text, 250);
return $text;
}
示例4: get_user_addr
function get_user_addr($addr)
{
global $settings;
if ($settings['geolink'] && preg_match("/(\\d+\\.\\d+\\.\\d+\\.\\d+)/", $addr, $matches)) {
$userip = $matches[1];
return get_popup(safe_htmlspecialchars(str_replace("{ip}", $userip, $settings['geolink'])), '', safe_htmlspecialchars($addr), "GeoLocation", safe_htmlspecialchars("ip{$userip}"), safe_htmlspecialchars($settings['geolinkparams']));
}
return safe_htmlspecialchars($addr);
}
示例5: sanitize_message
/**
* Sanitize message body and make it a safe HTML string.
*
* @param array $msg Message object
* @return array Message object with sanitized body.
*/
function sanitize_message($msg)
{
$message_body = $msg['message'];
// Messages entered by user or operator cannot contain any markup
if ($msg['kind'] == Thread::KIND_USER || $msg['kind'] == Thread::KIND_AGENT) {
$message_body = safe_htmlspecialchars($message_body);
}
$msg['message'] = sanitize_string($message_body, 'low', 'moderate');
return $msg;
}
示例6: generate_button
function generate_button($title, $locale, $style, $group, $inner, $showhost, $forcesecure, $modsecurity)
{
$link = get_app_location($showhost, $forcesecure) . "/client.php";
if ($locale) {
$link = append_query($link, "locale={$locale}");
}
if ($style) {
$link = append_query($link, "style={$style}");
}
if ($group) {
$link = append_query($link, "group={$group}");
}
$modsecfix = $modsecurity ? ".replace('http://','').replace('https://','')" : "";
$jslink = safe_htmlspecialchars(append_query("'" . $link, "url='+escape(document.location.href{$modsecfix})+'&referrer='+escape(document.referrer{$modsecfix})"));
$temp = get_popup(safe_htmlspecialchars($link), "{$jslink}", $inner, safe_htmlspecialchars($title), "mibew", "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1");
return "<!-- mibew button -->" . $temp . "<!-- / mibew button -->";
}
示例7: tpl_content
function tpl_content()
{
global $page, $mibewroot, $errors;
?>
<?php
echo getlocal("page.notifications.intro");
?>
<br />
<br />
<?php
require_once 'inc_errors.php';
?>
<form name="notifyFilterForm" method="get" action="<?php
echo $mibewroot;
?>
/operator/notifications.php">
<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">
<div class="packedFormField">
<?php
echo getlocal("notifications.kind");
?>
<br/>
<select name="kind" onchange="this.form.submit();"><?php
foreach ($page['allkinds'] as $k) {
echo "<option value=\"" . safe_htmlspecialchars($k) . "\"" . ($k == form_value("kind") ? " selected=\"selected\"" : "") . ">" . getlocal("notifications.kind." . ($k ? $k : "all")) . "</option>";
}
?>
</select>
</div>
<div class="packedFormField">
<?php
echo getlocal("notifications.locale");
?>
<br/>
<select name="lang" onchange="this.form.submit();"><?php
foreach ($page['locales'] as $k) {
echo "<option value=\"" . safe_htmlspecialchars($k["id"]) . "\"" . ($k["id"] == form_value("lang") ? " selected=\"selected\"" : "") . ">" . safe_htmlspecialchars($k["name"]) . "</option>";
}
?>
</select>
</div>
<br clear="all"/>
</div><div class="formbottom"><div class="formbottomi"></div></div></div>
</form>
<br/>
<?php
if ($page['pagination']) {
?>
<table class="list">
<thead>
<tr class="header">
<th>
<?php
echo getlocal("notifications.head.to");
?>
</th><th>
<?php
echo getlocal("notifications.head.subj");
?>
</th><th>
<?php
echo getlocal("notifications.head.msg");
?>
</th><th>
<?php
echo getlocal("notifications.head.time");
?>
</th>
</tr>
</thead>
<tbody>
<?php
if ($page['pagination.items']) {
foreach ($page['pagination.items'] as $b) {
?>
<tr>
<td class="notlast">
<a href="<?php
echo $mibewroot;
?>
/operator/notification.php?id=<?php
echo urlencode($b['id']);
?>
" target="_blank" onclick="this.newWindow = window.open('<?php
echo $mibewroot;
?>
/operator/notification.php?id=<?php
echo urlencode($b['id']);
?>
', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=720,height=520,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;" class="<?php
echo $b['vckind'] == 'xmpp' ? 'xmpp' : 'mail';
//.........这里部分代码省略.........
示例8: setup_redirect_links
function setup_redirect_links($threadid, $token)
{
global $page, $mibewroot, $settings, $mysqlprefix;
loadsettings();
$link = connect();
$operatorscount = db_rows_count("{$mysqlprefix}chatoperator", array(), "", $link);
$groupscount = 0;
$groups = array();
if ($settings['enablegroups'] == "1") {
foreach (get_groups($link, true) as $group) {
if ($group['inumofagents'] == 0) {
continue;
}
$groups[] = $group;
}
$groupscount = count($groups);
}
prepare_pagination(max($operatorscount, $groupscount), 8);
$p = $page['pagination'];
$limit = $p['limit'];
$operators = select_multi_assoc(db_build_select("operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time", "{$mysqlprefix}chatoperator", array(), "order by vclogin " . $limit), $link);
$groups = array_slice($groups, $p['start'], $p['end'] - $p['start']);
mysql_close($link);
$agent_list = "";
$params = array('thread' => $threadid, 'token' => $token);
foreach ($operators as $agent) {
$params['nextAgent'] = $agent['operatorid'];
$status = $agent['time'] < $settings['online_timeout'] ? $agent['istatus'] == 0 ? getlocal("char.redirect.operator.online_suff") : getlocal("char.redirect.operator.away_suff") : "";
$agent_list .= "<li><a href=\"" . add_params($mibewroot . "/operator/redirect.php", $params) . "\" title=\"" . safe_htmlspecialchars(topage(get_operator_name($agent))) . "\">" . safe_htmlspecialchars(topage(get_operator_name($agent))) . "</a> {$status}</li>";
}
$page['redirectToAgent'] = $agent_list;
$group_list = "";
if ($settings['enablegroups'] == "1") {
$params = array('thread' => $threadid, 'token' => $token);
foreach ($groups as $group) {
$params['nextGroup'] = $group['groupid'];
$status = $group['ilastseen'] !== NULL && $group['ilastseen'] < $settings['online_timeout'] ? getlocal("char.redirect.operator.online_suff") : ($group['ilastseenaway'] !== NULL && $group['ilastseenaway'] < $settings['online_timeout'] ? getlocal("char.redirect.operator.away_suff") : "");
$group_list .= "<li><a href=\"" . add_params($mibewroot . "/operator/redirect.php", $params) . "\" title=\"" . safe_htmlspecialchars(topage(get_group_name($group))) . "\">" . safe_htmlspecialchars(topage(get_group_name($group))) . "</a> {$status}</li>";
}
}
$page['redirectToGroup'] = $group_list;
}
示例9: tpl_content
function tpl_content()
{
global $page, $mibewroot, $errors;
?>
<?php
if ($page['saved']) {
?>
<?php
echo getlocal("page.translate.done");
?>
<script type="text/javascript"><!--
if(window.opener && window.opener.location) {
window.opener.location.reload();
}
setTimeout( (function() { window.close(); }), 500 );
//--></script>
<?php
}
if (!$page['saved']) {
?>
<?php
echo getlocal("page.translate.one");
?>
<br/>
<br/>
<?php
require_once 'inc_errors.php';
?>
<form name="translateForm" method="post" action="<?php
echo $mibewroot;
?>
/operator/translate.php">
<?php
print_csrf_token_input();
?>
<input type="hidden" name="key" value="<?php
echo safe_htmlspecialchars($page['key']);
?>
"/>
<input type="hidden" name="target" value="<?php
echo safe_htmlspecialchars($page['target']);
?>
"/>
<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">
<div class="fieldForm">
<div class="field">
<div class="flabel"><?php
echo safe_htmlspecialchars($page['title1']);
?>
</div>
<div class="fvaluenodesc">
<textarea name="original" disabled="disabled" cols="20" rows="5" class="wide"><?php
echo form_value('original');
?>
</textarea>
</div>
</div>
<div class="field">
<div class="flabel"><?php
echo safe_htmlspecialchars($page['title2']);
?>
</div>
<div class="fvaluenodesc">
<textarea name="translation" cols="20" rows="5" class="wide"><?php
echo form_value('translation');
?>
</textarea>
</div>
</div>
<div class="fbutton">
<input type="image" name="save" value="" src="<?php
echo $mibewroot . safe_htmlspecialchars(getlocal("image.button.save"));
?>
" alt="<?php
echo safe_htmlspecialchars(getlocal("button.save"));
?>
"/>
</div>
</div>
</div><div class="formbottom"><div class="formbottomi"></div></div></div>
</form>
<?php
}
?>
<?php
}
示例10: connect
if ($thread['istate'] == $state_chatting) {
$link = connect();
commit_thread($threadid, array("istate" => intval($state_waiting), "nextagent" => 0, "groupid" => intval($nextid), "agentId" => 0, "agentName" => "''"), $link);
post_message_($thread['threadid'], $kind_events, getstring2_("chat.status.operator.redirect", array(get_operator_name($operator)), $thread['locale'], true), $link);
mysql_close($link);
} else {
$errors[] = getlocal("chat.redirect.cannot");
}
} else {
$errors[] = getlocal("chat.redirect.unknown_group");
}
} else {
$nextid = verifyparam("nextAgent", "/^\\d{1,10}\$/");
$nextOperator = operator_by_id($nextid);
if ($nextOperator) {
$page['message'] = getlocal2("chat.redirected.content", array(safe_htmlspecialchars(topage(get_operator_name($nextOperator)))));
if ($thread['istate'] == $state_chatting) {
$link = connect();
$threadupdate = array("istate" => intval($state_waiting), "nextagent" => intval($nextid), "agentId" => 0);
if ($thread['groupid'] != 0) {
if (FALSE === select_one_row("select groupid from {$mysqlprefix}chatgroupoperator where operatorid = " . intval($nextid) . " and groupid = " . intval($thread['groupid']), $link)) {
$threadupdate['groupid'] = 0;
}
}
commit_thread($threadid, $threadupdate, $link);
post_message_($thread['threadid'], $kind_events, getstring2_("chat.status.operator.redirect", array(get_operator_name($operator)), $thread['locale'], true), $link);
mysql_close($link);
} else {
$errors[] = getlocal("chat.redirect.cannot");
}
} else {
示例11: tpl_content
function tpl_content()
{
global $page, $mibewroot, $errors;
$notification = $page['notification'];
?>
<?php
echo getlocal("notification.intro");
?>
<br/><br/>
<div class="logpane">
<div class="header">
<div class="wlabel">
<?php
echo getlocal("notification.label.to");
?>
:
</div>
<div class="wvalue">
<?php
echo topage(safe_htmlspecialchars($notification['vcto']));
?>
</div>
<br clear="all"/>
<div class="wlabel">
<?php
echo getlocal("notification.label.time");
?>
:
</div>
<div class="wvalue">
<?php
echo date_to_text($notification['created']);
?>
</div>
<br clear="all"/>
<div class="wlabel">
<?php
echo getlocal("notification.label.subj");
?>
:
</div>
<div class="wvalue">
<?php
echo topage(safe_htmlspecialchars($notification['vcsubject']));
?>
</div>
<br clear="all"/>
</div>
<div class="message">
<?php
echo topage(prepare_html_message($notification['tmessage']));
?>
</div>
</div>
<br />
<a href="<?php
echo $mibewroot;
?>
/operator/notifications.php">
<?php
echo getlocal("notification.back_to_list");
?>
</a>
<br />
<?php
}
示例12: tpl_content
function tpl_content()
{
global $page, $mibewroot;
?>
<?php
echo getlocal("page.analysis.userhistory.intro");
?>
<br />
<br />
<?php
if ($page['pagination']) {
?>
<table class="list">
<thead>
<tr class="header">
<th>
<?php
echo getlocal("page.analysis.search.head_name");
?>
</th><th>
<?php
echo getlocal("page.analysis.search.head_host");
?>
</th><th>
<?php
echo getlocal("page.analysis.search.head_operator");
?>
</th><th>
<?php
echo getlocal("page.analysis.search.head_time");
?>
</th></tr>
</thead>
<tbody>
<?php
if ($page['pagination.items']) {
foreach ($page['pagination.items'] as $chatthread) {
?>
<tr>
<td>
<a href="<?php
echo $mibewroot;
?>
/operator/threadprocessor.php?threadid=<?php
echo urlencode($chatthread['threadid']);
?>
" target="_blank" onclick="this.newWindow = window.open('<?php
echo $mibewroot;
?>
/operator/threadprocessor.php?threadid=<?php
echo urlencode($chatthread['threadid']);
?>
', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=720,height=520,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><?php
echo topage(safe_htmlspecialchars($chatthread['userName']));
?>
</a>
</td>
<td>
<?php
echo get_user_addr(topage($chatthread['remote']));
?>
</td>
<td>
<?php
if ($chatthread['agentName']) {
echo topage(safe_htmlspecialchars($chatthread['agentName']));
}
?>
</td>
<td>
<?php
echo date_diff_to_text($chatthread['modified'] - $chatthread['created']);
?>
, <?php
echo date_to_text($chatthread['created']);
?>
</td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="5">
<?php
echo getlocal("tag.pagination.no_items");
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
if ($page['pagination.items']) {
echo "<br/>";
//.........这里部分代码省略.........
示例13: tpl_content
function tpl_content()
{
global $page, $mibewroot;
?>
<?php
echo getlocal("updates.intro");
?>
<br />
<br />
<div>
<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">
<?php
echo getlocal("updates.news");
?>
<br/>
<div id="news">
</div>
<?php
echo getlocal("updates.current");
?>
<br/>
<div id="cver"><?php
echo safe_htmlspecialchars($page['version']);
?>
</div>
<br/>
<?php
echo getlocal("updates.latest");
?>
<div id="lver"></div>
<br/>
<?php
echo getlocal("updates.installed_locales");
?>
<br/>
<?php
foreach ($page['localizations'] as $loc) {
?>
<?php
echo safe_htmlspecialchars($loc);
?>
<?php
}
?>
<br/><br/>
<?php
echo getlocal("updates.env");
?>
<br/>
PHP <?php
echo safe_htmlspecialchars($page['phpVersion']);
?>
</div><div class="formbottom"><div class="formbottomi"></div></div></div>
</div>
<?php
}
示例14: tpl_content
function tpl_content()
{
global $page, $mibewroot, $errors;
?>
<?php
echo getlocal("page_ban.intro");
?>
<br />
<br />
<?php
require_once 'inc_errors.php';
?>
<div class="tabletool">
<img src="<?php
echo $mibewroot;
?>
/images/buttons/createban.gif" border="0" alt=""/>
<a href="<?php
echo $mibewroot;
?>
/operator/ban.php" title="<?php
echo safe_htmlspecialchars(getlocal("page_bans.add"));
?>
">
<?php
echo getlocal("page_bans.add");
?>
</a>
</div>
<br clear="all"/>
<?php
if ($page['pagination']) {
?>
<table class="list">
<thead>
<tr class="header">
<th>
<?php
echo getlocal("form.field.address");
?>
</th><th>
<?php
echo getlocal("page_bans.to");
?>
</th><th>
<?php
echo getlocal("form.field.ban_comment");
?>
</th><th>
</th>
</tr>
</thead>
<tbody>
<?php
if ($page['pagination.items']) {
foreach ($page['pagination.items'] as $b) {
?>
<tr>
<td class="notlast">
<a href="ban.php?id=<?php
echo urlencode($b['banid']);
?>
" class="man" id="ti<?php
echo safe_htmlspecialchars($b['banid']);
?>
">
<?php
echo safe_htmlspecialchars($b['address']);
?>
</a>
</td>
<td class="notlast">
<?php
echo date_to_text($b['till']);
?>
</td>
<td>
<?php
if (strlen(topage($b['comment'])) > 30) {
echo safe_htmlspecialchars(substr(topage($b['comment']), 0, 30));
} else {
echo safe_htmlspecialchars(topage($b['comment']));
}
?>
</td>
<td>
<a class="removelink" id="i<?php
echo safe_htmlspecialchars($b['banid']);
?>
" href="<?php
echo $mibewroot;
?>
/operator/blocked.php?act=del&id=<?php
echo urlencode($b['banid']);
print_csrf_token_in_url();
?>
//.........这里部分代码省略.........
示例15: show_nav_option
function show_nav_option($title, $url, $extra = "")
{
global $site_sess;
$bgcolor = get_navrow_bg();
echo "<tr><td bgcolor=\"{$bgcolor}\" valign=top onmouseover=\"this.style.backgroundColor='#FFE673';this.style.cursor='hand';\" onclick=\"parent.frames['main'].location='" . $site_sess->url($url) . "'\" onmouseout=\"this.style.backgroundColor='" . $bgcolor . "'\">\n";
echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\"><tr><td>\n";
echo "<a href=\"" . $site_sess->url(safe_htmlspecialchars(strip_tags($url))) . "\" class=\"navlink\">" . $title . "</a> {$extra}\n";
echo "</td></tr></table>\n";
echo "</td></tr>\n";
echo "<tr><td bgcolor=\"#FFFFFF\"><img src=\"" . ROOT_PATH . "admin/images/spacer.gif\"></td></tr>\n";
}