Exemple #1
0
 public function actionIndex()
 {
     $uid = Ibos::app()->user->uid;
     $unreadAtMe = UserData::model()->countUnreadAtMeByUid($uid);
     $pageCount = Atme::model()->countByAttributes(array("uid" => $uid));
     $pages = PageUtil::create($pageCount);
     $atList = Atme::model()->fetchAllAtmeListByUid($uid, $pages->getLimit(), $pages->getOffset());
     $feedIds = ConvertUtil::getSubByKey($atList, "feedid");
     $diggArr = FeedDigg::model()->checkIsDigg($feedIds, $uid);
     $data = array("unreadAtmeCount" => $unreadAtMe, "list" => $atList, "pages" => $pages, "digg" => $diggArr);
     $this->setPageTitle(Ibos::lang("Mention me"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Message center"), "url" => $this->createUrl("mention/index")), array("name" => Ibos::lang("Mention me"))));
     $this->render("index", $data);
 }
Exemple #2
0
 public function deleteComment($ids, $uid = null, $module = "")
 {
     $ids = is_array($ids) ? $ids : explode(",", $ids);
     $map = array("and");
     $map[] = array("in", "cid", $ids);
     $comments = $this->getDbConnection()->createCommand()->select("cid,module,table,rowid,moduleuid,uid")->from($this->tableName())->where($map)->queryAll();
     if (empty($comments)) {
         return false;
     }
     foreach ($comments as $value) {
         Atme::model()->deleteAtme($value["table"], null, $value["cid"], null);
     }
     $_comments = array();
     foreach ($comments as $comment) {
         $_comments[$comment["table"]][$comment["rowid"]][] = $comment["cid"];
     }
     $cids = ConvertUtil::getSubByKey($comments, "cid");
     $res = $this->updateAll(array("isdel" => 1), "`cid` IN (" . implode(",", $cids) . ")");
     if ($res) {
         foreach ($_comments as $tableName => $rows) {
             foreach ($rows as $rowid => $cid) {
                 $_table = ucfirst($tableName);
                 $field = $_table::model()->getTableSchema()->primaryKey;
                 if (empty($field)) {
                     $field = $tableName . "id";
                 }
                 $_table::model()->updateCounters(array("commentcount" => -count($cid)), "`{$field}`={$rowid}");
                 if ($module == "weibo" || $module == "feed") {
                     $_table::model()->cleanCache($rowid);
                 }
             }
         }
         if ($uid) {
             UserUtil::updateCreditByAction("delcomment", $uid);
         }
     }
     $this->addError("deletecomment", $res != false ? Ibos::lang("Operation succeed", "message") : Ibos::lang("Operation failure", "message"));
     return $res;
 }
Exemple #3
0
 public function doEditFeed($feedid, $type, $uid = null)
 {
     $return = array("isSuccess" => false);
     if (empty($feedid)) {
     } else {
         $feedid = is_array($feedid) ? implode(",", $feedid) : intval($feedid);
         $con = sprintf("feedid = %d", $feedid);
         $isdel = $type == "delFeed" ? 1 : 0;
         if ($type == "deleteFeed") {
             $msg = array("user" => Ibos::app()->user->username, "ip" => EnvUtil::getClientIp(), "id" => $feedid, "value" => $this->get($feedid));
             Log::write($msg, "db", "module.weibo.deleteFeed");
             $res = $this->deleteAll($con);
             $res && $this->_deleteFeedAttach($feedid);
         } else {
             $ids = explode(",", $feedid);
             $feedList = $this->getFeeds($ids);
             $res = $this->updateAll(array("isdel" => $isdel), $con);
             if ($type == "feedRecover") {
                 foreach ($feedList as $v) {
                     UserData::model()->updateKey("feed_count", 1, true, $v["user_info"]["uid"]);
                     UserData::model()->updateKey("weibo_count", 1, true, $v["user_info"]["uid"]);
                 }
             } else {
                 foreach ($feedList as $v) {
                     UserData::model()->updateKey("feed_count", -1, false, $v["user_info"]["uid"]);
                     UserData::model()->updateKey("weibo_count", -1, false, $v["user_info"]["uid"]);
                 }
             }
             $this->cleanCache($ids);
             $query = $this->fetchAll(array("select" => "feedid", "condition" => sprintf("rowid = %d", $feedid)));
             $sids = ConvertUtil::getSubByKey($query, "feedid");
             $sids && $this->cleanCache($sids);
         }
         $commentQuery = $this->getDbConnection()->createCommand()->select("cid")->from("{{comment}}")->where(sprintf("`module` = 'weibo' AND `table` = 'feed' AND `rowid` = %d", $feedid))->queryAll();
         $commentIds = ConvertUtil::getSubByKey($commentQuery, "cid");
         $commentIds && Comment::model()->deleteComment($commentIds, null, "weibo");
         FeedTopic::model()->deleteWeiboJoinTopic($feedid);
         Atme::model()->deleteAtme("feed", null, $feedid);
         $topics = FeedTopicLink::model()->fetchAll(array("select" => "topicid", "condition" => "feedid=" . $feedid));
         $topicId = ConvertUtil::getSubByKey($topics, "topicid");
         $topicId && FeedTopic::model()->updateCounters(array("count" => -1), sprintf("FIND_IN_SET(topicid,'%s')", implode(",", $topicId)));
         FeedTopicLink::model()->deleteAll("feedid=" . $feedid);
         if ($res) {
             $return = array("isSuccess" => true);
             $uid && UserUtil::updateCreditByAction("deleteweibo", $uid);
         }
     }
     return $return;
 }