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() { if ($this->session->get('successfu_edite')) { $this->view->successfu_edite = true; $this->session->clear('successfu_edite'); } if ($this->session->get('error_permision')) { $this->view->error_permision = $this->session->get('error_permision'); $this->session->clear('error_permision'); } $reques = $this->getRequest(); $page = $reques->getRequest('page', 1); $data = array('start' => $page * JO_Registry::get('config_admin_limit') - JO_Registry::get('config_admin_limit'), 'limit' => JO_Registry::get('config_admin_limit')); $this->view->words = array(); $words = Model_Banners::getBanners($data); if ($words) { foreach ($words as $word) { $word['text_controller'] = $this->positions($word['controller']); $this->view->words[] = $word; } } $total_records = Model_Banners::getTotalBanners($data); $this->view->total_pages = ceil($total_records / JO_Registry::get('config_admin_limit')); $this->view->total_rows = $total_records; $pagination = new Model_Pagination(); $pagination->setLimit(JO_Registry::get('config_admin_limit')); $pagination->setPage($page); $pagination->setTotal($total_records); $pagination->setUrl($this->getRequest()->getModule() . '/banners/?page={page}'); $this->view->pagination = $pagination->render(); }
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 getSearchResultAction($return_data = false) { $request = $this->getRequest(); $response = $this->getResponse(); $query = $request->getRequest('q'); $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $pp = (int) Helper_Config::get('config_front_limit'); if (!(int) $pp) { $pp = 50; } if ((int) $request->getRequest('per_page') > 0 && (int) $request->getRequest('per_page') < 300) { $pp = (int) $request->getRequest('per_page'); } $data = array('start' => $pp * $page - $pp, 'limit' => $pp, 'filter_description' => $query); $return = array(); /* set board count */ $has_pins = true; if (!trim($query)) { $has_pins = false; } // pins data $pins = $has_pins ? new Model_Pins_Search($data) : new ArrayObject(); //format response data $formatObject = new Helper_Format(); if ($has_pins && $pins->count()) { $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position >= '" . (int) $data['start'] . "' AND position <= '" . (int) ($data['start'] + $pp) . "'")); foreach ($pins->data as $row => $pin) { ///banners $key = $row + ($pp * $page - $pp); if (isset($banners[$key]) && $banners[$key]) { if (($banners_result = $formatObject->fromatListBanners($banners[$key])) !== false) { $return[] = $banners_result; } } //pins $return[] = $formatObject->fromatList($pin); } } else { if ($page == 1) { $message = $this->translate('No pyngs!'); } else { $message = $this->translate('No more pyngs!'); } $return[] = $formatObject->fromatListNoResults($message); } if ($return_data) { return $return; } $formatObject->responseJsonCallback($return); $this->noViewRenderer(true); }
public function getPinsAction($return_data = false) { $request = $this->getRequest(); $response = $this->getResponse(); $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $pp = (int) Helper_Config::get('config_front_limit'); if (!(int) $pp) { $pp = 50; } if ((int) $request->getRequest('per_page') > 0 && (int) $request->getRequest('per_page') < 300) { $pp = (int) $request->getRequest('per_page'); } $data = array('start' => $pp * $page - $pp, 'limit' => $pp); $return = array(); //Recent Activity if ($page == 1 && JO_Session::get('user[user_id]')) { $history_data = Model_History_Activity::getHistoryV2(array('start' => 0, 'limit' => 10, 'sort' => 'DESC', 'order' => 'history_id')); $history = array(); foreach ($history_data as $row) { $user_avatars = Helper_Uploadimages::userAvatars(array('avatar' => $row['user_avatar'], 'store' => $row['user_store'], 'user_id' => $row['user_user_id'])); $haystack_pins = array(Model_History_Abstract::REPIN, Model_History_Abstract::ADDPIN, Model_History_Abstract::COMMENTPIN, Model_History_Abstract::LIKEPIN); $text = $row['history_text_type']; $href_pin = false; /*if( in_array($row['history_history_action'], $haystack_pins) ) { // if($row['history_history_action'] == Model_History_Abstract::REPIN) { $href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $row['history_pin_id']); } else {*/ $href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $row['history_from_user_id']); if (Model_History_Abstract::REPIN == $row['history_history_action']) { $text = array($this->translate('repinned your'), $this->translate('pin'), 1); $href_pin = WM_Router::pinAction($row['history_pin_id']); } elseif (Model_History_Abstract::LIKEPIN == $row['history_history_action']) { $text = array($this->translate('like your'), $this->translate('pin'), 1); $href_pin = WM_Router::pinAction($row['history_pin_id']); } elseif (Model_History_Abstract::UNLIKEPIN == $row['history_history_action']) { $text = array($this->translate('unlike your'), $this->translate('pin'), 1); $href_pin = WM_Router::pinAction($row['history_pin_id']); } elseif (Model_History_Abstract::COMMENTPIN == $row['history_history_action']) { $text = array($this->translate('comment your'), $this->translate('pin'), 1); $href_pin = WM_Router::pinAction($row['history_pin_id']); } elseif (Model_History_Abstract::FOLLOW == $row['history_history_action']) { $board_info = new Model_Boards_Board($row['history_board_id']); if ($board_info->count()) { $text = array($this->translate('is now following your'), $board_info['board_title']); $href_pin = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['board_user_id'] . '&board_id=' . $board_info['board_board_id']); } } elseif (Model_History_Abstract::UNFOLLOW == $row['history_history_action']) { $board_info = new Model_Boards_Board($row['history_board_id']); if ($board_info->count()) { $text = array($this->translate('has unfollow your'), $board_info['board_title']); $href_pin = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['board_user_id'] . '&board_id=' . $board_info['board_board_id']); } } //} $history[] = array('history_id' => $row['history_history_id'], 'date_added' => $row['history_date_added'], 'profile' => array('fullname' => $row['user_fullname'], 'avatars' => $user_avatars), 'href' => $href, 'href_pin' => $href_pin, 'text_type' => $text, 'text_date_dif' => sprintf($this->translate('%d %s ago'), $row['history_date_dif']['value'], $this->translate($row['history_date_dif']['key']))); } if ($history) { $return[] = array('template' => 'home_history', 'history' => $history, 'text_title_box' => $this->translate('Recent Activity')); } } // pins data $pins = new Model_Pins_HomePage($data); //format response data $formatObject = new Helper_Format(); if ($pins->count()) { $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position >= '" . (int) $data['start'] . "' AND position <= '" . (int) ($data['start'] + $pp) . "'")); foreach ($pins->data as $row => $pin) { ///banners $key = $row + ($pp * $page - $pp); if (isset($banners[$key]) && $banners[$key]) { if (($banners_result = $formatObject->fromatListBanners($banners[$key])) !== false) { $return[] = $banners_result; } } //pins $return[] = $formatObject->fromatList($pin); } } else { if ($page == 1) { $message = $this->translate('No pyngs!'); } else { $message = $this->translate('No more pyngs!'); } $return[] = $formatObject->fromatListNoResults($message); } if ($return_data) { return $return; } $formatObject->responseJsonCallback($return); $this->noViewRenderer(true); }
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 function indexHelper($return_data = false) { $request = $this->getRequest(); //if(JO_Session::get('user[user_id]') && $request->getPost('send_comment') == 1 ) { // $this->forward('pin', 'v2addComment'); //} $pin_id = $request->getRequest('pin_id'); $pin_array2 = new Model_Pins_Pin($pin_id); $return = array(); if ($pin_array2->count() < 1) { $return = array('template' => 'error', 'message' => $this->translate('The page you\'re looking for could not be found.')); } else { $pin_array = $pin_array2->data; //metas if ($return_data) { JO_Layout::getInstance()->meta_title = $pin_array['board_title'] . ' - ' . htmlspecialchars(strip_tags(html_entity_decode($pin_array['pin_description']))); JO_Layout::getInstance()->placeholder('header_metas', $this->view->callChildren('pin/header_metas', $pin_array)); } $pin = array(); foreach ($pin_array as $key => $value) { $pin[$key] = $value; } $loged = JO_Session::get('user[user_id]'); $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "'")); $tmp_banners = array(); foreach ($banners as $pos => $bannersd) { foreach ($bannersd as $k => $d) { $bannersd[$k]['html'] = html_entity_decode($d['html']); } $tmp_banners = array_merge($tmp_banners, $bannersd); } $extra_metas = ''; if (!Helper_Config::get('config_disable_js')) { $this->header_metasAction($pin_array); $extra_metas_get = Model_Extensions::getByMethod('extra_metas'); foreach ($extra_metas_get as $id => $mod) { $extra_metas .= $this->view->callChildren('modules_' . $mod . '_extrametas'); } } $pin = array_merge((array) $pin, Helper_Pin::formatPinData((array) $pin, true)); /* v2.2 */ $config_enable_follow_private_profile = Helper_Config::get('config_enable_follow_private_profile'); if ($config_enable_follow_private_profile) { $user_enable_follow = $pin['via_user_id'] ? $pin['via_enable_follow'] : $pin['user_enable_follow']; } else { $user_enable_follow = true; } /* v2.2 */ $return = array('template' => 'pinDetail', 'pin_id' => (string) $pin['pin_id'], 'is_reported' => $pin['pin_is_reported'], 'loged' => $loged, 'is_liked' => $pin['pin_is_liked'], 'vip' => $pin['pin_vip'], 'gift' => $pin['pin_gift'], 'price' => $pin['pin_price_formated'], 'is_video' => $pin['pin_is_video'], 'description' => str_replace('&', '&', $pin['pin_description']), 'likes' => $pin['pin_likes'], 'comments' => $pin['pin_comments'], 'repins' => $pin['pin_repins'], 'video_code' => $pin['pin_video_code'], 'from' => $pin['pin_from'], 'source' => $pin['pin_source'], 'target_repin' => $pin['pin_target_repin'], 'offerStartsOn' => $pin['offerStartsOn'], 'offerExpiresOn' => $pin['offerExpiresOn'], 'cityName' => $pin['cityName'], 'placeName' => $pin['placeName'], 'storeName' => $pin['storeName'], 'banners' => $tmp_banners, 'extra_metas' => $extra_metas, 'meta_title' => $pin['board_title'] . ' - ' . htmlspecialchars(strip_tags(html_entity_decode($pin['pin_description']))), 'enable_follow_board' => $loged ? $pin['board_user_id'] != $loged && $user_enable_follow : false, 'enable_follow_user' => $loged ? $pin['user_user_id'] != $loged && $user_enable_follow : false, 'enable_follow_via' => $loged ? ($pin['via_user_id'] ? $pin['via_user_id'] : $pin['user_user_id']) != $loged && $user_enable_follow : false, 'board_is_follow' => $pin['following_board'], 'user_is_follow' => $pin['following_user'], 'via_is_follow' => $pin['via_user_id'] ? $pin['following_via'] : $pin['following_user'], 'via_profile' => $pin['via_profile'] ? $pin['via_profile'] : false, 'self_profile' => $pin['self_profile'] ? $pin['self_profile'] : false, 'author_profile' => array('avatars' => $pin['user_avatars'], 'fullname' => $pin['user_fullname'], 'user_id' => $pin['user_user_id'], 'href' => $pin['user_href']), 'url_repin' => $pin['pin_url_repin'], 'url_edit' => $pin['pin_edit'], 'url_like' => $pin['pin_url_like'], 'url_comment' => $pin['pin_url_comment'], 'url_embed' => $pin['pin_url_embed'], 'url_report' => $pin['pin_url_report'], 'url_email' => $pin['pin_url_email'], 'url_login' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'), 'pin_url' => $pin['pin_href'], 'board_url' => $pin['pin_onto_href'], 'pin_next_href' => $pin['pin_next_href'], 'pin_prev_href' => $pin['pin_prev_href'], 'user_follow_href' => $pin['user_follow_href'], 'board_follow_href' => $pin['board_follow_href'], 'via_follow_href' => $pin['via_follow_href'], 'mobile_upload' => $pin['mobile_upload'], 'pin_comments' => $pin['pin_latest_comments'] ? $pin['pin_latest_comments'] : false, 'images' => $pin['pin_thumbs'], 'gallery' => $pin['pin_gallery'], 'text_mobile' => $this->translate('Mobile'), 'text_vip' => $this->translate('VIP'), 'text_from' => $this->translate('From'), 'text_uploaded_by' => $this->translate('Uploaded by'), 'text_delete_comment' => $this->translate('Delete Comment'), 'text_via' => $this->translate('via'), 'text_onto' => $this->translate('onto'), 'text_repin' => $this->translate('Repin'), 'text_edit' => $this->translate('Edit'), 'text_email' => $this->translate('Email'), 'text_like_unlike' => $pin['pin_is_liked'] ? $this->translate('Unlike') : $this->translate('Like'), 'text_comment' => $this->translate('Comment'), 'text_add_comment' => $this->translate('Add a comment...'), 'text_post_comment' => $this->translate('Post comment'), 'text_post_comment_help' => $this->translate('Type @ to recommend this pin to another Pinner'), 'text_login_comment' => $this->translate('Login to Comment'), 'text_total_likes' => sprintf($this->translate('%d like' . ($pin['pin_likes'] == 1 ? '' : 's')), $pin['pin_likes']), 'text_total_comments' => sprintf($this->translate('%d comment' . ($pin['pin_comments'] == 1 ? '' : 's')), $pin['pin_comments']), 'text_total_repins' => sprintf($this->translate('%d repin' . ($pin['pin_repins'] == 1 ? '' : 's')), $pin['pin_repins']), 'text_date_dif' => sprintf($this->translate('%d %s ago'), $pin['pin_date_dif']['value'], $this->translate($pin['pin_date_dif']['key'])), 'text_pinned_date_dif' => sprintf($this->translate(($pin['pin_repin_from'] ? 'Repinned' : 'Pinned') . ' %d %s ago'), $pin['pin_date_dif']['value'], $this->translate($pin['pin_date_dif']['key'])), 'text_pinned_date_dif_from' => sprintf($this->translate(($pin['pin_repin_from'] ? 'Repinned' : 'Pinned') . ' %d %s ago from'), $pin['pin_date_dif']['value'], $this->translate($pin['pin_date_dif']['key'])), 'text_uploads_date_dif' => sprintf($this->translate('Uploaded %d %s ago'), $pin['pin_date_dif']['value'], $this->translate($pin['pin_date_dif']['key'])), 'text_uploads_date_dif_from' => sprintf($this->translate('Uploaded %d %s ago from'), $pin['pin_date_dif']['value'], $this->translate($pin['pin_date_dif']['key'])), 'text_board' => $pin['board_title'], 'text_all_comments' => $pin['pin_comments'] >= (int) Helper_Config::get('config_comments_list') ? sprintf($this->translate('All %d comments...'), $pin['pin_comments']) : false, 'text_tweet' => $this->translate('Tweet'), 'text_embed' => $this->translate('Embed'), 'text_report_pin' => $this->translate('Report Pin'), 'text_next' => $this->translate('Next'), 'text_prev' => $this->translate('Previous'), 'text_follow' => $this->translate('Follow'), 'text_unfollow' => $this->translate('Unfollow')); Model_Pins::updateViewed($pin['pin_id']); } $extensions = Model_Extensions::getByMethod('pin_view'); if ($extensions) { $front = JO_Front::getInstance(); foreach ($extensions as $id => $ext) { $pin_data_ext = call_user_func(array($front->formatModuleName('model_' . $ext . '_pin'), 'preview'), $pin, $return); if ($pin_data_ext && is_array($pin_data_ext)) { $return = array_merge($return, $pin_data_ext); } } } if ($return_data) { return $return; } //format response data $formatObject = new Helper_Format(); $formatObject->responseJsonCallback($return); $this->noViewRenderer(true); }
public function indexAction() { // var_dump( htmlspecialchars('⚐') );exit; $request = $this->getRequest(); $pin_id = $request->getRequest('pin_id'); $pin_info = Model_Pins::getPin($pin_id); if (!$pin_info) { $this->forward('error', 'error404'); } if ($request->isPost()) { $data = $request->getParams(); $write_comment = $request->getPost('write_comment'); if (JO_Session::get('user[user_id]') && $request->issetPost('friends') && is_array($request->getPost('friends'))) { foreach ($request->getPost('friends') as $user_id => $fullname) { if (Model_Users::isFriendUser($user_id, JO_Session::get('user[user_id]'))) { $profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_id); $write_comment = preg_replace('/\\@' . $fullname . '/i', ' <a class="link comment-user-profile" href="' . $profile . '">@' . $fullname . '</a> ', $write_comment); } } } $data['write_comment'] = $write_comment; if ($request->isXmlHttpRequest()) { if (JO_Session::get('user[user_id]')) { $result = Model_Pins::addComment($data, $pin_info['latest_comments'], Model_Users::$allowed_fields); $this->view = JO_View::getInstance()->reset(); if ($result) { $avatar = Helper_Uploadimages::avatar($result['user'], '_A'); $result['user']['avatar'] = $avatar['image']; $result['user']['profile'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $result['user_id']); $this->view->ok = true; $result['pin'] = self::getPinStat($pin_id); if (JO_Session::get('user[user_id]')) { if (JO_Session::get('user[is_admin]') || JO_Session::get('user[user_id]') == $result['user_id']) { $result['delete_comment'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=deleteComment&comment_id=' . $result['comment_id']); } } if ($request) { Model_History::addHistory($pin_info['user_id'], Model_History::COMMENTPIN, $pin_id, 0, $request->getPost('write_comment')); if ($pin_info['user']['email_interval'] == 1 && $pin_info['user']['comments_email']) { $this->view->user_info = $pin_info['user']; $this->view->text_email = $this->translate('comment your'); $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=' . $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('comment your pin'), $this->view->render('comment_pin', 'mail')); } } $this->view->comment = $result; } else { $this->view->error = $this->translate('There was a problem with the record. Please try again!'); } } else { $this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=landing'); } echo $this->renderScript('json'); exit; } else { if (JO_Session::get('user[user_id]')) { $result = Model_Pins::addComment($data, $pin_info['latest_comments']); $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin_id)); } else { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing')); } } } $this->view->show_buttonswrapper = true; $this->view->url_like = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=like&pin_id=' . $pin_id); $this->view->url_tweet = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin_id); $this->view->url_embed = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=embed&pin_id=' . $pin_id); $this->view->url_report = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=report&pin_id=' . $pin_id); $this->view->url_email = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=email&pin_id=' . $pin_id); $this->view->url_repin = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=repin&pin_id=' . $pin_id); $this->view->url_comment = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=comment&pin_id=' . $pin_id); $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "'")); if ($request->isXmlHttpRequest()) { $this->view->popup = true; echo Helper_Externallinks::fixExternallinks(Helper_Pin::returnHtmlDetail($pin_info, $banners)); $this->noViewRenderer(true); } else { $this->view->pins_details = Helper_Pin::returnHtmlDetail($pin_info, $banners); JO_Registry::set('pin_info', $pin_info); $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'pin/left_part'); } }
public function indexeventBoxDetailAction() { // var_dump( htmlspecialchars('⚐') );exit; $request = $this->getRequest(); $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $dataEvents = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_event_id' => $request->getRequest('event_id')); $events = Model_Events::getEvent($dataEvents); if (!$events) { $this->forward('error', 'error404'); } if ($request->getRequest('comment')) { $this->view->comment = true; } if ($events) { $event_id = $events['event_id']; $user_id = $events['user_id']; $href = ""; $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $model_images = new Helper_Images(); $avatar = Helper_Uploadimages::avatar($events, '_D'); $events['thumb'] = $avatar['image']; //$events['avatar'] = $avatar['image']; $events['popup'] = $avatar['image']; $events['popup_width'] = $avatar['width']; $events['popup_height'] = $avatar['height']; $events['original_image'] = $avatar['original']; $events['date_event'] = Model_Events::cambiafyh_espanol($events['date_event']); //$events["sport_category"] = Model_Boards::getCategoryTitle($events["sport_category"]); $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' => $events["user_id"]); $users = Model_Users::getUsers($data); if ($users) { $events['fullname'] = $users[0]["fullname"]; $events['descriptionUser'] = $users[0]["description"]; $avataruser = Helper_Uploadimages::avatar($users[0], '_B'); $events['avataruser'] = $avataruser['image']; $events['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $events['user_id']); $href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $events['user_id']); } if (JO_Session::get('user[user_id]')) { $events['url_like'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=like&event_id=' . $event_id); $events['url_repin'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=repin&event_id=' . $event_id); $events['url_comment'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=comment&event_id=' . $event_id); $events['comment'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=comment&event_id=' . $event_id); $events['edit'] = JO_Session::get('user[user_id]') == $user_id ? WM_Router::create($request->getBaseUrl() . '?controller=events&action=events&event_id=' . $event_id) : false; } else { $events['url_like'] = $events['url_repin'] = $events['url_comment'] = $events['comment'] = WM_Router::create($request->getBaseUrl() . '?controller=landing'); $events['edit'] = false; } $view->event = $events; //$this->view->events .= $view->render('boxEventDetail', 'events'); //$this->view->events .= $view->render('pinboxdetail', 'events'); $this->view->eventos = $events; $this->view->class_contaner = 'persons'; } if ($request->isPost()) { $data = $request->getParams(); $write_comment = $request->getPost('write_comment'); if (JO_Session::get('user[user_id]') && $request->issetPost('friends') && is_array($request->getPost('friends'))) { foreach ($request->getPost('friends') as $user_id => $fullname) { if (Model_Users::isFriendUser($user_id, JO_Session::get('user[user_id]'))) { $profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_id); $write_comment = preg_replace('/\\@' . $fullname . '/i', ' <a class="link comment-user-profile" href="' . $profile . '">@' . $fullname . '</a> ', $write_comment); } } } $data['write_comment'] = $write_comment; if ($request->isXmlHttpRequest()) { if (JO_Session::get('user[user_id]')) { $result = Model_Events::addComment($data, $events['latest_comments'], Model_Users::$allowed_fields); $this->view = JO_View::getInstance()->reset(); if ($result) { $avatar = Helper_Uploadimages::avatar($result['user'], '_A'); $result['user']['avatar'] = $avatar['image']; $result['user']['profile'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $result['user_id']); $this->view->ok = true; //$result['pin'] = self::getPinStat($event_id); if (JO_Session::get('user[user_id]')) { if (JO_Session::get('user[is_admin]') || JO_Session::get('user[user_id]') == $result['user_id']) { $result['delete_comment'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=deleteComment&comment_id=' . $result['comment_id']); } } /* if($request) { Model_History::addHistory($event_info['user_id'], Model_History::COMMENTPIN, $event_id, 0, $request->getPost('write_comment')); if($event_info['user']['email_interval'] == 1 && $event_info['user']['comments_email']) { $this->view->user_info = $event_info['user']; $this->view->text_email = $this->translate('comment your'); $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->event_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $event_id ); Model_Email::send( $event_info['user']['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('comment your pin'), $this->view->render('comment_pin', 'mail') ); } } */ $this->view->comment = $result; } else { $this->view->error = $this->translate('There was a problem with the record. Please try again!'); } } else { $this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=landing'); } echo $this->renderScript('json'); exit; } else { if (JO_Session::get('user[user_id]')) { $result = Model_Events::addComment($data, $event_info['latest_comments']); $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event_id)); } else { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing')); } } } if (!$request->isXmlHttpRequest() && JO_Session::get('user[user_id]')) { $history = Model_Events::getTotalFollow(array('sort' => 'ASC', 'order' => 'date_added', 'filter_event_id' => $event_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']; $history[$key]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $data['user_id']); } $this->view->history = $history; } $this->view->show_buttonswrapper = true; $this->view->url_like = WM_Router::create($request->getBaseUrl() . '?controller=events&action=like&event_id=' . $event_id); $this->view->url_tweet = WM_Router::create($request->getBaseUrl() . '?controller=events&action=eventboxdetail&event_id=' . $event_id); $this->view->url_embed = WM_Router::create($request->getBaseUrl() . '?controller=events&action=embed&event_id=' . $event_id); $this->view->url_report = WM_Router::create($request->getBaseUrl() . '?controller=events&action=report&event_id=' . $event_id); $this->view->url_email = WM_Router::create($request->getBaseUrl() . '?controller=events&action=email&event_id=' . $event_id); $this->view->url_comment = WM_Router::create($request->getBaseUrl() . '?controller=events&action=comment&event_id=' . $event_id); //$view->event_url = WM_Router::create( $request->getBaseUrl() . '?controller=events&event_id=' . $event_id ); $view->event_url = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail?event_id=' . $event_id); //$view->login_href = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=login&next=' . urlencode($event['href']) ); $view->like_event = WM_Router::create($request->getBaseUrl() . '?controller=events&action=like&event_id=' . $event_id . '&userio_id=' . $user_id); if (JO_Session::get('user[user_id]')) { $view->eventIsLike = Model_Events::isLikeEvent($event_id, JO_Session::get('user[user_id]')); } $view->editEvent_url = WM_Router::create($request->getBaseUrl() . '?controller=events&action=add?event_id=' . $event_id); $view->follow_event = WM_Router::create($request->getBaseUrl() . '?controller=events&action=follow&event_id=' . $event_id . '&userio_id=' . $user_id); if (JO_Session::get('user[user_id]')) { $view->eventIsFollow = Model_Events::isFollowEvent($event_id, JO_Session::get('user[user_id]')); } $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "'")); if ($request->isXmlHttpRequest()) { $this->view->popup = true; echo Helper_Externallinks::fixExternallinks(Helper_Events::returnHtmlDetail($events, $banners)); $this->noViewRenderer(true); } else { $this->view->events_details = Helper_Events::returnHtmlDetail($events, $banners); JO_Registry::set('events_info', $events); $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'events/left_part'); } }