Skip to content

Commit

Permalink
Merge pull request #1112 from proditis/fix-layoutoverrides
Browse files Browse the repository at this point in the history
Fix layout overrides
  • Loading branch information
proditis authored Feb 20, 2024
2 parents c3be968 + 587eca0 commit cf51fd5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 4 additions & 6 deletions frontend/components/echoCTFView.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ public function init()
$this->title=sprintf("%s", \Yii::$app->sys->event_name);
}

$this->registerJsOverrides();
$this->registerCssOverrides();

if($this->loadLayoutOverrides!==false)
$this->registerLayoutOverrides();
parent::init();

if(!\Yii::$app->user->isGuest && \Yii::$app->user->identity->sSL!==null && \Yii::$app->user->identity->sSL->expires)
\Yii::$app->getSession()->addFlash('warning', \Yii::t('app','Your VPN key is about to expire. Go to your profile and {revokeURL} it to get a new one.',['revokeURL'=>\yii\helpers\Html::a(\Yii::t('app','revoke it'),['/profile/revoke'],['class'=>'text-dark text-bold','data-method'=>'post'])]));
\Yii::$app->getSession()->addFlash('warning', \Yii::t('app','Your VPN key is about to expire. Go to your profile and {revokeURL} it to get a new one.',['revokeURL'=>\yii\helpers\Html::a(\Yii::t('app','revoke it'),['/profile/revoke'],['class'=>'text-dark text-bold','data-method'=>'post'])]));
}

public function getTwitterHandle()
Expand Down Expand Up @@ -212,6 +208,8 @@ public function registerCssOverrides()

public function registerLayoutOverrides()
{
if($this->loadLayoutOverrides!==true)
return;
$qcmd=\Yii::$app->db->createCommand("SELECT css,js FROM layout_override WHERE (player_id=:player_id or player_id IS NULL) AND ((NOW() BETWEEN valid_from AND valid_until) OR (repeating=1 AND NOW() BETWEEN DATE_FORMAT(valid_from,CONCAT(YEAR(NOW()),'-%m-%d')) AND DATE_FORMAT(valid_until,CONCAT(YEAR(NOW()),'-%m-%d'))))")->bindValue(':player_id',\Yii::$app->user->id,\PDO::PARAM_INT);
$records=$qcmd->queryAll();

Expand Down
3 changes: 3 additions & 0 deletions frontend/themes/material/layouts/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
$this->registerMetaTag($this->twitter_image, 'twitter_image');
$this->registerMetaTag($this->twitter_image_width, 'twitter_image_width');
$this->registerMetaTag($this->twitter_image_height, 'twitter_image_height');
$this->registerJsOverrides();
$this->registerCssOverrides();
$this->registerLayoutOverrides();
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
Expand Down

0 comments on commit cf51fd5

Please sign in to comment.