public function action_delete($id = null)
 {
     if ($currency = Model_Currency::find($id)) {
         $currency->delete();
         Session::set_flash('success', e('Deleted currency #' . $id));
     } else {
         Session::set_flash('error', e('Could not delete currency #' . $id));
     }
     Response::redirect('admin/currencies');
 }
Exemplo n.º 2
0
 public function testtoApiArray()
 {
     $cartModel = new \Model_Cart();
     $cartModel->loadBean(new \RedBeanPHP\OODBBean());
     $cartProductModel = new \Model_CartProduct();
     $cartProductModel->loadBean(new \RedBeanPHP\OODBBean());
     $serviceMock = $this->getMockBuilder('\\Box\\Mod\\Cart\\Service')->setMethods(array('getCartProducts', 'cartProductToApiArray'))->getMock();
     $serviceMock->expects($this->atLeastOnce())->method('getCartProducts')->will($this->returnValue(array($cartProductModel)));
     $cartProductApiArray = array('total' => 1, 'discount' => 0);
     $serviceMock->expects($this->atLeastOnce())->method('cartProductToApiArray')->will($this->returnValue($cartProductApiArray));
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $currencyModel = new \Model_Currency();
     $currencyModel->loadBean(new \RedBeanPHP\OODBBean());
     $dbMock->expects($this->atLeastOnce())->method('getExistingModelById')->will($this->returnValue($currencyModel));
     $currencyService = $this->getMockBuilder('\\Box\\Mod\\Currency\\Service')->getMock();
     $currencyService->expects($this->atLeastOnce())->method('toApiArray')->will($this->returnValue(array()));
     $di = new \Box_Di();
     $di['db'] = $dbMock;
     $di['mod_service'] = $di->protect(function () use($currencyService) {
         return $currencyService;
     });
     $serviceMock->setDi($di);
     $result = $serviceMock->toApiArray($cartModel);
     $expected = array('promocode' => null, 'discount' => 0, 'total' => 1, 'items' => array($cartProductApiArray), 'currency' => array());
     $this->assertInternalType('array', $result);
     $this->assertEquals($expected, $result);
 }
Exemplo n.º 3
0
 public function testDelete()
 {
     $model = new \Model_Currency();
     $model->loadBean(new \RedBeanPHP\OODBBean());
     $model->code = 'EUR';
     $code = 'EUR';
     $service = $this->getMockBuilder('\\Box\\Mod\\Currency\\Service')->setMethods(array('getByCode', 'rm'))->getMock();
     $service->expects($this->atLeastOnce())->method('getByCode')->will($this->returnValue($model));
     $service->expects($this->atLeastOnce())->method('rm')->will($this->returnValue($model));
     $manager = $this->getMockBuilder('Box_EventManager')->getMock();
     $manager->expects($this->atLeastOnce())->method('fire')->will($this->returnValue(true));
     $di = new \Box_Di();
     $db = $this->getMockBuilder('Box_Database')->getMock();
     $di['logger'] = new \Box_Log();
     $di['db'] = $db;
     $di['events_manager'] = $manager;
     $service->setDi($di);
     $result = $service->deleteCurrencyByCode($code);
     $this->assertInternalType('boolean', $result);
     $this->assertEquals($result, true);
 }
Exemplo n.º 4
0
 public function testcreateOrder()
 {
     $modelClient = new \Model_Client();
     $modelClient->loadBean(new \RedBeanPHP\OODBBean());
     $modelClient->currency = 'USD';
     $modelProduct = new \Model_Product();
     $modelProduct->loadBean(new \RedBeanPHP\OODBBean());
     $modelProduct->id = 1;
     $modelProduct->type = 'custom';
     $licenseMock = $this->getMockBuilder('\\Box_License')->getMock();
     $licenseMock->expects($this->atLeastOnce())->method('isPro')->willReturn(true);
     $currencyModel = new \Model_Currency();
     $currencyModel->loadBean(new \RedBeanPHP\OODBBean());
     $currencyServiceMock = $this->getMockBuilder('\\Box\\Mod\\Currency\\Service')->getMock();
     $currencyServiceMock->expects($this->atLeastOnce())->method('getByCode')->willReturn($currencyModel);
     $cartServiceMock = $this->getMockBuilder('\\Box\\Mod\\Cart\\Service')->getMock();
     $cartServiceMock->expects($this->atLeastOnce())->method('isStockAvailable')->with($modelProduct)->willReturn(true);
     $eventMock = $this->getMockBuilder('\\Box_EventManager')->getMock();
     $eventMock->expects($this->atLeastOnce())->method('fire');
     $productServiceMock = $this->getMockBuilder('\\Box\\Mod\\Servicecustom')->getMock();
     $clientOrderModel = new \Model_ClientOrder();
     $clientOrderModel->loadBean(new \RedBeanPHP\OODBBean());
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $dbMock->expects($this->atLeastOnce())->method('dispense')->with('ClientOrder')->willReturn($clientOrderModel);
     $newId = 1;
     $dbMock->expects($this->atLeastOnce())->method('store')->with($clientOrderModel)->willReturn($newId);
     $periodMock = $this->getMockBuilder('\\Box_Period')->disableOriginalConstructor()->getMock();
     $periodMock->expects($this->atLeastOnce())->method('getCode')->willReturn('1Y');
     $di = new \Box_Di();
     $di['license'] = $licenseMock;
     $di['mod_service'] = $di->protect(function ($serviceName) use($currencyServiceMock, $cartServiceMock, $productServiceMock) {
         if ($serviceName == 'currency') {
             return $currencyServiceMock;
         }
         if ($serviceName == 'cart') {
             return $cartServiceMock;
         }
         if ($serviceName == 'servicecustom') {
             return $productServiceMock;
         }
     });
     $di['events_manager'] = $eventMock;
     $di['db'] = $dbMock;
     $di['period'] = $di->protect(function () use($periodMock) {
         return $periodMock;
     });
     $di['logger'] = new \Box_Log();
     $di['array_get'] = $di->protect(function (array $array, $key, $default = null) use($di) {
         return isset($array[$key]) ? $array[$key] : $default;
     });
     $this->service->setDi($di);
     $result = $this->service->createOrder($modelClient, $modelProduct, array('period' => '1Y', 'price' => '10', 'notes' => 'test'));
     $this->assertEquals($newId, $result);
 }
Exemplo n.º 5
0
 private function getPageForm()
 {
     $request = $this->getRequest();
     $page_id = $request->getQuery('id');
     $pages_module = new Model_Currency();
     if ($page_id) {
         $page_info = $pages_module->getCurrency($page_id);
     }
     if ($request->getPost('status')) {
         $this->view->status = $request->getPost('status');
     } elseif (isset($page_info)) {
         $this->view->status = $page_info['status'];
     } else {
         $this->view->status = 1;
     }
     if ($request->getPost('code')) {
         $this->view->code = $request->getPost('code');
     } elseif (isset($page_info)) {
         $this->view->code = $page_info['code'];
     } else {
         $this->view->code = '';
     }
     if ($request->getPost('decimal_place')) {
         $this->view->decimal_place = $request->getPost('decimal_place');
     } elseif (isset($page_info)) {
         $this->view->decimal_place = $page_info['decimal_place'];
     } else {
         $this->view->decimal_place = 2;
     }
     if ($request->getPost('value')) {
         $this->view->value = $request->getPost('value');
     } elseif (isset($page_info)) {
         $this->view->value = $page_info['value'];
     } else {
         $this->view->value = 0;
     }
     if ($request->getPost('decimal_point')) {
         $this->view->decimal_point = $request->getPost('decimal_point');
     } elseif (isset($page_info)) {
         $this->view->decimal_point = $page_info['decimal_point'];
     } else {
         $this->view->decimal_point = '.';
     }
     if ($request->getPost('thousand_point')) {
         $this->view->thousand_point = $request->getPost('thousand_point');
     } elseif (isset($page_info)) {
         $this->view->thousand_point = $page_info['thousand_point'];
     } else {
         $this->view->thousand_point = ',';
     }
     if ($request->getPost('title')) {
         $this->view->title = $request->getPost('title');
     } elseif (isset($page_info)) {
         $this->view->title = $page_info['title'];
     } else {
         $this->view->title = '';
     }
     if ($request->getPost('symbol_left')) {
         $this->view->symbol_left = $request->getPost('symbol_left');
     } elseif (isset($page_info)) {
         $this->view->symbol_left = $page_info['symbol_left'];
     } else {
         $this->view->symbol_left = '';
     }
     if ($request->getPost('symbol_right')) {
         $this->view->symbol_right = $request->getPost('symbol_right');
     } elseif (isset($page_info)) {
         $this->view->symbol_right = $page_info['symbol_right'];
     } else {
         $this->view->symbol_right = '';
     }
 }
Exemplo n.º 6
0
 public function getForm()
 {
     $request = $this->getRequest();
     $this->view->templates = $this->getTemplates(array('mobile'));
     $config = $request->getPost('config');
     $images = $request->getPost('images');
     $pages = $request->getPost('pages');
     $store_config = Model_Settings::getSettingsPairs();
     $this->view->pages = Model_Pages::getPagesFromParent(0);
     $this->view->pages_about = array();
     $this->view->pages_about[] = array('title' => $this->translate('SEPARATOR MENU'), 'page_id' => -1);
     if ($this->view->pages) {
         foreach ($this->view->pages as $p) {
             $this->view->pages_about[] = array('title' => $p['title'], 'page_id' => $p['page_id']);
         }
     }
     $this->view->currencies = Model_Currency::getCurrencies();
     $this->view->app_path = BASE_PATH;
     //////////////////////////////////////// OAUTH ////////////////////////////////////////
     //facebook
     if (isset($config['oauth_fb_key'])) {
         $this->view->oauth_fb_key = $config['oauth_fb_key'];
     } elseif (isset($store_config['oauth_fb_key'])) {
         $this->view->oauth_fb_key = $store_config['oauth_fb_key'];
     }
     if (isset($config['oauth_fb_secret'])) {
         $this->view->oauth_fb_secret = $config['oauth_fb_secret'];
     } elseif (isset($store_config['oauth_fb_secret'])) {
         $this->view->oauth_fb_secret = $store_config['oauth_fb_secret'];
     }
     if (isset($config['og_namespace'])) {
         $this->view->og_namespace = $config['og_namespace'];
     } elseif (isset($store_config['og_namespace'])) {
         $this->view->og_namespace = $store_config['og_namespace'];
     }
     if (isset($config['og_recipe'])) {
         $this->view->og_recipe = $config['og_recipe'];
     } elseif (isset($store_config['og_recipe'])) {
         $this->view->og_recipe = $store_config['og_recipe'];
     }
     //twitter
     if (isset($config['oauth_tw_key'])) {
         $this->view->oauth_tw_key = $config['oauth_tw_key'];
     } elseif (isset($store_config['oauth_tw_key'])) {
         $this->view->oauth_tw_key = $store_config['oauth_tw_key'];
     }
     if (isset($config['oauth_tw_secret'])) {
         $this->view->oauth_tw_secret = $config['oauth_tw_secret'];
     } elseif (isset($store_config['oauth_tw_secret'])) {
         $this->view->oauth_tw_secret = $store_config['oauth_tw_secret'];
     }
     ///instagram
     if (isset($config['oauth_in_key'])) {
         $this->view->oauth_in_key = $config['oauth_in_key'];
     } elseif (isset($store_config['oauth_in_key'])) {
         $this->view->oauth_in_key = $store_config['oauth_in_key'];
     }
     if (isset($config['oauth_in_secret'])) {
         $this->view->oauth_in_secret = $config['oauth_in_secret'];
     } elseif (isset($store_config['oauth_in_secret'])) {
         $this->view->oauth_in_secret = $store_config['oauth_in_secret'];
     }
     //////////////////////////////////////// GENERAL ////////////////////////////////////////
     if (isset($config['config_base_domain'])) {
         $this->view->config_base_domain = $config['config_base_domain'];
     } elseif (isset($store_config['config_base_domain'])) {
         $this->view->config_base_domain = $store_config['config_base_domain'];
     } else {
         $this->view->config_base_domain = $request->getBaseUrl();
     }
     if (isset($config['config_on_facebook'])) {
         $this->view->config_on_facebook = $config['config_on_facebook'];
     } elseif (isset($store_config['config_on_facebook'])) {
         $this->view->config_on_facebook = $store_config['config_on_facebook'];
     } else {
         $this->view->config_on_facebook = '';
     }
     if (isset($config['google_analytics'])) {
         $this->view->google_analytics = $config['google_analytics'];
     } elseif (isset($store_config['google_analytics'])) {
         $this->view->google_analytics = $store_config['google_analytics'];
     }
     if (isset($config['config_fix_image_thumb_editor'])) {
         $this->view->config_fix_image_thumb_editor = $config['config_fix_image_thumb_editor'];
     } elseif (isset($store_config['config_fix_image_thumb_editor'])) {
         $this->view->config_fix_image_thumb_editor = $store_config['config_fix_image_thumb_editor'];
     }
     if (isset($config['config_fix_external_urls'])) {
         $this->view->config_fix_external_urls = $config['config_fix_external_urls'];
     } elseif (isset($store_config['config_fix_external_urls'])) {
         $this->view->config_fix_external_urls = $store_config['config_fix_external_urls'];
     }
     //////////////////////////////////////// SEO ////////////////////////////////////////
     if (isset($config['site_name'])) {
         $this->view->site_name = $config['site_name'];
     } elseif (isset($store_config['site_name'])) {
         $this->view->site_name = $store_config['site_name'];
     }
     if (isset($config['meta_title'])) {
         $this->view->meta_title = $config['meta_title'];
     } elseif (isset($store_config['meta_title'])) {
         $this->view->meta_title = $store_config['meta_title'];
     }
     if (isset($config['meta_keywords'])) {
         $this->view->meta_keywords = $config['meta_keywords'];
     } elseif (isset($store_config['meta_keywords'])) {
         $this->view->meta_keywords = $store_config['meta_keywords'];
     }
     if (isset($config['meta_description'])) {
         $this->view->meta_description = $config['meta_description'];
     } elseif (isset($store_config['meta_description'])) {
         $this->view->meta_description = $store_config['meta_description'];
     }
     //////////////////////////////////////// Options ////////////////////////////////////////
     if (isset($config['config_admin_limit'])) {
         $this->view->config_admin_limit = $config['config_admin_limit'];
     } elseif (isset($store_config['config_admin_limit'])) {
         $this->view->config_admin_limit = $store_config['config_admin_limit'];
     } else {
         $this->view->config_admin_limit = 15;
     }
     if (isset($config['config_front_limit'])) {
         $this->view->config_front_limit = $config['config_front_limit'];
     } elseif (isset($store_config['config_front_limit'])) {
         $this->view->config_front_limit = $store_config['config_front_limit'];
     } else {
         $this->view->config_front_limit = 10;
     }
     if (isset($config['template'])) {
         $this->view->template = $config['template'];
     } elseif (isset($store_config['template'])) {
         $this->view->template = $store_config['template'];
     }
     if (isset($config['config_maintenance'])) {
         $this->view->config_maintenance = $config['config_maintenance'];
     } elseif (isset($store_config['config_maintenance'])) {
         $this->view->config_maintenance = $store_config['config_maintenance'];
     } else {
         $this->view->config_maintenance = 0;
     }
     if (isset($config['config_hide_brand'])) {
         $this->view->config_hide_brand = $config['config_hide_brand'];
     } elseif (isset($store_config['config_hide_brand'])) {
         $this->view->config_hide_brand = $store_config['config_hide_brand'];
     } else {
         $this->view->config_hide_brand = 0;
     }
     $this->view->data_timezones = JO_Date_Timezones::getTimezonse();
     if (isset($config['phpSettings']['date.timezone'])) {
         $this->view->date_timezone = $config['phpSettings']['date.timezone'];
     } elseif (isset($store_config['phpSettings']['date.timezone'])) {
         $this->view->date_timezone = $store_config['phpSettings']['date.timezone'];
     } else {
         $this->view->date_timezone = 'UTC';
     }
     /////////////////////////////// CURRENCY ///////////////////////
     $this->view->currencies = array();
     $currencies = Model_Currency::getCurrencies(array('status' => 1));
     //WM_Currency::getCurrencies();
     if ($currencies) {
         $this->view->currencies = $currencies;
     }
     if (isset($config['config_currency'])) {
         $this->view->config_currency = $config['config_currency'];
     } elseif (isset($store_config['config_currency'])) {
         $this->view->config_currency = $store_config['config_currency'];
     }
     if (isset($config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $config['config_currency_auto_update'];
     } elseif (isset($store_config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $store_config['config_currency_auto_update'];
     } else {
         $this->view->config_currency_auto_update = 1;
     }
     if (isset($config['config_cache_live'])) {
         $this->view->config_cache_live = $config['config_cache_live'];
     } elseif (isset($store_config['config_cache_live'])) {
         $this->view->config_cache_live = $store_config['config_cache_live'];
     } else {
         $this->view->config_cache_live = 0;
     }
     if (isset($config['enable_free_registration'])) {
         $this->view->enable_free_registration = $config['enable_free_registration'];
     } elseif (isset($store_config['enable_free_registration'])) {
         $this->view->enable_free_registration = $store_config['enable_free_registration'];
     } else {
         $this->view->enable_free_registration = 0;
     }
     //////////////////////////////////////// Contacts ////////////////////////////////////////
     if (isset($config['admin_mail'])) {
         $this->view->admin_mail = $config['admin_mail'];
     } elseif (isset($store_config['admin_mail'])) {
         $this->view->admin_mail = $store_config['admin_mail'];
     }
     if (isset($config['report_mail'])) {
         $this->view->report_mail = $config['report_mail'];
     } elseif (isset($store_config['report_mail'])) {
         $this->view->report_mail = $store_config['report_mail'];
     }
     if (isset($config['noreply_mail'])) {
         $this->view->noreply_mail = $config['noreply_mail'];
     } elseif (isset($store_config['noreply_mail'])) {
         $this->view->noreply_mail = $store_config['noreply_mail'];
     }
     if (isset($config['mail_smtp'])) {
         $this->view->mail_smtp = $config['mail_smtp'];
     } elseif (isset($store_config['mail_smtp'])) {
         $this->view->mail_smtp = $store_config['mail_smtp'];
     } else {
         $this->view->mail_smtp = 0;
     }
     if (isset($config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $config['mail_smtp_host'];
     } elseif (isset($store_config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $store_config['mail_smtp_host'];
     }
     if (isset($config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $config['mail_smtp_port'];
     } elseif (isset($store_config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $store_config['mail_smtp_port'];
     }
     if (isset($config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $config['mail_smtp_user'];
     } elseif (isset($store_config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $store_config['mail_smtp_user'];
     }
     if (isset($config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $config['mail_smtp_password'];
     } elseif (isset($store_config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $store_config['mail_smtp_password'];
     }
     if (isset($config['mail_footer'])) {
         $this->view->mail_footer = $config['mail_footer'];
     } elseif (isset($store_config['mail_footer'])) {
         $this->view->mail_footer = $store_config['mail_footer'];
     }
     if (isset($config['not_rp'])) {
         $this->view->not_rp = $config['not_rp'];
     } elseif (isset($store_config['not_rp'])) {
         $this->view->not_rp = $store_config['not_rp'];
     } else {
         $this->view->not_rp = 0;
     }
     if (isset($config['not_rc'])) {
         $this->view->not_rc = $config['not_rc'];
     } elseif (isset($store_config['not_rc'])) {
         $this->view->not_rc = $store_config['not_rc'];
     } else {
         $this->view->not_rc = 0;
     }
     if (isset($config['not_ri'])) {
         $this->view->not_ri = $config['not_ri'];
     } elseif (isset($store_config['not_ri'])) {
         $this->view->not_ri = $store_config['not_ri'];
     } else {
         $this->view->not_ri = 0;
     }
     //////////////////////////////////////// AMAZON ////////////////////////////////////////
     $uploads_methods = $this->uploadsMethods();
     $this->view->uploads_methods = array();
     foreach ($uploads_methods as $method) {
         $this->view->uploads_methods[] = $this->view->callChildren('upload_' . $method);
     }
     //////////////////////////////////////// Images ////////////////////////////////////////
     /////// logo
     $image_model = new Helper_Images();
     if (isset($images['site_logo']) && $images['site_logo']) {
         $this->view->site_logo = $images['site_logo'];
     } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) {
         $this->view->site_logo = $store_config['site_logo'];
     } else {
         $this->view->site_logo = '';
     }
     if ($this->view->site_logo) {
         $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100);
     } else {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo) {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     $this->view->preview = $image_model->resize('/logo.png', 100, 100);
     ////mobile logo
     if (isset($images['site_logo_mobile']) && $images['site_logo_mobile']) {
         $this->view->site_logo_mobile = $images['site_logo_mobile'];
     } elseif (isset($store_config['site_logo_mobile']) && $store_config['site_logo_mobile']) {
         $this->view->site_logo_mobile = $store_config['site_logo_mobile'];
     } else {
         $this->view->site_logo_mobile = '';
     }
     if ($this->view->site_logo_mobile) {
         $this->view->preview_logo_mobile = $image_model->resize($this->view->site_logo_mobile, 100, 100);
     } else {
         $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo_mobile) {
         $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100);
     }
     $this->view->preview_mobile = $image_model->resize('/logo.png', 100, 100);
     ////// no image
     if (isset($images['no_image']) && $images['no_image']) {
         $this->view->no_image = $images['no_image'];
     } elseif (isset($store_config['no_image']) && $store_config['no_image']) {
         $this->view->no_image = $store_config['no_image'];
     } else {
         $this->view->no_image = '/no_image.png';
     }
     if ($this->view->no_image) {
         $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100);
     } else {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     if (!$this->view->preview_no_image) {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     ////// no avatar
     if (isset($images['no_avatar']) && $images['no_avatar']) {
         $this->view->no_avatar = $images['no_avatar'];
     } elseif (isset($store_config['no_avatar']) && $store_config['no_avatar']) {
         $this->view->no_avatar = $store_config['no_avatar'];
     } else {
         $this->view->no_avatar = '/no-avatar.png';
     }
     if ($this->view->no_avatar) {
         $this->view->preview_no_avatar = $image_model->resize($this->view->no_avatar, 100, 100);
     } else {
         $this->view->preview_no_avatar = $image_model->resize('/no-avatar.png', 100, 100);
     }
     if (!$this->view->preview_no_avatar) {
         $this->view->preview_no_avatar = $image_model->resize('/no_image.png', 100, 100);
     }
     ////// favicon
     if (isset($images['favicon']) && $images['favicon']) {
         $this->view->favicon = $images['favicon'];
     } elseif (isset($store_config['favicon']) && $store_config['favicon']) {
         $this->view->favicon = $store_config['favicon'];
     } else {
         $this->view->favicon = '';
     }
     if ($this->view->favicon) {
         $this->view->preview_favicon = $image_model->resize($this->view->favicon, 100, 100);
     } else {
         $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100);
     }
     if (!$this->view->preview_favicon) {
         $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100);
     }
     //    	$this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     //////////////////////////////////////// PAGES ////////////////////////////////////////
     if (isset($pages['about_menu'])) {
         $this->view->about_menu = $pages['about_menu'];
     } elseif (isset($store_config['about_menu'])) {
         $this->view->about_menu = $store_config['about_menu'];
     } else {
         $this->view->about_menu = array();
     }
     if (isset($pages['page_login_trouble'])) {
         $this->view->page_login_trouble = $pages['page_login_trouble'];
     } elseif (isset($store_config['page_login_trouble'])) {
         $this->view->page_login_trouble = $store_config['page_login_trouble'];
     } else {
         $this->view->page_login_trouble = 0;
     }
     if (isset($pages['page_terms'])) {
         $this->view->page_terms = $pages['page_terms'];
     } elseif (isset($store_config['page_terms'])) {
         $this->view->page_terms = $store_config['page_terms'];
     } else {
         $this->view->page_terms = 0;
     }
     if (isset($pages['page_contact'])) {
         $this->view->page_contact = $pages['page_contact'];
     } elseif (isset($store_config['page_contact'])) {
         $this->view->page_contact = $store_config['page_contact'];
     } else {
         $this->view->page_contact = 0;
     }
     if (isset($pages['page_goodies'])) {
         $this->view->page_goodies = $pages['page_goodies'];
     } elseif (isset($store_config['page_goodies'])) {
         $this->view->page_goodies = $store_config['page_goodies'];
     } else {
         $this->view->page_goodies = 0;
     }
     if (isset($pages['delete_account'])) {
         $this->view->delete_account = $pages['delete_account'];
     } elseif (isset($store_config['delete_account'])) {
         $this->view->delete_account = $store_config['delete_account'];
     } else {
         $this->view->delete_account = 0;
     }
     if (isset($pages['support_page'])) {
         $this->view->support_page = $pages['support_page'];
     } elseif (isset($store_config['support_page'])) {
         $this->view->support_page = $store_config['support_page'];
     } else {
         $this->view->support_page = 0;
     }
     if (isset($pages['page_pinmarklet'])) {
         $this->view->page_pinmarklet = $pages['page_pinmarklet'];
     } elseif (isset($store_config['page_pinmarklet'])) {
         $this->view->page_pinmarklet = $store_config['page_pinmarklet'];
     } else {
         $this->view->page_pinmarklet = 0;
     }
     if (isset($pages['page_privacy_policy'])) {
         $this->view->page_privacy_policy = $pages['page_privacy_policy'];
     } elseif (isset($store_config['page_privacy_policy'])) {
         $this->view->page_privacy_policy = $store_config['page_privacy_policy'];
     } else {
         $this->view->page_privacy_policy = 0;
     }
     //////////////////////////////////////// DATES ////////////////////////////////////////
     $this->view->short_dates = array('dd.mm.yy', 'yy-mm-dd');
     $this->view->medium_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy');
     $this->view->long_dates = array('dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy');
     $this->view->long_dates_times = array('dd MM yy H:i:s', 'D, d MM y H:i:s', 'DD, dd-MM-y H:i:s', 'D, d MM yy H:i:s');
     $this->view->news_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy', 'dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy', 'dd MM yy | H:i', 'D, d MM y | H:i', 'DD, dd-MM-y | H:i', 'D, d MM yy | H:i', 'dd MM yy | H:i:s', 'D, d MM y | H:i:s', 'DD, dd-MM-y | H:i:s', 'D, d MM yy | H:i:s');
     if (isset($config['config_date_format_short'])) {
         $this->view->config_date_format_short = $config['config_date_format_short'];
     } elseif (isset($store_config['config_date_format_short'])) {
         $this->view->config_date_format_short = $store_config['config_date_format_short'];
     } else {
         $this->view->config_date_format_short = 'dd.mm.yy';
     }
     if (isset($config['config_date_format_medium'])) {
         $this->view->config_date_format_medium = $config['config_date_format_medium'];
     } elseif (isset($store_config['config_date_format_medium'])) {
         $this->view->config_date_format_medium = $store_config['config_date_format_medium'];
     } else {
         $this->view->config_date_format_medium = 'dd M yy';
     }
     if (isset($config['config_date_format_long'])) {
         $this->view->config_date_format_long = $config['config_date_format_long'];
     } elseif (isset($store_config['config_date_format_long'])) {
         $this->view->config_date_format_long = $store_config['config_date_format_long'];
     } else {
         $this->view->config_date_format_long = 'dd MM yy';
     }
     if (isset($config['config_date_format_news'])) {
         $this->view->config_date_format_news = $config['config_date_format_news'];
     } elseif (isset($store_config['config_date_format_news'])) {
         $this->view->config_date_format_news = $store_config['config_date_format_news'];
     } else {
         $this->view->config_date_format_news = 'dd MM yy | H:i';
     }
     if (isset($config['config_date_format_long_time'])) {
         $this->view->config_date_format_long_time = $config['config_date_format_long_time'];
     } elseif (isset($store_config['config_date_format_long_time'])) {
         $this->view->config_date_format_long_time = $store_config['config_date_format_long_time'];
     } else {
         $this->view->config_date_format_long_time = 'dd MM yy H:i:s';
     }
     //////////////////////////////////////// DATES ////////////////////////////////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_without_children' => true));
     if ($categories) {
         foreach ($categories as $category) {
             $this->view->categories[] = $category;
         }
     }
     if (isset($config['default_category_id'])) {
         $this->view->default_category_id = $config['default_category_id'];
     } elseif (isset($store_config['default_category_id'])) {
         $this->view->default_category_id = $store_config['default_category_id'];
     } else {
         $this->view->default_category_id = 0;
     }
     if (isset($config['default_boards'])) {
         $this->view->default_boards = $config['default_boards'];
     } elseif (isset($store_config['default_boards'])) {
         $this->view->default_boards = $store_config['default_boards'];
     } else {
         $this->view->default_boards = array();
     }
 }
Exemplo n.º 7
0
 public function testSetDefault()
 {
     $adminApi = new \Box\Mod\Currency\Api\Admin();
     $model = new \Model_Currency();
     $model->loadBean(new \RedBeanPHP\OODBBean());
     $model->code = 'EUR';
     $data = array('code' => 'EUR', 'format' => '€{{price}}');
     $service = $this->getMockBuilder('\\Box\\Mod\\Currency\\Service')->getMock();
     $service->expects($this->atLeastOnce())->method('getByCode')->will($this->returnValue($model));
     $service->expects($this->atLeastOnce())->method('setAsDefault')->will($this->returnValue(true));
     $validatorMock = $this->getMockBuilder('\\Box_Validate')->getMock();
     $validatorMock->expects($this->atLeastOnce())->method('checkRequiredParamsForArray');
     $di = new \Box_Di();
     $db = $this->getMockBuilder('Box_Database')->getMock();
     $di['db'] = $db;
     $di['validator'] = $validatorMock;
     $adminApi->setDi($di);
     $adminApi->setService($service);
     $result = $adminApi->set_default($data);
     $this->assertInternalType('boolean', $result);
     $this->assertEquals($result, true);
 }
Exemplo n.º 8
0
 public function testprepareInvoiceCurrencyWasNotDefined()
 {
     $serviceMock = $this->getMockBuilder('\\Box\\Mod\\Invoice\\Service')->setMethods(array('setInvoiceDefaults'))->getMock();
     $serviceMock->expects($this->atLeastOnce())->method('setInvoiceDefaults');
     $data = array('gateway_id' => '', 'text_1' => '', 'text_2' => '', 'items' => array(array('id' => 1)), 'approve');
     $clientModel = new \Model_Client();
     $clientModel->loadBean(new \RedBeanPHP\OODBBean());
     $invoiceModel = new \Model_Invoice();
     $invoiceModel->loadBean(new \RedBeanPHP\OODBBean());
     $currencyModel = new \Model_Currency();
     $currencyModel->loadBean(new \RedBeanPHP\OODBBean());
     $currencyService = $this->getMockBuilder('\\Box\\Mod\\Currency\\Service')->getMock();
     $currencyService->expects($this->atLeastOnce())->method('getDefault')->will($this->returnValue($currencyModel));
     $itemInvoiceServiceMock = $this->getMockBuilder('\\Box\\Mod\\Invoice\\ServiceInvoiceItem')->getMock();
     $itemInvoiceServiceMock->expects($this->atLeastOnce())->method('addNew');
     $newRecordId = 1;
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $dbMock->expects($this->atLeastOnce())->method('store')->will($this->returnValue($newRecordId));
     $dbMock->expects($this->atLeastOnce())->method('dispense')->will($this->returnValue($invoiceModel));
     $di = new \Box_Di();
     $di['db'] = $dbMock;
     $di['mod_service'] = $di->protect(function ($serviceName, $sub = '') use($currencyService, $itemInvoiceServiceMock) {
         if ($serviceName == 'Currency') {
             return $currencyService;
         }
         if ($sub == 'InvoiceItem') {
             return $itemInvoiceServiceMock;
         }
     });
     $di['logger'] = new \Box_Log();
     $di['array_get'] = $di->protect(function (array $array, $key, $default = null) use($di) {
         return isset($array[$key]) ? $array[$key] : $default;
     });
     $serviceMock->setDi($di);
     $result = $serviceMock->prepareInvoice($clientModel, $data);
     $this->assertInstanceOf('Model_Invoice', $result);
 }
Exemplo n.º 9
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;
 }
Exemplo n.º 10
0
 public function action_edit($id)
 {
     $partner = Model_Partner::find($id);
     /* @var $partner Model_Partner */
     if (!$partner) {
         Response::redirect('/admin/404');
     }
     $validationErrors = array();
     $view = $this->setDefaultValiesToView('admin/partners/partners/edit.html.twig');
     if (Input::post()) {
         if (Input::post('delete')) {
             $url = 'admin/partners';
             $this->performItemDeletion($partner, $url);
         }
         if (Input::post('update')) {
             try {
                 $validationErrors = $this->validateItem();
                 if ($validationErrors) {
                     throw new Exception('Form validation failed');
                 }
                 // Updates item
                 $this->assignValuesFromPost($partner);
                 // Adds terms and conditions
                 foreach (self::$languages as $language) {
                     // In case translation for current language is missing, copies EN translation by default
                     if (Input::post('terms_' . $language)) {
                         $partner->setTerms(Input::post('terms_' . $language), $language);
                     } else {
                         $partner->setTerms(Input::post('terms_en'), $language);
                     }
                 }
                 $partner->save();
                 // Reloads page
                 $session = Session::instance();
                 $session->set($this->updatedKey, true);
                 Response::redirect('admin/partners/edit/' . $partner->get('id'));
             } catch (Exception $e) {
                 Log::debug($e->getMessage());
                 $view->set('post', Input::post());
             }
         }
     }
     $view->set('pageTitle', 'Edit Partner');
     $view->set('partner', $partner);
     $view->set('countries', Model_Country::findAll(null, 'en'));
     $view->set('country', Model_Country::find($partner->get('country')));
     $view->set('currencies', Model_Currency::find('all'));
     $view->set('validationErrors', $validationErrors);
     return $view;
 }
Exemplo n.º 11
0
 public function getForm()
 {
     $request = $this->getRequest();
     $this->view->templates = $this->getTemplates(array('mobile'));
     $config = $request->getPost('config');
     $images = $request->getPost('images');
     $pages = $request->getPost('pages');
     $store_config = Model_Settings::getSettingsPairs();
     $this->view->pages = Model_Pages::getPagesFromParent(0);
     $this->view->pages_about = array();
     $this->view->pages_about[] = array('title' => $this->translate('SEPARATOR MENU'), 'page_id' => -1);
     if ($this->view->pages) {
         foreach ($this->view->pages as $p) {
             $this->view->pages_about[] = array('title' => $p['title'], 'page_id' => $p['page_id']);
         }
     }
     $this->view->currencies = Model_Currency::getCurrencies();
     $this->view->app_path = BASE_PATH;
     //////////////////////////////////////// GENERAL ////////////////////////////////////////
     if (isset($config['config_base_domain'])) {
         $this->view->config_base_domain = $config['config_base_domain'];
     } elseif (isset($store_config['config_base_domain'])) {
         $this->view->config_base_domain = $store_config['config_base_domain'];
     } else {
         $this->view->config_base_domain = $request->getBaseUrl();
     }
     if (isset($config['config_on_facebook'])) {
         $this->view->config_on_facebook = $config['config_on_facebook'];
     } elseif (isset($store_config['config_on_facebook'])) {
         $this->view->config_on_facebook = $store_config['config_on_facebook'];
     } else {
         $this->view->config_on_facebook = '';
     }
     if (isset($config['google_analytics'])) {
         $this->view->google_analytics = $config['google_analytics'];
     } elseif (isset($store_config['google_analytics'])) {
         $this->view->google_analytics = $store_config['google_analytics'];
     }
     if (isset($config['config_fix_image_thumb_editor'])) {
         $this->view->config_fix_image_thumb_editor = $config['config_fix_image_thumb_editor'];
     } elseif (isset($store_config['config_fix_image_thumb_editor'])) {
         $this->view->config_fix_image_thumb_editor = $store_config['config_fix_image_thumb_editor'];
     }
     if (isset($config['config_fix_external_urls'])) {
         $this->view->config_fix_external_urls = $config['config_fix_external_urls'];
     } elseif (isset($store_config['config_fix_external_urls'])) {
         $this->view->config_fix_external_urls = $store_config['config_fix_external_urls'];
     }
     //////////////////////////////////////// SEO ////////////////////////////////////////
     if (isset($config['site_name'])) {
         $this->view->site_name = $config['site_name'];
     } elseif (isset($store_config['site_name'])) {
         $this->view->site_name = $store_config['site_name'];
     }
     if (isset($config['meta_title'])) {
         $this->view->meta_title = $config['meta_title'];
     } elseif (isset($store_config['meta_title'])) {
         $this->view->meta_title = $store_config['meta_title'];
     }
     if (isset($config['meta_keywords'])) {
         $this->view->meta_keywords = $config['meta_keywords'];
     } elseif (isset($store_config['meta_keywords'])) {
         $this->view->meta_keywords = $store_config['meta_keywords'];
     }
     if (isset($config['meta_description'])) {
         $this->view->meta_description = $config['meta_description'];
     } elseif (isset($store_config['meta_description'])) {
         $this->view->meta_description = $store_config['meta_description'];
     }
     //////////////////////////////////////// Options ////////////////////////////////////////
     if (isset($config['config_admin_limit'])) {
         $this->view->config_admin_limit = $config['config_admin_limit'];
     } elseif (isset($store_config['config_admin_limit'])) {
         $this->view->config_admin_limit = $store_config['config_admin_limit'];
     } else {
         $this->view->config_admin_limit = 15;
     }
     if (isset($config['config_front_limit'])) {
         $this->view->config_front_limit = $config['config_front_limit'];
     } elseif (isset($store_config['config_front_limit'])) {
         $this->view->config_front_limit = $store_config['config_front_limit'];
     } else {
         $this->view->config_front_limit = 10;
     }
     if (isset($config['template'])) {
         $this->view->template = $config['template'];
     } elseif (isset($store_config['template'])) {
         $this->view->template = $store_config['template'];
     }
     if (isset($config['config_maintenance'])) {
         $this->view->config_maintenance = $config['config_maintenance'];
     } elseif (isset($store_config['config_maintenance'])) {
         $this->view->config_maintenance = $store_config['config_maintenance'];
     } else {
         $this->view->config_maintenance = 0;
     }
     if (isset($config['config_hide_brand'])) {
         $this->view->config_hide_brand = $config['config_hide_brand'];
     } elseif (isset($store_config['config_hide_brand'])) {
         $this->view->config_hide_brand = $store_config['config_hide_brand'];
     } else {
         $this->view->config_hide_brand = 0;
     }
     $this->view->data_timezones = JO_Date_Timezones::getTimezonse();
     if (isset($config['phpSettings']['date.timezone'])) {
         $this->view->date_timezone = $config['phpSettings']['date.timezone'];
     } elseif (isset($store_config['phpSettings']['date.timezone'])) {
         $this->view->date_timezone = $store_config['phpSettings']['date.timezone'];
     } else {
         $this->view->date_timezone = 'UTC';
     }
     if (isset($config['config_disable_js'])) {
         $this->view->config_disable_js = $config['config_disable_js'];
     } elseif (isset($store_config['config_disable_js'])) {
         $this->view->config_disable_js = $store_config['config_disable_js'];
     } else {
         $this->view->config_disable_js = 0;
     }
     if (isset($config['config_pin_prefix'])) {
         $this->view->config_pin_prefix = $config['config_pin_prefix'];
     } elseif (isset($store_config['config_pin_prefix'])) {
         $this->view->config_pin_prefix = $store_config['config_pin_prefix'];
     } else {
         $this->view->config_pin_prefix = 'pin';
     }
     if (isset($config['config_user_view'])) {
         $this->view->config_user_view = $config['config_user_view'];
     } elseif (isset($store_config['config_user_view'])) {
         $this->view->config_user_view = $store_config['config_user_view'];
     } else {
         $this->view->config_user_view = 'fullname';
     }
     if (isset($config['config_gallery_pin'])) {
         $this->view->config_gallery_pin = $config['config_gallery_pin'];
     } elseif (isset($store_config['config_gallery_pin'])) {
         $this->view->config_gallery_pin = $store_config['config_gallery_pin'];
     } else {
         $this->view->config_gallery_pin = 1;
     }
     if (isset($config['config_gallery_limit'])) {
         $this->view->config_gallery_limit = $config['config_gallery_limit'];
     } elseif (isset($store_config['config_gallery_limit'])) {
         $this->view->config_gallery_limit = $store_config['config_gallery_limit'];
     } else {
         $this->view->config_gallery_limit = 5;
     }
     if (isset($config['config_home_page_view_not_loged'])) {
         $this->view->config_home_page_view_not_loged = $config['config_home_page_view_not_loged'];
     } elseif (isset($store_config['config_home_page_view_not_loged'])) {
         $this->view->config_home_page_view_not_loged = $store_config['config_home_page_view_not_loged'];
     } else {
         $this->view->config_home_page_view_not_loged = 'randum';
     }
     if (isset($config['config_home_page_view_loged'])) {
         $this->view->config_home_page_view_loged = $config['config_home_page_view_loged'];
     } elseif (isset($store_config['config_home_page_view_loged'])) {
         $this->view->config_home_page_view_loged = $store_config['config_home_page_view_loged'];
     } else {
         $this->view->config_home_page_view_loged = 'following';
     }
     if (isset($config['config_image_minimum_size'])) {
         $this->view->config_image_minimum_size = $config['config_image_minimum_size'];
     } elseif (isset($store_config['config_image_minimum_size'])) {
         $this->view->config_image_minimum_size = $store_config['config_image_minimum_size'];
     } else {
         $this->view->config_image_minimum_size = 80;
     }
     /* v2.2 */
     if (isset($config['config_enable_follow_private_profile'])) {
         $this->view->config_enable_follow_private_profile = $config['config_enable_follow_private_profile'];
     } elseif (isset($store_config['config_enable_follow_private_profile'])) {
         $this->view->config_enable_follow_private_profile = $store_config['config_enable_follow_private_profile'];
     } else {
         $this->view->config_enable_follow_private_profile = 0;
     }
     /* v2.2 */
     //////////////////////////////////////// Storage ////////////////////////////////////////
     $this->view->upload_storage = array();
     $this->view->upload_storage[] = array('key' => 'Model_Upload_Locale', 'active' => 'Model_Upload_Locale' == Helper_Config::get('file_upload_method'), 'name' => $this->translate('Locale'));
     /*$storage = (array)$this->view->callChildrenView('modules_storage');
      	if(isset($storage['modules']) && $storage['modules']) {*/
     $storage_modules = $this->getUploadStorages();
     if ($storage_modules) {
         foreach ($storage_modules as $mod) {
             if ($mod['is_installed']) {
                 $key = 'Model_Upload_' . ucfirst(strtolower($mod['key']));
                 $this->view->upload_storage[] = array('key' => $key, 'active' => $key == Helper_Config::get('file_upload_method'), 'name' => $mod['name']);
             }
         }
     }
     if (isset($config['config_comments_list'])) {
         $this->view->config_comments_list = $config['config_comments_list'];
     } elseif (isset($store_config['config_comments_list'])) {
         $this->view->config_comments_list = $store_config['config_comments_list'];
     } else {
         $this->view->config_comments_list = 0;
     }
     /////////////////////////////// CURRENCY ///////////////////////
     $this->view->currencies = array();
     $currencies = Model_Currency::getCurrencies(array('status' => 1));
     //WM_Currency::getCurrencies();
     if ($currencies) {
         $this->view->currencies = $currencies;
     }
     if (isset($config['config_currency'])) {
         $this->view->config_currency = $config['config_currency'];
     } elseif (isset($store_config['config_currency'])) {
         $this->view->config_currency = $store_config['config_currency'];
     }
     if (isset($config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $config['config_currency_auto_update'];
     } elseif (isset($store_config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $store_config['config_currency_auto_update'];
     } else {
         $this->view->config_currency_auto_update = 1;
     }
     if (isset($config['config_cache_live'])) {
         $this->view->config_cache_live = $config['config_cache_live'];
     } elseif (isset($store_config['config_cache_live'])) {
         $this->view->config_cache_live = $store_config['config_cache_live'];
     } else {
         $this->view->config_cache_live = 0;
     }
     if (isset($config['enable_free_registration'])) {
         $this->view->enable_free_registration = $config['enable_free_registration'];
     } elseif (isset($store_config['enable_free_registration'])) {
         $this->view->enable_free_registration = $store_config['enable_free_registration'];
     } else {
         $this->view->enable_free_registration = 0;
     }
     //////////////////////////////////////// Contacts ////////////////////////////////////////
     if (isset($config['admin_mail'])) {
         $this->view->admin_mail = $config['admin_mail'];
     } elseif (isset($store_config['admin_mail'])) {
         $this->view->admin_mail = $store_config['admin_mail'];
     }
     if (isset($config['report_mail'])) {
         $this->view->report_mail = $config['report_mail'];
     } elseif (isset($store_config['report_mail'])) {
         $this->view->report_mail = $store_config['report_mail'];
     }
     if (isset($config['noreply_mail'])) {
         $this->view->noreply_mail = $config['noreply_mail'];
     } elseif (isset($store_config['noreply_mail'])) {
         $this->view->noreply_mail = $store_config['noreply_mail'];
     }
     if (isset($config['mail_smtp'])) {
         $this->view->mail_smtp = $config['mail_smtp'];
     } elseif (isset($store_config['mail_smtp'])) {
         $this->view->mail_smtp = $store_config['mail_smtp'];
     } else {
         $this->view->mail_smtp = 0;
     }
     if (isset($config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $config['mail_smtp_host'];
     } elseif (isset($store_config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $store_config['mail_smtp_host'];
     }
     if (isset($config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $config['mail_smtp_port'];
     } elseif (isset($store_config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $store_config['mail_smtp_port'];
     }
     if (isset($config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $config['mail_smtp_user'];
     } elseif (isset($store_config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $store_config['mail_smtp_user'];
     }
     if (isset($config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $config['mail_smtp_password'];
     } elseif (isset($store_config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $store_config['mail_smtp_password'];
     }
     if (isset($config['mail_footer'])) {
         $this->view->mail_footer = $config['mail_footer'];
     } elseif (isset($store_config['mail_footer'])) {
         $this->view->mail_footer = $store_config['mail_footer'];
     }
     if (isset($config['not_rp'])) {
         $this->view->not_rp = $config['not_rp'];
     } elseif (isset($store_config['not_rp'])) {
         $this->view->not_rp = $store_config['not_rp'];
     } else {
         $this->view->not_rp = 0;
     }
     if (isset($config['not_rc'])) {
         $this->view->not_rc = $config['not_rc'];
     } elseif (isset($store_config['not_rc'])) {
         $this->view->not_rc = $store_config['not_rc'];
     } else {
         $this->view->not_rc = 0;
     }
     if (isset($config['not_ri'])) {
         $this->view->not_ri = $config['not_ri'];
     } elseif (isset($store_config['not_ri'])) {
         $this->view->not_ri = $store_config['not_ri'];
     } else {
         $this->view->not_ri = 0;
     }
     //////////////////////////////////////// Images ////////////////////////////////////////
     /////// logo
     $image_model = new Helper_Images();
     if (isset($images['site_logo']) && $images['site_logo']) {
         $this->view->site_logo = $images['site_logo'];
     } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) {
         $this->view->site_logo = $store_config['site_logo'];
     } else {
         $this->view->site_logo = '';
     }
     if ($this->view->site_logo) {
         $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100);
     } else {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo) {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     $this->view->preview = $image_model->resize('/logo.png', 100, 100);
     ////mobile logo
     if (isset($images['site_logo_mobile']) && $images['site_logo_mobile']) {
         $this->view->site_logo_mobile = $images['site_logo_mobile'];
     } elseif (isset($store_config['site_logo_mobile']) && $store_config['site_logo_mobile']) {
         $this->view->site_logo_mobile = $store_config['site_logo_mobile'];
     } else {
         $this->view->site_logo_mobile = '';
     }
     if ($this->view->site_logo_mobile) {
         $this->view->preview_logo_mobile = $image_model->resize($this->view->site_logo_mobile, 100, 100);
     } else {
         $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo_mobile) {
         $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100);
     }
     $this->view->preview_mobile = $image_model->resize('/logo.png', 100, 100);
     ////// no image
     if (isset($images['no_image']) && $images['no_image']) {
         $this->view->no_image = $images['no_image'];
     } elseif (isset($store_config['no_image']) && $store_config['no_image']) {
         $this->view->no_image = $store_config['no_image'];
     } else {
         $this->view->no_image = '/no_image.png';
     }
     if ($this->view->no_image) {
         $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100);
     } else {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     if (!$this->view->preview_no_image) {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     ////// no avatar
     if (isset($images['no_avatar']) && $images['no_avatar']) {
         $this->view->no_avatar = $images['no_avatar'];
     } elseif (isset($store_config['no_avatar']) && $store_config['no_avatar']) {
         $this->view->no_avatar = $store_config['no_avatar'];
     } else {
         $this->view->no_avatar = '/no-avatar.png';
     }
     if ($this->view->no_avatar) {
         $this->view->preview_no_avatar = $image_model->resize($this->view->no_avatar, 100, 100);
     } else {
         $this->view->preview_no_avatar = $image_model->resize('/no-avatar.png', 100, 100);
     }
     if (!$this->view->preview_no_avatar) {
         $this->view->preview_no_avatar = $image_model->resize('/no_image.png', 100, 100);
     }
     ////// favicon
     if (isset($images['favicon']) && $images['favicon']) {
         $this->view->favicon = $images['favicon'];
     } elseif (isset($store_config['favicon']) && $store_config['favicon']) {
         $this->view->favicon = $store_config['favicon'];
     } else {
         $this->view->favicon = '';
     }
     if ($this->view->favicon) {
         $this->view->preview_favicon = $image_model->resize($this->view->favicon, 100, 100);
     } else {
         $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100);
     }
     if (!$this->view->preview_favicon) {
         $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100);
     }
     //    	$this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     //////////////////////////////////////// PAGES ////////////////////////////////////////
     if (isset($pages['about_menu'])) {
         $this->view->about_menu = $pages['about_menu'];
     } elseif (isset($store_config['about_menu'])) {
         $this->view->about_menu = $store_config['about_menu'];
     } else {
         $this->view->about_menu = array();
     }
     if (isset($pages['page_login_trouble'])) {
         $this->view->page_login_trouble = $pages['page_login_trouble'];
     } elseif (isset($store_config['page_login_trouble'])) {
         $this->view->page_login_trouble = $store_config['page_login_trouble'];
     } else {
         $this->view->page_login_trouble = 0;
     }
     if (isset($pages['page_terms'])) {
         $this->view->page_terms = $pages['page_terms'];
     } elseif (isset($store_config['page_terms'])) {
         $this->view->page_terms = $store_config['page_terms'];
     } else {
         $this->view->page_terms = 0;
     }
     if (isset($pages['page_contact'])) {
         $this->view->page_contact = $pages['page_contact'];
     } elseif (isset($store_config['page_contact'])) {
         $this->view->page_contact = $store_config['page_contact'];
     } else {
         $this->view->page_contact = 0;
     }
     if (isset($pages['page_goodies'])) {
         $this->view->page_goodies = $pages['page_goodies'];
     } elseif (isset($store_config['page_goodies'])) {
         $this->view->page_goodies = $store_config['page_goodies'];
     } else {
         $this->view->page_goodies = 0;
     }
     if (isset($pages['delete_account'])) {
         $this->view->delete_account = $pages['delete_account'];
     } elseif (isset($store_config['delete_account'])) {
         $this->view->delete_account = $store_config['delete_account'];
     } else {
         $this->view->delete_account = 0;
     }
     if (isset($pages['support_page'])) {
         $this->view->support_page = $pages['support_page'];
     } elseif (isset($store_config['support_page'])) {
         $this->view->support_page = $store_config['support_page'];
     } else {
         $this->view->support_page = 0;
     }
     if (isset($pages['page_pinmarklet'])) {
         $this->view->page_pinmarklet = $pages['page_pinmarklet'];
     } elseif (isset($store_config['page_pinmarklet'])) {
         $this->view->page_pinmarklet = $store_config['page_pinmarklet'];
     } else {
         $this->view->page_pinmarklet = 0;
     }
     if (isset($pages['page_privacy_policy'])) {
         $this->view->page_privacy_policy = $pages['page_privacy_policy'];
     } elseif (isset($store_config['page_privacy_policy'])) {
         $this->view->page_privacy_policy = $store_config['page_privacy_policy'];
     } else {
         $this->view->page_privacy_policy = 0;
     }
     if (isset($pages['page_private_boards'])) {
         $this->view->page_private_boards = $pages['page_private_boards'];
     } elseif (isset($store_config['page_private_boards'])) {
         $this->view->page_private_boards = $store_config['page_private_boards'];
     } else {
         $this->view->page_private_boards = 0;
     }
     //////////////////////////////////////// DATES ////////////////////////////////////////
     $this->view->short_dates = array('dd.mm.yy', 'yy-mm-dd');
     $this->view->medium_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy');
     $this->view->long_dates = array('dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy');
     $this->view->long_dates_times = array('dd MM yy H:i:s', 'D, d MM y H:i:s', 'DD, dd-MM-y H:i:s', 'D, d MM yy H:i:s');
     $this->view->news_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy', 'dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy', 'dd MM yy | H:i', 'D, d MM y | H:i', 'DD, dd-MM-y | H:i', 'D, d MM yy | H:i', 'dd MM yy | H:i:s', 'D, d MM y | H:i:s', 'DD, dd-MM-y | H:i:s', 'D, d MM yy | H:i:s');
     if (isset($config['config_date_format_short'])) {
         $this->view->config_date_format_short = $config['config_date_format_short'];
     } elseif (isset($store_config['config_date_format_short'])) {
         $this->view->config_date_format_short = $store_config['config_date_format_short'];
     } else {
         $this->view->config_date_format_short = 'dd.mm.yy';
     }
     if (isset($config['config_date_format_medium'])) {
         $this->view->config_date_format_medium = $config['config_date_format_medium'];
     } elseif (isset($store_config['config_date_format_medium'])) {
         $this->view->config_date_format_medium = $store_config['config_date_format_medium'];
     } else {
         $this->view->config_date_format_medium = 'dd M yy';
     }
     if (isset($config['config_date_format_long'])) {
         $this->view->config_date_format_long = $config['config_date_format_long'];
     } elseif (isset($store_config['config_date_format_long'])) {
         $this->view->config_date_format_long = $store_config['config_date_format_long'];
     } else {
         $this->view->config_date_format_long = 'dd MM yy';
     }
     if (isset($config['config_date_format_news'])) {
         $this->view->config_date_format_news = $config['config_date_format_news'];
     } elseif (isset($store_config['config_date_format_news'])) {
         $this->view->config_date_format_news = $store_config['config_date_format_news'];
     } else {
         $this->view->config_date_format_news = 'dd MM yy | H:i';
     }
     if (isset($config['config_date_format_long_time'])) {
         $this->view->config_date_format_long_time = $config['config_date_format_long_time'];
     } elseif (isset($store_config['config_date_format_long_time'])) {
         $this->view->config_date_format_long_time = $store_config['config_date_format_long_time'];
     } else {
         $this->view->config_date_format_long_time = 'dd MM yy H:i:s';
     }
     //////////////////////////////////////// DATES ////////////////////////////////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_without_children' => true));
     if ($categories) {
         foreach ($categories as $category) {
             $this->view->categories[] = $category;
         }
     }
     if (isset($config['config_board_description_enable'])) {
         $this->view->config_board_description_enable = $config['config_board_description_enable'];
     } elseif (isset($store_config['config_board_description_enable'])) {
         $this->view->config_board_description_enable = $store_config['config_board_description_enable'];
     } else {
         $this->view->config_board_description_enable = 0;
     }
     if (isset($config['config_private_boards'])) {
         $this->view->config_private_boards = $config['config_private_boards'];
     } elseif (isset($store_config['config_private_boards'])) {
         $this->view->config_private_boards = $store_config['config_private_boards'];
     } else {
         $this->view->config_private_boards = 0;
     }
     if (isset($config['default_category_id'])) {
         $this->view->default_category_id = $config['default_category_id'];
     } elseif (isset($store_config['default_category_id'])) {
         $this->view->default_category_id = $store_config['default_category_id'];
     } else {
         $this->view->default_category_id = 0;
     }
     if (isset($config['default_boards'])) {
         $this->view->default_boards = $config['default_boards'];
     } elseif (isset($store_config['default_boards'])) {
         $this->view->default_boards = $store_config['default_boards'];
     } else {
         $this->view->default_boards = array();
     }
 }