Beispiel #1
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     if ($this->session->get('error_permision')) {
         $this->view->error_permision = $this->session->get('error_permision');
         $this->session->clear('error_permision');
     }
     $request = $this->getRequest();
     $this->setViewChange('form');
     if ($request->isPost()) {
         if (!WM_Users::allow('edit', $this->getRequest()->getController())) {
             $this->session->set('error_permision', $this->translate('You do not have permission to this action'));
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/');
         }
         if (JO_Registry::get('license_powered_check') != 'false') {
             $request->setParams('config_hide_brand', 0);
         }
         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'], true);
         }
         $this->session->set('successfu_edite', true);
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/');
     }
     $this->getForm();
 }
Beispiel #2
0
 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));
 }
 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;
         }
     }
 }
Beispiel #4
0
 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));
 }
Beispiel #5
0
 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;
         }
     }
 }
 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;
         }
     }
 }
Beispiel #8
0
 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);
     }
 }