Esempio n. 1
0
                
                <div class="forum-cell col-md-2 center hidden-xs">
                    <?php 
    echo Html::encode($forum->num_topics);
    ?>
                </div>
                
                <div class="forum-cell col-md-3 last-cell">
                    <div class="hidden-xs"> 
                        <?php 
    if ($forum->last_post_id && $forum->lastPost) {
        echo Html::a(Html::encode($forum->lastPost->topic->title), ['topic', 'id' => $forum->lastPost->topic_id]);
        echo '<br>' . YBoard::t('yboard', 'Last post by') . ' ' . Html::encode($forum->lastPost->poster->profile->username);
        echo Html::a(Html::img($this->context->module->getRegisteredImage('next.png'), ['style' => 'margin-left:5px;', 'title' => YBoard::t('yboard', 'view last post')]), ['topic', 'id' => $forum->lastPost->topic_id, 'nav' => 'last']);
        echo '<br>';
        echo ' ' . YBoard::t('yboard', 'on') . ' ' . DateTimeCalculation::medium($forum->lastPost->create_time);
    } else {
        echo YBoard::t('yboard', 'No posts');
    }
    ?>
                    </div>
                    
                    <div class="visible-xs">
                        <?php 
    echo YBoard::t('yboard', '{topics, plural, =0{No Topic} =1{One Topic} other{# Topics}}. Last Post {time}', ['topics' => $forum->num_topics == null ? 0 : $forum->num_topics, 'time' => DateTimeCalculation::short($forum->lastPost == null ? 0 : $forum->lastPost->create_time)]);
    ?>
                    </div>
                </div>
            </div>
        <?php 
}
Esempio n. 2
0
echo YBoard::t('yboard', 'Recent Replies');
?>
</div>
                <div class="contents">
                    <?php 
$idx = 0;
?>
                    <?php 
foreach ($recentReplies as $post) {
    ?>
                        <div class="<?php 
    echo $idx % 2 == 0 ? 'even' : 'odd';
    ?>
">
                            <?php 
    echo YBoard::t('yboard', '{user} replied to {topic} on {time}', ['topic' => Html::a($post->topic->title, ['topic', 'id' => $post->topic->id]), 'user' => Html::a($post->poster->profile->username, ['member/view', 'id' => $topic->starter->id]), 'time' => DateTimeCalculation::medium($post->create_time)]);
    ?>
<br>
                            <?php 
    $idx = $idx + 1;
    ?>
                        </div>
                    <?php 
}
?>
                </div>
            </div>
        </div>
    </div>     
       
    <div class="hidden-xs">
Esempio n. 3
0
    echo Html::img($this->context->module->getRegisteredImage('empty.png'), ['alt' => 'empty']);
    ?>
                    <?php 
    echo Html::img($this->context->module->getRegisteredImage('update.png'), ['update', 'title' => YBoard::t('yboard', 'Update topic'), 'style' => 'cursor:pointer', 'onclick' => 'YBoard.updateTopic(' . $model->id . ', "' . \Yii::$app->urlManager->createAbsoluteUrl($this->context->module->id . '/moderator/topic') . '")']);
    ?>
                <?php 
}
?>
            </div> 
            
            <div class="col-md-12 ">
                <?php 
echo YBoard::t('yboard', 'started by ') . Html::encode($model->starter->profile->username);
?>
                <?php 
echo ' ' . YBoard::t('yboard', 'on') . ' ' . DateTimeCalculation::medium($model->firstPost->create_time);
?>
            </div>
        </div>
    </div>
    
    <div class="forum-cell center col-md-2 ">
        <?php 
echo Html::encode($model->num_replies);
?>
<br>
        <?php 
echo Html::encode($model->getAttributeLabel('num_replies'));
?>
    </div>
    
Esempio n. 4
0
		                 
                <?php 
if (Yii::$app->user->can('moderator')) {
    ?>
                    <!--Moderator Actions -->
                    <?php 
    echo ButtonDropdown::widget(['label' => YBoard::t('yboard', 'Mod'), 'options' => ['class' => 'btn btn-default btn-sm pull-left'], 'dropdown' => ['encodeLabels' => false, 'items' => array_merge(!Yii::$app->user->can('admin') || $model->original_post == 1 ? [] : [['label' => YBoard::t('yboard', 'Delete post') . ' <span class="glyphicon glyphicon-trash"></span>', 'url' => '/', 'options' => [], 'linkOptions' => ['onclick' => 'if(confirm("' . YBoard::t('yboard', 'Want to delete this post?') . '")) { deletePost("' . Yii::$app->urlManager->createAbsoluteUrl([$this->context->module->id . '/moderator/delete', 'id' => $model->id]) . '"); return false; }']]], [['label' => YBoard::t('yboard', 'Disapprove post') . ' <span class="glyphicon glyphicon-remove-circle"></span>', 'url' => '#', 'options' => [], 'linkOptions' => ['onclick' => 'if(confirm("' . YBoard::t('yboard', 'Want to Remove post from visible Posts?') . '")) { deletePost("' . Yii::$app->urlManager->createAbsoluteUrl([$this->context->module->id . '/moderator/disapprove', 'id' => $model->id]) . '"); return false; }']], ['label' => YBoard::t('yboard', 'Ban user') . ' <span class="glyphicon glyphicon-fire"></span>', 'url' => '', 'options' => [], 'linkOptions' => ['title' => YBoard::t('yboard', 'Ban this user'), 'onclick' => 'if(confirm("' . YBoard::t('yboard', 'Do you really want to Ban this User?') . '")) { banUser(' . Yii::$app->user->id . ', "' . Yii::$app->urlManager->createAbsoluteUrl([$this->context->module->id . '/moderator/ban-user', 'id' => $model->user_id]) . '");  }return false;']], ['label' => YBoard::t('yboard', 'Ban user IP') . ' <span class="glyphicon glyphicon-shot"></span>', 'visible' => Yii::$app->user->can('admin'), 'url' => '/', 'options' => [], 'linkOptions' => ['title' => YBoard::t('yboard', 'Ban IP user\'saddress'), 'onclick' => 'if(confirm("' . YBoard::t('yboard', 'Do you really want to ban this IP address?') . '")) { banIp(' . $model->id . ', "' . Yii::$app->urlManager->createAbsoluteUrl('moderator/ban-ip') . '"); }return false; ']]])]]);
    ?>
                <?php 
}
?>
            </div>
        </div>
            
        <div class= "col-md-4">
            <?php 
if ($model->change_reason) {
    ?>
                <?php 
    echo YBoard::t('yboard', 'last modified on {date}, Reason: {reason}', ['date' => DateTimeCalculation::medium($model->change_time), 'reason' => Html::encode($model->change_reason)]);
    ?>
            <?php 
}
?>
        </div>
    </div>
    
    <div class="post-bottom"></div>
</div>

Esempio n. 5
0
use yii\grid\GridView;
use yii\jui\Dialog;
use app\modules\yboard\YBoard;
use app\modules\yboard\components\DateTimeCalculation;
$this->params['breadcrumbs'] = [['label' => YBoard::t('yboard', 'Forums'), 'url' => ['forum/index']], ['label' => YBoard::t('yboard', 'Settings'), 'url' => ['setting/index']], YBoard::t('yboard', 'Web Spiders')];
$this->title = YBoard::t('yboard', 'Settings - Spiders');
$items = array(['label' => YBoard::t('yboard', 'Settings'), 'url' => array('setting/index')], ['label' => YBoard::t('yboard', 'Manage forums'), 'url' => array('setting/forum')], ['label' => YBoard::t('yboard', 'Member groups'), 'url' => array('setting/group')], ['label' => YBoard::t('yboard', 'Moderators'), 'url' => array('setting/moderator')]);
$this->registerJs("\n    var confirmation = '" . YBoard::t('yboard', 'Are you sure that you want to delete this webspider?') . "'\n", View::POS_HEAD);
?>
<div id="yboard-wrapper"  class="container">
	
	<p class="pad5"><?php 
echo Html::button(YBoard::t('yboard', 'New Spider'), array('onclick' => 'YBoardSetting.EditSpider()', 'class' => 'btn btn-primary btn-sm'));
?>
</p>
	 
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $model, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', 'user_agent', 'hits', ['attribute' => 'last_visit', 'value' => function ($data) {
    return DateTimeCalculation::medium($data->last_visit);
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', '#', ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0', 'onclick' => 'YBoardSetting.EditSpider(' . $model->id . ',"' . Yii::$app->urlManager->createAbsoluteUrl(Yii::$app->controller->module->id . '/setting/get-spider') . '"); return false;']);
}]]]]);
?>
      
     
 </div>

<?php 
Dialog::begin(['id' => 'dlgEditSpider', 'clientOptions' => ['title' => 'Web Spider', 'autoOpen' => false, 'modal' => true, 'width' => 400, 'show' => 'fade', 'buttons' => [YBoard::t('yboard', 'Delete') => new JsExpression('function(){ YBoardSetting.DeleteSpider("' . Yii::$app->urlManager->createAbsoluteUrl(Yii::$app->controller->module->id . '/setting/delete-spider') . '"); }'), YBoard::t('yboard', 'Save') => new JsExpression('function(){ YBoardSetting.SaveSpider("' . Yii::$app->urlManager->createAbsoluteUrl(Yii::$app->controller->module->id . '/setting/save-spider') . '"); }'), YBoard::t('yboard', 'Cancel') => new JsExpression('function(){ $(this).dialog("close"); }')]]]);
echo $this->render('_editSpider', ['model' => $model]);
Dialog::end();
 /**
  * Quote the original post in the reply (reply to a post)
  * @param $id integer post_id
  */
 public function actionQuote($id)
 {
     if (!Yii::$app->user->can('app.forum.forum.quote')) {
         throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no enough permission to access this page! If you think its a mistake, please consider reporting to us.'));
     }
     $quoted = YBoardPost::findOne($id);
     if ($quoted === null) {
         throw new NotFoundHttpException(404, YBoard::t('yboard', 'The requested post does not exist.'));
     }
     if ($quoted->topic->approved == 0) {
         throw new ForbiddenHttpException(YBoard::t('yboard', 'The requested topic cannot be replied to.'), 403);
     }
     $topic = YBoardTopic::findOne($quoted->topic_id);
     $forum = YBoardForum::findOne($topic->forum_id);
     if (isset($_POST['YBoardPost'])) {
         $post = new YBoardPost();
         $post->attributes = $_POST['YBoardPost'];
         $post->user_id = Yii::$app->user->id;
         if ($forum->moderated) {
             $post->approved = 0;
         } else {
             $post->approved = 1;
         }
         $post->forum_id = $topic->forum_id;
         if ($post->save()) {
             if ($post->approved) {
                 $forum->updateCounters(['num_posts' => 1]);
                 $topic->updateCounters(['num_replies' => 1]);
                 $topic->updateAttributes(['last_post_id' => $post->id]);
                 $forum->updateAttributes(['last_post_id' => $post->id]);
             } else {
                 Yii::$app->session->setFlash('moderation', YBoard::t('yboard', 'Your post has been saved. It has been placed in a queue and is now waiting for approval by a moderator before it will appear on the forum. Thank you for your contribution to the forum.'));
             }
             //send notifications
             $this->sendNotifications($post);
             $this->redirect(['topic', 'id' => $post->topic_id, 'nav' => 'last']);
         }
     } else {
         $post = new YBoardPost();
         $quote = '<div class="quotation-header"><cite class="quotation-username">' . $quoted->poster->profile->username . ' ' . YBoard::t('yboard', 'Wrote:') . ' </cite><cite class="quotation-date">' . DateTimeCalculation::medium($quoted->create_time) . '</cite></div>';
         $quote = '<div class="quotation-header"><cite class="quotation-username">' . $quoted->poster->profile->username . ' ' . YBoard::t('yboard', 'wrote') . ' </cite><cite class="quotation-date">' . DateTimeCalculation::medium($quoted->create_time) . '</cite></div>';
         $post->content = '<blockquote class="quotation-content">' . $quote . ' ' . $quoted->content . '</blockquote>  <p></p>';
         $post->subject = $quoted->subject;
         $post->forum_id = $quoted->forum_id;
         $post->topic_id = $quoted->topic_id;
     }
     return $this->render('reply', array('forum' => $forum, 'topic' => $topic, 'post' => $post));
 }