Skip to content

Commit

Permalink
Dev: Added TypeHints to GlobalSettings Controller
Browse files Browse the repository at this point in the history
  • Loading branch information
thedirtypanda committed Jul 14, 2021
1 parent bdba2d2 commit b1f358d
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions application/controllers/admin/globalsettings.php
Expand Up @@ -52,13 +52,19 @@ public function index()
$this->_displaySettings();
}

/**
* Show PHP Info
*/
public function showphpinfo()
{
if (!Yii::app()->getConfig('demoMode')) {
phpinfo();
}
}

/**
* Refresh Assets
*/
public function refreshAssets()
{
// Only people who can create or update themes should be allowed to refresh the assets
Expand Down Expand Up @@ -215,6 +221,9 @@ protected function getTemplateFolderStorage($uploaddir, $decimals)
return $templates;
}

/**
* Save Settings
*/
private function _saveSettings()
{
if (Yii::app()->getRequest()->getPost('action') !== "globalsettingssave") {
Expand Down Expand Up @@ -278,7 +287,7 @@ private function _saveSettings()
if (!Yii::app()->getConfig('demoMode')) {
$sTemplate = Yii::app()->getRequest()->getPost("defaulttheme");
if (array_key_exists($sTemplate, Template::getTemplateList())) {
// Filter template name
// Filter template name
SettingGlobal::setSetting('defaulttheme', $sTemplate);
}
SettingGlobal::setSetting('x_frame_options', Yii::app()->getRequest()->getPost('x_frame_options'));
Expand Down Expand Up @@ -398,6 +407,9 @@ private function _saveSettings()
}
}

/**
* Check Settings
*/
private function _checkSettings()
{
$surveycount = Survey::model()->count();
Expand Down Expand Up @@ -517,12 +529,18 @@ public function surveySettings()
$this->_renderWrappedTemplate('globalsettings', 'surveySettings', $aData);
}

/**
* Survey Setting Menues
*/
public function surveysettingmenues()
{
$menues = Surveymenu::model()->getMenuesForGlobalSettings();
Yii::app()->getController()->renderPartial('super/_renderJson', ['data' => $menues[0]]);
}

/**
* Send Test Email
*/
public function sendTestEmail()
{
$sSiteName = Yii::app()->getConfig('sitename');
Expand All @@ -540,6 +558,13 @@ public function sendTestEmail()
$this->_sendEmailAndShowResult($body, $sSubject, $sTo, $sFrom);
}

/**
* Send Email and show result
* @param string $body
* @param string $sSubject
* @param string $sTo
* @param string $sFrom
*/
private function _sendEmailAndShowResult($body, $sSubject, $sTo, $sFrom)
{
$mailer = new \LimeMailer();
Expand All @@ -566,6 +591,9 @@ private function _sendEmailAndShowResult($body, $sSubject, $sTo, $sFrom)
$this->_renderWrappedTemplate('globalsettings', '_emailTestResults', $data);
}

/**
* Send Test Email Confirmation
*/
public function sendTestEmailConfirmation()
{
$user = User::model()->findByPk(Yii::app()->session['loginID']);
Expand All @@ -585,9 +613,10 @@ public function sendTestEmailConfirmation()
/**
* Renders template(s) wrapped in header and footer
*
* @param string $sAction Current action, the folder to fetch views from
* @param string $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
* @param string $sAction Current action, the folder to fetch views from
* @param string $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
* @param bool $sRenderFile
*/
protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
Expand Down

0 comments on commit b1f358d

Please sign in to comment.