Esempio n. 1
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     //    	$this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
     $this->view->sub_of = $sub_of = $this->getRequest()->getRequest('sub_of', 0);
     if ($sub_of) {
         $category_info = Model_Categories::getCategoryPath($sub_of);
         if (!$category_info) {
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/categories/');
         }
         $this->view->parent_name = $category_info['name'];
         $this->view->parent_href = $this->getRequest()->getModule() . '/categories/?sub_of=' . $category_info['sub_of'];
     }
     $data = array('filter_sub_of' => $sub_of);
     $this->view->categories = array();
     $categories = Model_Categories::getCategories($data);
     if ($categories) {
         $url = '';
         if ($sub_of) {
             $url .= "&sub_of=" . $sub_of;
         }
         foreach ($categories as $category) {
             $category['subcategories'] = $this->getRequest()->getModule() . '/categories/?sub_of=' . $category['id'];
             $category['edit'] = $this->getRequest()->getModule() . '/categories/edit/?id=' . $category['id'] . $url;
             //            	$category['up'] = $this->getRequest()->getModule() . '/categories/sort/?sort=up&sub_of='.$category['sub_of'].'&id=' . $category['id'];
             //            	$category['down'] = $this->getRequest()->getModule() . '/categories/sort/?sort=down&sub_of='.$category['sub_of'].'&id=' . $category['id'];
             $this->view->categories[] = $category;
         }
     }
     //        $total_records = Model_Categories::getTotalCategories($data);
     //
     //		$this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
     //		$this->view->total_rows = $total_records;
     //
     //		$url = '';
     //		if($this->getRequest()->getRequest('sub_of')) {
     //			$url = '&sub_of=' . $this->getRequest()->getRequest('sub_of');
     //		}
     //
     //		$pagination = new Model_Pagination;
     //		$pagination->setLimit(JO_Registry::get('admin_limit'));
     //		$pagination->setPage($page);
     //		$pagination->setTotal($total_records);
     //		$pagination->setUrl($this->getRequest()->getModule() . '/categories/?page={page}' . $url);
     //		$this->view->pagination = $pagination->render();
 }
 public function indexAction()
 {
     $request = $this->getRequest();
     $places_model = new Model_Categories();
     $data = array('filter_without_children' => true);
     $this->view->new_record_url = $request->getBaseUrl() . $request->getModule() . '/categories/create/';
     $this->view->categories = array();
     $categories = $places_model->getCategories($data);
     if ($categories) {
         foreach ($categories as $category) {
             $category['edit'] = $request->getModule() . '/categories/edit/?id=' . $category['category_id'];
             //				$category['boards'] = 1;
             $this->view->categories[] = $category;
         }
     }
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
 }
Esempio n. 3
0
 public function registerAction()
 {
     $request = $this->getRequest();
     $_SESSION["deportes_url"] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register');
     $this->view->deportes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=deportes');
     //////////// Categories ////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
         $this->view->categories[] = $category;
     }
     //////////// User Type ////////////
     $this->view->user_types = array();
     $user_types = Model_Users::getUserType(array('filter_status' => 1));
     foreach ($user_types as $user_type) {
         $user_type['subuser_types'] = Model_Users::getSubUserType($user_type['user_type_id']);
         $this->view->user_types[] = $user_type;
     }
     $this->view->user_sports = array();
     $users_sports = Model_Users::getUserSports(0);
     $i = 0;
     foreach ($users_sports as $user_sports) {
         if ($user_sports['sport_category'] != 1) {
             if (!Model_Boards::isCategoryParent($user_sports['sport_category'])) {
                 $this->view->user_sports[] = Model_Boards::getCategoryTitle($user_sports['sport_category']);
                 $i++;
             }
         }
     }
     //$this->view->sportcounter = $i;
     if (JO_Session::get('user[user_id]')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')));
     }
     $shared_content = Model_Users::checkSharedContent($request->getParam('key'), $request->getParam('user_id'));
     if (!JO_Registry::get('enable_free_registration')) {
         if (!$shared_content) {
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing'));
         }
     } else {
         $this->view->fb_register = null;
         $fb_ses = JO_Registry::get('facebookapi');
         $session = $fb_ses->getUser();
         if (JO_Registry::get('oauth_fb_key') && JO_Registry::get('oauth_fb_secret')) {
             $this->view->fb_register = $this->facebook->getLoginUrl(array('redirect_uri' => WM_Router::create($request->getBaseUrl() . '?controller=facebook&action=login'), 'req_perms' => 'email,user_birthday,status_update,user_videos,user_status,user_photos,offline_access,read_friendlists'));
         }
     }
     if (JO_Registry::get('oauth_in_key')) {
         $this->view->instagram_register = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=instagram&action=register&next=' . urlencode(WM_Router::create($request->getBaseUrl() . '?controller=instagram&action=register')));
     }
     $this->view->error = false;
     if ($request->isPost()) {
         $validate = new Helper_Validate();
         $validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
         $validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
         //$validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
         $validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
         $validate->_set_rules($request->getPost('password'), $this->translate('Password'), 'not_empty;min_length[4];max_length[30]');
         $validate->_set_rules($request->getPost('password2'), $this->translate('Confirm password'), 'not_empty;min_length[4];max_length[30]');
         if (!isset($_SESSION['token'])) {
             if ($request->issetPost('type_user')) {
                 if ($request->getPost('type_user') != 1 && $request->getPost('type_user') != 5 && $request->getPost('type_user') != 12) {
                     $validate->_set_rules($request->getPost('location'), $this->translate('Location'), 'not_empty;min_length[3];max_length[100]');
                 }
             }
             //is_nan() sino
             /* if($request->getPost('sport_category_1') == "" && $request->getPost('sport_category_2') == "" && $request->getPost('sport_category_3') == "") {
                           $validate->_set_rules($request->getPost('sport_category'), $this->translate('Category_id'), 'not_empty;min_length[3];max_length[100]');
             
                           } */
             $validate->_set_rules($request->getPost('sports'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
             //$validate->_set_rules($request->getPost('sport_category_2'), $this->translate('Category_id2'), 'not_empty;min_length[3];max_length[100]');
             //$validate->_set_rules($request->getPost('sport_category_3'), $this->translate('Category_id3'), 'not_empty;min_length[3];max_length[100]');
             $validate->_set_rules($request->getPost('type_user'), $this->translate('User_type_id'), 'not_empty;min_length[1];max_length[100]');
         }
         if ($validate->_valid_form()) {
             if (md5($request->getPost('password')) != md5($request->getPost('password2'))) {
                 $validate->_set_form_errors($this->translate('Password and Confirm Password should be the same'));
                 $validate->_set_valid_form(false);
             }
             if (Model_Users::isExistEmail($request->getPost('email'))) {
                 $validate->_set_form_errors($this->translate('This e-mail address is already used'));
                 $validate->_set_valid_form(false);
             }
             if (Model_Users::isExistUsername($request->getPost('username'))) {
                 $validate->_set_form_errors($this->translate('This username is already used'));
                 $validate->_set_valid_form(false);
             }
         }
         if ($validate->_valid_form()) {
             $reg_key = sha1($request->getPost('email') . $request->getPost('username'));
             $lat = $request->getPost('lat');
             $len = $request->getPost('len');
             /*
             while (Model_Users::getUsersLatLen($lat, $len))
             {
             
                 $posLat = strpos($lat, ".");
                 $longLat = strlen(substr((string) $lat, $posLat));
                 $cantLat = 0;
                 for ($i = 0; $i < ($longLat - 4); $i++)
                 {
                     if ($i == 0)
                     {
                         $cantLat .= ".0";
                     } else
                     {
                         $cantLat .= "0";
                     }
                 }
                 $cantLat .= "1";
                 $lat = $lat + $cantLat;
             
                 $posLen = strpos($len, ".");
                 $longLen = strlen(substr((string) $len, $posLen));
                 $cantLen = 0;
                 for ($i = 0; $i < ($longLen - 4); $i++)
                 {
                     if ($i == 0)
                     {
                         $cantLen .= ".0";
                     } else
                     {
                         $cantLen .= "0";
                     }
                 }
                 $cantLen .= "1";
                 $len = $len + $cantLen;
             }
             */
             $result = Model_Users::create(array('username' => $request->getPost('username'), 'firstname' => $request->getPost('firstname'), 'lastname' => $request->getPost('lastname'), 'email' => $request->getPost('email'), 'password' => $request->getPost('password'), 'delete_email' => isset($shared_content['email']) ? $shared_content['email'] : '', 'delete_code' => isset($shared_content['if_id']) ? $shared_content['if_id'] : '', 'following_user' => isset($shared_content['user_id']) ? $shared_content['user_id'] : '', 'facebook_id' => isset($shared_content['facebook_id']) ? $shared_content['facebook_id'] : 0, 'location' => $request->getPost('location') != "Introduce una ubicación" ? $request->getPost('location') : "", 'sport_category_1' => $request->getPost('sport_category_1'), 'sport_category_2' => $request->getPost('sport_category_2'), 'sport_category_3' => $request->getPost('sport_category_3'), 'type_user' => $request->getPost('type_user'), 'lat' => $lat, 'len' => $len, 'confirmed' => '0', 'regkey' => $reg_key));
             if ($result) {
                 for ($i = 0; $i <= $request->getPost('locationcounter'); $i++) {
                     $location = 'location' . $i;
                     $lat = 'lat' . $i;
                     $len = 'len' . $i;
                     if ($request->issetPost($location)) {
                         if ($request->getPost($location) != "") {
                             $lat = $request->getPost($lat);
                             $len = $request->getPost($len);
                             /*
                                                             while (Model_Users::getLocationUsersLatLen($lat, $len))
                                                             {
                                $posLat = strpos($lat, ".");
                                $longLat = strlen(substr((string) $lat, $posLat));
                                $cantLat = 0;
                                for ($x = 0; $x < ($longLat - 4); $x++)
                                {
                                    if ($x == 0)
                                    {
                                        $cantLat .= ".0";
                                    } else
                                    {
                                        $cantLat .= "0";
                                    }
                                }
                                $cantLat .= "1";
                                $lat = $lat + $cantLat;
                             
                                $posLen = strpos($len, ".");
                                $longLen = strlen(substr((string) $len, $posLen));
                                $cantLen = 0;
                                for ($y = 0; $y < ($longLen - 4); $y++)
                                {
                                    if ($y == 0)
                                    {
                                        $cantLen .= ".0";
                                    } else
                                    {
                                        $cantLen .= "0";
                                    }
                                }
                                $cantLen .= "1";
                                $len = $len + $cantLen;
                                                             }
                             */
                             if (Model_Users::createUsersLocation($result, $request->getPost($location), $lat, $len)) {
                             }
                         }
                     }
                 }
                 if (Model_Users::editUserSports($result)) {
                 }
                 if (self::sendMail($result)) {
                     self::loginInit($result);
                 }
             } else {
                 $this->view->error = $this->translate('There was a problem with the record. Please try again!');
             }
         } else {
             $this->view->error = $validate->_get_error_messages();
         }
     }
     $this->view->baseUrl = $request->getBaseUrl();
     if ($request->issetPost('email')) {
         $this->view->email = $request->getPost('email');
     } else {
         if (isset($shared_content['email'])) {
             $this->view->email = $shared_content['email'];
         } else {
             $this->view->email = '';
         }
     }
     if ($request->issetPost('firstname')) {
         $this->view->firstname = $request->getPost('firstname');
     } else {
         $this->view->firstname = '';
     }
     if ($request->issetPost('lastname')) {
         $this->view->lastname = $request->getPost('lastname');
     } else {
         $this->view->lastname = '';
     }
     if ($request->issetPost('username')) {
         $this->view->username = $request->getPost('username');
     } else {
         $this->view->username = '';
     }
     $this->view->password = $request->getPost('password');
     $this->view->password2 = $request->getPost('password2');
     $this->view->location = '';
     if ($request->issetPost('location')) {
         $this->view->location = $request->getPost('location');
     } else {
         $this->view->location = '';
     }
     //lat
     $this->view->lat = '';
     if ($request->issetPost('lat')) {
         $this->view->lat = $request->getPost('lat');
     } else {
         $this->view->lat = '';
     }
     //len
     $this->view->len = '';
     if ($request->issetPost('len')) {
         $this->view->len = $request->getPost('len');
     } else {
         $this->view->len = '';
     }
     $this->view->cat_title1 = '';
     $this->view->sport_category_1 = '';
     if ($request->issetPost('sport_category_1')) {
         $this->view->sport_category_1 = $request->getPost('sport_category_1');
         if ($request->getPost('sport_category_1') != "") {
             if ($request->getPost('sport_category_1') == 1) {
                 $this->view->cat_title1 = "Todo";
             } else {
                 $this->view->cat_title1 = Model_Boards::getCategoryTitle($request->getPost('sport_category_1'));
             }
         }
     } else {
         $this->view->sport_category_1 = '';
     }
     $this->view->cat_title2 = '';
     $this->view->sport_category_2 = '';
     if ($request->issetPost('sport_category_2')) {
         $this->view->sport_category_2 = $request->getPost('sport_category_2');
         if ($request->getPost('sport_category_2') != "") {
             if ($request->getPost('sport_category_2') == 1) {
                 $this->view->cat_title2 = "Todo";
             } else {
                 $this->view->cat_title2 = Model_Boards::getCategoryTitle($request->getPost('sport_category_2'));
             }
         }
     } else {
         $this->view->sport_category_2 = '';
     }
     $this->view->cat_title3 = '';
     $this->view->sport_category_3 = '';
     if ($request->issetPost('sport_category_3')) {
         $this->view->sport_category_3 = $request->getPost('sport_category_3');
         if ($request->getPost('sport_category_3') != "") {
             if ($request->getPost('sport_category_3') == 1) {
                 $this->view->cat_title3 = "Todo";
             } else {
                 $this->view->cat_title3 = Model_Boards::getCategoryTitle($request->getPost('sport_category_3'));
             }
         }
     } else {
         $this->view->sport_category_3 = '';
     }
     $this->view->usertype_title = '';
     $this->view->type_user = '';
     if ($request->issetPost('type_user')) {
         $this->view->type_user = $request->getPost('type_user');
         if ($request->getPost('type_user') != "") {
             $this->view->usertype_title = Model_Users::getUserTypeTitle($request->getPost('type_user'));
         }
     } else {
         $this->view->type_user = '';
     }
     //////////// User location ////////////
     $this->view->user_location = array();
     $this->view->locationcounter = 0;
     if ($request->issetPost('location1')) {
         $user_location = array();
         for ($i = 1; $i <= $request->getPost('locationcounter'); $i++) {
             $location = 'location' . $i;
             $lat = 'lat' . $i;
             $len = 'len' . $i;
             if ($request->issetPost($location)) {
                 if ($request->getPost($location) != "") {
                     $user_location[] = $request->getPost($location);
                 }
             }
         }
         $this->view->user_location = $user_location;
         $this->view->locationcounter = $request->getPost('locationcounter');
     } else {
         $this->view->locationcounter = 0;
     }
     // si llama a los deportes
     if (isset($_SESSION["email"])) {
         $this->view->email = $_SESSION["email"];
         $_SESSION["email"] = null;
     }
     if (isset($_SESSION["firstname"])) {
         $this->view->firstname = $_SESSION["firstname"];
         $_SESSION["firstname"] = null;
     }
     if (isset($_SESSION["username"])) {
         $this->view->username = $_SESSION["username"];
         $_SESSION["username"] = null;
     }
     if (isset($_SESSION["password"])) {
         $this->view->password = $_SESSION["password"];
         $_SESSION["password"] = null;
     }
     if (isset($_SESSION["password2"])) {
         $this->view->password2 = $_SESSION["password2"];
         $_SESSION["password2"] = null;
     }
     if (isset($_SESSION["location"])) {
         $this->view->location = $_SESSION["location"];
         $_SESSION["location"] = null;
     }
     if (isset($_SESSION["lat"])) {
         $this->view->lat = $_SESSION["lat"];
         $_SESSION["lat"] = null;
     }
     if (isset($_SESSION["len"])) {
         $this->view->len = $_SESSION["len"];
         $_SESSION["len"] = null;
     }
     if (isset($_SESSION["type_user"])) {
         if ($_SESSION["type_user"] != "") {
             $this->view->type_user = $_SESSION["type_user"];
             $this->view->usertype_title = Model_Users::getUserTypeTitle($_SESSION["type_user"]);
         }
         $_SESSION["type_user"] = null;
     }
     if (isset($_SESSION["location1"])) {
         $user_location = array();
         for ($i = 1; $i <= $_SESSION['locationcounter']; $i++) {
             $location = 'location' . $i;
             $lat = 'lat' . $i;
             $len = 'len' . $i;
             if (isset($_SESSION[$location])) {
                 if ($_SESSION[$location] != "") {
                     $user_location[] = $_SESSION[$location];
                     $_SESSION[$location] = null;
                 }
             }
         }
         $this->view->user_location = $user_location;
         $this->view->locationcounter = $_SESSION['locationcounter'];
         $_SESSION['locationcounter'] = null;
     }
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Esempio n. 4
0
 public function MAXactivatedAction()
 {
     $request = $this->getRequest();
     //$this->view->advanced_url = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced');
     $this->view->advanced_url = WM_Router::create($request->getBaseUrl() . '?controller=search&action=index');
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $id = $request->getRequest('id');
     //////////// Categories ////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
         $this->view->categories[] = $category;
     }
     //////////// User Type ////////////
     $this->view->user_types = array();
     $user_types = Model_Users::getUserType(array('filter_status' => 1));
     //////////// Age ////////////
     $this->view->ages = array();
     $ages = Model_Users::getAge();
     $this->view->ages = $ages;
     //////////// Level ////////////
     $this->view->levels = array();
     $levels = Model_Users::getLevel();
     $this->view->levels = $levels;
     if ($request->issetPost('firstname')) {
         $this->view->firstname = $request->getPost('firstname');
     } else {
         $this->view->firstname = '';
     }
     $this->view->location = '';
     if ($request->issetPost('location')) {
         $this->view->location = $request->getPost('location');
     } else {
         $this->view->location = '';
     }
     $this->view->cat_title1 = '';
     $this->view->sport_category_1 = '';
     if ($request->issetPost('sport_category_1')) {
         $this->view->sport_category_1 = $request->getPost('sport_category_1');
         if ($request->getPost('sport_category_1') != "") {
             if ($request->getPost('sport_category_1') == 1) {
                 $this->view->cat_title1 = "Todo";
             } else {
                 $this->view->cat_title1 = Model_Boards::getCategoryTitle($request->getPost('sport_category_1'));
             }
         }
     } else {
         $this->view->sport_category_1 = '';
     }
     $this->view->cat_title2 = '';
     $this->view->sport_category_2 = '';
     if ($request->issetPost('sport_category_2')) {
         $this->view->sport_category_2 = $request->getPost('sport_category_2');
         if ($request->getPost('sport_category_2') != "") {
             if ($request->getPost('sport_category_2') == 1) {
                 $this->view->cat_title2 = "Todo";
             } else {
                 $this->view->cat_title2 = Model_Boards::getCategoryTitle($request->getPost('sport_category_2'));
             }
         }
     } else {
         $this->view->sport_category_2 = '';
     }
     $this->view->cat_title3 = '';
     $this->view->sport_category_3 = '';
     if ($request->issetPost('sport_category_3')) {
         $this->view->sport_category_3 = $request->getPost('sport_category_3');
         if ($request->getPost('sport_category_3') != "") {
             if ($request->getPost('sport_category_3') == 1) {
                 $this->view->cat_title3 = "Todo";
             } else {
                 $this->view->cat_title3 = Model_Boards::getCategoryTitle($request->getPost('sport_category_3'));
             }
         }
     } else {
         $this->view->sport_category_3 = '';
     }
     $this->view->usertype_title = '';
     $this->view->type_user = '';
     if ($request->issetPost('type_user')) {
         $this->view->type_user = $request->getPost('type_user');
         if ($request->getPost('type_user') != "") {
             $this->view->usertype_title = Model_Users::getUserTypeTitle($request->getPost('type_user'));
         }
     } else {
         $this->view->type_user = '';
     }
     //gender
     if ($request->issetPost('gender')) {
         $this->view->gender = $request->getRequest('gender');
     } elseif (isset($user_data['gender'])) {
         $this->view->gender = $user_data['gender'];
     } else {
         $this->view->gender = "";
     }
     //location
     if ($request->issetPost('location')) {
         $this->view->location = $request->getPost('location');
     } elseif (isset($user_data['location'])) {
         $this->view->location = $user_data['location'];
     } else {
         $this->view->location = '';
     }
     //sport category
     if ($request->issetPost('sport_category')) {
         $this->view->sport_category = $request->getPost('sport_category');
         if ($request->getPost('sport_category') != "") {
             $this->view->cat_title = Model_Boards::getCategoryTitle($request->getPost('sport_category'));
         }
     } elseif (isset($user_data['sport_category'])) {
         $this->view->sport_category = $user_data['sport_category'];
         $this->view->cat_title = Model_Boards::getCategoryTitle($user_data['sport_category']);
     } else {
         $this->view->cat_title = '';
         $this->view->sport_category = '';
     }
     //age
     if ($request->issetPost('age')) {
         $this->view->age = $request->getPost('age');
         if ($request->getPost('age') != "") {
             $this->view->age_title = Model_Users::getAgeTitle($request->getPost('age'));
         }
     } elseif (isset($user_data['age'])) {
         $this->view->age = $user_data['age'];
         $this->view->age_title = Model_Users::getAgeTitle($user_data['age']);
     } else {
         $this->view->age_title = '';
         $this->view->age = '';
     }
     //level
     if ($request->issetPost('level')) {
         $this->view->level = $request->getPost('level');
         if ($request->getPost('level') != "") {
             $this->view->level_title = Model_Users::getLevelTitle($request->getPost('level'));
         }
     } elseif (isset($user_data['level'])) {
         $this->view->level = $user_data['level'];
         $this->view->level_title = Model_Users::getLevelTitle($user_data['level']);
     } else {
         $this->view->level_title = '';
         $this->view->level = '';
     }
     //option1
     if ($request->issetPost('option1')) {
         $this->view->option1 = $request->getPost('option1');
     } elseif (isset($user_data['option1'])) {
         $this->view->option1 = $user_data['option1'];
     } else {
         $this->view->option1 = '';
     }
     //option2
     if ($request->issetPost('option2')) {
         $this->view->option2 = $request->getPost('option2');
     } elseif (isset($user_data['option2'])) {
         $this->view->option2 = $user_data['option2'];
     } else {
         $this->view->option2 = '';
     }
     //option3
     if ($request->issetPost('option3')) {
         $this->view->option3 = $request->getPost('option3');
     } elseif (isset($user_data['option3'])) {
         $this->view->option3 = $user_data['option3'];
     } else {
         $this->view->option3 = '';
     }
     //option4
     if ($request->issetPost('option4')) {
         $this->view->option4 = $request->getPost('option4');
     } elseif (isset($user_data['option4'])) {
         $this->view->option4 = $user_data['option4'];
     } else {
         $this->view->option4 = '';
     }
     //option5
     if ($request->issetPost('option5')) {
         $this->view->option5 = $request->getPost('option5');
     } elseif (isset($user_data['option5'])) {
         $this->view->option5 = $user_data['option5'];
     } else {
         $this->view->option5 = '';
     }
     //option6
     if ($request->issetPost('option6')) {
         $this->view->option6 = $request->getPost('option6');
     } elseif (isset($user_data['option6'])) {
         $this->view->option6 = $user_data['option6'];
     } else {
         $this->view->option6 = '';
     }
     //option7
     if ($request->issetPost('option7')) {
         $this->view->option7 = $request->getPost('option7');
     } elseif (isset($user_data['option7'])) {
         $this->view->option7 = $user_data['option7'];
     } else {
         $this->view->option7 = '';
     }
     //option8
     if ($request->issetPost('option8')) {
         $this->view->option8 = $request->getPost('option8');
     } elseif (isset($user_data['option8'])) {
         $this->view->option8 = $user_data['option8'];
     } else {
         $this->view->option8 = '';
     }
     //option9
     if ($request->issetPost('option9')) {
         $this->view->option9 = $request->getPost('option9');
     } elseif (isset($user_data['option9'])) {
         $this->view->option9 = $user_data['option9'];
     } else {
         $this->view->option9 = '';
     }
     //option10
     if ($request->issetPost('option10')) {
         $this->view->option10 = $request->getPost('option10');
     } elseif (isset($user_data['option10'])) {
         $this->view->option10 = $user_data['option10'];
     } else {
         $this->view->option10 = '';
     }
     //controlador
     /*
               if ($id == "amatteur")
               {
               $this->view->advancedActive = "amatteur";
               $with_action = $request->getAction();
               $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced');
     
               }
               else if ($id == "activate")
               {
              * */
     $this->view->advancedActive = "activate";
     $with_action = $request->getAction();
     $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search&action=activate');
     /*
      }
      else if ($id == "services")
      {
      $this->view->advancedActive = "services";
      $with_action = $request->getAction();
      $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced');
     
      }
     */
     if ($request->isPost()) {
         $query = $request->getRequest('words');
         $this->view->query = $query;
         //$this->view->menuSearch = $this->searchMenu($query);
         $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_description' => $query, 'filter_marker' => $request->getRequest('marker'));
         $this->view->pins = '';
         $pins = Model_Pins::getPins($data);
         if ($pins) {
             foreach ($pins as $pin) {
                 $this->view->pins .= Helper_Pin::returnHtml($pin);
             }
             // 			JO_Registry::set('marker', Model_Pins::getMaxPin($data));
         }
     }
     /*
      if(in_array($request->getAction(), array('index', 'page', 'view'))) {
      $with_action = 0;
      $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search');
      } elseif( in_array($request->getAction(), array('boards', 'people')) ) {
      $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...');
     */
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Esempio n. 5
0
 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 = '';
     }
 }
Esempio n. 6
0
 public function upload_imagesViewAction()
 {
     $request = $this->getRequest();
     if ($request->isXmlHttpRequest() && JO_Session::get('upload_from_file') && file_exists(BASE_PATH . JO_Session::get('upload_from_file'))) {
         $this->view->createBoard = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create');
         $temporary = '/cache/review/';
         $upload_folder = BASE_PATH . $temporary;
         $boards = Model_Boards::getBoards(array('filter_user_id' => JO_Session::get('user[user_id]'), 'order' => 'boards.sort_order', 'sort' => 'ASC', 'friendly' => JO_Session::get('user[user_id]')));
         $this->view->boards = array();
         if ($boards) {
             foreach ($boards as $board) {
                 $this->view->boards[] = array('board_id' => $board['board_id'], 'title' => $board['title']);
             }
         }
         //////////// Categories ////////////
         $this->view->categories = array();
         $categories = Model_Categories::getCategories(array('filter_status' => 1));
         foreach ($categories as $category) {
             $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
             $this->view->categories[] = $category;
         }
         $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=addpin&action=upload_images');
         $this->view->upload_action = WM_Router::create($request->getBaseUrl() . '?controller=addpin&action=upload_imagesView');
         $this->view->from_url = WM_Router::create($request->getBaseUrl() . '?controller=addpin&action=fromfile');
         $this->view->file = JO_Session::get('upload_from_file_name');
         $this->view->full_path = WM_Router::create($request->getBaseUrl() . JO_Session::get('upload_from_file'));
         $this->view->success = $this->view->render('upload_images', 'addpin');
     } else {
         $this->forward('addpin', 'fromfile');
     }
     $this->noViewRenderer(true);
     echo $this->view->success;
 }
Esempio n. 7
0
 private function getForm()
 {
     $request = $this->getRequest();
     $board_id = $request->getRequest('id');
     $board_info = Model_Boards::getBoard($board_id);
     if ($board_info) {
         $this->view->board_id = $board_id;
         //			$this->view->title = $board_info['title'];
         /*$this->view->type = $user_info['type'];*/
         /*$this->view->username = $user_info['username'];*/
         //			$this->view->names = $user_info['firstname'] . ' ' . $user_info['lastname'];
         /*$this->view->email = $user_info['email'];*/
         //			$this->view->status = $user_info['status'];
         //			$this->view->profile_url = WM_Router::create( $this->getRequest()->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_id );
     }
     if ($request->getPost('title')) {
         $this->view->title = $request->getPost('title');
     } elseif (isset($board_info)) {
         $this->view->title = $board_info['title'];
     } else {
         $this->view->title = '';
     }
     if ($request->getPost('description')) {
         $this->view->description = $request->getPost('description');
     } elseif (isset($board_info)) {
         $this->view->description = $board_info['description'];
     } else {
         $this->view->description = '';
     }
     if ($request->getPost('category_id')) {
         $this->view->category_id = $request->getPost('category_id');
     } elseif (isset($board_info)) {
         $this->view->category_id = $board_info['category_id'];
     } else {
         $this->view->category_id = '';
     }
     if ($request->getPost('keyword')) {
         $this->view->keyword = $request->getPost('keyword');
     } elseif (isset($board_info)) {
         $this->view->keyword = $board_info['keyword'];
     } else {
         $this->view->keyword = '';
     }
     $this->view->categories = Model_Categories::getCategories();
 }
Esempio n. 8
0
 private function getForm()
 {
     $request = $this->getRequest();
     $categories_id = $request->getRequest('id');
     $places_model = new Model_Categories();
     if ($categories_id) {
         $categories_info = $places_model->getCategory($categories_id);
         $this->view->parent_id = $categories_info['parent_id'];
         $this->view->categories = $places_model->getCategories();
         $this->view->subcategories = $places_model->getSubCategories($categories_id);
     }
     $this->view->cancel_url = $request->getModule() . '/categories/';
     if ($request->getPost('status')) {
         $this->view->status = $request->getPost('status');
     } elseif (isset($categories_info)) {
         $this->view->status = $categories_info['status'];
     } else {
         $this->view->status = 1;
     }
     if ($request->getPost('title')) {
         $this->view->title = $request->getPost('title');
     } elseif (isset($categories_info)) {
         $this->view->title = $categories_info['title'];
     }
     if ($request->getPost('meta_title')) {
         $this->view->meta_title = $request->getPost('meta_title');
     } elseif (isset($categories_info)) {
         $this->view->meta_title = $categories_info['meta_title'];
     }
     if ($request->getPost('meta_description')) {
         $this->view->meta_description = $request->getPost('meta_description');
     } elseif (isset($categories_info)) {
         $this->view->meta_description = $categories_info['meta_description'];
     }
     if ($request->getPost('meta_keywords')) {
         $this->view->meta_keywords = $request->getPost('meta_keywords');
     } elseif (isset($categories_info)) {
         $this->view->meta_keywords = $categories_info['meta_keywords'];
     }
     if ($request->getRequest('keyword')) {
         $this->view->keyword = $request->getRequest('keyword');
     } elseif (isset($categories_info)) {
         $this->view->keyword = $categories_info['keyword'];
     }
     // image
     $image_model = new Helper_Images();
     if ($request->getRequest('image')) {
         $this->view->image = $request->getRequest('image');
     } elseif (isset($categories_info['image'])) {
         $this->view->image = $categories_info['image'];
     } else {
         $this->view->image = '';
     }
     if ($this->view->image) {
         $this->view->preview_image = $image_model->resize($this->view->image, 100, 100);
     } else {
         $this->view->preview_image = $image_model->resize(JO_Registry::get('no_image'), 100, 100);
     }
     if (!$this->view->preview_image) {
         $this->view->preview_image = $image_model->resize(JO_Registry::get('no_image'), 100, 100);
     }
 }
Esempio n. 9
0
 private function getForm()
 {
     $request = $this->getRequest();
     $id = $request->getQuery('id');
     $module = new Model_Attributes();
     $this->view->sub_of = $sub_of = $this->getRequest()->getRequest('sub_of', 0);
     if ($sub_of) {
         $category_info = Model_Attributes::getAttribute2($sub_of);
         if (!$category_info) {
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/attributes/');
         }
         $this->view->parent_name = $category_info['name'];
         $this->view->parent_href = $this->getRequest()->getModule() . '/attributes/';
     }
     if ($id) {
         $info = $module->getAttribute($id);
     }
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } elseif (isset($info)) {
         $this->view->name = $info['name'];
     } else {
         $this->view->name = '';
     }
     if ($request->getPost('search')) {
         $this->view->search = $request->getPost('search');
     } elseif (isset($info)) {
         $this->view->search = $info['search'];
     } else {
         $this->view->search = 'false';
     }
     if ($request->getPost('visible')) {
         $this->view->visible = $request->getPost('visible');
     } elseif (isset($info)) {
         $this->view->visible = $info['visible'];
     } else {
         $this->view->visible = 'true';
     }
     if ($sub_of) {
         $this->view->categories = Model_Attributes::getAttributes();
         if ($request->getPost('category_id')) {
             $this->view->category_id = $request->getPost('category_id');
         } elseif (isset($info)) {
             $this->view->category_id = $info['category_id'];
         } else {
             $this->view->category_id = '';
         }
         if (isset($info)) {
             $this->view->photo = $info['photo'];
         } else {
             $this->view->photo = '';
         }
     } else {
         $this->view->categories = Model_Categories::getCategories(array('filter_sub_of' => 0));
         $this->view->types = self::typeAttributes();
         if ($request->getPost('categories')) {
             $this->view->categories_s = $request->getPost('categories');
         } elseif (isset($info)) {
             $this->view->categories_s = explode(',', $info['categories']);
         } else {
             $this->view->categories_s = array();
         }
         if ($request->getPost('type')) {
             $this->view->type = $request->getPost('type');
         } elseif (isset($info)) {
             $this->view->type = $info['type'];
         } else {
             $this->view->type = '';
         }
     }
 }
Esempio n. 10
0
 public function header_partAction()
 {
     $request = $this->getRequest();
     if (JO_Session::get('user[user_id]') && JO_Session::get('category_id')) {
         new Model_Users_Edit(JO_Session::get('user[user_id]'), array('first_login' => '0'));
         JO_Session::clear('category_id');
         $template = Model_Notification::getTemplate('welcome');
         if ($template) {
             $template_data = array('user_id' => JO_Session::get('user[user_id]'), 'user_firstname' => JO_Session::get('user[firstname]'), 'user_lastname' => JO_Session::get('user[lastname]'), 'user_fullname' => JO_Session::get('user[fullname]'), 'user_username' => JO_Session::get('user[username]'), 'site_url' => $request->getBaseUrl(), 'site_name' => Helper_Config::get('site_name'), 'mail_footer' => html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8'));
             if (!$template['title']) {
                 $template['title'] = $this->translate('Welcome to ${site_name}!');
             }
             $title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data);
             $body = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data);
             Model_Email::send(JO_Session::get('user[email]'), Helper_Config::get('noreply_mail'), $title, $body);
         }
     }
     $this->view->show_landing = !Helper_Config::get('enable_free_registration');
     $this->getLayout()->placeholder('site_name', Helper_Config::get('site_name'));
     $this->view->site_name = Helper_Config::get('site_name');
     $this->view->meta_title = Helper_Config::get('meta_title');
     $this->getLayout()->placeholder('google_analytics', html_entity_decode(Helper_Config::get('google_analytics'), ENT_QUOTES, 'utf-8'));
     $this->view->baseUrl = $request->getBaseUrl();
     $this->view->site_logo = $request->getBaseUrl() . 'data/images/logo.png';
     if (Helper_Config::get('site_logo') && file_exists(BASE_PATH . '/uploads' . Helper_Config::get('site_logo'))) {
         $this->view->site_logo = $request->getBaseUrl() . 'uploads' . Helper_Config::get('site_logo');
     }
     ///global metas
     if (!JO_Layout::getInstance()->placeholder('header_metas')) {
         $to_title = '';
         if (JO_Session::get('user[user_id]')) {
             $to_title = JO_Session::get('user[fullname]') . ' / ';
         }
         $this->getLayout()->placeholder('title', $to_title . Helper_Config::get('meta_title'));
         JO_Layout::getInstance()->placeholder('header_metas', $this->view->callChildren('layout/header_metas', array('meta_title' => Helper_Config::get('meta_title'), 'meta_description' => Helper_Config::get('meta_description'), 'meta_keywords' => Helper_Config::get('meta_keywords'), 'site_logo' => $this->view->site_logo)));
     }
     if (Helper_Config::get('favicon') && file_exists(BASE_PATH . '/uploads' . Helper_Config::get('favicon'))) {
         $this->getLayout()->placeholder('favicon', $request->getBaseUrl() . 'uploads' . Helper_Config::get('favicon'));
     }
     $this->getLayout()->placeholder('site_logo', $this->view->site_logo);
     $this->view->show_header_invate = !JO_Session::get('user[user_id]');
     $this->view->controller_open = $request->getController();
     //==== brand =====//
     $this->view->show_brand = false;
     /*if( JO_Registry::get('license_powered_check') == 'false' && Helper_Config::get('config_hide_brand') ) {
     			$this->view->show_brand = false;
     		}*/
     ////////// CURRENCY
     //autoupdate currency if set
     if (Helper_Config::get('config_currency_auto_update')) {
         WM_Currency::updateCurrencies();
     }
     //////////// Categories ////////////
     $this->view->categories = array();
     $this->view->category_active = false;
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $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 {
         }
         $this->view->categories[] = $category;
     }
     ////////////////////////////// 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 = Helper_Uploadimages::userAvatars(JO_Session::get('user'));
         $this->view->self_profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $this->view->is_loged);
         $this->view->self_firstname = JO_Session::get('user[firstname]');
         $this->view->logout = WM_Router::create($request->getBaseUrl() . '?controller=users&action=logout');
         $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->registration = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register');
     ////////////////////////////// GIFTS ///////////////////////////
     $this->view->gifts = WM_Router::create($request->getBaseUrl() . '?controller=gifts');
     $this->view->giftSums = array();
     $sums = Model_Gifts::getAll();
     foreach ($sums as $sum) {
         if ($sum['price_from'] || $sum['price_to']) {
             $title = WM_Currency::format($sum['price_from']);
             $url = '';
             if ($sum['price_to']) {
                 $title .= ' - ';
                 $title .= WM_Currency::format($sum['price_to']);
                 $url = '&price_to=' . $sum['price_to'];
             } else {
                 $title .= '+';
             }
             $this->view->giftSums[] = array('title' => $title, 'href' => WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=' . $sum['price_from'] . $url));
         }
     }
     //////////// Video ////////////
     $this->view->video_url = WM_Router::create($request->getBaseUrl() . '?controller=videos');
     //////////// Popular ////////////
     $this->view->popular_url = WM_Router::create($request->getBaseUrl() . '?controller=popular');
     //////////// ALL PINS ////////////
     $this->view->all_url = WM_Router::create($request->getBaseUrl() . '?controller=all');
     ////////////////////////////// SEARCH ///////////////////////////
     //$this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search');
     if ($request->getAction() != 'index' && $request->getController() == 'search') {
         $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');
     ////////////////////////////// ADD PIN ///////////////////////////
     $this->view->addPin = WM_Router::create($request->getBaseUrl() . '?controller=addpin');
     ////////////////////////////// user ignore search engine ///////////////////////////
     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 ///////////////////////////
     $about_menu = Model_Pages::getMenu(0);
     $this->view->about_menu = array();
     foreach ($about_menu as $row => $page) {
         $class = '';
         if ($row == 0) {
             $class .= ' first';
         } else {
             if (count($about_menu) - 1 == $row) {
                 $class .= ' last';
             }
         }
         if ($page['page_id'] == -1) {
             $has = true;
         } else {
             if ($page['status']) {
                 if (isset($has) && $has) {
                     $class .= " group";
                     $has = false;
                 }
                 $this->view->about_menu[] = array('class' => trim($class), 'title' => $page['title'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page['page_id']));
             }
             $has = false;
         }
     }
     ////////////////////////////// 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;
         		}*/
         $this->view->show_new_password = true;
     }
     ////////////////////////////// Board category ///////////////////////////
     if (($board_info = JO_Registry::forceGet('board_category_change')) instanceof ArrayObject) {
         $this->view->board_category_change = array('title' => $board_info['board_title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board_info['board_user_id'] . '&board_id=' . $board_info['board_board_id']));
     }
     ///////////////////// invate menu user /////////////////////////////
     $methodsforinvates = $this->view->callChildrenView('invates/methodsforinvates');
     $this->view->methodsforinvates = (array) $methodsforinvates->user_invate_friends;
     ///////////////////// extra metatags /////////////////////////////
     $extra_metas = '';
     $extra_metas_get = Model_Extensions::getByMethod('extra_metas');
     foreach ($extra_metas_get as $id => $mod) {
         $extra_metas .= $this->view->callChildren('modules_' . $mod . '_extrametas');
     }
     if ($extra_metas) {
         JO_Layout::getInstance()->placeholder('header_metas', $extra_metas);
     }
 }
Esempio n. 11
0
 public function searchAction()
 {
     $request = $this->getRequest();
     $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=events&action=search');
     $event_data = Model_Users::getUser(JO_Session::get('user[user_id]'));
     $this->view->user_data = $event_data;
     //////////// Categories ////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
         $this->view->categories[] = $category;
     }
     if ($request->issetRequest('eventname')) {
         $this->view->eventname = $request->getRequest('eventname');
     } else {
         $this->view->eventname = '';
     }
     if ($request->issetRequest('organiza')) {
         $this->view->organiza = $request->getRequest('organiza');
     } else {
         $this->view->organiza = '';
     }
     //date_event
     if ($request->issetRequest('date_event1')) {
         $this->view->date_event1 = $request->getRequest('date_event1');
     } elseif (isset($user_data['date_event1'])) {
         $this->view->date_event1 = $user_data['date_event1'];
     } else {
         $this->view->date_event1 = "";
     }
     //date_event
     if ($request->issetRequest('date_event2')) {
         $this->view->date_event2 = $request->getRequest('date_event2');
     } elseif (isset($user_data['date_event2'])) {
         $this->view->date_event2 = $user_data['date_event2'];
     } else {
         $this->view->date_event2 = "";
     }
     //location
     if ($request->issetRequest('location')) {
         $this->view->location = $request->getRequest('location');
     } elseif (isset($user_data['location'])) {
         $this->view->location = $user_data['location'];
     } else {
         $this->view->location = '';
     }
     //sport category
     if ($request->issetRequest('sport_category')) {
         $this->view->sport_category = $request->getRequest('sport_category');
         if ($request->getRequest('sport_category') != "") {
             $this->view->cat_title = Model_Boards::getCategoryTitle($request->getRequest('sport_category'));
         }
     } elseif (isset($user_data['sport_category'])) {
         $this->view->sport_category = $user_data['sport_category'];
         $this->view->cat_title = Model_Boards::getCategoryTitle($user_data['sport_category']);
     } else {
         $this->view->cat_title = '';
         $this->view->sport_category = '';
     }
     //compartir
     if ($request->issetRequest('compartir')) {
         $this->view->compartir = $request->getRequest('compartir');
     } elseif (isset($user_data['compartir'])) {
         $this->view->compartir = $user_data['compartir'];
     } else {
         $this->view->compartir = '';
     }
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $this->view->error = "";
     if ($request->issetRequest('zoom')) {
         $this->view->isPost = "true";
         //if( $request->isPost() ) {
         $this->view->all = true;
         $soloFechaActual = true;
         if ($this->view->date_event2 != "" || $this->view->date_event1 != "") {
             $soloFechaActual = false;
         }
         $dataEvents = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_eventname' => $request->getRequest('eventname'), 'filter_organiza' => $request->getRequest('organiza'), 'filter_location' => $request->getRequest('location'), 'filter_sport_category' => $request->getRequest('sport_category'), 'filter_event_date1' => $request->getRequest('date_event1'), 'filter_event_date2' => $request->getRequest('date_event2'), 'filter_compartir' => $request->getRequest('compartir'), 'filter_delete_event' => '1', 'filter_actual_date' => $soloFechaActual, 'sort' => 'ASC', 'order' => 'date_event');
         $events = Model_Events::getEvents($dataEvents);
         if ($events) {
             $i = 0;
             foreach ($events as $key => $event) {
                 $this->view->all = false;
                 $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["sport_category"] = Model_Boards::getCategoryTitle($event["sport_category"]);
                 $event['date_event'] = Model_Events::cambiafyh_espanol($event['date_event']);
                 $event['href'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']);
                 $href = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']);
                 $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_user_id' => $event["user_id"]);
                 $users = Model_Users::getUsers($data);
                 if ($users) {
                     $event['fullname'] = $users[0]["fullname"];
                     $event['hrefuser'] = 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->from_url = WM_Router::create($request->getBaseUrl() . '?controller=addpin&action=fromurl');
                 $this->view->successfu_edite = false;
                 $view->event = $event;
                 $this->view->eventsBox .= $view->render('boxEvent', 'events');
                 //$events[$i]["href"] = $href;
                 //$eventsTot[] = $events[$i];
                 $eventsTot[] = $event;
                 $i++;
             }
             $this->view->eventos = $eventsTot;
             $this->view->class_contaner = 'persons';
         } else {
             $this->view->error = $this->translate('La búsqueda no ha devuelto resultados');
         }
     } else {
         $this->view->all = true;
         /*
                         
                         $this->view->all = false;
         
                         $dataEvents = array(
            'start' => ( JO_Registry::get('config_front_limit') * $page ) - JO_Registry::get('config_front_limit'),
            'limit' => JO_Registry::get('config_front_limit')
                         );
         
                         $events = Model_Events::getEvents($dataEvents);
         
                         if ($events)
                         {
            $i=0;
            foreach ($events AS $key => $event)
            {
                $this->view->all = true;                        
                $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["sport_category"] = Model_Boards::getCategoryTitle($event["sport_category"]);
                
                $event['date_event'] = Model_Events::cambiafyh_espanol($event['date_event']);                        
                
                $event['href'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']);
                $href = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']);
                
                $data = array(
                    'start' => ( JO_Registry::get('config_front_limit') * $page ) - JO_Registry::get('config_front_limit'),
                    'limit' => JO_Registry::get('config_front_limit'),
                    'filter_user_id' => $event["user_id"]
                );
         
                $users = Model_Users::getUsers($data);
                if ($users)
                {
                    $event['fullname'] = $users[0]["fullname"];
                    $event['hrefuser'] = 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']);
                
                $view->event = $event;
                $this->view->eventsBox .= $view->render('boxEvent', 'events');
                
                //$events[$i]["href"] = $href;
                //$eventsTot[] = $events[$i];
                $eventsTot[] = $event;
                $i++;
            }
         
                
            $this->view->successfu_edite = false;                    
            $this->view->eventos = $eventsTot;
            $this->view->class_contaner = 'persons';
                         }
                         else
                         {
            $this->view->error = $this->translate('La búsqueda no ha devuelto resultados');
                         }
         * 
         */
     }
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Esempio n. 12
0
 public function secondAction()
 {
     $request = $this->getRequest();
     $this->view->total_following = Model_Boards_Follow::totalBoardFollow(JO_Session::get('user[user_id]'));
     if ($this->view->total_following < 5) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=welcome'));
     }
     //////////// Categories ////////////
     $this->view->categories = array();
     /* v2.2 */
     $config_enable_follow_private_profile = '';
     if (Helper_Config::get('config_enable_follow_private_profile')) {
         $config_enable_follow_private_profile = ' AND user_id IN (SELECT user_id FROM users WHERE public = 1)';
     }
     /* v2.2 */
     $categories = Model_Categories::getCategories(array('filter_status' => 1, 'where' => new JO_Db_Expr('category.category_id IN (SELECT category_id FROM boards WHERE category_id = category.category_id AND pins > 0 ' . $config_enable_follow_private_profile . ')')));
     $model_images = new Helper_Images();
     foreach ($categories as $category) {
         if ($category['image']) {
             $category['thumb'] = $model_images->resize($category['image'], 113, 113, true);
         } else {
             $category['thumb'] = $model_images->resize(Helper_Config::get('no_image'), 113, 113);
         }
         $this->view->categories[] = $category;
     }
     $this->view->load_boards = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=welcome&action=boardsideas');
     $this->view->next_step = WM_Router::create($request->getBaseUrl() . '?controller=welcome&action=third');
     $this->view->createBoard = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=createboardwithoutcategory');
     $this->view->createBoardWithCat = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create');
     //call header and footer childrens
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Esempio n. 13
0
 public function sportsAction()
 {
     //echo"entrando";
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     $response = $this->getResponse();
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $callback = $request->getRequest('callback');
     if (!preg_match('/^([a-z0-9_.]{1,})$/', $callback)) {
         $callback = false;
     }
     $return = array();
     //////////// Categories ////////////
     $categorias = array();
     //$this->view->category_active = false;
     //array('id' => $result['user_id']); // $user_data;
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
         $categorias[] = $category;
     }
     $return = array($categorias);
     if ($callback) {
         $return = $callback . '(' . JO_Json::encode($return) . ')';
     } else {
         $response->addHeader('Cache-Control: no-cache, must-revalidate');
         $response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         $response->addHeader('Content-type: application/json; charset=utf-8');
         $return = JO_Json::encode($return);
     }
     $response->appendBody($return);
 }
Esempio n. 14
0
 public function getForm()
 {
     $request = $this->getRequest();
     $this->view->templates = $this->getTemplates(array('mobile'));
     $config = $request->getPost('config');
     $images = $request->getPost('images');
     $pages = $request->getPost('pages');
     $store_config = Model_Settings::getSettingsPairs();
     $this->view->pages = Model_Pages::getPagesFromParent(0);
     $this->view->pages_about = array();
     $this->view->pages_about[] = array('title' => $this->translate('SEPARATOR MENU'), 'page_id' => -1);
     if ($this->view->pages) {
         foreach ($this->view->pages as $p) {
             $this->view->pages_about[] = array('title' => $p['title'], 'page_id' => $p['page_id']);
         }
     }
     $this->view->currencies = Model_Currency::getCurrencies();
     $this->view->app_path = BASE_PATH;
     //////////////////////////////////////// GENERAL ////////////////////////////////////////
     if (isset($config['config_base_domain'])) {
         $this->view->config_base_domain = $config['config_base_domain'];
     } elseif (isset($store_config['config_base_domain'])) {
         $this->view->config_base_domain = $store_config['config_base_domain'];
     } else {
         $this->view->config_base_domain = $request->getBaseUrl();
     }
     if (isset($config['config_on_facebook'])) {
         $this->view->config_on_facebook = $config['config_on_facebook'];
     } elseif (isset($store_config['config_on_facebook'])) {
         $this->view->config_on_facebook = $store_config['config_on_facebook'];
     } else {
         $this->view->config_on_facebook = '';
     }
     if (isset($config['google_analytics'])) {
         $this->view->google_analytics = $config['google_analytics'];
     } elseif (isset($store_config['google_analytics'])) {
         $this->view->google_analytics = $store_config['google_analytics'];
     }
     if (isset($config['config_fix_image_thumb_editor'])) {
         $this->view->config_fix_image_thumb_editor = $config['config_fix_image_thumb_editor'];
     } elseif (isset($store_config['config_fix_image_thumb_editor'])) {
         $this->view->config_fix_image_thumb_editor = $store_config['config_fix_image_thumb_editor'];
     }
     if (isset($config['config_fix_external_urls'])) {
         $this->view->config_fix_external_urls = $config['config_fix_external_urls'];
     } elseif (isset($store_config['config_fix_external_urls'])) {
         $this->view->config_fix_external_urls = $store_config['config_fix_external_urls'];
     }
     //////////////////////////////////////// SEO ////////////////////////////////////////
     if (isset($config['site_name'])) {
         $this->view->site_name = $config['site_name'];
     } elseif (isset($store_config['site_name'])) {
         $this->view->site_name = $store_config['site_name'];
     }
     if (isset($config['meta_title'])) {
         $this->view->meta_title = $config['meta_title'];
     } elseif (isset($store_config['meta_title'])) {
         $this->view->meta_title = $store_config['meta_title'];
     }
     if (isset($config['meta_keywords'])) {
         $this->view->meta_keywords = $config['meta_keywords'];
     } elseif (isset($store_config['meta_keywords'])) {
         $this->view->meta_keywords = $store_config['meta_keywords'];
     }
     if (isset($config['meta_description'])) {
         $this->view->meta_description = $config['meta_description'];
     } elseif (isset($store_config['meta_description'])) {
         $this->view->meta_description = $store_config['meta_description'];
     }
     //////////////////////////////////////// Options ////////////////////////////////////////
     if (isset($config['config_admin_limit'])) {
         $this->view->config_admin_limit = $config['config_admin_limit'];
     } elseif (isset($store_config['config_admin_limit'])) {
         $this->view->config_admin_limit = $store_config['config_admin_limit'];
     } else {
         $this->view->config_admin_limit = 15;
     }
     if (isset($config['config_front_limit'])) {
         $this->view->config_front_limit = $config['config_front_limit'];
     } elseif (isset($store_config['config_front_limit'])) {
         $this->view->config_front_limit = $store_config['config_front_limit'];
     } else {
         $this->view->config_front_limit = 10;
     }
     if (isset($config['template'])) {
         $this->view->template = $config['template'];
     } elseif (isset($store_config['template'])) {
         $this->view->template = $store_config['template'];
     }
     if (isset($config['config_maintenance'])) {
         $this->view->config_maintenance = $config['config_maintenance'];
     } elseif (isset($store_config['config_maintenance'])) {
         $this->view->config_maintenance = $store_config['config_maintenance'];
     } else {
         $this->view->config_maintenance = 0;
     }
     if (isset($config['config_hide_brand'])) {
         $this->view->config_hide_brand = $config['config_hide_brand'];
     } elseif (isset($store_config['config_hide_brand'])) {
         $this->view->config_hide_brand = $store_config['config_hide_brand'];
     } else {
         $this->view->config_hide_brand = 0;
     }
     $this->view->data_timezones = JO_Date_Timezones::getTimezonse();
     if (isset($config['phpSettings']['date.timezone'])) {
         $this->view->date_timezone = $config['phpSettings']['date.timezone'];
     } elseif (isset($store_config['phpSettings']['date.timezone'])) {
         $this->view->date_timezone = $store_config['phpSettings']['date.timezone'];
     } else {
         $this->view->date_timezone = 'UTC';
     }
     if (isset($config['config_disable_js'])) {
         $this->view->config_disable_js = $config['config_disable_js'];
     } elseif (isset($store_config['config_disable_js'])) {
         $this->view->config_disable_js = $store_config['config_disable_js'];
     } else {
         $this->view->config_disable_js = 0;
     }
     if (isset($config['config_pin_prefix'])) {
         $this->view->config_pin_prefix = $config['config_pin_prefix'];
     } elseif (isset($store_config['config_pin_prefix'])) {
         $this->view->config_pin_prefix = $store_config['config_pin_prefix'];
     } else {
         $this->view->config_pin_prefix = 'pin';
     }
     if (isset($config['config_user_view'])) {
         $this->view->config_user_view = $config['config_user_view'];
     } elseif (isset($store_config['config_user_view'])) {
         $this->view->config_user_view = $store_config['config_user_view'];
     } else {
         $this->view->config_user_view = 'fullname';
     }
     if (isset($config['config_gallery_pin'])) {
         $this->view->config_gallery_pin = $config['config_gallery_pin'];
     } elseif (isset($store_config['config_gallery_pin'])) {
         $this->view->config_gallery_pin = $store_config['config_gallery_pin'];
     } else {
         $this->view->config_gallery_pin = 1;
     }
     if (isset($config['config_gallery_limit'])) {
         $this->view->config_gallery_limit = $config['config_gallery_limit'];
     } elseif (isset($store_config['config_gallery_limit'])) {
         $this->view->config_gallery_limit = $store_config['config_gallery_limit'];
     } else {
         $this->view->config_gallery_limit = 5;
     }
     if (isset($config['config_home_page_view_not_loged'])) {
         $this->view->config_home_page_view_not_loged = $config['config_home_page_view_not_loged'];
     } elseif (isset($store_config['config_home_page_view_not_loged'])) {
         $this->view->config_home_page_view_not_loged = $store_config['config_home_page_view_not_loged'];
     } else {
         $this->view->config_home_page_view_not_loged = 'randum';
     }
     if (isset($config['config_home_page_view_loged'])) {
         $this->view->config_home_page_view_loged = $config['config_home_page_view_loged'];
     } elseif (isset($store_config['config_home_page_view_loged'])) {
         $this->view->config_home_page_view_loged = $store_config['config_home_page_view_loged'];
     } else {
         $this->view->config_home_page_view_loged = 'following';
     }
     if (isset($config['config_image_minimum_size'])) {
         $this->view->config_image_minimum_size = $config['config_image_minimum_size'];
     } elseif (isset($store_config['config_image_minimum_size'])) {
         $this->view->config_image_minimum_size = $store_config['config_image_minimum_size'];
     } else {
         $this->view->config_image_minimum_size = 80;
     }
     /* v2.2 */
     if (isset($config['config_enable_follow_private_profile'])) {
         $this->view->config_enable_follow_private_profile = $config['config_enable_follow_private_profile'];
     } elseif (isset($store_config['config_enable_follow_private_profile'])) {
         $this->view->config_enable_follow_private_profile = $store_config['config_enable_follow_private_profile'];
     } else {
         $this->view->config_enable_follow_private_profile = 0;
     }
     /* v2.2 */
     //////////////////////////////////////// Storage ////////////////////////////////////////
     $this->view->upload_storage = array();
     $this->view->upload_storage[] = array('key' => 'Model_Upload_Locale', 'active' => 'Model_Upload_Locale' == Helper_Config::get('file_upload_method'), 'name' => $this->translate('Locale'));
     /*$storage = (array)$this->view->callChildrenView('modules_storage');
      	if(isset($storage['modules']) && $storage['modules']) {*/
     $storage_modules = $this->getUploadStorages();
     if ($storage_modules) {
         foreach ($storage_modules as $mod) {
             if ($mod['is_installed']) {
                 $key = 'Model_Upload_' . ucfirst(strtolower($mod['key']));
                 $this->view->upload_storage[] = array('key' => $key, 'active' => $key == Helper_Config::get('file_upload_method'), 'name' => $mod['name']);
             }
         }
     }
     if (isset($config['config_comments_list'])) {
         $this->view->config_comments_list = $config['config_comments_list'];
     } elseif (isset($store_config['config_comments_list'])) {
         $this->view->config_comments_list = $store_config['config_comments_list'];
     } else {
         $this->view->config_comments_list = 0;
     }
     /////////////////////////////// CURRENCY ///////////////////////
     $this->view->currencies = array();
     $currencies = Model_Currency::getCurrencies(array('status' => 1));
     //WM_Currency::getCurrencies();
     if ($currencies) {
         $this->view->currencies = $currencies;
     }
     if (isset($config['config_currency'])) {
         $this->view->config_currency = $config['config_currency'];
     } elseif (isset($store_config['config_currency'])) {
         $this->view->config_currency = $store_config['config_currency'];
     }
     if (isset($config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $config['config_currency_auto_update'];
     } elseif (isset($store_config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $store_config['config_currency_auto_update'];
     } else {
         $this->view->config_currency_auto_update = 1;
     }
     if (isset($config['config_cache_live'])) {
         $this->view->config_cache_live = $config['config_cache_live'];
     } elseif (isset($store_config['config_cache_live'])) {
         $this->view->config_cache_live = $store_config['config_cache_live'];
     } else {
         $this->view->config_cache_live = 0;
     }
     if (isset($config['enable_free_registration'])) {
         $this->view->enable_free_registration = $config['enable_free_registration'];
     } elseif (isset($store_config['enable_free_registration'])) {
         $this->view->enable_free_registration = $store_config['enable_free_registration'];
     } else {
         $this->view->enable_free_registration = 0;
     }
     //////////////////////////////////////// Contacts ////////////////////////////////////////
     if (isset($config['admin_mail'])) {
         $this->view->admin_mail = $config['admin_mail'];
     } elseif (isset($store_config['admin_mail'])) {
         $this->view->admin_mail = $store_config['admin_mail'];
     }
     if (isset($config['report_mail'])) {
         $this->view->report_mail = $config['report_mail'];
     } elseif (isset($store_config['report_mail'])) {
         $this->view->report_mail = $store_config['report_mail'];
     }
     if (isset($config['noreply_mail'])) {
         $this->view->noreply_mail = $config['noreply_mail'];
     } elseif (isset($store_config['noreply_mail'])) {
         $this->view->noreply_mail = $store_config['noreply_mail'];
     }
     if (isset($config['mail_smtp'])) {
         $this->view->mail_smtp = $config['mail_smtp'];
     } elseif (isset($store_config['mail_smtp'])) {
         $this->view->mail_smtp = $store_config['mail_smtp'];
     } else {
         $this->view->mail_smtp = 0;
     }
     if (isset($config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $config['mail_smtp_host'];
     } elseif (isset($store_config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $store_config['mail_smtp_host'];
     }
     if (isset($config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $config['mail_smtp_port'];
     } elseif (isset($store_config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $store_config['mail_smtp_port'];
     }
     if (isset($config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $config['mail_smtp_user'];
     } elseif (isset($store_config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $store_config['mail_smtp_user'];
     }
     if (isset($config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $config['mail_smtp_password'];
     } elseif (isset($store_config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $store_config['mail_smtp_password'];
     }
     if (isset($config['mail_footer'])) {
         $this->view->mail_footer = $config['mail_footer'];
     } elseif (isset($store_config['mail_footer'])) {
         $this->view->mail_footer = $store_config['mail_footer'];
     }
     if (isset($config['not_rp'])) {
         $this->view->not_rp = $config['not_rp'];
     } elseif (isset($store_config['not_rp'])) {
         $this->view->not_rp = $store_config['not_rp'];
     } else {
         $this->view->not_rp = 0;
     }
     if (isset($config['not_rc'])) {
         $this->view->not_rc = $config['not_rc'];
     } elseif (isset($store_config['not_rc'])) {
         $this->view->not_rc = $store_config['not_rc'];
     } else {
         $this->view->not_rc = 0;
     }
     if (isset($config['not_ri'])) {
         $this->view->not_ri = $config['not_ri'];
     } elseif (isset($store_config['not_ri'])) {
         $this->view->not_ri = $store_config['not_ri'];
     } else {
         $this->view->not_ri = 0;
     }
     //////////////////////////////////////// Images ////////////////////////////////////////
     /////// logo
     $image_model = new Helper_Images();
     if (isset($images['site_logo']) && $images['site_logo']) {
         $this->view->site_logo = $images['site_logo'];
     } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) {
         $this->view->site_logo = $store_config['site_logo'];
     } else {
         $this->view->site_logo = '';
     }
     if ($this->view->site_logo) {
         $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100);
     } else {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo) {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     $this->view->preview = $image_model->resize('/logo.png', 100, 100);
     ////mobile logo
     if (isset($images['site_logo_mobile']) && $images['site_logo_mobile']) {
         $this->view->site_logo_mobile = $images['site_logo_mobile'];
     } elseif (isset($store_config['site_logo_mobile']) && $store_config['site_logo_mobile']) {
         $this->view->site_logo_mobile = $store_config['site_logo_mobile'];
     } else {
         $this->view->site_logo_mobile = '';
     }
     if ($this->view->site_logo_mobile) {
         $this->view->preview_logo_mobile = $image_model->resize($this->view->site_logo_mobile, 100, 100);
     } else {
         $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo_mobile) {
         $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100);
     }
     $this->view->preview_mobile = $image_model->resize('/logo.png', 100, 100);
     ////// no image
     if (isset($images['no_image']) && $images['no_image']) {
         $this->view->no_image = $images['no_image'];
     } elseif (isset($store_config['no_image']) && $store_config['no_image']) {
         $this->view->no_image = $store_config['no_image'];
     } else {
         $this->view->no_image = '/no_image.png';
     }
     if ($this->view->no_image) {
         $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100);
     } else {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     if (!$this->view->preview_no_image) {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     ////// no avatar
     if (isset($images['no_avatar']) && $images['no_avatar']) {
         $this->view->no_avatar = $images['no_avatar'];
     } elseif (isset($store_config['no_avatar']) && $store_config['no_avatar']) {
         $this->view->no_avatar = $store_config['no_avatar'];
     } else {
         $this->view->no_avatar = '/no-avatar.png';
     }
     if ($this->view->no_avatar) {
         $this->view->preview_no_avatar = $image_model->resize($this->view->no_avatar, 100, 100);
     } else {
         $this->view->preview_no_avatar = $image_model->resize('/no-avatar.png', 100, 100);
     }
     if (!$this->view->preview_no_avatar) {
         $this->view->preview_no_avatar = $image_model->resize('/no_image.png', 100, 100);
     }
     ////// favicon
     if (isset($images['favicon']) && $images['favicon']) {
         $this->view->favicon = $images['favicon'];
     } elseif (isset($store_config['favicon']) && $store_config['favicon']) {
         $this->view->favicon = $store_config['favicon'];
     } else {
         $this->view->favicon = '';
     }
     if ($this->view->favicon) {
         $this->view->preview_favicon = $image_model->resize($this->view->favicon, 100, 100);
     } else {
         $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100);
     }
     if (!$this->view->preview_favicon) {
         $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100);
     }
     //    	$this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     //////////////////////////////////////// PAGES ////////////////////////////////////////
     if (isset($pages['about_menu'])) {
         $this->view->about_menu = $pages['about_menu'];
     } elseif (isset($store_config['about_menu'])) {
         $this->view->about_menu = $store_config['about_menu'];
     } else {
         $this->view->about_menu = array();
     }
     if (isset($pages['page_login_trouble'])) {
         $this->view->page_login_trouble = $pages['page_login_trouble'];
     } elseif (isset($store_config['page_login_trouble'])) {
         $this->view->page_login_trouble = $store_config['page_login_trouble'];
     } else {
         $this->view->page_login_trouble = 0;
     }
     if (isset($pages['page_terms'])) {
         $this->view->page_terms = $pages['page_terms'];
     } elseif (isset($store_config['page_terms'])) {
         $this->view->page_terms = $store_config['page_terms'];
     } else {
         $this->view->page_terms = 0;
     }
     if (isset($pages['page_contact'])) {
         $this->view->page_contact = $pages['page_contact'];
     } elseif (isset($store_config['page_contact'])) {
         $this->view->page_contact = $store_config['page_contact'];
     } else {
         $this->view->page_contact = 0;
     }
     if (isset($pages['page_goodies'])) {
         $this->view->page_goodies = $pages['page_goodies'];
     } elseif (isset($store_config['page_goodies'])) {
         $this->view->page_goodies = $store_config['page_goodies'];
     } else {
         $this->view->page_goodies = 0;
     }
     if (isset($pages['delete_account'])) {
         $this->view->delete_account = $pages['delete_account'];
     } elseif (isset($store_config['delete_account'])) {
         $this->view->delete_account = $store_config['delete_account'];
     } else {
         $this->view->delete_account = 0;
     }
     if (isset($pages['support_page'])) {
         $this->view->support_page = $pages['support_page'];
     } elseif (isset($store_config['support_page'])) {
         $this->view->support_page = $store_config['support_page'];
     } else {
         $this->view->support_page = 0;
     }
     if (isset($pages['page_pinmarklet'])) {
         $this->view->page_pinmarklet = $pages['page_pinmarklet'];
     } elseif (isset($store_config['page_pinmarklet'])) {
         $this->view->page_pinmarklet = $store_config['page_pinmarklet'];
     } else {
         $this->view->page_pinmarklet = 0;
     }
     if (isset($pages['page_privacy_policy'])) {
         $this->view->page_privacy_policy = $pages['page_privacy_policy'];
     } elseif (isset($store_config['page_privacy_policy'])) {
         $this->view->page_privacy_policy = $store_config['page_privacy_policy'];
     } else {
         $this->view->page_privacy_policy = 0;
     }
     if (isset($pages['page_private_boards'])) {
         $this->view->page_private_boards = $pages['page_private_boards'];
     } elseif (isset($store_config['page_private_boards'])) {
         $this->view->page_private_boards = $store_config['page_private_boards'];
     } else {
         $this->view->page_private_boards = 0;
     }
     //////////////////////////////////////// DATES ////////////////////////////////////////
     $this->view->short_dates = array('dd.mm.yy', 'yy-mm-dd');
     $this->view->medium_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy');
     $this->view->long_dates = array('dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy');
     $this->view->long_dates_times = array('dd MM yy H:i:s', 'D, d MM y H:i:s', 'DD, dd-MM-y H:i:s', 'D, d MM yy H:i:s');
     $this->view->news_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy', 'dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy', 'dd MM yy | H:i', 'D, d MM y | H:i', 'DD, dd-MM-y | H:i', 'D, d MM yy | H:i', 'dd MM yy | H:i:s', 'D, d MM y | H:i:s', 'DD, dd-MM-y | H:i:s', 'D, d MM yy | H:i:s');
     if (isset($config['config_date_format_short'])) {
         $this->view->config_date_format_short = $config['config_date_format_short'];
     } elseif (isset($store_config['config_date_format_short'])) {
         $this->view->config_date_format_short = $store_config['config_date_format_short'];
     } else {
         $this->view->config_date_format_short = 'dd.mm.yy';
     }
     if (isset($config['config_date_format_medium'])) {
         $this->view->config_date_format_medium = $config['config_date_format_medium'];
     } elseif (isset($store_config['config_date_format_medium'])) {
         $this->view->config_date_format_medium = $store_config['config_date_format_medium'];
     } else {
         $this->view->config_date_format_medium = 'dd M yy';
     }
     if (isset($config['config_date_format_long'])) {
         $this->view->config_date_format_long = $config['config_date_format_long'];
     } elseif (isset($store_config['config_date_format_long'])) {
         $this->view->config_date_format_long = $store_config['config_date_format_long'];
     } else {
         $this->view->config_date_format_long = 'dd MM yy';
     }
     if (isset($config['config_date_format_news'])) {
         $this->view->config_date_format_news = $config['config_date_format_news'];
     } elseif (isset($store_config['config_date_format_news'])) {
         $this->view->config_date_format_news = $store_config['config_date_format_news'];
     } else {
         $this->view->config_date_format_news = 'dd MM yy | H:i';
     }
     if (isset($config['config_date_format_long_time'])) {
         $this->view->config_date_format_long_time = $config['config_date_format_long_time'];
     } elseif (isset($store_config['config_date_format_long_time'])) {
         $this->view->config_date_format_long_time = $store_config['config_date_format_long_time'];
     } else {
         $this->view->config_date_format_long_time = 'dd MM yy H:i:s';
     }
     //////////////////////////////////////// DATES ////////////////////////////////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_without_children' => true));
     if ($categories) {
         foreach ($categories as $category) {
             $this->view->categories[] = $category;
         }
     }
     if (isset($config['config_board_description_enable'])) {
         $this->view->config_board_description_enable = $config['config_board_description_enable'];
     } elseif (isset($store_config['config_board_description_enable'])) {
         $this->view->config_board_description_enable = $store_config['config_board_description_enable'];
     } else {
         $this->view->config_board_description_enable = 0;
     }
     if (isset($config['config_private_boards'])) {
         $this->view->config_private_boards = $config['config_private_boards'];
     } elseif (isset($store_config['config_private_boards'])) {
         $this->view->config_private_boards = $store_config['config_private_boards'];
     } else {
         $this->view->config_private_boards = 0;
     }
     if (isset($config['default_category_id'])) {
         $this->view->default_category_id = $config['default_category_id'];
     } elseif (isset($store_config['default_category_id'])) {
         $this->view->default_category_id = $store_config['default_category_id'];
     } else {
         $this->view->default_category_id = 0;
     }
     if (isset($config['default_boards'])) {
         $this->view->default_boards = $config['default_boards'];
     } elseif (isset($store_config['default_boards'])) {
         $this->view->default_boards = $store_config['default_boards'];
     } else {
         $this->view->default_boards = array();
     }
 }
Esempio n. 15
0
 private function getCategories()
 {
     $request = $this->getRequest();
     $mainCategories = Model_Categories::getMain();
     if ($mainCategories) {
         $i = 0;
         $this->view->mainCategories = array();
         foreach ($mainCategories as $k => $v) {
             if ($i < 6) {
                 $this->view->mainCategories[$i] = array('name' => $v['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $v['id'] . '&name=' . WM_Router::clearName($v['name'])), 'sub_cats' => Model_Categories::getCategories($v['id']));
                 $v['sub_cats'] = Model_Categories::getCategories($v['id']);
                 if ($v['sub_cats']) {
                     foreach ($v['sub_cats'] as $sk => $sv) {
                         $this->view->mainCategories[$i]['sub_cats'][$sk]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $sv['id'] . '&name=' . WM_Router::clearName($sv['name']));
                     }
                 }
             } else {
                 if ($i == 6) {
                     $this->view->mainCategories[6] = array('name' => $this->view->translate('More'), 'href' => '#', 'no_link' => 1);
                 }
                 $this->view->mainCategories[6]['sub_cats'][] = array('name' => $v['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $v['id'] . '&name=' . WM_Router::clearName($v['name'])));
             }
             $i++;
         }
     }
 }
Esempio n. 16
0
 public function indexAction()
 {
     $request = $this->getRequest();
     JO_Session::set('redirect', $request->getBaseUrl() . $request->getUri());
     $category_id = $request->getParam('category_id');
     if (!$category_id) {
         return $this->forward('error', 'error404');
     }
     $page = (int) $request->getRequest('page', 1);
     if ($page < 1) {
         $page = 1;
     }
     $limit = JO_Registry::get('front_limit');
     $order = $request->getRequest('order');
     if (is_null($order)) {
         $order = 'desc';
     }
     $sort = $request->getRequest('sort');
     if (is_null($sort)) {
         $sort = 'datetime';
     }
     if ($sort == 'username') {
         $prefix = 'users.';
     } else {
         $prefix = 'items.';
     }
     if (is_numeric($category_id)) {
         $this->view->category = Model_Categories::get($category_id);
         $this->getLayout()->meta_title = $this->view->category['name'];
         $this->getLayout()->meta_description = $this->view->category['name'];
         if ($this->view->category['sub_of'] == 0) {
             $categories = Model_Categories::getMain();
         } else {
             $categories = Model_Categories::getCategories($this->view->category['sub_of']);
             $crumbs_categories = Model_Categories::get_all();
             if ($crumbs_categories) {
                 $parents = Model_Categories::getCategoryParents($crumbs_categories, $category_id);
                 $parents = explode(',', $parents);
                 $parents = array_reverse($parents);
                 $cnt = count($parents) - 1;
                 $crumbs = array();
                 for ($i = 1; $i < $cnt; $i++) {
                     $crumbs[$i] = array('name' => $crumbs_categories[$parents[$i]]['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $parents[$i] . '&name=' . WM_Router::clearName($crumbs_categories[$parents[$i]]['name'])));
                 }
             }
         }
         /* SORT */
         $link = $request->getBaseUrl() . '?&controller=categories&category_id=' . $category_id;
         $total_records = Model_Items::CountItems($category_id);
         $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 = Model_Items::getAll($category_id, $start, $limit, ($sort == 'price' ? 'rprice' : $prefix . $sort) . ' ' . $order);
     } else {
         if (in_array($category_id, array('recent', 'featured', 'popular'))) {
             switch ($category_id) {
                 case 'featured':
                     $where = 'items.weekly_to >= \'' . date('Y-m-d') . '\'';
                     $this->view->category['name'] = $this->view->translate('Featured Items');
                     $total_records = Model_Items::countWeekly();
                     break;
                 default:
                     $this->view->category['name'] = $this->view->translate('Recent Items');
                     $total_records = Model_Items::countItems();
             }
             $this->getLayout()->meta_title = $this->view->category['name'];
             $this->getLayout()->meta_description = $this->view->category['name'];
             /* SORT */
             $link = $request->getBaseUrl() . '?controller=categories&action=' . $category_id;
             $start = $page * $limit - $limit;
             if ($start > $total_records) {
                 $last_page = max(ceil($total_records / $limit), 1);
                 $start = $last_page * $limit - $limit;
             } elseif ($start < 0) {
                 $start = 0;
             }
             $items = Model_Items::getAll($category_id, $start, $limit, ($sort == 'price' ? 'rprice' : $prefix . $sort) . ' ' . $order, !empty($where) ? $where : '');
             $categories = Model_Categories::getMain();
         }
     }
     $this->view->sort_by = array(array('name' => $this->view->translate('date'), 'href' => WM_Router::create($link . '&sort=datetime'), 'is_selected' => $sort == 'datetime' ? true : false), array('name' => $this->view->translate('title'), 'href' => WM_Router::create($link . '&sort=name'), 'is_selected' => $sort == 'name' ? true : false), array('name' => $this->view->translate('rating'), 'href' => WM_Router::create($link . '&sort=rating'), 'is_selected' => $sort == 'rating' ? true : false), array('name' => $this->view->translate('sales'), 'href' => WM_Router::create($link . '&sort=sales'), 'is_selected' => $sort == 'sales' ? true : false), array('name' => $this->view->translate('price'), 'href' => WM_Router::create($link . '&sort=price'), 'is_selected' => $sort == 'price' ? true : false), array('name' => $this->view->translate('author name'), 'href' => WM_Router::create($link . '&sort=username'), 'is_selected' => $sort == 'username' ? true : false));
     /* ORDER */
     $link .= '&sort=' . $sort;
     $this->view->orders = array(array('name' => '&raquo;', 'href' => WM_Router::create($link . '&order=desc'), 'is_selected' => $order == 'desc' ? true : false), array('name' => '&laquo;', 'href' => WM_Router::create($link . '&order=asc'), 'is_selected' => $order == 'asc' ? true : false));
     /* CRUMBS */
     $this->view->crumbs = array();
     $this->view->crumbs[] = array('name' => $this->view->translate('Home'), 'href' => $request->getBaseUrl());
     if (isset($crumbs)) {
         $this->view->crumbs += $crumbs;
     }
     /* CATEGORIES */
     if ($categories) {
         $this->view->all_categories_name = $this->translate('All Categories');
         $this->view->categories = array();
         foreach ($categories as $k => $v) {
             $this->view->categories[$k] = array('name' => $v['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $v['id'] . '&name=' . WM_Router::clearName($v['name'])));
         }
     }
     /* PAGENATION */
     $link .= '&order=' . $order;
     $pagination = new Model_Pagination();
     $pagination->setLimit($limit);
     $pagination->setPage($page);
     $pagination->setText(array('text_prev' => $this->view->translate('Prev'), 'text_next' => $this->view->translate('Next')));
     $pagination->setTotal($total_records);
     $pagination->setUrl(WM_Router::create($link . '&page={page}'));
     $this->view->pagination = $pagination->render();
     if (!empty($this->view->pagination)) {
         $this->view->pagination = str_replace('{of}', $this->view->translate('OF'), $this->view->pagination);
     }
     /* ITEMS */
     if ($items) {
         $this->view->items = array();
         foreach ($items as $n => $item) {
             if (!empty($item['demo_url'])) {
                 $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&action=preview&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
             }
             $this->view->items[] = Helper_Items::returnViewIndex($item, 'category');
         }
     }
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
Esempio n. 17
0
 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']));
     }
 }
Esempio n. 18
0
 public function indexAction()
 {
     $request = $this->getRequest();
     //////////// Categories ////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
         $this->view->categories[] = $category;
     }
     //////////// User Type ////////////
     $this->view->user_types = array();
     $user_types = Model_Users::getUserType(array('filter_status' => 1));
     foreach ($user_types as $user_type) {
         $user_type['subuser_types'] = Model_Users::getSubUserType($user_type['user_type_id']);
         $this->view->user_types[] = $user_type;
     }
     /////////// activate //////////
     $_SESSION["activate_url"] = WM_Router::create($request->getBaseUrl() . '?controller=settings');
     $this->view->popup_activate = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activate');
     $_SESSION["deportes_url"] = WM_Router::create($request->getBaseUrl() . '?controller=settings');
     $this->view->deportes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=deportes');
     $this->view->user_sports = array();
     $users_sports = Model_Users::getUserSports(JO_Session::get('user[user_id]'));
     $i = 0;
     foreach ($users_sports as $user_sports) {
         if ($user_sports['sport_category'] != 1) {
             if (!Model_Boards::isCategoryParent($user_sports['sport_category'])) {
                 $this->view->user_sports[] = Model_Boards::getCategoryTitle($user_sports['sport_category']);
                 $i++;
             }
         }
     }
     $this->view->sportcounter = $i;
     $user_data = Model_Users::getUser(JO_Session::get('user[user_id]'));
     $upload = new JO_Upload_SessionStore();
     $upload->setName('upload_avatar');
     $info = $upload->getFileInfo();
     if (JO_Session::get('successfu_edite')) {
         $this->view->successfu_edite = true;
         JO_Session::clear('successfu_edite');
     }
     if ($request->isPost()) {
         $validate = new Helper_Validate();
         $validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
         $validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
         //$validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
         $validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
         if ($request->issetPost('type_user')) {
             if ($request->getPost('type_user') != 1 && $request->getPost('type_user') != 5 && $request->getPost('type_user') != 12) {
                 $validate->_set_rules($request->getPost('location'), $this->translate('Location'), 'not_empty;min_length[3];max_length[100]');
             }
         }
         $validate->_set_rules($request->getPost('sports'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
         //is_nan() sino
         /*
                                 if($request->getPost('sport_category_1') == "" && $request->getPost('sport_category_2') == "" && $request->getPost('sport_category_3') == "") {
                                     $validate->_set_rules($request->getPost('sport_category'), $this->translate('Category_id'), 'not_empty;min_length[3];max_length[100]');
         
                                 }
                                  * */
         //$validate->_set_rules($request->getPost('sport_category_1'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
         //$validate->_set_rules($request->getPost('sport_category_2'), $this->translate('Category_id2'), 'not_empty;min_length[3];max_length[100]');
         //$validate->_set_rules($request->getPost('sport_category_3'), $this->translate('Category_id3'), 'not_empty;min_length[3];max_length[100]');
         $validate->_set_rules($request->getPost('type_user'), $this->translate('User_type_id'), 'not_empty;min_length[1];max_length[100]');
         $data = $request->getPost();
         if ($validate->_valid_form()) {
             if (Model_Users::isExistEmail($request->getPost('email'), JO_Session::get('user[email]'))) {
                 $validate->_set_form_errors($this->translate('This e-mail address is already used'));
                 $validate->_set_valid_form(false);
             }
             if (Model_Users::isExistUsername($request->getPost('username'), JO_Session::get('user[username]'))) {
                 $validate->_set_form_errors($this->translate('This username is already used'));
                 $validate->_set_valid_form(false);
             }
         }
         if ($validate->_valid_form()) {
             $data['dont_search_index'] = (int) $request->issetPost('dont_search_index');
             $data['facebook_timeline'] = (int) $request->issetPost('facebook_timeline');
             if ($info) {
                 if (!@file_exists(BASE_PATH . '/cache/avatar/') || !is_dir(BASE_PATH . '/cache/avatar/')) {
                     mkdir(BASE_PATH . '/cache/avatar/');
                 }
                 $filename = BASE_PATH . '/cache/avatar/' . md5(mt_rand() . time()) . $upload->get_extension($info['name']);
                 if (file_put_contents($filename, $info['data'])) {
                     $data['avatar'] = $filename;
                 }
             }
             $new_email_key = md5(JO_Session::get('user[email]') . mt_rand() . time());
             if (JO_Session::get('user[email]') != $request->getPost('email')) {
                 $data['new_email_key'] = $new_email_key;
             } else {
                 $data['new_email_key'] = '';
             }
             $data['new_email'] = $data['email'];
             unset($data['email']);
             /*
             $lat = $data['lat'];
             $len = $data['len'];
             
             while(Model_Users::getUsersLatLen($lat,$len))
             {
             
                 $posLat = strpos($lat, ".");
                 $longLat = strlen(substr((string)$lat, $posLat));
                 $cantLat = 0;
                 for ($i = 0; $i < ($longLat - 4); $i++)
                 {
                     if ($i == 0)
                     {
                         $cantLat .= ".0";
                     }
                     else
                     {
                         $cantLat .= "0";
                     }
                 }
                 $cantLat .= "1";
                 $lat = $lat + $cantLat;
             
                 $posLen = strpos($len, ".");
                 $longLen = strlen(substr((string)$len, $posLen));
                 $cantLen = 0;
                 for ($i = 0; $i < ($longLen - 4); $i++)
                 {
                     if ($i == 0)
                     {
                         $cantLen .= ".0";
                     }
                     else
                     {
                         $cantLen .= "0";
                     }
                 }
                 $cantLen .= "1";
                 $len = $len + $cantLen;
             }
             
             $data['lat'] = $lat;
             $data['len'] = $len;
             */
             if (Model_Users::edit(JO_Session::get('user[user_id]'), $data)) {
                 JO_Session::set('successfu_edite', true);
                 $upload->getFileInfo(true);
                 if (JO_Session::get('user[email]') != $request->getPost('email')) {
                     $this->view->verify_email_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&user_id=' . JO_Session::get('user[user_id]') . '&verify=' . $new_email_key);
                     $this->view->user_info = $user_data;
                     Model_Email::send($request->getPost('email'), JO_Registry::get('noreply_mail'), $this->translate('Please verify your email'), $this->view->render('verify_email', 'mail'));
                 }
                 if (!Model_Users::getUserTypeNotOthers($user_data['type_user'])) {
                     $data['activate'] = 0;
                     //borrar activate
                     if (Model_Users::createActivate(JO_Session::get('user[user_id]'), $data)) {
                     }
                 }
                 if (Model_Users::deleteUsersLocation(JO_Session::get('user[user_id]'))) {
                     for ($i = 0; $i <= $request->getPost('locationcounter'); $i++) {
                         $location = 'location' . $i;
                         $lat = 'lat' . $i;
                         $len = 'len' . $i;
                         if ($request->issetPost($location)) {
                             if ($request->getPost($location) != "") {
                                 $lat = $request->getPost($lat);
                                 $len = $request->getPost($len);
                                 while (Model_Users::getLocationUsersLatLen($lat, $len)) {
                                     $posLat = strpos($lat, ".");
                                     $longLat = strlen(substr((string) $lat, $posLat));
                                     $cantLat = 0;
                                     for ($i = 0; $i < $longLat - 4; $i++) {
                                         if ($i == 0) {
                                             $cantLat .= ".0";
                                         } else {
                                             $cantLat .= "0";
                                         }
                                     }
                                     $cantLat .= "1";
                                     $lat = $lat + $cantLat;
                                     $posLen = strpos($len, ".");
                                     $longLen = strlen(substr((string) $len, $posLen));
                                     $cantLen = 0;
                                     for ($i = 0; $i < $longLen - 4; $i++) {
                                         if ($i == 0) {
                                             $cantLen .= ".0";
                                         } else {
                                             $cantLen .= "0";
                                         }
                                     }
                                     $cantLen .= "1";
                                     $len = $len + $cantLen;
                                 }
                                 if (Model_Users::createUsersLocation(JO_Session::get('user[user_id]'), $request->getPost($location), $lat, $len)) {
                                 }
                             }
                         }
                     }
                 }
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=settings'));
             } else {
                 $this->view->error = $this->translate('There was a problem with the record. Please try again!');
             }
         } else {
             $this->view->error = $validate->_get_error_messages();
         }
         foreach ($data as $k => $v) {
             if (isset($user_data[$k])) {
                 $user_data[$k] = $v;
             }
         }
     }
     if ($info) {
         $user_data['avatar'] = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=temporary_avatar&s=' . microtime(true));
         $user_data['has_avatar'] = true;
     } else {
         $avatar = Helper_Uploadimages::avatar($user_data, '_B');
         $user_data['avatar'] = $avatar['image'] . '?s=' . microtime(true);
         $user_data['has_avatar'] = @getimagesize($user_data['avatar']) ? true : false;
     }
     //////////// User location ////////////
     $this->view->user_location = array();
     $this->view->user_lat = array();
     $this->view->user_len = array();
     $this->view->locationcounter = 0;
     if ($request->issetPost('location1')) {
         $user_location = array();
         $user_lat = array();
         $user_len = array();
         for ($i = 1; $i <= $request->getPost('locationcounter'); $i++) {
             $location = 'location' . $i;
             $lat = 'lat' . $i;
             $len = 'len' . $i;
             if ($request->issetPost($location)) {
                 if ($request->getPost($location) != "") {
                     $user_location[] = $request->getPost($location);
                     $user_lat[] = $request->getPost($lat);
                     $user_len[] = $request->getPost($len);
                 }
             }
         }
         $this->view->user_location = $user_location;
         $this->view->user_lat = $user_lat;
         $this->view->user_len = $user_len;
         $this->view->locationcounter = $request->getPost('locationcounter');
     } else {
         $users_location = Model_Users::getUserLocation(JO_Session::get('user[user_id]'));
         $i = 0;
         foreach ($users_location as $user_location) {
             $this->view->user_location[] = $user_location['location'];
             $this->view->user_lat[] = $user_location['lat'];
             $this->view->user_len[] = $user_location['len'];
             $i++;
         }
         $this->view->locationcounter = $i;
     }
     $this->view->location = '';
     if ($request->issetPost('location')) {
         $this->view->location = $request->getPost('location');
     } else {
         $this->view->location = '';
     }
     $this->view->cat_title1 = '';
     $this->view->sport_category_1 = '';
     if ($request->issetPost('sport_category_1')) {
         $this->view->sport_category_1 = $request->getPost('sport_category_1');
         if ($request->getPost('sport_category_1') != "") {
             if ($request->getPost('sport_category_1') == 1) {
                 $this->view->cat_title1 = "Todo";
             } else {
                 $this->view->cat_title1 = Model_Boards::getCategoryTitle($request->getPost('sport_category_1'));
             }
         }
     } else {
         if ($user_data['sport_category_1'] != "") {
             $this->view->sport_category_1 = $user_data['sport_category_1'];
             if ($user_data['sport_category_1'] == 1) {
                 $this->view->cat_title1 = "Todo";
             } else {
                 $this->view->cat_title1 = Model_Boards::getCategoryTitle($user_data['sport_category_1']);
             }
         }
     }
     $this->view->cat_title2 = '';
     $this->view->sport_category_2 = '';
     if ($request->issetPost('sport_category_2')) {
         $this->view->sport_category_2 = $request->getPost('sport_category_2');
         if ($request->getPost('sport_category_2') != "") {
             if ($request->getPost('sport_category_2') == 1) {
                 $this->view->cat_title2 = "Todo";
             } else {
                 $this->view->cat_title2 = Model_Boards::getCategoryTitle($request->getPost('sport_category_2'));
             }
         }
     } elseif ($user_data['sport_category_2'] != "") {
         $this->view->sport_category_2 = $user_data['sport_category_2'];
         if ($user_data['sport_category_2'] == 1) {
             $this->view->cat_title2 = "Todo";
         } else {
             $this->view->cat_title2 = Model_Boards::getCategoryTitle($user_data['sport_category_2']);
         }
     }
     $this->view->cat_title3 = '';
     $this->view->sport_category_3 = '';
     if ($request->issetPost('sport_category_3')) {
         $this->view->sport_category_3 = $request->getPost('sport_category_3');
         if ($request->getPost('sport_category_3') != "") {
             if ($request->getPost('sport_category_3') == 1) {
                 $this->view->cat_title3 = "Todo";
             } else {
                 $this->view->cat_title3 = Model_Boards::getCategoryTitle($request->getPost('sport_category_3'));
             }
         }
     } elseif ($user_data['sport_category_3'] != "") {
         $this->view->sport_category_3 = $user_data['sport_category_3'];
         if ($user_data['sport_category_3'] == 1) {
             $this->view->cat_title3 = "Todo";
         } else {
             $this->view->cat_title3 = Model_Boards::getCategoryTitle($user_data['sport_category_3']);
         }
     }
     $this->view->usertype_title = '';
     $this->view->type_user = '';
     if ($request->issetPost('type_user')) {
         $this->view->type_user = $request->getPost('type_user');
         if ($request->getPost('type_user') != "") {
             $this->view->usertype_title = Model_Users::getUserTypeTitle($request->getPost('type_user'));
         }
     } elseif ($user_data['type_user'] != "") {
         $this->view->type_user = $user_data['type_user'];
         $this->view->usertype_title = Model_Users::getUserTypeTitle($user_data['type_user']);
     }
     if ($request->issetPost('activate')) {
         $this->view->activate = $request->getPost('activate');
     } else {
         $activate = Model_Users::getActivateUser(JO_Session::get('user[user_id]'));
         if ($activate) {
             $this->view->activate = $activate["activate"];
         } else {
             $this->view->activate = "";
         }
     }
     $this->view->instagram_enable = JO_Registry::get('oauth_in_key');
     $this->view->twitteroauth_enable = JO_Registry::get('oauth_tw_key');
     $this->view->facebook_enable = JO_Registry::get('oauth_fb_key');
     $this->view->user_data = $user_data;
     $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=upload_avatar');
     $this->view->invites_fb = WM_Router::create($request->getBaseUrl() . '?controller=invites&action=facebook');
     $this->view->facebook_connect = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=facebook_connect');
     $this->view->twitter_connect = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=twitter_connect');
     $this->view->instagram_connect = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=instagram_connect');
     $this->view->instagram_fetch = WM_Router::create($request->getBaseUrl() . '?controller=instagram&action=media');
     $this->view->instagram_fetch_cron = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=instagram_cron');
     $this->view->facebook_connect_avatar = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=facebook_connect_avatar');
     $this->view->check_username = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=check_username');
     $this->view->delete_username = WM_Router::create($request->getBaseUrl() . '?controller=users&action=delete&user_id=' . $user_data['user_id']);
     $this->view->facebook_connect2 = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=facebook_connect2');
     $this->view->prefs_action = WM_Router::create($request->getBaseUrl() . '?controller=prefs');
     $this->view->new_password = WM_Router::create($request->getBaseUrl() . '?controller=password&action=change');
     $this->view->site_name = JO_Registry::get('site_name');
     $this->view->base_href = $request->getBaseUrl();
     $this->view->delete_account = '';
     if (JO_Registry::get('delete_account')) {
         $page_description = Model_Pages::getPage(JO_Registry::get('delete_account'));
         if ($page_description) {
             $this->view->delete_account = html_entity_decode($page_description['description'], ENT_QUOTES, 'utf-8');
         }
     }
     // si llama a los deportes
     if (isset($_SESSION["email"])) {
         $this->view->email = $_SESSION["email"];
         $_SESSION["email"] = null;
     }
     if (isset($_SESSION["firstname"])) {
         $this->view->firstname = $_SESSION["firstname"];
         $_SESSION["firstname"] = null;
     }
     if (isset($_SESSION["username"])) {
         $this->view->username = $_SESSION["username"];
         $_SESSION["username"] = null;
     }
     if (isset($_SESSION["password"])) {
         $this->view->password = $_SESSION["password"];
         $_SESSION["password"] = null;
     }
     if (isset($_SESSION["password2"])) {
         $this->view->password2 = $_SESSION["password2"];
         $_SESSION["password2"] = null;
     }
     if (isset($_SESSION["info"])) {
         $this->view->info = $_SESSION["info"];
         $_SESSION["info"] = null;
     }
     if (isset($_SESSION["location"])) {
         $this->view->location = $_SESSION["location"];
         $_SESSION["location"] = null;
     }
     if (isset($_SESSION["lat"])) {
         $this->view->lat = $_SESSION["lat"];
         $_SESSION["lat"] = null;
     }
     if (isset($_SESSION["len"])) {
         $this->view->len = $_SESSION["len"];
         $_SESSION["len"] = null;
     }
     if (isset($_SESSION["type_user"])) {
         if ($_SESSION["type_user"] != "") {
             $this->view->type_user = $_SESSION["type_user"];
             $this->view->usertype_title = Model_Users::getUserTypeTitle($_SESSION["type_user"]);
         }
         $_SESSION["type_user"] = null;
     }
     if (isset($_SESSION["location1"])) {
         $user_location = array();
         for ($i = 1; $i <= $_SESSION['locationcounter']; $i++) {
             $location = 'location' . $i;
             if (isset($_SESSION[$location])) {
                 if ($_SESSION[$location] != "") {
                     $user_location[] = $_SESSION[$location];
                     $_SESSION[$location] = null;
                 }
             }
         }
         $this->view->user_location = $user_location;
         $this->view->locationcounter = $_SESSION['locationcounter'];
         $_SESSION['locationcounter'] = null;
     }
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Esempio n. 19
0
 public function repinAction()
 {
     $request = $this->getRequest();
     $pin_id = $request->getRequest('pin_id');
     $pin_info = Model_Pins::getPin($pin_id);
     if (!$pin_info) {
         $this->forward('error', 'error404');
     }
     $model_images = new Helper_Images();
     $this->view->title = $pin_info['title'];
     $this->view->price = $pin_info['price'];
     $image = Helper_Uploadimages::pin($pin_info, '_B');
     if ($image) {
         $this->view->media = $image['original'];
     } else {
         $this->view->media = false;
     }
     $this->view->is_video = $pin_info['is_video'] ? 'true' : 'false';
     $this->view->is_article = $pin_info['is_article'] ? 'true' : 'false';
     $this->view->from = $pin_info['from'];
     $this->view->description = $pin_info['description'];
     $this->view->from_url = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=repin&pin_id=' . $pin_id);
     $this->view->createBoard = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create');
     $boards = Model_Boards::getBoards(array('filter_user_id' => JO_Session::get('user[user_id]'), 'order' => 'boards.sort_order', 'sort' => 'ASC', 'friendly' => JO_Session::get('user[user_id]')));
     $this->view->boards = array();
     if ($boards) {
         foreach ($boards as $board) {
             $this->view->boards[] = array('board_id' => $board['board_id'], 'title' => $board['title']);
         }
     }
     //////////// Categories ////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
         $this->view->categories[] = $category;
     }
     $this->view->popup_main_box = $this->view->render('repin', 'pin');
     $this->view->is_article = $pin_info['is_article'] ? 'true' : 'false';
     if ($request->isPost()) {
         $result = Model_Pins::create(array('title' => $pin_info['title'], 'from' => $pin_info['from'], 'image' => $this->view->media, 'is_video' => $pin_info['is_video'] ? 'true' : 'false', 'is_article' => $pin_info['is_article'] ? 'true' : 'false', 'description' => $request->getPost('message'), 'price' => $request->getPost('price'), 'board_id' => $request->getPost('board_id'), 'via' => $pin_info['user_id'], 'repin_from' => $pin_info['pin_id'], 'from_repin' => $pin_info['from']));
         if ($result) {
             $this->view->pin_url = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $result);
             $this->view->popup_main_box = $this->view->render('success', 'addpin');
             //add history
             Model_History::addHistory($pin_info['user_id'], Model_History::REPIN, $result);
             if ($pin_info['user']['email_interval'] == 1 && $pin_info['user']['repins_email']) {
                 $this->view->user_info = $pin_info['user'];
                 $this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]'));
                 $this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]');
                 $this->view->text_email = $this->translate('repin your');
                 $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin_id);
                 Model_Email::send($pin_info['user']['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('repin your pin'), $this->view->render('repin_pin', 'mail'));
             }
         }
     }
     $this->setViewChange('index');
     if ($request->isXmlHttpRequest()) {
         $this->noViewRenderer(true);
         echo $this->view->popup_main_box;
         $this->view->is_popup = true;
     } else {
         $this->view->pins_details = $this->view->popup_main_box;
         $this->view->is_popup = false;
         $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'pin/left_part');
     }
 }
Esempio n. 20
0
 public function editAction()
 {
     $request = $this->getRequest();
     if (JO_Session::get('user[user_id]')) {
         $board_id = $request->getRequest('board_id');
         $board_info = new Model_Boards_Board($board_id);
         if (!$board_info->count()) {
             $this->forward('error', 'error404');
         }
         if ($board_info['board_user_id'] != JO_Session::get('user[user_id]')) {
             $this->forward('error', 'error404');
         }
         $this->view->is_edit = true;
         if ($request->isPost()) {
             $validate = new Helper_Validate();
             $validate->_set_rules($request->getPost('newboard'), $this->translate('Board Name'), 'not_empty;min_length[3];max_length[100]');
             $validate->_set_rules($request->getPost('category_id'), $this->translate('Board Category'), 'not_empty');
             if ($validate->_valid_form()) {
                 $postData = array_merge($request->getPost(), array('title' => $request->getPost('newboard')));
                 if (Helper_Config::get('config_private_boards')) {
                     $postData['public'] = (int) (!$request->issetPost('public'));
                 }
                 $result = new Model_Boards_Edit($board_id, $postData);
                 if ($result->affected_rows) {
                     $this->view->redirect = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['board_user_id'] . '&board_id=' . $board_info['board_board_id']);
                 } else {
                     $this->view->error = $this->translate('There was a problem with the record. Please try again!');
                 }
             } else {
                 $this->view->error = $validate->_get_error_messages();
             }
             echo $this->renderScript('json');
         } else {
             $this->view->title = $board_info['board_title'];
             $this->view->category_id = $board_info['board_category_id'];
             $this->view->board_description = $board_info['board_description'];
             $this->view->another_users = array();
             $this->view->private = $board_info['board_public'];
             $this->view->board_id = $board_id;
             $b_users = $board_info['board_users_all'] ? explode(',', $board_info['board_users_all']) : array();
             if ($b_users) {
                 $board_users = new Model_Users_UsersInId($b_users);
                 if ($board_users->count()) {
                     foreach ($board_users as $user) {
                         $this->view->another_users[] = array('user_id' => $user['user_id'], 'avatars' => Helper_Uploadimages::userAvatars($user), 'fullname' => $user['fullname'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']));
                     }
                 }
             }
             $self = array();
             foreach ($board_info as $key => $data) {
                 if (strpos($key, 'user_') === 0) {
                     $self[substr($key, 5)] = $data;
                 }
             }
             $uin = Model_Users::getUser($board_info['user_id']);
             $this->view->avatars = Helper_Uploadimages::userAvatars($self);
             $this->view->fullname = $self['fullname'];
             $this->view->userhref = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $board_info['user_user_id']);
             $this->view->friends_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=friends');
             $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board_info['user_user_id'] . '&board_id=' . $board_info['board_board_id']);
             $this->view->board_href = WM_Router::create($request->getBaseUrl() . '?controller=boards&user_id=' . $board_info['user_user_id'] . '&board_id=' . $board_info['board_board_id']);
             $this->view->board_delete = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=delete&user_id=' . $board_info['user_user_id'] . '&board_id=' . $board_info['board_board_id']);
             /////private boards
             $this->view->enable_private_boards = Helper_Config::get('config_private_boards');
             $private_boards = Model_Pages::getPage(Helper_Config::get('page_private_boards'));
             if ($private_boards) {
                 $this->view->text_private_boards = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . Helper_Config::get('page_private_boards'));
             }
             //////////// Categories ////////////
             $this->view->categories = Model_Categories::getCategories(array('filter_status' => 1));
             $this->view->config_board_description_enable = Helper_Config::get('config_board_description_enable');
             $this->view->popup_main_box = $this->view->render('popup_form', 'boards');
             $this->setViewChange('form');
             if ($request->isXmlHttpRequest()) {
                 $this->view->popup = true;
                 echo $this->view->popup_main_box;
                 $this->noViewRenderer(true);
             } else {
                 $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
             }
         }
     } else {
         if ($request->isXmlHttpRequest()) {
             $this->view->redirect = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
             echo $this->renderScript('json');
         } else {
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
         }
     }
 }
Esempio n. 21
0
 public static function returnHtmlDetail()
 {
     //XPER: función que carga PIN
     static $view = null, $model_images = null, $request = null;
     if ($view === null) {
         $view = JO_View::getInstance();
     }
     if ($model_images === null) {
         $model_images = new Helper_Images();
     }
     if ($request === null) {
         $request = JO_Request::getInstance();
     }
     //$request = $this->getRequest();
     //////////// Categories ////////////
     $view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
         $view->categories[] = $category;
     }
     //////////// Age ////////////
     $view->ages = array();
     $ages = Model_Users::getAge();
     $view->ages = $ages;
     //////////// Level ////////////
     $view->levels = array();
     $levels = Model_Users::getLevel();
     $view->levels = $levels;
     $user_data = Model_Users::getActivateUser(JO_Session::get('user[user_id]'));
     $view->user_data = $user_data;
     if (JO_Registry::get('isMobile')) {
         $view->urlmensajes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=mensajes&user_id=' . $request->getRequest('board_user'));
     }
     //gender
     if ($request->issetPost('gender')) {
         $view->gender = $request->getRequest('gender');
     } elseif (isset($user_data['gender'])) {
         $view->gender = $user_data['gender'];
     } else {
         $view->gender = "";
     }
     //location
     if ($request->issetPost('location')) {
         $view->location = $request->getPost('location');
     } elseif (isset($user_data['location'])) {
         $view->location = $user_data['location'];
     } else {
         $view->location = '';
     }
     //sport category
     if ($request->issetPost('sport_category')) {
         $view->sport_category = $request->getPost('sport_category');
         if ($request->getPost('sport_category') != "") {
             $view->cat_title = Model_Boards::getCategoryTitle($request->getPost('sport_category'));
         }
     } elseif (isset($user_data['sport_category'])) {
         $view->sport_category = $user_data['sport_category'];
         $view->cat_title = Model_Boards::getCategoryTitle($user_data['sport_category']);
     } else {
         $view->cat_title = '';
         $view->sport_category = '';
     }
     //age
     if ($request->issetPost('age')) {
         $view->age = $request->getPost('age');
         if ($request->getPost('age') != "") {
             $view->age_title = Model_Users::getAgeTitle($request->getPost('age'));
         }
     } elseif (isset($user_data['age'])) {
         $view->age = $user_data['age'];
         $view->age_title = Model_Users::getAgeTitle($user_data['age']);
     } else {
         $view->age_title = '';
         $view->age = '';
     }
     //level
     if ($request->issetPost('level')) {
         $view->level = $request->getPost('level');
         if ($request->getPost('level') != "") {
             $view->level_title = Model_Users::getLevelTitle($request->getPost('level'));
         }
     } elseif (isset($user_data['level'])) {
         $view->level = $user_data['level'];
         $view->level_title = Model_Users::getLevelTitle($user_data['level']);
     } else {
         $view->level_title = '';
         $view->level = '';
     }
     //comment
     if ($request->issetPost('comment')) {
         $view->comment = $request->getPost('comment');
     } elseif (isset($user_data['comment'])) {
         $view->comment = $user_data['comment'];
     } else {
         $view->comment = '';
     }
     //$view->form_action = WM_Router::create( $request->getBaseUrl() . '?controller=addpin&action=get_images' );
     //$view->from_url = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=activatePopup' );
     $view->from_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activateDetail');
     //$view->popup_main_box = $view->render('activatePopup','users');
     $view->popup_main_box = $view->render('activateDetail', 'users');
     return $view->render('activateDetail', 'users');
 }
Esempio n. 22
0
 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;
     if ($info['thumbnail']) {
         $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));
     $category = Model_Categories::getParentCategoryByItem($info['id'], true);
     $category = trim($category['categories'], ',');
     $this->view->attributes_list = Model_Attributes::getAllWithCategories("attributes_categories.categories LIKE '%," . (int) $category . ",%'");
     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 = '';
     }
 }
Esempio n. 23
0
 public function getForm()
 {
     $request = $this->getRequest();
     $this->view->templates = $this->getTemplates(array('mobile'));
     $config = $request->getPost('config');
     $images = $request->getPost('images');
     $pages = $request->getPost('pages');
     $store_config = Model_Settings::getSettingsPairs();
     $this->view->pages = Model_Pages::getPagesFromParent(0);
     $this->view->pages_about = array();
     $this->view->pages_about[] = array('title' => $this->translate('SEPARATOR MENU'), 'page_id' => -1);
     if ($this->view->pages) {
         foreach ($this->view->pages as $p) {
             $this->view->pages_about[] = array('title' => $p['title'], 'page_id' => $p['page_id']);
         }
     }
     $this->view->currencies = Model_Currency::getCurrencies();
     $this->view->app_path = BASE_PATH;
     //////////////////////////////////////// OAUTH ////////////////////////////////////////
     //facebook
     if (isset($config['oauth_fb_key'])) {
         $this->view->oauth_fb_key = $config['oauth_fb_key'];
     } elseif (isset($store_config['oauth_fb_key'])) {
         $this->view->oauth_fb_key = $store_config['oauth_fb_key'];
     }
     if (isset($config['oauth_fb_secret'])) {
         $this->view->oauth_fb_secret = $config['oauth_fb_secret'];
     } elseif (isset($store_config['oauth_fb_secret'])) {
         $this->view->oauth_fb_secret = $store_config['oauth_fb_secret'];
     }
     if (isset($config['og_namespace'])) {
         $this->view->og_namespace = $config['og_namespace'];
     } elseif (isset($store_config['og_namespace'])) {
         $this->view->og_namespace = $store_config['og_namespace'];
     }
     if (isset($config['og_recipe'])) {
         $this->view->og_recipe = $config['og_recipe'];
     } elseif (isset($store_config['og_recipe'])) {
         $this->view->og_recipe = $store_config['og_recipe'];
     }
     //twitter
     if (isset($config['oauth_tw_key'])) {
         $this->view->oauth_tw_key = $config['oauth_tw_key'];
     } elseif (isset($store_config['oauth_tw_key'])) {
         $this->view->oauth_tw_key = $store_config['oauth_tw_key'];
     }
     if (isset($config['oauth_tw_secret'])) {
         $this->view->oauth_tw_secret = $config['oauth_tw_secret'];
     } elseif (isset($store_config['oauth_tw_secret'])) {
         $this->view->oauth_tw_secret = $store_config['oauth_tw_secret'];
     }
     ///instagram
     if (isset($config['oauth_in_key'])) {
         $this->view->oauth_in_key = $config['oauth_in_key'];
     } elseif (isset($store_config['oauth_in_key'])) {
         $this->view->oauth_in_key = $store_config['oauth_in_key'];
     }
     if (isset($config['oauth_in_secret'])) {
         $this->view->oauth_in_secret = $config['oauth_in_secret'];
     } elseif (isset($store_config['oauth_in_secret'])) {
         $this->view->oauth_in_secret = $store_config['oauth_in_secret'];
     }
     //////////////////////////////////////// GENERAL ////////////////////////////////////////
     if (isset($config['config_base_domain'])) {
         $this->view->config_base_domain = $config['config_base_domain'];
     } elseif (isset($store_config['config_base_domain'])) {
         $this->view->config_base_domain = $store_config['config_base_domain'];
     } else {
         $this->view->config_base_domain = $request->getBaseUrl();
     }
     if (isset($config['config_on_facebook'])) {
         $this->view->config_on_facebook = $config['config_on_facebook'];
     } elseif (isset($store_config['config_on_facebook'])) {
         $this->view->config_on_facebook = $store_config['config_on_facebook'];
     } else {
         $this->view->config_on_facebook = '';
     }
     if (isset($config['google_analytics'])) {
         $this->view->google_analytics = $config['google_analytics'];
     } elseif (isset($store_config['google_analytics'])) {
         $this->view->google_analytics = $store_config['google_analytics'];
     }
     if (isset($config['config_fix_image_thumb_editor'])) {
         $this->view->config_fix_image_thumb_editor = $config['config_fix_image_thumb_editor'];
     } elseif (isset($store_config['config_fix_image_thumb_editor'])) {
         $this->view->config_fix_image_thumb_editor = $store_config['config_fix_image_thumb_editor'];
     }
     if (isset($config['config_fix_external_urls'])) {
         $this->view->config_fix_external_urls = $config['config_fix_external_urls'];
     } elseif (isset($store_config['config_fix_external_urls'])) {
         $this->view->config_fix_external_urls = $store_config['config_fix_external_urls'];
     }
     //////////////////////////////////////// SEO ////////////////////////////////////////
     if (isset($config['site_name'])) {
         $this->view->site_name = $config['site_name'];
     } elseif (isset($store_config['site_name'])) {
         $this->view->site_name = $store_config['site_name'];
     }
     if (isset($config['meta_title'])) {
         $this->view->meta_title = $config['meta_title'];
     } elseif (isset($store_config['meta_title'])) {
         $this->view->meta_title = $store_config['meta_title'];
     }
     if (isset($config['meta_keywords'])) {
         $this->view->meta_keywords = $config['meta_keywords'];
     } elseif (isset($store_config['meta_keywords'])) {
         $this->view->meta_keywords = $store_config['meta_keywords'];
     }
     if (isset($config['meta_description'])) {
         $this->view->meta_description = $config['meta_description'];
     } elseif (isset($store_config['meta_description'])) {
         $this->view->meta_description = $store_config['meta_description'];
     }
     //////////////////////////////////////// Options ////////////////////////////////////////
     if (isset($config['config_admin_limit'])) {
         $this->view->config_admin_limit = $config['config_admin_limit'];
     } elseif (isset($store_config['config_admin_limit'])) {
         $this->view->config_admin_limit = $store_config['config_admin_limit'];
     } else {
         $this->view->config_admin_limit = 15;
     }
     if (isset($config['config_front_limit'])) {
         $this->view->config_front_limit = $config['config_front_limit'];
     } elseif (isset($store_config['config_front_limit'])) {
         $this->view->config_front_limit = $store_config['config_front_limit'];
     } else {
         $this->view->config_front_limit = 10;
     }
     if (isset($config['template'])) {
         $this->view->template = $config['template'];
     } elseif (isset($store_config['template'])) {
         $this->view->template = $store_config['template'];
     }
     if (isset($config['config_maintenance'])) {
         $this->view->config_maintenance = $config['config_maintenance'];
     } elseif (isset($store_config['config_maintenance'])) {
         $this->view->config_maintenance = $store_config['config_maintenance'];
     } else {
         $this->view->config_maintenance = 0;
     }
     if (isset($config['config_hide_brand'])) {
         $this->view->config_hide_brand = $config['config_hide_brand'];
     } elseif (isset($store_config['config_hide_brand'])) {
         $this->view->config_hide_brand = $store_config['config_hide_brand'];
     } else {
         $this->view->config_hide_brand = 0;
     }
     $this->view->data_timezones = JO_Date_Timezones::getTimezonse();
     if (isset($config['phpSettings']['date.timezone'])) {
         $this->view->date_timezone = $config['phpSettings']['date.timezone'];
     } elseif (isset($store_config['phpSettings']['date.timezone'])) {
         $this->view->date_timezone = $store_config['phpSettings']['date.timezone'];
     } else {
         $this->view->date_timezone = 'UTC';
     }
     /////////////////////////////// CURRENCY ///////////////////////
     $this->view->currencies = array();
     $currencies = Model_Currency::getCurrencies(array('status' => 1));
     //WM_Currency::getCurrencies();
     if ($currencies) {
         $this->view->currencies = $currencies;
     }
     if (isset($config['config_currency'])) {
         $this->view->config_currency = $config['config_currency'];
     } elseif (isset($store_config['config_currency'])) {
         $this->view->config_currency = $store_config['config_currency'];
     }
     if (isset($config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $config['config_currency_auto_update'];
     } elseif (isset($store_config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $store_config['config_currency_auto_update'];
     } else {
         $this->view->config_currency_auto_update = 1;
     }
     if (isset($config['config_cache_live'])) {
         $this->view->config_cache_live = $config['config_cache_live'];
     } elseif (isset($store_config['config_cache_live'])) {
         $this->view->config_cache_live = $store_config['config_cache_live'];
     } else {
         $this->view->config_cache_live = 0;
     }
     if (isset($config['enable_free_registration'])) {
         $this->view->enable_free_registration = $config['enable_free_registration'];
     } elseif (isset($store_config['enable_free_registration'])) {
         $this->view->enable_free_registration = $store_config['enable_free_registration'];
     } else {
         $this->view->enable_free_registration = 0;
     }
     //////////////////////////////////////// Contacts ////////////////////////////////////////
     if (isset($config['admin_mail'])) {
         $this->view->admin_mail = $config['admin_mail'];
     } elseif (isset($store_config['admin_mail'])) {
         $this->view->admin_mail = $store_config['admin_mail'];
     }
     if (isset($config['report_mail'])) {
         $this->view->report_mail = $config['report_mail'];
     } elseif (isset($store_config['report_mail'])) {
         $this->view->report_mail = $store_config['report_mail'];
     }
     if (isset($config['noreply_mail'])) {
         $this->view->noreply_mail = $config['noreply_mail'];
     } elseif (isset($store_config['noreply_mail'])) {
         $this->view->noreply_mail = $store_config['noreply_mail'];
     }
     if (isset($config['mail_smtp'])) {
         $this->view->mail_smtp = $config['mail_smtp'];
     } elseif (isset($store_config['mail_smtp'])) {
         $this->view->mail_smtp = $store_config['mail_smtp'];
     } else {
         $this->view->mail_smtp = 0;
     }
     if (isset($config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $config['mail_smtp_host'];
     } elseif (isset($store_config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $store_config['mail_smtp_host'];
     }
     if (isset($config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $config['mail_smtp_port'];
     } elseif (isset($store_config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $store_config['mail_smtp_port'];
     }
     if (isset($config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $config['mail_smtp_user'];
     } elseif (isset($store_config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $store_config['mail_smtp_user'];
     }
     if (isset($config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $config['mail_smtp_password'];
     } elseif (isset($store_config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $store_config['mail_smtp_password'];
     }
     if (isset($config['mail_footer'])) {
         $this->view->mail_footer = $config['mail_footer'];
     } elseif (isset($store_config['mail_footer'])) {
         $this->view->mail_footer = $store_config['mail_footer'];
     }
     if (isset($config['not_rp'])) {
         $this->view->not_rp = $config['not_rp'];
     } elseif (isset($store_config['not_rp'])) {
         $this->view->not_rp = $store_config['not_rp'];
     } else {
         $this->view->not_rp = 0;
     }
     if (isset($config['not_rc'])) {
         $this->view->not_rc = $config['not_rc'];
     } elseif (isset($store_config['not_rc'])) {
         $this->view->not_rc = $store_config['not_rc'];
     } else {
         $this->view->not_rc = 0;
     }
     if (isset($config['not_ri'])) {
         $this->view->not_ri = $config['not_ri'];
     } elseif (isset($store_config['not_ri'])) {
         $this->view->not_ri = $store_config['not_ri'];
     } else {
         $this->view->not_ri = 0;
     }
     //////////////////////////////////////// AMAZON ////////////////////////////////////////
     $uploads_methods = $this->uploadsMethods();
     $this->view->uploads_methods = array();
     foreach ($uploads_methods as $method) {
         $this->view->uploads_methods[] = $this->view->callChildren('upload_' . $method);
     }
     //////////////////////////////////////// Images ////////////////////////////////////////
     /////// logo
     $image_model = new Helper_Images();
     if (isset($images['site_logo']) && $images['site_logo']) {
         $this->view->site_logo = $images['site_logo'];
     } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) {
         $this->view->site_logo = $store_config['site_logo'];
     } else {
         $this->view->site_logo = '';
     }
     if ($this->view->site_logo) {
         $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100);
     } else {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo) {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     $this->view->preview = $image_model->resize('/logo.png', 100, 100);
     ////mobile logo
     if (isset($images['site_logo_mobile']) && $images['site_logo_mobile']) {
         $this->view->site_logo_mobile = $images['site_logo_mobile'];
     } elseif (isset($store_config['site_logo_mobile']) && $store_config['site_logo_mobile']) {
         $this->view->site_logo_mobile = $store_config['site_logo_mobile'];
     } else {
         $this->view->site_logo_mobile = '';
     }
     if ($this->view->site_logo_mobile) {
         $this->view->preview_logo_mobile = $image_model->resize($this->view->site_logo_mobile, 100, 100);
     } else {
         $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo_mobile) {
         $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100);
     }
     $this->view->preview_mobile = $image_model->resize('/logo.png', 100, 100);
     ////// no image
     if (isset($images['no_image']) && $images['no_image']) {
         $this->view->no_image = $images['no_image'];
     } elseif (isset($store_config['no_image']) && $store_config['no_image']) {
         $this->view->no_image = $store_config['no_image'];
     } else {
         $this->view->no_image = '/no_image.png';
     }
     if ($this->view->no_image) {
         $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100);
     } else {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     if (!$this->view->preview_no_image) {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     ////// no avatar
     if (isset($images['no_avatar']) && $images['no_avatar']) {
         $this->view->no_avatar = $images['no_avatar'];
     } elseif (isset($store_config['no_avatar']) && $store_config['no_avatar']) {
         $this->view->no_avatar = $store_config['no_avatar'];
     } else {
         $this->view->no_avatar = '/no-avatar.png';
     }
     if ($this->view->no_avatar) {
         $this->view->preview_no_avatar = $image_model->resize($this->view->no_avatar, 100, 100);
     } else {
         $this->view->preview_no_avatar = $image_model->resize('/no-avatar.png', 100, 100);
     }
     if (!$this->view->preview_no_avatar) {
         $this->view->preview_no_avatar = $image_model->resize('/no_image.png', 100, 100);
     }
     ////// favicon
     if (isset($images['favicon']) && $images['favicon']) {
         $this->view->favicon = $images['favicon'];
     } elseif (isset($store_config['favicon']) && $store_config['favicon']) {
         $this->view->favicon = $store_config['favicon'];
     } else {
         $this->view->favicon = '';
     }
     if ($this->view->favicon) {
         $this->view->preview_favicon = $image_model->resize($this->view->favicon, 100, 100);
     } else {
         $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100);
     }
     if (!$this->view->preview_favicon) {
         $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100);
     }
     //    	$this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     //////////////////////////////////////// PAGES ////////////////////////////////////////
     if (isset($pages['about_menu'])) {
         $this->view->about_menu = $pages['about_menu'];
     } elseif (isset($store_config['about_menu'])) {
         $this->view->about_menu = $store_config['about_menu'];
     } else {
         $this->view->about_menu = array();
     }
     if (isset($pages['page_login_trouble'])) {
         $this->view->page_login_trouble = $pages['page_login_trouble'];
     } elseif (isset($store_config['page_login_trouble'])) {
         $this->view->page_login_trouble = $store_config['page_login_trouble'];
     } else {
         $this->view->page_login_trouble = 0;
     }
     if (isset($pages['page_terms'])) {
         $this->view->page_terms = $pages['page_terms'];
     } elseif (isset($store_config['page_terms'])) {
         $this->view->page_terms = $store_config['page_terms'];
     } else {
         $this->view->page_terms = 0;
     }
     if (isset($pages['page_contact'])) {
         $this->view->page_contact = $pages['page_contact'];
     } elseif (isset($store_config['page_contact'])) {
         $this->view->page_contact = $store_config['page_contact'];
     } else {
         $this->view->page_contact = 0;
     }
     if (isset($pages['page_goodies'])) {
         $this->view->page_goodies = $pages['page_goodies'];
     } elseif (isset($store_config['page_goodies'])) {
         $this->view->page_goodies = $store_config['page_goodies'];
     } else {
         $this->view->page_goodies = 0;
     }
     if (isset($pages['delete_account'])) {
         $this->view->delete_account = $pages['delete_account'];
     } elseif (isset($store_config['delete_account'])) {
         $this->view->delete_account = $store_config['delete_account'];
     } else {
         $this->view->delete_account = 0;
     }
     if (isset($pages['support_page'])) {
         $this->view->support_page = $pages['support_page'];
     } elseif (isset($store_config['support_page'])) {
         $this->view->support_page = $store_config['support_page'];
     } else {
         $this->view->support_page = 0;
     }
     if (isset($pages['page_pinmarklet'])) {
         $this->view->page_pinmarklet = $pages['page_pinmarklet'];
     } elseif (isset($store_config['page_pinmarklet'])) {
         $this->view->page_pinmarklet = $store_config['page_pinmarklet'];
     } else {
         $this->view->page_pinmarklet = 0;
     }
     if (isset($pages['page_privacy_policy'])) {
         $this->view->page_privacy_policy = $pages['page_privacy_policy'];
     } elseif (isset($store_config['page_privacy_policy'])) {
         $this->view->page_privacy_policy = $store_config['page_privacy_policy'];
     } else {
         $this->view->page_privacy_policy = 0;
     }
     //////////////////////////////////////// DATES ////////////////////////////////////////
     $this->view->short_dates = array('dd.mm.yy', 'yy-mm-dd');
     $this->view->medium_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy');
     $this->view->long_dates = array('dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy');
     $this->view->long_dates_times = array('dd MM yy H:i:s', 'D, d MM y H:i:s', 'DD, dd-MM-y H:i:s', 'D, d MM yy H:i:s');
     $this->view->news_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy', 'dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy', 'dd MM yy | H:i', 'D, d MM y | H:i', 'DD, dd-MM-y | H:i', 'D, d MM yy | H:i', 'dd MM yy | H:i:s', 'D, d MM y | H:i:s', 'DD, dd-MM-y | H:i:s', 'D, d MM yy | H:i:s');
     if (isset($config['config_date_format_short'])) {
         $this->view->config_date_format_short = $config['config_date_format_short'];
     } elseif (isset($store_config['config_date_format_short'])) {
         $this->view->config_date_format_short = $store_config['config_date_format_short'];
     } else {
         $this->view->config_date_format_short = 'dd.mm.yy';
     }
     if (isset($config['config_date_format_medium'])) {
         $this->view->config_date_format_medium = $config['config_date_format_medium'];
     } elseif (isset($store_config['config_date_format_medium'])) {
         $this->view->config_date_format_medium = $store_config['config_date_format_medium'];
     } else {
         $this->view->config_date_format_medium = 'dd M yy';
     }
     if (isset($config['config_date_format_long'])) {
         $this->view->config_date_format_long = $config['config_date_format_long'];
     } elseif (isset($store_config['config_date_format_long'])) {
         $this->view->config_date_format_long = $store_config['config_date_format_long'];
     } else {
         $this->view->config_date_format_long = 'dd MM yy';
     }
     if (isset($config['config_date_format_news'])) {
         $this->view->config_date_format_news = $config['config_date_format_news'];
     } elseif (isset($store_config['config_date_format_news'])) {
         $this->view->config_date_format_news = $store_config['config_date_format_news'];
     } else {
         $this->view->config_date_format_news = 'dd MM yy | H:i';
     }
     if (isset($config['config_date_format_long_time'])) {
         $this->view->config_date_format_long_time = $config['config_date_format_long_time'];
     } elseif (isset($store_config['config_date_format_long_time'])) {
         $this->view->config_date_format_long_time = $store_config['config_date_format_long_time'];
     } else {
         $this->view->config_date_format_long_time = 'dd MM yy H:i:s';
     }
     //////////////////////////////////////// DATES ////////////////////////////////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_without_children' => true));
     if ($categories) {
         foreach ($categories as $category) {
             $this->view->categories[] = $category;
         }
     }
     if (isset($config['default_category_id'])) {
         $this->view->default_category_id = $config['default_category_id'];
     } elseif (isset($store_config['default_category_id'])) {
         $this->view->default_category_id = $store_config['default_category_id'];
     } else {
         $this->view->default_category_id = 0;
     }
     if (isset($config['default_boards'])) {
         $this->view->default_boards = $config['default_boards'];
     } elseif (isset($store_config['default_boards'])) {
         $this->view->default_boards = $store_config['default_boards'];
     } else {
         $this->view->default_boards = array();
     }
 }
Esempio n. 24
0
 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;
                 }
             }
         }
     }
 }
Esempio n. 25
0
 public function indexAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user[user_id]')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&popup=true&next=' . urlencode($request->getFullUrl())));
     }
     $this->view->createBoard = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create');
     $boards = Model_Boards::getBoards(array('filter_user_id' => JO_Session::get('user[user_id]'), 'order' => 'boards.sort_order', 'sort' => 'ASC', 'friendly' => JO_Session::get('user[user_id]')));
     $this->view->boards = array();
     if ($boards) {
         foreach ($boards as $board) {
             $this->view->boards[] = array('board_id' => $board['board_id'], 'title' => $board['title']);
         }
     }
     //////////// Categories ////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
         $this->view->categories[] = $category;
     }
     $this->view->title = JO_Utf8::convertToUtf8($request->getQuery('title'));
     $this->view->url = JO_Utf8::convertToUtf8(urldecode($request->getQuery('url')));
     $this->view->media = JO_Utf8::convertToUtf8($request->getQuery('media'));
     $this->view->is_video = JO_Utf8::convertToUtf8($request->getQuery('is_video'));
     $this->view->description = JO_Utf8::convertToUtf8($request->getQuery('description'));
     $this->view->charset = JO_Utf8::convertToUtf8($request->getQuery('charset'));
     if (!trim($this->view->description)) {
         $this->view->description = $this->view->title;
     }
     if (JO_Session::get('success_added')) {
         $this->view->pin_url = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . JO_Session::get('success_added'));
         $this->setViewChange('success');
         JO_Session::clear('success_added');
     } else {
         if ($request->isPost()) {
             $result = Model_Pins::create(array('title' => $this->view->title, 'from' => $this->view->url, 'image' => $this->view->media, 'is_video' => $this->view->is_video, 'description' => $request->getPost('message'), 'price' => $request->getPost('price'), 'board_id' => $request->getPost('board_id'), 'pinmarklet' => 1));
             if ($result) {
                 Model_History::addHistory(0, Model_History::ADDPIN, $result);
                 $session_user = JO_Session::get('user[user_id]');
                 $group = Model_Boards::isGroupBoard($request->getPost('board_id'));
                 if ($group) {
                     $users = explode(',', $group);
                     foreach ($users as $user_id) {
                         if ($user_id != $session_user) {
                             $user_data = Model_Users::getUser($user_id);
                             if ($user_data && $user_data['email_interval'] == 1 && $user_data['groups_pin_email']) {
                                 $this->view->user_info = $user_data;
                                 $this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]'));
                                 $this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]');
                                 $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $result);
                                 $board_info = Model_Boards::getBoard($request->getPost('board_id'));
                                 if ($board_info) {
                                     $this->view->board_title = $board_info['title'];
                                     $this->view->board_href = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id']);
                                 }
                                 Model_Email::send($user_data['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('added new pin to a group board'), $this->view->render('group_board', 'mail'));
                             }
                         }
                     }
                 }
                 JO_Session::set('success_added', $result);
                 $this->redirect($request->getBaseUrl() . '?controller=bookmarklet');
             }
         }
     }
 }
Esempio n. 26
0
 private function getForm()
 {
     $request = $this->getRequest();
     $dic_id = $request->getRequest('id');
     if ($dic_id) {
         $banner_info = Model_Banners::getBanner($dic_id);
     }
     if ($request->getPost('status')) {
         $this->view->status = $request->getPost('status');
     } elseif (isset($banner_info['status'])) {
         $this->view->status = $banner_info['status'];
     } else {
         $this->view->status = 1;
     }
     if ($request->getPost('status_in_js_mode')) {
         $this->view->status_in_js_mode = $request->getPost('status_in_js_mode');
     } elseif (isset($banner_info['status_in_js_mode'])) {
         $this->view->status_in_js_mode = $banner_info['status_in_js_mode'];
     } else {
         $this->view->status_in_js_mode = 0;
     }
     if ($request->getPost('category_id')) {
         $this->view->category_id = $request->getPost('category_id');
     } elseif (isset($banner_info['category_id'])) {
         $this->view->category_id = $banner_info['category_id'];
     } else {
         $this->view->category_id = '';
     }
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } elseif (isset($banner_info['name'])) {
         $this->view->name = $banner_info['name'];
     } else {
         $this->view->name = '';
     }
     if ($request->getPost('html')) {
         $this->view->html = $request->getPost('html');
     } elseif (isset($banner_info['html'])) {
         $this->view->html = $banner_info['html'];
     } else {
         $this->view->html = '';
     }
     if ($request->getPost('height')) {
         $this->view->height = $request->getPost('height');
     } elseif (isset($banner_info['height'])) {
         if ($banner_info['height']) {
             $this->view->height = $banner_info['height'];
         } else {
             $this->view->height = 180;
         }
     } else {
         $this->view->height = 180;
     }
     if ($request->getPost('width')) {
         $this->view->width = $request->getPost('width');
     } elseif (isset($banner_info['width'])) {
         if ($banner_info['width']) {
             $this->view->width = $banner_info['width'];
         } else {
             $this->view->width = 180;
         }
     } else {
         $this->view->width = 180;
     }
     if ($request->getPost('position')) {
         $this->view->position = $request->getPost('position');
     } elseif (isset($banner_info['position'])) {
         $this->view->position = $banner_info['position'];
     } else {
         $this->view->position = 0;
     }
     if ($request->getPost('controller_set')) {
         $this->view->controller_set = $request->getPost('controller_set');
     } elseif (isset($banner_info['controller'])) {
         $this->view->controller_set = $banner_info['controller'];
     } else {
         $this->view->controller_set = '';
     }
     $this->view->categories = Model_Categories::getCategories();
     $this->view->controllers = $this->positions();
 }
Esempio n. 27
0
File: Audio.php Progetto: noikiy/PD
    public function editItem($id, $data)
    {
        $db = JO_Db::getDefaultAdapter();
        $info = self::getItem($id);
        if (!$info) {
            return;
        }
        if (isset($data['free_file'])) {
            $db->update('items', array('free_file' => 'false'));
            self::addUserStatus($id, 'freefile');
        }
        $db->update('items', array('name' => $data['name'], 'description' => $data['description'], 'price' => $data['price'], 'free_file' => isset($data['free_file']) ? 'true' : 'false', 'weekly_from' => $data['weekly_from'] ? JO_Date::getInstance($data['weekly_from'], 'yy-mm-dd', true) : '0000-00-00', 'weekly_to' => $data['weekly_to'] ? JO_Date::getInstance($data['weekly_to'], 'yy-mm-dd', true) : '0000-00-00'), array('id = ?' => (int) $id));
        if (isset($data['set_status']) && $data['set_status'] == 'active') {
            $db->update('items', array('status' => $data['set_status']), array('id = ?' => (int) $id));
            $db->update(Model_Users::getPrefixDB() . 'users', array('items' => new JO_Db_Expr('items + 1')), array('user_id = ?' => $info['user_id']));
            /////////// send email
            $request = JO_Request::getInstance();
            $translate = JO_Translate::getInstance();
            $not_template = Model_Notificationtemplates::get('approval_item');
            $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@' . $request->getDomain());
            $href = '<a href="' . WM_Router::create($request->getBaseUrl() . '?module=' . $info['module'] . '&controller=items&item_id=' . $id) . '">' . $info['name'] . '</a>';
            if ($not_template) {
                $title = $not_template['title'];
                $html = html_entity_decode($not_template['template'], ENT_QUOTES, 'utf-8');
                $html = str_replace('{USERNAME}', $info['username'], $html);
                $html = str_replace('{ITEM}', $info['name'], $html);
                $html = str_replace('{URL}', $href, $html);
            } else {
                $title = "[" . $request->getDomain() . "] " . $data['name'];
                $html = nl2br($translate->translate('Item') . ' 
				' . $href . ' ' . $translate->translate('approval'));
            }
            $mail->setSubject($title);
            $mail->setHTML($html);
            $result = $mail->send(array($info['email']), JO_Registry::get('mail_smtp') ? 'smtp' : 'mail');
            unset($mail);
            //////////////////////
        }
        if (isset($data['weekly_to']) && trim($data['weekly_to']) != '') {
            self::addUserStatus($id, 'featured');
        }
        $db->delete('items_to_category', array('item_id = ?' => (int) $id));
        if (isset($data['category_id'])) {
            foreach ($data['category_id'] as $category_id) {
                $categories = Model_Categories::getCategoryParents(Model_Categories::getCategories(array('filter_id_key' => true)), $category_id);
                $categories = explode(',', $categories);
                array_pop($categories);
                $categories = array_reverse($categories);
                $categories = ',' . implode(',', $categories) . ',';
                $db->insert('items_to_category', array('item_id' => (int) $id, 'categories' => $categories));
            }
        }
        $db->delete('items_attributes', array('item_id = ?' => (int) $id));
        if (isset($data['attributes']) && is_array($data['attributes'])) {
            foreach ($data['attributes'] as $cid => $value) {
                if (is_array($value)) {
                    foreach ($value as $val) {
                        $db->insert('items_attributes', array('item_id' => $id, 'attribute_id' => $val, 'category_id' => (int) $cid));
                    }
                } elseif ($value) {
                    $db->insert('items_attributes', array('item_id' => $id, 'attribute_id' => $value, 'category_id' => (int) $cid));
                }
            }
        }
        $db->delete('items_tags', array('item_id = ?' => (int) $id));
        if (isset($data['tags']) && $data['tags']) {
            $tags = explode(',', $data['tags']);
            foreach ($tags as $tag) {
                $tag = trim($tag);
                if ($tag) {
                    $tag_id = Model_Tags::getTagByTitleAndInsert($tag);
                    if ($tag_id) {
                        $db->insert('items_tags', array('item_id' => $id, 'tag_id' => (int) $tag_id, 'type' => ''));
                    }
                }
            }
        }
    }
Esempio n. 28
0
File: Image.php Progetto: noikiy/PD
    public function editItem($id, $data)
    {
        set_time_limit(0);
        $db = JO_Db::getDefaultAdapter();
        $info = self::getItem($id);
        if (!$info) {
            return;
        }
        if (isset($data['free_file'])) {
            $db->update('items', array('free_file' => 'false'));
            self::addUserStatus($id, 'freefile');
        }
        $db->update('items', array('name' => $data['name'], 'description' => $data['description'], 'price' => $data['price'][$data['default_price']], 'free_file' => isset($data['free_file']) ? 'true' : 'false', 'item_tags_string' => isset($data['tags']) ? $data['tags'] : '', 'weekly_from' => $data['weekly_from'] ? JO_Date::getInstance($data['weekly_from'], 'yy-mm-dd', true) : '0000-00-00', 'weekly_to' => $data['weekly_to'] ? JO_Date::getInstance($data['weekly_to'], 'yy-mm-dd', true) : '0000-00-00'), array('id = ?' => (int) $id));
        if (isset($data['set_status']) && $data['set_status'] == 'active') {
            $db->update('items', array('status' => $data['set_status']), array('id = ?' => (int) $id));
            /////////// send email
            $request = JO_Request::getInstance();
            $translate = JO_Translate::getInstance();
            $not_template = Model_Notificationtemplates::get('approval_item');
            $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@' . $request->getDomain());
            $href = '<a href="' . WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $id) . '">' . $info['name'] . '</a>';
            if ($not_template) {
                $title = $not_template['title'];
                $html = html_entity_decode($not_template['template'], ENT_QUOTES, 'utf-8');
                $html = str_replace('{USERNAME}', $info['username'], $html);
                $html = str_replace('{ITEM}', $info['name'], $html);
                $html = str_replace('{URL}', $href, $html);
            } else {
                $title = "[" . $request->getDomain() . "] " . $data['name'];
                $html = nl2br($translate->translate('Item') . ' 
				' . $href . ' ' . $translate->translate('approval'));
            }
            $mail->setSubject($title);
            $mail->setHTML($html);
            $result = $mail->send(array($info['email']), JO_Registry::get('mail_smtp') ? 'smtp' : 'mail');
            unset($mail);
            //////////////////////
        }
        if (isset($data['weekly_to']) && trim($data['weekly_to']) != '') {
            self::addUserStatus($id, 'featured');
        }
        $db->delete('items_to_category', array('item_id = ?' => (int) $id));
        if (isset($data['category_id'])) {
            foreach ($data['category_id'] as $category_id) {
                $categories = Model_Categories::getCategoryParents(Model_Categories::getCategories(array('filter_id_key' => true)), $category_id);
                $categories = explode(',', $categories);
                array_pop($categories);
                $categories = array_reverse($categories);
                $categories = ',' . implode(',', $categories) . ',';
                $db->insert('items_to_category', array('item_id' => (int) $id, 'categories' => $categories));
            }
        }
        $db->delete('items_attributes', array('item_id = ?' => (int) $id));
        if (isset($data['attributes']) && is_array($data['attributes'])) {
            foreach ($data['attributes'] as $cid => $value) {
                if (is_array($value)) {
                    foreach ($value as $val) {
                        $db->insert('items_attributes', array('item_id' => $id, 'attribute_id' => $val, 'category_id' => (int) $cid));
                    }
                } elseif ($value) {
                    $db->insert('items_attributes', array('item_id' => $id, 'attribute_id' => $value, 'category_id' => (int) $cid));
                }
            }
        }
        $db->delete('items_tags', array('item_id = ?' => (int) $id));
        if (isset($data['tags']) && $data['tags']) {
            $tags = explode(',', $data['tags']);
            foreach ($tags as $tag) {
                $tag = trim($tag);
                if ($tag) {
                    $tag_id = Model_Tags::getTagByTitleAndInsert($tag);
                    if ($tag_id) {
                        $db->insert('items_tags', array('item_id' => $id, 'tag_id' => (int) $tag_id, 'type' => ''));
                    }
                }
            }
        }
        $sizes = Model_Sizes::getAll();
        $tmp_sizes = array();
        foreach ($sizes as $size1) {
            $tmp_sizes[$size1['id']] = $size1;
        }
        $info_file = getimagesize(BASE_PATH . '/uploads/' . $info['main_file']);
        $steps = 0;
        if ($info_file[0] < $info_file[1]) {
            $type = 'p';
            $steps = $info_file[0];
            $source_aspect_ratio = round($info_file[1] / $info_file[0], 5);
        } elseif ($info_file[0] > $info_file[1]) {
            $type = 'l';
            $steps = $info_file[1];
            $source_aspect_ratio = round($info_file[0] / $info_file[1], 5);
        } else {
            $type = 'k';
            $steps = $info_file[0];
            $source_aspect_ratio = 1;
        }
        $temp_sizes = array();
        $temp_sizes2 = array();
        $deleted = array();
        foreach ($data['price'] as $size_id => $price) {
            if (trim($price) && (double) $price && isset($tmp_sizes[$size_id])) {
                $sizeMP = $tmp_sizes[$size_id]['size'] * 1000000;
                $sizeMPFrom = $sizeMP - $sizeMP / 100;
                for ($i = $steps; $i >= 1; $i--) {
                    if ($type == 'p') {
                        $width = $info_file[0] - $i;
                        $height = round($width * $source_aspect_ratio);
                    } elseif ($type == 'l') {
                        $height = $info_file[1] - $i;
                        $width = round($height * $source_aspect_ratio);
                    } else {
                        $width = $info_file[0] - $i;
                        $height = $info_file[1] - $i;
                    }
                    if ($width < 1 || $height < 1) {
                        continue;
                    }
                    if ($width * $height >= $sizeMPFrom && $width * $height <= $sizeMP) {
                        $temp_sizes[$size_id] = array('width' => $width, 'height' => $height, 'price' => $price, 'size_id' => $size_id, 'size' => $tmp_sizes[$size_id]['size']);
                        $temp_sizes2[$size_id] = true;
                        continue;
                    }
                }
            } else {
                $deleted[] = $size_id;
            }
        }
        $query_files = $db->select()->from('items_prices')->where('item_id = ?', (int) $id);
        $list_files = $db->fetchAll($query_files);
        if ($list_files) {
            foreach ($list_files as $fils) {
                if (in_array($fils['size_id'], $deleted)) {
                    if (!self::fileIsOrdered($id, $fils['size_id'])) {
                        unlink(BASE_PATH . '/uploads/' . $fils['main_file']);
                        $db->delete('items_prices', array('id = ?' => (int) $fils['id']));
                    } else {
                        $db->delete('items_prices', array('id = ?' => (int) $fils['id']));
                    }
                } elseif (!in_array($fils['size_id'], $temp_sizes2)) {
                    if (!self::fileIsOrdered($id, $fils['size_id'])) {
                        unlink(BASE_PATH . '/uploads/' . $fils['main_file']);
                        $db->delete('items_prices', array('id = ?' => (int) $fils['id']));
                    } else {
                        $db->delete('items_prices', array('id = ?' => (int) $fils['id']));
                    }
                } else {
                    if (file_exists(BASE_PATH . '/uploads/' . $fils['main_file'])) {
                        $db->update('items_prices', array('price' => (double) $temp_sizes[$fils['size_id']]['price']), array('id = ?' => (int) $fils['id']));
                        unset($temp_sizes[$fils['size_id']]);
                    } else {
                        $db->delete('items_prices', array('id = ?' => (int) $fils['id']));
                    }
                }
            }
        }
        $main_file = BASE_PATH . '/uploads/' . $info['main_file'];
        $main_path = dirname($info['main_file']);
        foreach ($temp_sizes as $key => $value) {
            $name_new = md5(time() . '_' . mt_rand()) . '.' . round($key, 2) . strtolower(strrchr(basename($info['main_file']), '.'));
            $ext = strtolower(strrchr($info['main_file'], '.'));
            $image_p = imagecreatetruecolor($value['width'], $value['height']);
            $image = null;
            if ($ext == '.jpg' || $ext == '.jpeg') {
                $image = imagecreatefromjpeg(BASE_PATH . '/uploads/' . $info['main_file']);
            } else {
                continue;
            }
            imageantialias($image_p, true);
            if ($image) {
                imagecopyresampled($image_p, $image, 0, 0, 0, 0, $value['width'], $value['height'], $info_file[0], $info_file[1]);
            }
            if (!file_exists(dirname($main_file) . '/downloads/')) {
                mkdir(dirname($main_file) . '/downloads/', 0777, true);
            }
            imagejpeg($image_p, dirname($main_file) . '/downloads/' . $name_new, 100);
            if (file_exists(dirname($main_file) . '/downloads/' . $name_new)) {
                $db->insert('items_prices', array('item_id' => (int) $id, 'size_id' => (int) $value['size_id'], 'price' => (double) $value['price'], 'main_file' => $main_path . '/downloads/' . $name_new, 'size' => $key, 'width' => $value['width'], 'height' => $value['height']));
            }
        }
    }
Esempio n. 29
0
 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 = '';
         }
     }
 }
Esempio n. 30
0
 public function editAction()
 {
     $request = $this->getRequest();
     $board_id = $request->getRequest('board_id');
     $board_info = Model_Boards::getBoard($board_id);
     if (!$board_info) {
         $this->forward('error', 'error404');
     }
     $shared = Model_Boards::allowEdit($board_id);
     if ($board_info['user_id'] != JO_Session::get('user[user_id]')) {
         if (!$shared) {
             $this->forward('error', 'error404');
         }
     }
     $this->view->shared = $shared;
     if ($shared) {
         $_POST['newboard'] = $board_info['title'];
         $_POST['category_id'] = $board_info['category_id'];
     }
     $this->view->is_edit = true;
     if ($request->isPost()) {
         if (JO_Session::get('user[user_id]')) {
             if (trim($request->getPost('newboard'))) {
                 $data = Model_Boards::editBoard($board_id, array('title' => trim($request->getPost('newboard')), 'category_id' => $request->getPost('category_id'), 'friends' => $request->getPost('friends')));
                 if ($data) {
                     $data = array();
                     $data['href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . JO_Session::get('user[user_id]') . '&board_id=' . $board_id);
                     $this->view->data = $data;
                 } else {
                     $this->view->error = $this->translate('There was a problem with the record. Please try again!');
                 }
             } else {
                 $this->view->error = $this->translate('Board name must not be empty!');
             }
         } else {
             $this->view->error = 'error login';
         }
         echo $this->renderScript('json');
     } else {
         $this->view->cat_title = Model_Boards::getCategoryTitle($board_info['category_id']);
         $this->view->title = $board_info['title'];
         $this->view->category_id = $board_info['category_id'];
         $this->view->another_users = array();
         $this->view->board_id = $board_id;
         $model_images = new Helper_Images();
         foreach ($board_info['board_users'] as $u) {
             $avatar = Helper_Uploadimages::avatar($u, '_A');
             $u['avatar'] = $avatar['image'];
             $u['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $u['user_id']);
             $this->view->another_users[] = $u;
         }
         $uin = Model_Users::getUser($board_info['user_id']);
         $avatar = Helper_Uploadimages::avatar($uin, '_A');
         $this->view->avatar = $avatar['image'];
         $this->view->fullname = $uin['fullname'];
         $this->view->userhref = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $uin['user_id']);
         $this->view->friends_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=friends');
         $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $uin['user_id'] . '&board_id=' . $board_id);
         $this->view->board_href = WM_Router::create($request->getBaseUrl() . '?controller=boards&user_id=' . $uin['user_id'] . '&board_id=' . $board_id);
         $this->view->board_delete = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=delete&user_id=' . $uin['user_id'] . '&board_id=' . $board_id);
         //////////// Categories ////////////
         $this->view->categories = array();
         $categories = Model_Categories::getCategories(array('filter_status' => 1));
         foreach ($categories as $category) {
             $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
             $this->view->categories[] = $category;
         }
         $this->view->popup_main_box = $this->view->render('popup_form', 'boards');
         $this->setViewChange('form');
         if ($request->isXmlHttpRequest()) {
             $this->view->popup = true;
             echo $this->view->popup_main_box;
             $this->noViewRenderer(true);
         } else {
             $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
         }
     }
 }