本文整理汇总了PHP中getMessages函数的典型用法代码示例。如果您正苦于以下问题:PHP getMessages函数的具体用法?PHP getMessages怎么用?PHP getMessages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getMessages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMessage
function sendMessage($sentMsg, $senderChatId, $senderEmail, $groupId)
{
global $conn;
writeToFile("msg: {$sentMsg}, chat_id: {$senderChatId}, email: {$senderEmail}, group_id: {$groupId}");
//get the current timestamp
$timeStamp = date("Y-m-d H:i:s");
if ($groupId) {
//insert the sent msg to DB
$sql = "INSERT INTO CHATLINETABLE" . "(id, chat_id, user_email, text_line, time_stamp, group_id)" . "VALUES (NULL, {$senderChatId}, '{$senderEmail}', '{$sentMsg}', '{$timeStamp}', {$groupId})";
} else {
//insert the sent msg to DB
$sql = "INSERT INTO CHATLINETABLE" . "(id, chat_id, user_email, text_line, time_stamp, group_id)" . "VALUES (NULL, {$senderChatId}, '{$senderEmail}', '{$sentMsg}', '{$timeStamp}',NULL)";
}
try {
$result = $conn->query($sql);
if ($result) {
if (isset($_COOKIE['groupId'])) {
getGroupData($_COOKIE['groupId']);
} else {
if (isset($_COOKIE['sender']) && isset($_COOKIE['receiver'])) {
getMessages($_COOKIE['sender'], $_COOKIE['receiver'], $_COOKIE['recName']);
}
}
} else {
echo "Error while inserting data to chat table";
}
} catch (Exception $e) {
echo 'Exception in sendMessage() :' . $e->getMessage();
}
}
示例2: newMessage
/**
* Saves a new message and updates the cache.
*/
function newMessage($conn, $cache, $message)
{
// This is great PHP
if ($message == "0" || $message) {
$stmt = $conn->prepare("INSERT INTO messages (message) VALUES (:message);");
$stmt->execute(array(':message' => $message));
$cache->set("messages", getMessages($conn, null));
}
}
示例3: render
function render()
{
global $user, $twig;
$this->user = $user;
$this->loadMenu();
$this->campaign = updatesCampaign();
if ($this->user->loggedin and !$this->user->checkRole('miserend')) {
$this->mychurches = feltoltes_block();
}
if ($this->user->checkRole('"any"')) {
$this->chat = chat_load();
}
$this->messages = getMessages();
$this->html = $twig->render($this->template, (array) $this);
}
示例4: show_messages
function show_messages($target = "_global")
{
$mtypes = array("ERROR" => "danger", "WARN" => "warning", "OK" => "success");
foreach ($mtypes as $mt => $mcl) {
if (hasMessages($mt, $target)) {
$msgs = getMessages($mt, $target);
for ($i = 0; $i < count($msgs); $i++) {
?>
<div class="alert alert-<?php
echo $mcl;
?>
" role="alert"><?php
echo $msgs[$i];
?>
</div>
<?php
}
}
}
clearMessages($target);
}
示例5: run
public function run()
{
parent::run();
$this->getInputJson();
$newuser = new \User();
$validFields = array('username', 'email', 'password', 'nickname', 'name');
$fieldsToSubmit = array();
foreach ($validFields as $field) {
if ($this->input[$field] and $this->input[$field] != '') {
$fieldsToSubmit[$field] = $this->input[$field];
}
}
$success = $newuser->submit($fieldsToSubmit);
$messages = getMessages();
if (!$success) {
$exceptionTexts = array();
foreach ($messages as $message) {
$exceptionTexts[] = $message['text'];
}
throw new \Exception(implode("\n", $exceptionTexts));
}
}
示例6: exit
<?php
if (!defined('BASEPATH')) {
exit(__('No direct script access allowed'));
}
?>
<!-- START:: Global Messages | General Helper -->
<?php
echo getMessages();
?>
<!-- END:: Global Messages -->
<?php
/*
* TODO:: Below this is deprecated | To be removed after all file update finish
* Please use above method to get all global messages
*/
/*
if(!isset($error_message) || !is_array($error_message)) {$error_message = array();}
if(!isset($success_message) || !is_array($success_message)) {$success_message = array();}
if(count($success_message) > 0) { ?>
<div class="success"><?php
foreach($success_message as $v) { ?>
<p><?php echo "$v\n"; ?></p><?php
} ?>
</div><?php
}
if(count($error_message) > 0) { ?>
<div class="error"><?php
示例7: header
<?php
$page_title = "Postkast";
$file_name = "messages.php";
require_once "../header.php";
require_once "functions.php";
if (!isset($_SESSION["logged_in_user_id"])) {
header("Location: login.php");
}
$messages = getMessages();
?>
<html>
<body>
<table border=1 >
<tr>
<th>Eesnimi</th>
<th>Perekonnanimi</th>
<th>Sõnum</th>
</tr>
<?php
//iga massiivis oleva elemendi kohta
//count($tasks) - massiivi pikkus
for ($i = 0; $i < count($messages); $i++) {
echo "<tr>";
//echo "<td>".$lectures[$i]->id."</td>";
echo "<td align=center>" . $messages[$i]->fname . "</td>";
echo "<td align=center>" . $messages[$i]->lname . "</td>";
echo "<td align=center>" . $messages[$i]->message . "</td>";
//echo "<td align=center>".$lectures[$i]->title."</td>";
//echo "<td><a href='tasks.php?lecture_id=".$messages[$i]->lectureid."'>".$lectures[$i]->lname."</a></td>";
示例8: authed
function authed($username)
{
if (!isset($username)) {
getMessages($_POST["username"], true);
echo "<br>sent msgs:<br>";
getMessages($_POST["username"] . ".sent", true, false);
} else {
getMessages($username, true);
echo "<br>sent msgs:<br>";
getMessages($username . ".sent", true, false);
}
if (isset($_POST["api"])) {
break;
}
include "form.php";
return true;
}
示例9: add_photoAction
public function add_photoAction($id = null)
{
$userSession = $this->session->get('userSession');
$id = $userSession['id'];
$member = Members::findFirst($id);
if (!$member) {
$this->response->redirect('biz/add_photo/' . $userSession['id']);
}
$photos = MemberPhotos::find(array('member_id = "' . $id . '"', 'order' => 'id DESC'));
$this->view->setVars(['photos' => $photos, 'member' => $member]);
// POST
if ($this->request->isPost() && $this->request->hasFiles() == true) {
//ini_set('upload_max_filesize', '64M');
set_time_limit(1200);
$uploads = $this->request->getUploadedFiles();
$isUploaded = false;
#do a loop to handle each file individually
foreach ($uploads as $upload) {
#define a “unique” name and a path to where our file must go
$fileName = $upload->getname();
$fileInfo = new SplFileInfo($fileName);
$fileExt = $fileInfo->getExtension();
$fileExt = strtolower($fileExt);
$newFileName = substr(md5(uniqid(rand(), true)), 0, 10) . date('ymdhis') . '.' . $fileExt;
//$fileExt = $upload->getExtension();
$fileImageExt = array('jpeg', 'jpg', 'png');
//error_log("File Extension :".$fileExt, 0);
$fileType = '';
$filePath = '';
$path = '';
//$path = ''.$newFileName;
if (in_array($fileExt, $fileImageExt)) {
$path = 'img/member/' . $newFileName;
// img/business_member ?
$filePath = 'img/member/';
// img/business_member ?
//$fileType = 'Image';
}
#move the file and simultaneously check if everything was ok
$upload->moveTo($path) ? $isUploaded = true : ($isUploaded = false);
}
#if any file couldn't be moved, then throw an message
if ($isUploaded) {
$memberPhotos = new MemberPhotos();
$memberPhotos->created = date('Y-m-d H:i:s');
$memberPhotos->modified = date('Y-m-d H:i:s');
$memberPhotos->member_id = $userSession['id'];
$memberPhotos->file_path = $filePath;
$memberPhotos->filename = $newFileName;
$memberPhotos->caption = $this->request->getPost('caption');
if (count($photos) > 0) {
$memberPhotos->primary_pic = 'No';
} else {
$memberPhotos->primary_pic = 'Yes';
$userSession['primary_pic'] = $filePath . $newFileName;
$this->session->set('userSession', $userSession);
}
if ($memberPhotos->create()) {
return $this->response->redirect('biz/add_photo/' . $id);
} else {
// if member photos creation is failed.
$this->view->disable();
print_r($memberPhotos . getMessages());
}
}
}
}
示例10: getMessages
$chatID_temp = $chatIDobj->fetch();
$chatID = $chatID_temp['chatID'];
?>
<table class="chatTable" id="Message_<?php
echo $chatID_temp['chatID'];
?>
" rows="31" cols="2" id='messageArea'>
<tr>
<td><?php
echo $firstname . " " . $lastname;
?>
</td>
<td>You</td>
</tr>
<?php
echo getMessages($chatID_temp);
?>
</table>
<input id="messageText" type="text" name="messageArea"></input>
<?php
echo "<button id='btn_send' onclick=sendMessage({$chatID}); > Send </button>";
} else {
echo "<p> No messages to display, say something! </p>";
}
} else {
echo "<p>derp</p>";
}
//gets all the messages between two people
function getMessages($chatID)
{
include 'db.php';
示例11: getMessages
<!-- sidebar -->
<?php
include 'templates/sidebar.php';
?>
<!-- End sidebar -->
<!-- mainContent -->
<div id="mainContent">
<div id="inboxList">
<ul>
<?php
getMessages();
?>
</ul>
</div><!-- End inboxList -->
</div>
<!-- End mainContent -->
<!-- sidebar2 -->
<?php
include 'templates/sidebar2.php';
?>
<!-- End sidebar2 -->
示例12: array
<?php
}
?>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<!-- Contents -->
<div style="height:4em"></div>
<div class="container">
<div class="row messages">
<?php
$message_types = array(MSG_TYPE_ERR => 'alert-danger', MSG_TYPE_WARN => 'alert-warning', MSG_TYPE_INFO => 'alert-info');
$fmt = '<div class="alert %s" role="alert">%s</div>';
foreach ($message_types as $message_type => $alert_class) {
$messages = getMessages($message_type);
foreach ($messages as $message) {
printf($fmt, $alert_class, $message);
}
}
?>
</div>
<div class="row theme-showcase" role="main">
<?php
print $contents;
?>
</div>
</div>
</body>
</html>
示例13: showMessage
function showMessage($mess)
{
if ($mess['last'] > (time() - 3600*24*28)) {
global $db;
global $maxDepth;
global $maxLen;
$id = $mess['ID'];
$poster = $mess['poster'];
$subject = $mess['subject'];
$time = gmdate('j F Y H:i:s T',$mess['time']);
$message = strip_tags($mess['message'],'<b><i><u><a><s><font>');
if (strlen($message) > $maxLen) {
$message = substr($message, 0, $maxLen - 20) . '[truncated]' . substr($message, -20);
}
$importance = $mess['importance'];
$reply_to = $mess['reply_to'];
$ip = $mess['ip'];
$replies = numberOfReplies($id);
global $depth;
$tempDepth = $depth;
$query = "SELECT * FROM `messages` WHERE `poster` = \"$poster\"";
$postCount = mysql_num_rows(mysql_query($query,$db));
?>
<div style="padding-left: <?= $depth*20 ?>px;">
<p>
<small>
<a href="<?= $_PHP_SELF ?>?post=<?= $id ?>&maxDepth=1">View <?= $replies ?> Direct Replies</a>
<a href="<?= $_PHP_SELF ?>?post=<?= $id ?>">Permanent link</a>
<a href="postreply.php?reply=<?= $id ?>">Reply</a>
</small>
<?php if($_COOKIE['admin']) {?>
<small><a href="deletepost.php?post=<?= $id ?>">Delete</a></small>
<small><a href="editpost.php?post=<?= $id ?>">Edit</a></small><br />
<? } ?>
<br />
<strong><?= str_repeat('*',$importance) ?> <?=$subject?> <?= str_repeat('*',$importance) ?></strong><br />
<em><!--(<?=$id?> <?=$depth?> <?=$postCount?>)-->Posted by <b><?=$poster?></b> at <b><?=$time?></b></em></p>
<p><?=$message?></p>
<hr/>
</div>
<?
if ($depth < $maxDepth || $maxDepth == 0) {
$messages = getMessages($id);
$rows = mysql_num_rows($messages);
$depth++;
for ($i = 0; $i < $rows; $i++) {
showMessage(mysql_fetch_assoc($messages));
}
$depth = $tempDepth;
}
}
}
示例14: _
if ($_SESSION[$guid]["i18n"]["dateFormatRegEx"] == "") {
print "/^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\\d\\d\$/i";
} else {
print $_SESSION[$guid]["i18n"]["dateFormatRegEx"];
}
?>
, failureMessage: "Use <?php
if ($_SESSION[$guid]["i18n"]["dateFormat"] == "") {
print "dd/mm/yyyy";
} else {
print $_SESSION[$guid]["i18n"]["dateFormat"];
}
?>
." } );
date.add(Validate.Presence);
</script>
<script type="text/javascript">
$(function() {
$( "#date" ).datepicker();
});
</script>
<input style='min-width: 30px; margin-top: 0px; float: right' type='submit' value='<?php
print _('Go');
?>
'>
<?php
print "</form>";
print "</div>";
print "</div>";
print getMessages($guid, $connection2, "print", dateConvert($guid, $date));
}
示例15: list
<?php
/*
** Zabbix
** Copyright (C) 2001-2016 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
list($table, $info) = make_latest_issues($data['filter'], 'zabbix.php?action=dashboard.view');
$output = ['header' => _n('Last %1$d issue', 'Last %1$d issues', DEFAULT_LATEST_ISSUES_CNT), 'body' => (new CDiv([getMessages(), $table]))->toString(), 'footer' => (new CListItem($info))->toString() . (new CListItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS))))->toString()];
if ($data['user']['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) {
CProfiler::getInstance()->stop();
$output['debug'] = CProfiler::getInstance()->make()->toString();
}
echo (new CJson())->encode($output);