Пример #1
0
 public function actionSaveSort()
 {
     $objTypeId = Yii::app()->request->getParam('id', NULL);
     $sort = Yii::app()->request->getParam('sort');
     if (count($sort) >= param('searchMaxField', 15)) {
         HAjax::jsonError(tt('Search max field ') . param('searchMaxField', 3));
     }
     if ($objTypeId !== NULL && $sort && is_array($sort)) {
         $elements = SearchForm::getSearchFields();
         $sql = "DELETE FROM {{search_form}} WHERE obj_type_id=:id AND status!=:status";
         Yii::app()->db->createCommand($sql)->execute(array(':id' => $objTypeId, ':status' => SearchFormModel::STATUS_NOT_REMOVE));
         $i = 3;
         foreach ($sort as $field) {
             if (!isset($elements[$field])) {
                 continue;
             }
             $search = new SearchFormModel();
             $search->attributes = array('obj_type_id' => $objTypeId, 'field' => $field, 'status' => $elements[$field]['status'], 'sorter' => $i, 'formdesigner_id' => isset($elements[$field]['formdesigner_id']) ? $elements[$field]['formdesigner_id'] : 0);
             $search->save();
             $i++;
         }
         // delete assets js cache
         ConfigurationModel::clearGenerateJSAssets();
         HAjax::jsonOk();
     }
     HAjax::jsonError();
 }
Пример #2
0
 public function init()
 {
     $langs = Lang::getActiveLangs();
     $defaultLang = Lang::getDefaultLang();
     $this->isInstalled = oreInstall::isInstalled();
     $keyDefault = array_search($defaultLang, $langs);
     if ($keyDefault !== false && $this->isInstalled) {
         unset($langs[$keyDefault]);
     }
     //$countLangs = count($langs);
     $this->langRoute = '<lang:' . implode('|', $langs) . '>';
     $rules = array('sitemap.xml' => 'sitemap/main/viewxml', 'yandex_export_feed.xml' => 'yandexRealty/main/viewfeed', 'version' => '/site/version', 'site/uploadimage/' => 'site/uploadimage/', 'site/activation' => 'site/activation', 'min/serve/g/' => 'min/serve/', 'rss' => 'quicksearch/main/mainsearch/rss/1', '<module:\\w+>/backend/<controller:\\w+>/<action:\\w+>' => '<module>/backend/<controller>/<action>');
     $rulesLang = array('/' => 'site/index', '/login' => 'site/login', '/admin' => 'site/login', '/administrator' => 'site/login', '/register' => 'site/register', '/recover' => 'site/recover', '/logout' => 'site/logout', '/site/activation' => 'site/activation', '/sell' => 'quicksearch/main/mainsearch/type/2', '/rent' => 'quicksearch/main/mainsearch/type/1', '/site/uploadimage/' => 'site/uploadimage/', '/min/serve/g/' => 'min/serve/', '/news' => 'news/main/index', '/news/<id:\\d+>' => 'news/main/view', '/news/<url:[-a-zA-Z0-9_+\\.]{1,255}>' => 'news/main/view', '/blog' => 'blog/main/index', '/blog/<id:\\d+>' => 'blog/main/view', '/blog/<url:[-a-zA-Z0-9_+\\.]{1,255}>' => 'blog/main/view', '/faq' => 'articles/main/index', '/faq/<id:\\d+>' => 'articles/main/view', '/faq/<url:[-a-zA-Z0-9_+\\.]{1,255}>' => 'articles/main/view', '/contact-us' => 'contactform/main/index', '/specialoffers' => 'specialoffers/main/index', '/sitemap' => 'sitemap/main/index', '/reviews' => 'reviews/main/index', '/reviews/add' => 'reviews/main/add', '/vacancy' => 'vacancy/main/index', '/vacancy/add' => 'vacancy/main/add', '/guestad/add' => 'guestad/main/create', '/page/<id:\\d+>' => 'infopages/main/view', '/page/<url:[-a-zA-Z0-9_+\\.]{1,255}>' => 'infopages/main/view', '/search' => 'quicksearch/main/mainsearch', '/comparisonList' => 'comparisonList/main/index', '/complain/add' => 'apartmentsComplain/main/complain', '/booking/add' => 'booking/main/bookingform', '/booking/request' => 'booking/main/mainform', '/usercpanel' => 'usercpanel/main/index', '/usercpanel/data' => 'usercpanel/main/data', '/usercpanel/xmlfeed' => 'usercpanel/main/xmlfeed', '/usercpanel/changepwd' => 'usercpanel/main/changepassword', '/usercpanel/tariffplans' => 'tariffPlans/main/index', '/usercpanel/payments' => 'usercpanel/main/payments', '/usercpanel/balance' => 'usercpanel/main/balance', '/usercpanel/bookingtable' => 'bookingtable/main/index', '/userads/create' => 'userads/main/create', '/userads/edit' => 'userads/main/update', '/userads/delete' => 'userads/main/delete', '/users/viewall' => 'users/main/search', '/users/alllistings' => 'apartments/main/alllistings', '/apartments/sendEmail' => 'apartments/main/sendEmail', '/mailbox' => 'messages/main/index', '/mailbox/send' => 'messages/main/sendform', '/mailbox/read' => 'messages/main/read', '/mailbox/delete' => 'messages/main/delete', '/messages/downloadFile' => 'messages/main/downloadFile', '/service-<serviceId:\\d+>' => 'quicksearch/main/mainsearch', '/property/<id:\\d+>' => 'apartments/main/view', '/property/<url:[-a-zA-Z0-9_+\\.]{1,255}>' => 'apartments/main/view', '/<controller:(quicksearch|specialoffers)>/main/index' => '<controller>/main/index', '/<_m>/<_c>/<_a>*' => '<_m>/<_c>/<_a>', '/<_c>/<_a>*' => '<_c>/<_a>', '/<_c>' => '<_c>');
     foreach ($rulesLang as $key => $rule) {
         if ($langs && $this->langRoute) {
             $rules[$this->langRoute . $key] = $rule;
         }
         $rules[$key] = array($rule, 'defaultParams' => array('lang' => $defaultLang));
     }
     if ($langs && $this->langRoute) {
         $rules[$this->langRoute] = '';
     }
     $this->addRules($rules);
     if ($this->isInstalled) {
         $modules = Yii::app()->getModules();
         $paramModules = ConfigurationModel::getModulesList();
         foreach ($paramModules as $module) {
             if (isset($modules[$module]) && !param('module_enabled_' . $module)) {
                 $modules[$module]['enabled'] = false;
             }
         }
         Yii::app()->setModules($modules);
     }
     return parent::init();
 }
Пример #3
0
 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'));
 }
Пример #4
0
 private function loadConfig()
 {
     Yii::import('application.modules.configuration.models.ConfigurationModel');
     $model = Yii::app()->cache->get(self::$cacheName);
     if ($model === false) {
         $model = ConfigurationModel::model()->findAll();
         Yii::app()->cache->set(self::$cacheName, $model, $this->cachingTime);
     }
     foreach ($model as $key) {
         Yii::app()->params[$key->name] = $key->value;
     }
 }
Пример #5
0
 public function actionSetDefault()
 {
     if (demo()) {
         throw new CException(tc('Sorry, this action is not allowed on the demo server.'));
     }
     $id = (int) Yii::app()->request->getPost('id');
     $model = Themes::model()->findByPk($id);
     $model->setDefault();
     // delete assets js cache
     ConfigurationModel::clearGenerateJSAssets();
     Yii::app()->end();
 }
Пример #6
0
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $this->performAjaxValidation($model);
     if (isset($_POST[$this->modelName])) {
         $model->attributes = $_POST[$this->modelName];
         $model->scenario = 'save_types';
         if ($model->save()) {
             // delete assets js cache
             ConfigurationModel::clearGenerateJSAssets();
             $this->redirect(array('admin'));
         }
     }
     $this->render('_setup_form', array('model' => $model));
 }
Пример #7
0
 public function init()
 {
     $langs = Lang::getActiveLangs();
     $countLangs = count($langs);
     $langRoute = $countLangs > 1 || $countLangs == 1 && param('useLangPrefixIfOneLang') ? '<lang:' . implode('|', $langs) . '>' : '';
     $rules = array('sitemap.xml' => 'sitemap/main/viewxml', 'yandex_export_feed.xml' => 'yandexRealty/main/viewfeed', 'version' => '/site/version', 'sell' => 'quicksearch/main/mainsearch/type/2', 'rent' => 'quicksearch/main/mainsearch/type/1', 'site/uploadimage/' => 'site/uploadimage/', $langRoute . '/site/uploadimage/' => 'site/uploadimage/', 'min/serve/g/' => 'min/serve/', $langRoute . '/min/serve/g/' => 'min/serve/', '<module:\\w+>/backend/<controller:\\w+>/<action:\\w+>' => '<module>/backend/<controller>/<action>', $langRoute . '/property/<id:\\d+>' => 'apartments/main/view', $langRoute . '/property/<url:[-a-zA-Z0-9_+\\.]{1,255}>' => 'apartments/main/view', $langRoute . '/news' => 'news/main/index', $langRoute . '/news/<id:\\d+>' => 'news/main/view', $langRoute . '/news/<url:[-a-zA-Z0-9_+\\.]{1,255}>' => 'news/main/view', $langRoute . '/faq' => 'articles/main/index', $langRoute . '/faq/<id:\\d+>' => 'articles/main/view', $langRoute . '/faq/<url:[-a-zA-Z0-9_+\\.]{1,255}>' => 'articles/main/view', $langRoute . '/contact-us' => 'contactform/main/index', $langRoute . '/specialoffers' => 'specialoffers/main/index', $langRoute . '/sitemap' => 'sitemap/main/index', $langRoute . '/reviews' => 'reviews/main/index', $langRoute . '/reviews/add' => 'reviews/main/add', $langRoute . '/guestad/add' => 'guestad/main/create', $langRoute . '/page/<id:\\d+>' => 'infopages/main/view', $langRoute . '/page/<url:[-a-zA-Z0-9_+\\.]{1,255}>' => 'infopages/main/view', $langRoute . '/search' => 'quicksearch/main/mainsearch', $langRoute . '/comparisonList' => 'comparisonList/main/index', $langRoute . '/complain/add' => 'apartmentsComplain/main/complain', $langRoute . '/booking/add' => 'booking/main/bookingform', $langRoute . '/booking/request' => 'booking/main/mainform', $langRoute . '/usercpanel' => 'usercpanel/main/index', $langRoute . '/userads/create' => 'userads/main/create', $langRoute . '/userads/edit' => 'userads/main/update', $langRoute . '/userads/delete' => 'userads/main/delete', $langRoute . '/users/viewall' => 'users/main/search', $langRoute . '/users/alllistings' => 'apartments/main/alllistings', $langRoute . '/apartments/sendEmail' => 'apartments/main/sendEmail', '/rss' => 'quicksearch/main/mainsearch/rss/1', $langRoute . '/service-<serviceId:\\d+>' => 'quicksearch/main/mainsearch', $langRoute . '/<controller:(quicksearch|specialoffers)>/main/index' => '<controller>/main/index', $langRoute . '/' => 'site/index', $langRoute . '/<_m>/<_c>/<_a>*' => '<_m>/<_c>/<_a>', $langRoute . '/<_c>/<_a>*' => '<_c>/<_a>', $langRoute . '/<_c>' => '<_c>', '/property/' => 'quicksearch/main/mainsearch', $langRoute . '/property/' => 'quicksearch/main/mainsearch');
     if ($langRoute) {
         $rules[$langRoute] = '';
     }
     $this->addRules($rules);
     if (oreInstall::isInstalled()) {
         $modules = Yii::app()->getModules();
         $paramModules = ConfigurationModel::getModulesList();
         foreach ($paramModules as $module) {
             if (isset($modules[$module]) && !param('module_enabled_' . $module)) {
                 $modules[$module]['enabled'] = false;
             }
         }
         Yii::app()->setModules($modules);
     }
     return parent::init();
 }
Пример #8
0
 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));
 }
Пример #9
0
 public function actionActivate()
 {
     $id = intval(Yii::app()->request->getQuery('id', 0));
     if ($id) {
         $action = Yii::app()->request->getQuery('action');
         $model = $this->loadModel($id);
         if ($model) {
             if ($model->name == 'useTypeRent' || $model->name == 'useTypeSale' || $model->name == 'useTypeRenting' || $model->name == 'useTypeBuy' || $model->name == 'useTypeChange' || $model->name == 'useTypeMortgage' || $model->name == 'useTypePrivatisation') {
                 if (count(Apartment::availableApTypesIds()) == 1 && $action == 'deactivate') {
                     if (!Yii::app()->request->isAjaxRequest) {
                         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
                     }
                     Yii::app()->end;
                 }
             }
             $model->value = $action == 'activate' ? 1 : 0;
             $model->update(array('value'));
             if ($model->name == 'useGoogleMap' && $model->value == 1) {
                 $modelToggle = ConfigurationModel::model()->findAllByAttributes(array('name' => array('useYandexMap', 'useOSMMap')));
                 if ($modelToggle) {
                     foreach ($modelToggle as $mToggle) {
                         $mToggle->value = 0;
                         $mToggle->update(array('value'));
                     }
                 }
             }
             if ($model->name == 'useYandexMap' && $model->value == 1) {
                 $modelToggle = ConfigurationModel::model()->findAllByAttributes(array('name' => array('useGoogleMap', 'useOSMMap')));
                 if ($modelToggle) {
                     foreach ($modelToggle as $mToggle) {
                         $mToggle->value = 0;
                         $mToggle->update(array('value'));
                     }
                 }
             }
             if ($model->name == 'useOSMMap' && $model->value == 1) {
                 $modelToggle = ConfigurationModel::model()->findAllByAttributes(array('name' => array('useYandexMap', 'useGoogleMap')));
                 if ($modelToggle) {
                     foreach ($modelToggle as $mToggle) {
                         $mToggle->value = 0;
                         $mToggle->update(array('value'));
                     }
                 }
             }
         }
     }
     if (!Yii::app()->request->isAjaxRequest) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
 }
Пример #10
0
<?php

$this->pageTitle = Yii::app()->name . ' - ' . tc('Manage modules');
$this->breadcrumbs = array(tc('Modules'));
$this->menu = array(array());
$this->adminTitle = tc('Manage modules');
$freeModules = ConfigurationModel::getFreeModules();
$proModules = ConfigurationModel::getProModules();
$modules = CMap::mergeArray($freeModules, $proModules);
if ($modules) {
    foreach ($modules as $module) {
        $enabled = false;
        $isFree = true;
        if (param('module_enabled_' . $module)) {
            $type = 'success';
            $enabled = true;
        } else {
            $type = 'warning';
        }
        if (in_array($module, $proModules)) {
            $isFree = false;
        }
        if (!$isFree) {
            if (!issetModule($module, true)) {
                $type = 'danger';
                $enabled = false;
            }
        }
        echo '<div class="alert in alert-block fade alert-' . $type . '">';
        echo '<div class="row-fluid">';
        echo '<div class="span3">';
Пример #11
0
function issetModule($module, $raw = false)
{
    if (!oreInstall::isInstalled()) {
        $raw = true;
    }
    if (!$raw) {
        $modules = ConfigurationModel::getModulesList();
        if (in_array($module, $modules)) {
            if (!param('module_enabled_' . $module)) {
                return false;
            }
        }
    }
    if (is_array($module)) {
        foreach ($module as $module_name) {
            if (!isset(Yii::app()->modules[$module_name])) {
                return false;
            }
        }
        return true;
    }
    return isset(Yii::app()->modules[$module]);
}
Пример #12
0
 function init()
 {
     if (!oreInstall::isInstalled() && !(Yii::app()->controller->module && Yii::app()->controller->module->id == 'install')) {
         $this->redirect(array('/install'));
     }
     setLang();
     $modulesToCheck = ConfigurationModel::getModulesList();
     foreach ($modulesToCheck as $module) {
         if (param('module_enabled_' . $module) === null) {
             ConfigurationModel::createValue('module_enabled_' . $module, 0);
             Yii::app()->params['module_enabled_' . $module] = 0;
         }
     }
     unset($modulesToCheck);
     $this->assetsGenPath = Yii::getPathOfAlias('webroot.assets');
     $this->assetsGenUrl = Yii::app()->getBaseUrl(true) . '/assets/';
     Yii::app()->user->setState('menu_active', '');
     if (isFree()) {
         $this->pageTitle = param('siteTitle');
         $this->pageKeywords = param('siteKeywords');
         $this->pageDescription = param('siteDescription');
     } else {
         if (issetModule('seo')) {
             $this->pageTitle = Seo::getSeoValue('siteName');
             $this->pageKeywords = Seo::getSeoValue('siteKeywords');
             $this->pageDescription = Seo::getSeoValue('siteDescription');
         } else {
             $this->pageTitle = tt('siteName', 'seo');
             $this->pageKeywords = tt('siteKeywords', 'seo');
             $this->pageDescription = tt('siteDescription', 'seo');
         }
     }
     Yii::app()->name = $this->pageTitle;
     if (Yii::app()->getModule('menumanager')) {
         if (!(Yii::app()->controller->module && Yii::app()->controller->module->id == 'install')) {
             $this->infoPages = Menu::getMenuItems(0);
         }
     }
     if (!Yii::app()->user->isGuest && !Yii::app()->user->getState('isAdmin')) {
         $subItems = HUser::getMenu();
     } else {
         $subItems = array();
     }
     $urlAddAd = Yii::app()->user->isGuest && issetModule('guestad') ? array('/guestad/main/create') : array('/userads/main/create');
     $this->aData['userCpanelItems'] = array(array('label' => tt('Add ad', 'common'), 'url' => $urlAddAd, 'visible' => Yii::app()->user->isGuest == false), array('label' => '|', 'visible' => param('useUserads', 0) == 1), array('label' => tt('Special offers', 'common'), 'url' => array('/specialoffers/main/index')), array('label' => tt('Search for listings on the map', 'common'), 'url' => array('/page/2')), array('label' => tt('Contact us', 'common'), 'url' => array('/contactform/main/index')), array('label' => '|', 'visible' => Yii::app()->user->getState('isAdmin') === null), array('label' => tt('Reserve apartment', 'common'), 'url' => array('/booking/main/mainform'), 'visible' => Yii::app()->user->getState('isAdmin') === null, 'linkOptions' => array('class' => 'fancy')), array('label' => '|', 'visible' => Yii::app()->user->getState('isAdmin') === null), array('label' => Yii::t('common', 'Control panel'), 'url' => array('/usercpanel/main/index'), 'visible' => Yii::app()->user->getState('isAdmin') === null, 'items' => $subItems, 'submenuOptions' => array('class' => 'sub_menu_dropdown')));
     if (!Yii::app()->user->isGuest) {
         $user = HUser::getModel();
         $this->aData['userCpanelItems'][] = array('label' => '|');
         $this->aData['userCpanelItems'][] = array('label' => '(' . $user->username . ') ' . tt('Logout', 'common'), 'url' => array('/site/logout'));
     }
     $this->aData['topMenuItems'] = $this->infoPages;
     // comparison list
     if (issetModule('comparisonList')) {
         if (!Yii::app()->user->isGuest) {
             $resultCompare = ComparisonList::model()->findAllByAttributes(array('user_id' => Yii::app()->user->id));
         } else {
             $resultCompare = ComparisonList::model()->findAllByAttributes(array('session_id' => Yii::app()->session->sessionId));
         }
         if ($resultCompare) {
             foreach ($resultCompare as $item) {
                 $this->apInComparison[] = $item->apartment_id;
             }
         }
     }
     parent::init();
 }
Пример #13
0
 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 static function siteUnavailableView()
 {
     $configModel = new ConfigurationModel();
     (new UnavailableSiteView())->show($configModel->getConfiguration("disabledSiteMessage")["value"]);
 }
Пример #15
0
<?php

$this->pageTitle = Yii::app()->name . ' - ' . tc('Manage modules');
$this->breadcrumbs = array(tc('Modules'));
$this->menu = array(array());
$this->adminTitle = tc('Manage modules');
$proModules = ConfigurationModel::getProModules();
$freeModules = ConfigurationModel::getFreeModules();
$modules = CMap::mergeArray($proModules, $freeModules);
if ($modules) {
    foreach ($modules as $module) {
        $enabled = false;
        $isFree = true;
        if (param('module_enabled_' . $module)) {
            $type = 'success';
            $enabled = true;
        } else {
            $type = 'warning';
        }
        if (in_array($module, $proModules)) {
            $isFree = false;
        }
        if (!$isFree) {
            if (!issetModule($module, true)) {
                $type = 'danger';
                $enabled = false;
            }
        }
        echo '<div class="alert in alert-block fade alert-' . $type . '">';
        echo '<div class="row-fluid">';
        echo '<div class="span3">';
Пример #16
0
 /**
  * EmailModel constructor.
  * @param ConfigurationModel $config
  */
 public function __construct(ConfigurationModel $config)
 {
     $this->db = $config->getDb();
     $this->dbPostfix = $config->getDbPostfix();
     $this->config = $config;
 }
Пример #17
0
 /**
  * Sets up the sidebar
  *
  * @param bool $user_section Adjust sidebar to user section?
  */
 protected function setupSidebar($user_section = false)
 {
     // Basic info and layout
     $sidebar = Sidebar::Get();
     $sidebar->setTitle(_('Konfiguration'));
     $sidebar->setImage(Assets::image_path('sidebar/admin-sidebar.png'));
     // Views
     $views = new ViewsWidget();
     $views->addLink(_('Globale Konfiguration'), $this->url_for('admin/configuration/configuration'))->setActive(!$user_section);
     $views->addLink(_('Personenkonfiguration'), $this->url_for('admin/configuration/user_configuration'))->setActive($user_section);
     $sidebar->addWidget($views);
     // Add section selector when not in user mode
     if (!$user_section) {
         $options = array();
         foreach (ConfigurationModel::getConfig() as $key => $value) {
             $options[$key] = $key ?: '- ' . _('Ohne Kategorie') . ' -';
         }
         $widget = new SelectWidget(_('Anzeigefilter'), $this->url_for('admin/configuration/configuration'), 'section', 'get');
         $widget->addElement(new SelectElement(-1, _('alle anzeigen')));
         $widget->setOptions($options);
         $sidebar->addWidget($widget);
     }
     // Add specific searches (specific user when in user mode, keyword
     // otherwise)
     if ($user_section) {
         $search = new SearchWidget($this->url_for('admin/configuration/user_configuration'));
         $search->addNeedle(_('Person suchen'), 'user_id', true, new StandardSearch('user_id'), 'function () { $(this).closest("form").submit(); }');
     } else {
         $search = new SearchWidget($this->url_for('admin/configuration/configuration'));
         $search->addNeedle(_('Suchbegriff'), 'needle', true);
     }
     $sidebar->addWidget($search);
 }
Пример #18
0
 function init()
 {
     if (!oreInstall::isInstalled() && !(Yii::app()->controller->module && Yii::app()->controller->module->id == 'install')) {
         $this->redirect(array('/install'));
     }
     setLang();
     $modulesToCheck = ConfigurationModel::getModulesList();
     foreach ($modulesToCheck as $module) {
         if (param('module_enabled_' . $module) === null) {
             ConfigurationModel::createValue('module_enabled_' . $module, 0);
             Yii::app()->params['module_enabled_' . $module] = 0;
         }
     }
     unset($modulesToCheck);
     $this->assetsGenPath = Yii::getPathOfAlias('webroot.assets');
     $this->assetsGenUrl = Yii::app()->getBaseUrl(true) . '/assets/';
     Yii::app()->user->setState('menu_active', '');
     $this->pageTitle = tt('siteName', 'seo');
     $this->pageKeywords = tt('siteKeywords', 'seo');
     $this->pageDescription = tt('siteDescription', 'seo');
     Yii::app()->name = $this->pageTitle;
     $this->defaultTheme = Themes::getDefaultTheme();
     if (!$this->defaultTheme) {
         $this->defaultTheme = 'classic';
     }
     Yii::app()->theme = $this->defaultTheme;
     $this->baseUrl = Yii::app()->baseUrl;
     $this->baseThemeUrl = Yii::app()->theme->baseUrl;
     if (Yii::app()->getModule('menumanager')) {
         if (!(Yii::app()->controller->module && Yii::app()->controller->module->id == 'install')) {
             $this->infoPages = Menu::getMenuItems(true, 2);
         }
     }
     $subItems = array();
     if (!Yii::app()->user->isGuest) {
         $subItems = HUser::getMenu();
     }
     $this->aData['userCpanelItems'] = Menu::getMenuItems(true, 1);
     $this->aData['userCpanelItems'][] = array('label' => tt('Reserve apartment', 'common'), 'url' => array('/booking/main/mainform'), 'visible' => Yii::app()->user->checkAccess('backend_access') === false, 'linkOptions' => array('class' => 'fancy'), 'itemOptions' => array('class' => 'depth_zero'));
     $this->aData['userCpanelItems'][] = array('label' => Yii::t('common', 'Control panel'), 'url' => array('/usercpanel/main/index'), 'visible' => Yii::app()->user->checkAccess('backend_access') === false, 'items' => $subItems, 'itemOptions' => array('class' => 'depth_zero'), 'submenuOptions' => array('class' => 'sub_menu_dropdown'));
     if (!Yii::app()->user->isGuest) {
         $user = HUser::getModel();
         $this->aData['userCpanelItems'][] = array('label' => '(' . $user->username . ') ' . tt('Logout', 'common'), 'url' => array('/site/logout'), 'itemOptions' => array('class' => 'depth_zero'));
     }
     $this->aData['topMenuItems'] = $this->infoPages;
     // comparison list
     if (issetModule('comparisonList')) {
         if (!Yii::app()->user->isGuest) {
             $resultCompare = ComparisonList::model()->findAllByAttributes(array('user_id' => Yii::app()->user->id));
         } else {
             $resultCompare = ComparisonList::model()->findAllByAttributes(array('session_id' => Yii::app()->session->sessionId));
         }
         if ($resultCompare) {
             foreach ($resultCompare as $item) {
                 $this->apInComparison[] = $item->apartment_id;
             }
         }
     }
     $this->currentUserIp = Yii::app()->request->getUserHostAddress();
     $this->currentUserIpLong = ip2long($this->currentUserIp);
     $this->datePickerLang = Yii::app()->language;
     if ($this->datePickerLang == 'en') {
         $this->datePickerLang = 'en-GB';
     }
     if (demo()) {
         if (isset($_GET['theme']) && array_key_exists($_GET['theme'], Themes::getColorThemesList())) {
             $theme = $_GET['theme'];
             $cookie = new CHttpCookie('theme', $theme);
             $cookie->expire = time() + 86400;
             Yii::app()->request->cookies['theme'] = $cookie;
         }
     }
     parent::init();
 }
Пример #19
0
 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});
         }
     }
 }
 /**
  * Updates the Config and writes changes into db
  * @param ConfigurationModel $model
  */
 public function updateConfiguration(ConfigurationModel $model)
 {
     Configuration::updateValue('PIGMBH_PAYMILL_DEBIT', $model->getDirectdebit());
     Configuration::updateValue('PIGMBH_PAYMILL_CREDITCARD', $model->getCreditcard());
     Configuration::updateValue('PIGMBH_PAYMILL_PUBLICKEY', $model->getPublicKey());
     Configuration::updateValue('PIGMBH_PAYMILL_PRIVATEKEY', $model->getPrivateKey());
     Configuration::updateValue('PIGMBH_PAYMILL_DEBIT_DAYS', $model->getDebitDays());
     Configuration::updateValue('PIGMBH_PAYMILL_DEBUG', $model->getDebug());
     Configuration::updateValue('PIGMBH_PAYMILL_LOGGING', $model->getLogging());
     Configuration::updateValue('PIGMBH_PAYMILL_FASTCHECKOUT', $model->getFastcheckout());
     Configuration::updateValue('PIGMBH_PAYMILL_CAPTURE', $model->getCapture());
     Configuration::updateValue('PIGMBH_PAYMILL_ACCEPTED_BRANDS', Tools::jsonEncode($model->getAccpetedCreditCards()));
 }
Пример #21
0
 private function onConfigurationSave()
 {
     $old_config = $this->configuration_handler->loadConfiguration();
     $new_config = new ConfigurationModel();
     $accepted_brands = array();
     if (Tools::getValue('accepted_brands')) {
         foreach (Tools::getValue('accepted_brands') as $accepted_brand) {
             $accepted_brands[$accepted_brand] = true;
         }
     }
     $accepted_brands_result = array();
     foreach (array_keys($old_config->getAccpetedCreditCards()) as $key) {
         if (array_key_exists($key, $accepted_brands)) {
             $accepted_brands_result[$key] = true;
         } else {
             $accepted_brands_result[$key] = false;
         }
     }
     $new_config->setCreditcard(Tools::getValue('creditcard', 'OFF'));
     $new_config->setDirectdebit(Tools::getValue('debit', 'OFF'));
     $new_config->setDebug(Tools::getValue('debug', 'OFF'));
     $new_config->setFastcheckout(Tools::getValue('fastcheckout', 'OFF'));
     $new_config->setLogging(Tools::getValue('logging', 'OFF'));
     $new_config->setPrivateKey(trim(Tools::getValue('privatekey', $old_config->getPrivateKey())));
     $new_config->setPublicKey(trim(Tools::getValue('publickey', $old_config->getPublicKey())));
     $new_config->setAccpetedCreditCards($accepted_brands_result);
     $new_config->setDebitDays(Tools::getValue('debit_days', '7'));
     $new_config->setCapture(Tools::getValue('capture_option', 'OFF'));
     $this->configuration_handler->updateConfiguration($new_config);
     $this->registerPaymillWebhook($new_config->getPrivateKey());
 }
Пример #22
0
?>
</p>

    <input type="hidden" name="config_id" id="config_id" value="<?php 
echo $model->id;
?>
">
	<input type="hidden" id="config_required" value="<?php 
echo $required;
?>
">

    <?php 
echo '<div class="rowold">';
echo CHtml::activeLabel($model, 'value', array('required' => $required));
if ($model->type == 'enum' && ($list = ConfigurationModel::getEnumListForKey($model->name))) {
    echo $form->dropDownList($model, 'value', $list, array('class' => 'width450', 'id' => 'config_value'));
} else {
    echo $form->textArea($model, 'value', array('class' => 'width450', 'id' => 'config_value'));
}
echo $form->error($model, 'value');
echo '</div>';
?>

<?php 
if (!$ajax) {
    ?>
    <div class="rowold buttons">
           <?php 
    $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'icon' => 'ok white', 'label' => tc('Save')));
    ?>
Пример #23
0
 public function getLanguageId()
 {
     return $this->config->getLanguageId();
 }