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 getLanguages() { $data = Model_Language::getLanguages(); if ($data) { return $data; } return array(); }
private function getForm() { $request = $this->getRequest(); $id = $request->getQuery('id'); if ($id) { $info = Model_Membership::get($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']; } } } if ($request->getPost('status')) { $this->view->status = $request->getPost('status'); } elseif (isset($info)) { $this->view->status = $info[0]['status']; } else { $this->view->status = 'false'; } if ($request->getPost('price')) { $this->view->price = $request->getPost('price'); } elseif (isset($info)) { $this->view->price = $info[0]['price']; } else { $this->view->price = 0; } if ($request->getPost('max_items_cnt')) { $this->view->max_items_cnt = $request->getPost('max_items_cnt'); } elseif (isset($info)) { $this->view->max_items_cnt = $info[0]['max_items_cnt']; } else { $this->view->max_items_cnt = 0; } if ($request->getPost('order_index')) { $this->view->order_index = $request->getPost('order_index'); } elseif (isset($info)) { $this->view->order_index = $info[0]['order_index']; } else { $this->view->order_index = Model_Membership::getMaxPosition(); } if ($request->getPost('description')) { $this->view->description = $request->getPost('description'); } elseif (isset($info)) { $this->view->description = array(); foreach ($info as $i) { $this->view->description[$i['lid']] = $i['description']; } } else { $this->view->description = ''; } }
public function indexAction() { $request = $this->getRequest(); $this->view->modules = self::getModulesList(); if ($request->getQuery('mod') && in_array($request->getQuery('mod'), $this->view->modules)) { $this->view->mod = $request->getQuery('mod'); } else { $this->view->mod = 'admin'; $request->setParams('mod', 'admin'); } if ($request->getQuery('lid')) { $this->view->language_id = $request->getQuery('lid'); } else { $this->view->language_id = JO_Registry::get('default_config_language_id'); $request->setParams('lid', JO_Registry::get('default_config_language_id')); } if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } $this->view->languages = array(); $this->view->def_lang = $this->view->sel_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']; } if ($this->view->language_id == $language['language_id']) { $this->view->sel_lang = $language['code']; } } } if ($request->isPost()) { Model_Translate::setTranslate($request->getParams()); $this->session->set('successfu_edite', true); if ($request->getPost('hidden_mod') != $this->view->mod) { $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/translate/?mod=' . $request->getPost('hidden_mod') . '&lid=' . $request->getPost('hidden_lang')); } else { $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/translate/?mod=' . $this->view->mod . '&lid=' . $request->getPost('hidden_lang')); } } $this->view->translated = Model_Translate::getTranslate($this->view->mod, $this->view->language_id); if ($this->view->translated) { foreach ($this->view->translated as $k => $v) { $this->view->translated[$k]['keyword'] = htmlspecialchars($v['keyword'], ENT_QUOTES, 'utf-8'); } } }
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 = ''; } }
private function getPageForm() { $request = $this->getRequest(); $page_id = $request->getQuery('id'); $pages_module = new Model_Pages(); $this->view->sub_of = $sub_of = $this->getRequest()->getRequest('sub_of', 0); if ($page_id) { $page_info = $pages_module->getPage($page_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->name[$language['language_id']] = ''; $this->view->text[$language['language_id']] = ''; } } if ($sub_of) { $category_info = $pages_module->getPagePath($sub_of); if (!$category_info) { $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/pages/'); } $this->view->parent_name = $category_info['name']; $this->view->parent_href = $this->getRequest()->getModule() . '/pages/?sub_of=' . $category_info['sub_of']; } if ($request->getPost('name')) { $this->view->name = $request->getPost('name'); } elseif (isset($page_info)) { $this->view->name = array(); foreach ($page_info as $i) { $this->view->name[$i['lid']] = $i['name']; } } if ($request->getPost('text')) { $this->view->text = $request->getPost('text'); } elseif (isset($page_info)) { $this->view->text = array(); foreach ($page_info as $i) { $this->view->text[$i['lid']] = $i['text']; } } if ($request->getPost('visible')) { $this->view->visible = $request->getPost('visible'); } elseif (isset($page_info)) { $this->view->visible = $page_info[0]['visible']; } else { $this->view->visible = 'true'; } if ($request->getPost('meta_title')) { $this->view->meta_title = $request->getPost('meta_title'); } elseif (isset($page_info)) { $this->view->meta_title = $page_info[0]['meta_title']; } else { $this->view->meta_title = ''; } if ($request->getPost('meta_keywords')) { $this->view->meta_keywords = $request->getPost('meta_keywords'); } elseif (isset($page_info)) { $this->view->meta_keywords = $page_info[0]['meta_keywords']; } else { $this->view->meta_keywords = ''; } if ($request->getPost('meta_description')) { $this->view->meta_description = $request->getPost('meta_description'); } elseif (isset($page_info)) { $this->view->meta_description = $page_info[0]['meta_description']; } else { $this->view->meta_description = ''; } if ($request->getPost('menu')) { $this->view->menu = $request->getPost('menu'); } elseif (isset($page_info)) { $this->view->menu = $page_info[0]['menu']; } else { $this->view->menu = ''; } if ($request->getPost('footer')) { $this->view->footer = $request->getPost('footer'); } elseif (isset($page_info)) { $this->view->footer = $page_info[0]['footer']; } else { $this->view->footer = 'false'; } if ($request->getPost('key')) { $this->view->key = $request->getPost('key'); } elseif (isset($page_info)) { $this->view->key = $page_info[0]['key']; } else { $this->view->key = ''; } if ($request->getPost('url')) { $this->view->url = $request->getPost('url'); } elseif (isset($page_info)) { $this->view->url = $page_info[0]['url']; } else { $this->view->url = ''; } }
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; }
/** * Make sure PHP is up to snuff, that we can write to the right places, and * make the first user. */ public function indexAction() { $phpCheck = array('PHP Version >= 5.2.3' => version_compare(PHP_VERSION, '5.2.3') >= 0, 'Standard Extension Loaded' => extension_loaded('standard'), 'SOAP Extension Loaded' => extension_loaded('soap'), 'PCRE Extension Loaded' => extension_loaded('pcre'), 'PDO Extension Loaded' => extension_loaded('pdo'), 'PDO SQLite Extension Loaded' => extension_loaded('pdo_sqlite'), 'SPL Extension Loaded' => extension_loaded('spl'), 'Session Extension Loaded' => extension_loaded('session'), 'Ctype Extension Loaded' => extension_loaded('ctype')); $systemCheck = array('Languages Directory (' . LANGUAGE_PATH . ') Writable' => is_writable(LANGUAGE_PATH), 'Skins Directory (' . SKIN_PATH . ') Writable' => is_writable(SKIN_PATH), 'Database Directory (' . APPLICATION_PATH . '/../data/db) Writable' => is_writable(APPLICATION_PATH . '/../data/db'), 'Configuration File (' . CONFIG_PATH . '/settings.ini' . ') Writable' => is_writable(CONFIG_PATH . '/settings.ini')); /* * Show an error if there are any PHP or system errors. */ $hasPhpErrors = false; $hasSystemErrors = false; foreach ($phpCheck as $check) { if (!$check) { $hasPhpErrors = true; break; } } foreach ($systemCheck as $check) { if (!$check) { $hasSystemErrors = true; break; } } if (!$hasPhpErrors && !$hasSystemErrors) { /* * Build the add user form. */ $config = Zend_Registry::get('config'); $skins = Model_Skin::getAllSkins(); $languages = Model_Language::getAllLanguages(); /* * Turn the skin and language lists into something more Zend_Form * friendly. */ foreach ($skins as $skin) { $skinList[$skin->name] = $skin->name; } foreach ($languages as $language) { $languageList[$language->name] = $language->name; } $form = new Zend_Form(); $form->setMethod('post'); $username = $form->createElement('text', 'username'); $username->setLabel(ucfirst($this->view->translate->_('username'))); $username->setRequired(true); $username->addValidator('alnum'); $apiKey = $form->createElement('text', 'apiKey'); $apiKey->setLabel(ucfirst($this->view->translate->_('API key'))); $apiKey->setRequired(true); $apiKey->addValidator('alnum'); $skin = $form->createElement('select', 'skin'); $skin->setLabel(ucfirst($this->view->translate->_('skin'))); $skin->addMultiOptions($skinList); $skin->setValue($config->defaults->skin); $skin->setRequired(true); $language = $form->createElement('select', 'language'); $language->setLabel(ucfirst($this->view->translate->_('language'))); $language->addMultiOptions($languageList); $language->setValue($config->defaults->language); $language->setRequired(true); $form->addElement($username); $form->addElement($apiKey); $form->addElement($skin); $form->addElement($language); $form->addElement('submit', 'submit', array('label' => $this->view->translate->_('Submit'))); /* * Process form submission. */ if ($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if ($form->isValid($formData)) { /* * Try out the username and API key to make sure they * entered a good one. */ $account = null; $client = SoftLayer_SoapClient::getClient('SoftLayer_Account', null, $form->getValue('username'), $form->getValue('apiKey')); try { $account = $client->getObject(); } catch (Exception $e) { $this->view->errorMessage = $this->view->translate->_('Please enter a valid username and API key combination.'); } /* * Add the user. */ if ($account != null) { try { $user = Model_DbTable_User::addUser($form->getValue('username'), $form->getValue('apiKey'), $form->getValue('skin'), $form->getValue('language'), true); $this->_helper->_redirector->goToRouteAndExit(array('controller' => 'index', 'action' => null)); } catch (Exception $e) { $this->view->errorMessage = $this->view->translate->_('Unable to add user.') . ' ' . $e->getMessage(); } } } else { $this->view->errorMessage = $this->view->translate->_('Please completely fill out the configuration form.'); } $form->populate($formData); } $this->view->form = $form; } $this->view->pageTitle = 'Installation'; $this->view->headTitle('Installation'); $this->view->phpCheck = $phpCheck; $this->view->systemCheck = $systemCheck; $this->view->hasPhpErrors = $hasPhpErrors; $this->view->hasSystemErrors = $hasSystemErrors; }
public function editlanguageAction() { $language = null; $config = Zend_Registry::get('config'); /* * Retrieve the language. */ try { $language = new Model_Language($this->_getParam('name')); } catch (Exception $e) { $this->view->errorMessage = $this->translate->_('Unable to locate language.') . ' ' . $e->getMessage(); } if ($language != null) { /* * Build the delete form. Only show it if the language is not the default system language. */ $deleteForm = null; if ($language->name != $config->defaults->language) { $deleteForm = new Zend_Form(); $deleteForm->setMethod('post'); $hidden = $deleteForm->createElement('hidden', 'mode'); $hidden->setValue('delete'); $deleteForm->addElement($hidden); $deleteForm->addElement('submit', 'submit', array('label' => $this->view->translate->_('Submit'))); } /* * Build the edit forms. One for the logo, one for the css. */ $languages = Model_Language::getAllLanguages(); $form = new Zend_Form(); $form->setMethod('post'); $lang = $form->createElement('textarea', 'language'); $lang->setRequired(true); $lang->setValue($language->getLanguageContent()); $lang->setAttrib('rows', '24'); $lang->setAttrib('cols', '80'); $lang->setAttrib('style', 'margin-left: 60px;'); $hidden = $form->createElement('hidden', 'mode'); $hidden->setValue('edit'); $form->addElement($lang); $form->addElement($hidden); $form->addElement('submit', 'submit', array('label' => $this->view->translate->_('Submit'))); /* * Process form submission. */ if ($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); switch ($formData['mode']) { /* * Delete the language. */ case 'delete': /* * You may not delete the default system language. */ if ($language->name == $config->defaults->language) { $this->view->errorMessage = $this->view->translate->_('You may not delete the default system language.'); } else { try { $language->deleteLanguage(); $this->_helper->_redirector->goToRouteAndExit(array('controller' => 'admin', 'action' => 'languages', 'id' => null, 'name' => null)); } catch (Exception $e) { $this->view->errorMessage = $this->view->translate->_('Unable to delete language.') . ' ' . $e->getMessage(); } } break; /* * Change the language's content. */ /* * Change the language's content. */ case 'edit': if ($form->isValid($formData)) { try { $language->updateLanguage($form->getValue('language')); $this->view->statusMessage = $this->view->translate->_('Language saved.'); } catch (Exception $e) { $this->view->errorMessage = $this->view->translate->_('Unable to save language.') . ' ' . $e->getMessage(); } } else { $this->view->errorMessage = $this->view->translate->_('Please completely fill out the configuration form.'); } $form->populate($formData); break; } } $this->view->pageTitle = $this->view->translate->_('Edit') . ' ' . $language->name; $this->view->headTitle($this->view->translate->_('Edit') . ' ' . $language->name); $this->view->form = $form; $this->view->deleteForm = $deleteForm; } $this->view->language = $language; }