public function indexAction() { if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } if ($this->session->get('error_permision')) { $this->view->error_permision = $this->session->get('error_permision'); $this->session->clear('error_permision'); } $request = $this->getRequest(); $this->setViewChange('form'); if ($request->isPost()) { if (!WM_Users::allow('edit', $this->getRequest()->getController())) { $this->session->set('error_permision', $this->translate('You do not have permission to this action')); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/'); } if (JO_Registry::get('license_powered_check') != 'false') { $request->setParams('config_hide_brand', 0); } Model_Settings::updateAll($request->getParams()); $config = $request->getPost('config'); if (isset($config['config_currency_auto_update']) && $config['config_currency_auto_update'] == 1) { WM_Currency::updateCurrencies($config['config_currency'], true); } $this->session->set('successfu_edite', true); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/'); } $this->getForm(); }
public static function editeCurrency($page_id, $data) { $db = JO_Db::getDefaultAdapter(); $db->update('currency', array('date_modified' => new JO_Db_Expr('NOW()'), 'status' => $data['status'], 'code' => mb_strtoupper($data['code'], 'utf-8'), 'decimal_place' => (int) $data['decimal_place'], 'value' => (double) str_replace(',', '.', $data['value']), 'decimal_point' => (string) $data['decimal_point'], 'thousand_point' => (string) $data['thousand_point'], 'symbol_left' => $data['symbol_left'], 'symbol_right' => $data['symbol_right'], 'title' => $data['title']), array('currency_id = ?' => (int) $page_id)); if (JO_Registry::get('config_currency_auto_update')) { WM_Currency::updateCurrencies(JO_Registry::get('config_currency'), true); } return $page_id; }
public function indexAction() { if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } $this->view->currency = Model_Currency::getCurrencies(); $this->view->default_currency = WM_Currency::getCurrencyCode(); }
public function __construct($options = array()) { parent::__construct($options); $cache_host = str_replace('www.', '', JO_Request::getInstance()->getServer('HTTP_HOST')); $request_path = trim(JO_Request::getInstance()->getFullUri(), ' /'); $request_path = str_replace(array('?', '&', ' '), '/', $request_path); $request_path = date('Y-m-d') . '/' . JO_Request::getInstance()->getController() . '/' . $request_path; $request_path = preg_replace('/([\\/]{2,})/', '/', $request_path); $request_path = trim($request_path, '/'); $request_path = self::fixEncoding($request_path); // var_dump($request_path); exit; if (strpos($request_path, '/') !== false) { $path = dirname($request_path) . '/'; $tmp = explode('/', $request_path); $name = $this->clearString(end($tmp)); $name = $name == 'index' ? $name . '.' . mt_rand(00, 5) : $name; $this->cache_name = $name . '.cache'; } else { $path = ''; $name = $this->clearString(trim($request_path) ? $request_path : 'home'); $name = $name == 'index' ? $name . '.' . mt_rand(00, 5) : $name; $this->cache_name = $name . '.cache'; } $folder = ''; if (class_exists('WM_Currency')) { $folder = '/' . WM_Currency::getCurrencyCode(); } // $cache_folder = BASE_PATH . '/cache/' . $cache_host . '/' . JO_Locale::findLocale() . $folder . '/' . $path; $cache_folder = BASE_PATH . '/cache/' . $cache_host . '/' . $path; if (!file_exists($cache_folder) || !is_dir($cache_folder)) { if (!file_exists($cache_folder) || !is_dir($cache_folder)) { if (@mkdir($cache_folder, 0777, true)) { $this->is_writable = true; } } else { $this->is_writable = true; } } elseif (is_writable($cache_folder)) { $this->is_writable = true; } $this->cache_dir = $cache_folder; $this->cache_path = BASE_PATH . '/cache/' . $cache_host . '/'; $this->ignore_cache[] = 'vieworder'; $this->ignore_cache[] = 'prices'; $this->ignore_cache[] = 'cron'; $this->ignore_cache[] = 'bulidUrl'; $this->ignore_cache[] = 'latest_view'; if (in_array(JO_Request::getInstance()->getController(), $this->ignore_cache)) { $this->is_writable = false; } if (in_array(JO_Request::getInstance()->getAction(), $this->ignore_cache)) { $this->is_writable = false; } }
public function indexAction() { if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } $percents = Model_Percents::getAll(); $this->view->percents = array(); if ($percents) { foreach ($percents as $percent) { $this->view->percents[] = array('id' => $percent['id'], 'percent' => $percent['percent'], 'from' => WM_Currency::format($percent['from']), 'to' => WM_Currency::format($percent['to'])); } } }
public function indexAction() { if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } $payments = Model_Membership::getAll(); $this->view->payments = array(); if ($payments) { foreach ($payments as $payment) { $payment['price'] = WM_Currency::format($payment['price']); $this->view->payments[] = $payment; } } }
public function configAction() { $request = $this->getRequest(); $this->noLayout(true); /* price formats */ $currencies = WM_Currency::getCurrencies(); $price_left = array(); $price_right = array(); if ($currencies) { foreach ($currencies as $currency) { if (trim($currency['symbol_left'])) { $price_left[] = preg_quote(trim($currency['symbol_left'])); } if (trim($currency['symbol_right'])) { $price_right[] = preg_quote(trim($currency['symbol_right'])); } } } $price = array(); if ($price_left) { $price['price_left'] = 'js:/(' . implode('|', $price_left) . ')([\\s]{0,2})?(?:(?:\\d{1,5}(?:\\,\\d{3})+)|(?:\\d+))(?:\\.\\d{2})?/'; } if ($price_right) { $price['price_right'] = 'js:/(?:(?:\\d{1,5}(?:\\,\\d{3})+)|(?:\\d+))(?:\\.\\d{2})?([\\s]{0,2})?(' . implode('|', $price_right) . ')/'; } /* config data */ $loged = JO_Session::get('user[user_id]'); $config = array('loged' => $loged, 'load_dynamically_extensions' => array(), 'load_dynamically_extensions_css' => array(), 'facebook_app_id' => null, 'regExPrice' => $price, 'comments_list' => (int) Helper_Config::get('config_comments_list'), 'disable_js' => (int) Helper_Config::get('config_disable_js'), 'invate_limit' => 5, 'baseUrl' => $request->getBaseUrl(), 'search_autocomplete' => WM_Router::create($request->getBaseUrl() . '?controller=search&action=autocomplete'), 'get_user_friends' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=friends'), 'edit_description' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=editDescription'), 'order_boards' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=sort_order'), 'resend_email_verification' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=resend'), 'createboardwithoutcategory' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=createboardwithoutcategory'), 'text' => array('text_save_description' => $this->translate('Save Description'), 'text_rearrange_boards' => $this->translate('Rearrange Boards'), 'text_save_arrangement' => $this->translate('Save Arrangement'), 'text_create_board_input' => $this->translate('Create New Board'), 'text_create_board_button' => $this->translate('Create'))); $other_config = Model_Extensions::getByMethod('extensions_config_js'); if (is_array($other_config)) { $front = $this->getFrontController(); foreach ($other_config as $ext) { $settings = Model_Extensions::getSettingsPairs($ext); if (isset($settings[$ext . '_module_status_enable']) && $settings[$ext . '_module_status_enable']) { $call = $front->formatModuleName('model_' . $ext . '_jsConfig'); $config = call_user_func(array($call, 'extendsConfig'), $config); } } } //format config $this->view->config_data = JO_Javascript::encode($config); $response = $this->getResponse(); $response->addHeader('Cache-Control: no-cache, must-revalidate'); $response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); $response->addHeader('Content-type: application/javascript; charset=utf-8'); }
public function indexAction() { if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } if ($this->session->get('error_permision')) { $this->view->error_permision = $this->session->get('error_permision'); $this->session->clear('error_permision'); } $default_currency = WM_Currency::getCurrencyCode(); $this->view->currency = array(); $currencies = Model_Currency::getCurrencies(); if ($currencies) { foreach ($currencies as $currency) { $currency['is_set'] = $default_currency == $currency['code']; $currency['format'] = WM_Currency::format(1, $currency['code'], 1); $this->view->currency[] = $currency; } } $this->view->default_currency = WM_Currency::getCurrencyCode(); }
private function getForm() { $request = $this->getRequest(); $url = ''; if ($request->getQuery('filter_id')) { $url .= '&filter_id=' . $request->getQuery('filter_id'); } if ($request->getQuery('filter_name')) { $url .= '&filter_name=' . $request->getQuery('filter_name'); } if ($request->getQuery('filter_username')) { $url .= '&filter_username='******'filter_username'); } if ($request->getQuery('filter_price')) { $url .= '&filter_price=' . $request->getQuery('filter_price'); } if ($request->getQuery('filter_sales')) { $url .= '&filter_sales=' . $request->getQuery('filter_sales'); } if ($request->getQuery('filter_profit')) { $url .= '&filter_profit=' . $request->getQuery('filter_profit'); } if ($request->getQuery('filter_free_request')) { $url .= '&filter_free_request=' . $request->getQuery('filter_free_request'); } if ($request->getQuery('filter_free_file')) { $url .= '&filter_free_file=' . $request->getQuery('filter_free_file'); } if ($request->getQuery('filter_weekly')) { $url .= '&filter_weekly=' . $request->getQuery('filter_weekly'); } if ($request->getQuery('sort')) { $url .= '&sort=' . $request->getQuery('sort'); } if ($request->getQuery('order')) { $url .= '&order=' . $request->getQuery('order'); } if ($request->getQuery('page')) { $url .= '&page=' . $request->getQuery('page'); } $id = $request->getQuery('id'); $info = Model_Items::getItem($id); if (!$info) { $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/queueitems/?' . $url); } $this->view->cancel = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/queueitems/?' . $url; $model_images = new Model_Images(); $this->view->info = $info; $this->view->price_f = WM_Currency::format($info['suggested_price']); $this->view->categories = Model_Categories::getCategoriesFromParentByModule(0, $info['module']); $cats_module = Model_Categories::getCategories(array('filter_sub_of' => 0, 'filter_module' => $info['module'], 'filter_concat' => true)); $where_attr = ''; if ($cats_module) { $tmp = array(); foreach ($cats_module as $c) { $tmp[] = "categories LIKE '%," . $c . ",%'"; } if ($tmp) { $where_attr = implode(' OR ', $tmp); } } $this->view->attributes_list = array(); $attr_cat = Model_Attributes::getAttributes(array(), $where_attr); if ($attr_cat) { foreach ($attr_cat as $row => $attr) { $attr_list = Model_Attributes::getAttributes(array('filter_sub_of' => $attr['id'])); if ($attr_list) { $this->view->attributes_list[$row] = $attr; $this->view->attributes_list[$row]['items'] = $attr_list; } } } if ($request->getPost('name')) { $this->view->name = $request->getPost('name'); } else { $this->view->name = $info['name']; } if ($request->getPost('description')) { $this->view->description = $request->getPost('description'); } else { $this->view->description = $info['description']; } if ($request->getPost('price')) { $this->view->price = $request->getPost('price'); } else { $this->view->price = ''; } if ($request->getPost('category_id')) { $this->view->category_id = $request->getPost('category_id'); } else { $this->view->category_id = Model_Items::getItemCategory($id); } if ($request->getPost('attributes')) { $this->view->attributes = $request->getPost('attributes'); } else { $this->view->attributes = Model_Items::getItemAttributes($id); } if ($request->getPost('tags')) { $this->view->tags = $request->getPost('tags'); } else { $this->view->tags = Model_Items::getItemTags($id); } if ($request->getPost('free_file')) { $this->view->free_file = $request->getPost('free_file'); } else { $this->view->free_file = $info['free_file']; } if ($request->getPost('demo_url')) { $this->view->demo_url = $request->getPost('demo_url'); } else { $this->view->demo_url = $info['demo_url']; } if ($request->getPost('weekly_from')) { $this->view->weekly_from = $request->getPost('weekly_from'); } else { $this->view->weekly_from = ''; } if ($request->getPost('weekly_to')) { $this->view->weekly_to = $request->getPost('weekly_to'); } else { $this->view->weekly_to = ''; } }
public function editAction() { $request = $this->getRequest(); if (!JO_Session::get('user_id')) { JO_Session::set('msg_error', $this->translate('You must be logged to access that page')); $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login')); } $itemID = $request->getRequest('edit'); $item = Model_Items::get($itemID); if (JO_Session::get('user_id') != $item['user_id']) { $this->redirect(WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']))); } $this->getLayout()->meta_title = $item['name']; $this->getLayout()->meta_description = substr(strip_tags(html_entity_decode($item['description'], ENT_QUOTES, 'utf-8')), 0, 255); $this->view->item_link = WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name'])); $faqs_data = Model_Faq::getAll($itemID); if (JO_Session::get('user_id') == $item['user_id'] || $faqs_data) { $this->view->faq_link = WM_Router::create($request->getBaseUrl() . '?controller=items&action=faq&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name'])); } if (JO_Session::get('user_id') == $item['user_id']) { $this->view->edit_link = WM_Router::create($request->getBaseUrl() . '?controller=items&action=edit&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name'])); $this->view->delete_link = WM_Router::create($request->getBaseUrl() . '?controller=items&action=delete&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name'])); } $this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $this->translate('Portfolio'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'username')))), array('name' => $item['name'], 'href' => $this->view->item_link), array('name' => $this->translate('Edit'))); $this->view->comment_link = WM_Router::create($request->getBaseUrl() . '?controller=items&action=comments&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name'])); $categories = Model_Categories::getMain(); if ($categories) { foreach ($categories as $category) { $this->view->categories[] = array('id' => $category['id'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=upload&action=get_categories&category_id=' . $category['id']), 'name' => $category['name']); } } $this->view->mainCategories = $categories; if (JO_Session::get('msg_success')) { $this->view->msg_success = JO_Session::get('msg_success'); JO_Session::clear('msg_success'); } elseif (JO_Session::get('msg_error')) { $this->view->error = JO_Session::get('msg_error'); $data = JO_Session::get('data'); JO_Session::clear('msg_error'); JO_Session::clear('data'); } $this->view->sel_category = isset($data) ? $data['category_id'] : reset($item['categories'][0]); $allCategories = Model_Categories::getWithChilds(); $this->view->categoriesSelect = array(); $categoriesSelect = Model_Categories::generateSelect($allCategories, $this->view->sel_category, $this->view->sel_category); if ($categoriesSelect) { $categories = explode('|', $categoriesSelect); foreach ($categories as $category) { if (!empty($category)) { $c = explode('>', $category); $this->view->categoriesSelect[] = array('id' => $c[0], 'name' => $c[1]); } } } $this->view->attributes = Model_Attributes::getAllWithCategories("attributes_categories.categories LIKE '%," . (int) $this->view->sel_category . ",%'"); $this->view->total_sales_cnt = JO_Session::get('sales'); $this->view->total_balance = WM_Currency::format(JO_Session::get('total')); $user = array('user_id' => JO_Session::get('user_id'), 'sold' => JO_Session::get('sold')); $this->view->percent = Model_Percentes::getPercentRow($user); if (isset($data)) { $item['name'] = $data['name']; $item['description'] = $data['description']; $item['theme_preview'] = $data['theme_preview']; $item['theme_preview_zip'] = $data['theme_preview_zip']; $item['main_file'] = $data['main_file']; $item['reviewer_comment'] = $data['reviewer_comment']; $item['attributes'] = $data['attributes']; isset($data['source_license']) && ($item['source_license'] = $data['source_license']); isset($data['free_request']) && ($item['free_file'] = true); } $item['suggested_price'] = isset($data['suggested_price']) ? $data['suggested_price'] : $item['price']; $item['selected_categories'] = isset($data['category']) ? $data['category'] : JO_Array::multi_array_to_single_uniq($item['categories']); $item['selected_attributes'] = isset($data['attributes']) ? JO_Array::multi_array_to_single_uniq($data['attributes']) : JO_Array::multi_array_to_single_uniq($item['attributes']); $item['selected_tags'] = isset($data['tags']) ? $data['tags'] : implode(', ', JO_Array::multi_array_to_single_uniq($item['tags'])); $help = Model_Pages::get(JO_Registry::forceGet('page_upload_item')); if ($help) { $this->view->page_upload_item = array('name' => $help['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&page_id=' . $help['id'])); } $this->view->uploaded_files = JO_Session::get('uploaded_files'); $this->view->uploaded_arhives = JO_Session::get('uploaded_arhives'); $this->view->file_upload = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=upload&action=doupload'); $this->view->action_upload = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&action=doedit'); $this->view->d = $item; $this->view->autocomplete = WM_Router::create($request->getBaseUrl() . '?controller=items&action=auto'); $this->view->children = array(); $this->view->children['header_part'] = 'layout/header_part'; $this->view->children['footer_part'] = 'layout/footer_part'; }
public function sendWeeklyAction() { $request = $this->getRequest(); $this->view->base_href = $request->getBaseUrl(); $this->view->site_name = JO_Registry::get('site_name'); $this->view->on_facebook = JO_Registry::get('config_on_facebook'); $this->view->site_logo = $this->view->base_href . 'data/images/logo.png'; if (JO_Registry::get('site_logo') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('site_logo'))) { $this->view->site_logo = $this->view->base_href . 'uploads' . JO_Registry::get('site_logo'); } $this->view->settings = WM_Router::create($this->view->base_href . '?controller=prefs'); $goodies = Model_Pages::getPage(JO_Registry::get('page_goodies')); if ($goodies) { //$this->view->pin_it = WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_goodies')); $this->view->pin_it = 'http://amatteur.com/apps'; } $this->view->pages = array(); $page = Model_Pages::getPage(JO_Registry::get('page_privacy_policy')); if ($page) { $this->view->pages[] = array('title' => $page['title'], 'href' => WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_privacy_policy'))); } $page = Model_Pages::getPage(JO_Registry::get('page_terms')); if ($page) { $this->view->pages[] = array('title' => $page['title'], 'href' => WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_privacy_policy'))); } $histories = Model_History::getHistoryToday(array('week_range' => WM_Date::x_week_range($this->now))); $no_avatar = JO_Registry::get('no_avatar'); if ($histories) { $model_images = new Helper_Images(); /* BOARDS */ $this->view->popular_bards = array(); $populars = Model_Boards::getBoards(array('start' => 0, 'limit' => 6, 'sort' => 'DESC', 'order' => 'boards.total_views', 'where' => new JO_Db_Expr('pins > 4'))); if ($populars) { foreach ($populars as $board) { $board['href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); $board['thumbs'] = array(); $get_big = false; for ($i = 0; $i < 5; $i++) { $image = isset($board['pins_array'][$i]) ? $board['pins_array'][$i]['image'] : false; if ($image) { if ($get_big) { $size = '_A'; } else { $size = '_C'; $get_big = true; } $data_img = call_user_func(array(Helper_Pin::formatUploadModule($board['pins_array'][$i]['store']), 'getPinImage'), $board['pins_array'][$i], $size); if ($data_img) { $board['thumbs'][] = $data_img['image']; } else { $board['thumbs'][] = false; } } else { $board['thumbs'][] = false; } } $board['user'] = Model_Users::getUser($board['user_id']); $board['user']['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $board['user_id']); $avatar = Helper_Uploadimages::avatar($board['user'], '_A'); $board['user']['avatar'] = $avatar['image']; $this->view->popular_bards[] = $board; } } /* VIDEO */ // $this->view->video = array(); // $video = Model_Pins::getPins(array( // 'start' => 0, // 'limit' => 1, // 'filter_is_video' => 1 // )); // // if($video) { // foreach($video AS $pin) { // $pin['thumb'] = $model_images->resizeWidth($pin['image'], 194); // $pin['thumb_width'] = $model_images->getSizes('width'); // $pin['thumb_height'] = $model_images->getSizes('height'); // $pin['description'] = Helper_Pin::descriptionFix($pin['description']); // $pin['href'] = WM_Router::create( $request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id'] ); // // } // } /* HISTORY */ foreach ($histories as $history) { if (!isset($history['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($history, '_B'); $history['avatar'] = $avatar['image']; $history['user_followers'] = WM_Router::create($this->view->base_href . '?controller=users&action=followers&user_id=' . $history['user_id']); $history['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $history['user_id']); $history['history_comments_total'] = count($history['history_comments']); $history['history_follow_total'] = count($history['history_follow']); $history['history_like_total'] = count($history['history_like']); $history['history_repin_total'] = count($history['history_repin']); $history['history_event_total'] = count($history['history_event']); /////comments if ($history['history_comments_total']) { foreach ($history['history_comments'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_comments'][$k]['avatar'] = $avatar['image']; $history['history_comments'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } /////follow if ($history['history_follow_total']) { foreach ($history['history_follow'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_follow'][$k]['avatar'] = $avatar['image']; $history['history_follow'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } /////like if ($history['history_like_total']) { foreach ($history['history_like'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_like'][$k]['avatar'] = $avatar['image']; $history['history_like'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } /////repin if ($history['history_repin_total']) { foreach ($history['history_repin'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_repin'][$k]['avatar'] = $avatar['image']; $history['history_repin'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } ////events if ($history['history_event_total']) { foreach ($history['history_event'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::event($v, '_A'); $history['history_event'][$k]['avatar'] = $avatar['image']; $history['history_event'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } $this->view->events = array(); $this->view->event = array(); $dataEvents = array('filter_cron' => $history['user_id']); $events = Model_Events::getEvents($dataEvents); if ($events) { foreach ($events as $key => $event) { $href = ""; $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $model_images = new Helper_Images(); $avatar = Helper_Uploadimages::avatar($event, '_B'); $event['avatar'] = $avatar['image']; $event['thumbs'] = $avatar['image']; $event["sport_category"] = Model_Boards::getCategoryTitle($event["sport_category"]); $data = array('filter_user_id' => $event["user_id"]); $users = Model_Users::getUsers($data); if ($users) { $event['fullname'] = $users[0]["fullname"]; $event['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']); $href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']); } //$view->boxeventdetail = WM_Router::create($request->getBaseUrl() . '?controller=events&action=boxeventdetail&event_id=' . $event['event_id']); $view->boxeventdetail = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']); $this->view->event[] = $event; $view->event = $event; $this->view->events[] = $view->render('boxEvent', 'events'); } } /* PINS */ $likes = Model_History::getHistory(array('history_action' => Model_History::LIKEPIN, 'start' => 0, 'limit' => 30), 'from_user_id', $history['user_id']); $history['pins_likes'] = array(); if ($likes) { $temp = array(); foreach ($likes as $like) { $temp[$like['pin_id']] = $like['pin_id']; } if ($temp) { $pins = Model_Pins::getPins(array('start' => 0, 'limit' => 9, 'filter_id_in' => implode(',', $temp))); if ($pins) { foreach ($pins as $pin) { $image = call_user_func(array(Helper_Pin::formatUploadModule($pin['store']), 'getPinImage'), $pin, '_B'); if ($image) { $pin['thumb'] = $image['image']; $pin['thumb_width'] = $image['width']; $pin['thumb_height'] = $image['height']; } else { continue; } $pin['description'] = Helper_Pin::descriptionFix($pin['description']); $pin['href'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id']); $pin['onto_href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $pin['user_id'] . '&board_id=' . $pin['board_id']); $pin['price_formated'] = WM_Currency::format($pin['price']); $avatar = Helper_Uploadimages::avatar($pin['user'], '_A'); $pin['user']['avatar'] = $avatar['image']; $pin['user']['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $pin['user_id']); $pin['via_profile'] = array(); if ($pin['via'] && $pin['user_via']) { $pin['via_profile'] = array('profile' => WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $pin['via']), 'fullname' => $pin['user_via']['fullname']); } $history['pins_likes'][] = $pin; } } } } $this->view->history = $history; $html = $this->view->render('sendWeekly', 'crons'); Model_Email::send($history['email'], JO_Registry::get('noreply_mail'), sprintf($this->translate('Weekly %s'), $this->view->site_name), $html); } } }
private function getForm() { $request = $this->getRequest(); $id = $request->getQuery('id'); $info = Model_Users::getWithdraw($id); if (!$info) { $url = ''; if ($this->getRequest()->getQuery('page')) { $url = '?page=' . $this->getRequest()->getQuery('page'); } $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/gainpayingup/' . $url); } $this->view->page_num = $this->getRequest()->getRequest('page', 1); $info['earning_formated'] = WM_Currency::format($info['earning']); $info['earning'] = WM_Currency::format($info['earning'], false); $date = new JO_Date($info['datetime'], 'dd MM yy'); $info['datetime'] = $date->toString(); $this->view->info = $info; }
public function buy($item, $price, $extended = 'false') { $you = Model_Users::getUser(JO_Session::get('user_id')); $deposit = 0; $earning = 0; if ($you['deposit'] > $price) { $deposit = $price; } else { $deposit = $you['deposit']; $earning = floatval($price) - floatval($you['deposit']); } $db = JO_Db::getDefaultAdapter(); $db->update(Model_Users::getPrefixDB() . 'users', array('deposit' => new JO_Db_Expr('deposit - ' . floatval($deposit)), 'earning' => new JO_Db_Expr('earning - ' . floatval($earning)), 'total' => new JO_Db_Expr('total - ' . floatval($price))), array('user_id =?' => $you['user_id'])); JO_Session::set('deposit', floatval(JO_Session::get('deposit')) - floatval($deposit)); JO_Session::set('earning', floatval(JO_Session::get('earning')) - floatval($earning)); JO_Session::set('total', floatval(JO_Session::get('total')) - floatval($price)); #ADD PRICE TO OWNER USER $user = Model_Users::getUser($item['user_id']); $percent = Model_Percentes::getPercentRow($user); $percent = $percent['percent']; $receiveMoney = floatval($price) * floatval($percent) / 100; $db->update(Model_Users::getPrefixDB() . 'users', array('earning' => new JO_Db_Expr('earning+' . floatval($receiveMoney)), 'total' => new JO_Db_Expr('total + ' . floatval($receiveMoney)), 'sold' => new JO_Db_Expr('sold + ' . floatval($price)), 'sales' => new JO_Db_Expr('sales+1')), array('user_id =?' => $user['user_id'])); #ADD ORDER $currency = WM_Currency::getCurrency(); $db->insert('orders', array('user_id' => (int) JO_Session::get('user_id'), 'owner_id' => (int) $item['user_id'], 'item_id' => (int) $item['id'], 'item_name' => $item['name'], 'price' => (double) $price, 'datetime' => new JO_Db_Expr('NOW()'), 'receive' => $receiveMoney, 'paid' => 'true', 'paid_datetime' => new JO_Db_Expr('NOW()'), 'extended' => $extended, 'type' => 'buy', 'currency_code' => $currency['code'], 'currency_value' => $currency['value'], 'module' => $item['module'])); $order_id = $db->lastInsertId(); if ($order_id && $you['referal_id'] != '0') { self::referalMoney(array('order_id' => $order_id, 'price' => $price, 'user_id' => JO_Session::get('user_id'), 'owner_id' => $item['user_id'], 'item_id' => $item['id'], 'item_name' => $item['name'], 'currency_code' => $currency['code'], 'currency_value' => $currency['value']), $you); } $db->update(Model_Users::getPrefixDB() . 'users', array('buy' => new JO_Db_Expr('buy+1')), array('user_id =?' => JO_Session::get('user_id'))); #UPDATE ITEM $toadd = array('sales' => new JO_Db_Expr('sales+1'), 'earning' => new JO_Db_Expr('earning+' . $price)); if ($extended == 'true') { $toadd['status'] = 'extended_buy'; } $db->update('items', $toadd, array('id = ?' => $item['id'])); return true; }
public function __construct($pin_id, $data = array()) { $db = JO_Db::getDefaultAdapter(); try { $db->beginTransaction(); $pin_info = new Model_Pins_Pin($pin_id); if (!$pin_info->count()) { return $this; } $pin_info = $pin_info->data; if (isset($data['board_id'])) { $board_info = new Model_Boards_Board($data['board_id']); if ($board_info->count()) { $data['board_id'] = $board_info['board_board_id']; $data['category_id'] = $board_info['board_category_id']; $data['public'] = $board_info['board_public']; } else { $data['board_id'] = 0; } } $data['likes'] = new JO_Db_Expr('(SELECT COUNT(DISTINCT user_id) FROM pins_likes WHERE pin_id = pins.pin_id)'); $data['comments'] = new JO_Db_Expr('(SELECT COUNT(DISTINCT comment_id) FROM pins_comments WHERE pin_id = pins.pin_id)'); $data['date_modified'] = WM_Date::format(time(), 'yy-mm-dd H:i:s'); $data['source_id'] = 0; //sorce if (isset($data['from']) && $data['from']) { $source = new Model_Sources_GetSourceByUrl($data['from']); if ($source->source_id) { $data['source_id'] = $source->source_id; } } $data['from_md5'] = md5(isset($data['from']) ? $data['from'] : time()); /* price */ //$data['price'] = 0; if (isset($data['price']) && $data['price']) { $currencies = WM_Currency::getCurrencies(); $price_left = array(); $price_right = array(); if ($currencies) { foreach ($currencies as $currency) { if (trim($currency['symbol_left'])) { $price_left[] = preg_quote(trim($currency['symbol_left'])); } if (trim($currency['symbol_right'])) { $price_right[] = preg_quote(trim($currency['symbol_right'])); } } if ($price_left) { if (preg_match('/(' . implode('|', $price_left) . ')([\\s]{0,2})?(?:(?:\\d{1,5}(?:\\,\\d{3})+)|(?:\\d+))(?:\\.\\d{2})?/', $data['price'], $match)) { $price_tmp = trim(str_replace(trim($match[1]), '', $match[0])); $currency = self::getCurrencyBySimbol(trim($match[1])); if ($currency) { $data['price'] = round($price_tmp / $currency, 4); } } } if (!$data['price'] && $price_right) { if (preg_match('/(?:(?:\\d{1,5}(?:\\,\\d{3})+)|(?:\\d+))(?:\\.\\d{2})?([\\s]{0,2})?(' . implode('|', $price_right) . ')/', $data['price'], $match)) { $price_tmp = trim(str_replace(trim($match[2]), '', $match[0])); $currency = self::getCurrencyBySimbol(trim($match[2])); if ($currency) { $data['price'] = round($price_tmp / $currency, 4); } } } } } /* end price */ $from = isset($data['from']) ? $data['from'] : time(); $data['is_video'] = isset($data['is_video']) && $data['is_video'] == 'true' ? 1 : 0; if (!$data['is_video']) { $auto = new Helper_AutoEmbed(); if ($auto->parseUrl($from)) { $data['is_video'] = 1; } } /* is video */ ///////////////// Event onComplete ///////////////////// $on_add_call = Helper_Config::get('pin_onbefore_edit'); if ($on_add_call) { foreach ($on_add_call as $call) { call_user_func($call, $data); } } //edit pin $result = Helper_Db::update('pins', $data, array('pin_id = ?' => $pin_id)); ///////////////// update latest pins for board ///////////////////// if (isset($data['board_id']) && $data['board_id'] && $pin_info['pin_board_id'] != $data['board_id']) { new Model_Boards_UpdateLatestPins($data['board_id']); new Model_Boards_UpdateLatestPins($pin_info['pin_board_id']); $board_info = new Model_Boards_Board($data['board_id']); if ($board_info->count()) { if ($board_info['board_cover'] == $pin_id) { $res = Helper_Db::update('boards', array('cover' => 0), array('board_id = >' => $pin_info['pin_board_id'])); if (!$result && $res) { $result = $res; } } } } ///////////////// update latest pins for user ///////////////////// new Model_Users_UpdateLatestPins($pin_info['pin_user_id']); ///////////////// Word for search index's ///////////////////// $spl = JO_Utf8::str_word_split(strip_tags(html_entity_decode($data['description'], ENT_QUOTES, 'utf-8')), self::$searchWordLenght); $words = array(); foreach ($spl as $word) { $word = mb_strtolower($word, 'utf-8'); if (!in_array($word, self::blackWordsDictionary()) && $word[0] . $word[1] != '&#') { $words[$word] = $word; } } ///////////////// Word for search index's insert ///////////////////// Helper_Db::delete('pins_invert', array('pin_id = ?' => $pin_id)); foreach ($words as $word => $data1) { $dic_id = $db->fetchOne($db->select()->from('pins_dictionary', 'dic_id')->where('word = ?', $word)); if (!$dic_id) { $dic_id = Helper_Db::insert('pins_dictionary', array('word' => $word)); } if ($dic_id) { $res = Helper_Db::insert('pins_invert', array('pin_id' => $pin_id, 'dic_id' => $dic_id)); if (!$result && $res) { $result = $res; } } } ///////////////// Extension on edit ////////////////// $extensions = Model_Extensions::getByMethod('pin_onedit'); if ($extensions) { $front = JO_Front::getInstance(); foreach ($extensions as $id => $ext) { $pin_data_ext = call_user_func(array($front->formatModuleName('model_' . $ext . '_pin'), 'onedit'), $pin_id, $data); if ($pin_data_ext && is_array($pin_data_ext)) { $data = array_merge(data, $pin_data_ext); } } } ///////////////// Event onComplete ///////////////////// $trigger = new Helper_Triggers_PinOnEdit(); $trigger->bind($pin_id); $this->affected_rows = $result; $db->commit(); } catch (JO_Exception $e) { echo $e; exit; $db->rollBack(); } }
public function membershipFormAction() { $this->view->order_info = Model_Membership::get(JO_Session::get('membership_id')); if (!$this->view->order_info) { return; } $this->view->currency = WM_Currency::getCurrency(); if (JO_Registry::forceGet('paypal_sandbox_mode')) { $this->view->url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; } else { $this->view->url = 'https://www.paypal.com/cgi-bin/webscr'; } $this->view->paypal_email = JO_Registry::forceGet('paypal_email'); $this->view->return = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=success_membership'); $this->view->notify_url = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=payments_paypal&action=callback_membership'); $this->view->cancel_return = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=membership'); $this->view->email = JO_Session::get('email'); $this->view->first_name = JO_Session::get('firstname'); $this->view->last_name = JO_Session::get('lastname'); }
public function depositIsPay($id) { $row = self::getDeposit($id); if ($row) { if ($row['added'] == 'true') { return; } $db = JO_Db::getDefaultAdapter(); if (JO_Session::get('user_id')) { $user_data = Model_Users::getUser($row['user_id']); /* razkomentirame, ako iskame da nachislqva pari na referral_id i pri deposit if($user_data['referal_id'] > 0) { $referal = Model_Users::getUser($user_data['referal_id']); $referal_cnt = JO_Registry::forceGet('referal_sum'); $percent = str_replace('%', '', JO_Registry::forceGet('referal_percent')); $sum = $row['deposit'] * ((int) $percent / 100); if($referal_cnt > 0) { $cnt = Model_Users::getTotalReferals($user_data['user_id'], $user_data['referal_id']); if(($cnt + 1) >= $referal_cnt) $user_data['referal_id'] = 0; } $db->update(Model_Users::getPrefixDB().'users', array( 'earning' => new JO_Db_Expr('earning + ' . $sum), 'total' => new JO_Db_Expr('total + ' . $sum) ), array('user_id = ?' => (int)$referal['user_id'])); $db->insert(Model_Users::getPrefixDB().'users_referals_count', array( 'user_id' => (int)$row['user_id'], 'referal_id' => (int)$referal['user_id'], 'datetime' => new JO_Db_Expr('NOW()'), 'order_type' => 'deposit', 'referal_sum' => (float) $sum )); } */ $db->update(Model_Users::getPrefixDB() . 'users', array('deposit' => new JO_Db_Expr('deposit + ' . $row['deposit']), 'total' => new JO_Db_Expr('total + ' . $row['deposit'])), array('user_id = ?' => (int) $row['user_id'])); $db->update(Model_Users::getPrefixDB() . 'deposit', array('added' => 'true'), array('id = ?' => (int) $id)); if ($user_data) { $groups = unserialize($user_data['groups']); if (is_array($groups) && count($groups) > 0) { $query_group = $db->select()->from(Model_Users::getPrefixDB() . 'user_groups')->where("ug_id IN (?)", new JO_Db_Expr(implode(',', array_keys($groups)))); $fetch_all = $db->fetchAll($query_group); $user_data['access'] = array(); if ($fetch_all) { foreach ($fetch_all as $row) { $modules = unserialize($row['rights']); if (is_array($modules)) { foreach ($modules as $module => $ison) { $user_data['access'][$module] = $module; } } } } } } if ($user_data) { if (isset($user_data['access']) && count($user_data['access'])) { $user_data['is_admin'] = true; } JO_Session::set($user_data); } } $translate = JO_Translate::getInstance(); Model_History::add($translate->translate('Deposit from') . ' ' . WM_Currency::format($row['deposit']), $id, $row['user_id']); } }
public static function setCurrency($currency) { self::$code = $currency; if (JO_Session::get('currency') != $currency) { JO_Session::set('currency', $currency); } if (JO_Request::getInstance()->getCookie('currency') != $currency) { setcookie('currency', $currency, time() + 60 * 60 * 24 * 30, '/', JO_Request::getInstance()->getServer('HTTP_HOST')); } }
public static function returnViewIndex($item, $view_name = 'index') { if (!isset($item['module']) || !$item['module']) { return; } $view = JO_View::getInstance(); if (!isset($item['no_items'])) { static $results = array(); $model_images = new Helper_Images(); $request = JO_Request::getInstance(); if (mb_strlen($item['name'], 'UTF-8') > 35) { $item['name'] = JO_Utf8::mb_cut_text($item['name'], 0, 35, ' '); } $item['price'] = WM_Currency::format($item['price']); switch ($view_name) { case 'category': $height = JO_Registry::forceGet($item['module'] . '_items_preview_height'); $item['thumbnail'] = $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width')); if (!empty($item['thumbnail'])) { $thumb_size = getimagesize($item['thumbnail']); if ($thumb_size[1] > $height) { $image = new JO_GDThumb($item['thumbnail']); $image->crop(0, 0, $thumb_size[0], $height); $image->save($item['thumbnail']); } } /* CATEGORIES */ $cats = array(); $categories = Model_Categories::getCategoriesByIds($item['categories']); foreach ($categories as $v) { $cats[] = array('name' => $v['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=categories&category_id=' . $v['id'] . '&name=' . WM_Router::clearName($v['name']))); } $item['categories'] = $cats; break; case 'downloads': $height = JO_Registry::forceGet($item['module'] . '_items_preview_height'); $item['thumbnail'] = $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width')); if (!empty($item['thumbnail'])) { $thumb_size = getimagesize($item['thumbnail']); if ($thumb_size[1] > $height) { $image = new JO_GDThumb($item['thumbnail']); $image->crop(0, 0, $thumb_size[0], $height); $image->save($item['thumbnail']); } } $item['rate'] = Model_Items::isRate($item['id']); break; default: $height = JO_Registry::forceGet($item['module'] . '_items_thumb_height'); $item['thumbnail'] = $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_thumb_width'), $height); if (!empty($item['thumbnail'])) { $thumb_size = getimagesize($item['thumbnail']); if ($thumb_size[1] > $height) { $image = new JO_GDThumb($item['thumbnail']); $image->crop(0, 0, $thumb_size[0], $height); $image->save($item['thumbnail']); } } } $item['href'] = WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name'])); $item['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'username'])); } $view->item = $item; return $view->renderByModule('single_items/' . $view_name, 'items', $item['module']); }
public function indexAction() { if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } $request = $this->getRequest(); if ($request->isPost()) { $avatar_width = $request->getParam('user_avatar_width'); if ($avatar_width > 120) { $request->getParam('user_avatar_width', 120); } $avatar_height = $request->getParam('user_avatar_height'); if ($avatar_height > 120) { $request->getParam('user_avatar_height', 120); } Model_Settings::updateAll($request->getParams()); $config = $request->getPost('config'); if (isset($config['config_currency_auto_update']) && $config['config_currency_auto_update'] == 1) { WM_Currency::updateCurrencies($config['config_currency']); } $this->session->set('successfu_edite', true); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/'); } $this->view->templates = $this->getTemplates(); $this->view->modules = WM_Modules::getList(array('update', 'install', 'admin')); $image_setings_get = WM_Modules::getConfig(); $image_setings = array(); $watermark_setings = array(); $domains_setings = array(); foreach ($image_setings_get as $module_get => $ims) { $image_setings[$module_get] = isset($ims['images']) && is_array($ims['images']) ? $ims['images'] : array(); $watermark_setings[$module_get] = isset($ims['watermark']) && is_array($ims['watermark']) ? $ims['watermark'] : array(); $domains_setings[$module_get] = isset($ims['domain']) && is_array($ims['domain']) ? $ims['domain'] : array(); } $config = $request->getPost('config'); $images = $request->getPost('images'); $pages = $request->getPost('pages'); $store_config = Model_Settings::getSettingsPairs(); $this->view->currencies = Model_Currency::getCurrencies(); $this->view->pages = Model_Pages::getPagesFromParent(0); $this->view->languages = array(); $languages = Model_Language::getLanguages(); if ($languages) { $this->view->languages = $languages; } //////////////////////////////////////// GENERAL //////////////////////////////////////// if (isset($config['referal_sum'])) { $this->view->referal_sum = $config['referal_sum']; } elseif (isset($store_config['referal_sum'])) { $this->view->referal_sum = $store_config['referal_sum']; } else { $this->view->referal_sum = 0; } if (isset($config['referal_percent'])) { $this->view->referal_percent = str_replace('%', '', $config['referal_percent']) . '%'; } elseif (isset($store_config['referal_percent'])) { $this->view->referal_percent = str_replace('%', '', $store_config['referal_percent']) . '%'; } else { $this->view->referal_percent = 0; } if (isset($config['prepaid_price_discount'])) { $this->view->prepaid_price_discount = $config['prepaid_price_discount']; } elseif (isset($store_config['prepaid_price_discount'])) { $this->view->prepaid_price_discount = $store_config['prepaid_price_discount']; } else { $this->view->prepaid_price_discount = 0; } if (isset($config['extended_price'])) { $this->view->extended_price = $config['extended_price']; } elseif (isset($store_config['extended_price'])) { $this->view->extended_price = $store_config['extended_price']; } else { $this->view->extended_price = 0; } if (isset($config['no_exclusive_author_percent'])) { $this->view->no_exclusive_author_percent = $config['no_exclusive_author_percent']; } elseif (isset($store_config['no_exclusive_author_percent'])) { $this->view->no_exclusive_author_percent = $store_config['no_exclusive_author_percent']; } else { $this->view->no_exclusive_author_percent = 0; } if (isset($config['exclusive_author_percent'])) { $this->view->exclusive_author_percent = $config['exclusive_author_percent']; } elseif (isset($store_config['exclusive_author_percent'])) { $this->view->exclusive_author_percent = $store_config['exclusive_author_percent']; } else { $this->view->exclusive_author_percent = 0; } if (isset($config['facebook_appid'])) { $this->view->facebook_appid = $config['facebook_appid']; } elseif (isset($store_config['facebook_appid'])) { $this->view->facebook_appid = $store_config['facebook_appid']; } else { $this->view->facebook_appid = ''; } if (isset($config['facebook_secret'])) { $this->view->facebook_secret = $config['facebook_secret']; } elseif (isset($store_config['facebook_secret'])) { $this->view->facebook_secret = $store_config['facebook_secret']; } else { $this->view->facebook_secret = ''; } if (isset($config['recaptcha_public_key'])) { $this->view->recaptcha_public_key = $config['recaptcha_public_key']; } elseif (isset($store_config['recaptcha_public_key'])) { $this->view->recaptcha_public_key = $store_config['recaptcha_public_key']; } else { $this->view->recaptcha_public_key = 0; } if (isset($config['recaptcha_private_key'])) { $this->view->recaptcha_private_key = $config['recaptcha_private_key']; } elseif (isset($store_config['recaptcha_private_key'])) { $this->view->recaptcha_private_key = $store_config['recaptcha_private_key']; } else { $this->view->recaptcha_private_key = 0; } if (isset($config['google_translate_key'])) { $this->view->google_translate_key = $config['google_translate_key']; } elseif (isset($store_config['google_translate_key'])) { $this->view->google_translate_key = $store_config['google_translate_key']; } else { $this->view->google_translate_key = ''; } //////////////////////////////////////// SEO //////////////////////////////////////// if (isset($config['meta_title'])) { $this->view->meta_title = $config['meta_title']; } elseif (isset($store_config['meta_title'])) { $this->view->meta_title = $store_config['meta_title']; } if (isset($config['meta_keywords'])) { $this->view->meta_keywords = $config['meta_keywords']; } elseif (isset($store_config['meta_keywords'])) { $this->view->meta_keywords = $store_config['meta_keywords']; } if (isset($config['meta_description'])) { $this->view->meta_description = $config['meta_description']; } elseif (isset($store_config['meta_description'])) { $this->view->meta_description = $store_config['meta_description']; } if (isset($config['google_analytics'])) { $this->view->google_analytics = $config['google_analytics']; } elseif (isset($store_config['google_analytics'])) { $this->view->google_analytics = $store_config['google_analytics']; } //////////////////////////////////////// Options //////////////////////////////////////// if (isset($config['admin_limit'])) { $this->view->admin_limit = $config['admin_limit']; } elseif (isset($store_config['admin_limit'])) { $this->view->admin_limit = $store_config['admin_limit']; } else { $this->view->admin_limit = 15; } if (isset($config['front_limit'])) { $this->view->front_limit = $config['front_limit']; } elseif (isset($store_config['front_limit'])) { $this->view->front_limit = $store_config['front_limit']; } else { $this->view->front_limit = 10; } if (isset($config['template'])) { $this->view->template = $config['template']; } elseif (isset($store_config['template'])) { $this->view->template = $store_config['template']; } if (isset($config['default_module'])) { $this->view->default_module = $config['default_module']; } elseif (isset($store_config['default_module'])) { $this->view->default_module = $store_config['default_module']; } if (isset($config['currency_position'])) { $this->view->currency_position = $config['currency_position']; } elseif (isset($store_config['currency_position'])) { $this->view->currency_position = $store_config['currency_position']; } else { $this->view->currency_position = 'left'; } if (isset($config['currency_decimal_places'])) { $this->view->currency_decimal_places = $config['currency_decimal_places']; } elseif (isset($store_config['currency_decimal_places'])) { $this->view->currency_decimal_places = $store_config['currency_decimal_places']; } else { $this->view->currency_decimal_places = 2; } if (isset($config['currency_decimal_point'])) { $this->view->currency_decimal_point = $config['currency_decimal_point']; } elseif (isset($store_config['currency_decimal_point'])) { $this->view->currency_decimal_point = $store_config['currency_decimal_point']; } else { $this->view->currency_decimal_point = '.'; } if (isset($config['currency_thousand_point'])) { $this->view->currency_thousand_point = $config['currency_thousand_point']; } elseif (isset($store_config['currency_thousand_point'])) { $this->view->currency_thousand_point = $store_config['currency_thousand_point']; } else { $this->view->currency_thousand_point = ','; } if (isset($config['config_language_id'])) { $this->view->config_language_id = $config['config_language_id']; } elseif (isset($store_config['config_language_id'])) { $this->view->config_language_id = $store_config['config_language_id']; } //////////////////////////////////////// Contacts //////////////////////////////////////// if (isset($config['admin_mail'])) { $this->view->admin_mail = $config['admin_mail']; } elseif (isset($store_config['admin_mail'])) { $this->view->admin_mail = $store_config['admin_mail']; } if (isset($config['report_mail'])) { $this->view->report_mail = $config['report_mail']; } elseif (isset($store_config['report_mail'])) { $this->view->report_mail = $store_config['report_mail']; } if (isset($config['mail_smtp'])) { $this->view->mail_smtp = $config['mail_smtp']; } elseif (isset($store_config['mail_smtp'])) { $this->view->mail_smtp = $store_config['mail_smtp']; } else { $this->view->mail_smtp = 0; } if (isset($config['mail_smtp_host'])) { $this->view->mail_smtp_host = $config['mail_smtp_host']; } elseif (isset($store_config['mail_smtp_host'])) { $this->view->mail_smtp_host = $store_config['mail_smtp_host']; } if (isset($config['mail_smtp_port'])) { $this->view->mail_smtp_port = $config['mail_smtp_port']; } elseif (isset($store_config['mail_smtp_port'])) { $this->view->mail_smtp_port = $store_config['mail_smtp_port']; } if (isset($config['mail_smtp_user'])) { $this->view->mail_smtp_user = $config['mail_smtp_user']; } elseif (isset($store_config['mail_smtp_user'])) { $this->view->mail_smtp_user = $store_config['mail_smtp_user']; } if (isset($config['mail_smtp_password'])) { $this->view->mail_smtp_password = $config['mail_smtp_password']; } elseif (isset($store_config['mail_smtp_password'])) { $this->view->mail_smtp_password = $store_config['mail_smtp_password']; } //////////////////////////////////////// Images //////////////////////////////////////// /////// logo $image_model = new Model_Images(); if (isset($images['site_logo']) && $images['site_logo']) { $this->view->site_logo = $images['site_logo']; } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) { $this->view->site_logo = $store_config['site_logo']; } else { $this->view->site_logo = ''; } if ($this->view->site_logo) { $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100); } else { $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100); } if (!$this->view->preview_logo) { $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100); } ////// no image if (isset($images['no_image']) && $images['no_image']) { $this->view->no_image = $images['no_image']; } elseif (isset($store_config['no_image']) && $store_config['no_image']) { $this->view->no_image = $store_config['no_image']; } else { $this->view->no_image = '/no_image.png'; } if ($this->view->no_image) { $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100); } else { $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); } if (!$this->view->preview_no_image) { $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); } $this->view->preview = $image_model->resize('/logo.png', 100, 100); // $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100); /////items $this->view->generate_item_image_form = array(); foreach ($image_setings as $mod => $data) { foreach ($data as $imagetype => $value) { $this->view->generate_item_image_form[$mod][] = array('name' => $value['name'], 'info' => isset($value['info']) ? $value['info'] : '', 'key_width' => $mod . '_items_' . $imagetype . '_width', 'key_height' => $mod . '_items_' . $imagetype . '_height'); if (isset($config[$mod . '_items_' . $imagetype . '_width'])) { $this->view->{$mod . '_items_' . $imagetype . '_width'} = $config[$mod . '_items_' . $imagetype . '_width']; } elseif (isset($store_config[$mod . '_items_' . $imagetype . '_width'])) { $this->view->{$mod . '_items_' . $imagetype . '_width'} = $store_config[$mod . '_items_' . $imagetype . '_width']; } else { $this->view->{$mod . '_items_' . $imagetype . '_width'} = isset($value['width']) ? $value['width'] : ''; } if (isset($config[$mod . '_items_' . $imagetype . '_height'])) { $this->view->{$mod . '_items_' . $imagetype . '_height'} = $config[$mod . '_items_' . $imagetype . '_height']; } elseif (isset($store_config[$mod . '_items_' . $imagetype . '_height'])) { $this->view->{$mod . '_items_' . $imagetype . '_height'} = $store_config[$mod . '_items_' . $imagetype . '_height']; } else { $this->view->{$mod . '_items_' . $imagetype . '_height'} = isset($value['height']) ? $value['height'] : ''; } } } //// watermark $this->view->generate_watermark_form = array(); foreach ($watermark_setings as $mod => $data) { foreach ($data as $imagetype => $value) { $this->view->generate_watermark_form[$mod] = array('name' => $value['name'], 'info' => $value['info'], 'key' => $mod . '_watermark_' . $imagetype); if (isset($images[$mod . '_watermark_' . $imagetype]) && $images[$mod . '_watermark_' . $imagetype]) { $this->view->{$mod . '_watermark_' . $imagetype} = $images[$mod . '_watermark_' . $imagetype]; } elseif (isset($store_config[$mod . '_watermark_' . $imagetype]) && $store_config[$mod . '_watermark_' . $imagetype]) { $this->view->{$mod . '_watermark_' . $imagetype} = $store_config[$mod . '_watermark_' . $imagetype]; } else { if (file_exists(BASE_PATH . '/uploads' . $value['image'])) { $this->view->{$mod . '_watermark_' . $imagetype} = $value['image']; } else { $this->view->{$mod . '_watermark_' . $imagetype} = ''; } } if ($this->view->{$mod . '_watermark_' . $imagetype}) { $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($this->view->{$mod . '_watermark_' . $imagetype}, 100, 100); } else { $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($value['image'], 100, 100); } if (!$this->view->{'preview_' . $mod . '_watermark_' . $imagetype}) { $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($this->view->no_image, 100, 100); } $this->view->{'default_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($value['image'], 100, 100); } } ////////////////user if (isset($config['user_avatar_width'])) { $this->view->user_avatar_width = $config['user_avatar_width']; } elseif (isset($store_config['user_avatar_width'])) { $this->view->user_avatar_width = $store_config['user_avatar_width']; } else { $this->view->user_avatar_width = 80; } if (isset($config['user_avatar_height'])) { $this->view->user_avatar_height = $config['user_avatar_height']; } elseif (isset($store_config['user_avatar_height'])) { $this->view->user_avatar_height = $store_config['user_avatar_height']; } else { $this->view->user_avatar_height = 80; } if (isset($config['user_avatar2_width'])) { $this->view->user_avatar2_width = $config['user_avatar2_width']; } elseif (isset($store_config['user_avatar2_width'])) { $this->view->user_avatar2_width = $store_config['user_avatar2_width']; } else { $this->view->user_avatar2_width = 40; } if (isset($config['user_avatar2_height'])) { $this->view->user_avatar2_height = $config['user_avatar2_height']; } elseif (isset($store_config['user_avatar2_height'])) { $this->view->user_avatar2_height = $store_config['user_avatar2_height']; } else { $this->view->user_avatar2_height = 40; } if (isset($config['user_profile_photo_width'])) { $this->view->user_profile_photo_width = $config['user_profile_photo_width']; } elseif (isset($store_config['user_profile_photo_width'])) { $this->view->user_profile_photo_width = $store_config['user_profile_photo_width']; } else { $this->view->user_profile_photo_width = 590; } if (isset($config['user_profile_photo_height'])) { $this->view->user_profile_photo_height = $config['user_profile_photo_height']; } elseif (isset($store_config['user_profile_photo_height'])) { $this->view->user_profile_photo_height = $store_config['user_profile_photo_height']; } else { $this->view->user_profile_photo_height = 242; } if (isset($config['user_public_collection_width'])) { $this->view->user_public_collection_width = $config['user_public_collection_width']; } elseif (isset($store_config['user_public_collection_width'])) { $this->view->user_public_collection_width = $store_config['user_public_collection_width']; } else { $this->view->user_public_collection_width = 260; } if (isset($config['user_public_collection_height'])) { $this->view->user_public_collection_height = $config['user_public_collection_height']; } elseif (isset($store_config['user_public_collection_height'])) { $this->view->user_public_collection_height = $store_config['user_public_collection_height']; } else { $this->view->user_public_collection_height = 140; } //////////////////////////////////////// PAGES //////////////////////////////////////// if (isset($pages['page_about'])) { $this->view->page_about = $pages['page_about']; } elseif (isset($store_config['page_about'])) { $this->view->page_about = $store_config['page_about']; } else { $this->view->page_about = 0; } if (isset($pages['page_upload_item'])) { $this->view->page_upload_item = $pages['page_upload_item']; } elseif (isset($store_config['page_upload_item'])) { $this->view->page_upload_item = $store_config['page_upload_item']; } else { $this->view->page_upload_item = 0; } if (isset($pages['page_terms'])) { $this->view->page_terms = $pages['page_terms']; } elseif (isset($store_config['page_terms'])) { $this->view->page_terms = $store_config['page_terms']; } else { $this->view->page_terms = 0; } if (isset($pages['page_regular_licence'])) { $this->view->page_regular_licence = $pages['page_regular_licence']; } elseif (isset($store_config['page_regular_licence'])) { $this->view->page_regular_licence = $store_config['page_regular_licence']; } else { $this->view->page_regular_licence = 0; } if (isset($pages['page_forum_rules'])) { $this->view->page_forum_rules = $pages['page_forum_rules']; } elseif (isset($store_config['page_forum_rules'])) { $this->view->page_forum_rules = $store_config['page_forum_rules']; } else { $this->view->page_forum_rules = 0; } if (isset($pages['page_affiliate_program'])) { $this->view->page_affiliate_program = $pages['page_affiliate_program']; } elseif (isset($store_config['page_affiliate_program'])) { $this->view->page_affiliate_program = $store_config['page_affiliate_program']; } else { $this->view->page_affiliate_program = 0; } /////////////////////////////// CURRENCY /////////////////////// $this->view->currencies = array(); $currencies = Model_Currency::getCurrencies(array('status' => 1)); //WM_Currency::getCurrencies(); if ($currencies) { $this->view->currencies = $currencies; } if (isset($config['config_currency'])) { $this->view->config_currency = $config['config_currency']; } elseif (isset($store_config['config_currency'])) { $this->view->config_currency = $store_config['config_currency']; } if (isset($config['config_currency_auto_update'])) { $this->view->config_currency_auto_update = $config['config_currency_auto_update']; } elseif (isset($store_config['config_currency_auto_update'])) { $this->view->config_currency_auto_update = $store_config['config_currency_auto_update']; } else { $this->view->config_currency_auto_update = 1; } /////////////////////////////// DOMAINS /////////////////////// $this->view->show_domain_tab = count($domains_setings) > 1; $this->view->generate_domains_setings_form = array(); foreach ($domains_setings as $mod => $data) { $this->view->generate_domains_setings_form[$mod] = array('key' => $mod); if (isset($config['default_domain'][$mod])) { $this->view->generate_domains_setings_form[$mod]['value'] = $config['default_domain'][$mod]; } elseif (isset($store_config['default_domain'][$mod])) { $this->view->generate_domains_setings_form[$mod]['value'] = $store_config['default_domain'][$mod]; } elseif (isset($data['default'])) { $this->view->generate_domains_setings_form[$mod]['value'] = $data['default']; } else { $this->view->generate_domains_setings_form[$mod]['value'] = ''; } } $this->view->show_domain_tab = false; }
public function header_partAction() { $request = $this->getRequest(); if (JO_Session::get('user[user_id]') && JO_Session::get('category_id')) { Model_Users::edit(JO_Session::get('user[user_id]'), array('first_login' => '0')); JO_Session::clear('category_id'); $this->view->user_info = JO_Session::get('user'); Model_Email::send(JO_Session::get('user[email]'), JO_Registry::get('noreply_mail'), sprintf($this->translate('Welcome to %s!'), JO_Registry::get('site_name')), $this->view->render('welcome', 'mail')); } $this->view->og_namespace = trim(JO_Registry::get('og_namespace')); $this->view->og_recipe = trim(JO_Registry::get('og_recipe')); if (!$this->view->og_recipe) { $this->view->og_namespace = ''; } $this->view->show_landing = !JO_Registry::get('enable_free_registration'); $to_title = ''; if (JO_Session::get('user[user_id]')) { $to_title = JO_Session::get('user[fullname]') . ' / '; } if ($this->getLayout()->meta_title) { $this->getLayout()->placeholder('title', $this->getLayout()->meta_title . ' - ' . JO_Registry::get('meta_title')); } else { $this->getLayout()->placeholder('title', $to_title . JO_Registry::get('meta_title')); } if ($this->getLayout()->meta_description) { $this->getLayout()->placeholder('description', $this->getLayout()->meta_description); } else { $this->getLayout()->placeholder('description', JO_Registry::get('meta_description')); } if ($this->getLayout()->meta_keywords) { $this->getLayout()->placeholder('keywords', $this->getLayout()->meta_keywords); } else { $this->getLayout()->placeholder('keywords', JO_Registry::get('meta_keywords')); } $this->getLayout()->placeholder('site_name', JO_Registry::get('site_name')); $this->view->site_name = JO_Registry::get('site_name'); $this->view->meta_title = JO_Registry::get('meta_title'); $this->getLayout()->placeholder('google_analytics', html_entity_decode(JO_Registry::get('google_analytics'), ENT_QUOTES, 'utf-8')); $this->view->baseUrl = $request->getBaseUrl(); $this->view->site_logo = $request->getBaseUrl() . 'data/images/logo.png'; if (JO_Registry::get('site_logo') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('site_logo'))) { $this->view->site_logo = $request->getBaseUrl() . 'uploads' . JO_Registry::get('site_logo'); } if (JO_Registry::get('favicon') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('favicon'))) { $this->getLayout()->placeholder('favicon', $request->getBaseUrl() . 'uploads' . JO_Registry::get('favicon')); } $this->getLayout()->placeholder('site_logo', $this->view->site_logo); $this->view->show_header_invate = !JO_Session::get('user[user_id]'); if (!JO_Session::get('user[user_id]')) { switch (true) { case $request->getAction() == 'login': $this->view->show_header_invate = true; case $request->getAction() == 'register': $this->view->show_header_invate = true; break; } } $this->view->controller_open = $request->getController(); $this->view->show_header_line = !in_array($request->getController(), array('pin')); $this->view->show_slider = !in_array($request->getController(), array('users', 'pin', 'settings', 'prefs', 'password')); if ($request->getController() == 'users') { $this->view->show_header_line = false; } //==== brand =====// $this->view->show_brand = true; if (JO_Registry::get('license_powered_check') == 'false' && JO_Registry::get('config_hide_brand')) { $this->view->show_brand = false; } ////////// CURRENCY //autoupdate currency if set if (JO_Registry::get('config_currency_auto_update')) { WM_Currency::updateCurrencies(); } $currencies = WM_Currency::getCurrencies(); $price_left = array(); $price_right = array(); if ($currencies) { foreach ($currencies as $currency) { if (trim($currency['symbol_left'])) { $price_left[] = preg_quote(trim($currency['symbol_left'])); } if (trim($currency['symbol_right'])) { $price_right[] = preg_quote(trim($currency['symbol_right'])); } } } $this->view->price_left = implode('|', $price_left); $this->view->price_right = implode('|', $price_right); //////////// Categories //////////// $this->view->categories = array(); $categories1 = array("0" => array("category_id" => "9999", "title" => "TODO", "image" => "")); $this->view->category_active = false; $categories2 = Model_Categories::getCategories(array('filter_status' => 1)); $categories = array_merge($categories1, $categories2); $x = 0; foreach ($categories as $category) { if ($x == 0) { $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']); $category['href'] = WM_Router::create($request->getBaseUrl() . '?controller=all&category_id=' . $category['category_id']); if ($request->getRequest('category_id') == 9999) { $category['active'] = TRUE; $this->view->category_active = $category['title']; } else { $category['active'] = FALSE; } $this->view->categories[] = $category; } else { $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']); $category['href'] = WM_Router::create($request->getBaseUrl() . '?controller=category&category_id=' . $category['category_id']); $category['active'] = $category['category_id'] == $request->getRequest('category_id'); if ($category['active']) { $this->view->category_active = $category['title']; } else { $i = 0; foreach ($category['subcategories'] as $subcategory) { $category['subcategories'][$i]['active'] = $subcategory['category_id'] == $request->getRequest('category_id'); if ($category['subcategories'][$i]['active']) { $this->view->category_active = $subcategory['title']; } $i++; } } $this->view->categories[] = $category; } $x = 1; } ////////////////////////////// USER MENU /////////////////////////// $this->view->is_loged = JO_Session::get('user[user_id]'); if ($this->view->is_loged) { $model_images = new Helper_Images(); $avatar = Helper_Uploadimages::avatar(JO_Session::get('user'), '_A'); $this->view->self_avatar = $avatar['image']; $this->view->self_profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $this->view->is_loged); $this->view->mails = WM_Router::create($request->getBaseUrl() . '?controller=users&action=mails'); $this->view->self_firstname = JO_Session::get('user[firstname]'); $this->view->logout = WM_Router::create($request->getBaseUrl() . '?controller=users&action=logout'); $this->view->invites = WM_Router::create($request->getBaseUrl() . '?controller=invites'); $this->view->invites_fb = WM_Router::create($request->getBaseUrl() . '?controller=invites&action=facebook'); $this->view->user_pins = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $this->view->is_loged); $this->view->user_pins_likes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $this->view->is_loged . '&filter=likes'); $this->view->settings = WM_Router::create($request->getBaseUrl() . '?controller=settings'); } $this->view->login = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'); $this->view->landing = WM_Router::create($request->getBaseUrl() . '?controller=landing'); $this->view->site_name = JO_Registry::get('site_name'); $this->view->registration = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register'); $category_id = null; if ($request->getRequest('category_id')) { $category_id = $request->getRequest('category_id'); ////////////////////////////// GIFTS /////////////////////////// $this->view->gifts = WM_Router::create($request->getBaseUrl() . '?controller=gifts&category_id=' . $category_id); $this->view->gifts1 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=1&price_to=20&category_id=' . $category_id); $this->view->gifts2 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=20&price_to=50&category_id=' . $category_id); $this->view->gifts3 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=50&price_to=100&category_id=' . $category_id); $this->view->gifts4 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=100&price_to=200&category_id=' . $category_id); $this->view->gifts5 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=200&price_to=500&category_id=' . $category_id); $this->view->gifts6 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=500&category_id=' . $category_id); //////////// Video //////////// $this->view->video_url = WM_Router::create($request->getBaseUrl() . '?controller=videos&category_id=' . $category_id); /* //////////// Popular //////////// $this->view->popular_url = WM_Router::create( $request->getBaseUrl() . '?controller=popular&category_id='.$category_id ); */ //////////// Articles //////////// $this->view->article_url = WM_Router::create($request->getBaseUrl() . '?controller=articles&category_id=' . $category_id); //////////// Ranking //////////// $this->view->pinTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=1&category_id=' . $category_id); $this->view->pinTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=2&category_id=' . $category_id); $this->view->profileTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=3&category_id=' . $category_id); $this->view->profileTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=4&category_id=' . $category_id); } else { ////////////////////////////// GIFTS /////////////////////////// $this->view->gifts = WM_Router::create($request->getBaseUrl() . '?controller=gifts'); $this->view->gifts1 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=1&price_to=20'); $this->view->gifts2 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=20&price_to=50'); $this->view->gifts3 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=50&price_to=100'); $this->view->gifts4 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=100&price_to=200'); $this->view->gifts5 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=200&price_to=500'); $this->view->gifts6 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=500'); //////////// Video //////////// $this->view->video_url = WM_Router::create($request->getBaseUrl() . '?controller=videos'); /* //////////// Popular //////////// $this->view->popular_url = WM_Router::create( $request->getBaseUrl() . '?controller=popular' ); */ //////////// Articles //////////// $this->view->article_url = WM_Router::create($request->getBaseUrl() . '?controller=articles'); //////////// Ranking //////////// $this->view->pinTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=1'); $this->view->pinTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=2'); $this->view->profileTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=3'); $this->view->profileTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=4'); } //////////// Popular //////////// $this->view->popular_url = WM_Router::create($request->getBaseUrl() . '?controller=premiostt'); //////////// ALL PINS //////////// $this->view->all_url = WM_Router::create($request->getBaseUrl() . '?controller=all'); //////////// activate //////////// $this->view->activate_url = WM_Router::create($request->getBaseUrl() . '?controller=index&action=indexActivate'); //////////// Eventtos //////////// $this->view->events_url = WM_Router::create($request->getBaseUrl() . '?controller=events'); //////////// Volunttarios //////////// if ($this->view->is_loged) { $this->view->voluntarios_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=voluntarioMenuPopup&user_id=' . $this->view->is_loged); } else { $this->view->voluntarios_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=voluntarioMenuPopup'); } ////////////////////////////// SEARCH /////////////////////////// //$this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search'); if (in_array($request->getAction(), array('advanced', 'page', 'view'))) { $with_action = $request->getAction(); $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search&action=' . $request->getAction()); } elseif (in_array($request->getAction(), array('advanced', 'advanced'))) { $with_action = $request->getAction(); $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search&action=' . $request->getAction()); } else { $with_action = 0; $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search'); } //$this->view->search_autocomplete = WM_Router::create($request->getBaseUrl() . '?controller=search&action=autocomplete'); if (strpos($this->view->search, '?') !== false) { $this->view->show_hidden = true; $this->view->with_action = $with_action; } //$this->view->keywords = $request->issetQuery('q') ? $request->getQuery('q') : $this->translate('Search...'); /* if(in_array($request->getAction(), array('amatteur'))) { $with_action = 0; $this->view->search_action_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search'); } elseif( in_array($request->getAction(), array('activate', 'services')) ) { $with_action = $request->getAction(); $this->view->search_action_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search&action='.$request->getAction()); } else { $with_action = 0; $this->view->search_action_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search'); } $this->view->search_autocomplete_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search&action=autocomplete'); if(strpos($this->view->search_advanced, '?') !== false) { $this->view->show_hidden = true; $this->view->with_action = $with_action; } $this->view->keywords = $request->issetQuery('q') ? $request->getQuery('q') : $this->translate('Search...'); */ $this->view->search_url = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced?id=amatteur'); ////////////////////////////// ADD PIN /////////////////////////// $this->view->addPin = WM_Router::create($request->getBaseUrl() . '?controller=addpin'); ////////////////////////////// MAILS /////////////////////////// $this->view->addMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=create'); $this->view->stateMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=state'); $this->view->viewMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=view'); ////////////////////////////// FULL URL /////////////////////////// $this->view->full_url_js = false; switch (true) { case 'index' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl()); break; case 'search' == $request->getController(): if (in_array($request->getAction(), array('index', 'page', 'view'))) { $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=search&q=' . $request->getRequest('q')); } else { $parametros = ""; $this->view->keywords = $request->issetQuery('location') ? $request->getQuery('location') : $this->translate('Search...'); /* if ($request->issetPost('firstname')) { $parametros .= "&firstname=". $request->getPost('firstname'); } if ($request->issetPost('words')) { $parametros .= "&words=". $request->getPost('words'); } if ($request->issetPost('location')) { $parametros .= "&location=". $request->getPost('location'); } if ($request->issetPost('sport_category_1')) { $parametros .= "&sport_category_1=". $request->getPost('sport_category_1'); } if ($request->issetPost('sport_category_2')) { $parametros .= "&sport_category_2=". $request->getPost('sport_category_2'); } if ($request->issetPost('sport_category_3')) { $parametros .= "&sport_category_3=". $request->getPost('sport_category_3'); } if ($request->issetPost('type_user')) { $parametros .= "&type_user="******"&gender=". $request->getRequest('gender'); } //location if ($request->issetPost('location')) { $parametros .= "&location=". $request->getPost('location'); } //sport category if ($request->issetPost('sport_category')) { $parametros .= "&sport_category=". $request->getPost('sport_category'); } //age if ($request->issetPost('age')) { $parametros .= "&age=". $request->getPost('age'); } //level if ($request->issetPost('level')) { $parametros .= "&level=". $request->getPost('level'); } //option1 if ($request->issetPost('option1')) { $parametros .= "&option1=". $request->getPost('option1'); } //option2 if ($request->issetPost('option2')) { $parametros .= "&option2=". $request->getPost('option2'); } //option3 if ($request->issetPost('option3')) { $parametros .= "&option3=". $request->getPost('option3'); } //option4 if ($request->issetPost('option4')) { $parametros .= "&option4=". $request->getPost('option4'); } //option5 if ($request->issetPost('option5')) { $parametros .= "&option5=". $request->getPost('option5'); } //option6 if ($request->issetPost('option6')) { $parametros .= "&option6=". $request->getPost('option6'); } //option7 if ($request->issetPost('option7')) { $parametros .= "&option7=". $request->getPost('option7'); } //option8 if ($request->issetPost('option8')) { $parametros .= "&option8=". $request->getPost('option8'); } //option9 if ($request->issetPost('option9')) { $parametros .= "&option9=". $request->getPost('option9'); } //option10 if ($request->issetPost('option10')) { $parametros .= "&option10=". $request->getPost('option10'); } //option11 if ($request->issetPost('option11')) { $parametros .= "&option11=". $request->getPost('option11'); } //option12 if ($request->issetPost('option12')) { $parametros .= "&option12=". $request->getPost('option12'); } //option13 if ($request->issetPost('option13')) { $parametros .= "&option13=". $request->getPost('option13'); } //option14 if ($request->issetPost('option14')) { $parametros .= "&option14=". $request->getPost('option14'); } //option15 if ($request->issetPost('option15')) { $parametros .= "&option15=". $request->getPost('option15'); } //option16 if ($request->issetPost('option16')) { $parametros .= "&option16=". $request->getPost('option16'); } //option17 if ($request->issetPost('option17')) { $parametros .= "&option17=". $request->getPost('option17'); } //option18 if ($request->issetPost('option18')) { $parametros .= "&option18=". $request->getPost('option18'); } * */ if ($request->issetRequest('zoom')) { $parametros .= "&zoom=" . $request->getRequest('zoom'); } if ($request->issetRequest('id')) { $parametros .= "&id=" . $request->getRequest('id'); } if ($request->issetRequest('firstname')) { $parametros .= "&firstname=" . $request->getRequest('firstname'); } if ($request->issetRequest('words')) { $parametros .= "&words=" . $request->getRequest('words'); } if ($request->issetRequest('location')) { $parametros .= "&location=" . $request->getRequest('location'); } if ($request->issetRequest('sport_category_1')) { $parametros .= "&sport_category_1=" . $request->getRequest('sport_category_1'); } if ($request->issetRequest('sport_category_2')) { $parametros .= "&sport_category_2=" . $request->getRequest('sport_category_2'); } if ($request->issetRequest('sport_category_3')) { $parametros .= "&sport_category_3=" . $request->getRequest('sport_category_3'); } if ($request->issetRequest('type_user')) { $parametros .= "&type_user="******"&gender=" . $request->getRequest('gender'); } //location if ($request->issetRequest('location')) { $parametros .= "&location=" . $request->getRequest('location'); } //sport category if ($request->issetRequest('sport_category')) { $parametros .= "&sport_category=" . $request->getRequest('sport_category'); } //age if ($request->issetRequest('age')) { $parametros .= "&age=" . $request->getRequest('age'); } //level if ($request->issetRequest('level')) { $parametros .= "&level=" . $request->getRequest('level'); } //option1 if ($request->issetRequest('option1')) { $parametros .= "&option1=" . $request->getRequest('option1'); } //option2 if ($request->issetRequest('option2')) { $parametros .= "&option2=" . $request->getRequest('option2'); } //option3 if ($request->issetRequest('option3')) { $parametros .= "&option3=" . $request->getRequest('option3'); } //option4 if ($request->issetRequest('option4')) { $parametros .= "&option4=" . $request->getRequest('option4'); } //option5 if ($request->issetRequest('option5')) { $parametros .= "&option5=" . $request->getRequest('option5'); } //option6 if ($request->issetRequest('option6')) { $parametros .= "&option6=" . $request->getRequest('option6'); } //option7 if ($request->issetRequest('option7')) { $parametros .= "&option7=" . $request->getRequest('option7'); } //option8 if ($request->issetRequest('option8')) { $parametros .= "&option8=" . $request->getRequest('option8'); } //option9 if ($request->issetRequest('option9')) { $parametros .= "&option9=" . $request->getRequest('option9'); } //option10 if ($request->issetRequest('option10')) { $parametros .= "&option10=" . $request->getRequest('option10'); } //option11 if ($request->issetRequest('option11')) { $parametros .= "&option11=" . $request->getRequest('option11'); } //option12 if ($request->issetRequest('option12')) { $parametros .= "&option12=" . $request->getRequest('option12'); } //option13 if ($request->issetRequest('option13')) { $parametros .= "&option13=" . $request->getRequest('option13'); } //option14 if ($request->issetRequest('option14')) { $parametros .= "&option14=" . $request->getRequest('option14'); } //option15 if ($request->issetRequest('option15')) { $parametros .= "&option15=" . $request->getRequest('option15'); } //option16 if ($request->issetRequest('option16')) { $parametros .= "&option16=" . $request->getRequest('option16'); } //option17 if ($request->issetRequest('option17')) { $parametros .= "&option17=" . $request->getRequest('option17'); } //option18 if ($request->issetRequest('option18')) { $parametros .= "&option18=" . $request->getRequest('option18'); } $parametros .= "&kk=kk"; $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=search&action=' . $request->getAction() . '&q=' . $request->getRequest('q') . '&id=' . $request->getRequest('id') . $parametros); } break; case 'all' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=all'); break; case 'videos' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=videos'); break; case 'popular' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=popular'); break; case 'category' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=category&category_id=' . $request->getRequest('category_id')); break; case 'source' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=source&source_id=' . $request->getRequest('source_id')); break; case 'boards' == $request->getController() && in_array($request->getAction(), array('index', 'page')): $url = ''; if ($request->getRequest('user_id')) { $url = '&user_id=' . $request->getRequest('user_id'); } $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view' . $url . '&board_id=' . $request->getRequest('board_id')); break; case 'gifts' == $request->getController(): $url = ''; if ($request->issetParam('price_from')) { $url .= (int) $request->getRequest('price_from'); } if ($request->issetParam('price_to')) { $url .= ':' . (int) $request->getRequest('price_to'); } $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=gifts' . ($url ? '&action=' . $url : '')); break; case 'users' == $request->getController(): if (in_array($request->getAction(), array('pins', 'followers', 'following', 'likers', 'liking', 'activity')) && $request->getRequest('user_id')) { $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=users&action=' . $request->getAction() . '&user_id=' . $request->getRequest('user_id') . ($request->getQuery('filter') ? '&filter=' . $request->getQuery('filter') : '')); } break; } if ($request->getRequest('user_id')) { $user_info = Model_Users::getUser($request->getRequest('user_id')); if ($user_info && $user_info['dont_search_index']) { $this->getLayout()->placeholder('inhead', '<meta name="robots" content="noindex"/>'); } } ////////////////////////////// ABOUT MENU /////////////////////////// $this->view->about_menu = array(); $has = false; if (is_array(JO_Registry::forceGet('about_menu'))) { foreach (JO_Registry::forceGet('about_menu') as $row => $page_id) { if ($row == 0) { $class = 'first'; } else { if (count(JO_Registry::forceGet('about_menu')) - 1 == $row) { $class = 'last'; } else { $class = ''; } } // $class = $row==0?' first':''; if ($page_id == -1) { $has = true; } else { $pinfo = Model_Pages::getPage($page_id); if ($pinfo && $pinfo['status']) { if ($has) { $class .= " group"; $has = false; } $this->view->about_menu[] = array('class' => trim($class), 'title' => $pinfo['title'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_id)); } } } } ////////////////////////////// NEW PASSWORD /////////////////////////// $this->view->show_new_password = false; if (JO_Session::get('user[user_id]') && JO_Session::get('user[email]') != JO_Session::get('user[new_email]')) { switch (true) { case 'index' == $request->getController(): case 'all' == $request->getController(): case 'category' == $request->getController(): case 'videos' == $request->getController(): case 'popular' == $request->getController(): case 'gifts' == $request->getController(): $this->view->show_new_password = true; break; } } ////////////////////////////// Board category /////////////////////////// if (is_array($board_info = JO_Registry::forceGet('board_category_change'))) { $this->view->board_category_change = array('title' => $board_info['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id'])); } }
public function editAction() { // var_dump( htmlspecialchars('⚐') );exit; $request = $this->getRequest(); $pin_id = $request->getRequest('pin_id'); // $pin_info = Model_Pins::getPin($pin_id); $pin_info = new Model_Pins_Pin($pin_id); if (!$pin_info->count() || $pin_info->data['pin_user_id'] != JO_Session::get('user[user_id]')) { $this->forward('error', 'error404'); } $pin_info = $pin_info->data; if ($request->isPost()) { $validate = new Helper_Validate(); if ($pin_info['pin_from']) { $validate->_set_rules($request->getPost('from'), $this->translate('Link'), 'not_empty;min_length[3];domain'); } else { if (trim($request->getPost('from'))) { $validate->_set_rules($request->getPost('from'), $this->translate('Link'), 'not_empty;min_length[3];domain'); } } $data = $request->getPost(); if ($validate->_valid_form()) { $edit = new Model_Pins_Edit($pin_id, $request->getPost()); $this->redirect(WM_Router::pinAction($pin_info['pin_pin_id'])); } else { $this->view->error = $validate->_get_error_messages(); } foreach ($data as $k => $v) { if (isset($pin_info['pin_' . $k])) { $pin_info['pin_' . $k] = $v; } } } $pin_info['images'] = Helper_Uploadimages::pinThumbs($pin_info); if ($pin_info['pin_gift']) { $pin_info['price_formated'] = WM_Currency::format($pin_info['pin_price']); } else { $pin_info['price_formated'] = ''; $pin_info['pin_price'] = 0; } $pin_info['href'] = WM_Router::pinAction($pin_info['pin_pin_id']); $this->view->pin_info = $pin_info; $view->get_user_friends = WM_Router::create($request->getBaseUrl() . '?controller=users&action=friends'); $boards = new Model_Boards_BoardsWithShared(array('filter_user_id' => JO_Session::get('user[user_id]'))); $this->view->boards = array(); if ($boards->count()) { foreach ($boards as $board) { $this->view->boards[] = array('board_id' => $board['board_board_id'], 'title' => $board['board_title']); } } ///////////////// Extension on edit ////////////////// $this->view->form_extensions = array(); $extensions = Model_Extensions::getByMethod('pin_oneditform'); if ($extensions) { $front = JO_Front::getInstance(); foreach ($extensions as $id => $ext) { $this->view->form_extensions[] = array('html' => $this->view->callChildren('modules_' . $ext . '_oneditform'), 'view' => $this->view->callChildrenView('modules_' . $ext . '_oneditform'), 'key' => $ext); } } $this->view->pin_delete = WM_Router::pinAction($pin_id, 'delete'); $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); }
public function balanceAction() { $this->view->page_num = $this->getRequest()->getQuery('page'); $this->view->user_id = $balance_id = $this->getRequest()->getQuery('id'); $request = $this->getRequest(); $url = ''; if ($request->getQuery('sort')) { $url .= '&sort=' . $request->getQuery('sort'); } if ($request->getQuery('order')) { $url .= '&order=' . $request->getQuery('order'); } if ($request->getQuery('page')) { $url .= '&page=' . $request->getQuery('page'); } if ($request->getQuery('filter_id')) { $url .= '&filter_id=' . $request->getQuery('filter_id'); } if ($request->getQuery('filter_username')) { $url .= '&filter_username='******'filter_username'); } if ($request->getQuery('filter_total')) { $url .= '&filter_total=' . $request->getQuery('filter_total'); } if ($request->getQuery('filter_sales')) { $url .= '&filter_sales=' . $request->getQuery('filter_sales'); } if ($request->getQuery('filter_sold')) { $url .= '&filter_sold=' . $request->getQuery('filter_sold'); } if ($request->getQuery('filter_web_profit2')) { $url .= '&filter_web_profit2=' . $request->getQuery('filter_web_profit2'); } if ($request->getQuery('filter_commission')) { $url .= '&filter_commission=' . $request->getQuery('filter_commission'); } if ($request->getQuery('filter_items')) { $url .= '&filter_items=' . $request->getQuery('filter_items'); } if ($request->getQuery('filter_referals')) { $url .= '&filter_referals=' . $request->getQuery('filter_referals'); } if ($request->getQuery('filter_referal_money')) { $url .= '&filter_referal_money=' . $request->getQuery('filter_referal_money'); } if ($request->getQuery('filter_featured_author')) { $url .= '&filter_featured_author=' . $request->getQuery('filter_featured_author'); } if ($request->getQuery('id')) { $url .= '&id=' . $request->getQuery('id'); } $user_info = Model_Users::getUser($balance_id); if (!$user_info) { $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/users/?' . $url); } $this->view->createBalans = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/users/createBalance/?' . $url; $this->view->back_href = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/users/?' . $url; $this->view->username = $user_info['username']; if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } $this->view->balances = array(); $balances = Model_Users::getBalances($balance_id); if ($balances) { foreach ($balances as $balance) { $last_login_datetime = new JO_Date($balance['datetime'], 'dd MM yy'); $balance['datetime'] = $last_login_datetime->toString(); $balance['deposit'] = WM_Currency::format($balance['deposit']); $balance['edit'] = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/users/editBalance/?bid=' . $balance['id'] . $url; $this->view->balances[] = $balance; } } }
private function getForm() { $request = $this->getRequest(); $url = ''; if ($request->getQuery('filter_id')) { $url .= '&filter_id=' . $request->getQuery('filter_id'); } if ($request->getQuery('filter_name')) { $url .= '&filter_name=' . $request->getQuery('filter_name'); } if ($request->getQuery('filter_username')) { $url .= '&filter_username='******'filter_username'); } if ($request->getQuery('filter_price')) { $url .= '&filter_price=' . $request->getQuery('filter_price'); } if ($request->getQuery('filter_sales')) { $url .= '&filter_sales=' . $request->getQuery('filter_sales'); } if ($request->getQuery('filter_profit')) { $url .= '&filter_profit=' . $request->getQuery('filter_profit'); } if ($request->getQuery('filter_free_request')) { $url .= '&filter_free_request=' . $request->getQuery('filter_free_request'); } if ($request->getQuery('filter_free_file')) { $url .= '&filter_free_file=' . $request->getQuery('filter_free_file'); } if ($request->getQuery('filter_weekly')) { $url .= '&filter_weekly=' . $request->getQuery('filter_weekly'); } if ($request->getQuery('sort')) { $url .= '&sort=' . $request->getQuery('sort'); } if ($request->getQuery('order')) { $url .= '&order=' . $request->getQuery('order'); } if ($request->getQuery('page')) { $url .= '&page=' . $request->getQuery('page'); } $id = $request->getQuery('id'); $info = Model_Items::getItemUpdate($id); if (!$info) { $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/queueupdateditems/?' . $url); } $this->view->cancel = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/queueupdateditems/?' . $url; $model_images = new Model_Images(); $info['thumbnail'] = $model_images->resize($info['thumbnail'], JO_Registry::forceGet($info['module'] . '_items_thumb_width'), JO_Registry::forceGet($info['module'] . '_items_thumb_height'), true); if ((int) JO_Registry::get($info['module'] . '_items_preview_width') && (int) JO_Registry::get($info['module'] . '_items_preview_height')) { $info['theme_preview_thumbnail'] = $model_images->resize($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_width'), JO_Registry::forceGet($info['module'] . '_items_preview_height'), true); } elseif ((int) JO_Registry::get($info['module'] . '_items_preview_width')) { $info['theme_preview_thumbnail'] = $model_images->resizeWidth($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_width')); } elseif ((int) JO_Registry::get($info['module'] . '_items_preview_height')) { $info['theme_preview_thumbnail'] = $model_images->resizeHeight($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_height')); } else { $info['theme_preview_thumbnail'] = false; } $this->view->info = $info; $this->view->price_f = WM_Currency::format($info['suggested_price']); $this->view->categories = Model_Categories::getCategoriesFromParentByModule(0, $info['module']); $cats_module = Model_Categories::getCategories(array('filter_sub_of' => 0, 'filter_module' => $info['module'], 'filter_concat' => true)); $where_attr = ''; if ($cats_module) { $tmp = array(); foreach ($cats_module as $c) { $tmp[] = "categories LIKE '%," . $c . ",%'"; } if ($tmp) { $where_attr = implode(' OR ', $tmp); } } $this->view->attributes_list = array(); $attr_cat = Model_Attributes::getAttributes(array(), $where_attr); if ($attr_cat) { foreach ($attr_cat as $row => $attr) { $attr_list = Model_Attributes::getAttributes(array('filter_sub_of' => $attr['id'])); if ($attr_list) { $this->view->attributes_list[$row] = $attr; $this->view->attributes_list[$row]['items'] = $attr_list; } } } if ($request->getPost('name')) { $this->view->name = $request->getPost('name'); } else { $this->view->name = $info['name']; } if ($request->getPost('description')) { $this->view->description = $request->getPost('description'); } else { $this->view->description = $info['description']; } if ($request->getPost('price')) { $this->view->price = $request->getPost('price'); } else { $this->view->price = $info['price']; } if ($request->getPost('category_id')) { $this->view->category_id = $request->getPost('category_id'); } else { $this->view->category_id = Model_Items::getItemCategory($id); } if ($request->getPost('attributes')) { $this->view->attributes = $request->getPost('attributes'); } else { $this->view->attributes = Model_Items::getItemAttributes($id); } if ($request->getPost('tags')) { $this->view->tags = $request->getPost('tags'); } else { // $this->view->tags = Model_Items::getItemTagsUpdate($id); $this->view->tags = Model_Items::getItemTags($id); } if ($request->getPost('free_file')) { $this->view->free_file = $request->getPost('free_file'); } else { $this->view->free_file = $info['free_file']; } if ($request->getPost('demo_url')) { $this->view->demo_url = $request->getPost('demo_url'); } else { $this->view->demo_url = $info['demo_url']; } if ($request->getPost('weekly_from')) { $this->view->weekly_from = $request->getPost('weekly_from'); } else { $this->view->weekly_from = ''; } if ($request->getPost('weekly_to')) { $this->view->weekly_to = $request->getPost('weekly_to'); } else { $this->view->weekly_to = ''; } if ($request->getPost('default_price')) { $this->view->default_price = $request->getPost('default_price'); } else { $this->view->default_price = ''; } /* sizes */ $prices = Model_Items_Image::getPriceItem($id); $sizes = Model_Sizes::getAll(); $this->view->sizes = array(); if ($sizes) { $filesize = false; if ($info['main_file'] && file_exists(BASE_PATH . '/uploads/' . $info['main_file'])) { $info_file = getimagesize(BASE_PATH . '/uploads/' . $info['main_file']); $filesize = $info_file[0] * $info_file[1]; } foreach ($sizes as $k => $size) { $price = isset($prices[$size['id']]) ? $prices[$size['id']] : ''; if ($filesize && $size['size'] * 1000000 <= $filesize) { $size['post_price'] = $request->issetPost('price[' . $size['id'] . ']') ? $request->getPost('price[' . $size['id'] . ']') : $price; $size['size'] = round($size['size'], 2); $this->view->sizes[$k] = $size; $this->view->default_price = $this->view->default_price ? $this->view->default_price : ($size['post_price'] == $info['price'] ? $size['id'] : ''); } } if (!$this->view->default_price) { foreach ($sizes as $k => $size) { if ($filesize && $size['size'] * 1000000 <= $filesize) { $this->view->default_price = $size['id']; break; } } } } }
public function indexAction() { if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } $request = $this->getRequest(); $this->view->page_num = $page = $request->getRequest('page', 1); $this->view->sort = $request->getRequest('sort', 'DESC'); $this->view->order = $request->getRequest('order', 'i.id'); $this->view->filter_id = $request->getQuery('filter_id'); $this->view->filter_name = $request->getQuery('filter_name'); $this->view->filter_username = $request->getQuery('filter_username'); $this->view->filter_price = $request->getQuery('filter_price'); $this->view->filter_sales = $request->getQuery('filter_sales'); $this->view->filter_profit = $request->getQuery('filter_profit'); $this->view->filter_free_request = $request->getQuery('filter_free_request'); $this->view->filter_free_file = $request->getQuery('filter_free_file'); $this->view->filter_weekly = $request->getQuery('filter_weekly'); $this->view->filter_user_id = $request->getQuery('filter_user_id'); $this->view->filter_web_profit = $request->getQuery('filter_web_profit'); $this->view->filter_refferals = $request->getQuery('filter_refferals'); $url = ''; if ($this->view->filter_id) { $url .= '&filter_id=' . $this->view->filter_id; } if ($this->view->filter_name) { $url .= '&filter_name=' . $this->view->filter_name; } if ($this->view->filter_username) { $url .= '&filter_username='******'&filter_user_id=' . $this->view->filter_user_id; } if ($this->view->filter_price) { $url .= '&filter_price=' . $this->view->filter_price; } if ($this->view->filter_sales) { $url .= '&filter_sales=' . $this->view->filter_sales; } if ($this->view->filter_profit) { $url .= '&filter_profit=' . $this->view->filter_profit; } if ($this->view->filter_free_request) { $url .= '&filter_free_request=' . $this->view->filter_free_request; } if ($this->view->filter_free_file) { $url .= '&filter_free_file=' . $this->view->filter_free_file; } if ($this->view->filter_weekly) { $url .= '&filter_weekly=' . $this->view->filter_weekly; } $url1 = ''; if ($this->view->sort) { $url1 .= '&sort=' . $this->view->sort; } if ($this->view->order) { $url1 .= '&order=' . $this->view->order; } $url2 = '&page=' . $page; $data = array('start' => $page * JO_Registry::get('admin_limit') - JO_Registry::get('admin_limit'), 'limit' => JO_Registry::get('admin_limit'), 'sort' => $this->view->sort, 'order' => $this->view->order, 'filter_id' => $this->view->filter_id, 'filter_name' => $this->view->filter_name, 'filter_username' => $this->view->filter_username, 'filter_price' => $this->view->filter_price, 'filter_sales' => $this->view->filter_sales, 'filter_profit' => $this->view->filter_profit, 'filter_free_request' => $this->view->filter_free_request, 'filter_free_file' => $this->view->filter_free_file, 'filter_weekly' => $this->view->filter_weekly, 'filter_user_id' => $this->view->filter_user_id, 'filter_web_profit' => $this->view->filter_web_profit, 'filter_refferals' => $this->view->filter_refferals, 'filter_status' => 'active'); $this->view->items = array(); $items = Model_Items::getItems($data); if ($items) { foreach ($items as $item) { $this->view->items[] = array('id' => $item['id'], 'user_id' => $item['user_id'], 'href' => WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&item_id=' . $item['id']), 'name' => $item['name'], 'username' => $item['username'], 'name' => $item['name'], 'price' => WM_Currency::format($item['price']), 'sales' => $item['sales'], 'receive' => WM_Currency::format($item['sum_receive']), 'profit' => WM_Currency::format($item['earning']), 'web_profit' => WM_Currency::format($item['web_profit']), 'web_profit2' => WM_Currency::format($item['web_profit2']), 'has_referral_sum' => $item['referral_sum'], 'referral_sum' => WM_Currency::format($item['referral_sum']), 'free_request' => $item['free_request'] == 'true', 'free_file' => $item['free_file'] == 'true', 'weekly_from' => $item['weekly_from'] != '0000-00-00' ? JO_Date::getInstance($item['weekly_from'], 'dd.mm.yy', true)->toString() : '', 'weekly_to' => $item['weekly_to'] != '0000-00-00' ? JO_Date::getInstance($item['weekly_to'], 'dd.mm.yy', true)->toString() : '', 'comments' => $item['comments'], 'edit' => $request->getModule() . '/items/edit/?m=' . $item['module'] . '&id=' . $item['id'] . $url . $url1 . $url2, 'comments_href' => $request->getModule() . '/items/comments/?id=' . $item['id'] . $url . $url1 . $url2); } } $this->view->sort = strtolower($this->view->sort); $this->view->sort_id = $request->getModule() . '/items/?order=i.id&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_name = $request->getModule() . '/items/?order=i.name&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_username = $request->getModule() . '/items/?order=u.username&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_price = $request->getModule() . '/items/?order=i.price&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_sales = $request->getModule() . '/items/?order=i.sales&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_earning = $request->getModule() . '/items/?order=i.earning&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_free_request = $request->getModule() . '/items/?order=i.free_request&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_free_file = $request->getModule() . '/items/?order=i.free_file&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_web_profit = $request->getModule() . '/items/?order=web_profit2&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_referral_sum = $request->getModule() . '/items/?order=referral_sum&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $total_records = Model_Items::getTotalItems($data); $this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit')); $this->view->total_rows = $total_records; $pagination = new Model_Pagination(); $pagination->setLimit(JO_Registry::get('admin_limit')); $pagination->setPage($page); $pagination->setTotal($total_records); $pagination->setUrl($this->getRequest()->getModule() . '/items/?page={page}' . $url . $url1); $this->view->pagination = $pagination->render(); }
public function indexAction() { $request = $this->getRequest(); if ($request->getQuery('from')) { $this->view->from = $request->getQuery('from'); } else { $date = new JO_Date(null, 'yy-mm-01'); $this->view->from = $date->toString(); } if ($request->getQuery('to')) { $this->view->to = $request->getQuery('to'); } else { $date = new JO_Date(null, 'yy-mm-t'); $this->view->to = $date->toString(); } $reportData = Model_Reports::getReport($this->view->from, $this->view->to); $depositData = Model_Reports::getDeposits($this->view->from, $this->view->to); $withdrawData = Model_Reports::getWithdraws($this->view->from, $this->view->to); $data = array(); foreach ($reportData as $date => $v) { $data[$date] = array(); } foreach ($depositData as $date => $v) { $data[$date] = array(); } foreach ($withdrawData as $date => $v) { $data[$date] = array(); } foreach ($data as $k => $v) { if (isset($reportData[$k])) { $data[$k]['total'] = $reportData[$k]['total']; $data[$k]['receive'] = $reportData[$k]['receive']; $data[$k]['referal'] = $reportData[$k]['referal']; $data[$k]['win'] = $reportData[$k]['win']; $data[$k]['total_for'] = WM_Currency::format($reportData[$k]['total']); $data[$k]['receive_for'] = WM_Currency::format($reportData[$k]['receive']); $data[$k]['referal_for'] = WM_Currency::format($reportData[$k]['referal']); $data[$k]['win_for'] = WM_Currency::format($reportData[$k]['win']); } else { $data[$k]['total'] = 0; $data[$k]['receive'] = 0; $data[$k]['referal'] = 0; $data[$k]['win'] = 0; $data[$k]['total_for'] = WM_Currency::format(0); $data[$k]['receive_for'] = WM_Currency::format(0); $data[$k]['referal_for'] = WM_Currency::format(0); $data[$k]['win_for'] = WM_Currency::format(0); } if (isset($depositData[$k])) { $data[$k]['deposit'] = $depositData[$k]['deposit']; $data[$k]['deposit_for'] = WM_Currency::format($depositData[$k]['deposit']); } else { $data[$k]['deposit'] = 0; $data[$k]['deposit_for'] = WM_Currency::format(0); } if (isset($withdrawData[$k])) { $data[$k]['withdraw'] = $withdrawData[$k]['amount']; $data[$k]['withdraw_for'] = WM_Currency::format($withdrawData[$k]['amount']); } else { $data[$k]['withdraw'] = 0; $data[$k]['withdraw_for'] = WM_Currency::format(0); } } $this->view->reports = $data; }
public function indexAction() { $request = $this->getRequest(); $update_for = 'themes'; $db = JO_Db::getDefaultAdapter(); $this->view->msg_error = array(); $this->view->msg_success = array(); //begin updater $old_sys_config = BASE_PATH . '/old_sys/data/uploads/language/config.php'; if (!file_exists($old_sys_config)) { $this->view->msg_error['old_sys'] = 'Please move the "data" folder of your old system into folder: <strong>' . BASE_PATH . '/old_sys/</strong>'; } if (!$this->view->msg_error && $request->isPost()) { self::unlink(BASE_PATH . '/uploads/items/', true); self::unlink(BASE_PATH . '/uploads/attributes/', true); self::unlink(BASE_PATH . '/uploads/cache/', true); self::unlink(BASE_PATH . '/uploads/countries/', true); $db_queries = array(); include_once $old_sys_config; $old_config = $db->getConfig(); $db_config = $old_config; $db_config['host'] = $configArr['mysql_host']; $db_config['username'] = $configArr['mysql_user']; $db_config['password'] = $configArr['mysql_pass']; $db_config['dbname'] = $configArr['mysql_db']; $old_db_tables = $db->listTables(); $new_db = JO_Db::setAdapterConfig($db_config); $new_db_tables = $new_db->listTables(); // other tables $all_arr = array('bulletin', 'bulletin_emails', 'collections', 'collections_rates', 'contacts', 'contacts_categories', 'deposit', 'history', 'percents', 'quiz', 'quiz_answers', 'users_emails', 'users_followers', 'users_referals_count', 'users_status', 'user_groups', 'withdraw', 'items_attributes', 'items_collections', 'items_comments', 'items_faqs', 'items_rates', 'items_tags', 'items_to_category'); foreach ($all_arr as $table) { if (!in_array($table, $old_db_tables) || !in_array($table, $new_db_tables)) { continue; } $query = $new_db->select()->from($table); $attributes_categories = $new_db->fetchAll($query); if ($attributes_categories) { $db_queries['TRUNCATE'][] = array('table' => $table, 'where' => null); foreach ($attributes_categories as $key => $val) { $vals = array(); foreach ($val as $k => $d) { if (self::is_serialized($d)) { $vals[$k] = $d; } else { $vals[$k] = htmlspecialchars($d, ENT_QUOTES, 'utf-8'); } } if (count($vals) > 0) { $db_queries[$table][] = $vals; } } } } //attributes_categories $attributes_categories = $new_db->fetchAll("SELECT * FROM `attributes_categories`"); if ($attributes_categories) { $db_queries['TRUNCATE'][] = array('table' => 'attributes_categories', 'where' => null); foreach ($attributes_categories as $data) { // $db_queries[] = "INSERT INTO `attributes_categories` (`id`, `name`, `type`, `categories`, `visible`, `order_index`,`required`) VALUES ('".(int)$data['id'] ."', '".htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8') ."', '".htmlspecialchars($data['type'], ENT_QUOTES, 'utf-8') ."', '".htmlspecialchars($data['categories'], ENT_QUOTES, 'utf-8') ."', '".htmlspecialchars($data['visible'], ENT_QUOTES, 'utf-8') ."', '".(int)$data['order_index'] ."',1);"; $db_queries['attributes_categories'][] = array('id' => (int) $data['id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'type' => htmlspecialchars($data['type'], ENT_QUOTES, 'utf-8'), 'categories' => htmlspecialchars($data['categories'], ENT_QUOTES, 'utf-8'), 'visible' => 'true', 'order_index' => (int) $data['order_index'], 'required' => 1); } } //attributes $attributes_categories = $new_db->fetchAll("SELECT * FROM `attributes`"); if ($attributes_categories) { $db_queries['TRUNCATE'][] = array('table' => 'attributes', 'where' => null); foreach ($attributes_categories as $data) { $photo = self::copyFile(BASE_PATH . '/old_sys/data/uploads/attributes/' . $data['photo'], '/attributes/' . $data['photo']); $db_queries['attributes'][] = array('id' => (int) $data['id'], 'category_id' => (int) $data['category_id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'photo' => basename($photo), 'visible' => 'true', 'order_index' => (int) $data['order_index']); } } //attributes $attributes_categories = $new_db->fetchAll("SELECT * FROM `badges`"); if ($attributes_categories) { $db_queries['TRUNCATE'][] = array('table' => 'badges', 'where' => null); foreach ($attributes_categories as $data) { $photo = self::copyFile(BASE_PATH . '/old_sys/data/uploads/badges/' . $data['photo'], '/badges/' . $data['photo']); $db_queries['badges'][] = array('id' => (int) $data['id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'photo' => basename($photo), 'visible' => htmlspecialchars($data['visible'], ENT_QUOTES, 'utf-8'), 'from' => htmlspecialchars($data['from'], ENT_QUOTES, 'utf-8'), 'to' => htmlspecialchars($data['to']), 'type' => htmlspecialchars($data['type'], ENT_QUOTES, 'utf-8'), 'sys_key' => htmlspecialchars($data['sys_key'], ENT_QUOTES, 'utf-8')); } } //categories $attributes_categories = $new_db->fetchAll("SELECT * FROM `categories`"); if ($attributes_categories) { $db_queries['TRUNCATE'][] = array('table' => 'categories', 'where' => null); $db_queries['TRUNCATE'][] = array('table' => 'categories_description', 'where' => null); foreach ($attributes_categories as $data) { $db_queries['categories'][] = array('id' => (int) $data['id'], 'sub_of' => (int) $data['sub_of'], 'meta_title' => htmlspecialchars($data['meta_title'], ENT_QUOTES, 'utf-8'), 'meta_keywords' => htmlspecialchars($data['meta_keywords'], ENT_QUOTES, 'utf-8'), 'meta_description' => htmlspecialchars($data['meta_description'], ENT_QUOTES, 'utf-8'), 'visible' => htmlspecialchars($data['visible'], ENT_QUOTES, 'utf-8'), 'order_index' => (int) $data['order_index'], 'module' => $update_for); $db_queries['categories_description'][] = array('id' => (int) $data['id'], 'lid' => 1, 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8')); } } //countries $attributes_categories = $new_db->fetchAll("SELECT * FROM `countries`"); if ($attributes_categories) { $db_queries['TRUNCATE'][] = array('table' => 'countries', 'where' => null); foreach ($attributes_categories as $data) { $photo = self::copyFile(BASE_PATH . '/old_sys/data/uploads/countries/' . $data['photo'], '/countries/' . $data['photo']); $db_queries['countries'][] = array('id' => (int) $data['id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'photo' => basename($photo), 'visible' => htmlspecialchars($data['visible'], ENT_QUOTES, 'utf-8'), 'order_index' => (int) $data['order_index']); } } //items $attributes_categories = $new_db->fetchAll("SELECT * FROM `items`"); $temp_items = array(); if ($attributes_categories) { $db_queries['TRUNCATE'][] = array('table' => 'items', 'where' => null); foreach ($attributes_categories as $data) { $weekly_from = '0000-00-00'; $weekly_to = '0000-00-00'; if ($data['weekly_to'] && $data['weekly_to'] != '0000-00-00') { $weekly_from = $data['weekly_to']; $weekly_to = JO_Date::getInstance($data['weekly_to'], 'yy-mm-dd', true)->setInterval('+7 days')->toString(); } $old_path = BASE_PATH . '/old_sys/data/uploads/items/' . $data['id'] . '/'; $item_path = '/items/' . JO_Date::getInstance($data['datetime'], 'yy/mm/', true)->toString() . $data['id'] . '/'; //self::recursiveCopy($old_path . 'preview/', BASE_PATH . '/uploads/' . $item_path . 'preview/'); $thumbnail = self::copyFile($old_path . $data['thumbnail'], $item_path . $data['thumbnail']); $main_file = self::copyFile($old_path . $data['main_file'], $item_path . $data['main_file']); $theme_preview = self::copyFile($old_path . $data['theme_preview'], $item_path . $data['theme_preview']); $theme_preview_thumbnail = self::copyFromArchive($theme_preview); $temp_items[(int) $data['id']] = array('id' => (int) $data['id'], 'user_id' => (int) $data['user_id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'description' => htmlspecialchars($data['description'], ENT_QUOTES, 'utf-8'), 'thumbnail' => $thumbnail, 'theme_preview_thumbnail' => $theme_preview_thumbnail, 'theme_preview' => $theme_preview, 'main_file' => $main_file, 'main_file_name' => htmlspecialchars($data['main_file_name'], ENT_QUOTES, 'utf-8'), 'categories' => htmlspecialchars($data['categories'], ENT_QUOTES, 'utf-8'), 'demo_url' => htmlspecialchars($data['demo_url'], ENT_QUOTES, 'utf-8'), 'price' => (double) $data['price'], 'suggested_price' => (double) $data['suggested_price'], 'sales' => (double) $data['sales'], 'earning' => (double) $data['earning'], 'rating' => (double) $data['rating'], 'votes' => (double) $data['votes'], 'score' => (double) $data['score'], 'comments' => (double) $data['comments'], 'free_request' => htmlspecialchars($data['free_request'], ENT_QUOTES, 'utf-8'), 'free_file' => htmlspecialchars($data['free_file'], ENT_QUOTES, 'utf-8'), 'weekly_from' => $weekly_from, 'weekly_to' => $weekly_to, 'reviewer_comment' => htmlspecialchars($data['reviewer_comment'], ENT_QUOTES, 'utf-8'), 'datetime' => htmlspecialchars($data['datetime'], ENT_QUOTES, 'utf-8'), 'status' => htmlspecialchars($data['status'], ENT_QUOTES, 'utf-8'), 'module' => $update_for, 'video_file' => htmlspecialchars(isset($data['video_file']) ? $data['video_file'] : '', ENT_QUOTES, 'utf-8'), 'item_tags_string' => htmlspecialchars(isset($data['item_tags_string']) ? $data['item_tags_string'] : '', ENT_QUOTES, 'utf-8'), 'preview' => htmlspecialchars(isset($data['preview']) ? $data['preview'] : '', ENT_QUOTES, 'utf-8')); $db_queries['items'][] = $temp_items[(int) $data['id']]; } } //orders $attributes_categories = $new_db->fetchAll("SELECT * FROM `orders`"); if ($attributes_categories) { JO_Db::setAdapterConfig($old_config); $db_queries['TRUNCATE'][] = array('table' => 'orders', 'where' => null); foreach ($attributes_categories as $data) { $db_queries['orders'][] = array('id' => (int) $data['id'], 'order_id' => (int) (isset($data['order_id']) ? $data['order_id'] : 0), 'user_id' => (int) $data['user_id'], 'owner_id' => (int) $data['owner_id'], 'item_id' => (int) $data['item_id'], 'item_name' => htmlspecialchars($data['item_name'], ENT_QUOTES, 'utf-8'), 'price' => (double) $data['price'], 'receive' => (double) $data['receive'], 'datetime' => htmlspecialchars($data['datetime'], ENT_QUOTES, 'utf-8'), 'paid' => htmlspecialchars($data['paid'], ENT_QUOTES, 'utf-8'), 'paid_datetime' => htmlspecialchars($data['paid_datetime'], ENT_QUOTES, 'utf-8'), 'extended' => htmlspecialchars($data['extended'], ENT_QUOTES, 'utf-8'), 'type' => htmlspecialchars($data['type'], ENT_QUOTES, 'utf-8'), 'currency_code' => WM_Currency::getCurrencyCode(), 'currency_value' => '1.00000000', 'domain' => htmlspecialchars(isset($data['domain']) ? $data['domain'] : '', ENT_QUOTES, 'utf-8'), 'module' => $update_for, 'size_id' => htmlspecialchars(isset($data['size_id']) ? $data['size_id'] : '', ENT_QUOTES, 'utf-8'), 'main_file' => isset($temp_items[$data['item_id']]['main_file']) ? $temp_items[$data['item_id']]['main_file'] : '', 'main_file_info' => htmlspecialchars(isset($data['main_file_info']) ? $data['main_file_info'] : '', ENT_QUOTES, 'utf-8')); } } $new_db = JO_Db::setAdapterConfig($db_config); //temp_items $attributes_categories = $new_db->fetchAll("SELECT * FROM `temp_items`"); if ($attributes_categories) { $db_queries['TRUNCATE'][] = array('table' => 'temp_items', 'where' => null); foreach ($attributes_categories as $data) { if (!isset($temp_items[$data['item_id']])) { continue; } $old_path = BASE_PATH . '/old_sys/data/uploads/items/' . $data['item_id'] . '/temp/'; $item_path = '/items/' . JO_Date::getInstance($data['datetime'], 'yy/mm/', true)->toString() . $data['item_id'] . '/temp/'; //self::recursiveCopy($old_path . 'preview/', BASE_PATH . '/uploads/' . $item_path . 'preview/'); $thumbnail = self::copyFile($old_path . $data['thumbnail'], $item_path . $data['thumbnail']); $main_file = self::copyFile($old_path . $data['main_file'], $item_path . $data['main_file']); $theme_preview = self::copyFile($old_path . $data['theme_preview'], $item_path . $data['theme_preview']); $theme_preview_thumbnail = self::copyFromArchive($theme_preview); $db_queries['temp_items'][] = array('id' => (int) $data['id'], 'item_id' => (int) $data['item_id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'thumbnail' => $thumbnail, 'theme_preview_thumbnail' => $theme_preview_thumbnail, 'theme_preview' => $theme_preview, 'main_file' => $main_file, 'main_file_name' => htmlspecialchars($data['main_file_name'], ENT_QUOTES, 'utf-8'), 'reviewer_comment' => htmlspecialchars($data['reviewer_comment'], ENT_QUOTES, 'utf-8'), 'datetime' => htmlspecialchars($data['datetime'], ENT_QUOTES, 'utf-8'), 'video_file' => htmlspecialchars(isset($data['video_file']) ? $data['video_file'] : '', ENT_QUOTES, 'utf-8'), 'preview' => htmlspecialchars(isset($data['preview']) ? $data['preview'] : '', ENT_QUOTES, 'utf-8')); } } //temp_items_tags $attributes_categories = $new_db->fetchAll("SELECT * FROM `temp_items_tags`"); if ($attributes_categories) { foreach ($attributes_categories as $data) { if (!isset($temp_items[$data['item_id']])) { continue; } $db_queries['TRUNCATE'][] = array('table' => 'items_tags', 'where' => "`item_id` = '" . (int) $data['item_id'] . "'"); $db_queries['items_tags'][] = array('item_id' => (int) $data['item_id'], 'item_id' => (int) $data['item_id'], 'type' => htmlspecialchars($data['type'], ENT_QUOTES, 'utf-8')); } } /* if(in_array('slider', $old_db_tables) && in_array('slider', $new_db_tables)) { //slider $attributes_categories = $new_db->fetchAll("SELECT * FROM `slider`"); if($attributes_categories) { $db_queries['TRUNCATE'][] = array( 'table' => 'slider', 'where' => null ); foreach($attributes_categories AS $data) { $photo = self::copyFile(BASE_PATH . '/old_sys/data/uploads/slider/'.$data['photo'], '/slider/'.$data['photo']); $db_queries['slider'][] = array( 'id' => (int)$data['id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'url' => htmlspecialchars($data['url'], ENT_QUOTES, 'utf-8'), 'photo' => ($photo), 'visible' => htmlspecialchars($data['visible'], ENT_QUOTES, 'utf-8'), 'order_index' => (int)$data['order_index'] ); } } } */ //users $attributes_categories = $new_db->fetchAll("SELECT * FROM `users`"); if ($attributes_categories) { $db_queries['TRUNCATE'][] = array('table' => 'users', 'where' => null); foreach ($attributes_categories as $data) { $old_path = BASE_PATH . '/old_sys/data/uploads/users/' . $data['user_id'] . '/'; $item_path = '/users/' . JO_Date::getInstance($data['register_datetime'], 'yy/mm/', true)->toString() . $data['user_id'] . '/'; $avatar = self::copyFile($old_path . $data['avatar'], $item_path . $data['avatar']); $homeimage = self::copyFile($old_path . $data['homeimage'], $item_path . $data['homeimage']); $db_queries['users'][] = array('user_id' => (int) $data['user_id'], 'username' => htmlspecialchars($data['username'], ENT_QUOTES, 'utf-8'), 'password' => htmlspecialchars($data['password'], ENT_QUOTES, 'utf-8'), 'email' => htmlspecialchars($data['email'], ENT_QUOTES, 'utf-8'), 'firstname' => htmlspecialchars($data['firstname'], ENT_QUOTES, 'utf-8'), 'lastname' => htmlspecialchars($data['lastname'], ENT_QUOTES, 'utf-8'), 'featured_item_id' => htmlspecialchars($data['featured_item_id'], ENT_QUOTES, 'utf-8'), 'exclusive_author' => htmlspecialchars($data['exclusive_author'], ENT_QUOTES, 'utf-8'), 'license' => $data['license'], 'avatar' => $avatar, 'homeimage' => $homeimage, 'firmname' => htmlspecialchars($data['firmname'], ENT_QUOTES, 'utf-8'), 'profile_title' => htmlspecialchars($data['profile_title'], ENT_QUOTES, 'utf-8'), 'profile_desc' => htmlspecialchars($data['profile_desc'], ENT_QUOTES, 'utf-8'), 'live_city' => htmlspecialchars($data['live_city'], ENT_QUOTES, 'utf-8'), 'country_id' => htmlspecialchars($data['country_id'], ENT_QUOTES, 'utf-8'), 'freelance' => htmlspecialchars($data['freelance'], ENT_QUOTES, 'utf-8'), 'social' => $data['social'], 'quiz' => htmlspecialchars($data['quiz'], ENT_QUOTES, 'utf-8'), 'deposit' => htmlspecialchars($data['deposit'], ENT_QUOTES, 'utf-8'), 'earning' => htmlspecialchars($data['earning'], ENT_QUOTES, 'utf-8'), 'total' => htmlspecialchars($data['total'], ENT_QUOTES, 'utf-8'), 'sold' => htmlspecialchars($data['sold'], ENT_QUOTES, 'utf-8'), 'items' => htmlspecialchars($data['items'], ENT_QUOTES, 'utf-8'), 'sales' => htmlspecialchars($data['sales'], ENT_QUOTES, 'utf-8'), 'buy' => htmlspecialchars($data['buy'], ENT_QUOTES, 'utf-8'), 'rating' => htmlspecialchars($data['rating'], ENT_QUOTES, 'utf-8'), 'score' => htmlspecialchars($data['score'], ENT_QUOTES, 'utf-8'), 'votes' => htmlspecialchars($data['votes'], ENT_QUOTES, 'utf-8'), 'referals' => htmlspecialchars($data['referals'], ENT_QUOTES, 'utf-8'), 'referal_money' => htmlspecialchars($data['referal_money'], ENT_QUOTES, 'utf-8'), 'featured_author' => htmlspecialchars($data['featured_author'], ENT_QUOTES, 'utf-8'), 'register_datetime' => htmlspecialchars($data['register_datetime'], ENT_QUOTES, 'utf-8'), 'last_login_datetime' => htmlspecialchars($data['last_login_datetime'], ENT_QUOTES, 'utf-8'), 'ip_address' => htmlspecialchars($data['ip_address'], ENT_QUOTES, 'utf-8'), 'status' => htmlspecialchars($data['status'], ENT_QUOTES, 'utf-8'), 'groups' => $data['groups'], 'remember_key' => htmlspecialchars($data['remember_key'], ENT_QUOTES, 'utf-8'), 'activate_key' => htmlspecialchars($data['activate_key'], ENT_QUOTES, 'utf-8'), 'referal_id' => htmlspecialchars($data['referal_id'], ENT_QUOTES, 'utf-8'), 'commission_percent' => htmlspecialchars($data['commission_percent'], ENT_QUOTES, 'utf-8'), 'badges' => htmlspecialchars($data['badges'], ENT_QUOTES, 'utf-8')); } } JO_Session::clear('inserted'); JO_Session::clear('deleted'); if (isset($db_queries['TRUNCATE'])) { $truncate = $db_queries['TRUNCATE']; unset($db_queries['TRUNCATE']); JO_Session::set('deleted', $truncate); } $tmp = array(); $checked = array(); foreach ($db_queries as $table => $data) { foreach ($data as $key => $res) { $key = md5(var_export(array($table, $res), true)); if (!isset($checked[$key])) { $tmp[] = array('table' => $table, 'data' => $res); } $checked[$key] = true; } } JO_Session::set('inserted', $tmp); JO_Session::set('query_error', array()); $this->redirect(WM_Router::create($request->getBaseUrl() . '?module=update&controller=index&action=stepTwo')); } }
public function membershipAction() { $request = $this->getRequest(); if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } $this->view->page_num = $page = $request->getRequest('page', 1); $this->view->sort = strtolower($request->getRequest('sort', 'ASC')); $this->view->order = $request->getRequest('order', 'm.datetime'); $this->view->filter_id = $request->getQuery('filter_id'); $this->view->filter_username = $request->getQuery('filter_username'); $this->view->filter_price = $request->getQuery('filter_price'); $this->view->filter_extended = $request->getQuery('filter_datetime'); $url = ''; if ($this->view->filter_id) { $url .= '&filter_id=' . $this->view->filter_id; } if ($this->view->filter_username) { $url .= '&filter_username='******'&filter_price=' . $this->view->filter_price; } $url1 = ''; if ($this->view->sort) { $url1 .= '&sort=' . $this->view->sort; } if ($this->view->order) { $url1 .= '&order=' . $this->view->order; } $url2 = '&page=' . $page; $this->view->sort_id = $request->getModule() . '/orders/membership/?order=m.id&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_username = $request->getModule() . '/orders/membership/?order=u.username&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_price = $request->getModule() . '/orders/membership/?order=m.amount&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $this->view->sort_datetime = $request->getModule() . '/orders/membership/?order=m.datetime&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2; $data = array('sort' => $this->view->sort, 'order' => $this->view->order, 'filter_id' => $this->view->filter_id, 'filter_username' => $this->view->filter_username, 'filter_price' => $this->view->filter_price); $this->view->items = array(); $items = Model_Membership::getNoPaid($data); if ($items) { $total_records = count($items); $limit = JO_Registry::get('admin_limit'); $this->view->total_pages = ceil($total_records / $limit); $this->view->total_rows = $total_records; $pagination = new Model_Pagination(); $pagination->setLimit($limit); $pagination->setPage($page); $pagination->setTotal($total_records); $pagination->setUrl($this->getRequest()->getModule() . '/orders/membership/?page={page}' . $url . $url1); $this->view->pagination = $pagination->render(); $start = $page * $limit - $limit; if ($start > $total_records) { $page = max(ceil($total_records / $limit), 1); $start = $page * $limit - $limit; } elseif ($start < 0) { $start = 0; } $items = array_slice($items, $start, $limit); foreach ($items as $item) { $item['amounte'] = WM_Currency::format($item['amount']); $this->view->items[] = $item; } } $this->view->order_link = WM_Router::create($request->getBaseUrl() . '?controller=admin/orders&action=index'); $this->view->deposit_link = WM_Router::create($request->getBaseUrl() . '?controller=admin/orders&action=deposit'); $this->view->membership_link = WM_Router::create($request->getBaseUrl() . '?controller=admin/orders&action=membership'); }
public function __construct($data = array()) { $db = JO_Db::getDefaultAdapter(); $data['category_id'] = 0; $data['public'] = 1; if (isset($data['board_id'])) { $board_info = new Model_Boards_Board($data['board_id']); if ($board_info->count()) { $data['board_id'] = $board_info['board_board_id']; $data['category_id'] = $board_info['board_category_id']; $data['public'] = $board_info['board_public']; } else { $data['board_id'] = 0; } } else { $data['board_id'] = 0; } $data['date_added'] = WM_Date::format(time(), 'yy-mm-dd H:i:s'); $data['date_modified'] = $data['date_added']; $data['user_id'] = isset($data['user_id']) ? $data['user_id'] : (string) JO_Session::get('user[user_id]'); $data['store'] = Helper_Config::get('file_upload_method') ? Helper_Config::get('file_upload_method') : 'Model_Upload_Locale'; $data['source_id'] = 0; //sorce if (isset($data['from']) && $data['from']) { $source = new Model_Sources_GetSourceByUrl($data['from']); if ($source->source_id) { $data['source_id'] = $source->source_id; } } $data['from_md5'] = md5(isset($data['from']) ? $data['from'] : time()); /* price */ //$data['price'] = 0; if (isset($data['price']) && $data['price']) { $currencies = WM_Currency::getCurrencies(); $price_left = array(); $price_right = array(); if ($currencies) { foreach ($currencies as $currency) { if (trim($currency['symbol_left'])) { $price_left[] = preg_quote(trim($currency['symbol_left'])); } if (trim($currency['symbol_right'])) { $price_right[] = preg_quote(trim($currency['symbol_right'])); } } if ($price_left) { if (preg_match('/(' . implode('|', $price_left) . ')([\\s]{0,2})?(?:(?:\\d{1,5}(?:\\,\\d{3})+)|(?:\\d+))(?:\\.\\d{2})?/', $data['price'], $match)) { $price_tmp = trim(str_replace(trim($match[1]), '', $match[0])); $currency = self::getCurrencyBySimbol(trim($match[1])); if ($currency) { $data['price'] = round($price_tmp / $currency, 4); } } } if (!$data['price'] && $price_right) { if (preg_match('/(?:(?:\\d{1,5}(?:\\,\\d{3})+)|(?:\\d+))(?:\\.\\d{2})?([\\s]{0,2})?(' . implode('|', $price_right) . ')/', $data['price'], $match)) { $price_tmp = trim(str_replace(trim($match[2]), '', $match[0])); $currency = self::getCurrencyBySimbol(trim($match[2])); if ($currency) { $data['price'] = round($price_tmp / $currency, 4); } } } } } /* end price */ $from = isset($data['from']) ? $data['from'] : time(); $data['is_video'] = isset($data['is_video']) && $data['is_video'] == 'true' ? 1 : 0; if (!$data['is_video']) { $auto = new Helper_AutoEmbed(); if ($auto->parseUrl($from)) { $data['is_video'] = 1; } } /* is video */ ///////////////// Event onComplete ///////////////////// $on_add_call = Helper_Config::get('pin_onbefore_create'); if ($on_add_call) { foreach ($on_add_call as $call) { call_user_func($call, $data); } } ///////////////// upload image ///////////////////// $image = false; if (isset($data['media']) && !isset($data['image'])) { $image = $data['media']; } else { if (isset($data['image'])) { $image = $data['image']; } } if (!isset($data['gallery']) && !$image) { return $this; } $data['image'] = ''; //create pin $data['pin_id'] = Helper_Db::insert('pins', $data); if (!$data['pin_id']) { return $this; } if (isset($data['gallery'])) { if (is_array($data['gallery']) && count($data['gallery']) > 0) { $method_for_upload = Helper_Config::get('file_upload_method'); if ($method_for_upload) { foreach ($data['gallery'] as $row => $image_get) { if ($this->error) { return $this; } $image = call_user_func(array($method_for_upload, 'uploadPin'), $image_get, isset($data['title']) && $data['title'] ? $data['title'] : $data['description'], $data['pin_id']); $this->error = call_user_func(array($method_for_upload, 'getError')); if ($image && isset($image['image'])) { if ($row == 0) { Helper_Db::update('pins', array('image' => $image['image'], 'store' => $image['store'], 'height' => $image['height'], 'width' => $image['width']), array('pin_id = ?' => (string) $data['pin_id'])); } else { $gal_id = Helper_Db::insert('pins_gallery', array('image' => $image['image'], 'store' => $image['store'], 'pin_id' => $data['pin_id'], 'sort_order' => $row)); if (!$gal_id) { return $this; } } } else { return $this; } } } else { Helper_Db::delete('pins', array('pin_id = ?' => (string) $data['pin_id'])); return $this; } } else { Helper_Db::delete('pins', array('pin_id = ?' => (string) $data['pin_id'])); return $this; } } else { $method_for_upload = Helper_Config::get('file_upload_method'); if ($method_for_upload && $image) { $image = call_user_func(array($method_for_upload, 'uploadPin'), $image, isset($data['title']) && $data['title'] ? $data['title'] : $data['description'], $data['pin_id']); $this->error = call_user_func(array($method_for_upload, 'getError')); if ($image && isset($image['image'])) { Helper_Db::update('pins', array('image' => $image['image'], 'store' => $image['store'], 'height' => $image['height'], 'width' => $image['width']), array('pin_id = ?' => (string) $data['pin_id'])); } else { Helper_Db::delete('pins', array('pin_id = ?' => (string) $data['pin_id'])); return $this; } } else { Helper_Db::delete('pins', array('pin_id = ?' => (string) $data['pin_id'])); return $this; } } ///////////////// update latest pins for board ///////////////////// if (isset($data['board_id']) && $data['board_id']) { new Model_Boards_UpdateLatestPins($data['board_id']); } ///////////////// update latest pins for user ///////////////////// new Model_Users_UpdateLatestPins($data['user_id']); ///////////////// Pin total repins ///////////////////// if (isset($data['repin_from']) && $data['repin_from']) { $pin_repin = new Model_Pins_Pin($data['repin_from']); if ($pin_repin->count()) { Helper_Db::update('pins', array('repins' => $db->fetchOne($db->select()->from('pins', 'COUNT(pin_id)')->where('repin_from = ?', $data['repin_from'])->limit(1))), array('pin_id = ?' => $data['repin_from'])); } } ///////////////// Word for search index's ///////////////////// $spl = JO_Utf8::str_word_split(strip_tags(html_entity_decode($data['description'], ENT_QUOTES, 'utf-8')), self::$searchWordLenght); $words = array(); foreach ($spl as $word) { $word = mb_strtolower($word, 'utf-8'); if (!in_array($word, self::blackWordsDictionary()) && $word[0] . $word[1] != '&#') { $words[$word] = $word; } } ///////////////// Word for search index's insert ///////////////////// foreach ($words as $word => $data1) { $dic_id = $db->fetchOne($db->select()->from('pins_dictionary', 'dic_id')->where('word = ?', $word)); if (!$dic_id) { $db->insert('pins_dictionary', array('word' => $word)); $dic_id = $db->lastInsertId(); } if ($dic_id) { $db->insert('pins_invert', array('pin_id' => $data['pin_id'], 'dic_id' => $dic_id)); } } Helper_Db::delete('pins_images', array('pin_id = ?' => $data['pin_id'])); ///////////////// Extension on create ////////////////// $extensions = Model_Extensions::getByMethod('pin_oncreate'); if ($extensions) { $front = JO_Front::getInstance(); foreach ($extensions as $id => $ext) { $pin_data_ext = call_user_func(array($front->formatModuleName('model_' . $ext . '_pin'), 'oncreate'), $data['pin_id'], $data); if ($pin_data_ext && is_array($pin_data_ext)) { $data = array_merge(data, $pin_data_ext); } } } ///////////////// Event onComplete ///////////////////// $trigger = new Helper_Triggers_PinOnCreate(); $trigger->bind($data['pin_id']); $this->data = $data; // parent::__construct($data); }
private function getForm() { $request = $this->getRequest(); $url = ''; if ($request->getQuery('filter_id')) { $url .= '&filter_id=' . $request->getQuery('filter_id'); } if ($request->getQuery('filter_name')) { $url .= '&filter_name=' . $request->getQuery('filter_name'); } if ($request->getQuery('filter_username')) { $url .= '&filter_username='******'filter_username'); } if ($request->getQuery('filter_user_id')) { $url .= '&filter_user_id=' . $request->getQuery('filter_user_id'); } if ($request->getQuery('filter_price')) { $url .= '&filter_price=' . $request->getQuery('filter_price'); } if ($request->getQuery('filter_sales')) { $url .= '&filter_sales=' . $request->getQuery('filter_sales'); } if ($request->getQuery('filter_profit')) { $url .= '&filter_profit=' . $request->getQuery('filter_profit'); } if ($request->getQuery('filter_free_request')) { $url .= '&filter_free_request=' . $request->getQuery('filter_free_request'); } if ($request->getQuery('filter_free_file')) { $url .= '&filter_free_file=' . $request->getQuery('filter_free_file'); } if ($request->getQuery('filter_weekly')) { $url .= '&filter_weekly=' . $request->getQuery('filter_weekly'); } if ($request->getQuery('sort')) { $url .= '&sort=' . $request->getQuery('sort'); } if ($request->getQuery('order')) { $url .= '&order=' . $request->getQuery('order'); } if ($request->getQuery('page')) { $url .= '&page=' . $request->getQuery('page'); } $id = $request->getQuery('id'); $info = Model_Items::getItem($id); if (!$info) { $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/items/?' . $url); } $this->view->cancel = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/items/?' . $url; $model_images = new Model_Images(); $info['thumbnail'] = $model_images->resize($info['thumbnail'], JO_Registry::forceGet($info['module'] . '_items_thumb_width'), JO_Registry::forceGet($info['module'] . '_items_thumb_height'), true); if ((int) JO_Registry::get($info['module'] . '_items_preview_width') && (int) JO_Registry::get($info['module'] . '_items_preview_height')) { $info['theme_preview_thumbnail'] = $model_images->resize($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_width'), JO_Registry::forceGet($info['module'] . '_items_preview_height'), true); } elseif ((int) JO_Registry::get($info['module'] . '_items_preview_width')) { $info['theme_preview_thumbnail'] = $model_images->resizeWidth($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_width')); } elseif ((int) JO_Registry::get($info['module'] . '_items_preview_height')) { $info['theme_preview_thumbnail'] = $model_images->resizeHeight($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_height')); } else { $info['theme_preview_thumbnail'] = false; } $this->view->info = $info; $this->view->price_f = WM_Currency::format($info['suggested_price']); $this->view->categories = Model_Categories::getCategoriesFromParentByModule(0, $info['module']); $cats_module = Model_Categories::getCategories(array('filter_sub_of' => 0, 'filter_module' => $info['module'], 'filter_concat' => true)); $where_attr = ''; if ($cats_module) { $tmp = array(); foreach ($cats_module as $c) { $tmp[] = "categories LIKE '%," . $c . ",%'"; } if ($tmp) { $where_attr = implode(' OR ', $tmp); } } $this->view->attributes_list = array(); $attr_cat = Model_Attributes::getAttributes(array(), $where_attr); if ($attr_cat) { foreach ($attr_cat as $row => $attr) { $attr_list = Model_Attributes::getAttributes(array('filter_sub_of' => $attr['id'])); if ($attr_list) { $this->view->attributes_list[$row] = $attr; $this->view->attributes_list[$row]['items'] = $attr_list; } } } //var_dump($this->view->attributes_list); if ($request->getPost('name')) { $this->view->name = $request->getPost('name'); } else { $this->view->name = $info['name']; } if ($request->getPost('description')) { $this->view->description = $request->getPost('description'); } else { $this->view->description = $info['description']; } if ($request->getPost('price')) { $this->view->price = $request->getPost('price'); } else { $this->view->price = $info['price']; } if ($request->getPost('category_id')) { $this->view->category_id = $request->getPost('category_id'); } else { $this->view->category_id = Model_Items::getItemCategory($id); } if ($request->getPost('attributes')) { $this->view->attributes = $request->getPost('attributes'); } else { $this->view->attributes = Model_Items::getItemAttributes($id); } if ($request->getPost('tags')) { $this->view->tags = $request->getPost('tags'); } else { $this->view->tags = Model_Items::getItemTags($id); } if ($request->getPost('free_file')) { $this->view->free_file = $request->getPost('free_file'); } else { $this->view->free_file = $info['free_file']; } if ($request->getPost('demo_url')) { $this->view->demo_url = $request->getPost('demo_url'); } else { $this->view->demo_url = $info['demo_url']; } if ($request->getPost('weekly_from')) { $this->view->weekly_from = $request->getPost('weekly_from'); } else { if ($info['weekly_from'] != '0000-00-00') { $this->view->weekly_from = JO_Date::getInstance($info['weekly_from'], 'dd.mm.yy', true)->toString(); } else { $this->view->weekly_from = ''; } } if ($request->getPost('weekly_to')) { $this->view->weekly_to = $request->getPost('weekly_to'); } else { if ($info['weekly_to'] != '0000-00-00') { $this->view->weekly_to = JO_Date::getInstance($info['weekly_to'], 'dd.mm.yy', true)->toString(); } else { $this->view->weekly_to = ''; } } }
public function daily_summary_mailAction() { $this->noViewRenderer(true); $request = $this->getRequest(); $users = Model_Users::getDailySummary(); if ($users) { $domain = $request->getDomain(); $mail = new JO_Mail(); if (JO_Registry::get('mail_smtp')) { $mail->setSMTPParams(JO_Registry::forceGet('mail_smtp_host'), JO_Registry::forceGet('mail_smtp_port'), JO_Registry::forceGet('mail_smtp_user'), JO_Registry::forceGet('mail_smtp_password')); } $mail->setFrom('no-reply@' . $domain); $not_template = Model_Notification::getNotification('daily_summary'); foreach ($users as $user) { $user['to_date'] = WM_Date::format($user['to_date'], 'Y-mm-dd H:i'); $user['from_date'] = WM_Date::format($user['from_date'], 'Y-mm-dd H:i'); if ($not_template) { $title = $not_template['title']; $html = html_entity_decode($not_template['template'], ENT_QUOTES, 'utf-8'); $html = str_replace('{USERNAME}', $user['username'], $html); $html = str_replace('{SALES}', $user['cnt'], $html); $html = str_replace('{SUM}', WM_Currency::format($user['daily_sum']), $html); $html = str_replace('{TO_DATE}', $user['to_date'], $html); $html = str_replace('{FROM_DATE}', $user['from_date'], $html); } else { $title = "[" . $domain . "] " . $this->translate('Daily summary'); $html = nl2br($this->translate('Daily summary') . ' from ' . $user['from_date'] . ' to ' . $user['to_date'] . ' Sales: ' . $user['cnt'] . ', Receive money: ' . WM_Currency::format($user['daily_sum']) . ' =============================================================================================== ' . JO_Registry::forceGet('meta_title') . ' '); } $mail->setSubject($title); $mail->setHTML($html); $mail->send(array($user['email']), JO_Registry::get('mail_smtp') ? 'smtp' : 'mail'); } } }