Exemplo n.º 1
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');
             }
         }
     }
 }
Exemplo n.º 2
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');
 }
Exemplo n.º 3
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');
 }
Exemplo n.º 4
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;
 }
Exemplo n.º 5
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');
     }
 }
Exemplo n.º 6
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']));
     }
 }
Exemplo n.º 7
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');
 }
Exemplo n.º 8
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');
 }
Exemplo n.º 9
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);
 }
Exemplo n.º 10
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');
 }
Exemplo n.º 11
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');
         }
     }
 }