public function startup() { parent::startup(); $this->absoluteUrls = TRUE; $admin_config = ConfigAdapterIni::load(APP_DIR . '/config/admin.ini'); foreach ($admin_config['admin'] as $var => $value) { Environment::setVariable($var, $value); } Environment::setVariable('themesDir', 'themes'); $method = $this->getRequest()->getMethod(); if ($method == 'GET') { $data = $method = $this->getRequest()->getParams(); if (isset($data['rsd'])) { header('Content-Type: text/xml'); $this->view = 'rsd'; } elseif (isset($data['wlw'])) { header('Content-Type: text/xml'); $this->view = 'wlw'; } } else { if (!isset($HTTP_RAW_POST_DATA)) { $HTTP_RAW_POST_DATA = file_get_contents('php://input'); } $data = $HTTP_RAW_POST_DATA; file_put_contents('xmlrpc.txt', $data, FILE_APPEND); $this->formatCallbacks($this->methods); $server = new IXR_Server($this->methods, $data); } }
public function actionDefault() { if (Environment::getUser()->getIdentity()->role == 'super admin') { $this->config_data = ConfigAdapterIni::load(APP_DIR . '/config/admin.ini', 'admin'); $this->profile_data = $this->config_data['admin']; $this->mode = 'superadmin'; } $this->view = 'profile'; }
public function saveMetaData($form) { $values = $form->getValues(); $data = ConfigAdapterIni::load(APP_DIR . '/config/site.ini', 'site'); try { foreach ($values as $key => $value) { $data['key'] = $value; } $metaConfig = new Config(); $metaConfig->import($data); $metaConfig->save(APP_DIR . '/config/site.ini', 'site'); $this->flash('Metadata saved'); } catch (InvalidArgumentException $e) { $this->flash($e->getMessage); } }
* @package FrontModule */ class Front_BasePresenter extends Presenter { public $pathToTheme, $viewTemplatePath, $presenterTemplatePath; protected $themesDir = 'themes'; protected $data; /** @persistent */ public $lang; private $translator; public function startup() { parent::startup(); //$application = Environment::getApplication(); if (!isset($this->lang)) { $this->lang = $this->getHttpRequest()->detectLanguage(array('en', 'sk')); $this->canonicalize();
protected function refreshConfig() { $user = Environment::getUser(); $this->template->user = $user; if ($user->getIdentity() != null) { $this->template->user_data = $user->getIdentity()->getData(); } $this->template->setTranslator($this->translator); $this->template->website = Environment::getVariable('website'); $this->template->domain = 'http://' . Environment::getVariable('website'); $this->template->presenter = $this; $admin_config = ConfigAdapterIni::load(APP_DIR . '/config/admin.ini'); foreach ($admin_config['admin'] as $var => $value) { Environment::setVariable($var, $value); } Environment::setVariable('themesDir', 'themes'); }
public function get($content_type) { $appDir = Environment::getVariable('appDir'); $moduleDir = 'FrontModule'; $themesDir = Environment::getVariable('themesDir'); $data = ConfigAdapterIni::load(APP_DIR . '/config/site.ini', 'site'); $activeTheme = $data['theme']; $themesPath = $appDir . '/' . $moduleDir . '/' . $themesDir; $folder = $themesPath . '/' . $activeTheme . '/templates/Page/'; $templates = glob($folder . $content_type . '*'); $new_templates = array(); foreach ($templates as $index => $template) { $fn = basename($template); $fn = str_replace($content_type . '-', '', $fn); $fn = str_replace('.phtml', '', $fn); $new_templates[$fn] = $fn; } return $new_templates; }
public function handleActivateSiteTheme($theme) { $data = ConfigAdapterIni::load(APP_DIR . '/config/site.ini', 'site'); $data['theme'] = $theme; $themeConfig = new Config(); $themeConfig->import($data); $themeConfig->save(APP_DIR . '/config/site.ini', 'site'); $this->flash('Site theme ' . $theme . ' activated'); }