本文整理汇总了PHP中getstring函数的典型用法代码示例。如果您正苦于以下问题:PHP getstring函数的具体用法?PHP getstring怎么用?PHP getstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getstring函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: demo_process_thread
function demo_process_thread($act, $outformat, $lastid, $isuser, $canpost, $istyping, $postmessage)
{
global $kind_for_agent, $kind_info, $kind_events, $kind_user, $kind_agent, $webimroot, $settings;
loadsettings();
if ($act == "refresh" || $act == "post") {
$lastid++;
if ($outformat == "xml") {
start_xml_output();
print "<thread lastid=\"{$lastid}\" typing=\"" . ($istyping ? 1 : 0) . "\" canpost=\"" . ($canpost ? 1 : 0) . "\">";
} else {
start_html_output();
$url = "{$webimroot}/thread.php?act=refresh&thread=0&token=123&html=on&user=" . ($isuser ? "true" : "false");
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" . "<html>\n<head>\n" . "<link href=\"{$webimroot}/styles/default/chat.css\" rel=\"stylesheet\" type=\"text/css\">\n" . "<meta http-equiv=\"Refresh\" content=\"" . $settings['updatefrequency_oldchat'] . "; URL={$url}&sn=11\">\n" . "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n" . "<title>chat</title>\n" . "</head>\n" . "<body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400'>" . "<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message'>";
}
if ($lastid == 1) {
demo_print_message(array('ikind' => $kind_for_agent, 'created' => time() - 15, 'tname' => '', 'tmessage' => getstring2('chat.came.from', array("http://google.com"))), $outformat);
demo_print_message(array('ikind' => $kind_info, 'created' => time() - 15, 'tname' => '', 'tmessage' => getstring('chat.wait')), $outformat);
demo_print_message(array('ikind' => $kind_events, 'created' => time() - 10, 'tname' => '', 'tmessage' => getstring2("chat.status.operator.joined", array("Administrator"))), $outformat);
demo_print_message(array('ikind' => $kind_agent, 'created' => time() - 9, 'tname' => 'Administrator', 'tmessage' => getstring("demo.chat.welcome")), $outformat);
demo_print_message(array('ikind' => $kind_user, 'created' => time() - 5, 'tname' => getstring("chat.default.username"), 'tmessage' => getstring("demo.chat.question")), $outformat);
if ($canpost && $outformat == 'xml') {
demo_print_message(array('ikind' => $kind_info, 'created' => time() - 5, 'tname' => '', 'tmessage' => 'Hint: type something in message field to see typing notification'), $outformat);
}
}
if ($act == 'post') {
demo_print_message(array('ikind' => $isuser ? $kind_user : $kind_agent, 'created' => time(), 'tmessage' => $postmessage, 'tname' => $isuser ? getstring("chat.default.username") : "Administrator"), $outformat);
}
if ($outformat == "xml") {
print "</thread>";
} else {
print "</td></tr></table><a name='aend'></a>" . "</body></html>";
}
}
}
示例2: userLogin
function userLogin($username, $password, $log = true)
{
global $USER, $MSG;
if ($username == "") {
array_push($MSG, getstring('warning.login.noemail'));
return false;
}
if ($password == "") {
array_push($MSG, getstring('warning.login.nopassword'));
return false;
}
$USER = new User($username);
$USER->setUsername($username);
$USER->password = $password;
if ($USER instanceof User) {
if ($USER->validPassword($password)) {
$_SESSION["session_username"] = $USER->getUsername();
setcookie("user", $USER->getUsername(), time() + 60 * 60 * 24 * 30, "/");
setLang($USER->getProp('lang'));
if ($log) {
writeToLog('info', 'login', 'user logged in');
}
return true;
} else {
array_push($MSG, getstring('warning.login.invalid'));
writeToLog('info', 'loginfailure', 'username: ' . $username);
unset($USER);
return false;
}
} else {
return false;
}
}
示例3: thread_to_xml
function thread_to_xml($thread, $link)
{
global $state_chatting, $threadstate_to_string, $threadstate_key, $mibew_encoding, $operator, $settings, $can_viewthreads, $can_takeover, $mysqlprefix;
$state = $threadstate_to_string[$thread['istate']];
$result = "<thread id=\"" . safe_htmlspecialchars(safe_htmlspecialchars($thread['threadid'])) . "\" stateid=\"{$state}\"";
if ($state == "closed") {
return $result . "/>";
}
$state = getstring($threadstate_key[$thread['istate']]);
$nextagent = $thread['nextagent'] != 0 ? operator_by_id_($thread['nextagent'], $link) : null;
$threadoperator = $nextagent ? get_operator_name($nextagent) : ($thread['agentName'] ? $thread['agentName'] : "-");
if ($threadoperator == "-" && $thread['groupname']) {
$threadoperator = "- " . $thread['groupname'] . " -";
}
if (!($thread['istate'] == $state_chatting && $thread['agentId'] != $operator['operatorid'] && !is_capable($can_takeover, $operator))) {
$result .= " canopen=\"true\"";
}
if ($thread['agentId'] != $operator['operatorid'] && $thread['nextagent'] != $operator['operatorid'] && is_capable($can_viewthreads, $operator)) {
$result .= " canview=\"true\"";
}
if ($settings['enableban'] == "1") {
$result .= " canban=\"true\"";
}
$banForThread = $settings['enableban'] == "1" ? ban_for_addr_($thread['remote'], $link) : false;
if ($banForThread) {
$result .= " ban=\"blocked\" banid=\"" . safe_htmlspecialchars(safe_htmlspecialchars($banForThread['banid'])) . "\"";
}
$result .= " state=\"{$state}\" typing=\"" . safe_htmlspecialchars(safe_htmlspecialchars($thread['userTyping'])) . "\">";
$result .= "<name>";
if ($banForThread) {
$result .= safe_htmlspecialchars(getstring('chat.client.spam.prefix'));
}
$result .= safe_htmlspecialchars(safe_htmlspecialchars(get_user_name($thread['userName'], $thread['remote'], $thread['userid']))) . "</name>";
$result .= "<addr>" . safe_htmlspecialchars(get_user_addr($thread['remote'])) . "</addr>";
$result .= "<agent>" . safe_htmlspecialchars(safe_htmlspecialchars($threadoperator)) . "</agent>";
$result .= "<time>" . safe_htmlspecialchars(safe_htmlspecialchars($thread['unix_timestamp(dtmcreated)'])) . "000</time>";
$result .= "<modified>" . safe_htmlspecialchars(safe_htmlspecialchars($thread['unix_timestamp(dtmmodified)'])) . "000</modified>";
if ($banForThread) {
$result .= "<reason>" . safe_htmlspecialchars(safe_htmlspecialchars($banForThread['comment'])) . "</reason>";
}
$userAgent = get_useragent_version($thread['userAgent']);
$result .= "<useragent>" . safe_htmlspecialchars($userAgent) . "</useragent>";
if ($thread["shownmessageid"] != 0) {
$query = "select tmessage from {$mysqlprefix}chatmessage where messageid = " . intval($thread["shownmessageid"]);
$line = select_one_row($query, $link);
if ($line) {
$message = preg_replace("/[\r\n\t]+/", " ", $line["tmessage"]);
$result .= "<message>" . safe_htmlspecialchars(safe_htmlspecialchars($message)) . "</message>";
}
}
$result .= "</thread>";
return $result;
}
示例4: check_login
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once '../libs/common.php';
require_once '../libs/operator.php';
require_once '../libs/chat.php';
$operator = check_login();
$page = array();
setlocale(LC_TIME, getstring("time.locale"));
function notification_info($id)
{
global $mysqlprefix;
$link = connect();
$notification = select_one_row(db_build_select("id, locale, vckind, vcto, unix_timestamp(dtmcreated) as created, vcsubject, tmessage, refoperator", "{$mysqlprefix}chatnotification", array("id = {$id}"), ""), $link);
mysql_close($link);
return $notification;
}
$notificationid = verifyparam("id", "/^(\\d{1,9})\$/");
$page['notification'] = notification_info($notificationid);
prepare_menu($operator, false);
start_html_output();
require '../view/notification.php';
示例5: error
/**
* Handle parsing error
*/
protected function error($message, $text = '', $questionname = '')
{
global $MSG;
array_push($MSG, getstring("import.quiz.error.questionformat", array($questionname)));
$this->importerrors++;
}
示例6: getstring
echo "<li>" . $err . "</li>";
}
echo "</ul></div>";
}
echo "<p>" . getstring("reset.text") . "</h1>";
?>
<form method="post" action="">
<div class="formblock">
<div class="formlabel"><?php
echo getstring('register.email');
?>
</div>
<div class="formfield"><input type="text" name="email" value="<?php
echo $email;
?>
"></input></div>
</div>
<div class="formblock">
<div class="formlabel"> </div>
<div class="formfield">
<input type="submit" name="submit" value="<?php
echo getstring("reset.submit.button");
?>
"></input>
</div>
</div>
</form>
<?php
include_once "./includes/footer.php";
示例7: optional_param
$new = optional_param("new", "", PARAM_TEXT);
$view = optional_param("view", "invite", PARAM_TEXT);
$q = $API->getQuizForUser($qref, $USER->userid);
if (!$q) {
die;
}
printf("<h1>%s</h1>", $q->title);
if ($new == "true") {
printf("<div class='info'>%s</div>", getstring("quiz.new.saved", array($CONFIG->homeAddress . "m/?preview=true#" . $q->ref, $CONFIG->homeAddress . "quiz/edit.php?ref=" . $q->ref)));
} else {
if ($new == "false") {
printf("<div class='info'>%s</div>", getstring("quiz.edit.saved", array($CONFIG->homeAddress . "m/?preview=true#" . $q->ref, $CONFIG->homeAddress . "quiz/edit.php?ref=" . $q->ref)));
}
}
if ($q->draft) {
printf("<div class='info'>%s</div>", getstring('quiz.draft'));
} else {
?>
<div id="share">
<h2>Share:</h2>
<div id="tweet">
<?php
printf('<a href="https://twitter.com/share" class="twitter-share-button"
data-url="%sm/#%s" data-text="Try my new quiz \'%s\'"
data-size="large" data-count="none"
data-hashtags="mquiz">Tweet</a>', $CONFIG->homeAddress, $q->ref, $q->title);
?>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
示例8: time
<?php
/*
*
* Данный файл является частью проекта Веб Мессенджер.
*
* Все права защищены. (c) 2005-2009 ООО "ТОП".
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.thread.php';
$operator = Operator::getInstance()->GetLoggedOperator(false);
// папка online в мэмкэш --------------------
//touch_online_file(OPERATOR_VIEW_TRACKER_FILE);
$mem_buff->set('OPERATOR_VIEW_TRACKER_FILE', time(), 1800);
if (!$operator) {
Browser::SendXmlHeaders();
echo "<error><descr>" . escape_with_cdata(getstring("agent.not_logged_in")) . "</descr></error>";
exit;
}
$xml = Thread::getInstance()->BuildVisitorsXml();
Browser::SendXmlHeaders();
echo $xml;
示例9: foreach
</h1>
<?php
if (!empty($MSG)) {
echo "<div class='warning'><ul>";
foreach ($MSG as $err) {
echo "<li>" . $err . "</li>";
}
echo "</ul></div>";
}
?>
<form method="post" action="">
<div class="formblock">
<div class="formlabel"><?php
echo getstring('import.quiz.title');
?>
</div>
<div class="formfield"><input type="text" name="title" size="60" value="<?php
echo htmlentities($q->title);
?>
"></input></div>
</div>
<div class="formblock">
<div class="formlabel"> </div>
<div class='formfield'>
<input type="checkbox" name="quizdraft" value="1"
<?php
if ($q->draft == 1) {
echo "checked='checked'";
}
示例10: getstring
</div>
</div>
</div>
<?php
}
?>
</div>
<div class="formblock">
<div class="formlabel"> </div>
<div class="formfield"><input type="button" name="addquestion" value="<?php
echo getstring("quiz.edit.add");
?>
" onclick="addQuestion()"/></div>
</div>
<div class="formblock">
<div class="formlabel"> </div>
<div class="formfield"><input type="submit" name="submit" value="<?php
echo getstring("quiz.edit.submit.button");
?>
"></input></div>
</div>
<input type="hidden" id="noquestions" name="noquestions" value="<?php
echo count($qq);
?>
">
</form>
</div>
<?php
include_once "../includes/footer.php";
示例11: Start
function Start($id){
global $serversockets, $clientsockets, $sockets_status, $settings, $reqmessage,
$timeout;
$message = '';
if(($message = getstring($clientsockets[$id], 10)) === CLOSED_SOCKET){
close($id);
return CLOSED_SOCKET;
}
elseif($message === NO_DATA)
return NOT_ALL_DATA;
@$reqmessage[$id] .= $message;
// Checking the packet
if($reqmessage[$id][0] !== VER){
close($id);
return CLOSED_SOCKET;
}
if(!isset($reqmessage[$id][1]))
return NOT_ALL_DATA;
if(ord($reqmessage[$id][1]) > strlen($reqmessage[$id]) - 2)
return NOT_ALL_DATA;
elseif(ord($reqmessage[$id][1]) === strlen($reqmessage[$id]) - 2){
if($settings['AUTH'] !== 1){
sendstring($clientsockets[$id], VER.AUTH_NOT_REQ);
unset($reqmessage[$id]);
$sockets_status[$id] = STATUS_REQUESTRECV;
$timeout[$id] = time();
return 0;
}
if(strstr(substr($reqmessage[$id], 2, ord($reqmessage[$id][1])), AUTH_METHOD))
{
$timeout[$id] = time();
$sockets_status[$id] = STATUS_RECVAUTHREQ;
sendstring($clientsockets[$id], VER.AUTH_METHOD);
unset($reqmessage[$id]);
return 0;
}
else{
sendstring($clientsockets[$id], VER.WRONG_AUTH_METHODS);
return 0;
close($id);
return CLOSED_SOCKET;
}
$sockets_status[$id] = STATUS_REQUEST;
return 0;
}
else{
close($id);
return CLOSED_SOCKET;
}
}
示例12: getstring
?>
</div>
</div>
<div class="formblock">
<div class="formlabel"><?php
echo getstring("profile.newpassword");
?>
</div>
<div class="formfield"><input type="password" name="password" value=""></input></div>
</div>
<div class="formblock">
<div class="formlabel"><?php
echo getstring("profile.repeatnewpassword");
?>
</div>
<div class="formfield"><input type="password" name="repeatpassword" value=""></input></div>
</div>
<div class="formblock">
<div class="formlabel"> </div>
<div class="formfield"><input type="submit" name="submit" value="<?php
echo getstring("profile.submit.button");
?>
"></input></div>
</div>
</form>
<?php
include_once "./includes/footer.php";
示例13: getstring
<?php
include_once "../config.php";
$PAGE = "myresults";
include_once "../includes/header.php";
$results = $API->getMyQuizScores();
?>
<h1><?php
echo getstring("myresults.title");
?>
</h1>
<?php
if (count($results) == 0) {
echo "<div class='info'>";
echo getstring("myresults.none");
echo "</div>";
} else {
echo "<div id='title' class='quizlist'>";
echo "<div style='clear:both'></div>";
echo "<div class='quiztitle'> </div>";
echo "<div class='quizcell'>Attempts</div>";
echo "<div class='quizcell'>Highest Score</div>";
echo "<div class='quizcell'>Lowest score</div>";
echo "<div class='quizcell'>Average Score</div>";
echo "<div class='quizcell'>Best Ranking</div>";
echo "<div style='clear:both'></div>";
echo "</div>";
foreach ($results as $r) {
echo "<div id='" . $r->ref . "' class='quizlist'>";
echo "<div class='quiztitle'><a href='" . $CONFIG->homeAddress . "quiz/view.php?ref=" . $r->ref . "'>" . $r->title . "</a></div>";
示例14: printf
printf("<div class='warning'>%s</div>", getstring("warning.quiz.hasattempts"));
}
?>
<div id="quizform">
<form method="post" action="">
<div class="info">
You you sure you want to delete the quiz '<?php
echo $q->title;
?>
'?
<p>This will completely remove the quiz and all its questions and cannot be undone.</p>
</div>
<div class="formblock">
<div class="formlabel"> </div>
<div class="formfield">
<input type="submit" name="delete" value="<?php
echo getstring("quiz.delete.button");
?>
"></input>
<input type="submit" name="cancel" value="<?php
echo getstring("quiz.delete.cancel.button");
?>
"></input>
</div>
</div>
</form>
</div>
<?php
include_once "../includes/footer.php";
示例15: getstring
}
?>
</div>
</div>
</div>
<?php
}
?>
</div>
<div class="formblock">
<div class="formlabel"> </div>
<div class="formfield"><input type="button" name="addquestion" value="<?php
echo getstring("quiz.new.add");
?>
" onclick="addQuestion()"/></div>
</div>
<div class="formblock">
<div class="formlabel"> </div>
<div class="formfield"><input type="submit" name="submit" value="<?php
echo getstring("quiz.new.submit.button");
?>
"></input></div>
</div>
<input type="hidden" id="noquestions" name="noquestions" value="2"/>
</form>
</div>
<?php
include_once "../includes/footer.php";