public function index() { $Config = App::getConfig(); $configData = array('config_data' => array('admin_panel_link' => __ADMINPANE__, 'ssl' => (string) (isset($Config['ssl']) && $Config['ssl'] == 1) ? 1 : 0), 'gallerysettings_data' => App::getModel('globalsettings')->getGallerySettings()); $settingsData = App::getModel('globalsettings')->getSettings(); $colour = $settingsData['gallerysettings_data']['colour']; unset($settingsData['gallerysettings_data']); $settingsData['gallerysettings_data']['colour'] = array('type' => 1, 'start' => $colour); $this->formModel->setPopulateData(array_merge_recursive($configData, $settingsData)); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $Data = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT); $Settings = $form->getSubmitValues(); Event::notify($this, 'admin.globalsettings.model.save', array('id' => 1, 'data' => $Data)); App::getModel('globalsettings')->updateGallerySettings($Data); App::getModel('globalsettings')->updateGlobalSettings($Settings['interface'], 'interface'); App::getModel('globalsettings')->updateGlobalSettings(array('colour' => $Settings['gallerysettings_data']['colour']['start']), 'gallerysettings_data'); Session::setActiveGlobalSettings(NULL); App::getModel('globalsettings')->configWriter($Data); if (__ADMINPANE__ != $Data['admin_panel_link']) { Session::flush(); App::redirect(''); } else { App::redirect(__ADMINPANE__ . '/globalsettings'); } } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } } $this->renderLayout(array('form' => $form->Render())); }
public function index() { if (App::getConfig('devmode') == 0) { App::redirect(__ADMINPANE__ . '/mainside'); } if ((int) $this->getParam() == 0) { $form = new FormEngine\Elements\Form(array('name' => 'exchange', 'action' => '', 'method' => 'post')); $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'type_pane', 'label' => _('TXT_EXCHANGE_TYPE_MIGRATION_SETTINGS')))); $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Podaj adres URL wtyczki integracyjnej.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'apiurl', 'label' => _('TXT_MIGRATION_API_URL')))); $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Podaj klucz jaki został ustawiony w pliku integracyjnym ($key)</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'apikey', 'label' => _('TXT_MIGRATION_API_KEY')))); $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Wybierz rodzaj importowanych danych.Sugerujemy import w następującej kolejności: <ul> <li>Zdjęcia</li> <li>Producenci</li> <li>Kategorie</li> <li>Wartości cech</li> <li>Produkty</li> </ul></p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'entity', 'label' => _('TXT_EXCHANGE_ENTITY'), 'options' => array(new FormEngine\Option(1, _('TXT_PRODUCTS')), new FormEngine\Option(2, _('TXT_CATEGORIES')), new FormEngine\Option(3, _('TXT_PRODUCERS')), new FormEngine\Option(4, _('TXT_PHOTOS')), new FormEngine\Option(5, _('TXT_ATTRIBUTES')), new FormEngine\Option(6, _('TXT_ORDERS')), new FormEngine\Option(7, _('TXT_SIMILARPRODUCT'))), 'default' => 1))); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); if ($form->Validate(FormEngine\FE::SubmittedData())) { $Data = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT); Session::setActiveMigrationData(json_encode($Data)); App::redirect(__ADMINPANE__ . '/migration/index/' . $Data['entity']); } $this->registry->template->assign('form', $form->Render()); $this->registry->xajax->processRequest(); $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript()); $this->registry->template->display($this->loadTemplate('index.tpl')); } else { if (Session::getActiveMigrationData() == NULL) { App::redirect(__ADMINPANE__ . '/migration/'); } $form = new FormEngine\Elements\Form(array('name' => 'add_migration', 'action' => '', 'method' => 'post')); $progress = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'progres_data', 'label' => 'Aktualizacja'))); $progress->AddChild(new FormEngine\Elements\ProgressIndicator(array('name' => 'progress', 'label' => 'Postęp migracji', 'chunks' => 1, 'load' => array(App::getModel('migration'), 'doLoadQueque'), 'process' => array(App::getModel('migration'), 'doProcessQueque'), 'success' => array(App::getModel('migration'), 'doSuccessQueque'), 'preventSubmit' => true))); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); $this->registry->template->assign('form', $form->Render()); $this->registry->xajax->processRequest(); $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript()); $this->registry->template->display($this->loadTemplate('index.tpl')); } }
public function __construct(array $settings) { $this->host = $settings['host']; $this->port = (int) $settings['port']; if (isset($settings['zlib_compression']) && $settings['zlib_compression'] == 1) { if (extension_loaded('zlib')) { $this->compression = MEMCACHE_COMPRESSED; } else { trigger_error('zlib module not loaded. Compression not set (memcache).', E_USER_WARNING); } } if (!@$this->pconnect($this->host, $this->port)) { throw new Exception('Can\'t connect to Memcached server. Sorry.'); } $prefix = \Gekosale\App::getConfig('database'); $this->prefix = !empty($settings['prefix']) ? $settings['prefix'] : $prefix['dbname']; }
public function __construct($registry) { $this->registry = $registry; $config = App::getConfig(); $this->isMemcache = isset($config['memcache']['active']) ? (bool) $config['memcache']['active'] : false; $this->__SESSION_HANDLER = ini_get('session.save_handler'); $this->__SESSION_LIFETIME = isset($config['session_gc_maxlifetime']) ? $config['session_gc_maxlifetime'] : ini_get('session.gc_maxlifetime'); if (!isset($_SESSION)) { if (isset($_POST[session_name()])) { session_id($_POST[session_name()]); } ini_set('session.save_handler', 'user'); session_set_save_handler(array(&$this, 'session_open'), array(&$this, 'session_close'), array(&$this, 'session_read'), array(&$this, 'session_write'), array(&$this, 'session_destroy'), array(&$this, 'session_gc')); register_shutdown_function("session_write_close"); @session_start(); $this->__SESSION_ID = session_id(); } }
public function configWriter($Data) { $Config = App::getConfig(); $ssl = isset($Data['ssl']) && $Data['ssl'] == 1 ? 1 : 0; $db = $Config['database']; $Config['admin_panel_link'] = addslashes($Data['admin_panel_link']); $Config['ssl'] = $ssl; $filename = ROOTPATH . 'config' . DS . 'settings.php'; $out = @fopen($filename, "w"); @fwrite($out, "<?php \r\n"); @fwrite($out, '/** * Gekosale, Open Source E-Commerce Solution * http://www.gekosale.pl * * Copyright (c) 2008-2012 Gekosale. Zabronione jest usuwanie informacji o licencji i autorach. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * */' . "\r\n"); fwrite($out, ' $Settings = Array(' . "\n\t\t\t'database'=> Array(\n\t\t\t\t'driver'=> '{$db['driver']}',\n\t\t\t\t'host'=> '{$db['host']}',\n\t\t\t\t'user'=> '{$db['user']}',\n\t\t\t\t'password'=> '{$db['password']}',\n\t\t\t\t'dbname'=> '{$db['dbname']}',\n\t\t\t),\n\t\t\t'admin_panel_link'=> '{$Config['admin_panel_link']}',\n\t\t\t'client_data_encription_string'=> '{$Config['client_data_encription_string']}',\n\t\t\t'ssl'=> {$Config['ssl']},\n\t\t);"); @fclose($out); }
public function setConfig() { $Array = App::getConfig('phpmailer'); try { $this->debugConfig($Array); } catch (Exception $e) { throw new Exception($e->getMessage()); } switch ($Array['Mailer']) { case 'mail': $this->IsMail(); $this->From = $Array['FromEmail']; break; case 'sendmail': $this->IsSendmail(); $this->From = $Array['FromEmail']; break; case 'smtp': $this->IsSMTP(); $this->Host = $Array['server']; $this->Port = $Array['port']; $this->SMTPSecure = $Array['SMTPSecure']; $this->SMTPAuth = $Array['SMTPAuth']; $this->From = $Array['FromEmail']; $this->Username = $Array['SMTPUsername']; $this->Password = $Array['SMTPPassword']; break; default: throw new Exception('Wrong e-mail sending method'); } $this->CharSet = $Array['CharSet']; $this->FromName = $Array['FromName']; $this->IsHTML(true); }