public function indexAction() { $request = $this->getRequest(); $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_marker' => $request->getRequest('marker'), 'filter_price_from' => (int) $request->getRequest('price_from'), 'filter_price_to' => (int) $request->getRequest('price_to'), 'allow_gifts' => true, 'filter_categoria_id' => $request->getRequest('category_id') != 9999 ? $request->getRequest('category_id') : null); // if((int)JO_Session::get('user[user_id]')) { // $data['following_users_from_user_id'] = JO_Session::get('user[user_id]'); // } $category_id = $request->getRequest('category_id'); if ($category_id == 9999) { $category_id = null; } $category_info = Model_Categories::getCategory($category_id); /* if($category_info && !$category_info['parent_id']){ $subCats = Model_Categories::getSubcategories($category_id); if($subCats){ $category_id = ''; foreach($subCats as $sc){ $category_id.= $sc['category_id'].","; } $category_id = substr($category_id,0,-1); } } */ if (!$category_info) { $category_info["title"] = "Todo"; } $this->view->category = $category_info; $this->view->price_from = (int) $request->getRequest('price_from'); $this->view->price_to = (int) $request->getRequest('price_to'); $this->view->pins = ''; $pins = Model_Pins::getPins($data); if ($pins) { $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position BETWEEN '" . (int) $data['start'] . "' AND '" . (int) $data['limit'] . "'")); $pp = JO_Registry::get('config_front_limit'); foreach ($pins as $row => $pin) { ///banners $key = $row + ($pp * $page - $pp); if (isset($banners[$key])) { $this->view->pins .= Helper_Banners::returnHtml($banners[$key]); } //pins $this->view->pins .= Helper_Pin::returnHtml($pin); } // JO_Registry::set('marker', Model_Pins::getMaxPin($data)); } if ($request->isXmlHttpRequest()) { echo $this->view->pins; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } }
public function indexAction() { $request = $this->getRequest(); //JO_Session::clear('categoria_id'); $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_marker' => $request->getRequest('marker')); $this->view->pins = ''; $pins = Model_Pins::getPins($data); if ($pins) { $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position BETWEEN '" . (int) $data['start'] . "' AND '" . (int) $data['limit'] . "'")); $pp = JO_Registry::get('config_front_limit'); foreach ($pins as $row => $pin) { ///banners $key = $row + ($pp * $page - $pp); if (isset($banners[$key])) { $this->view->pins .= Helper_Banners::returnHtml($banners[$key]); } //pins $this->view->pins .= Helper_Pin::returnHtml($pin); } // JO_Registry::set('marker', Model_Pins::getMaxPin($data)); } if ($request->isXmlHttpRequest()) { echo $this->view->pins; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } }
public function indexAction() { $request = $this->getRequest(); $source_id = $request->getRequest('source_id'); $source_info = Model_Source::getSource($source_id); if (!$source_info) { $this->forward('error', 'error404'); } $this->getLayout()->meta_title = $source_info['source']; $this->view->source = $source_info; $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_source_id' => $request->getRequest('source_id'), 'filter_marker' => $request->getRequest('marker')); // if((int)JO_Session::get('user[user_id]')) { // $data['following_users_from_user_id'] = JO_Session::get('user[user_id]'); // } $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 ($request->isXmlHttpRequest()) { echo $this->view->pins; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } }
public function indexAction() { $request = $this->getRequest(); $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $query = $request->getRequest('q'); $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 ($request->isXmlHttpRequest()) { echo $this->view->pins; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } }
public function indexAction() { $request = $this->getRequest(); //JO_Session::clear('categoria_id'); //para las APP's if (isset($_POST['token']) && $_POST['token'] == md5($_POST['userid'])) { $_SESSION['token'] = $_POST['token']; JO_Session::set('token', $_POST['token']); $result = Model_Users::checkLoginAPP($_POST['userid']); if ($result) { if ($result['status']) { @setcookie('csrftoken_', md5($result['user_id'] . $request->getDomain() . $result['date_added']), time() + 86400 * 366 * 5, '/', '.' . $request->getDomain()); JO_Session::set(array('user' => $result)); } } } if ($request->getParam('direct_path') == 'true') { 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->redirect($request->getBaseUrl()); } /*$img = JO_Phpthumb::getInstance(); var_dump($img->isValidImplementation('imagick')); exit; $img = JO_Phpthumb_Factory::create('http://www.desiredanimations.com/wp-content/uploads/2011/08/Cars-2.jpg'); $img->adaptiveResize(250, 250)->createReflection(40, 40, 80, true, '#a4a4a4'); $img->show(); exit;*/ $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit')); if (JO_Session::get('user[user_id]')) { $data['following_users_from_user_id'] = JO_Session::get('user[user_id]'); $data['filter_marker'] = $request->getRequest('marker'); } else { $data['filter_rand'] = true; } $this->view->pins = ''; //error_log("INICIO PINS: ".date("Y-m-d H:i:s")); $pins = Model_Pins::getPins($data); //error_log("EMPIEZAN PINES: ".self::udate("Y-m-d H:i:s:u")); if ($pins) { $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position BETWEEN '" . (int) $data['start'] . "' AND '" . (int) $data['limit'] . "'")); $pp = JO_Registry::get('config_front_limit'); $cuentaPins = 0; foreach ($pins as $row => $pin) { $cuentaPins = $cuentaPins + 1; ///banners $key = $row + ($pp * $page - $pp); if (isset($banners[$key])) { $this->view->pins .= Helper_Banners::returnHtml($banners[$key]); } //pins //error_log("EMPIEZA PIN(".$cuentaPins."): ".self::udate("Y-m-d H:i:s:u")); $this->view->pins .= Helper_Pin::returnHtml($pin); //error_log("FIN PIN(".$cuentaPins."): ".self::udate("Y-m-d H:i:s:u")); } //error_log("FIN BUCLE (".$cuentaPins." PINS): ".date("Y-m-d H:i:s")); if (JO_Session::get('user[user_id]')) { // JO_Registry::set('marker', Model_Pins::getMaxPin($data)); } } //error_log("FIN PINES(".$cuentaPins."): ".self::udate("Y-m-d H:i:s:u")); if (!$request->isXmlHttpRequest() && JO_Session::get('user[user_id]')) { $history = Model_History::getHistory(array('start' => 0, 'limit' => 10, 'sort' => 'DESC', 'order' => 'history_id')); $model_images = new Helper_Images(); foreach ($history as $key => $data) { if (!isset($data['user']['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($data['user'], '_A'); $history[$key]['user']['avatar'] = $avatar['image']; if ($data['history_action'] == Model_History::REPIN) { $history[$key]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $data['pin_id']); } else { $history[$key]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $data['from_user_id']); } } $this->view->history = $history; } if ($request->isXmlHttpRequest()) { echo $this->view->pins; // echo $this->renderScript('json'); $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } // if((int)JO_Registry::get('config_cache_live')) { // $http = new JO_Http(); // $http->setTimeout(1); // $http->execute($request->getBaseUrl() . '?action=generateCache'); // } }
public static function rebuildCache($pins) { if (!$pins) { return; } if (!is_array($pins)) { $pins = Model_Pins::getPins(array('filter_pin_id' => $pins)); } else { $pins = Model_Pins::getPins(array('filter_id_in' => implode(',', $pins))); } if ($pins) { foreach ($pins as $pin) { self::deleteCache($pin); Helper_Pin::returnHtml($pin, true); } } }
public function pinsAction() { $request = $this->getRequest(); $user_data = $this->profileHelp(); $this->setViewChange('profile'); $this->view->active = 'pins'; $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $this->view->boards = ''; $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_marker' => $request->getRequest('marker'), 'filter_user_id' => $user_data['user_id']); if ($request->getQuery('filter') == 'likes') { unset($data['filter_user_id']); $data['filter_likes'] = $user_data['user_id']; $this->view->active = 'likes'; } $pins = Model_Pins::getPins($data); if ($pins) { foreach ($pins as $pin) { $this->view->boards .= Helper_Pin::returnHtml($pin); } // JO_Registry::set('marker', Model_Pins::getMaxPin($data)); } if ($request->getQuery('filter') == 'likes') { $events = Model_Events::getEvents($data); 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['original'] = $avatar['original']; $event['width'] = $avatar['width']; $event['height'] = $avatar['height']; $event["sport_category"] = Model_Boards::getCategoryTitle($event["sport_category"]); $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->boards .= $view->render('boxEventPin', 'events'); $events[$i]["href"] = $href; $eventsTot[] = $events[$i]; $i++; } // JO_Registry::set('marker', Model_Pins::getMaxPin($data)); } } $agendas = Model_Users::getUserAgenda(array('filter_user_id' => $user_data['user_id'])); $this->view->has_agendas = false; $this->view->agendas_users = ""; if ($agendas) { $this->view->has_agendas = true; foreach ($agendas as $agenda) { $agenda['hrefDelete'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=agendaPopupDelete&agenda_id=' . $agenda['agenda_id'] . '&user_id=' . $user_data['user_id']); $this->view->agenda = $agenda; $this->view->agendas_users .= $this->view->render('agenda', 'users'); } } $session_user = JO_Session::get('user[user_id]'); $this->view->popup_agenda = WM_Router::create($request->getBaseUrl() . '?controller=users&action=agendaPopup&user_id=' . $user_data['user_id']); //no mover de esta ubicación $messages = Model_Users::getUserMessages(array('start' => 0, 'limit' => 100, 'filter_user_id' => $user_data['user_id'], 'idPadre' => 0)); $this->view->has_messages = false; $this->view->messages_users = ""; if ($messages) { $this->view->has_messages = true; foreach ($messages as $message) { $avatar = Helper_Uploadimages::avatar($message, '_A'); $message['avatar'] = $avatar['image']; $message['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $message['user_id']); $message['hrefDelete'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopupDelete&message_id=' . $message['message_id'] . '&user_id=' . $user_data['user_id']); $message['hrefResponder'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopup&user_from=' . $session_user . '&user_to=' . $user_data['user_id'] . '&board_user='******'user_id'] . '&message_from_id=' . $message['message_id']); $this->view->message = $message; $this->view->messages_users .= $this->view->render('message', 'users'); //ahora vamos a consultar las respuestas a este: $messagesHijos = Model_Users::getUserMessages(array('start' => 0, 'limit' => 100, 'filter_user_id' => $user_data['user_id'], 'idPadre' => $message['message_id'])); if ($messagesHijos) { foreach ($messagesHijos as $messageHijo) { $avatar = Helper_Uploadimages::avatar($messageHijo, '_A'); $messageHijo['avatar'] = $avatar['image']; $messageHijo['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $messageHijo['user_id']); $messageHijo['hrefDelete'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopupDelete&message_id=' . $messageHijo['message_id'] . '&user_id=' . $user_data['user_id']); $messageHijo['hrefResponder'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopup&user_from=' . $session_user . '&user_to=' . $user_data['user_id'] . '&board_user='******'user_id'] . '&message_from_id=' . $messageHijo['message_id']); $this->view->message = $messageHijo; $this->view->messages_users .= $this->view->render('message', 'users'); } } } } $session_user = JO_Session::get('user[user_id]'); $this->view->popup_messages = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopup&user_from=' . $session_user . '&user_to=' . $user_data['user_id'] . '&board_user='******'user_id'] . '&message_from_id=0'); //$this->view->popup_activate = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=activatePopup'); //&user_from=' . $session_user . '&user_to=' . $user_data['user_id'].'&board_user='******'user_id'] .'&message_from_id=0' ); //$this->view->popup_activate = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=activateDetail'); //&user_from=' . $session_user . '&user_to=' . $user_data['user_id'].'&board_user='******'user_id'] .'&message_from_id=0' ); $_SESSION["activate_url"] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')); $this->view->popup_activate = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activate'); $this->view->search_url = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced?id=activate'); //$this->view->deportes = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=deportes'); $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'); $activate = Model_Users::getActivateUser(JO_Session::get('user[user_id]')); if ($activate) { $this->view->userIsActivate = $activate["activate"]; } if ($user_data['type_user']) { $this->view->userCanActivate = Model_Users::getUserTypeNotOthers($user_data['type_user']); } if (JO_Registry::get('isMobile')) { $this->view->urlagenda = WM_Router::create($request->getBaseUrl() . '?controller=users&action=agenda&user_id=' . $user_data['user_id']); $this->view->urlmensajes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=mensajes&user_id=' . $user_data['user_id']); } if ($request->isXmlHttpRequest()) { echo $this->view->boards; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } }
public function indexAction() { $request = $this->getRequest(); $board_id = $request->getRequest('board_id'); $user_id = $request->getRequest('user_id'); $board_info = Model_Boards::getBoard($board_id, true); if (!$board_info) { $this->forward('error', 'error404'); } if (!$board_info['category_id'] && JO_Session::get('user[user_id]') == $board_info['user_id']) { JO_Registry::set('board_category_change', $board_info); } $user_info = Model_Users::getUserByBoard($board_info['user_id'], $board_id); $model_images = new Helper_Images(); if ($user_info) { $avatar = Helper_Uploadimages::avatar($user_info, '_A'); $user_info['avatar'] = $avatar['image']; $user_info['profile'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_info['user_id']); $this->view->user_info = $user_info; $user_id = $user_info['user_id']; } Model_Boards::updateViewed($board_id); if (!$board_info['public'] && $user_id != JO_Registry::get('user[user_id]')) { $this->forward('error', 'error404'); } $board_info['isFollow'] = Model_Users::isFollow(array('board_id' => $board_info['board_id'])); $this->view->follow = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=follow' . ($board_info['user_id'] ? '&user_id=' . $board_info['user_id'] : '') . '&board_id=' . $board_info['board_id']); if (Model_Boards::allowEdit($board_id)) { $this->view->is_enable_follow = false; $board_info['edit'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id']); } else { $board_info['edit'] = false; if (JO_Session::get('user[user_id]')) { if (JO_Session::get('user[user_id]') != $board_info['user_id']) { $this->view->is_enable_follow = true; } else { $this->view->is_enable_follow = false; $board_info['edit'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id']); } } else { $this->view->is_enable_follow = false; } } $this->view->board_url = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id']); $this->view->board_users = array(); if ($board_info['board_users']) { foreach ($board_info['board_users'] as $usr) { $avatar = Helper_Uploadimages::avatar($usr, '_A'); $usr['avatar'] = $avatar['image']; $usr['profile'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $usr['user_id']); $this->view->board_users[] = $usr; } } $this->view->board = $board_info; $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_board_id' => $board_info['board_id'], 'filter_marker' => $request->getRequest('marker')); // if((int)JO_Session::get('user[user_id]')) { // $data['following_users_from_user_id'] = JO_Session::get('user[user_id]'); // } $this->view->pins = ''; $pins = Model_Pins::getPins($data); //==== FEED ====// JO_Registry::set('rss_feed', array('title' => $board_info['title'] . ' ' . sprintf($this->translate('on %s'), JO_Registry::get('site_name')), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id'] . '&feed'))); $_route_ = $request->getParam('_route_'); $_route_parts = explode('/', $_route_); if (isset($_route_parts[2]) && $_route_parts[2] == 'feed') { $this->forward('boards', 'feed', array('pins' => $pins, 'view' => $this->view)); } //==== FEED ====// $image = ''; if ($pins) { foreach ($pins as $pin) { $this->view->pins .= Helper_Pin::returnHtml($pin); if (!$image) { $img = Helper_Uploadimages::pin($pin, '_D'); if ($img) { $image = $img['image']; } } } // JO_Registry::set('marker', Model_Pins::getMaxPin($data)); } $this->getLayout()->placeholder('pin_url', $this->view->board_url); if ($image) { $this->getLayout()->placeholder('pin_image', $image); } $this->getLayout()->placeholder('pin_description', 'null'); if ($request->isXmlHttpRequest()) { echo $this->view->pins; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } JO_Layout::getInstance()->meta_title = $board_info['title']; }