Beispiel #1
0
 public function afterDelete()
 {
     (new History(['user_id' => $this->user_id, 'action' => History::ACTION_DELETE_COMMENT, 'target' => $this->id]))->save(false);
     Siteinfo::updateCounterInfo('deleteComment');
     UserInfo::updateCounterInfo('deleteComment', $this->user_id);
     Topic::afterCommentDelete($this->topic_id);
     return parent::afterDelete();
 }
Beispiel #2
0
 public function afterSave($insert, $changedAttributes)
 {
     if ($insert === true) {
         (new History(['user_id' => $this->topic->user_id, 'action' => History::ACTION_ADD_TOPIC, 'action_time' => $this->topic->created_at, 'target' => $this->topic_id]))->save(false);
         Siteinfo::updateCounterInfo('addTopic');
         UserInfo::updateCounterInfo('addTopic', $this->topic->user_id);
         Node::updateCounterInfo('addTopic', $this->topic->node_id);
         Notice::afterTopicInsert($this);
         Tag::afterTopicInsert($this);
     }
     return parent::afterSave($insert, $changedAttributes);
 }
Beispiel #3
0
 public function afterDelete()
 {
     (new History(['user_id' => $this->user_id, 'action' => History::ACTION_DELETE_TOPIC, 'target' => $this->id]))->save(false);
     TopicContent::deleteAll(['topic_id' => $this->id]);
     Node::updateCounterInfo('deleteTopic', $this->node_id);
     UserInfo::updateCounterInfo('deleteTopic', $this->user_id);
     $count = Comment::afterTopicDelete($this->id);
     Siteinfo::updateCountersInfo(['topics' => -1, 'comments' => -$count]);
     Favorite::afterTopicDelete($this->id);
     Notice::afterTopicDelete($this->id);
     return parent::afterDelete();
 }
}
if (intval($settings['cache_enabled']) === 0 || $this->beginCache('f-index-right', ['duration' => intval($settings['cache_time']) * 60])) {
    $hotTopics = Topic::getHotTopics();
    if (!empty($hotTopics)) {
        ?>
<ul class="list-group sf-box">
  <li class="list-group-item gray">24小时内热议主题</li>
<?php 
        foreach ($hotTopics as $ht) {
            echo '<li class="list-group-item">', Html::a(Html::encode($ht['title']), ['topic/view', 'id' => $ht['id']]), '</li>';
        }
        ?>
</ul>
<?php 
    }
    $siteinfo = Siteinfo::getSiteInfo();
    if (!empty($siteinfo)) {
        ?>
<div class="panel panel-default sf-box">
  <div class="panel-heading gray">社区运行状况</div>
  <div class="panel-body">
		<span class="si-label">注册会员:</span><span class="si-info"><?php 
        echo $siteinfo['users'];
        ?>
</span>
		<span class="si-label">节点:</span><span class="si-info"><?php 
        echo $siteinfo['nodes'];
        ?>
</span>
		<span class="si-label">主题:</span><span class="si-info"><?php 
        echo $siteinfo['topics'];
Beispiel #5
0
 public function afterSave($insert, $changedAttributes)
 {
     if ($insert === true) {
         $userIP = sprintf("%u", ip2long(Yii::$app->getRequest()->getUserIP()));
         (new UserInfo(['user_id' => $this->id, 'reg_ip' => $userIP]))->save(false);
         Siteinfo::updateCounterInfo('addUser');
         /*			if ( intval(Yii::$app->params['settings']['email_verify']) === 1) {
         				Token::sendActivateMail($this);
         			}*/
         (new History(['user_id' => $this->id, 'action' => History::ACTION_REG, 'action_time' => $this->created_at, 'target' => $userIP]))->save(false);
     }
     return parent::afterSave($insert, $changedAttributes);
 }
Beispiel #6
0
 public function afterDelete()
 {
     Siteinfo::updateCounterInfo('deleteNode');
     return parent::afterDelete();
 }