本文整理汇总了PHP中EnvUtil::getVisitorClient方法的典型用法代码示例。如果您正苦于以下问题:PHP EnvUtil::getVisitorClient方法的具体用法?PHP EnvUtil::getVisitorClient怎么用?PHP EnvUtil::getVisitorClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnvUtil
的用法示例。
在下文中一共展示了EnvUtil::getVisitorClient方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateToComment
private function updateToComment($data, $sourceInfo, $lessUids)
{
$commentInfo = Source::getSourceInfo($data["module_table"], $data["module_rowid"], false, $data["module"]);
$oldInfo = isset($commentInfo["sourceInfo"]) ? $commentInfo["sourceInfo"] : $commentInfo;
$c["module"] = $data["module"];
$c["table"] = "feed";
$c["moduleuid"] = !empty($oldInfo["source_user_info"]["uid"]) ? $oldInfo["source_user_info"]["uid"] : $oldInfo["uid"];
$c["content"] = $data["content"];
$c["rowid"] = !empty($oldInfo["sourceInfo"]) ? $oldInfo["sourceInfo"]["source_id"] : $oldInfo["source_id"];
if ($data["module"]) {
$c["rowid"] = $oldInfo["feedid"];
}
$c["from"] = EnvUtil::getVisitorClient();
Comment::model()->addComment($c, false, false, $lessUids);
}
示例2: escapeData
private function escapeData($data)
{
$add["module"] = $data["module"];
$add["table"] = $data["table"];
$add["rowid"] = intval($data["rowid"]);
$add["uid"] = Ibos::app()->user->uid;
$add["moduleuid"] = intval($data["moduleuid"]);
$add["content"] = StringUtil::pregHtml($data["content"]);
$add["tocid"] = isset($data["tocid"]) ? intval($data["tocid"]) : 0;
$add["touid"] = isset($data["touid"]) ? intval($data["touid"]) : 0;
$add["data"] = serialize(isset($data["data"]) ? $data["data"] : array());
$add["ctime"] = TIMESTAMP;
$add["from"] = isset($data["from"]) ? intval($data["from"]) : EnvUtil::getVisitorClient();
$add["attachmentid"] = isset($data["attachmentid"]) ? $data["attachmentid"] : "";
return $add;
}
示例3: shareFeed
public function shareFeed($data, $from = "share", $lessUids = null)
{
$return = array("isSuccess" => false, "data" => "转发失败");
if (empty($data["sid"])) {
return $return;
}
$type = StringUtil::filterCleanHtml($data["type"]);
$table = isset($data["table"]) ? $data["table"] : $type;
$module = isset($data["module"]) ? $data["module"] : "weibo";
$forApi = isset($data["forApi"]) && $data["forApi"] ? true : false;
if (!($oldInfo = Source::getSourceInfo($table, $data["sid"], $forApi, $data["module"]))) {
$return["data"] = "此信息不可以被转发";
return $return;
}
$d["content"] = isset($data["content"]) ? str_replace(Ibos::app()->setting->get("siteurl"), "[SITE_URL]", $data["content"]) : "";
$d["body"] = str_replace(Ibos::app()->setting->get("siteurl"), "[SITE_URL]", $data["body"]);
$feedType = "repost";
if (!empty($oldInfo["feedType"]) && !in_array($oldInfo["feedType"], array("post", "postimage"))) {
$feedType = $oldInfo["feedType"];
}
$d["sourceInfo"] = !empty($oldInfo["sourceInfo"]) ? $oldInfo["sourceInfo"] : $oldInfo;
$isOther = $from == "comment" ? false : true;
$d["curid"] = $data["curid"];
if ($oldInfo["rowid"] == 0) {
$id = $oldInfo["source_id"];
$table = $oldInfo["source_table"];
} else {
$id = $oldInfo["rowid"];
$table = $oldInfo["table"];
}
$d["from"] = isset($data["from"]) ? intval($data["from"]) : 0;
$res = $this->put(Ibos::app()->user->uid, $module, $feedType, $d, $id, $table, null, $lessUids, $isOther, 1);
if ($res) {
if (isset($data["comment"])) {
$c["module"] = $module;
$c["moduleuid"] = $data["curid"];
$c["table"] = "feed";
$c["uid"] = $oldInfo["uid"];
$c["content"] = !empty($d["body"]) ? $d["body"] : $d["content"];
$c["rowid"] = !empty($oldInfo["sourceInfo"]) ? $oldInfo["sourceInfo"]["source_id"] : $id;
$c["from"] = EnvUtil::getVisitorClient();
$notCount = $from == "share" ? $data["comment"] == 1 ? false : true : false;
Comment::model()->addComment($c, false, $notCount, $lessUids);
}
FeedTopic::model()->addTopic(html_entity_decode($d["body"], ENT_QUOTES), $res["feedid"], $feedType);
$rdata = $res;
$rdata["feedid"] = $res["feedid"];
$rdata["rowid"] = $data["sid"];
$rdata["table"] = $data["type"];
$rdata["module"] = $module;
$rdata["isrepost"] = 1;
switch ($module) {
case "mobile":
break;
default:
$rdata["from"] = EnvUtil::getFromClient($from, $module);
break;
}
$return["data"] = $rdata;
$return["isSuccess"] = true;
if ($module == "weibo" && $type == "feed") {
$this->updateCounters(array("repostcount" => 1), "feedid = " . $data["sid"]);
$this->cleanCache($data["sid"]);
if ($data["curid"] != $data["sid"] && !empty($data["curid"])) {
$this->updateCounters(array("repostcount" => 1), "feedid = " . $data["curid"]);
$this->cleanCache($data["curid"]);
}
}
} else {
$return["data"] = $this->getError("putFeed");
}
return $return;
}