Skip to content

Commit

Permalink
Merge pull request #1108 from proditis/frontend-improvements
Browse files Browse the repository at this point in the history
Frontend improvements
  • Loading branch information
proditis authored Feb 19, 2024
2 parents 568023b + 9772071 commit c3be968
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/Sysconfig-Keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* `maintenance`: Enable site-wide maintenance mode
* `maintenance_notification`: Send maintenance notification to everyone connected to the frontend interface. The popup can be dismissed but it always comes back. No other notifications are delivered.
* `require_activation` Whether it is required for users to activate their accounts
* `players_require_approval` If player activation requires moderator approval first
* `disable_registration` Whether online registrations are allowed
* `team_visible_instances` Whether or not player instances are visible to the rest of the team by default otherwise the per-instance field `team_allowed` takes priority

Expand Down
12 changes: 12 additions & 0 deletions frontend/controllers/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ public function behaviors()
'class' => AccessControl::class,
'only' => ['index','login','logout', 'changelog', 'register', 'request-password-reset', 'verify-email', 'resend-verification-email', 'captcha'],
'rules' => [
'disabledRegs'=>[
'actions'=>['register'],
'allow'=>false,
'roles'=>['*'],
'matchCallback' => function ($rule, $action) {
return Yii::$app->sys->disable_registration!==false;
},
'denyCallback' => function ($rule, $action) {
return \Yii::$app->getResponse()->redirect([Yii::$app->sys->default_homepage],303);
},
],
'indexAuth'=>[
'actions'=>['index'],
'allow'=>false,
Expand Down Expand Up @@ -233,6 +244,7 @@ public function actionRegister()
catch(\Exception $e)
{
$transaction->rollBack();
Yii::error($e->getMessage());
Yii::$app->session->setFlash('error', \Yii::t('app','Registration failed.'));
}
catch(\Throwable $e)
Expand Down
2 changes: 1 addition & 1 deletion frontend/models/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public function genAvatar()
return;
$robohash=new \app\models\Robohash($_pID,'set1');
$image=$robohash->generate_image();
if(get_resource_type($image)=== 'gd')
if((gettype($image) === "object" && get_class($image) === "GdImage")||((int) phpversion() === 7 && gettype($image)==='resource'))
{
imagepng($image,$avatarPNG);
imagedestroy($image);
Expand Down
4 changes: 2 additions & 2 deletions frontend/modules/team/controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function actionMine()
]);
$teamPlayers = ArrayHelper::getColumn(Yii::$app->user->identity->team->players,'id');
$teamInstances = \app\modules\target\models\TargetInstance::find()->leftJoin('team_player','target_instance.player_id=team_player.player_id')
->andFilterWhere(['player_id'=>$teamPlayers])
->andFilterWhere(['team_instance.player_id'=>$teamPlayers])
->andFilterWhere(['team_player.approved'=>1]);

if(\Yii::$app->sys->team_visible_instances!==true)
Expand All @@ -213,7 +213,7 @@ public function actionMine()
]);

$stream=\app\models\Stream::find()->select('stream.*,TS_AGO(ts) as ts_ago')
->where(['player_id'=>$teamPlayers])
->where(['stream.player_id'=>$teamPlayers])
->orderBy(['ts'=>SORT_DESC, 'id'=>SORT_DESC]);
$streamProvider=new ActiveDataProvider([
'query' => $stream,
Expand Down
2 changes: 2 additions & 0 deletions frontend/themes/material/layouts/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
<?php endif;/*END OF FLAG FORM*/?>
<ul class="navbar-nav">
<?php if(Yii::$app->user->isGuest):?>
<?php if(Yii::$app->sys->disable_registration!==true):?>
<li class="nav-item"><?=Html::a('<i class="fas fa-user-plus"></i> Signup', ['/register'], ['class'=>'nav-link','rel'=>'tooltip', 'title'=>"Sign up for an ".\Yii::$app->sys->{"event_name"}." account"])?></li>
<?php endif;?>
<li class="nav-item"><?=Html::a('<i class="fas fa-sign-in-alt"></i> Login', ['/site/login'], ['class'=>'nav-link','rel'=>"tooltip", 'title'=>"Login to your ".\Yii::$app->sys->{"event_name"}." account"])?></li>
<?php else: ?>
<li class="nav-item dropdown" id="Hints">
Expand Down
8 changes: 4 additions & 4 deletions frontend/themes/material/modules/help/views/default/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<h4 class="card-title"><b><?=Html::a(\Yii::t('app','Instructions'), ['/help/instruction/index'])?></b></h4>
<p class="card-text"><?=\Yii::t('app','Instructions on connecting and requesting assistance')?></p>
</div>
<div class="card-footer"><?=Html::a(\Yii::t('app',"Read the Instructions"), ['/help/instruction/index'],['class'=>'btn bg-primary text-dark card-link'])?></div>
<div class="card-footer"><?=Html::a(\Yii::t('app',"Read the Instructions"), ['/help/instruction/index'],['class'=>'btn bg-primary text-bold text-dark card-link'])?></div>
</div>
</div>
<?php endif;?>
Expand All @@ -32,7 +32,7 @@
<h4 class="card-title"><b><?=Html::a(\Yii::t('app','FAQ'), ['/help/faq/index'])?></b></h4>
<p class="card-text"><?=\Yii::t('app','Frequently Asked Questions about the platform and gameplay')?></p>
</div>
<div class="card-footer"><?=Html::a(\Yii::t('app',"Check out the FAQ"), ['/help/faq/index'],['class'=>'btn bg-primary text-dark card-link'])?></div>
<div class="card-footer"><?=Html::a(\Yii::t('app',"Check out the FAQ"), ['/help/faq/index'],['class'=>'btn bg-primary text-bold text-dark card-link'])?></div>
</div>
</div>
<?php endif;?>
Expand All @@ -44,7 +44,7 @@
<h4 class="card-title"><b><?=Html::a(\Yii::t('app','Rules'), ['/help/rule/index'])?></b></h4>
<p class="card-text"><?=\Yii::t('app','Instructions on connecting and getting help')?></p>
</div>
<div class="card-footer"><?=Html::a(\Yii::t('app',"Read the Rules"), ['/help/rule/index'],['class'=>'btn bg-primary text-dark card-link'])?></div>
<div class="card-footer"><?=Html::a(\Yii::t('app',"Read the Rules"), ['/help/rule/index'],['class'=>'btn bg-primary text-bold text-dark card-link'])?></div>
</div>
</div>
<?php endif;?>
Expand All @@ -56,7 +56,7 @@
<h4 class="card-title"><b><?=Html::a(\Yii::t('app','Experience Levels'), ['/help/experience/index'])?></b></h4>
<p class="card-text"><?=\Yii::t('app','List of the experience levels for the platform.')?></p>
</div>
<div class="card-footer"><?=Html::a(\Yii::t('app',"See the Experience Levels"), ['/help/experience/index'],['class'=>'btn bg-primary text-dark card-link'])?></div>
<div class="card-footer"><?=Html::a(\Yii::t('app',"See the Experience Levels"), ['/help/experience/index'],['class'=>'btn bg-primary text-bold text-dark card-link'])?></div>
</div>
</div>
<?php endif;?>
Expand Down
2 changes: 1 addition & 1 deletion frontend/themes/material/profile/_profile_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function(event){
<?php endif;?>
<?php if ($model->_cf('discord')):?>
<div class="col-lg-4">
<?=$form->field($model, 'discord',['errorOptions' => ['class'=>'text-danger text-bold','encode' => false]])->textInput(['maxlength' => true,'autocomplete'=>'off'])->input('text', ['placeholder' => "DiscordUsername#Number"])->Label('<i class="fab fa-discord"></i> Discord')->hint('Enter your discord user and number') ?>
<?=$form->field($model, 'discord',['errorOptions' => ['class'=>'text-danger text-bold','encode' => false]])->textInput(['maxlength' => true,'autocomplete'=>'off'])->input('text', ['placeholder' => "DiscordUsername"])->Label('<i class="fab fa-discord"></i> Discord')->hint('Enter your discord user and number') ?>
</div>
<?php endif;?>
<?php if ($model->_cf('twitter')):?>
Expand Down

0 comments on commit c3be968

Please sign in to comment.