本文整理汇总了PHP中sPrintF函数的典型用法代码示例。如果您正苦于以下问题:PHP sPrintF函数的具体用法?PHP sPrintF怎么用?PHP sPrintF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sPrintF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _secs_to_days
function _secs_to_days($secs)
{
$ret = $secs < 0 ? '- ' : '';
$secs = abs($secs);
$ret .= sPrintF('%d days %d:%02d:%02d', $secs / (60 * 60 * 24), $secs / (60 * 60) % 24, $secs / 60 % 60, $secs / 1 % 60);
return $ret;
}
示例2: quoted_printable_encode
function quoted_printable_encode($str, $wrap = true)
{
$ret = '';
$l = strLen($str);
$current_locale = setLocale(LC_CTYPE, 0);
setLocale(LC_CTYPE, 'C');
for ($i = 0; $i < $l; ++$i) {
$char = $str[$i];
if (ctype_print($char) && !ctype_cntrl($char) && $char !== '=') {
$ret .= $char;
} else {
$ret .= sPrintF('=%02X', ord($char));
}
}
setLocale(LC_CTYPE, $current_locale);
return $wrap ? wordWrap($ret, 67, " =\n") : $ret;
}
示例3: gs_user_is_valid_name
function gs_user_is_valid_name($username)
{
if (!preg_match('/^[a-z0-9\\-_.]+$/', $username)) {
return new GsError('Username must be lowercase alphanumeric.');
}
if (strLen($username) < 2) {
return new GsError('Username must have 2 characters or more.');
}
if (strLen($username) > 50) {
return new GsError('Username can\'t have more than 50 characters.');
}
if (preg_match('/^[.]/', $username)) {
return new GsError('Username must not start in ".".');
}
if (!preg_match('/^[a-z0-9\\-_][a-z0-9\\-_.]+$/', $username)) {
return new GsError('Invalid username.');
}
if (in_array($username, array('sysadmin', 'root', 'gemeinschaft', 'setup', 'my', 'prov', 'img', 'js', 'mon', 'styles', 'soap', 'srv'), true) || preg_match('/^nobody-/', $username)) {
return new GsError(sPrintF('"%s" cannot be used as a username.', $username));
}
return true;
}
示例4: processLogs
public function processLogs($logs)
{
if (empty($logs) || $this->getApplication()->getMode() === 'Performance') {
return;
}
if (headers_sent()) {
echo '
<div style="width:100%; background-color:darkred; color:#FFF; padding:2px">
TFirePhpLogRoute.GroupLabel "<i>' . $this->getGroupLabel() . '</i>" -
Routing to FirePHP impossible, because headers already sent!
</div>
';
$fallback = new TBrowserLogRoute();
$fallback->processLogs($logs);
return;
}
$firephp = FirePHP::getInstance(true);
$firephp->setOptions(array('useNativeJsonEncode' => false));
$firephp->group($this->getGroupLabel(), array('Collapsed' => true));
$firephp->log('Time, Message');
$first = $logs[0][3];
$c = count($logs);
for ($i = 0, $n = $c; $i < $n; ++$i) {
$message = $logs[$i][0];
$level = $logs[$i][1];
$category = $logs[$i][2];
if ($i < $n - 1) {
$delta = $logs[$i + 1][3] - $logs[$i][3];
$total = $logs[$i + 1][3] - $first;
} else {
$delta = '?';
$total = $logs[$i][3] - $first;
}
$message = sPrintF('+%0.6f: %s', $delta, preg_replace('/\\(line[^\\)]+\\)$/', '', $message));
$firephp->fb($message, $category, self::translateLogLevel($level));
}
$firephp->log(sPrintF('%0.6f', $total), 'Cumulated Time');
$firephp->groupEnd();
}
示例5: _gs_legacy_user_map_lvm
function _gs_legacy_user_map_lvm($user)
{
global $dispatcher_errors_html;
if (!$user) {
return false;
}
if (GS_LDAP_PROP_UID === GS_LDAP_PROP_USER) {
return $user;
}
$ldap = gs_ldap_connect();
$u = gs_ldap_get_first($ldap, GS_LDAP_SEARCHBASE, '(' . GS_LDAP_PROP_UID . '=' . $user . ')', array(GS_LDAP_PROP_USER));
if (isGsError($u)) {
//echo $u->$msg;
$dispatcher_errors_html[] = sPrintF(htmlEnt(__('Failed to get user "%s" from LDAP server.')), $user);
return false;
}
if (!is_array($u)) {
$dispatcher_errors_html[] = sPrintF(htmlEnt(__('User "%s" not found in LDAP database.')), $user);
return false;
}
$lc_GS_LDAP_PROP_USER = strToLower(GS_LDAP_PROP_USER);
if (!isset($u[$lc_GS_LDAP_PROP_USER])) {
return false;
}
if (!isset($u[$lc_GS_LDAP_PROP_USER][0])) {
return false;
}
$ret = $u[$lc_GS_LDAP_PROP_USER][0];
//if (gs_get_conf('GS_LVM_USER_6_DIGIT_INT')) {
// this check is not really needed as this is a custom function anyway
$ret = str_pad($ret, 6, '0', STR_PAD_LEFT);
//}
return $ret;
}
示例6: __
<br />
<button type="submit">
<img alt=" " src="<?php
echo GS_URL_PATH;
?>
crystal-svg/16/act/filesave.png" />
<?php
echo __('Speichern');
?>
</button>
<br />
<br />
<br />
<p class="text"><sup>[1]</sup> <?php
echo htmlEnt(sPrintF(__("String für den Dial()-Befehl. Dabei wird {number} automatisch von Gemeinschaft durch die zu wählende Rufnummer, {number:1} durch die Rufnummer ohne die erste Ziffer, {port} durch den eingestellten Port und {gateway} durch die interne Bezeichnung \"%s\" ersetzt."), $gw['name']));
?>
</p>
<p class="text"><sup>[2]</sup> <?php
echo __('Gateways müssen jeweils einer Gateway-Gruppe zugeordnet werden damit sie benutzt werden können.');
?>
</p>
</form>
<?php
}
#####################################################################
#####################################################################
if ($action == '') {
?>
示例7: gs_form_hidden
}
echo '</tbody>', "\n";
echo '</table>', "\n";
echo '<br />', "\n";
echo '<form method="post" action="', GS_URL_PATH, '" enctype="multipart/form-data">', "\n";
echo gs_form_hidden($SECTION, $MODULE), "\n";
echo '<input type="hidden" name="action" value="import" />', "\n";
echo '<input type="hidden" name="sep" value="', $sep, '" />', "\n";
echo '<input type="hidden" name="encl" value="', $encl, '" />', "\n";
echo '<input type="hidden" name="enc" value="', $enc, '" />', "\n";
echo '<input type="hidden" name="col_ln" value="', $col_ln, '" />', "\n";
echo '<input type="hidden" name="col_fn" value="', $col_fn, '" />', "\n";
echo '<input type="hidden" name="col_nr" value="', $col_nr, '" />', "\n";
echo '<input type="hidden" name="skip_1st" value="', (int) $skip_1st, '" />', "\n";
echo '<input type="hidden" name="rem_old_entries" value="', (int) $rem_old_entries, '" />', "\n";
echo '<p class="text">', @sPrintF(__('Daten in Ihr persönliches Telefonbuch (Benutzer <code>%s</code>, %s %s, Durchwahl <code>%s</code>) importieren?'), @$_SESSION['sudo_user']['name'], @$_SESSION['sudo_user']['info']['firstname'], @$_SESSION['sudo_user']['info']['lastname'], @$_SESSION['sudo_user']['info']['ext']), '</p>', "\n";
echo '<p class="text">';
echo '<input type="checkbox" name="rem_old_entries" id="ipt-rem_old_entries" value="1"', $rem_old_entries ? ' checked="checked" ' : '', ' />', "\n", '<label for="ipt-rem_old_entries">', __('Alte Daten entfernen und Telefonbuch ersetzen'), '</label>', "\n";
echo '</p>', "\n";
echo '<input type="submit" value="', __('Import'), '" /><br />', "\n";
echo '</form>', "\n";
echo '<br />', "\n";
}
}
if ($action === 'import') {
if (!@is_array(@$records) || count($records) < 1) {
echo 'Error.';
} else {
$user_id = (int) @$_SESSION['sudo_user']['info']['id'];
$query_start = 'INSERT INTO `pb_prv` (`user_id`, `firstname`, `lastname`, `number`) VALUES ' . "\n";
$sql_values = array();
示例8: htmlEnt
break;
default:
echo htmlEnt($cf['src']);
}
//echo '</td>' ,"\n";
//echo '<td>';
echo ' ';
switch ($cf['case']) {
case 'always':
echo __('sofort');
break;
case 'busy':
echo __('bei besetzt');
break;
case 'unavail':
echo sPrintF(__('nach %s Sek.'), $cf['timeout']);
break;
case 'offline':
echo __('offline');
break;
default:
echo htmlEnt($cf['case']);
}
//echo '</td>' ,"\n";
//echo '<td>';
echo ' ';
echo '→ ';
if ($cf['active'] === 'vml' || preg_match('/^vm/', $cf['number'], $m)) {
echo htmlEnt(__('AB'));
if (preg_match('/^(?:(?:vm)?)(.*)/', $cf['number'], $m)) {
$vm_number = $m[1];
示例9: _update_users
function _update_users($DB, $host_id, $host, $api, &$msg)
{
$host_id = (int) $host_id;
$num_users_total = (int) $DB->executeGetOne('SELECT COUNT(*) FROM `users` WHERE `host_id`=' . $host_id);
$num_users_updated = 0;
$msg = '';
if ($num_users_total < 1) {
return null;
}
switch ($api) {
case 'm01':
case 'm02':
# update all users on the host
$hp_route_prefix = (string) $DB->executeGetOne('SELECT `value` FROM `host_params` ' . 'WHERE `host_id`=' . $host_id . ' AND `param`=\'route_prefix\'');
if (!extension_loaded('soap')) {
$msg = 'Failed to sync users on foreign host (SoapClient not available).';
return false;
}
include_once GS_DIR . 'inc/boi-soap/boi-soap.php';
$rs = $DB->execute('SELECT ' . '`u`.`user`, `u`.`pin`, `u`.`firstname`, `u`.`lastname`, `u`.`email`, ' . '`s`.`secret` `sip_pwd`, `s`.`name` `ext` ' . 'FROM ' . '`users` `u` JOIN ' . '`ast_sipfriends` `s` ON (`s`.`_user_id`=`u`.`id`) ' . 'WHERE `u`.`host_id`=' . $host_id);
if ($rs->numRows() == 0) {
return null;
}
$soap_errors = array();
while ($userinfo = $rs->fetchRow()) {
$ext = $userinfo['ext'];
$sub_ext = subStr($ext, 0, strLen($hp_route_prefix)) === $hp_route_prefix ? subStr($ext, strLen($hp_route_prefix)) : $ext;
gs_log(GS_LOG_DEBUG, "Mapping ext. {$ext} to {$sub_ext} for SOAP call");
$ok = gs_boi_update_extension($api, $host, $hp_route_prefix, $sub_ext, $userinfo['user'], $userinfo['sip_pwd'], $userinfo['pin'], $userinfo['firstname'], $userinfo['lastname'], $userinfo['email'], $soap_faultcode);
if (!$ok) {
# SOAP error
if (strToUpper($soap_faultcode) === 'HTTP') {
# SOAP error: Could not connect to host
$msg = sPrintF(__('Die Benutzer auf Host %s konnten nicht aktualisiert werden! (Verbindung fehlgeschlagen.)'), htmlEnt($host) . ' (ID ' . $host_id . ')');
return false;
}
if (!array_key_exists($soap_faultcode, $soap_errors)) {
$soap_errors[$soap_faultcode] = 1;
} else {
$soap_errors[$soap_faultcode] = $soap_errors[$soap_faultcode] + 1;
}
} else {
++$num_users_updated;
}
}
if ($num_users_updated < $num_users_total) {
$msg = sPrintF(__('%u von %u Benutzern auf Host %s konnten nicht aktualisiert werden!'), $num_users_total - $num_users_updated, $num_users_total, htmlEnt($host) . ' (ID ' . $host_id . ')');
if (count($soap_errors) > 0) {
$msg .= ' (SOAP errors: ';
$i = 0;
foreach ($soap_errors as $soap_faultcode => $num) {
if ($i === 0) {
++$i;
} else {
$msg .= ', ';
}
$msg .= htmlEnt($soap_faultcode) . ' (' . $num . ')';
}
$msg .= ')';
}
return false;
} else {
$msg = sPrintF(__('Die Benutzer auf Host %s wurden aktualisiert.'), htmlEnt($host) . ' (ID ' . $host_id . ')');
return true;
}
break;
case '':
# host does not provide any API
return null;
break;
default:
$msg = 'Failed to sync users on foreign host! (unknown API)';
return false;
# unknown API
}
return null;
}
示例10: snom_xml_esc
$query = 'SELECT `lastname` `ln`, `firstname` `fn`, `number`
FROM
`pb_prv`
WHERE
`user_id`=' . $user_id . '
' . ($where ? 'AND (' . $where . ')' : '') . '
ORDER BY `lastname`, `firstname`
LIMIT ' . $num_results;
$rs = $db->execute($query);
if ($rs->numRows() !== 0) {
echo '<SnomIPPhoneDirectory>', "\n", '<Title>', snom_xml_esc($typeToTitle[$type]), '</Title>', "\n", '<Prompt>Prompt</Prompt>', "\n";
while ($r = $rs->fetchRow()) {
$name = $r['ln'] . (strLen($r['fn']) > 0 ? ', ' . $r['fn'] : '');
$number = preg_replace('/[^\\d*#]/', '', $r['number']);
echo '<DirectoryEntry>', '<Name>', snom_xml_esc($name), '</Name>', '<Telephone>', $number, '</Telephone>', '</DirectoryEntry>', "\n";
}
defineKeys();
echo '</SnomIPPhoneDirectory>', "\n";
} else {
echo '<SnomIPPhoneText>', "\n", '<Title>', snom_xml_esc($typeToTitle[$type]), '</Title>', "\n", '<Prompt>Prompt</Prompt>', "\n";
if (strLen($keys) > 0) {
echo '<Text>', snom_xml_esc(sPrintF(__("Keine Treffer für \"%s\". Drücken Sie # um die letzte Eingabe zu widerrufen."), $keys)), '</Text>', "\n";
} else {
echo '<Text>', snom_xml_esc(__("Ihr persönliches Telefonbuch enthält keine Einträge.")), '</Text>', "\n";
}
defineBackKey();
echo '</SnomIPPhoneText>', "\n";
}
_ob_send();
}
#################################### PRIVATE PHONEBOOK }
示例11: trim
$action = @$_REQUEST['action'];
$host_id = (int) @$_REQUEST['p_host_id'];
$user_id = (int) @$_REQUEST['p_user_id'];
$page = (int) @$_REQUEST['page'];
$u_rname = trim(@$_REQUEST['u_rname']);
$host = trim(@$_REQUEST['host']);
if ($action == '') {
$action = 'view';
}
if (@$_REQUEST['p_user'] != '') {
$action = 'add';
}
if ($action === 'add') {
$user_id = (int) $DB->executeGetOne('SELECT `id` FROM `users` WHERE `user`=\'' . $DB->escape(trim(@$_REQUEST['p_user'])) . '\'');
if ($user_id < 1) {
echo '<div class="errorbox">', sPrintF(__('Benutzer "%s" unbekannt.'), @$_REQUEST['p_user']), '</div>', "\n";
} else {
$perms = '';
if ((int) @$_REQUEST['p_perm_l'] == 1) {
$perms .= 'l';
}
if ($perms == '') {
echo '<div class="errorbox">', __('Sie haben keine Berechtigung ausgewählt.'), '</div>', "\n";
} else {
$ok = $DB->execute('REPLACE INTO `boi_perms` (`user_id`, `host_id`, `roles`) ' . 'VALUES (' . $user_id . ', ' . $host_id . ', \'' . $DB->escape($perms) . '\')');
if (!$ok) {
echo '<div class="errorbox">', 'Error.', '</div>', "\n";
}
}
}
$action = 'view';
示例12: trim
if ($err === 0) {
$out = trim(implode(' ', $out));
//$out = htmlEnt($out);
$screen->addString(1, $out, 0, $y = $y + 13, 'font="f13h"');
}
# uptime
$err = 0;
$out = array();
@exec('sudo cat /proc/uptime 2>>/dev/null', $out, $err);
if ($err === 0) {
$out = trim(implode(' ', $out));
$tmp = explode(' ', $out);
$uptime = (double) @$tmp[0];
$days = $uptime < 0 ? '- ' : '';
$uptime = abs($uptime);
$days .= sPrintF('%d days %d:%02d:%02d', $uptime / (60 * 60 * 24), $uptime / (60 * 60) % 24, $uptime / 60 % 60, $uptime / 1 % 60);
$screen->addString(2, 'Uptime: ' . $days, 0, $y = $y + 13, 'font="f13h"');
}
} elseif ($info === 'user') {
$rs = $db->execute('SELECT `id`, `lastname`, `firstname`, `email` FROM `users` WHERE `id`=' . $user_id);
$user = $rs->fetchRow();
$screen->addString(0, 'User Info', 107, 0, 'font="f18c" halign="Center" valign="Top"');
$screen->addString(1, 'user_id: ' . $user['id'], 0, $y = $y + 13, 'font="f13h"');
$screen->addString(2, 'lastname: ' . $user['lastname'], 0, $y = $y + 13, 'font="f13h"');
$screen->addString(3, 'firstname: ' . $user['firstname'], 0, $y = $y + 13, 'font="f13h"');
$screen->addString(4, 'email: ' . $user['email'], 0, $y = $y + 13, 'font="f13h"');
} elseif ($info === 'phone') {
$rs = $db->execute('SELECT `type`, `mac_addr`, `firmware_cur` FROM `phones` WHERE `user_id`=' . $user_id);
$phone = $rs->fetchRow();
$screen->addString(0, 'Phone Info', 107, 0, 'font="f18c" halign="Center" valign="Top"');
$screen->addString(1, 'Deine IP: ' . $remote_ip, 0, $y = $y + 13, 'font="f13h"');
示例13: gs_prov_group_change
$key_profile_id = null;
}
$prov_param_profile_id = (int) @$_REQUEST['group-' . $group_id . '-prov_param_profile_id'];
if ($prov_param_profile_id < 1) {
$prov_param_profile_id = null;
}
$parent_id = (int) @$_REQUEST['group-' . $group_id . '-parent_id'];
if ($parent_id < 1) {
$parent_id = null;
}
$show_ext_modules = (int) @$_REQUEST['group-' . $group_id . '-show_ext_modules'];
$ret = gs_prov_group_change($group_id, $parent_id, $name, $title, $key_profile_id, $prov_param_profile_id, $show_ext_modules);
if (isGsError($ret)) {
echo '<div class="errorbox">', $ret->getMsg(), '</div>', "\n";
} elseif (!$ret) {
echo '<div class="errorbox">', sPrintF(__('Gruppe "%s" konnte nicht gespeichert werden.'), htmlEnt($name)), '</div>', "\n";
}
}
if (GS_BUTTONDAEMON_USE == true) {
gs_usergroup_update_all_ui();
}
$action = '';
# view
}
#####################################################################
# save }
#####################################################################
#####################################################################
# delete {
#####################################################################
if ($action === 'delete') {
示例14: htmlEnt
data="<?php
echo $audio_url_esc;
?>
"
width="250"
height="22"
align="right"
>
<param name="src" value="<?php
echo $audio_url_esc;
?>
" />
<param name="autoplay" value="true" />
<param name="controller" value="true" />
<small><?php
echo htmlEnt(sPrintF(__("Datei nicht gefunden, Konvertierungsfehler oder fehlendes Plugin für %s"), $formats[$fmt]['title']));
?>
</small>
</object>
<?php
}
echo '<br />';
echo '<div class="r" style="font-size:80%; line-height:100%;"><a href="', $audio_url_dl_esc, '" style="text-decoration:none;" target="_blank"><img alt="+" title="', htmlEnt(__("In neuem Fenster öffnen")), '" src="', GS_URL_PATH, 'img/new-window.gif" /></a></div>';
echo "\n", '</div>', "\n";
}
echo '<h2>';
if (@$MODULES[$SECTION]['icon']) {
echo '<img alt=" " src="', GS_URL_PATH, str_replace('%s', '32', $MODULES[$SECTION]['icon']), '" /> ';
}
if (count($MODULES[$SECTION]['sub']) > 1) {
示例15: execCmd
function execCmd($cmd, $arg = array())
{
#-------------------------------------------------------------------------------
$proto = $this->https ? "https" : "http";
#-------------------------------------------------------------------------------
$params = array('login' => $this->login, 'psw' => $this->password, 'charset' => 'utf-8', 'fmt' => 3);
#-------------------------------------------------------------------------------
$params = array_merge($params, $arg);
$urlParams = "";
#-------------------------------------------------------------------------------
foreach ($params as $param => $value) {
$urlParams .= sprintf("%s=%s&", $param, urlencode($value));
}
#-------------------------------------------------------------------------------
$url = sPrintF("%s://smsc.ru/sys/%s.php?%s", $proto, $cmd, $urlParams);
#Debug(SPrintF('[system/classes/SMSC.class.php]: url = %s',$url));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$i = 0;
do {
if ($i) {
sleep(2);
}
$ret = $this->readUrl($url);
} while ($ret == "" && ++$i < 3);
if ($ret == "") {
throw new jException("Error reading URL: " . $url);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Result = Json_Decode($ret, TRUE);
if (isset($Result['error'])) {
$this->error = SPrintF('error_code = %s; error = (%s)', $Result['error_code'], $Result['error']);
throw new jException(SPrintF('error_code = %s; error = (%s)', $Result['error_code'], $Result['error']));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return $Result;
#-------------------------------------------------------------------------------
}