Beispiel #1
0
 public function _initStoreSettings()
 {
     $request = JO_Request::getInstance();
     if ($request->getModule() == 'install') {
         return '';
     }
     $store = new WM_Store();
     $store_settings = $store->getStoreSettings();
     if ($store_settings) {
         foreach ($store_settings as $value) {
             if ($value['serialize']) {
                 JO_Registry::set($value['key'], self::mb_unserialize($value['value']));
             } else {
                 JO_Registry::set($value['key'], $value['value']);
             }
         }
     }
     if (!JO_Registry::get('admin_limit')) {
         JO_Registry::set('admin_limit', 15);
     }
     if (!JO_Registry::get('front_limit')) {
         JO_Registry::set('front_limit', 10);
     }
     if (!JO_Session::get('user_id')) {
         JO_Session::set('user_id', 0);
     }
     if ($request->getModule() == 'default' && JO_Registry::get('default_module')) {
         $request->setModule(JO_Registry::get('default_module'));
         $modules = WM_Modules::getList();
         if ($modules) {
             rsort($modules);
             $router = JO_Router::getInstance();
             $router->addRoute('default', new JO_Router_Regex('(' . implode('|', $modules) . ')/?(\\w+)?/?(\\w+)?/?', array('module' => JO_Registry::get('default_module'), 'controller' => 'index', 'action' => 'index'), array(1 => 'module', 2 => 'controller', 3 => 'action')));
             $matched = $router->match($request->getRequest('uri'), true);
             if ($matched) {
                 foreach ($matched as $key => $value) {
                     $request->setParams($key, $value);
                 }
             }
         }
     }
     //		$default_domains = JO_Registry::get('default_domain');
     //		if($default_domains && is_array($default_domains) && count($default_domains) > 1) {
     //			$search = array_search($request->getDomain(), $default_domains);
     //			if($search != $request->getModule()) {
     //				$request->setModule($search);
     //			}
     //		}
     JO_Registry::set('default_config_language_id', JO_Registry::get('config_language_id'));
 }
Beispiel #2
0
 public static function create($link)
 {
     static $cached_link = array();
     static $modules = null;
     static $db = null;
     if ($db === null) {
         $db = JO_Db::getDefaultAdapter();
     }
     if (isset($cached_link[$link])) {
         return $cached_link[$link];
     }
     $request = JO_Request::getInstance();
     if ($modules === null) {
         $modules = WM_Modules::getList(array('admin', 'update', 'install'));
     }
     $created = false;
     $controller = '';
     $action = '';
     $url_data = parse_url(str_replace('&', '&', $link));
     $url = '';
     $data = array();
     if (isset($url_data['query'])) {
         parse_str($url_data['query'], $data);
     }
     /* USERS URL-S */
     if (isset($data['user_id']) && isset($data['controller']) && isset($data['action'])) {
         $keyword = self::getAlias(new JO_Db_Expr($db->quote("user_id=" . $data['user_id'])));
         switch (true) {
             case in_array($data['action'], array('pins', 'followers', 'following', 'likers', 'liking', 'activity')):
                 if (trim($keyword['path'])) {
                     $url .= '/' . $keyword['path'];
                 } else {
                     $url .= '/' . $keyword['keyword'];
                 }
                 $url .= '/' . $data['action'];
                 unset($data['user_id']);
                 unset($data['controller']);
                 unset($data['action']);
                 break;
         }
         //return $link;
     }
     /* END USERS URL-S */
     foreach ($data as $key => $value) {
         //			if(in_array($key, array('page_id', 'news_id', 'category_id')) ) {
         $keyword = self::getAlias(new JO_Db_Expr($db->quote($key . "=" . (string) $value)));
         if ($keyword) {
             if (trim($keyword['path'])) {
                 $url .= '/' . $keyword['path'];
             } else {
                 $url .= '/' . $keyword['keyword'];
             }
             unset($data[$key]);
             if ($keyword['route'] == $controller . '/' . $action) {
                 $created = true;
             }
         } elseif ($key == 'controller') {
             $controller = $value;
             unset($data[$key]);
         } elseif ($key == 'action') {
             $action = $value;
             unset($data[$key]);
         } elseif ($key == 'pin_id') {
             $pin = '/' . $value;
             if ($controller == 'pin' && (!$action || $action == 'index')) {
                 $pin = '/pin/' . $value;
                 $created = true;
             }
             $url .= $pin;
             unset($data[$key]);
         } elseif (in_array($key, self::$systems)) {
             $url .= '/' . $key . '/' . $value;
             unset($data[$key]);
         } elseif ($key == 'tag') {
             $url .= '/' . (is_array($value) ? implode(':', $value) : $value);
             unset($data[$key]);
         } elseif ($key == 'module') {
             //				if($value != $request->getModule()) {
             //					$url_data['host'] = $value . '.' . str_replace('www.','',$url_data['host']);
             //				}
             if (count($modules) > 1) {
                 $url .= '/' . $value;
             } elseif (in_array($value, array('update', 'install'))) {
                 $url .= '/' . $value;
             }
             unset($data[$key]);
         }
     }
     if (!$created) {
         if ($action) {
             if ($action != 'index') {
                 $url = '/' . $controller . '/' . $action . $url;
             }
         } else {
             if ($controller) {
                 if ($controller != 'index') {
                     $url = '/' . $controller . $url;
                 }
             }
         }
     }
     if ($url) {
         $query = '';
         if ($data) {
             if ($created) {
                 if (isset($data['controller'])) {
                     unset($data['controller']);
                 }
                 if (isset($data['action'])) {
                     unset($data['action']);
                 }
             }
             $query .= http_build_query($data);
             if ($query) {
                 $query = '?' . trim($query, '&');
             }
         }
         if (isset($url_data['fragment']) && $url_data['fragment']) {
             $query .= '#' . $url_data['fragment'];
         }
         $result = $url . $query;
         $cached_link[$url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', rtrim($url_data['path'], '/')) . $result] = true;
         return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', rtrim($url_data['path'], '/')) . $result;
     } else {
         $cached_link[$link] = true;
         return $link;
     }
 }
Beispiel #3
0
 private function getForm()
 {
     $request = $this->getRequest();
     $id = $request->getQuery('id');
     $module = new Model_Categories();
     $this->view->sub_of = $sub_of = $this->getRequest()->getRequest('sub_of', 0);
     if ($sub_of) {
         $category_info = Model_Categories::getCategoryPath($sub_of);
         if (!$category_info) {
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/categories/');
         }
         $this->view->parent_name = $category_info['name'];
         $this->view->parent_href = $this->getRequest()->getModule() . '/categories/?sub_of=' . $category_info['sub_of'];
         $this->view->parent_module = $category_info['module'];
     }
     if ($id) {
         $info = $module->getCategory($id);
     }
     $this->view->languages = array();
     $this->view->def_lang = false;
     $languages = Model_Language::getLanguages();
     if ($languages) {
         $this->view->languages = $languages;
         foreach ($languages as $language) {
             if ($language['language_id'] == JO_Registry::get('default_config_language_id')) {
                 $this->view->def_lang = $language['code'];
             }
         }
     }
     $this->view->modules = WM_Modules::getList(array('update', 'install', 'admin'));
     if ($request->getPost('meta_title')) {
         $this->view->meta_title = $request->getPost('meta_title');
     } elseif (isset($info)) {
         $this->view->meta_title = $info[0]['meta_title'];
     } else {
         $this->view->meta_title = '';
     }
     if ($request->getPost('meta_keywords')) {
         $this->view->meta_keywords = $request->getPost('meta_keywords');
     } elseif (isset($info)) {
         $this->view->meta_keywords = $info[0]['meta_keywords'];
     } else {
         $this->view->meta_keywords = '';
     }
     if ($request->getPost('meta_description')) {
         $this->view->meta_description = $request->getPost('meta_description');
     } elseif (isset($info)) {
         $this->view->meta_description = $info[0]['meta_description'];
     } else {
         $this->view->meta_description = '';
     }
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } elseif (isset($info)) {
         $this->view->name = array();
         foreach ($info as $i) {
             $this->view->name[$i['lid']] = $i['name'];
         }
     } else {
         $this->view->name = '';
     }
     /*
     if($request->getPost('text')) {
         		$this->view->text = $request->getPost('text');
         	} elseif(isset($info)) {
         		$this->view->text = $info['text'];
         	} else {
         		$this->view->text = '';
         	}
     */
     if ($request->getPost('visible')) {
         $this->view->visible = $request->getPost('visible');
     } elseif (isset($info)) {
         $this->view->visible = $info[0]['visible'];
     } else {
         $this->view->visible = 'true';
     }
     if ($request->getPost('default_module')) {
         $this->view->default_module = $request->getPost('default_module');
     } elseif (isset($info)) {
         $this->view->default_module = $info[0]['module'];
     } else {
         $this->view->default_module = '';
     }
 }
Beispiel #4
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;
 }
Beispiel #5
0
 public static function create($link)
 {
     static $cached_link = array();
     static $modules;
     if (isset($cached_link[$link])) {
         return $cached_link[$link];
     }
     $request = JO_Request::getInstance();
     if (!isset($modules)) {
         $modules = WM_Modules::getList(array('admin', 'update', 'install'));
     }
     $db = JO_Db::getDefaultAdapter();
     $created = false;
     $url_data = parse_url(str_replace('&', '&', $link));
     $url = '';
     $data = array();
     if (isset($url_data['query'])) {
         parse_str($url_data['query'], $data);
     }
     foreach ($data as $key => $value) {
         if ($key == 'name') {
             $keyword = self::clear($value);
             if ($keyword) {
                 $url .= '/' . $keyword;
                 unset($data[$key]);
             }
             $created = true;
         } elseif ($key == 'category_id') {
             $keyword = is_numeric($value) ? $value : self::clear($value);
             if ($keyword) {
                 //$url .= (is_numeric($value) ? '/' . $value : '') . '/' . $keyword;
                 $url .= '/' . $keyword;
                 unset($data[$key]);
             }
             $created = true;
         } elseif ($key == 'item_id') {
             $keyword = $value;
             //self::getKeyword('items', 'id', $value, 'name');
             if ($keyword) {
                 $url .= '/' . $value;
                 // . '/' . $keyword . '.html';
                 unset($data[$key]);
             }
             $created = true;
         } elseif ($key == 'collection_id') {
             $url .= '/' . $value;
             unset($data[$key]);
             $created = true;
         } elseif ($key == 'page_id') {
             $keyword = $value;
             //self::getKeyword('pages', 'id', $value, 'key');
             //	if(!$keyword) {
             //		$keyword = self::getKeyword('pages', 'id', $value, 'name');
             //	}
             if ($keyword) {
                 $url .= '/' . $keyword;
                 // . '/' . $keyword . '.html';
                 unset($data[$key]);
             }
             $created = true;
         } elseif ($key == 'controller') {
             if ($value != 'index') {
                 $url .= '/' . $value;
             } elseif (isset($data['action']) && $data['action'] != 'index') {
                 $url .= '/' . $value;
             }
             unset($data[$key]);
         } elseif ($key == 'action') {
             if ($value != 'index') {
                 $url .= '/' . $value;
             }
             unset($data[$key]);
         } elseif ($key == 'page') {
             $url .= '/page/' . $value;
             unset($data[$key]);
         } elseif ($key == 'sort') {
             $url .= '/sort/' . $value;
             unset($data[$key]);
         } elseif ($key == 'order') {
             $url .= '/order/' . $value;
             unset($data[$key]);
         } elseif ($key == 'username') {
             $url .= '/' . $value;
             unset($data[$key]);
         } elseif ($key == 'tag') {
             $url .= '/' . urlencode($value);
             //(is_array($value) ? implode(':',$value) : $value);
             unset($data[$key]);
         } elseif ($key == 'setFile') {
             $url .= '/' . $value;
             unset($data[$key]);
         } elseif ($key == 'extension') {
             $url .= '/extensions/' . $value;
             unset($data[$key]);
         } elseif ($key == 'module') {
             //				if($value != $request->getModule()) {
             //					$url_data['host'] = $value . '.' . str_replace('www.','',$url_data['host']);
             //				}
             if (count($modules) > 1) {
                 $url .= '/' . $value;
             } elseif (in_array($value, array('update', 'install'))) {
                 $url .= '/' . $value;
             }
             unset($data[$key]);
         }
     }
     if ($url) {
         $query = '';
         if ($data) {
             if ($created) {
                 if (isset($data['controller'])) {
                     unset($data['controller']);
                 }
                 if (isset($data['action'])) {
                     unset($data['action']);
                 }
             }
             $query .= http_build_query($data);
             //				foreach ($data as $key => $value) {
             //					if($created && (($key == 'controller') || ($key == 'action'))) continue;
             //					$query .= '&' . $key . '=' . $value;
             //				}
             if ($query) {
                 $query = '?' . trim($query, '&');
             }
         }
         $result = $url . $query;
         $cached_link[$url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', rtrim($url_data['path'], '/')) . $result] = true;
         return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', rtrim($url_data['path'], '/')) . $result;
     } else {
         $cached_link[$link] = true;
         return $link;
     }
 }