Example #1
0
<?php

/* @var $this \mpf\modules\forum\controllers\Manage */
/* @var $model \mpf\modules\forum\models\ForumTitle */
echo \app\components\htmltools\Page::get()->title(\mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['home', 'index']), $this->forumTitle) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " Users", \mpf\modules\forum\components\UserAccess::get()->isSectionAdmin($this->sectionId) ? [['url' => $this->updateURLWithSection(['manage', 'groups']), 'label' => 'Manage Groups'], ['url' => $this->updateURLWithSection(['manage', 'categories']), 'label' => 'Manage Categories'], ['url' => $this->updateURLWithSection(['manage', 'users']), 'label' => 'Manage Users'], ['url' => $this->updateURLWithSection(['manage', 'titles']), 'label' => 'Manage Titles', 'htmlOptions' => ['class' => 'selected']], ['url' => $this->updateURLWithSection(['manage', 'newTitle']), 'label' => 'New Title']] : [['url' => $this->updateURLWithSection(['manage', 'users']), 'label' => 'Manage Users'], ['url' => $this->updateURLWithSection(['manage', 'titles']), 'label' => 'Manage Titles', 'htmlOptions' => ['class' => 'selected']]]);
\mpf\widgets\datatable\Table::get(['dataProvider' => $model->getDataProvider($this->sectionId), 'columns' => ['id', 'title', ['class' => 'Actions', 'buttons' => ['delete' => ['class' => 'Delete', 'url' => $this->getUrlForDatatableAction('delete')], 'edit' => ['class' => 'Edit', 'url' => $this->getUrlForDatatableAction('editTitle')]]]]])->display();
 public function beforeDelete()
 {
     if (!UserAccess::get()->isCategoryAdmin($this->category_id, $this->category->section_id)) {
         Messages::get()->error("You can't delete this category!");
         return false;
     }
     return parent::beforeDelete();
 }
Example #3
0
    ?>
    <?php 
    $menu = [['url' => $this->updateURLWithSection(['manage', 'groups']), 'label' => 'Manage Groups'], ['url' => $this->updateURLWithSection(['manage', 'categories']), 'label' => 'Manage Categories'], ['url' => $this->updateURLWithSection(['manage', 'users']), 'label' => 'Manage Users'], ['url' => $this->updateURLWithSection(['manage', 'titles']), 'label' => 'Manage Titles']];
}
echo \app\components\htmltools\Page::get()->title(\mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['home', 'index']), $this->forumTitle) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " Control Panel", $menu);
?>

<div class="forum-page <?php 
echo $this->forumPageTheme;
?>
">
    <?php 
$this->displayComponent('topuserpanel');
?>
    <?php 
if ((!\mpf\modules\forum\components\UserAccess::get()->isMember($this->sectionId) || \mpf\modules\forum\components\UserAccess::get()->isBanned($this->sectionId)) && !\mpf\modules\forum\components\UserAccess::get()->isSiteModerator() && !\mpf\modules\forum\components\UserAccess::get()->isSiteAdmin()) {
    ?>
        <?php 
    $this->displayComponent('accessdenied', ['location' => 'members']);
    ?>
        <?php 
    return;
    ?>
    <?php 
}
?>

    <?php 
echo \mpf\widgets\form\Form::get(['name' => 'save', 'model' => $model, 'theme' => 'default-wide', 'formHtmlOptions' => ['enctype' => 'multipart/form-data'], 'fields' => \mpf\modules\forum\components\Config::value('FORUM_HANDLE_USER_ICON') ? [['name' => 'signature', 'type' => 'markdown', 'htmlOptions' => ['style' => 'min-height: 200px;']], ['name' => 'icon', 'type' => 'image', 'urlPrefix' => $model->getIconLocationURL()]] : [['name' => 'signature', 'type' => 'markdown', 'htmlOptions' => ['style' => 'min-height: 200px;']]]])->display();
?>
Example #4
0
}
echo \app\components\htmltools\Page::get()->title(\mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['home']), \mpf\modules\forum\components\Translator::get()->translate($this->forumTitle)) . " " . \mpf\modules\forum\components\Config::value("FORUM_PAGE_TITLE_SEPARATOR") . " " . \mpf\modules\forum\components\Translator::get()->translate("Recent Threads"), $menu);
?>
<div class="forum-page <?php 
echo $this->forumPageTheme;
?>
">
    <?php 
$this->displayComponent('searchbar');
?>
    <?php 
$this->displayComponent('topuserpanel');
?>

    <?php 
if (!\mpf\modules\forum\components\UserAccess::get()->canRead($this->sectionId)) {
    ?>
        <?php 
    $this->displayComponent('accessdenied', ['location' => 'section']);
    ?>
        <?php 
    return;
    ?>
    <?php 
}
?>

    <table class="forum-category">
        <tr class="subcategory-title-row">
            <th colspan="6">
                <h2>
Example #5
0
    return;
}
?>
<div class="forum-user-panel">
    <div class="forum-user-panel-icon">
        <?php 
echo \mpf\web\helpers\Html::get()->link(['user', 'controlPanel'], \mpf\web\helpers\Html::get()->image(\mpf\modules\forum\components\ModelHelper::getUserIconURL(\mpf\WebApp::get()->user()->icon ?: 'default.png')));
?>
    </div>
    <div class="forum-user-panel-about">
        <?php 
echo \mpf\web\helpers\Html::get()->link(['user', 'index', ['id' => \mpf\WebApp::get()->user()->id, 'name' => \mpf\WebApp::get()->user()->name]], \mpf\WebApp::get()->user()->name, ['class' => 'form-user-panel-about-name']);
?>
        <span
            class="form-user-panel-about-title"><?php 
echo \mpf\modules\forum\components\UserAccess::get()->getUserTitle($this->sectionId, true);
?>
</span>
    </div>
    <div class="forum-user-panel-links">
        <?php 
echo \mpf\web\helpers\Html::get()->link(['home'], \mpf\modules\forum\components\Translator::get()->translate('Categories'));
?>
        <?php 
echo \mpf\web\helpers\Html::get()->link(['user', 'controlPanel'], \mpf\modules\forum\components\Translator::get()->translate('Control Panel'));
?>
        <?php 
echo \mpf\web\helpers\Html::get()->link(['search', 'recent'], \mpf\modules\forum\components\Translator::get()->translate('Recent Threads'));
?>
        <?php 
echo \mpf\web\helpers\Html::get()->link(['members'], \mpf\modules\forum\components\Translator::get()->translate('Members'));
Example #6
0
    <?php 
    $menu = [['url' => $this->updateURLWithSection(['manage', 'groups']), 'label' => 'Manage Groups'], ['url' => $this->updateURLWithSection(['manage', 'categories']), 'label' => 'Manage Categories'], ['url' => $this->updateURLWithSection(['manage', 'users']), 'label' => 'Manage Users'], ['url' => $this->updateURLWithSection(['manage', 'titles']), 'label' => 'Manage Titles']];
}
echo \app\components\htmltools\Page::get()->title(\mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['home', 'index']), $this->forumTitle) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " " . $user->user->name, $menu);
?>

<div class="forum-page <?php 
echo $this->forumPageTheme;
?>
">
    <?php 
$this->displayComponent('topuserpanel');
?>

    <?php 
if (!\mpf\modules\forum\components\UserAccess::get()->canViewUserProfile($user->user_id)) {
    ?>
        <?php 
    $this->displayComponent('accessdenied', ['location' => 'userprofile']);
    ?>
        <?php 
    return;
    ?>
    <?php 
}
?>

    <table class="forum-category">
        <tr class="subcategory-title-row">
            <th colspan="6">
                <h2>
Example #7
0
         ?>
                             <?php 
         echo $reply->getEditorProfileLink();
         ?>
                             <?php 
         echo \mpf\helpers\DateTimeHelper::get()->niceDate($reply->edit_time, false, false);
         ?>
                         <?php 
     }
     ?>
                     </div>
                 <?php 
 }
 ?>
                 <?php 
 if (!$reply->deleted && \mpf\modules\forum\components\UserAccess::get()->canReplyToThread($subcategory->category_id, $this->sectionId)) {
     ?>
                     <div class="forum-thread-reply-actions">
                         <?php 
     echo \mpf\web\helpers\Html::get()->link('#reply-for-1-' . $reply->id, \mpf\modules\forum\components\Translator::get()->translate('Reply'), ['class' => 'new-reply-button reply-to-existing-reply']);
     ?>
                     </div>
                 <?php 
 }
 ?>
                 <?php 
 if ($reply->sectionAuthor->getSignature()) {
     ?>
                     <?php 
     echo \mpf\modules\forum\components\Config::value('FORUM_THREAD_SIGNATURE_SEPARATOR');
     ?>
Example #8
0
<?php

/* @var $this \mpf\modules\forum\controllers\Manage */
/* @var $model \mpf\modules\forum\models\ForumUser2Section */
/* @var string[] $groups */
/* @var string[] $titles */
echo \app\components\htmltools\Page::get()->title(\mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['home', 'index']), $this->forumTitle) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " Users", \mpf\modules\forum\components\UserAccess::get()->isSectionAdmin($this->sectionId) ? [['url' => $this->updateURLWithSection(['manage', 'groups']), 'label' => 'Manage Groups'], ['url' => $this->updateURLWithSection(['manage', 'categories']), 'label' => 'Manage Categories'], ['url' => $this->updateURLWithSection(['manage', 'users']), 'label' => 'Manage Users', 'htmlOptions' => ['class' => 'selected']], ['url' => $this->updateURLWithSection(['manage', 'titles']), 'label' => 'Manage Titles']] : [['url' => $this->updateURLWithSection(['manage', 'users']), 'label' => 'Manage Users', 'htmlOptions' => ['class' => 'selected']], ['url' => $this->updateURLWithSection(['manage', 'titles']), 'label' => 'Manage Titles']]);
?>

<?php 
\mpf\widgets\datatable\Table::get(['dataProvider' => $model->getDataProvider($this->sectionId, 'forum'), 'columns' => ['name' => ['value' => '$row->user->name'], 'member_since' => ['class' => 'Date'], 'last_login' => ['class' => 'Date', 'value' => '$row->user->last_login?$row->user->last_login:"******"'], 'title_id' => ['class' => 'InlineEdit', 'type' => 'select', 'options' => $titles, 'filter' => $titles], 'group_id' => \mpf\modules\forum\components\UserAccess::get()->isSectionAdmin($this->sectionId) ? ['class' => 'InlineEdit', 'type' => 'select', 'filter' => $groups, 'options' => $groups] : ['value' => '$row->group?$row->group->full_name:"-"', 'filter' => $groups], 'muted' => ['class' => 'InlineEdit', 'type' => 'select', 'filter' => ['No', 'Yes'], 'options' => ['No', 'Yes']], 'banned' => ['class' => 'InlineEdit', 'type' => 'select', 'filter' => ['No', 'Yes'], 'options' => ['No', 'Yes']]]])->display();
Example #9
0
 /**
  * @param int $categoryId
  * @param int $sectionId
  * @return bool
  */
 public function canEdit($categoryId = null, $sectionId = null)
 {
     if (!is_null($this->_canEdit)) {
         return $this->_canEdit;
     }
     $categoryId = $categoryId ?: $this->subcategory->category_id;
     $sectionId = $sectionId ?: $this->subcategory->category->section_id;
     if (WebApp::get()->user()->isGuest()) {
         //added a fix for guests;
         return $this->_canEdit = false;
     }
     if (($this->closed || $this->deleted) && !($moderator = UserAccess::get()->isCategoryModerator($categoryId, $sectionId)) || UserAccess::get()->isMuted($sectionId)) {
         return $this->_canEdit = false;
     }
     if ($this->user_id == WebApp::get()->user()->id) {
         return $this->_canEdit = true;
     }
     return $this->_canEdit = isset($moderator) ? $moderator : UserAccess::get()->isCategoryModerator($categoryId, $sectionId);
 }
Example #10
0
 /**
  * @param int $categoryId
  * @param int $sectionId
  * @param ForumThread $thread
  * @return bool
  */
 public function canEdit($categoryId = null, $sectionId = null, ForumThread $thread = null)
 {
     if ($this->deleted) {
         return false;
     }
     $thread = $thread ?: $this->thread;
     $categoryId = $categoryId ?: $thread->subcategory->category_id;
     $sectionId = !is_null($sectionId) ? $sectionId : $thread->subcategory->category->section_id;
     if (WebApp::get()->user()->isGuest()) {
         //added a fix for guests;
         return false;
     }
     if ($this->user_id == WebApp::get()->user()->id && !($this->deleted || UserAccess::get()->isMuted($sectionId) || $thread->closed)) {
         return true;
     }
     if (!is_null($this->_canEdit)) {
         return $this->_canEdit;
     }
     return $this->_canEdit = UserAccess::get()->isCategoryModerator($categoryId, $sectionId);
 }
Example #11
0
        ?>
                    </td>
                </tr>
            <?php 
    }
    ?>
        <?php 
}
?>
    </table>
    <?php 
$this->displayComponent("pagelist", ['elementsName' => \mpf\modules\forum\components\Translator::get()->translate('threads'), 'totalElements' => $subcategory->number_of_threads, 'visibleElements' => count($threads), 'totalPages' => (int) ($subcategory->number_of_threads / \mpf\modules\forum\components\Config::value('FORUM_THREADS_PER_PAGE') + ($subcategory->number_of_threads % \mpf\modules\forum\components\Config::value('FORUM_THREADS_PER_PAGE') ? 1 : 0)), 'currentPage' => $currentPage]);
?>
    <div class="forum-section-footer">
        <?php 
if (\mpf\modules\forum\components\UserAccess::get()->isCategoryModerator($subcategory->category_id, $this->sectionId)) {
    ?>
            <div class="forum-section-actions">
                <?php 
    echo \mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['manage', 'editSubcategory', ['id' => $subcategory->id]]), \mpf\modules\forum\components\Translator::get()->translate("Edit subcategory"));
    ?>
            </div>
        <?php 
}
?>
        <div class="forum-section-jump-to-category">
            <select id="jump-to-category">
                <option><?php 
echo \mpf\modules\forum\components\Translator::get()->translate("--jump to category--");
?>
</option>
Example #12
0
<?php

/* @var $this \mpf\modules\forum\components\Controller */
/* @var $model \mpf\modules\forum\models\ForumThread */
echo \app\components\htmltools\Page::get()->title(\mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['home', 'index']), $this->forumTitle) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " " . \mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['category', 'index', ['category' => $model->subcategory->category->url_friendly_name, 'id' => $model->subcategory->category_id]]), $model->subcategory->category->name) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " " . \mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['subcategory', 'index', ['category' => $model->subcategory->category->url_friendly_name, 'subcategory' => $model->subcategory->url_friendly_title, 'id' => $model->subcategory->category_id]]), $model->subcategory->title) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " " . \mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['thread', 'index', ['category' => $model->subcategory->category->url_friendly_name, 'subcategory' => $model->subcategory->url_friendly_title, 'id' => $model->id]]), $model->title) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " " . \mpf\modules\forum\components\Translator::get()->translate("Edit post"));
?>

<div class="forum-page <?php 
echo $this->forumPageTheme;
?>
">
    <?php 
$this->displayComponent('topuserpanel');
?>

    <?php 
echo \mpf\widgets\form\Form::get(['model' => $model, 'name' => 'save', 'theme' => 'default-wide', 'fields' => ['title', ['name' => 'content', 'type' => \mpf\modules\forum\components\Config::value("FORUM_REPLY_INPUT_TYPE"), 'htmlOptions' => ['style' => 'min-height: 250px;']], ['name' => 'keywords', 'type' => 'seoKeywords']], 'buttons' => [['name' => 'preview', 'label' => 'Preview'], ['name' => 'sticky', 'label' => 'Save as Sticky', 'visible' => \mpf\modules\forum\components\UserAccess::get()->isCategoryModerator($model->subcategory->category_id, $this->sectionId)]]])->display();
?>

</div>
Example #13
0
 public function actionSubcategories($category)
 {
     $category = ForumCategory::findByPk($category);
     if (!UserAccess::get()->isSectionAdmin($category->section_id)) {
         Messages::get()->error("Not enough rights to edit subcategories for this category!");
         $this->goBack();
         die;
     }
     $model = ForumSubcategory::model();
     if (isset($_GET['ForumSubcategory'])) {
         $model->setAttributes($_GET['ForumSubcategory']);
     }
     $this->assign('model', $model);
     $this->assign('category', $category);
 }
Example #14
0
         ?>
                         <?php 
         echo $subReply->getEditorProfileLink();
         ?>
                         <?php 
         echo \mpf\helpers\DateTimeHelper::get()->niceDate($subReply->edit_time, false, false);
         ?>
                     <?php 
     }
     ?>
                 </div>
             <?php 
 }
 ?>
             <?php 
 if (!$reply->deleted && \mpf\modules\forum\components\Config::value('FORUM_MAX_REPLY_LEVELS') != $level && \mpf\modules\forum\components\UserAccess::get()->canReplyToThread($subcategory->category_id, $this->sectionId)) {
     ?>
                 <div class="forum-thread-reply-actions">
                     <?php 
     echo \mpf\web\helpers\Html::get()->link('#reply-for-' . $level . '-' . $subReply->id, \mpf\modules\forum\components\Translator::get()->translate('Reply'), ['class' => 'new-reply-button reply-to-existing-reply']);
     ?>
                 </div>
             <?php 
 }
 ?>
             <?php 
 if ($subReply->sectionAuthor->getSignature()) {
     ?>
                 <?php 
     echo \mpf\modules\forum\components\Config::value('FORUM_THREAD_SIGNATURE_SEPARATOR');
     ?>
 public function beforeSave()
 {
     if (is_a(App::get(), '\\mpf\\WebApp') && WebApp::get()->request()->getModule()) {
         if (!UserAccess::get()->isSectionAdmin($this->section_id)) {
             Messages::get()->error("You don't have access to edit this user group!");
             return false;
         }
     }
     return parent::beforeSave();
 }
Example #16
0
 echo \mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['user', 'index', ['id' => \mpf\WebApp::get()->user()->id, 'name' => \mpf\WebApp::get()->user()->name]]), \mpf\WebApp::get()->user()->name);
 ?>
                     </b>
                     <span class="forum-user-details-title">
                         <?php 
 echo ($t = \mpf\modules\forum\components\UserAccess::get()->getUserTitle($subcategory->category->section_id)) ? $t->title : '-';
 ?>
                     </span>
                 </div>
                 <?php 
 echo \mpf\web\helpers\Html::get()->image(\mpf\modules\forum\components\Config::value('USER_ICON_FOLDER_URL') . (\mpf\WebApp::get()->user()->icon ?: 'default.png'));
 ?>
                 <div class="forum-user-details-footer">
                     <span class="forum-user-details-group">
                     <?php 
 echo ($g = \mpf\modules\forum\components\UserAccess::get()->getUserGroup($subcategory->category->section_id)) ? $g->full_name : '-';
 ?>
                     </span>
                     <span class="forum-user-details-date">
                         <?php 
 echo \mpf\modules\forum\components\Translator::get()->translate("Member since");
 ?>
                         <?php 
 echo lcfirst(\mpf\helpers\DateTimeHelper::get()->niceDate($thread->getSectionUser($subcategory->category->section_id)->member_since, false, false));
 ?>
                     </span>
                 </div>
             </td>
             <td class="forum-reply-form-column">
                 <?php 
 $this->displayComponent("replyform", ['model' => $replyModel]);