public function actionManipulate($type, $module) { if ($type == 'enable') { ConfigurationModel::updateValue('module_enabled_' . $module, 1); } else { ConfigurationModel::updateValue('module_enabled_' . $module, 0); } $this->redirect(array('admin')); }
public function actionAdmin() { $model = new $this->modelName('search'); $model->resetScope(); $model->unsetAttributes(); // clear any default values if (isset($_GET[$this->modelName])) { $model->attributes = $_GET[$this->modelName]; } $model->deleteIpAfterDays = param('delete_ip_after_days'); if (isset($_POST[$this->modelName]) && isset($_POST[$this->modelName]['deleteIpAfterDays'])) { $model->scenario = 'upd_settings_day'; $model->attributes = $_POST[$this->modelName]; $model->setAttribute('deleteIpAfterDays', $_POST[$this->modelName]['deleteIpAfterDays']); if (!$model->deleteIpAfterDays) { $model->setAttribute('deleteIpAfterDays', 1); } if ($model->validate()) { ConfigurationModel::updateValue('delete_ip_after_days', $model->deleteIpAfterDays); Yii::app()->user->setFlash('success', tt('success_saved', 'service')); } } $this->render('admin', array_merge(array('model' => $model), $this->params)); }
public static function getModeListShow() { if (Yii::app()->theme->name == 'atlas') { $modeInState = 'block'; if (param('mode_list_show') != $modeInState) { Yii::app()->user->setState('mode_list_show', $modeInState); ConfigurationModel::updateValue('mode_list_show', $modeInState); Configuration::clearCache(); } return $modeInState; } $modeInState = Yii::app()->user->getState('mode_list_show'); $settingsMode = param('mode_list_show', 'block'); if ($modeInState == 'map' && !param('useGoogleMap', 0) && !param('useYandexMap', 0) && !param('useOSMMap', 0)) { $modeInState = 'block'; Yii::app()->user->setState('mode_list_show', $modeInState); ConfigurationModel::updateValue('mode_list_show', $modeInState); Configuration::clearCache(); } $modeInState = $modeInState ? $modeInState : $settingsMode; $modeInGet = Yii::app()->request->getParam('ls', $modeInState); if ($modeInGet != $modeInState) { Yii::app()->user->setState('mode_list_show', $modeInGet); $modeInState = $modeInGet; } return $modeInState; }
public function save() { // delete old watermark if (!$this->useWatermark || $this->useWatermark && $this->watermarkType == self::WATERMARK_FILE && $this->watermarkFile || $this->useWatermark && $this->watermarkType == self::WATERMARK_TEXT) { self::deleteWatermark(); } // save new from file if ($this->useWatermark && $this->watermarkFile) { $fileName = md5(file_get_contents($this->watermarkFile->tempName)) . '.' . $this->watermarkFile->extensionName; $this->watermarkFile->saveAs(Yii::getPathOfAlias('webroot.uploads') . DIRECTORY_SEPARATOR . $fileName); ConfigurationModel::updateValue('watermarkFile', $fileName); } else { ConfigurationModel::updateValue('watermarkFile', ''); } // generate new watermark from text - moved to Images class /*if($this->useWatermark && $this->watermarkType == self::WATERMARK_TEXT && $this->watermarkContent){ self::deleteWatermark(); ConfigurationModel::updateValue('watermarkFile', ''); }*/ foreach (self::$settings as $item) { if ($item != 'watermarkFile') { ConfigurationModel::updateValue($item, $this->{$item}); } } }