本文整理汇总了PHP中Source::getSourceInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Source::getSourceInfo方法的具体用法?PHP Source::getSourceInfo怎么用?PHP Source::getSourceInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Source
的用法示例。
在下文中一共展示了Source::getSourceInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$shareInfo["sid"] = intval(EnvUtil::getRequest("sid"));
$shareInfo["stable"] = StringUtil::filterCleanHtml(EnvUtil::getRequest("stable"));
$shareInfo["initHTML"] = StringUtil::filterDangerTag(EnvUtil::getRequest("initHTML"));
$shareInfo["curid"] = StringUtil::filterCleanHtml(EnvUtil::getRequest("curid"));
$shareInfo["curtable"] = StringUtil::filterCleanHtml(EnvUtil::getRequest("curtable"));
$shareInfo["module"] = StringUtil::filterCleanHtml(EnvUtil::getRequest("module"));
$shareInfo["isrepost"] = intval(EnvUtil::getRequest("isrepost"));
if (empty($shareInfo["stable"]) || empty($shareInfo["sid"])) {
echo "类型和资源ID不能为空";
exit;
}
if (!($oldInfo = Source::getSourceInfo($shareInfo["stable"], $shareInfo["sid"], false, $shareInfo["module"]))) {
echo "此信息不可以被转发";
exit;
}
empty($shareInfo["module"]) && ($shareInfo["module"] = $oldInfo["module"]);
if (empty($shareInfo["initHTML"]) && !empty($shareInfo["curid"])) {
if ($shareInfo["curid"] != $shareInfo["sid"] && $shareInfo["isrepost"] == 1) {
$curInfo = Source::getSourceInfo($shareInfo["curtable"], $shareInfo["curid"], false, "weibo");
$userInfo = $curInfo["source_user_info"];
$shareInfo["initHTML"] = " //@" . $userInfo["realname"] . ":" . $curInfo["source_content"];
$shareInfo["initHTML"] = str_replace(array("\n", "\r"), array("", ""), $shareInfo["initHTML"]);
}
}
$shareInfo["shareHtml"] = !empty($oldInfo["shareHtml"]) ? $oldInfo["shareHtml"] : "";
$data = array("shareInfo" => $shareInfo, "oldInfo" => $oldInfo);
$this->renderPartial("index", $data);
}
示例2: addDigg
public function addDigg($feedId, $uid)
{
$data["feedid"] = $feedId;
$data["uid"] = $uid;
$data["uid"] = !$data["uid"] ? Ibos::app()->user->uid : $data["uid"];
if (!$data["uid"]) {
$this->addError("addDigg", "未登录不能赞");
return false;
}
$isExit = $this->getIsExists($feedId, $uid);
if ($isExit) {
$this->addError("addDigg", "你已经赞过");
return false;
}
$data["ctime"] = time();
$res = $this->add($data);
if ($res) {
$feed = Source::getSourceInfo("feed", $feedId);
Feed::model()->updateCounters(array("diggcount" => 1), "feedid = " . $feedId);
Feed::model()->cleanCache($feedId);
$user = User::model()->fetchByUid($uid);
$config["{user}"] = $user["realname"];
$config["{sourceContent}"] = StringUtil::filterCleanHtml($feed["source_body"]);
$config["{sourceContent}"] = str_replace("◆", "", $config["{sourceContent}"]);
$config["{sourceContent}"] = StringUtil::cutStr($config["{sourceContent}"], 34);
$config["{url}"] = $feed["source_url"];
$config["{content}"] = Ibos::app()->getController()->renderPartial("application.modules.message.views.remindcontent", array("recentFeeds" => Feed::model()->getRecentFeeds()), true);
Notify::model()->sendNotify($feed["uid"], "message_digg", $config);
UserUtil::updateCreditByAction("diggweibo", $uid);
UserUtil::updateCreditByAction("diggedweibo", $feed["uid"]);
}
return $res;
}
示例3: fetchAllAtmeListByUid
public function fetchAllAtmeListByUid($uid, $limit, $offset, $order = "atid DESC")
{
$criteria = array("condition" => "`uid` = :uid", "params" => array(":uid" => $uid), "order" => $order, "limit" => $limit, "offset" => $offset);
$data = $this->fetchAll($criteria);
if (!empty($data)) {
foreach ($data as &$v) {
$v = Source::getSourceInfo($v["table"], $v["rowid"], false, $v["module"]);
}
}
$uid && UserData::model()->resetUserCount($uid, "unread_atme", 0);
return $data;
}
示例4: 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);
}
示例5: 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;
}