当前位置: 首页>>代码示例>>PHP>>正文


PHP EnvUtil::getFromClient方法代码示例

本文整理汇总了PHP中EnvUtil::getFromClient方法的典型用法代码示例。如果您正苦于以下问题:PHP EnvUtil::getFromClient方法的具体用法?PHP EnvUtil::getFromClient怎么用?PHP EnvUtil::getFromClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EnvUtil的用法示例。


在下文中一共展示了EnvUtil::getFromClient方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionPostFeed

 public function actionPostFeed()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $return = array("isSuccess" => true, "data" => "");
         $d["content"] = isset($_POST["content"]) ? StringUtil::filterDangerTag($_POST["content"]) : "";
         $d["body"] = $_POST["body"];
         $d["rowid"] = isset($_POST["rowid"]) ? intval($_POST["rowid"]) : 0;
         foreach ($_POST as $key => $val) {
             $_POST[$key] = StringUtil::filterCleanHtml($_POST[$key]);
         }
         $uid = Ibos::app()->user->uid;
         $user = User::model()->fetchByUid($uid);
         if (isset($_POST["view"])) {
             $_POST["view"] = $d["view"] = intval($_POST["view"]);
             if ($_POST["view"] == WbConst::SELFDEPT_VIEW_SCOPE) {
                 $d["deptid"] = $user["deptid"];
             }
             if ($_POST["view"] == WbConst::CUSTOM_VIEW_SCOPE) {
                 $scope = StringUtil::getId($_POST["viewid"], true);
                 if (isset($scope["u"])) {
                     $d["userid"] = implode(",", $scope["u"]);
                 }
                 if (isset($scope["d"])) {
                     $d["deptid"] = implode(",", $scope["d"]);
                 }
                 if (isset($scope["p"])) {
                     $d["positionid"] = implode(",", $scope["p"]);
                 }
             }
         }
         $d["source_url"] = isset($_POST["source_url"]) ? urldecode($_POST["source_url"]) : "";
         $d["body"] = preg_replace("/#[\\s]*([^#^\\s][^#]*[^#^\\s])[\\s]*#/is", "#" . trim("\${1}") . "#", $d["body"]);
         if (isset($_POST["attachid"])) {
             $d["attach_id"] = trim(StringUtil::filterCleanHtml($_POST["attachid"]));
             if (!empty($d["attach_id"])) {
                 $d["attach_id"] = explode(",", $d["attach_id"]);
                 array_map("intval", $d["attach_id"]);
             }
         }
         $type = StringUtil::filterCleanHtml($_POST["type"]);
         $table = isset($_POST["table"]) ? StringUtil::filterCleanHtml($_POST["table"]) : "feed";
         $module = isset($_POST["module"]) ? StringUtil::filterCleanHtml($_POST["module"]) : "weibo";
         $data = Feed::model()->put(Ibos::app()->user->uid, $module, $type, $d, $d["rowid"], $table);
         if (!$data) {
             $return["isSuccess"] = false;
             $return["data"] = Feed::model()->getError("putFeed");
             $this->ajaxReturn($return);
         }
         UserUtil::updateCreditByAction("addweibo", Ibos::app()->user->uid);
         $data["from"] = EnvUtil::getFromClient($data["from"], $data["module"]);
         $lang = Ibos::getLangSources();
         $return["data"] = $this->renderPartial("feedlist", array("list" => array($data), "lang" => $lang), true);
         $return["feedid"] = $data["feedid"];
         FeedTopic::model()->addTopic(html_entity_decode($d["body"], ENT_QUOTES, "UTF-8"), $data["feedid"], $type);
         $this->ajaxReturn($return);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:57,代码来源:FeedController.php

示例2: getData

 protected function getData($var)
 {
     $data = array();
     $type = isset($var["new"]) ? "new" . $var["type"] : $var["type"];
     $where = "isdel = 0 AND uid = " . $this->getUid() . ($this->getIsMe() ? "" : " AND " . WbfeedUtil::getViewCondition(Ibos::app()->user->uid));
     switch ($type) {
         case "all":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $loadId = isset($var["loadId"]) ? $var["loadId"] : 0;
                 $list = Feed::model()->searchFeed($var["feedkey"], "all", $loadId, $var["nums"], $pages->getOffset(), "", $this->getUid());
                 $count = Feed::model()->countSearchAll($var["feedkey"], $loadId);
             } else {
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND type = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
                 $count = Feed::model()->count($where);
             }
             break;
         case "movement":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $loadId = isset($var["loadId"]) ? $var["loadId"] : 0;
                 $list = Feed::model()->searchFeed($var["feedkey"], "movement", $loadId, $var["nums"], $pages->getOffset(), "", $this->getUid());
                 $count = Feed::model()->countSearchMovement($var["feedkey"], $loadId);
             } else {
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND module = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 } else {
                     $where .= " AND module != 'weibo'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
                 $count = Feed::model()->count($where);
             }
             break;
         case "newmovement":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d AND uid = %d", WbfeedUtil::getViewCondition(Ibos::app()->user->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $count = Feed::model()->count($where);
                 $data["count"] = count($list);
             }
             break;
         case "newall":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 %s AND feedid > %d AND uid = %d", $this->getIsMe() ? "" : " AND " . WbfeedUtil::getViewCondition(Ibos::app()->user->uid), intval($var["maxId"]), $this->getUid());
                 $list = Feed::model()->getList($where);
                 $count = Feed::model()->countFollowingFeed($where);
                 $data["count"] = count($list);
             }
             break;
         default:
             break;
     }
     $count = isset($count) ? $count : WbConst::MAX_VIEW_FEED_NUMS;
     $pages = PageUtil::create($count, WbConst::DEF_LIST_FEED_NUMS);
     if (!isset($var["new"])) {
         $pages->route = "personal/index";
         $currentUrl = (string) Ibos::app()->getRequest()->getUrl();
         $replaceUrl = str_replace("weibo/personal/loadmore", "weibo/personal/index", $currentUrl);
         $data["pageData"] = $this->widget("IWPage", array("pages" => $pages, "currentUrl" => $replaceUrl), true);
     }
     if (!empty($list)) {
         $data["firstId"] = $list[0]["feedid"];
         $data["lastId"] = $list[count($list) - 1]["feedid"];
         $feedids = ConvertUtil::getSubByKey($list, "feedid");
         $diggArr = FeedDigg::model()->checkIsDigg($feedids, $this->getUid());
         foreach ($list as &$v) {
             switch ($v["module"]) {
                 case "mobile":
                     break;
                 default:
                     $v["from"] = EnvUtil::getFromClient($v["from"], $v["module"]);
                     break;
             }
         }
         $data["html"] = $this->renderPartial("application.modules.message.views.feed.feedlist", array("list" => $list, "diggArr" => $diggArr), true);
     } else {
         $data["html"] = "";
         $data["firstId"] = $data["lastId"] = 0;
     }
     return $data;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:90,代码来源:PersonalController.php

示例3: array

    }
    ?>
					<p>
						<?php 
    echo StringUtil::filterCleanHtml($sourceInfo["source_content"]);
    ?>
					</p>
				</div>
				<div class="wb-info-ads clearfix">
					<div class="wb-info-from pull-left">
						<span><?php 
    echo $sourceInfo["ctime"];
    ?>
</span>
						<span>&nbsp;<?php 
    echo EnvUtil::getFromClient($sourceInfo["from"], $sourceInfo["module"]);
    ?>
&nbsp;</span>
					</div>
					<div class="wb-handle pull-right">
						<a href="<?php 
    echo Ibos::app()->urlManager->createUrl("weibo/personal/feed", array("uid" => $sourceInfo["uid"], "feedid" => $sourceInfo["feedid"]));
    ?>
" target="_blank">
							<i class="o-wbi-frow"></i>
							转发( <?php 
    echo $sourceInfo["repostcount"];
    ?>
 )
						</a>
						<a href="<?php 
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:repostFeed.php

示例4: getData

 protected function getData($var)
 {
     $data = array();
     $type = isset($var["new"]) ? "new" . $var["type"] : $var["type"];
     switch ($type) {
         case "following":
             $pages = PageUtil::create(1000, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "following", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid, "a.");
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND a.feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND a.type = '" . $var["feedtype"] . "'";
                 }
                 $list = Feed::model()->getFollowingFeed($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "all":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "all", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid);
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND type = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "movement":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "movement", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid);
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND module = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 } else {
                     $where .= " AND module != 'weibo'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "newmovement":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d", WbfeedUtil::getViewCondition($this->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $data["count"] = count($list);
             }
             break;
         case "newfollowing":
             $where = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid, "a.");
             if (0 < $var["maxId"]) {
                 $where .= " AND a.feedid > '" . intval($var["maxId"]) . "'";
                 $list = Feed::model()->getFollowingFeed($where);
                 $data["count"] = count($list);
             }
             break;
         case "newall":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d AND uid <> %d", WbfeedUtil::getViewCondition($this->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $data["count"] = count($list);
             }
             break;
         default:
             break;
     }
     if (!isset($var["new"])) {
         $pages->route = "home/index";
     }
     if (!empty($list)) {
         $data["firstId"] = $list[0]["feedid"];
         $data["lastId"] = $list[count($list) - 1]["feedid"];
         $feedids = ConvertUtil::getSubByKey($list, "feedid");
         $diggArr = FeedDigg::model()->checkIsDigg($feedids, $this->uid);
         foreach ($list as &$v) {
             switch ($v["module"]) {
                 case "mobile":
                     break;
                 default:
                     $v["from"] = EnvUtil::getFromClient($v["from"], $v["module"]);
                     break;
             }
             if (isset($v["attach_id"][0])) {
                 $_tmp = AttachUtil::getAttachData($v["attach_id"][0]);
                 $v["attach_url"] = FileUtil::getAttachUrl() . "/" . $_tmp[$v["attach_id"][0]]["attachment"];
             }
             if (isset($v["api_source"]["attach"][0]["attach_url"])) {
                 $v["api_source"]["attach_url"] = $v["api_source"]["attach"][0]["attach_url"];
                 unset($v["api_source"]["attach"]);
//.........这里部分代码省略.........
开发者ID:AxelPanda,项目名称:ibos,代码行数:101,代码来源:WeiboController.php

示例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;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:73,代码来源:Feed.php


注:本文中的EnvUtil::getFromClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。