public function initView() { //init session $storage = new Zend_Auth_Storage_Session(); $this->session = $storage->read(); if ($this->session) { $this->_me = $this->session; $this->view->user = $this->_me; } $settingsModel = new Settings(); $offset = date('Z') / 60 / 60; $settingsModel->query("SET time_zone = '{$offset}:00'"); $this->view->currentRoute = Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName(); $siteSettingsModel = new SiteSettings(); $this->view->siteSettings = $siteSettingsModel->getById(1); $this->init(); }
public function settingsAction() { if ($this->_me->admin != 1) { $this->_redirect("/"); } $siteSettingsModel = new SiteSettings(); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); if ($siteSettingsModel->update($data, 1)) { $this->view->success = "Settings updated."; } } $this->view->settings = $siteSettingsModel->getById(1); }