本文整理汇总了PHP中Post::Save方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::Save方法的具体用法?PHP Post::Save怎么用?PHP Post::Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Post
的用法示例。
在下文中一共展示了Post::Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page
function page()
{
for ($i = 0; $i < 1000; $i++) {
$a = new Post();
$a->CateID = 0;
$a->AuthorID = 1;
$a->Tag = '';
$a->Status = ZC_POST_STATUS_PUBLIC;
$a->Type = ZC_POST_TYPE_PAGE;
$a->Alias = '';
$a->IsTop = false;
$a->IsLock = false;
$a->Title = getRandStr(mt_rand(6, 10));
$a->Intro = '';
$a->Content = getRandStr(mt_rand(200, 300)) . GetGuid() . '<br/>' . GetGuid();
$a->IP = GetGuestIP();
$a->PostTime = time();
$a->CommNums = 0;
$a->ViewNums = 0;
$a->Template = '';
$a->Meta = '';
$a->Save();
}
}
示例2: switch
if ($_POST['submit_button'] == 'Save Draft and Continue Editing' || $_POST['submit_button'] == 'Save' || $_POST['submit_button'] == 'Save and Publish') {
$redirect = true;
// Get all the Form Data
$myPost->SetValues($_POST);
switch ($_POST['submit_button']) {
case 'Save Draft and Continue Editing':
$myPost->SetValue('status', 'Draft');
$redirect = false;
break;
case 'Save and Publish':
$myPost->SetValue('status', 'Published');
default:
break;
}
// Save the info to the DB if there is no errors
if ($myPost->Save()) {
// Sync in the Tags
$myPostTag = new PostTag();
$myPostTag->SetValue('post_id', $myPost->GetPrimary());
$myPostTag->Sync($myPost->GetValue('tags'));
SetAlert('Post Information Saved.', 'success');
// Redirect if needed
if ($redirect) {
header('location:posts.php');
die;
}
}
}
// If Deleting the Page
if ($_POST['submit_button'] == 'Delete') {
// Get all the form data
示例3: processPosts
function processPosts($counter = 0)
{
global $USER, $STATS;
while (isset($_POST["p_p" . $counter])) {
if (STATS_ACTIVE) {
$STATS->ProcessAction(ST_ACTION_EXTERNAL_POST);
}
$id = md5($USER->Browsers[0]->SystemId . AJAXDecode($_POST[POST_EXTERN_CHAT_ID]) . AJAXDecode($_POST["p_i" . $counter]));
$post = new Post($id, $USER->Browsers[0]->SystemId, $USER->Browsers[0]->InternalUser->SystemId, AJAXDecode($_POST["p_p" . $counter]), time(), $USER->Browsers[0]->ChatId);
if (isset($_POST["p_pt" . $counter])) {
$post->Translation = AJAXDecode($_POST["p_pt" . $counter]);
$post->TranslationISO = AJAXDecode($_POST["p_ptiso" . $counter]);
}
$post->Save();
$USER->AddFunctionCall("lz_chat_release_post('" . AJAXDecode($_POST["p_i" . $counter]) . "');", false);
$counter++;
}
$counter = 0;
while (isset($_POST["pr_i" . $counter])) {
markPostReceived(AJAXDecode($_POST["pr_i" . $counter]));
$USER->AddFunctionCall("lz_chat_message_set_received('" . AJAXDecode($_POST["pr_i" . $counter]) . "');", false);
$counter++;
}
}
示例4: ProcessPosts
function ProcessPosts()
{
global $USER;
$pc = 0;
if (!empty($USER->Browsers[0]->QueuedPosts)) {
if (!$USER->Browsers[0]->Waiting) {
while (!empty($_GET["mi" . $pc])) {
$pc++;
}
foreach ($USER->Browsers[0]->QueuedPosts as $id => $postar) {
$_GET["mp" . $pc] = $postar[0];
$_GET["mrid" . $pc] = $_GET["mi" . $pc] = Encoding::Base64UrlEncode($id);
$_GET["mc" . $pc++] = Encoding::Base64UrlEncode($postar[1]);
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_POSTS . "` WHERE `id`='" . DBManager::RealEscape($id) . "' LIMIT 1;");
}
$pc = 0;
$USER->Browsers[0]->QueuedPosts = array();
}
}
$this->OverlayHTML = "";
if (!empty($_GET["mi" . $pc]) || $USER->Browsers[0]->Waiting || !empty($USER->Browsers[0]->InitChatWith) || !empty($USER->Browsers[0]->Forward) && !$USER->Browsers[0]->Forward->Received && $USER->Browsers[0]->Forward->Processed) {
if ($USER->Browsers[0]->Waiting && $this->Botmode && !empty($USER->Browsers[0]->QueuedPosts)) {
$USER->Browsers[0]->QueuedPosts = array();
} else {
if (!Visitor::$OpenChatExternal) {
$this->Init();
}
}
if (!empty($USER->Browsers[0]->Forward) && !$USER->Browsers[0]->Forward->Received && $USER->Browsers[0]->Forward->Processed) {
$USER->Browsers[0]->Forward->Save(true, true);
Visitor::$IsActiveOverlayChat = !$USER->Browsers[0]->Declined;
}
}
if (!empty($USER->Browsers[0]->ChatId)) {
$USER->AddFunctionCall("lz_chat_id='" . $USER->Browsers[0]->ChatId . "';", false);
}
$USER->Browsers[0]->VisitId = $USER->VisitId;
while (!empty($_GET["mi" . $pc])) {
$id = Communication::ReadParameter("mrid" . $pc, md5($USER->Browsers[0]->SystemId . $USER->Browsers[0]->ChatId . $_GET["mi" . $pc]));
$senderName = !empty($USER->Browsers[0]->UserData->Fullname) ? $USER->Browsers[0]->UserData->Fullname : LocalizationManager::$TranslationStrings["client_guest"] . " " . Visitor::GetNoName($USER->UserId . Communication::GetIP());
$post = new Post($id, $USER->Browsers[0]->SystemId, "", Encoding::Base64UrlDecode($_GET["mp" . $pc]), Communication::ReadParameter("mc" . $pc, time()), $USER->Browsers[0]->ChatId, $senderName);
$post->BrowserId = VisitorMonitoring::$Browser->BrowserId;
if (!empty($_GET["mpti" . $pc])) {
$post->Translation = Encoding::Base64UrlDecode($_GET["mpt" . $pc]);
$post->TranslationISO = Encoding::Base64UrlDecode($_GET["mpti" . $pc]);
}
$saved = false;
if (!$USER->Browsers[0]->Waiting) {
foreach (Server::$Groups as $groupid => $group) {
if ($group->IsDynamic && $USER->Browsers[0]->Status == CHAT_STATUS_ACTIVE && isset($group->Members[$USER->Browsers[0]->SystemId])) {
foreach ($group->Members as $member => $persistent) {
if ($member != $USER->Browsers[0]->SystemId) {
if (!empty(Server::$Operators[$member])) {
processPost($id, $post, $member, $pc, $groupid, $USER->Browsers[0]->ChatId);
} else {
processPost($id, $post, $member, $pc, $groupid, CacheManager::GetValueBySystemId($member, "chat_id", ""));
}
$saved = true;
}
}
$pGroup = $group;
}
}
foreach ($USER->Browsers[0]->Members as $systemid => $member) {
if (!empty($member->Declined)) {
continue;
}
if (!empty(Server::$Operators[$systemid]) && !empty($pGroup) && isset($pGroup->Members[$systemid])) {
continue;
}
if (!(!empty($pGroup) && !empty(Server::$Operators[$systemid]))) {
$saved = processPost($id, $post, $systemid, $pc, $USER->Browsers[0]->SystemId, $USER->Browsers[0]->ChatId, Server::$Operators[$systemid]->IsBot);
}
}
if (!empty($USER->Browsers[0]->OperatorId) && (Server::$Operators[$USER->Browsers[0]->OperatorId]->IsBot || $USER->Browsers[0]->Status == CHAT_STATUS_ACTIVE)) {
$rpost = new Post($id = getId(32), Server::$Operators[$USER->Browsers[0]->OperatorId]->SystemId, $USER->Browsers[0]->SystemId, $answer = Server::$Operators[$USER->Browsers[0]->OperatorId]->GetAutoReplies($post->Text . " " . $post->Translation, $USER->Browsers[0]), time(), $USER->Browsers[0]->ChatId, Server::$Operators[$USER->Browsers[0]->OperatorId]->Fullname);
if (!empty($answer)) {
if (Server::$Operators[$USER->Browsers[0]->OperatorId]->IsBot) {
sleep(1);
$USER->AddFunctionCall("lz_chat_input_bot_state(true,false);", false);
}
$rpost->ReceiverOriginal = $rpost->ReceiverGroup = $USER->Browsers[0]->SystemId;
$rpost->Save();
$saved = true;
foreach ($USER->Browsers[0]->Members as $opsysid => $member) {
if ($opsysid != Server::$Operators[$USER->Browsers[0]->OperatorId]->SystemId || !Server::$Operators[$USER->Browsers[0]->OperatorId]->IsBot) {
$rpost = new Post($id, Server::$Operators[$USER->Browsers[0]->OperatorId]->SystemId, $opsysid, $answer, time(), $USER->Browsers[0]->ChatId, Server::$Operators[$opsysid]->Fullname);
$rpost->ReceiverOriginal = $rpost->ReceiverGroup = $USER->Browsers[0]->SystemId;
$rpost->Save();
}
}
}
}
if ($saved) {
$USER->AddFunctionCall("lz_chat_release_post('" . Encoding::Base64UrlDecode($_GET["mi" . $pc]) . "');", false);
}
} else {
processPost($id, $post, "", $pc, $USER->Browsers[0]->SystemId, $USER->Browsers[0]->ChatId, false);
$USER->Browsers[0]->QueuedPosts[$id] = array(0 => $_GET["mp" . $pc], 1 => time(), 2 => VisitorMonitoring::$Browser->BrowserId);
$USER->AddFunctionCall("lz_chat_release_post('" . Encoding::Base64UrlDecode($_GET["mi" . $pc]) . "');", false);
//.........这里部分代码省略.........
示例5: Post
<?php
include_once "../includes/header.inc.php";
$REQUIRED_USER_LEVEL = "LoggedVerified";
//NIVEL DE USUARIO MINIMO REQUERIDO
include_once "../includes/needLogIn.inc.php";
require_once "../Classes/Post.class.php";
if (isset($PARAMS['id'])) {
$post = new Post();
$post->id = $PARAMS['id'];
$post->Find();
if ($post->variables && !$post->delete_date && $post->username == $_SESSION['username']) {
$post->delete_date = date("Ymd");
$post->Save();
echo json_encode(array("status" => "OK"));
} else {
echo json_encode(array("status" => "unknowPost"));
}
} else {
echo json_encode(array("status" => "wrongData"));
}
示例6: SendAutoReply
static function SendAutoReply($_reply, $_user, $_sender)
{
$arpost = new Post($id = getId(32), Server::$Operators[$_user->Browsers[0]->OperatorId]->SystemId, $_user->Browsers[0]->SystemId, $_reply, time(), $_user->Browsers[0]->ChatId, Server::$Operators[$_user->Browsers[0]->OperatorId]->Fullname);
$arpost->ReceiverOriginal = $arpost->ReceiverGroup = $_user->Browsers[0]->SystemId;
$arpost->Save();
foreach ($_user->Browsers[0]->Members as $opsysid => $member) {
$rpost = new Post($id, Server::$Operators[$_user->Browsers[0]->OperatorId]->SystemId, $opsysid, $_reply, time(), $_user->Browsers[0]->ChatId, $_sender->Fullname);
$rpost->ReceiverOriginal = $rpost->ReceiverGroup = $_user->Browsers[0]->SystemId;
$rpost->Save();
}
}
示例7: processPosts
function processPosts()
{
global $INTERNAL, $GROUPS, $VISITOR, $CONFIG, $STATS;
$time = time();
$count = -1;
while (isset($_POST[POST_INTERN_PROCESS_POSTS . "_va" . ++$count])) {
$post = slashesStrip($_POST[POST_INTERN_PROCESS_POSTS . "_va" . $count]);
if ($_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count] == GROUP_EVERYONE_INTERN || isset($GROUPS[$_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count]])) {
foreach ($INTERNAL as $internal) {
if ($internal->SystemId != CALLER_SYSTEM_ID) {
if ($_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count] == GROUP_EVERYONE_INTERN || in_array($_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count], $internal->Groups)) {
if ($internal->Status != USER_STATUS_OFFLINE || !empty($CONFIG["gl_ogcm"])) {
$npost = new Post(getId(32), CALLER_SYSTEM_ID, $internal->SystemId, $post, $time, "");
$npost->Translation = $_POST[POST_INTERN_PROCESS_POSTS . "_vd" . $count];
$npost->TranslationISO = $_POST[POST_INTERN_PROCESS_POSTS . "_ve" . $count];
$npost->Persistent = true;
if ($_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count] == GROUP_EVERYONE_INTERN || in_array($_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count], $INTERNAL[CALLER_SYSTEM_ID]->Groups)) {
$npost->ReceiverGroup = $_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count];
}
$npost->Save();
}
}
}
}
} else {
if ($_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count] == GROUP_EVERYONE_EXTERN) {
foreach ($INTERNAL[CALLER_SYSTEM_ID]->ExternalChats as $chat) {
$npost = new Post(getId(32), CALLER_SYSTEM_ID, $chat->SystemId, $post, $time, "");
$npost->Translation = $_POST[POST_INTERN_PROCESS_POSTS . "_vd" . $count];
$npost->TranslationISO = $_POST[POST_INTERN_PROCESS_POSTS . "_ve" . $count];
$npost->Save();
}
} else {
if (!isset($INTERNAL[$_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count]])) {
if (STATS_ACTIVE) {
$STATS->ProcessAction(ST_ACTION_INTERNAL_POST);
}
if (isset($INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count]])) {
$npost = new Post($_POST[POST_INTERN_PROCESS_POSTS . "_vc" . $count], CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count], $post, $time, $INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count]]->ChatId);
} else {
continue;
}
} else {
$npost = new Post($_POST[POST_INTERN_PROCESS_POSTS . "_vc" . $count], CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count], $post, $time, "");
}
$npost->Persistent = isset($INTERNAL[$_POST[POST_INTERN_PROCESS_POSTS . "_vb" . $count]]);
$npost->Translation = $_POST[POST_INTERN_PROCESS_POSTS . "_vd" . $count];
$npost->TranslationISO = $_POST[POST_INTERN_PROCESS_POSTS . "_ve" . $count];
$npost->Save();
}
}
}
}
示例8: InsertInfo
function InsertInfo()
{
global $zbp;
$zbp->guid = GetGuid();
$mem = new Member();
$guid = GetGuid();
$mem->Guid = $guid;
$mem->Level = 1;
$mem->Name = GetVars('username', 'POST');
$mem->Password = Member::GetPassWordByGuid(GetVars('password', 'POST'), $guid);
$mem->IP = GetGuestIP();
$mem->PostTime = time();
$mem->Save();
$cate = new Category();
$cate->Name = $zbp->lang['msg']['uncategory'];
$cate->Alias = 'uncategorized';
$cate->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_navbar'];
$t->FileName = "navbar";
$t->Source = "system";
$t->SidebarID = 0;
$t->Content = '<li id="nvabar-item-index"><a href="{#ZC_BLOG_HOST#}">' . $zbp->lang['zb_install']['index'] . '</a></li><li id="navbar-page-2"><a href="{#ZC_BLOG_HOST#}?id=2">' . $zbp->lang['zb_install']['guestbook'] . '</a></li>';
$t->HtmlID = "divNavBar";
$t->Type = "ul";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['calendar'];
$t->FileName = "calendar";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = "";
$t->HtmlID = "divCalendar";
$t->Type = "div";
$t->IsHideTitle = true;
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['control_panel'];
$t->FileName = "controlpanel";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = '<span class="cp-hello">' . $zbp->lang['zb_install']['wellcome'] . '</span><br/><span class="cp-login"><a href="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=login">' . $zbp->lang['msg']['admin_login'] . '</a></span> <span class="cp-vrs"><a href="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=misc&type=vrs">' . $zbp->lang['msg']['view_rights'] . '</a></span>';
$t->HtmlID = "divContorPanel";
$t->Type = "div";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_catalog'];
$t->FileName = "catalog";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = "";
$t->HtmlID = "divCatalog";
$t->Type = "ul";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['search'];
$t->FileName = "searchpanel";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = '<form name="search" method="post" action="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=search"><input type="text" name="q" size="11" /> <input type="submit" value="' . $zbp->lang['msg']['search'] . '" /></form>';
$t->HtmlID = "divSearchPanel";
$t->Type = "div";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_comments'];
$t->FileName = "comments";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = "";
$t->HtmlID = "divComments";
$t->Type = "ul";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_archives'];
$t->FileName = "archives";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = "";
$t->HtmlID = "divArchives";
$t->Type = "ul";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_statistics'];
$t->FileName = "statistics";
$t->Source = "system";
$t->SidebarID = 0;
$t->Content = "";
$t->HtmlID = "divStatistics";
$t->Type = "ul";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_favorite'];
$t->FileName = "favorite";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = '<li><a href="http://bbs.zblogcn.com/" target="_blank">ZBlogger社区</a></li><li><a href="http://app.zblogcn.com/" target="_blank">Z-Blog应用中心</a></li><li><a href="http://weibo.com/zblogcn" target="_blank">Z-Blog新浪官微</a></li><li><a href="http://t.qq.com/zblogcn" target="_blank">Z-Blog腾讯官微</a></li>';
$t->HtmlID = "divFavorites";
$t->Type = "ul";
$t->Save();
$t = new Module();
//.........这里部分代码省略.........
示例9: processPostForExternal
function processPostForExternal($rec, $recgroup, $post, $time, $count, $_group = false)
{
global $INTERNAL, $GROUPS, $STATS;
if (STATS_ACTIVE) {
$STATS->ProcessAction(ST_ACTION_INTERNAL_POST);
}
if (!empty($INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$rec]) && $_group) {
$INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$rec]->Load();
$INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$rec]->Members[$rec] = true;
$chatId = $INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$rec]->ChatId;
$receiverlist = $INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$rec]->Members;
} else {
$chatId = getValueBySystemId($rec, "chat_id", "");
$receiverlist = array($rec => $rec);
}
$npost = new Post(getId(32), CALLER_SYSTEM_ID, "", $post, $time, $chatId, $INTERNAL[CALLER_SYSTEM_ID]->Fullname);
foreach ($receiverlist as $systemid => $member) {
if ($systemid == CALLER_SYSTEM_ID || !empty($member->Declined)) {
continue;
}
if (!empty($INTERNAL[$systemid]) && !empty($GROUPS[$recgroup]->Members[$systemid])) {
continue;
}
$npost->Receiver = $systemid;
$npost->Persistent = false;
$npost->Translation = $_POST[POST_INTERN_PROCESS_POSTS . "_vd" . $count];
$npost->TranslationISO = $_POST[POST_INTERN_PROCESS_POSTS . "_ve" . $count];
$npost->ReceiverGroup = $recgroup;
$npost->ReceiverOriginal = $rec;
$npost->Save();
$INTERNAL[CALLER_SYSTEM_ID]->SetRepostTime($npost->ReceiverGroup, $npost->Created);
}
}
示例10: RepostChatHistory
function RepostChatHistory($_caller, $_chatId, $_internalSystemId, $_from = 0, $_last = 0, $_receiverGroup = "", $_targetChatId = "", $_targetReceiverGroup = "", $_external = false, $_botonly = false, $_externalSelf = true)
{
global $INTERNAL;
if (empty($_receiverGroup)) {
$_receiverGroup = $this->SystemId;
}
if (!empty($INTERNAL[$_internalSystemId]->Reposts[$this->SystemId])) {
$_from = $INTERNAL[$_internalSystemId]->Reposts[$this->SystemId];
}
if (empty($_targetChatId)) {
$cidcrit = !empty($_chatId) ? " `chat_id` != '" . DBManager::RealEscape($_chatId) . "' AND" : "";
} else {
$cidcrit = !empty($_chatId) ? " `chat_id` = '" . DBManager::RealEscape($_chatId) . "' AND" : "";
}
$reccrit = $_external ? "" : " AND `received`=1";
$result = queryDB(true, $d = "SELECT * FROM `" . DB_PREFIX . DATABASE_POSTS . "` WHERE" . $cidcrit . " `repost`=0" . $reccrit . " AND `receiver_group`='" . DBManager::RealEscape($_receiverGroup) . "' AND `time`>" . $_from . " GROUP BY `id`;");
if ($result) {
while ($row = DBManager::FetchArray($result)) {
if ($_botonly) {
if (!(isset($INTERNAL[$row["receiver_original"]]) && $INTERNAL[$row["receiver_original"]]->IsBot) && !(isset($INTERNAL[$row["sender"]]) && $INTERNAL[$row["sender"]]->IsBot)) {
continue;
}
}
$post = new Post(getId(32), $row["sender"], $_internalSystemId, $row["text"], $row["time"], empty($_targetChatId) ? $row["chat_id"] : $_targetChatId, $row["sender_name"]);
$post->Translation = $row["translation"];
$post->ReceiverOriginal = $row["receiver_original"];
$post->TranslationISO = $row["translation_iso"];
$post->ReceiverGroup = empty($_targetReceiverGroup) ? $row["receiver_group"] : $_targetReceiverGroup;
$post->Repost = true;
$post->Save(array(0 => $row["micro"], 1 => $row["time"]));
$_last = max($_last, $row["time"]);
if ($_external && $_externalSelf) {
$post->Id = getId(32);
$post->Receiver = $_targetReceiverGroup;
$post->Save(array(0 => $row["micro"], 1 => $row["time"]));
}
}
}
$INTERNAL[$_internalSystemId]->Reposts[$this->SystemId] = max($_last, $_from);
}
示例11: processPosts
function processPosts($counter = 0)
{
global $USER, $STATS, $GROUPS, $INTERNAL, $LZLANG;
while (isset($_POST["p_p" . $counter])) {
if (STATS_ACTIVE) {
$STATS->ProcessAction(ST_ACTION_EXTERNAL_POST);
}
$id = md5($USER->Browsers[0]->SystemId . base64UrlDecode($_POST[POST_EXTERN_CHAT_ID]) . base64UrlDecode($_POST["p_i" . $counter]));
$senderName = !empty($USER->Browsers[0]->Fullname) ? $USER->Browsers[0]->Fullname : $LZLANG["client_guest"] . " " . getNoName($USER->UserId . getIP());
$post = new Post($id, $USER->Browsers[0]->SystemId, "", base64UrlDecode($_POST["p_p" . $counter]), time(), $USER->Browsers[0]->ChatId, $senderName);
foreach ($GROUPS as $groupid => $group) {
if ($group->IsDynamic && !empty($group->Members[$USER->Browsers[0]->SystemId])) {
foreach ($group->Members as $member => $persistent) {
if ($member != $USER->Browsers[0]->SystemId) {
if (!empty($INTERNAL[$member])) {
processPost($id, $post, $member, $counter, $groupid, $USER->Browsers[0]->ChatId);
} else {
processPost($id, $post, $member, $counter, $groupid, getValueBySystemId($member, "chat_id", ""));
}
}
}
$pGroup = $group;
}
}
foreach ($USER->Browsers[0]->Members as $systemid => $member) {
if (!empty($member->Declined)) {
continue;
}
if (!empty($INTERNAL[$systemid]) && !empty($pGroup->Members[$systemid])) {
continue;
}
if (!(!empty($pGroup) && !empty($INTERNAL[$systemid]))) {
processPost($id, $post, $systemid, $counter, $USER->Browsers[0]->SystemId, $USER->Browsers[0]->ChatId);
}
}
$autoReply = $USER->Browsers[0]->InternalUser->GetAutoReplies($post->Text, $USER->Browsers[0]);
if (!empty($autoReply)) {
$arpost = new Post($id = getId(32), $USER->Browsers[0]->InternalUser->SystemId, $USER->Browsers[0]->SystemId, $autoReply, time(), $USER->Browsers[0]->ChatId, $USER->Browsers[0]->InternalUser->Fullname);
$arpost->ReceiverOriginal = $arpost->ReceiverGroup = $USER->Browsers[0]->SystemId;
$arpost->Save();
foreach ($USER->Browsers[0]->Members as $opsysid => $member) {
$rpost = new Post($id, $USER->Browsers[0]->InternalUser->SystemId, $opsysid, $autoReply, time(), $USER->Browsers[0]->ChatId, $INTERNAL[$systemid]->Fullname);
$rpost->ReceiverOriginal = $rpost->ReceiverGroup = $USER->Browsers[0]->SystemId;
$rpost->Save();
}
}
$USER->AddFunctionCall("lz_chat_release_post('" . base64UrlDecode($_POST["p_i" . $counter]) . "');", false);
$counter++;
}
$counter = 0;
while (isset($_POST["pr_i" . $counter])) {
$post = new Post(base64UrlDecode($_POST["pr_i" . $counter]), "", "", "", "", "", "");
$post->MarkReceived($USER->Browsers[0]->SystemId);
$USER->AddFunctionCall("lz_chat_message_set_received('" . base64UrlDecode($_POST["pr_i" . $counter]) . "');", false);
$counter++;
}
}
示例12: processPosts
function processPosts($counter = 0)
{
global $USER;
while (isset($_POST["p_p" . $counter])) {
$id = md5($USER->Browsers[0]->SystemId . $_POST[POST_EXTERN_CHAT_ID] . $_POST["p_i" . $counter]);
$post = new Post($id, $USER->Browsers[0]->SystemId, $USER->Browsers[0]->Chat->InternalUser->SystemId, AJAXDecode($_POST["p_p" . $counter]), time());
$post->Save();
$USER->AddFunctionCall("lz_chat_release_post('" . $_POST["p_i" . $counter] . "');", false);
$counter++;
}
$counter = 0;
while (isset($_POST["pr_i" . $counter])) {
markPostReceived($_POST["pr_i" . $counter]);
$USER->AddFunctionCall("lz_chat_message_set_received('" . $_POST["pr_i" . $counter] . "');", false);
$counter++;
}
}
示例13: Post
}
}
if (!empty($USER->Browsers[0]->InternalUser) && ($USER->Browsers[0]->InternalUser->IsBot || $USER->Browsers[0]->Status == CHAT_STATUS_ACTIVE)) {
$rpost = new Post($id = getId(32), $USER->Browsers[0]->InternalUser->SystemId, $USER->Browsers[0]->SystemId, $answer = $USER->Browsers[0]->InternalUser->GetAutoReplies($post->Text . " " . $post->Translation, $USER->Browsers[0]), time(), $USER->Browsers[0]->ChatId, $USER->Browsers[0]->InternalUser->Fullname);
if (!empty($answer)) {
if ($USER->Browsers[0]->InternalUser->IsBot) {
$USER->AddFunctionCall("lz_chat_input_bot_state(true,false);", false);
}
$rpost->ReceiverOriginal = $rpost->ReceiverGroup = $USER->Browsers[0]->SystemId;
$rpost->Save();
$saved = true;
foreach ($USER->Browsers[0]->Members as $opsysid => $member) {
if ($opsysid != $USER->Browsers[0]->InternalUser->SystemId || !$USER->Browsers[0]->InternalUser->IsBot) {
$rpost = new Post($id, $USER->Browsers[0]->InternalUser->SystemId, $opsysid, $answer, time(), $USER->Browsers[0]->ChatId, $INTERNAL[$systemid]->Fullname);
$rpost->ReceiverOriginal = $rpost->ReceiverGroup = $USER->Browsers[0]->SystemId;
$rpost->Save();
}
}
}
}
if ($saved) {
$USER->AddFunctionCall("lz_chat_release_post('" . base64UrlDecode($_GET["mi" . $pc]) . "');", false);
}
} else {
processPost($id, $post, "", $pc, $USER->Browsers[0]->SystemId, $USER->Browsers[0]->ChatId, false);
$USER->Browsers[0]->QueuedPosts[$id] = array(0 => $_GET["mp" . $pc], 1 => time(), 2 => $BROWSER->BrowserId);
$USER->AddFunctionCall("lz_chat_release_post('" . base64UrlDecode($_GET["mi" . $pc]) . "');", false);
}
$pc++;
}
$startTime = 0;
示例14: appendPosts
function appendPosts()
{
global $INTERNAL, $GROUPS, $VISITOR, $CONFIG;
$posts = explode(POST_ACTION_VALUE_SPLITTER, slashesStrip($_POST[POST_INTERN_PROCESS_POSTS . "_va"]));
$receivers = explode(POST_ACTION_VALUE_SPLITTER, slashesStrip($_POST[POST_INTERN_PROCESS_POSTS . "_vb"]));
$postids = explode(POST_ACTION_VALUE_SPLITTER, slashesStrip($_POST[POST_INTERN_PROCESS_POSTS . "_vc"]));
$time = time();
foreach ($posts as $key => $post) {
if ($receivers[$key] == GROUP_EVERYONE_INTERN || isset($GROUPS[$receivers[$key]])) {
foreach ($INTERNAL as $internal) {
if ($internal->SystemId != CALLER_SYSTEM_ID) {
if ($receivers[$key] == GROUP_EVERYONE_INTERN || in_array($receivers[$key], $internal->Groups)) {
if ($internal->Status != USER_STATUS_OFFLINE || !isnull($CONFIG["gl_ogcm"])) {
$npost = new Post(getId(32), CALLER_SYSTEM_ID, $internal->SystemId, $posts[$key], $time);
$npost->Persistent = true;
if ($receivers[$key] == GROUP_EVERYONE_INTERN || in_array($receivers[$key], $INTERNAL[CALLER_SYSTEM_ID]->Groups)) {
$npost->ReceiverGroup = $receivers[$key];
}
$npost->Save();
}
}
}
}
} else {
if ($receivers[$key] == GROUP_EVERYONE_EXTERN) {
foreach ($INTERNAL[CALLER_SYSTEM_ID]->ExternalChats as $chat) {
$npost = new Post(getId(32), CALLER_SYSTEM_ID, $chat->ExternalUser->SystemId, $posts[$key], $time);
$npost->Save();
}
} else {
$npost = new Post($postids[$key], CALLER_SYSTEM_ID, $receivers[$key], $posts[$key], $time);
$npost->Persistent = isset($INTERNAL[$receivers[$key]]);
$npost->Save();
if (!$npost->Persistent) {
archiveExternalChat($npost);
}
}
}
}
}
示例15: array
<?php
include_once '../../globals.php';
$response = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// if form has been posted process data
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$content = $request->content;
$title = $request->title;
$request->date = date("Y-m-d H:i:s");
$request->user_id = $_SESSION['user_id'];
$post = new Post();
$success = $post->Save($request);
echo $success;
echo $success == true ? 'Votre article a bien été sauvegardé' : 'Il y a eu une erreur lors de la sauvegarde de votre article';
}
?>