<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 } ?> <!-- /do render forums here--> </div> </div>
<div id="yboard-message"></div><br> <p class="pull-right pad5-right"><?php echo Html::button(YBoard::t('yboard', 'New message'), ['class' => 'btn btn-default btn-md', 'style' => 'cursor:pointer;', 'onclick' => 'sendPm(' . Yii::$app->user->id . '); return false;']); ?> </p> <?php \yii\widgets\Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => null, 'id' => 'inbox-grid-box', 'rowOptions' => function ($model, $index, $widget, $grid) { return ['class' => $model->read_indicator ? '' : 'unread', 'id' => 'msg_id_' . $model->id]; }, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'sendfrom', 'value' => function ($model, $key, $index, $column) { return $model->sender->profile->username; }], 'subject', ['attribute' => 'create_time', 'value' => function ($model, $key, $index, $column) { return DateTimeCalculation::short($model->create_time); }], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}{reply}{delete}', 'buttons' => ['view' => function ($url, $model) { // return the button HTML code $src = $this->context->module->getRegisteredImage('view.png'); return Html::a(Html::img($src, ['alt' => 'view']), '#', ['style' => 'margin-left:5px;', 'onclick' => new JsExpression(' viewMessage("' . $model->id . '", "' . Yii::$app->urlManager->createAbsoluteUrl($this->context->module->id . '/message/view', ['id' => $model->id]) . '"); return false; ')]); }, 'reply' => function ($url, $model) { // return the button HTML code $src = $this->context->module->getRegisteredImage('reply.png'); return Html::a(Html::img($src, ['alt' => 'reply']), '#', ['style' => 'margin-left:5px;', 'onclick' => new JsExpression(' replyMessage(' . $model->sendfrom . ') return false; ')]) . ' '; }, 'delete' => function ($url, $model) {
?> <div class="yboard-ban-index"> <p class="header2"><?php echo Html::encode($this->title); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'user_id', 'value' => function ($model, $index, $dataColumn) { return $model->member->profile->username; }], ['attribute' => 'banned_by', 'value' => function ($model, $index, $dataColumn) { return $model->banner->profile->username; }], ['attribute' => 'expires', 'format' => 'raw', 'value' => function ($model, $index, $dataColumn) { return Editable::widget(['value' => DateTimeCalculation::short($model->expires), 'name' => 'expires', 'options' => ['name' => 'expires'], 'format' => Editable::FORMAT_BUTTON, 'inputType' => Editable::INPUT_DATETIME, 'formOptions' => ['action' => url::to(['moderator/change-ban-period', 'id' => $model->id])]]); }], 'ip', 'email:email', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{lift} {reason}', 'buttons' => ['lift' => function ($url, $model, $key) { return Html::a('<span class="glyphicon glyphicon-tint"></span>', '#', ['title' => YBoard::t('yboard', 'Lift Ban'), 'onclick' => 'if(confirm("' . YBoard::t('yboard', 'Do you really Lift this Ban') . '")) { banLift("' . Yii::$app->urlManager->createAbsoluteUrl([$this->context->module->id . '/moderator/ban-lift', 'id' => $model->id]) . '"); }return false; ']); }, 'reason' => function ($url, $model, $key) { return Html::a('<span class="glyphicon glyphicon-envelope"></span>', '#', ['title' => YBoard::t('yboard', 'Ban Reason'), 'onclick' => 'banMessage(\'' . $model->message . '\')']); }]]]]); ?> </div> <?php Dialog::begin(['id' => 'dlgBanMsg', 'clientOptions' => ['modal' => true, 'title' => YBoard::t('yboard', 'Ban Reason'), 'autoOpen' => false, 'modal' => true, 'height' => 'auto', 'min-height' => 100, 'width' => 200, 'buttons' => [['text' => YBoard::t('yboard', 'close'), 'class' => 'btn btn-sm btn-danger', 'click' => new \yii\web\JsExpression(' function() { $( this ).dialog( "close" ); }')]]]]); ?> <div id="dlgBanMsgText" class="alert alert-warning panel"></div>
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">
<?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>
<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> <div class="forum-cell center col-md-2 "> <?php echo Html::encode($model->num_views); ?> <br> <?php echo Html::encode($model->getAttributeLabel('num_views')); ?> </div> <div class="forum-cell last-cell col-md-3"> <?php echo Html::encode($model->lastPost->poster->profile->username); echo Html::a(Html::img($this->context->module->getRegisteredImage('next.png'), ['alt' => 'next', 'style' => 'margin-left:5px;']), ['topic', 'id' => $model->id, 'nav' => 'last'], ['title' => YBoard::t('yboard', 'Last Reply')]); echo '<br>'; echo DateTimeCalculation::longDate($model->lastPost->create_time); ?> </div> </div>
?> </span><br> <p><?php echo YBoard::t('yboard', 'Banned on: {time}', ['time' => DateTimeCalculation::long($model->banned_on)]); ?> </p> <p><?php echo YBoard::t('yboard', 'Ban Type: {type}', ['type' => $isIp ? YBoard::t('yboard', 'IP Ban') : YBoard::t('yboard', 'Member Ban')]); ?> </p> <p><?php echo YBoard::t('yboard', 'Reason: {reason}', ['reason' => $model->message]); ?> </p> <p><?php echo YBoard::t('yboard', 'Ban to Lift on: {time}', ['time' => DateTimeCalculation::long($model->expires)]); ?> </p> <p><?php echo YBoard::t('yboard', 'Ban length: {days} days {hours} hours', DateTimeCalculation::getDiff($model->banned_on, $model->expires)); ?> </p> <p><?php echo YBoard::t('yboard', 'Remained: {days} days {hours} hours', DateTimeCalculation::getDiff(time(), $model->expires)); ?> </p> </div> </div> </div>
<div class="progress"><div class="progressbar" style="width:<?php echo 2 * $count['outbox']; ?> %"> </div></div> <div id="yboard-message"></div><br> <?php \yii\widgets\Pjax::begin(); echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => null, 'id' => 'outbox-grid-box', 'rowOptions' => function ($model, $index, $widget, $grid) { return ['class' => $model->read_indicator ? '' : 'unread']; }, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'sendto', 'value' => function ($model, $key, $index, $column) { return $model->receiver == null ? YBoard::t('yboard', 'Management') : $model->receiver->profile->username; }], 'subject', ['attribute' => 'create_time', 'value' => function ($model, $key, $index, $column) { return DateTimeCalculation::long($model->create_time); }], ['attribute' => 'type', 'value' => function ($model, $key, $index, $column) { return $model->type ? Yii::t("app", "notification") : Yii::t("app", "message"); }], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}{delete}', 'buttons' => ['view' => function ($url, $model) { // return the button HTML code $src = $this->context->module->getRegisteredImage('view.png'); return Html::a(Html::img($src, ['alt' => 'view']), $model->id, ['style' => 'margin-left:5px;', 'onclick' => new JsExpression(' viewMessage($(this).attr("href"), "' . Yii::$app->urlManager->createAbsoluteUrl($this->context->module->id . '/message/view') . '"); return false; ')]); }, 'delete' => function ($url, $model) { // return the button HTML code $src = $this->context->module->getRegisteredImage('delete.png'); return Html::a(Html::img($src, ['alt' => 'view']), '#', ['style' => 'margin-left:5px;', 'onclick' => new \yii\web\JsExpression(' what = confirm("' . Yii::t('yii', 'Are you sure you want to delete this item?') . '"); if(what)
/** Change Ban Time */ public function actionChangeBanPeriod($id) { if (!Yii::$app->user->can('app.forum.moderator.change-ban-period')) { 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.')); } if (!Yii::$app->request->isAjax) { Yii::$app->end(); } if (isset($_POST['hasEditable']) && isset($_POST['expires'])) { $attrib = $_POST['expires']; $attrib = strtotime($attrib); $model = YBoardBan::findOne($id); if ($model == null) { echo json_encode(['output' => '', 'message' => 'Could Not Update Field']); Yii::$app->end(); } $model->expires = $attrib; if (!$model->save()) { // validation error echo json_encode(['output' => '', 'message' => 'Could Not Update Field']); } else { // read or convert your posted information $value = DateTimeCalculation::short($model->expires); echo json_encode(['output' => $value, 'message' => '']); } } else { throw new ForbiddenHttpException(YBoard::t('yboard', 'This Action is forbidden!')); } }
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)); }