public function indexAction() { $settings = new Model_Settings(); $this->view->maintenanceEnabled = $settings->isMaintenanceMode(); $authAttempts = new Users_Model_AuthAttempts(); $attempt = $authAttempts->get(); $this->view->useCaptcha = $attempt && $attempt->surpassedMaxAllowed(); $this->view->loginForm = new Users_Form_Login(null, $this->view->base, $this->view->useCaptcha); if ($this->_config->SSL->enable_mixed_mode) { if ($this->_config->subdomain->enabled) { // in this case $this->view->base contains the full URL, so we just gotta replace the protocol $this->view->loginTargetBase = 'https' . substr($this->view->base, strpos($this->view->base, '://')); } else { $this->view->loginTargetBase = 'https://' . $_SERVER['HTTP_HOST'] . $this->view->base; } } else { $this->view->loginTargetBase = $this->view->base; } $this->view->allowRegistrations = $this->_config->environment->registrations_enabled; if ($this->user->role == Users_Model_User::ROLE_GUEST && @$_COOKIE['image']) { $images = new Users_Model_SigninImages(); $this->view->image = $images->getByCookie($_COOKIE['image']); } else { $this->view->image = false; } $this->view->yubikey = $this->_config->yubikey; $this->_helper->viewRenderer->setResponseSegment('sidebar'); }
public function indexAction() { $request = $this->getRequest(); $store_config = Model_Settings::getSettingsPairs(); $config = $request->getPost('config'); if (isset($config['default_upload_method'])) { $this->view->default_upload_method = $config['default_upload_method']; } elseif (isset($store_config['default_upload_method'])) { $this->view->default_upload_method = $store_config['default_upload_method']; } else { $this->view->default_upload_method = 'locale'; } if (isset($config['rsUsername'])) { $this->view->rsUsername = $config['rsUsername']; } elseif (isset($store_config['rsUsername'])) { $this->view->rsUsername = $store_config['rsUsername']; } else { $this->view->rsUsername = ''; } if (isset($config['rsApiKey'])) { $this->view->rsApiKey = $config['rsApiKey']; } elseif (isset($store_config['rsApiKey'])) { $this->view->rsApiKey = $store_config['rsApiKey']; } else { $this->view->rsApiKey = ''; } }
public static function edit($id, $data) { $db = JO_Db::getDefaultAdapter(); if (isset($data['topbanner'])) { Model_Settings::updateAll(array('topbanner' => $data['topbanner'])); } return $db->update('topbanner', array('name' => $data['name'], 'url' => $data['url'], 'html' => $data['html'], 'background' => $data['background'], 'photo' => $data['photo'], 'from' => $data['from'] ? JO_Date::getInstance($data['from'], 'yy-mm-dd', true)->toString() : '0000-00-00', 'to' => $data['to'] ? JO_Date::getInstance($data['to'], 'yy-mm-dd', true)->toString() : '0000-00-00', 'close' => $data['close'], 'width' => (int) $data['width'], 'height' => (int) $data['height'], 'cookie' => (int) $data['cookie']), array('id = ?' => (int) $id)); }
private function authApplication() { if ($this->settings->getAuthType() === Methods_Method_Auth::TYPE_PUBLIC && $this->getAuthCode()) { return true; } $params = array('client_id' => $this->settings->app_id, 'client_secret' => $this->settings->app_secret, 'redirect_uri' => $this->settings->redirect_url, 'grant_type' => 'client_credentials'); $get_string = $this->paramsArrayToString($params); $url = 'https://api.vk.com/oauth/access_token?' . $get_string; $data = $this->transport->readJson($url); if (isset($data['access_token']) && !empty($data['access_token'])) { $this->settings->access_token = $data['access_token']; if (isset($data['user_id'])) { $this->user_id = $data['user_id']; } return true; } return false; }
private function getForm() { $request = $this->getRequest(); $language_id = $request->getQuery('id'); $model_language = new Model_Language(); if ($language_id) { $language_info = $model_language->getLanguage($language_id); } $countrycode = Model_Settings::getCountriesPairs(); $this->view->locale_territories = array(); $locale_territories = JO_Locale::listTerritory(); if ($locale_territories) { $sort_order = array(); foreach ($locale_territories as $iso2 => $lt) { if (isset($countrycode[$iso2])) { $sort_order[$lt] = $countrycode[$iso2]; $this->view->locale_territories[$lt] = array('code' => $lt, 'name' => $countrycode[$iso2]); } else { $sort_order[$lt] = $countrycode[$iso2]; $this->view->locale_territories[$lt] = array('code' => $lt, 'name' => $iso2); } } array_multisort($sort_order, SORT_ASC, $this->view->locale_territories); } $this->view->flags = $this->getFlags(); if ($request->getPost('name')) { $this->view->name = $request->getPost('name'); } elseif (isset($language_info)) { $this->view->name = $language_info['name']; } if ($request->getPost('code')) { $this->view->code = $request->getPost('code'); } elseif (isset($language_info)) { $this->view->code = $language_info['code']; } if ($request->getPost('locale')) { $this->view->locale = $request->getPost('locale'); } elseif (isset($language_info)) { $this->view->locale = $language_info['locale']; } if ($request->getPost('locale_territory')) { $this->view->locale_territory = $request->getPost('locale_territory'); } elseif (isset($language_info)) { $this->view->locale_territory = $language_info['locale_territory']; } if ($request->getPost('image')) { $this->view->image = $request->getPost('image'); } elseif (isset($language_info)) { $this->view->image = $language_info['image']; } if ($request->getPost('status')) { $this->view->status = $request->getPost('status'); } elseif (isset($language_info)) { $this->view->status = $language_info['status']; } }
public function index() { if ($this->registry["ui"]["admin"]) { $this->view->setTitle("Настройки почты"); $this->view->setLeftContent($this->view->render("left_settings", array())); $settings = new Model_Settings(); if (isset($_POST["submit"])) { $flag = true; if ($_POST["email"] == "") { $flag = false; } if ($_POST["server"] == "") { $flag = false; } if ($_POST["auth"] == "0") { $_POST["login"] = ""; $_POST["password"] = ""; } else { if ($_POST["login"] == "") { $flag = false; } if ($_POST["password"] == "") { $flag = false; } } if ($_POST["port"] == "") { $flag = false; } if ($_POST["ssl"] == "") { $flag = false; } if ($flag) { $settings->editMailbox($_POST); $this->view->refresh(array("timer" => "1", "url" => "settings/mail/")); } else { $this->view->settings_mail(array("err" => true, "post" => $_POST)); } } else { $mailboxes = $settings->getMailbox(); $this->view->settings_mail(array("post" => $mailboxes)); } } }
protected function getSettings() { try { $settings = \Model_Settings::select('item')->setMaxResults(1)->getQuery()->getResult(); if (count($settings) > 0) { return $settings[0]; } } catch (\Exception $e) { } return array(); }
public function action_get() { if ($_POST) { $val = \Validation::forge(); $val->add_field('el', 'element name', 'required|min_length[1]|max_length[20]'); if ($val->run()) { $settings = Model_Settings::find()->where('name', $val->validated('el'))->get_one(); echo json_encode(array('val' => $settings->value)); } } }
public function indexAction() { $request = $this->getRequest(); $store_config = Model_Settings::getSettingsPairs(); $config = $request->getPost('config'); $this->view->is_enable_s3 = JO_Registry::get('system_enable_amazon'); if (isset($config['default_upload_method'])) { $this->view->default_upload_method = $config['default_upload_method']; } elseif (isset($store_config['default_upload_method'])) { $this->view->default_upload_method = $store_config['default_upload_method']; } else { $this->view->default_upload_method = 'locale'; } }
public function indexAction() { if (!WM_Users::allow('edit', 'modules')) { JO_Session::set('error_permision', $this->translate('You do not have permission to this action')); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_oauth/'); } $request = $this->getRequest(); if (JO_Session::get('successfu_edite')) { $this->view->successfu_edite = true; JO_Session::clear('successfu_edite'); } if ($request->isPost()) { //validate app id $validate = new Helper_Modules_Facebook($request->getPost('facebook[facebook_oauth_key]'), $request->getPost('facebook[facebook_oauth_secret]')); if ($validate->checkValidAppId()) { Model_Settings::updateAll(array('facebook' => $request->getPost('facebook'))); JO_Session::set('successfu_edite', true); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_oauth_facebook/'); } else { $this->view->error = $this->translate('Invalid appID'); } } $this->view->modules_url = $this->getRequest()->getModule() . '/modules'; $this->view->modules_oauth_url = $this->getRequest()->getModule() . '/modules_oauth'; $methods = $this->getClassResources(); $this->view->methods = array(); $ignore = array('index', 'error404', 'install', 'uninstall'); foreach ($methods as $type => $mods) { foreach ($mods as $key => $value) { if (in_array($value, $ignore)) { continue; } if ($type == 'actions') { $this->view->methods[$type][] = array('title' => $this->translate($value), 'edit' => $this->getRequest()->getModule() . '/modules_oauth_facebook/' . strtolower($value)); } elseif ($type == 'radio') { $this->view->methods[$type][] = array('title' => $this->translate(str_replace('_', ' ', $value)), 'key' => 'facebook_' . strtolower($value)); } } } $store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'facebook')); foreach ($store_config as $key => $data) { if ($request->issetPost('facebook[' . $key . ']')) { $this->view->{$key} = $request->getPost('facebook[' . $key . ']'); } else { $this->view->{$key} = $data; } } }
public function action_set() { if ($_POST) { $val = \Validation::forge(); $val->add_field('el', 'element name', 'required|min_length[1]|max_length[20]'); $val->add_field('val', 'value', 'required|min_length[1]'); if ($val->run()) { $settings = Model_Settings::find()->where('name', $val->validated('el'))->where('meta_update_user', $this->user)->get_one(); if ($settings) { $settings->value = $val->validated('val'); $settings->save(); } } echo json_encode(array('status' => 'ok')); } }
private function parse_settings() { //when no user loged in, defualt background $a = array(array('name' => 'background', 'value' => '2'), array('name' => 'tutorials', 'value' => '0')); if (\Sentry::check()) { $a = array(); $user = \Sentry::user()->get('id'); $query = \Model_Settings::find()->where('meta_update_user', $user); $data = $query->get(); if ($query->count() == 0) { // user (demo) loged first time, make defualt settings $this->default_settings($user); $query = \Model_Settings::find()->where('meta_update_user', $user); $data = $query->get(); } foreach ($data as $s) { $m = array('name' => $s->name, 'value' => $s->value); array_push($a, $m); } /* $data=Model_Monitoring_Data::find()->where('meta_update_user',$user)->get_one(); $monitor=array( 'iconw'=>$data['iconw'], 'iconc'=>$data['iconc'], 'iconu'=>$data['iconu'], 'osdw'=>$data['osdw'], 'osdu'=>$data['osdu'], 'osdc'=>$data['osdc'], 'soundw'=>$data['soundw'], 'soundu'=>$data['soundu'], 'soundc'=>$data['soundc'] ); $m=array('name'=>'monitoring','value'=>$monitor); array_push($a, $m); } */ } return $a; }
private function parse_settings() { //when no user loged in, defualt background $a = array(array('name' => 'background', 'value' => '2'), array('name' => 'tutorials', 'value' => '0')); if (Sentry::check()) { $a = array(); $user = Sentry::user()->get('id'); $query = Model_Settings::find()->where('meta_update_user', $user); $data = $query->get(); if ($query->count() <= 1) { // user (demo) loged first time, make defualt settings $data = $this->default_settings($user); } foreach ($data as $s) { $m = array('name' => $s->name, 'value' => $s->value); array_push($a, $m); } } return $a; }
public function indexAction() { $request = $this->getRequest(); $store_config = Model_Settings::getSettingsPairs(); $config = $request->getPost('config'); if (isset($config['default_upload_method'])) { $this->view->default_upload_method = $config['default_upload_method']; } elseif (isset($store_config['default_upload_method'])) { $this->view->default_upload_method = $store_config['default_upload_method']; } else { $this->view->default_upload_method = 'Model_Upload_Locale'; } if (isset($config['awsAccessKey'])) { $this->view->awsAccessKey = $config['awsAccessKey']; } elseif (isset($store_config['awsAccessKey'])) { $this->view->awsAccessKey = $store_config['awsAccessKey']; } else { $this->view->awsAccessKey = ''; } if (isset($config['awsSecretKey'])) { $this->view->awsSecretKey = $config['awsSecretKey']; } elseif (isset($store_config['awsSecretKey'])) { $this->view->awsSecretKey = $store_config['awsSecretKey']; } else { $this->view->awsSecretKey = ''; } if (isset($config['bucklet'])) { $this->view->bucklet = $config['bucklet']; } elseif (isset($store_config['bucklet'])) { $this->view->bucklet = $store_config['bucklet']; } else { $this->view->bucklet = ''; } if (isset($config['awsDomain'])) { $this->view->awsDomain = $config['awsDomain']; } elseif (isset($store_config['awsDomain'])) { $this->view->awsDomain = $store_config['awsDomain']; } else { $this->view->awsDomain = ''; } }
public function indexAction() { $request = $this->getRequest(); if ($request->isPost()) { Model_Settings::updateAll($request->getParams()); $this->session->set('successfu_edite', true); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/payments/'); } $store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'paypal')); $confog = $request->getPost('paypal'); if (isset($confog['paypal_sandbox_mode'])) { $this->view->paypal_sandbox_mode = $confog['paypal_sandbox_mode']; } elseif (isset($store_config['paypal_sandbox_mode'])) { $this->view->paypal_sandbox_mode = $store_config['paypal_sandbox_mode']; } else { $this->view->paypal_sandbox_mode = 0; } if (isset($confog['paypal_status'])) { $this->view->paypal_status = $confog['paypal_status']; } elseif (isset($store_config['paypal_status'])) { $this->view->paypal_status = $store_config['paypal_status']; } else { $this->view->paypal_status = 0; } if (isset($confog['paypal_email'])) { $this->view->paypal_email = $confog['paypal_email']; } elseif (isset($store_config['paypal_email'])) { $this->view->paypal_email = $store_config['paypal_email']; } else { $this->view->paypal_email = ''; } if (isset($confog['paypal_sort_order'])) { $this->view->paypal_sort_order = $confog['paypal_sort_order']; } elseif (isset($store_config['paypal_sort_order'])) { $this->view->paypal_sort_order = $store_config['paypal_sort_order']; } else { $this->view->paypal_sort_order = 0; } if (isset($confog['paypal_pdt_token'])) { $this->view->paypal_pdt_token = $confog['paypal_pdt_token']; } elseif (isset($store_config['paypal_pdt_token'])) { $this->view->paypal_pdt_token = $store_config['paypal_pdt_token']; } else { $this->view->paypal_pdt_token = ''; } /**************** STATUSES ****************/ /*if(isset($confog['config_order_status_id'])) { $this->view->config_order_status_id = $confog['config_order_status_id']; } elseif(isset($store_config['config_order_status_id'])) { $this->view->config_order_status_id = $store_config['config_order_status_id']; } else { $this->view->config_order_status_id = ''; }*/ if (isset($confog['pp_standard_canceled_reversal_status_id'])) { $this->view->pp_standard_canceled_reversal_status_id = $confog['pp_standard_canceled_reversal_status_id']; } elseif (isset($store_config['pp_standard_canceled_reversal_status_id'])) { $this->view->pp_standard_canceled_reversal_status_id = $store_config['pp_standard_canceled_reversal_status_id']; } else { $this->view->pp_standard_canceled_reversal_status_id = ''; } if (isset($confog['pp_standard_completed_status_id'])) { $this->view->pp_standard_completed_status_id = $confog['pp_standard_completed_status_id']; } elseif (isset($store_config['pp_standard_completed_status_id'])) { $this->view->pp_standard_completed_status_id = $store_config['pp_standard_completed_status_id']; } else { $this->view->pp_standard_completed_status_id = ''; } if (isset($confog['pp_standard_denied_status_id'])) { $this->view->pp_standard_denied_status_id = $confog['pp_standard_denied_status_id']; } elseif (isset($store_config['pp_standard_denied_status_id'])) { $this->view->pp_standard_denied_status_id = $store_config['pp_standard_denied_status_id']; } else { $this->view->pp_standard_denied_status_id = ''; } if (isset($confog['pp_standard_expired_status_id'])) { $this->view->pp_standard_expired_status_id = $confog['pp_standard_expired_status_id']; } elseif (isset($store_config['pp_standard_expired_status_id'])) { $this->view->pp_standard_expired_status_id = $store_config['pp_standard_expired_status_id']; } else { $this->view->pp_standard_expired_status_id = ''; } if (isset($confog['pp_standard_failed_status_id'])) { $this->view->pp_standard_failed_status_id = $confog['pp_standard_failed_status_id']; } elseif (isset($store_config['pp_standard_failed_status_id'])) { $this->view->pp_standard_failed_status_id = $store_config['pp_standard_failed_status_id']; } else { $this->view->pp_standard_failed_status_id = ''; } if (isset($confog['pp_standard_pending_status_id'])) { $this->view->pp_standard_pending_status_id = $confog['pp_standard_pending_status_id']; } elseif (isset($store_config['pp_standard_pending_status_id'])) { $this->view->pp_standard_pending_status_id = $store_config['pp_standard_pending_status_id']; } else { $this->view->pp_standard_pending_status_id = ''; } if (isset($confog['pp_standard_processed_status_id'])) { $this->view->pp_standard_processed_status_id = $confog['pp_standard_processed_status_id']; } elseif (isset($store_config['pp_standard_processed_status_id'])) { $this->view->pp_standard_processed_status_id = $store_config['pp_standard_processed_status_id']; } else { $this->view->pp_standard_processed_status_id = ''; } if (isset($confog['pp_standard_refunded_status_id'])) { $this->view->pp_standard_refunded_status_id = $confog['pp_standard_refunded_status_id']; } elseif (isset($store_config['pp_standard_refunded_status_id'])) { $this->view->pp_standard_refunded_status_id = $store_config['pp_standard_refunded_status_id']; } else { $this->view->pp_standard_refunded_status_id = ''; } if (isset($confog['pp_standard_reversed_status_id'])) { $this->view->pp_standard_reversed_status_id = $confog['pp_standard_reversed_status_id']; } elseif (isset($store_config['pp_standard_reversed_status_id'])) { $this->view->pp_standard_reversed_status_id = $store_config['pp_standard_reversed_status_id']; } else { $this->view->pp_standard_reversed_status_id = ''; } if (isset($confog['pp_standard_voided_status_id'])) { $this->view->pp_standard_voided_status_id = $confog['pp_standard_voided_status_id']; } elseif (isset($store_config['pp_standard_voided_status_id'])) { $this->view->pp_standard_voided_status_id = $store_config['pp_standard_voided_status_id']; } else { $this->view->pp_standard_voided_status_id = ''; } $this->view->statuses = WM_Orderstatuses::orderStatuses(); /////// logo $image_model = new Helper_Images(); if (isset($confog['paypal_logo']) && $confog['paypal_logo']) { $this->view->paypal_logo = $confog['paypal_logo']; } elseif (isset($store_config['paypal_logo']) && $store_config['paypal_logo']) { $this->view->paypal_logo = $store_config['paypal_logo']; } else { $this->view->paypal_logo = ''; } if ($this->view->paypal_logo) { $this->view->preview_logo = $image_model->resize($this->view->paypal_logo, 100, 100); } else { $this->view->preview_logo = $image_model->resize(JO_Registry::forceGet('no_image'), 100, 100); } if (!$this->view->preview_logo) { $this->view->preview_logo = $image_model->resize(JO_Registry::forceGet('no_image'), 100, 100); } if (!$this->view->preview_logo) { $this->view->preview_logo = $image_model->resize('/no_image.png', 100, 100); } $this->view->preview = $image_model->resize(JO_Registry::forceGet('no_image'), 100, 100); if (!$this->view->preview) { $this->view->preview = $image_model->resize('/no_image.png', 100, 100); } }
/** * Retrieves a setting value from either the settings model or the main config file * @param string $setting_name * @param mixed $default_value If the setting isn't found * @return mixed */ public static function getSetting($setting_name, $default_value = null) { if (class_exists('Model_Settings')) { return \Model_Settings::getSetting($setting_name, $default_value); } return \Config::get($setting_name, $default_value); }
public function getForm() { $request = $this->getRequest(); $this->view->templates = $this->getTemplates(array('mobile')); $config = $request->getPost('config'); $images = $request->getPost('images'); $pages = $request->getPost('pages'); $store_config = Model_Settings::getSettingsPairs(); $this->view->pages = Model_Pages::getPagesFromParent(0); $this->view->pages_about = array(); $this->view->pages_about[] = array('title' => $this->translate('SEPARATOR MENU'), 'page_id' => -1); if ($this->view->pages) { foreach ($this->view->pages as $p) { $this->view->pages_about[] = array('title' => $p['title'], 'page_id' => $p['page_id']); } } $this->view->currencies = Model_Currency::getCurrencies(); $this->view->app_path = BASE_PATH; //////////////////////////////////////// GENERAL //////////////////////////////////////// if (isset($config['config_base_domain'])) { $this->view->config_base_domain = $config['config_base_domain']; } elseif (isset($store_config['config_base_domain'])) { $this->view->config_base_domain = $store_config['config_base_domain']; } else { $this->view->config_base_domain = $request->getBaseUrl(); } if (isset($config['config_on_facebook'])) { $this->view->config_on_facebook = $config['config_on_facebook']; } elseif (isset($store_config['config_on_facebook'])) { $this->view->config_on_facebook = $store_config['config_on_facebook']; } else { $this->view->config_on_facebook = ''; } if (isset($config['google_analytics'])) { $this->view->google_analytics = $config['google_analytics']; } elseif (isset($store_config['google_analytics'])) { $this->view->google_analytics = $store_config['google_analytics']; } if (isset($config['config_fix_image_thumb_editor'])) { $this->view->config_fix_image_thumb_editor = $config['config_fix_image_thumb_editor']; } elseif (isset($store_config['config_fix_image_thumb_editor'])) { $this->view->config_fix_image_thumb_editor = $store_config['config_fix_image_thumb_editor']; } if (isset($config['config_fix_external_urls'])) { $this->view->config_fix_external_urls = $config['config_fix_external_urls']; } elseif (isset($store_config['config_fix_external_urls'])) { $this->view->config_fix_external_urls = $store_config['config_fix_external_urls']; } //////////////////////////////////////// SEO //////////////////////////////////////// if (isset($config['site_name'])) { $this->view->site_name = $config['site_name']; } elseif (isset($store_config['site_name'])) { $this->view->site_name = $store_config['site_name']; } if (isset($config['meta_title'])) { $this->view->meta_title = $config['meta_title']; } elseif (isset($store_config['meta_title'])) { $this->view->meta_title = $store_config['meta_title']; } if (isset($config['meta_keywords'])) { $this->view->meta_keywords = $config['meta_keywords']; } elseif (isset($store_config['meta_keywords'])) { $this->view->meta_keywords = $store_config['meta_keywords']; } if (isset($config['meta_description'])) { $this->view->meta_description = $config['meta_description']; } elseif (isset($store_config['meta_description'])) { $this->view->meta_description = $store_config['meta_description']; } //////////////////////////////////////// Options //////////////////////////////////////// if (isset($config['config_admin_limit'])) { $this->view->config_admin_limit = $config['config_admin_limit']; } elseif (isset($store_config['config_admin_limit'])) { $this->view->config_admin_limit = $store_config['config_admin_limit']; } else { $this->view->config_admin_limit = 15; } if (isset($config['config_front_limit'])) { $this->view->config_front_limit = $config['config_front_limit']; } elseif (isset($store_config['config_front_limit'])) { $this->view->config_front_limit = $store_config['config_front_limit']; } else { $this->view->config_front_limit = 10; } if (isset($config['template'])) { $this->view->template = $config['template']; } elseif (isset($store_config['template'])) { $this->view->template = $store_config['template']; } if (isset($config['config_maintenance'])) { $this->view->config_maintenance = $config['config_maintenance']; } elseif (isset($store_config['config_maintenance'])) { $this->view->config_maintenance = $store_config['config_maintenance']; } else { $this->view->config_maintenance = 0; } if (isset($config['config_hide_brand'])) { $this->view->config_hide_brand = $config['config_hide_brand']; } elseif (isset($store_config['config_hide_brand'])) { $this->view->config_hide_brand = $store_config['config_hide_brand']; } else { $this->view->config_hide_brand = 0; } $this->view->data_timezones = JO_Date_Timezones::getTimezonse(); if (isset($config['phpSettings']['date.timezone'])) { $this->view->date_timezone = $config['phpSettings']['date.timezone']; } elseif (isset($store_config['phpSettings']['date.timezone'])) { $this->view->date_timezone = $store_config['phpSettings']['date.timezone']; } else { $this->view->date_timezone = 'UTC'; } if (isset($config['config_disable_js'])) { $this->view->config_disable_js = $config['config_disable_js']; } elseif (isset($store_config['config_disable_js'])) { $this->view->config_disable_js = $store_config['config_disable_js']; } else { $this->view->config_disable_js = 0; } if (isset($config['config_pin_prefix'])) { $this->view->config_pin_prefix = $config['config_pin_prefix']; } elseif (isset($store_config['config_pin_prefix'])) { $this->view->config_pin_prefix = $store_config['config_pin_prefix']; } else { $this->view->config_pin_prefix = 'pin'; } if (isset($config['config_user_view'])) { $this->view->config_user_view = $config['config_user_view']; } elseif (isset($store_config['config_user_view'])) { $this->view->config_user_view = $store_config['config_user_view']; } else { $this->view->config_user_view = 'fullname'; } if (isset($config['config_gallery_pin'])) { $this->view->config_gallery_pin = $config['config_gallery_pin']; } elseif (isset($store_config['config_gallery_pin'])) { $this->view->config_gallery_pin = $store_config['config_gallery_pin']; } else { $this->view->config_gallery_pin = 1; } if (isset($config['config_gallery_limit'])) { $this->view->config_gallery_limit = $config['config_gallery_limit']; } elseif (isset($store_config['config_gallery_limit'])) { $this->view->config_gallery_limit = $store_config['config_gallery_limit']; } else { $this->view->config_gallery_limit = 5; } if (isset($config['config_home_page_view_not_loged'])) { $this->view->config_home_page_view_not_loged = $config['config_home_page_view_not_loged']; } elseif (isset($store_config['config_home_page_view_not_loged'])) { $this->view->config_home_page_view_not_loged = $store_config['config_home_page_view_not_loged']; } else { $this->view->config_home_page_view_not_loged = 'randum'; } if (isset($config['config_home_page_view_loged'])) { $this->view->config_home_page_view_loged = $config['config_home_page_view_loged']; } elseif (isset($store_config['config_home_page_view_loged'])) { $this->view->config_home_page_view_loged = $store_config['config_home_page_view_loged']; } else { $this->view->config_home_page_view_loged = 'following'; } if (isset($config['config_image_minimum_size'])) { $this->view->config_image_minimum_size = $config['config_image_minimum_size']; } elseif (isset($store_config['config_image_minimum_size'])) { $this->view->config_image_minimum_size = $store_config['config_image_minimum_size']; } else { $this->view->config_image_minimum_size = 80; } /* v2.2 */ if (isset($config['config_enable_follow_private_profile'])) { $this->view->config_enable_follow_private_profile = $config['config_enable_follow_private_profile']; } elseif (isset($store_config['config_enable_follow_private_profile'])) { $this->view->config_enable_follow_private_profile = $store_config['config_enable_follow_private_profile']; } else { $this->view->config_enable_follow_private_profile = 0; } /* v2.2 */ //////////////////////////////////////// Storage //////////////////////////////////////// $this->view->upload_storage = array(); $this->view->upload_storage[] = array('key' => 'Model_Upload_Locale', 'active' => 'Model_Upload_Locale' == Helper_Config::get('file_upload_method'), 'name' => $this->translate('Locale')); /*$storage = (array)$this->view->callChildrenView('modules_storage'); if(isset($storage['modules']) && $storage['modules']) {*/ $storage_modules = $this->getUploadStorages(); if ($storage_modules) { foreach ($storage_modules as $mod) { if ($mod['is_installed']) { $key = 'Model_Upload_' . ucfirst(strtolower($mod['key'])); $this->view->upload_storage[] = array('key' => $key, 'active' => $key == Helper_Config::get('file_upload_method'), 'name' => $mod['name']); } } } if (isset($config['config_comments_list'])) { $this->view->config_comments_list = $config['config_comments_list']; } elseif (isset($store_config['config_comments_list'])) { $this->view->config_comments_list = $store_config['config_comments_list']; } else { $this->view->config_comments_list = 0; } /////////////////////////////// CURRENCY /////////////////////// $this->view->currencies = array(); $currencies = Model_Currency::getCurrencies(array('status' => 1)); //WM_Currency::getCurrencies(); if ($currencies) { $this->view->currencies = $currencies; } if (isset($config['config_currency'])) { $this->view->config_currency = $config['config_currency']; } elseif (isset($store_config['config_currency'])) { $this->view->config_currency = $store_config['config_currency']; } if (isset($config['config_currency_auto_update'])) { $this->view->config_currency_auto_update = $config['config_currency_auto_update']; } elseif (isset($store_config['config_currency_auto_update'])) { $this->view->config_currency_auto_update = $store_config['config_currency_auto_update']; } else { $this->view->config_currency_auto_update = 1; } if (isset($config['config_cache_live'])) { $this->view->config_cache_live = $config['config_cache_live']; } elseif (isset($store_config['config_cache_live'])) { $this->view->config_cache_live = $store_config['config_cache_live']; } else { $this->view->config_cache_live = 0; } if (isset($config['enable_free_registration'])) { $this->view->enable_free_registration = $config['enable_free_registration']; } elseif (isset($store_config['enable_free_registration'])) { $this->view->enable_free_registration = $store_config['enable_free_registration']; } else { $this->view->enable_free_registration = 0; } //////////////////////////////////////// Contacts //////////////////////////////////////// if (isset($config['admin_mail'])) { $this->view->admin_mail = $config['admin_mail']; } elseif (isset($store_config['admin_mail'])) { $this->view->admin_mail = $store_config['admin_mail']; } if (isset($config['report_mail'])) { $this->view->report_mail = $config['report_mail']; } elseif (isset($store_config['report_mail'])) { $this->view->report_mail = $store_config['report_mail']; } if (isset($config['noreply_mail'])) { $this->view->noreply_mail = $config['noreply_mail']; } elseif (isset($store_config['noreply_mail'])) { $this->view->noreply_mail = $store_config['noreply_mail']; } if (isset($config['mail_smtp'])) { $this->view->mail_smtp = $config['mail_smtp']; } elseif (isset($store_config['mail_smtp'])) { $this->view->mail_smtp = $store_config['mail_smtp']; } else { $this->view->mail_smtp = 0; } if (isset($config['mail_smtp_host'])) { $this->view->mail_smtp_host = $config['mail_smtp_host']; } elseif (isset($store_config['mail_smtp_host'])) { $this->view->mail_smtp_host = $store_config['mail_smtp_host']; } if (isset($config['mail_smtp_port'])) { $this->view->mail_smtp_port = $config['mail_smtp_port']; } elseif (isset($store_config['mail_smtp_port'])) { $this->view->mail_smtp_port = $store_config['mail_smtp_port']; } if (isset($config['mail_smtp_user'])) { $this->view->mail_smtp_user = $config['mail_smtp_user']; } elseif (isset($store_config['mail_smtp_user'])) { $this->view->mail_smtp_user = $store_config['mail_smtp_user']; } if (isset($config['mail_smtp_password'])) { $this->view->mail_smtp_password = $config['mail_smtp_password']; } elseif (isset($store_config['mail_smtp_password'])) { $this->view->mail_smtp_password = $store_config['mail_smtp_password']; } if (isset($config['mail_footer'])) { $this->view->mail_footer = $config['mail_footer']; } elseif (isset($store_config['mail_footer'])) { $this->view->mail_footer = $store_config['mail_footer']; } if (isset($config['not_rp'])) { $this->view->not_rp = $config['not_rp']; } elseif (isset($store_config['not_rp'])) { $this->view->not_rp = $store_config['not_rp']; } else { $this->view->not_rp = 0; } if (isset($config['not_rc'])) { $this->view->not_rc = $config['not_rc']; } elseif (isset($store_config['not_rc'])) { $this->view->not_rc = $store_config['not_rc']; } else { $this->view->not_rc = 0; } if (isset($config['not_ri'])) { $this->view->not_ri = $config['not_ri']; } elseif (isset($store_config['not_ri'])) { $this->view->not_ri = $store_config['not_ri']; } else { $this->view->not_ri = 0; } //////////////////////////////////////// Images //////////////////////////////////////// /////// logo $image_model = new Helper_Images(); if (isset($images['site_logo']) && $images['site_logo']) { $this->view->site_logo = $images['site_logo']; } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) { $this->view->site_logo = $store_config['site_logo']; } else { $this->view->site_logo = ''; } if ($this->view->site_logo) { $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100); } else { $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100); } if (!$this->view->preview_logo) { $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100); } $this->view->preview = $image_model->resize('/logo.png', 100, 100); ////mobile logo if (isset($images['site_logo_mobile']) && $images['site_logo_mobile']) { $this->view->site_logo_mobile = $images['site_logo_mobile']; } elseif (isset($store_config['site_logo_mobile']) && $store_config['site_logo_mobile']) { $this->view->site_logo_mobile = $store_config['site_logo_mobile']; } else { $this->view->site_logo_mobile = ''; } if ($this->view->site_logo_mobile) { $this->view->preview_logo_mobile = $image_model->resize($this->view->site_logo_mobile, 100, 100); } else { $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100); } if (!$this->view->preview_logo_mobile) { $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100); } $this->view->preview_mobile = $image_model->resize('/logo.png', 100, 100); ////// no image if (isset($images['no_image']) && $images['no_image']) { $this->view->no_image = $images['no_image']; } elseif (isset($store_config['no_image']) && $store_config['no_image']) { $this->view->no_image = $store_config['no_image']; } else { $this->view->no_image = '/no_image.png'; } if ($this->view->no_image) { $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100); } else { $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); } if (!$this->view->preview_no_image) { $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); } ////// no avatar if (isset($images['no_avatar']) && $images['no_avatar']) { $this->view->no_avatar = $images['no_avatar']; } elseif (isset($store_config['no_avatar']) && $store_config['no_avatar']) { $this->view->no_avatar = $store_config['no_avatar']; } else { $this->view->no_avatar = '/no-avatar.png'; } if ($this->view->no_avatar) { $this->view->preview_no_avatar = $image_model->resize($this->view->no_avatar, 100, 100); } else { $this->view->preview_no_avatar = $image_model->resize('/no-avatar.png', 100, 100); } if (!$this->view->preview_no_avatar) { $this->view->preview_no_avatar = $image_model->resize('/no_image.png', 100, 100); } ////// favicon if (isset($images['favicon']) && $images['favicon']) { $this->view->favicon = $images['favicon']; } elseif (isset($store_config['favicon']) && $store_config['favicon']) { $this->view->favicon = $store_config['favicon']; } else { $this->view->favicon = ''; } if ($this->view->favicon) { $this->view->preview_favicon = $image_model->resize($this->view->favicon, 100, 100); } else { $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100); } if (!$this->view->preview_favicon) { $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100); } // $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); //////////////////////////////////////// PAGES //////////////////////////////////////// if (isset($pages['about_menu'])) { $this->view->about_menu = $pages['about_menu']; } elseif (isset($store_config['about_menu'])) { $this->view->about_menu = $store_config['about_menu']; } else { $this->view->about_menu = array(); } if (isset($pages['page_login_trouble'])) { $this->view->page_login_trouble = $pages['page_login_trouble']; } elseif (isset($store_config['page_login_trouble'])) { $this->view->page_login_trouble = $store_config['page_login_trouble']; } else { $this->view->page_login_trouble = 0; } if (isset($pages['page_terms'])) { $this->view->page_terms = $pages['page_terms']; } elseif (isset($store_config['page_terms'])) { $this->view->page_terms = $store_config['page_terms']; } else { $this->view->page_terms = 0; } if (isset($pages['page_contact'])) { $this->view->page_contact = $pages['page_contact']; } elseif (isset($store_config['page_contact'])) { $this->view->page_contact = $store_config['page_contact']; } else { $this->view->page_contact = 0; } if (isset($pages['page_goodies'])) { $this->view->page_goodies = $pages['page_goodies']; } elseif (isset($store_config['page_goodies'])) { $this->view->page_goodies = $store_config['page_goodies']; } else { $this->view->page_goodies = 0; } if (isset($pages['delete_account'])) { $this->view->delete_account = $pages['delete_account']; } elseif (isset($store_config['delete_account'])) { $this->view->delete_account = $store_config['delete_account']; } else { $this->view->delete_account = 0; } if (isset($pages['support_page'])) { $this->view->support_page = $pages['support_page']; } elseif (isset($store_config['support_page'])) { $this->view->support_page = $store_config['support_page']; } else { $this->view->support_page = 0; } if (isset($pages['page_pinmarklet'])) { $this->view->page_pinmarklet = $pages['page_pinmarklet']; } elseif (isset($store_config['page_pinmarklet'])) { $this->view->page_pinmarklet = $store_config['page_pinmarklet']; } else { $this->view->page_pinmarklet = 0; } if (isset($pages['page_privacy_policy'])) { $this->view->page_privacy_policy = $pages['page_privacy_policy']; } elseif (isset($store_config['page_privacy_policy'])) { $this->view->page_privacy_policy = $store_config['page_privacy_policy']; } else { $this->view->page_privacy_policy = 0; } if (isset($pages['page_private_boards'])) { $this->view->page_private_boards = $pages['page_private_boards']; } elseif (isset($store_config['page_private_boards'])) { $this->view->page_private_boards = $store_config['page_private_boards']; } else { $this->view->page_private_boards = 0; } //////////////////////////////////////// DATES //////////////////////////////////////// $this->view->short_dates = array('dd.mm.yy', 'yy-mm-dd'); $this->view->medium_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy'); $this->view->long_dates = array('dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy'); $this->view->long_dates_times = array('dd MM yy H:i:s', 'D, d MM y H:i:s', 'DD, dd-MM-y H:i:s', 'D, d MM yy H:i:s'); $this->view->news_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy', 'dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy', 'dd MM yy | H:i', 'D, d MM y | H:i', 'DD, dd-MM-y | H:i', 'D, d MM yy | H:i', 'dd MM yy | H:i:s', 'D, d MM y | H:i:s', 'DD, dd-MM-y | H:i:s', 'D, d MM yy | H:i:s'); if (isset($config['config_date_format_short'])) { $this->view->config_date_format_short = $config['config_date_format_short']; } elseif (isset($store_config['config_date_format_short'])) { $this->view->config_date_format_short = $store_config['config_date_format_short']; } else { $this->view->config_date_format_short = 'dd.mm.yy'; } if (isset($config['config_date_format_medium'])) { $this->view->config_date_format_medium = $config['config_date_format_medium']; } elseif (isset($store_config['config_date_format_medium'])) { $this->view->config_date_format_medium = $store_config['config_date_format_medium']; } else { $this->view->config_date_format_medium = 'dd M yy'; } if (isset($config['config_date_format_long'])) { $this->view->config_date_format_long = $config['config_date_format_long']; } elseif (isset($store_config['config_date_format_long'])) { $this->view->config_date_format_long = $store_config['config_date_format_long']; } else { $this->view->config_date_format_long = 'dd MM yy'; } if (isset($config['config_date_format_news'])) { $this->view->config_date_format_news = $config['config_date_format_news']; } elseif (isset($store_config['config_date_format_news'])) { $this->view->config_date_format_news = $store_config['config_date_format_news']; } else { $this->view->config_date_format_news = 'dd MM yy | H:i'; } if (isset($config['config_date_format_long_time'])) { $this->view->config_date_format_long_time = $config['config_date_format_long_time']; } elseif (isset($store_config['config_date_format_long_time'])) { $this->view->config_date_format_long_time = $store_config['config_date_format_long_time']; } else { $this->view->config_date_format_long_time = 'dd MM yy H:i:s'; } //////////////////////////////////////// DATES //////////////////////////////////////// $this->view->categories = array(); $categories = Model_Categories::getCategories(array('filter_without_children' => true)); if ($categories) { foreach ($categories as $category) { $this->view->categories[] = $category; } } if (isset($config['config_board_description_enable'])) { $this->view->config_board_description_enable = $config['config_board_description_enable']; } elseif (isset($store_config['config_board_description_enable'])) { $this->view->config_board_description_enable = $store_config['config_board_description_enable']; } else { $this->view->config_board_description_enable = 0; } if (isset($config['config_private_boards'])) { $this->view->config_private_boards = $config['config_private_boards']; } elseif (isset($store_config['config_private_boards'])) { $this->view->config_private_boards = $store_config['config_private_boards']; } else { $this->view->config_private_boards = 0; } if (isset($config['default_category_id'])) { $this->view->default_category_id = $config['default_category_id']; } elseif (isset($store_config['default_category_id'])) { $this->view->default_category_id = $store_config['default_category_id']; } else { $this->view->default_category_id = 0; } if (isset($config['default_boards'])) { $this->view->default_boards = $config['default_boards']; } elseif (isset($store_config['default_boards'])) { $this->view->default_boards = $store_config['default_boards']; } else { $this->view->default_boards = array(); } }
function mailAction($mail) { $ttmail = new Model_TtMail(); $ttmail->uid = $this->uid; $settings = new Model_Settings(); $otms_mail = $settings->getMailbox(); $json = json_decode(base64_decode($mail["subject"])); if ($json->name == "OTMS" and isset($json->method)) { $this->emailTask = true; if ($otms_mail["email"] != $mail["mailbox"] . "@" . $mail["host"]) { if ($json->method == "addtask") { $this->textMailAction = "Новая задача(другая OTMS)"; foreach ($mail["body"] as $part) { $part = json_decode(base64_decode($part["text"]), true); $tid = $ttmail->addTask($json->tid, $part); } foreach ($mail["attach"] as $key => $part) { if ($part != "") { $sql = "INSERT INTO mail_attach (tid, md5, filename) VALUES (:tid, :md5, :filename)"; $res = $this->registry['db']->prepare($sql); $param = array(":tid" => $tid, ":md5" => $key, ":filename" => $part); $res->execute($param); } } } elseif ($json->method == "edittask") { $this->textMailAction = "Правка задачи(другая OTMS)"; foreach ($mail["body"] as $part) { $part = json_decode(base64_decode($part["text"]), true); $tid = $ttmail->editTask($json->tid, $part); } if (isset($mail["attach"]) and count($mail["attach"]) > 0) { $sql = "DELETE FROM mail_attach WHERE tid = :tid"; $res = $this->registry['db']->prepare($sql); $param = array(":mid" => $tid); $res->execute($param); } foreach ($mail["attach"] as $key => $part) { if ($part != "") { $sql = "INSERT INTO mail_attach (tid, md5, filename) VALUES (:tid, :md5, :filename)"; $res = $this->registry['db']->prepare($sql); $param = array(":tid" => $tid, ":md5" => $key, ":filename" => $part); $res->execute($param); } } } elseif ($json->method == "closetask") { $this->textMailAction = "Задача закрыта(другая OTMS)"; $ttmail->closeTask($json->tid); } elseif ($json->method == "comment") { $this->textMailAction = "Комментарий к задаче(другая OTMS)"; foreach ($mail["body"] as $part) { $part = json_decode(base64_decode($part["text"]), true); if ($json->rc) { $tdid = $ttmail->addCommentAnswer($json->tid, $part, $part["status"]); } else { $tdid = $ttmail->addComment($json->tid, $part, $part["status"]); } } foreach ($mail["attach"] as $key => $part) { if ($part != "") { $sql = "INSERT INTO mail_attach (tdid, md5, filename) VALUES (:tdid, :md5, :filename)"; $res = $this->registry['db']->prepare($sql); $param = array(":tdid" => $tdid, ":md5" => $key, ":filename" => $part); $res->execute($param); } } } } else { $this->notLog = false; } } }
public function uninstall() { $single_sign_on = Model_Settings::getSettingsPairs(array('filter_group' => 'singlesignon')); $single_sign_on['singlesignon_status'] = 0; Model_Settings::updateAll(array('singlesignon' => $single_sign_on)); }
public function clearFastmenu() { $settings = new Model_Settings(); $settings->clearFastmenu(); }
public function renderFastMenu() { $setting = new Model_Settings(); $sort = $setting->getFastmenu(); if (count($sort) == 0) { $json[0]["content"] = null; } if (!isset($sort) or count($sort) == 0) { $sort = array(); } $temp_fastmenu = $this->fastmenu; $this->fastmenu = array(); if (count($temp_fastmenu) > 0) { foreach ($sort as $part) { foreach ($temp_fastmenu as $key => $val) { if ($part == $key) { $this->fastmenu[] = $val; } } } foreach ($temp_fastmenu as $key => $val) { $flag = false; foreach ($sort as $part) { if ($part == $key) { $flag = true; } } if (!$flag) { $this->fastmenu[] = $val; } } } return implode(" ", $this->fastmenu); }
public function indexAction() { if (!WM_Users::allow('edit', 'modules')) { JO_Session::set('error_permision', $this->translate('You do not have permission to this action')); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_storage/'); } $request = $this->getRequest(); if (JO_Session::get('successfu_edite')) { $this->view->successfu_edite = true; JO_Session::clear('successfu_edite'); } if ($request->isPost()) { //validate app id $this->view->error = false; try { $s3 = new JO_Api_Amazon($request->getPost('amazons3[amazons3_access_key]'), $request->getPost('amazons3[amazons3_secret_key]')); //$s3->putBucket($request->getPost('amazons3[amazons3_bucklet]'), JO_Api_Amazon::ACL_PUBLIC_READ); $loged = $s3->getBucketLogging($request->getPost('amazons3[amazons3_bucklet]')); if ($loged) { $upload = $s3->putObjectString('test', $request->getPost('amazons3[amazons3_bucklet]'), 'test_upload.txt', JO_Api_Amazon::ACL_PUBLIC_READ); if (!$upload) { $this->view->error = sprintf($this->translate('Unable to upload to Bucklet "%s"'), $request->getPost('amazons3[amazons3_bucklet]')); $loged = false; } else { $is_file = @file_get_contents(trim($request->getPost('amazons3[amazons3_bucklet_location]'), '/') . '/test_upload.txt'); if ($is_file != 'test') { $this->view->error = sprintf($this->translate('Unable to read test file "%s"'), trim($request->getPost('amazons3[amazons3_bucklet_location]'), '/') . '/test_upload.txt'); $loged = false; } } } else { $this->view->error = sprintf($this->translate('Bucklet "%s" not found'), $request->getPost('amazons3[amazons3_bucklet]')); $loged = false; } } catch (JO_Exception $e) { $this->view->error = $e->getMessage(); $loged = false; } if ($loged) { Model_Settings::updateAll(array('amazons3' => $request->getPost('amazons3'))); JO_Session::set('successfu_edite', true); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_storage_amazons3/'); } else { if (!$this->view->error) { $this->view->error = $this->translate('Invalid App configuration'); } } } $this->view->modules_url = $this->getRequest()->getModule() . '/modules'; $this->view->modules_storage_url = $this->getRequest()->getModule() . '/modules_storage'; $store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'amazons3')); if (!isset($store_config['amazons3_access_key'])) { $store_config['amazons3_access_key'] = ''; } if (!isset($store_config['amazons3_secret_key'])) { $store_config['amazons3_secret_key'] = ''; } if (!isset($store_config['amazons3_bucklet'])) { $store_config['amazons3_bucklet'] = ''; } if (!isset($store_config['amazons3_bucklet_location'])) { $store_config['amazons3_bucklet_location'] = ''; } foreach ($store_config as $key => $data) { if ($request->issetPost('amazons3[' . $key . ']')) { $this->view->{$key} = $request->getPost('amazons3[' . $key . ']'); } else { $this->view->{$key} = $data; } } }
function phpmailer($_POST, $smtp = null, $fromName = null) { $settings = new Model_Settings($this->registry); if (isset($this->registry["module_mail"])) { $mailClass = $this->registry["module_mail"]; } if ($smtp == null) { $smtp = $settings->getMailbox(); } if ($fromName == null) { $fromName = $this->registry["mailSenderName"]; } $mailer = new Phpmailer_Phpmailer(); $err = array(); $mailer->SMTPDebug = 0; $mailer->CharSet = "utf-8"; $mailer->IsSMTP(); $mailer->Host = $smtp["server"]; $mailer->Port = $smtp["port"]; if ($smtp["ssl"] == "ssl") { $mailer->SMTPSecure = "ssl"; } if ($smtp["login"] and $smtp["password"]) { $mailer->SMTPAuth = true; $mailer->Username = $smtp["login"]; $mailer->Password = $smtp["password"]; } else { $mailer->SMTPAuth = false; } $mailer->From = $smtp["email"]; $mailer->FromName = $fromName; if ($_POST["to"] == null) { $err[] = "Не заданы адресаты"; } else { $to = explode(",", $_POST["to"]); for ($i = 0; $i < count($to); $i++) { $mailer->AddAddress($to[$i]); } } if (isset($_POST["attaches"])) { foreach ($_POST["attaches"] as $part) { $filename = mb_substr($part, mb_strrpos($part, DIRECTORY_SEPARATOR) + 1, mb_strlen($part) - mb_strrpos($part, DIRECTORY_SEPARATOR)); if (substr($part, 0, 1) != "/") { $dir = $this->registry["path"]["upload"]; $md5 = $mailClass->getAttachFileMD5($part); } else { if (isset($_POST["mail"]) and $_POST["mail"]) { $dir = $this->registry["path"]["attaches"]; $md5 = $mailClass->getFile($_POST["mail_id"], $filename); } else { $dir = $this->registry["path"]["upload"]; $md5 = $mailClass->getFileMD5($part); } } $mailer->AddAttachment($this->registry["rootPublic"] . $dir . $md5, $filename); } } if (!$this->text) { $mailer->IsHTML(true); $mailer->Subject = $_POST["subject"]; $mailer->Body = $_POST["textfield"]; $mailer->AltBody = strip_tags($_POST["textfield"]); } else { $mailer->IsHTML(false); $mailer->Subject = base64_encode($_POST["subject"]); $mailer->Body = base64_encode($_POST["textfield"]); } if ($_POST["textfield"] == null) { $err[] = "Пустое письмо"; } if (count($err) == 0) { if (!$mailer->Send()) { return $mailer->ErrorInfo; } else { return false; } } else { return $err; } }
/** * Gets an array copy of the site settings, if one exists */ protected function getSettings() { if (!class_exists('Model_Settings')) { return array(); } $result = \Model_Settings::select('item')->getQuery()->getArrayResult(); if (count($result)) { return $result[0]; } return array(); }
/** * Processes the value of this field before getting set to the model in the populate() method * @see \CMF\Model\Base::populate() * @param mixed $value The value about to be set * @param array $settings The settings for this field * @param object $model The model * @return mixed The value ready for setting on the model */ public static function process($value, $settings, $model) { if (!(isset($settings['auto_update']) && !$settings['auto_update']) && (isset($settings['template']) && !empty($settings['template']))) { $post_data = $context = \Input::post(); if (!is_array($context)) { $context = array(); } $context['model'] = $model; if (class_exists('Model_Settings')) { $context['settings'] = \Model_Settings::instance(); } $twig = \View_Twig::parser(); $loader = \View_Twig::loader(); if (!isset($loader) || is_null($loader)) { $loader = new Twig_Loader_String(); $twig->setLoader($loader); \View_Twig::setLoader($loader); } return $twig->render($settings['template'], $context); } return $value; }
public function getForm() { $request = $this->getRequest(); $this->view->templates = $this->getTemplates(array('mobile')); $config = $request->getPost('config'); $images = $request->getPost('images'); $pages = $request->getPost('pages'); $store_config = Model_Settings::getSettingsPairs(); $this->view->pages = Model_Pages::getPagesFromParent(0); $this->view->pages_about = array(); $this->view->pages_about[] = array('title' => $this->translate('SEPARATOR MENU'), 'page_id' => -1); if ($this->view->pages) { foreach ($this->view->pages as $p) { $this->view->pages_about[] = array('title' => $p['title'], 'page_id' => $p['page_id']); } } $this->view->currencies = Model_Currency::getCurrencies(); $this->view->app_path = BASE_PATH; //////////////////////////////////////// OAUTH //////////////////////////////////////// //facebook if (isset($config['oauth_fb_key'])) { $this->view->oauth_fb_key = $config['oauth_fb_key']; } elseif (isset($store_config['oauth_fb_key'])) { $this->view->oauth_fb_key = $store_config['oauth_fb_key']; } if (isset($config['oauth_fb_secret'])) { $this->view->oauth_fb_secret = $config['oauth_fb_secret']; } elseif (isset($store_config['oauth_fb_secret'])) { $this->view->oauth_fb_secret = $store_config['oauth_fb_secret']; } if (isset($config['og_namespace'])) { $this->view->og_namespace = $config['og_namespace']; } elseif (isset($store_config['og_namespace'])) { $this->view->og_namespace = $store_config['og_namespace']; } if (isset($config['og_recipe'])) { $this->view->og_recipe = $config['og_recipe']; } elseif (isset($store_config['og_recipe'])) { $this->view->og_recipe = $store_config['og_recipe']; } //twitter if (isset($config['oauth_tw_key'])) { $this->view->oauth_tw_key = $config['oauth_tw_key']; } elseif (isset($store_config['oauth_tw_key'])) { $this->view->oauth_tw_key = $store_config['oauth_tw_key']; } if (isset($config['oauth_tw_secret'])) { $this->view->oauth_tw_secret = $config['oauth_tw_secret']; } elseif (isset($store_config['oauth_tw_secret'])) { $this->view->oauth_tw_secret = $store_config['oauth_tw_secret']; } ///instagram if (isset($config['oauth_in_key'])) { $this->view->oauth_in_key = $config['oauth_in_key']; } elseif (isset($store_config['oauth_in_key'])) { $this->view->oauth_in_key = $store_config['oauth_in_key']; } if (isset($config['oauth_in_secret'])) { $this->view->oauth_in_secret = $config['oauth_in_secret']; } elseif (isset($store_config['oauth_in_secret'])) { $this->view->oauth_in_secret = $store_config['oauth_in_secret']; } //////////////////////////////////////// GENERAL //////////////////////////////////////// if (isset($config['config_base_domain'])) { $this->view->config_base_domain = $config['config_base_domain']; } elseif (isset($store_config['config_base_domain'])) { $this->view->config_base_domain = $store_config['config_base_domain']; } else { $this->view->config_base_domain = $request->getBaseUrl(); } if (isset($config['config_on_facebook'])) { $this->view->config_on_facebook = $config['config_on_facebook']; } elseif (isset($store_config['config_on_facebook'])) { $this->view->config_on_facebook = $store_config['config_on_facebook']; } else { $this->view->config_on_facebook = ''; } if (isset($config['google_analytics'])) { $this->view->google_analytics = $config['google_analytics']; } elseif (isset($store_config['google_analytics'])) { $this->view->google_analytics = $store_config['google_analytics']; } if (isset($config['config_fix_image_thumb_editor'])) { $this->view->config_fix_image_thumb_editor = $config['config_fix_image_thumb_editor']; } elseif (isset($store_config['config_fix_image_thumb_editor'])) { $this->view->config_fix_image_thumb_editor = $store_config['config_fix_image_thumb_editor']; } if (isset($config['config_fix_external_urls'])) { $this->view->config_fix_external_urls = $config['config_fix_external_urls']; } elseif (isset($store_config['config_fix_external_urls'])) { $this->view->config_fix_external_urls = $store_config['config_fix_external_urls']; } //////////////////////////////////////// SEO //////////////////////////////////////// if (isset($config['site_name'])) { $this->view->site_name = $config['site_name']; } elseif (isset($store_config['site_name'])) { $this->view->site_name = $store_config['site_name']; } if (isset($config['meta_title'])) { $this->view->meta_title = $config['meta_title']; } elseif (isset($store_config['meta_title'])) { $this->view->meta_title = $store_config['meta_title']; } if (isset($config['meta_keywords'])) { $this->view->meta_keywords = $config['meta_keywords']; } elseif (isset($store_config['meta_keywords'])) { $this->view->meta_keywords = $store_config['meta_keywords']; } if (isset($config['meta_description'])) { $this->view->meta_description = $config['meta_description']; } elseif (isset($store_config['meta_description'])) { $this->view->meta_description = $store_config['meta_description']; } //////////////////////////////////////// Options //////////////////////////////////////// if (isset($config['config_admin_limit'])) { $this->view->config_admin_limit = $config['config_admin_limit']; } elseif (isset($store_config['config_admin_limit'])) { $this->view->config_admin_limit = $store_config['config_admin_limit']; } else { $this->view->config_admin_limit = 15; } if (isset($config['config_front_limit'])) { $this->view->config_front_limit = $config['config_front_limit']; } elseif (isset($store_config['config_front_limit'])) { $this->view->config_front_limit = $store_config['config_front_limit']; } else { $this->view->config_front_limit = 10; } if (isset($config['template'])) { $this->view->template = $config['template']; } elseif (isset($store_config['template'])) { $this->view->template = $store_config['template']; } if (isset($config['config_maintenance'])) { $this->view->config_maintenance = $config['config_maintenance']; } elseif (isset($store_config['config_maintenance'])) { $this->view->config_maintenance = $store_config['config_maintenance']; } else { $this->view->config_maintenance = 0; } if (isset($config['config_hide_brand'])) { $this->view->config_hide_brand = $config['config_hide_brand']; } elseif (isset($store_config['config_hide_brand'])) { $this->view->config_hide_brand = $store_config['config_hide_brand']; } else { $this->view->config_hide_brand = 0; } $this->view->data_timezones = JO_Date_Timezones::getTimezonse(); if (isset($config['phpSettings']['date.timezone'])) { $this->view->date_timezone = $config['phpSettings']['date.timezone']; } elseif (isset($store_config['phpSettings']['date.timezone'])) { $this->view->date_timezone = $store_config['phpSettings']['date.timezone']; } else { $this->view->date_timezone = 'UTC'; } /////////////////////////////// CURRENCY /////////////////////// $this->view->currencies = array(); $currencies = Model_Currency::getCurrencies(array('status' => 1)); //WM_Currency::getCurrencies(); if ($currencies) { $this->view->currencies = $currencies; } if (isset($config['config_currency'])) { $this->view->config_currency = $config['config_currency']; } elseif (isset($store_config['config_currency'])) { $this->view->config_currency = $store_config['config_currency']; } if (isset($config['config_currency_auto_update'])) { $this->view->config_currency_auto_update = $config['config_currency_auto_update']; } elseif (isset($store_config['config_currency_auto_update'])) { $this->view->config_currency_auto_update = $store_config['config_currency_auto_update']; } else { $this->view->config_currency_auto_update = 1; } if (isset($config['config_cache_live'])) { $this->view->config_cache_live = $config['config_cache_live']; } elseif (isset($store_config['config_cache_live'])) { $this->view->config_cache_live = $store_config['config_cache_live']; } else { $this->view->config_cache_live = 0; } if (isset($config['enable_free_registration'])) { $this->view->enable_free_registration = $config['enable_free_registration']; } elseif (isset($store_config['enable_free_registration'])) { $this->view->enable_free_registration = $store_config['enable_free_registration']; } else { $this->view->enable_free_registration = 0; } //////////////////////////////////////// Contacts //////////////////////////////////////// if (isset($config['admin_mail'])) { $this->view->admin_mail = $config['admin_mail']; } elseif (isset($store_config['admin_mail'])) { $this->view->admin_mail = $store_config['admin_mail']; } if (isset($config['report_mail'])) { $this->view->report_mail = $config['report_mail']; } elseif (isset($store_config['report_mail'])) { $this->view->report_mail = $store_config['report_mail']; } if (isset($config['noreply_mail'])) { $this->view->noreply_mail = $config['noreply_mail']; } elseif (isset($store_config['noreply_mail'])) { $this->view->noreply_mail = $store_config['noreply_mail']; } if (isset($config['mail_smtp'])) { $this->view->mail_smtp = $config['mail_smtp']; } elseif (isset($store_config['mail_smtp'])) { $this->view->mail_smtp = $store_config['mail_smtp']; } else { $this->view->mail_smtp = 0; } if (isset($config['mail_smtp_host'])) { $this->view->mail_smtp_host = $config['mail_smtp_host']; } elseif (isset($store_config['mail_smtp_host'])) { $this->view->mail_smtp_host = $store_config['mail_smtp_host']; } if (isset($config['mail_smtp_port'])) { $this->view->mail_smtp_port = $config['mail_smtp_port']; } elseif (isset($store_config['mail_smtp_port'])) { $this->view->mail_smtp_port = $store_config['mail_smtp_port']; } if (isset($config['mail_smtp_user'])) { $this->view->mail_smtp_user = $config['mail_smtp_user']; } elseif (isset($store_config['mail_smtp_user'])) { $this->view->mail_smtp_user = $store_config['mail_smtp_user']; } if (isset($config['mail_smtp_password'])) { $this->view->mail_smtp_password = $config['mail_smtp_password']; } elseif (isset($store_config['mail_smtp_password'])) { $this->view->mail_smtp_password = $store_config['mail_smtp_password']; } if (isset($config['mail_footer'])) { $this->view->mail_footer = $config['mail_footer']; } elseif (isset($store_config['mail_footer'])) { $this->view->mail_footer = $store_config['mail_footer']; } if (isset($config['not_rp'])) { $this->view->not_rp = $config['not_rp']; } elseif (isset($store_config['not_rp'])) { $this->view->not_rp = $store_config['not_rp']; } else { $this->view->not_rp = 0; } if (isset($config['not_rc'])) { $this->view->not_rc = $config['not_rc']; } elseif (isset($store_config['not_rc'])) { $this->view->not_rc = $store_config['not_rc']; } else { $this->view->not_rc = 0; } if (isset($config['not_ri'])) { $this->view->not_ri = $config['not_ri']; } elseif (isset($store_config['not_ri'])) { $this->view->not_ri = $store_config['not_ri']; } else { $this->view->not_ri = 0; } //////////////////////////////////////// AMAZON //////////////////////////////////////// $uploads_methods = $this->uploadsMethods(); $this->view->uploads_methods = array(); foreach ($uploads_methods as $method) { $this->view->uploads_methods[] = $this->view->callChildren('upload_' . $method); } //////////////////////////////////////// Images //////////////////////////////////////// /////// logo $image_model = new Helper_Images(); if (isset($images['site_logo']) && $images['site_logo']) { $this->view->site_logo = $images['site_logo']; } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) { $this->view->site_logo = $store_config['site_logo']; } else { $this->view->site_logo = ''; } if ($this->view->site_logo) { $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100); } else { $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100); } if (!$this->view->preview_logo) { $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100); } $this->view->preview = $image_model->resize('/logo.png', 100, 100); ////mobile logo if (isset($images['site_logo_mobile']) && $images['site_logo_mobile']) { $this->view->site_logo_mobile = $images['site_logo_mobile']; } elseif (isset($store_config['site_logo_mobile']) && $store_config['site_logo_mobile']) { $this->view->site_logo_mobile = $store_config['site_logo_mobile']; } else { $this->view->site_logo_mobile = ''; } if ($this->view->site_logo_mobile) { $this->view->preview_logo_mobile = $image_model->resize($this->view->site_logo_mobile, 100, 100); } else { $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100); } if (!$this->view->preview_logo_mobile) { $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100); } $this->view->preview_mobile = $image_model->resize('/logo.png', 100, 100); ////// no image if (isset($images['no_image']) && $images['no_image']) { $this->view->no_image = $images['no_image']; } elseif (isset($store_config['no_image']) && $store_config['no_image']) { $this->view->no_image = $store_config['no_image']; } else { $this->view->no_image = '/no_image.png'; } if ($this->view->no_image) { $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100); } else { $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); } if (!$this->view->preview_no_image) { $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); } ////// no avatar if (isset($images['no_avatar']) && $images['no_avatar']) { $this->view->no_avatar = $images['no_avatar']; } elseif (isset($store_config['no_avatar']) && $store_config['no_avatar']) { $this->view->no_avatar = $store_config['no_avatar']; } else { $this->view->no_avatar = '/no-avatar.png'; } if ($this->view->no_avatar) { $this->view->preview_no_avatar = $image_model->resize($this->view->no_avatar, 100, 100); } else { $this->view->preview_no_avatar = $image_model->resize('/no-avatar.png', 100, 100); } if (!$this->view->preview_no_avatar) { $this->view->preview_no_avatar = $image_model->resize('/no_image.png', 100, 100); } ////// favicon if (isset($images['favicon']) && $images['favicon']) { $this->view->favicon = $images['favicon']; } elseif (isset($store_config['favicon']) && $store_config['favicon']) { $this->view->favicon = $store_config['favicon']; } else { $this->view->favicon = ''; } if ($this->view->favicon) { $this->view->preview_favicon = $image_model->resize($this->view->favicon, 100, 100); } else { $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100); } if (!$this->view->preview_favicon) { $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100); } // $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); //////////////////////////////////////// PAGES //////////////////////////////////////// if (isset($pages['about_menu'])) { $this->view->about_menu = $pages['about_menu']; } elseif (isset($store_config['about_menu'])) { $this->view->about_menu = $store_config['about_menu']; } else { $this->view->about_menu = array(); } if (isset($pages['page_login_trouble'])) { $this->view->page_login_trouble = $pages['page_login_trouble']; } elseif (isset($store_config['page_login_trouble'])) { $this->view->page_login_trouble = $store_config['page_login_trouble']; } else { $this->view->page_login_trouble = 0; } if (isset($pages['page_terms'])) { $this->view->page_terms = $pages['page_terms']; } elseif (isset($store_config['page_terms'])) { $this->view->page_terms = $store_config['page_terms']; } else { $this->view->page_terms = 0; } if (isset($pages['page_contact'])) { $this->view->page_contact = $pages['page_contact']; } elseif (isset($store_config['page_contact'])) { $this->view->page_contact = $store_config['page_contact']; } else { $this->view->page_contact = 0; } if (isset($pages['page_goodies'])) { $this->view->page_goodies = $pages['page_goodies']; } elseif (isset($store_config['page_goodies'])) { $this->view->page_goodies = $store_config['page_goodies']; } else { $this->view->page_goodies = 0; } if (isset($pages['delete_account'])) { $this->view->delete_account = $pages['delete_account']; } elseif (isset($store_config['delete_account'])) { $this->view->delete_account = $store_config['delete_account']; } else { $this->view->delete_account = 0; } if (isset($pages['support_page'])) { $this->view->support_page = $pages['support_page']; } elseif (isset($store_config['support_page'])) { $this->view->support_page = $store_config['support_page']; } else { $this->view->support_page = 0; } if (isset($pages['page_pinmarklet'])) { $this->view->page_pinmarklet = $pages['page_pinmarklet']; } elseif (isset($store_config['page_pinmarklet'])) { $this->view->page_pinmarklet = $store_config['page_pinmarklet']; } else { $this->view->page_pinmarklet = 0; } if (isset($pages['page_privacy_policy'])) { $this->view->page_privacy_policy = $pages['page_privacy_policy']; } elseif (isset($store_config['page_privacy_policy'])) { $this->view->page_privacy_policy = $store_config['page_privacy_policy']; } else { $this->view->page_privacy_policy = 0; } //////////////////////////////////////// DATES //////////////////////////////////////// $this->view->short_dates = array('dd.mm.yy', 'yy-mm-dd'); $this->view->medium_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy'); $this->view->long_dates = array('dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy'); $this->view->long_dates_times = array('dd MM yy H:i:s', 'D, d MM y H:i:s', 'DD, dd-MM-y H:i:s', 'D, d MM yy H:i:s'); $this->view->news_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy', 'dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy', 'dd MM yy | H:i', 'D, d MM y | H:i', 'DD, dd-MM-y | H:i', 'D, d MM yy | H:i', 'dd MM yy | H:i:s', 'D, d MM y | H:i:s', 'DD, dd-MM-y | H:i:s', 'D, d MM yy | H:i:s'); if (isset($config['config_date_format_short'])) { $this->view->config_date_format_short = $config['config_date_format_short']; } elseif (isset($store_config['config_date_format_short'])) { $this->view->config_date_format_short = $store_config['config_date_format_short']; } else { $this->view->config_date_format_short = 'dd.mm.yy'; } if (isset($config['config_date_format_medium'])) { $this->view->config_date_format_medium = $config['config_date_format_medium']; } elseif (isset($store_config['config_date_format_medium'])) { $this->view->config_date_format_medium = $store_config['config_date_format_medium']; } else { $this->view->config_date_format_medium = 'dd M yy'; } if (isset($config['config_date_format_long'])) { $this->view->config_date_format_long = $config['config_date_format_long']; } elseif (isset($store_config['config_date_format_long'])) { $this->view->config_date_format_long = $store_config['config_date_format_long']; } else { $this->view->config_date_format_long = 'dd MM yy'; } if (isset($config['config_date_format_news'])) { $this->view->config_date_format_news = $config['config_date_format_news']; } elseif (isset($store_config['config_date_format_news'])) { $this->view->config_date_format_news = $store_config['config_date_format_news']; } else { $this->view->config_date_format_news = 'dd MM yy | H:i'; } if (isset($config['config_date_format_long_time'])) { $this->view->config_date_format_long_time = $config['config_date_format_long_time']; } elseif (isset($store_config['config_date_format_long_time'])) { $this->view->config_date_format_long_time = $store_config['config_date_format_long_time']; } else { $this->view->config_date_format_long_time = 'dd MM yy H:i:s'; } //////////////////////////////////////// DATES //////////////////////////////////////// $this->view->categories = array(); $categories = Model_Categories::getCategories(array('filter_without_children' => true)); if ($categories) { foreach ($categories as $category) { $this->view->categories[] = $category; } } if (isset($config['default_category_id'])) { $this->view->default_category_id = $config['default_category_id']; } elseif (isset($store_config['default_category_id'])) { $this->view->default_category_id = $store_config['default_category_id']; } else { $this->view->default_category_id = 0; } if (isset($config['default_boards'])) { $this->view->default_boards = $config['default_boards']; } elseif (isset($store_config['default_boards'])) { $this->view->default_boards = $store_config['default_boards']; } else { $this->view->default_boards = array(); } }
public function indexAction() { if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } $request = $this->getRequest(); if ($request->isPost()) { $avatar_width = $request->getParam('user_avatar_width'); if ($avatar_width > 120) { $request->getParam('user_avatar_width', 120); } $avatar_height = $request->getParam('user_avatar_height'); if ($avatar_height > 120) { $request->getParam('user_avatar_height', 120); } Model_Settings::updateAll($request->getParams()); $config = $request->getPost('config'); if (isset($config['config_currency_auto_update']) && $config['config_currency_auto_update'] == 1) { WM_Currency::updateCurrencies($config['config_currency']); } $this->session->set('successfu_edite', true); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/'); } $this->view->templates = $this->getTemplates(); $this->view->modules = WM_Modules::getList(array('update', 'install', 'admin')); $image_setings_get = WM_Modules::getConfig(); $image_setings = array(); $watermark_setings = array(); $domains_setings = array(); foreach ($image_setings_get as $module_get => $ims) { $image_setings[$module_get] = isset($ims['images']) && is_array($ims['images']) ? $ims['images'] : array(); $watermark_setings[$module_get] = isset($ims['watermark']) && is_array($ims['watermark']) ? $ims['watermark'] : array(); $domains_setings[$module_get] = isset($ims['domain']) && is_array($ims['domain']) ? $ims['domain'] : array(); } $config = $request->getPost('config'); $images = $request->getPost('images'); $pages = $request->getPost('pages'); $store_config = Model_Settings::getSettingsPairs(); $this->view->currencies = Model_Currency::getCurrencies(); $this->view->pages = Model_Pages::getPagesFromParent(0); $this->view->languages = array(); $languages = Model_Language::getLanguages(); if ($languages) { $this->view->languages = $languages; } //////////////////////////////////////// GENERAL //////////////////////////////////////// if (isset($config['referal_sum'])) { $this->view->referal_sum = $config['referal_sum']; } elseif (isset($store_config['referal_sum'])) { $this->view->referal_sum = $store_config['referal_sum']; } else { $this->view->referal_sum = 0; } if (isset($config['referal_percent'])) { $this->view->referal_percent = str_replace('%', '', $config['referal_percent']) . '%'; } elseif (isset($store_config['referal_percent'])) { $this->view->referal_percent = str_replace('%', '', $store_config['referal_percent']) . '%'; } else { $this->view->referal_percent = 0; } if (isset($config['prepaid_price_discount'])) { $this->view->prepaid_price_discount = $config['prepaid_price_discount']; } elseif (isset($store_config['prepaid_price_discount'])) { $this->view->prepaid_price_discount = $store_config['prepaid_price_discount']; } else { $this->view->prepaid_price_discount = 0; } if (isset($config['extended_price'])) { $this->view->extended_price = $config['extended_price']; } elseif (isset($store_config['extended_price'])) { $this->view->extended_price = $store_config['extended_price']; } else { $this->view->extended_price = 0; } if (isset($config['no_exclusive_author_percent'])) { $this->view->no_exclusive_author_percent = $config['no_exclusive_author_percent']; } elseif (isset($store_config['no_exclusive_author_percent'])) { $this->view->no_exclusive_author_percent = $store_config['no_exclusive_author_percent']; } else { $this->view->no_exclusive_author_percent = 0; } if (isset($config['exclusive_author_percent'])) { $this->view->exclusive_author_percent = $config['exclusive_author_percent']; } elseif (isset($store_config['exclusive_author_percent'])) { $this->view->exclusive_author_percent = $store_config['exclusive_author_percent']; } else { $this->view->exclusive_author_percent = 0; } if (isset($config['facebook_appid'])) { $this->view->facebook_appid = $config['facebook_appid']; } elseif (isset($store_config['facebook_appid'])) { $this->view->facebook_appid = $store_config['facebook_appid']; } else { $this->view->facebook_appid = ''; } if (isset($config['facebook_secret'])) { $this->view->facebook_secret = $config['facebook_secret']; } elseif (isset($store_config['facebook_secret'])) { $this->view->facebook_secret = $store_config['facebook_secret']; } else { $this->view->facebook_secret = ''; } if (isset($config['recaptcha_public_key'])) { $this->view->recaptcha_public_key = $config['recaptcha_public_key']; } elseif (isset($store_config['recaptcha_public_key'])) { $this->view->recaptcha_public_key = $store_config['recaptcha_public_key']; } else { $this->view->recaptcha_public_key = 0; } if (isset($config['recaptcha_private_key'])) { $this->view->recaptcha_private_key = $config['recaptcha_private_key']; } elseif (isset($store_config['recaptcha_private_key'])) { $this->view->recaptcha_private_key = $store_config['recaptcha_private_key']; } else { $this->view->recaptcha_private_key = 0; } if (isset($config['google_translate_key'])) { $this->view->google_translate_key = $config['google_translate_key']; } elseif (isset($store_config['google_translate_key'])) { $this->view->google_translate_key = $store_config['google_translate_key']; } else { $this->view->google_translate_key = ''; } //////////////////////////////////////// SEO //////////////////////////////////////// if (isset($config['meta_title'])) { $this->view->meta_title = $config['meta_title']; } elseif (isset($store_config['meta_title'])) { $this->view->meta_title = $store_config['meta_title']; } if (isset($config['meta_keywords'])) { $this->view->meta_keywords = $config['meta_keywords']; } elseif (isset($store_config['meta_keywords'])) { $this->view->meta_keywords = $store_config['meta_keywords']; } if (isset($config['meta_description'])) { $this->view->meta_description = $config['meta_description']; } elseif (isset($store_config['meta_description'])) { $this->view->meta_description = $store_config['meta_description']; } if (isset($config['google_analytics'])) { $this->view->google_analytics = $config['google_analytics']; } elseif (isset($store_config['google_analytics'])) { $this->view->google_analytics = $store_config['google_analytics']; } //////////////////////////////////////// Options //////////////////////////////////////// if (isset($config['admin_limit'])) { $this->view->admin_limit = $config['admin_limit']; } elseif (isset($store_config['admin_limit'])) { $this->view->admin_limit = $store_config['admin_limit']; } else { $this->view->admin_limit = 15; } if (isset($config['front_limit'])) { $this->view->front_limit = $config['front_limit']; } elseif (isset($store_config['front_limit'])) { $this->view->front_limit = $store_config['front_limit']; } else { $this->view->front_limit = 10; } if (isset($config['template'])) { $this->view->template = $config['template']; } elseif (isset($store_config['template'])) { $this->view->template = $store_config['template']; } if (isset($config['default_module'])) { $this->view->default_module = $config['default_module']; } elseif (isset($store_config['default_module'])) { $this->view->default_module = $store_config['default_module']; } if (isset($config['currency_position'])) { $this->view->currency_position = $config['currency_position']; } elseif (isset($store_config['currency_position'])) { $this->view->currency_position = $store_config['currency_position']; } else { $this->view->currency_position = 'left'; } if (isset($config['currency_decimal_places'])) { $this->view->currency_decimal_places = $config['currency_decimal_places']; } elseif (isset($store_config['currency_decimal_places'])) { $this->view->currency_decimal_places = $store_config['currency_decimal_places']; } else { $this->view->currency_decimal_places = 2; } if (isset($config['currency_decimal_point'])) { $this->view->currency_decimal_point = $config['currency_decimal_point']; } elseif (isset($store_config['currency_decimal_point'])) { $this->view->currency_decimal_point = $store_config['currency_decimal_point']; } else { $this->view->currency_decimal_point = '.'; } if (isset($config['currency_thousand_point'])) { $this->view->currency_thousand_point = $config['currency_thousand_point']; } elseif (isset($store_config['currency_thousand_point'])) { $this->view->currency_thousand_point = $store_config['currency_thousand_point']; } else { $this->view->currency_thousand_point = ','; } if (isset($config['config_language_id'])) { $this->view->config_language_id = $config['config_language_id']; } elseif (isset($store_config['config_language_id'])) { $this->view->config_language_id = $store_config['config_language_id']; } //////////////////////////////////////// Contacts //////////////////////////////////////// if (isset($config['admin_mail'])) { $this->view->admin_mail = $config['admin_mail']; } elseif (isset($store_config['admin_mail'])) { $this->view->admin_mail = $store_config['admin_mail']; } if (isset($config['report_mail'])) { $this->view->report_mail = $config['report_mail']; } elseif (isset($store_config['report_mail'])) { $this->view->report_mail = $store_config['report_mail']; } if (isset($config['mail_smtp'])) { $this->view->mail_smtp = $config['mail_smtp']; } elseif (isset($store_config['mail_smtp'])) { $this->view->mail_smtp = $store_config['mail_smtp']; } else { $this->view->mail_smtp = 0; } if (isset($config['mail_smtp_host'])) { $this->view->mail_smtp_host = $config['mail_smtp_host']; } elseif (isset($store_config['mail_smtp_host'])) { $this->view->mail_smtp_host = $store_config['mail_smtp_host']; } if (isset($config['mail_smtp_port'])) { $this->view->mail_smtp_port = $config['mail_smtp_port']; } elseif (isset($store_config['mail_smtp_port'])) { $this->view->mail_smtp_port = $store_config['mail_smtp_port']; } if (isset($config['mail_smtp_user'])) { $this->view->mail_smtp_user = $config['mail_smtp_user']; } elseif (isset($store_config['mail_smtp_user'])) { $this->view->mail_smtp_user = $store_config['mail_smtp_user']; } if (isset($config['mail_smtp_password'])) { $this->view->mail_smtp_password = $config['mail_smtp_password']; } elseif (isset($store_config['mail_smtp_password'])) { $this->view->mail_smtp_password = $store_config['mail_smtp_password']; } //////////////////////////////////////// Images //////////////////////////////////////// /////// logo $image_model = new Model_Images(); if (isset($images['site_logo']) && $images['site_logo']) { $this->view->site_logo = $images['site_logo']; } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) { $this->view->site_logo = $store_config['site_logo']; } else { $this->view->site_logo = ''; } if ($this->view->site_logo) { $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100); } else { $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100); } if (!$this->view->preview_logo) { $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100); } ////// no image if (isset($images['no_image']) && $images['no_image']) { $this->view->no_image = $images['no_image']; } elseif (isset($store_config['no_image']) && $store_config['no_image']) { $this->view->no_image = $store_config['no_image']; } else { $this->view->no_image = '/no_image.png'; } if ($this->view->no_image) { $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100); } else { $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); } if (!$this->view->preview_no_image) { $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); } $this->view->preview = $image_model->resize('/logo.png', 100, 100); // $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); /////items $this->view->generate_item_image_form = array(); foreach ($image_setings as $mod => $data) { foreach ($data as $imagetype => $value) { $this->view->generate_item_image_form[$mod][] = array('name' => $value['name'], 'info' => isset($value['info']) ? $value['info'] : '', 'key_width' => $mod . '_items_' . $imagetype . '_width', 'key_height' => $mod . '_items_' . $imagetype . '_height'); if (isset($config[$mod . '_items_' . $imagetype . '_width'])) { $this->view->{$mod . '_items_' . $imagetype . '_width'} = $config[$mod . '_items_' . $imagetype . '_width']; } elseif (isset($store_config[$mod . '_items_' . $imagetype . '_width'])) { $this->view->{$mod . '_items_' . $imagetype . '_width'} = $store_config[$mod . '_items_' . $imagetype . '_width']; } else { $this->view->{$mod . '_items_' . $imagetype . '_width'} = isset($value['width']) ? $value['width'] : ''; } if (isset($config[$mod . '_items_' . $imagetype . '_height'])) { $this->view->{$mod . '_items_' . $imagetype . '_height'} = $config[$mod . '_items_' . $imagetype . '_height']; } elseif (isset($store_config[$mod . '_items_' . $imagetype . '_height'])) { $this->view->{$mod . '_items_' . $imagetype . '_height'} = $store_config[$mod . '_items_' . $imagetype . '_height']; } else { $this->view->{$mod . '_items_' . $imagetype . '_height'} = isset($value['height']) ? $value['height'] : ''; } } } //// watermark $this->view->generate_watermark_form = array(); foreach ($watermark_setings as $mod => $data) { foreach ($data as $imagetype => $value) { $this->view->generate_watermark_form[$mod] = array('name' => $value['name'], 'info' => $value['info'], 'key' => $mod . '_watermark_' . $imagetype); if (isset($images[$mod . '_watermark_' . $imagetype]) && $images[$mod . '_watermark_' . $imagetype]) { $this->view->{$mod . '_watermark_' . $imagetype} = $images[$mod . '_watermark_' . $imagetype]; } elseif (isset($store_config[$mod . '_watermark_' . $imagetype]) && $store_config[$mod . '_watermark_' . $imagetype]) { $this->view->{$mod . '_watermark_' . $imagetype} = $store_config[$mod . '_watermark_' . $imagetype]; } else { if (file_exists(BASE_PATH . '/uploads' . $value['image'])) { $this->view->{$mod . '_watermark_' . $imagetype} = $value['image']; } else { $this->view->{$mod . '_watermark_' . $imagetype} = ''; } } if ($this->view->{$mod . '_watermark_' . $imagetype}) { $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($this->view->{$mod . '_watermark_' . $imagetype}, 100, 100); } else { $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($value['image'], 100, 100); } if (!$this->view->{'preview_' . $mod . '_watermark_' . $imagetype}) { $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($this->view->no_image, 100, 100); } $this->view->{'default_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($value['image'], 100, 100); } } ////////////////user if (isset($config['user_avatar_width'])) { $this->view->user_avatar_width = $config['user_avatar_width']; } elseif (isset($store_config['user_avatar_width'])) { $this->view->user_avatar_width = $store_config['user_avatar_width']; } else { $this->view->user_avatar_width = 80; } if (isset($config['user_avatar_height'])) { $this->view->user_avatar_height = $config['user_avatar_height']; } elseif (isset($store_config['user_avatar_height'])) { $this->view->user_avatar_height = $store_config['user_avatar_height']; } else { $this->view->user_avatar_height = 80; } if (isset($config['user_avatar2_width'])) { $this->view->user_avatar2_width = $config['user_avatar2_width']; } elseif (isset($store_config['user_avatar2_width'])) { $this->view->user_avatar2_width = $store_config['user_avatar2_width']; } else { $this->view->user_avatar2_width = 40; } if (isset($config['user_avatar2_height'])) { $this->view->user_avatar2_height = $config['user_avatar2_height']; } elseif (isset($store_config['user_avatar2_height'])) { $this->view->user_avatar2_height = $store_config['user_avatar2_height']; } else { $this->view->user_avatar2_height = 40; } if (isset($config['user_profile_photo_width'])) { $this->view->user_profile_photo_width = $config['user_profile_photo_width']; } elseif (isset($store_config['user_profile_photo_width'])) { $this->view->user_profile_photo_width = $store_config['user_profile_photo_width']; } else { $this->view->user_profile_photo_width = 590; } if (isset($config['user_profile_photo_height'])) { $this->view->user_profile_photo_height = $config['user_profile_photo_height']; } elseif (isset($store_config['user_profile_photo_height'])) { $this->view->user_profile_photo_height = $store_config['user_profile_photo_height']; } else { $this->view->user_profile_photo_height = 242; } if (isset($config['user_public_collection_width'])) { $this->view->user_public_collection_width = $config['user_public_collection_width']; } elseif (isset($store_config['user_public_collection_width'])) { $this->view->user_public_collection_width = $store_config['user_public_collection_width']; } else { $this->view->user_public_collection_width = 260; } if (isset($config['user_public_collection_height'])) { $this->view->user_public_collection_height = $config['user_public_collection_height']; } elseif (isset($store_config['user_public_collection_height'])) { $this->view->user_public_collection_height = $store_config['user_public_collection_height']; } else { $this->view->user_public_collection_height = 140; } //////////////////////////////////////// PAGES //////////////////////////////////////// if (isset($pages['page_about'])) { $this->view->page_about = $pages['page_about']; } elseif (isset($store_config['page_about'])) { $this->view->page_about = $store_config['page_about']; } else { $this->view->page_about = 0; } if (isset($pages['page_upload_item'])) { $this->view->page_upload_item = $pages['page_upload_item']; } elseif (isset($store_config['page_upload_item'])) { $this->view->page_upload_item = $store_config['page_upload_item']; } else { $this->view->page_upload_item = 0; } if (isset($pages['page_terms'])) { $this->view->page_terms = $pages['page_terms']; } elseif (isset($store_config['page_terms'])) { $this->view->page_terms = $store_config['page_terms']; } else { $this->view->page_terms = 0; } if (isset($pages['page_regular_licence'])) { $this->view->page_regular_licence = $pages['page_regular_licence']; } elseif (isset($store_config['page_regular_licence'])) { $this->view->page_regular_licence = $store_config['page_regular_licence']; } else { $this->view->page_regular_licence = 0; } if (isset($pages['page_forum_rules'])) { $this->view->page_forum_rules = $pages['page_forum_rules']; } elseif (isset($store_config['page_forum_rules'])) { $this->view->page_forum_rules = $store_config['page_forum_rules']; } else { $this->view->page_forum_rules = 0; } if (isset($pages['page_affiliate_program'])) { $this->view->page_affiliate_program = $pages['page_affiliate_program']; } elseif (isset($store_config['page_affiliate_program'])) { $this->view->page_affiliate_program = $store_config['page_affiliate_program']; } else { $this->view->page_affiliate_program = 0; } /////////////////////////////// CURRENCY /////////////////////// $this->view->currencies = array(); $currencies = Model_Currency::getCurrencies(array('status' => 1)); //WM_Currency::getCurrencies(); if ($currencies) { $this->view->currencies = $currencies; } if (isset($config['config_currency'])) { $this->view->config_currency = $config['config_currency']; } elseif (isset($store_config['config_currency'])) { $this->view->config_currency = $store_config['config_currency']; } if (isset($config['config_currency_auto_update'])) { $this->view->config_currency_auto_update = $config['config_currency_auto_update']; } elseif (isset($store_config['config_currency_auto_update'])) { $this->view->config_currency_auto_update = $store_config['config_currency_auto_update']; } else { $this->view->config_currency_auto_update = 1; } /////////////////////////////// DOMAINS /////////////////////// $this->view->show_domain_tab = count($domains_setings) > 1; $this->view->generate_domains_setings_form = array(); foreach ($domains_setings as $mod => $data) { $this->view->generate_domains_setings_form[$mod] = array('key' => $mod); if (isset($config['default_domain'][$mod])) { $this->view->generate_domains_setings_form[$mod]['value'] = $config['default_domain'][$mod]; } elseif (isset($store_config['default_domain'][$mod])) { $this->view->generate_domains_setings_form[$mod]['value'] = $store_config['default_domain'][$mod]; } elseif (isset($data['default'])) { $this->view->generate_domains_setings_form[$mod]['value'] = $data['default']; } else { $this->view->generate_domains_setings_form[$mod]['value'] = ''; } } $this->view->show_domain_tab = false; }
public function indexAction() { if (!WM_Users::allow('edit', 'modules')) { JO_Session::set('error_permision', $this->translate('You do not have permission to this action')); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_storage/'); } $request = $this->getRequest(); if (JO_Session::get('successfu_edite')) { $this->view->successfu_edite = true; JO_Session::clear('successfu_edite'); } if ($request->isPost()) { //validate app id $auth = new JO_Api_Rackspace_Authentication($request->getPost('rackspace[rackspace_api_username]'), $request->getPost('rackspace[rackspace_api_key]'), $request->getPost('rackspace[rackspace_account_name]') ? $request->getPost('rackspace[rackspace_account_name]') : NULL, $request->getPost('rackspace[rackspace_authentication_service_uri]') == 'UK' ? JO_Api_Rackspace_Authentication::UK_AUTHURL : JO_Api_Rackspace_Authentication::US_AUTHURL); $loged = false; try { $loged = $auth->authenticate(); $connect = new JO_Api_Rackspace_Connection($auth); try { $images = $connect->get_container($request->getPost('rackspace[rackspace_pins_contaners]')); if (!$images->cdn_uri) { $this->view->error = sprintf(self::translate('Authentication response did not indicate CDN availability for "%s"'), $request->getPost('rackspace[rackspace_pins_contaners]')); $loged = false; } } catch (JO_Exception $e) { $this->view->error = sprintf($this->translate('Container "%s" not found.'), $request->getPost('rackspace[rackspace_pins_contaners]')); $loged = false; } try { $images = $connect->get_container($request->getPost('rackspace[rackspace_users_contaners]')); if (!$images->cdn_uri) { $this->view->error = sprintf(self::translate('Authentication response did not indicate CDN availability for "%s"'), $request->getPost('rackspace[rackspace_pins_contaners]')); $loged = false; } } catch (JO_Exception $e) { $this->view->error = sprintf($this->translate('Container "%s" not found.'), $request->getPost('rackspace[rackspace_pins_contaners]')); $loged = false; } } catch (JO_Exception $e) { $this->view->error = $e->getMessage(); $loged = false; } if ($loged) { Model_Settings::updateAll(array('rackspace' => $request->getPost('rackspace'))); JO_Session::set('successfu_edite', true); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_storage_rackspace/'); } else { //$this->view->error = $this->translate('Invalid App configuration'); } } $this->view->modules_url = $this->getRequest()->getModule() . '/modules'; $this->view->modules_storage_url = $this->getRequest()->getModule() . '/modules_storage'; $store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'rackspace')); if (!isset($store_config['rackspace_api_username'])) { $store_config['rackspace_api_username'] = ''; } if (!isset($store_config['rackspace_api_key'])) { $store_config['rackspace_api_key'] = ''; } if (!isset($store_config['rackspace_pins_contaners'])) { $store_config['rackspace_pins_contaners'] = ''; } if (!isset($store_config['rackspace_pins_contaners_cdn'])) { $store_config['rackspace_pins_contaners_cdn'] = ''; } if (!isset($store_config['rackspace_users_contaners'])) { $store_config['rackspace_users_contaners'] = ''; } if (!isset($store_config['rackspace_users_contaners_cdn'])) { $store_config['rackspace_users_contaners_cdn'] = ''; } if (!isset($store_config['rackspace_account_name'])) { $store_config['rackspace_account_name'] = ''; } if (!isset($store_config['rackspace_authentication_service_uri'])) { $store_config['rackspace_authentication_service_uri'] = ''; } foreach ($store_config as $key => $data) { if ($request->issetPost('rackspace[' . $key . ']')) { $this->view->{$key} = $request->getPost('rackspace[' . $key . ']'); } else { $this->view->{$key} = $data; } } }