public function configSaveAction() { $type = $this->getRequest()->getFiltered('c'); if ($type == 'default') { $type = 'ip'; } $action = $this->getFiltered('a'); Am_Config::saveValue('ban.' . $type . '_action', $action); //echo $this->getJson(array('result' => 'ok', 'ban.'.$type.'_action' => $action)); $this->_redirect('admin-ban?c=' . $type); }
public function deleteRecord($id, $record) { $record = $this->getRecord($id); $fields = Am_Di::getInstance()->config->get($this->config_key); foreach ($fields as $k => $v) { if ($v['name'] == $record->name) { unset($fields[$k]); } } Am_Config::saveValue($this->config_key, $fields); Am_Di::getInstance()->config->set('member_fields', $fields); if ($record->sql) { $this->dropSqlField($record->name); } }
function indexAction() { $this->view->title = ___('Fix aMember Pro License Key'); $this->view->msg = Am_License::getInstance()->check(); $form = new Am_Form_Admin_FixLicense(); $form->setDataSources(array($this->getRequest(), $form->getDsDefaults())); if ($form->isSubmitted() && $form->validate()) { $vars = $form->getValue(); Am_Config::saveValue('license', $vars['license']); Am_Config::saveValue('root_url', $vars['root_url']); Am_Config::saveValue('root_surl', $vars['root_surl']); return $this->redirectLocation($this->getFullUrl()); } $this->view->form = $form; $this->view->display('admin/fixlicense.phtml'); }
/** * @todo ELIMINATE duplication source (Am_Form_Setup_Plugins) */ function stepAutoEnable() { foreach ($this->getSession()->upgrades as $upgrade) { if (empty($upgrade->auto_enable)) { continue; } $type = $upgrade->type; if ($type == 'module') { $type = 'modules'; } $pm = $this->getDi()->plugins[$type]; if (!$pm) { continue; } $configKey = $type == 'modules' ? 'modules' : 'plugins.' . $type; $enabled = (array) $this->getDi()->config->get($configKey, array()); if (!in_array($upgrade->id, $enabled)) { if ($pm->load($upgrade->id)) { $class = $pm->getPluginClassName($upgrade->id); try { call_user_func(array($class, 'activate'), $upgrade->id, $type); } catch (Exception $e) { $this->getDi()->errorLogTable->logException($e); trigger_error("Error during plugin [{$upgrade->id}] activation: " . get_class($e) . ": " . $e->getMessage(), E_USER_WARNING); continue; } /// $enabled[] = $upgrade->id; $list = Am_Config::saveValue($configKey, $enabled); if ($type == 'modules') { // to run upgrade db with new module $this->getDi()->config->set('modules', $enabled); } } } } return true; }
protected function removeRegion($regionId) { $regional_taxes = $this->getDi()->config->get('regional_taxes'); unset($regional_taxes[$regionId]); Am_Config::saveValue('regional_taxes', $regional_taxes); }
function fixLogoutRedirectSettings() { if (version_compare($this->db_version, '4.2.20') < 0) { if (!$this->getDi()->config->get('protect.php_include.redirect_logout') && $this->getDi()->config->get('protect.php_include.redirect')) { Am_Config::saveValue('protect.php_include.redirect_logout', 'url'); $this->getDi()->config->read(); } } }
/** * Return (generate if necessary) a constant, random site ID * @return string */ function getSiteKey() { static $key; if ($key) { return $key; } $config = $this->di->config; if ($key = $config->get('random-site-key')) { return $key; } $key = sha1(mt_rand() . @$_SERVER['REMOTE_ADDR'] . microtime(true)); Am_Config::saveValue('random-site-key', $key); $config->set('random-site-key', $key); return $key; }
function disableQuickstartAction() { Am_Config::saveValue('quickstart-disable', true); $this->getDi()->config->set('quickstart-disable', true); return $this->indexAction(); }