Ejemplo n.º 1
0
 /**
  * @param array $options
  * @return JO_Layout
  */
 public static function getInstance($options = array())
 {
     if (self::$_instance == null) {
         self::$_instance = new self($options);
     }
     return self::$_instance;
 }
Ejemplo n.º 2
0
    public function registerCss()
    {
        $style = '<style type="text/css">
			#captcha_holder_' . $this->random_css_key . ' {
				padding: 5px;
				-moz-border-radius: 5px;
				-webkit-border-radius: 5px;
				border-radius: 5px;
				background: #7e0100;
			}
			#captcha_holder_' . $this->random_css_key . ' .image_' . $this->random_css_key . ' {
				width: ' . $this->width . 'px;
				height: ' . $this->height . 'px;
				margin-bottom: 5px;
			}
			#captcha_holder_' . $this->random_css_key . ' .input_' . $this->random_css_key . ' {
				padding: 2px 10px;
				-moz-border-radius: 5px;
				-webkit-border-radius: 5px;
				border-radius: 5px;
				background: #ffdc73;
				width: ' . ($this->width - 20) . 'px;
			}
			#captcha_holder_' . $this->random_css_key . ' .input_' . $this->random_css_key . ' input {
				width: ' . ($this->width - 25) . 'px;
				border: 1px solid #cca940;
				padding: 2px 0;
			}
			</style>';
        JO_Layout::getInstance()->placeholder('style', $style);
    }
Ejemplo n.º 3
0
 public function indexAction()
 {
     $request = $this->getRequest();
     //first login after registration
     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     if ($request->getParam('direct_path') == 'true') {
         $this->sendWelcomeAction();
         $this->redirect($request->getBaseUrl());
     }
     if (!Helper_Config::get('config_disable_js')) {
         //if pin is in detail page
         $this->view->open_from_pin_detail_page = false;
         if ($request->getParam('open_from_pin_detail_page')) {
             $pin_array = new Model_Pins_Pin($request->getParam('open_from_pin_detail_page'));
             if ($pin_array->count()) {
                 $pin_array = $pin_array->data;
                 $this->getLayout()->placeholder('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));
             }
             $this->view->open_from_pin_detail_page = WM_Router::pinAction($request->getParam('open_from_pin_detail_page'));
         }
     }
     ///// get pins
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $this->view->result_data = '';
     if (!Helper_Config::get('config_disable_js')) {
         //get pins data
         if ($request->isXmlHttpRequest()) {
             $this->forward('index', 'getPins');
         }
     } else {
         if ($page > 1 && $request->isXmlHttpRequest()) {
             $this->forward('index', 'getPins');
         }
         $pins = (array) $this->getPinsAction(true);
         foreach ($pins as $pin) {
             $template = new Helper_Tmpl($pin['template'], $pin);
             $this->view->result_data .= $template->render($pin['template']);
         }
     }
     //call header and footer childrens
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Ejemplo n.º 4
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $category_id = $request->getRequest('category_id');
     $category_info = Model_Categories::getCategory($category_id);
     if (!$category_info) {
         $this->forward('error', 'error404');
     }
     /*//get pins data
     		if($request->isXmlHttpRequest()) {
     			$this->forward('category', 'getPins');
     		}*/
     ///// get pins
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $this->view->result_data = '';
     if (!Helper_Config::get('config_disable_js')) {
         //get pins data
         if ($request->isXmlHttpRequest()) {
             $this->forward('category', 'getPins');
         }
     } else {
         if ($page > 1 && $request->isXmlHttpRequest()) {
             $this->forward('category', 'getPins');
         }
         $pins = (array) $this->getPinsAction(true);
         foreach ($pins as $pin) {
             $template = new Helper_Tmpl($pin['template'], $pin);
             $this->view->result_data .= $template->render($pin['template']);
         }
     }
     $this->view->category = $category_info;
     $category_logo = '';
     if ($category_info['image'] && file_exists(BASE_PATH . '/uploads' . $category_info['image'])) {
         $category_logo = $request->getBaseUrl() . 'uploads' . $category_info['image'];
     }
     $this->getLayout()->placeholder('title', $category_info['meta_title'] ? $category_info['meta_title'] : $category_info['title']);
     JO_Layout::getInstance()->placeholder('header_metas', $this->view->callChildren('layout/header_metas', array('meta_title' => $category_info['meta_title'] ? $category_info['meta_title'] : $category_info['title'], 'meta_description' => $category_info['meta_description'] ? $category_info['meta_description'] : Helper_Config::get('meta_description'), 'meta_keywords' => $category_info['meta_keywords'] ? $category_info['meta_keywords'] : Helper_Config::get('meta_keywords'), 'site_logo' => $category_logo)));
     //call header and footer childrens
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Ejemplo n.º 5
0
 public function readAction()
 {
     $pageIDs = explode('_', $this->getRequest()->getRequest('page_id'));
     $pageID = end($pageIDs);
     //	    if($pageID == JO_Registry::get('page_contact')) {
     //	    	$this->redirect(WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=contacts'));
     //	    }
     if ($this->getRequest()->isXmlHttpRequest() || $this->getRequest()->issetQuery('popup')) {
         $this->forward('pages', 'ajaxRead');
     }
     $this->view->page = Model_Pages::getPage($pageID);
     if (!$this->view->page) {
         $this->forward('error', 'error404');
     }
     if ($this->view->page['parent_id']) {
         $this->getRequest()->setParams('active_page_id', $this->view->page['parent_id']);
     } else {
         $this->getRequest()->setParams('active_page_id', $pageID);
     }
     $model_images = new Helper_Images();
     $this->view->page['description'] = html_entity_decode($this->view->page['description'], ENT_QUOTES, 'utf-8');
     if (Helper_Config::get('config_fix_image_thumb_editor')) {
         $this->view->page['description'] = $model_images->fixEditorText($this->view->page['description']);
     }
     if (Helper_Config::get('config_fix_external_urls')) {
         $this->view->page['description'] = $this->fixUrl($this->view->page['description']);
     }
     $this->view->page['description'] = $this->replaceTags($this->view->page['description']);
     $this->getLayout()->placeholder('title', $this->view->page['meta_title'] ? $this->view->page['meta_title'] : $this->view->page['title']);
     JO_Layout::getInstance()->placeholder('header_metas', $this->view->callChildren('layout/header_metas', array('meta_title' => $this->view->page['meta_title'] ? $this->view->page['meta_title'] : $this->view->page['title'], 'meta_description' => $this->view->page['meta_description'] ? $this->view->page['meta_description'] : Helper_Config::get('meta_description'), 'meta_keywords' => $this->view->page['meta_keywords'] ? $this->view->page['meta_keywords'] : Helper_Config::get('meta_keywords'))));
     $this->view->images = array();
     $images = Model_Gallery::getGalleryImages($pageID, 'pages');
     if ($images) {
         foreach ($images as $image) {
             $this->view->images[] = array('title' => $image['title'], 'thumb' => $model_images->resize($image['image'], 91, 47, true), 'popup' => $model_images->resizeWidth($image['image'], 582), 'image' => 'uploads' . $image['image']);
         }
     }
     $this->view->full_url = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . $pageID);
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'pages/left_part');
 }
Ejemplo n.º 6
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $board_id = $request->getRequest('board_id');
     $user_id = $request->getRequest('user_id');
     $board_info = new Model_Boards_Board($board_id);
     if (!$board_info->count()) {
         $this->forward('error', 'error404');
     }
     if (!Helper_Config::get('config_board_description_enable')) {
         $board_info['board_description'] = false;
     }
     $board_users_allow = array_filter(explode(',', $board_info['board_users_allow']));
     $board_users = array_merge(array($board_info['user_user_id']), array_filter($board_users_allow));
     if (!$board_info['board_public'] && !in_array(JO_Session::get('user[user_id]'), $board_users)) {
         $this->forward('error', 'error404');
     }
     if (!$board_info['board_category_id'] && JO_Session::get('user[user_id]') == $board_info['user_user_id']) {
         JO_Registry::set('board_category_change', $board_info);
     }
     $this->view->board_users = array();
     foreach ($board_users as $user_id) {
         $user_info = new Model_Users_User($user_id);
         if ($user_info->count()) {
             $user_avatars = Helper_Uploadimages::userAvatars($user_info);
             $this->view->board_users[] = array('fullname' => $user_info['fullname'], 'avatars' => $user_avatars, 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_info['user_id']));
         }
     }
     ///disable follow board for board users
     $this->view->is_enable_follow = JO_Session::get('user[user_id]');
     //if(in_array(JO_Session::get('user[user_id]'), $board_users)) {
     if (JO_Session::get('user[user_id]') == $board_info['board_user_id']) {
         $this->view->is_enable_follow = false;
     }
     /* v2.2 */
     if (Helper_Config::get('config_enable_follow_private_profile') && !$board_info['user_enable_follow']) {
         $this->view->is_enable_follow = false;
     }
     /* v2.2 */
     if ($this->view->is_enable_follow) {
         $this->view->follow = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=follow&user_id=' . $board_info['user_user_id'] . '&board_id=' . $board_info['board_board_id']);
     } else {
         $this->view->follow = false;
     }
     //enable edit for board user
     $board_info['edit'] = false;
     if (JO_Session::get('user[user_id]') == $board_info['user_user_id']) {
         $board_info['edit'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board_info['user_user_id'] . '&board_id=' . $board_info['board_board_id']);
     }
     // board url
     $this->view->board_url = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['board_user_id'] . '&board_id=' . $board_info['board_board_id']);
     $this->view->board = $board_info;
     $this->getLayout()->placeholder('title', $board_info['board_title']);
     JO_Layout::getInstance()->placeholder('header_metas', $this->view->callChildren('boards/header_metas', $board_info));
     /*//get pins data
     		if($request->isXmlHttpRequest()) {
     			$this->forward('boards', 'getPins', $board_info);
     		}*/
     ///// get pins
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     if ($request->getQuery('ignoreDisabled') == 'true') {
         Helper_Config::set('config_disable_js', 0);
     }
     $this->view->result_data = '';
     if (!Helper_Config::get('config_disable_js')) {
         //get pins data
         if ($request->isXmlHttpRequest()) {
             $this->forward('boards', 'getPins', $board_info);
         }
     } else {
         if ($page > 1 && $request->isXmlHttpRequest()) {
             $this->forward('boards', 'getPins', $board_info);
         }
         $pins = (array) $this->getPinsAction($board_info, true);
         foreach ($pins as $pin) {
             $template = new Helper_Tmpl($pin['template'], $pin);
             $this->view->result_data .= $template->render($pin['template']);
         }
     }
     //==== FEED ====//
     $_route_ = $request->getParam('_route_');
     $_route_parts = explode('/', $_route_);
     if (isset($_route_parts[2]) && $_route_parts[2] == 'feed') {
         $this->forward('boards', 'feed', array('view' => $this->view));
     }
     //call header and footer childrens
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
     //update count view
     Model_Boards::updateViewed($board_id);
 }
Ejemplo n.º 7
0
 private function profileHelp()
 {
     $request = $this->getRequest();
     $user_data = new Model_Users_User($request->getRequest('user_id'));
     if (!$user_data->count()) {
         $this->forward('error', 'error404');
     }
     if (!$user_data['facebook_connect']) {
         $user_data['facebook_id'] = 0;
     }
     if (!$user_data['twitter_connect']) {
         $user_data['twitter_id'] = 0;
     }
     $user_data['avatars'] = Helper_Uploadimages::userAvatars($user_data);
     //$user_data['image_href'] = $user_data['avatar'];
     if ($user_data['user_id'] == JO_Session::get('user[user_id]')) {
         $user_data['image_href'] = WM_Router::create($request->getBaseUrl() . '?controller=settings');
     } else {
         $user_data['image_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_data['user_id']);
     }
     $this->view->active = 'boards';
     if ($user_data['website'] && !preg_match('/^https?:\\/\\//', $user_data['website'])) {
         $user_data['website'] = 'http://' . $user_data['website'];
     }
     $this->view->userdata = $user_data;
     $this->view->self_profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_data['user_id']);
     $this->view->user_pins = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $user_data['user_id']);
     $this->view->user_pins_likes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $user_data['user_id'] . '&filter=likes');
     $this->view->settings = WM_Router::create($request->getBaseUrl() . '?controller=settings');
     $this->view->user_activity = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activity&user_id=' . $user_data['user_id']);
     $this->view->user_followers = WM_Router::create($request->getBaseUrl() . '?controller=users&action=followers&user_id=' . $user_data['user_id']);
     $this->view->user_following = WM_Router::create($request->getBaseUrl() . '?controller=users&action=following&user_id=' . $user_data['user_id']);
     $this->view->edit_description = WM_Router::create($request->getBaseUrl() . '?controller=users&action=editDescription');
     $this->view->enable_edit = JO_Session::get('user[user_id]') && JO_Session::get('user[user_id]') == $user_data['user_id'];
     /* v2.2 mod */
     $this->view->enable_follow = JO_Session::get('user[user_id]') && JO_Session::get('user[user_id]') != $user_data['user_id'] && (Helper_Config::get('config_enable_follow_private_profile') ? $user_data['enable_follow'] : true);
     /* v2.2 mod */
     $this->view->order_boards = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=sort_order');
     $this->view->reload_page = $request->getFullUrl();
     if (JO_Session::get('user[user_id]') && $user_data['user_id'] != JO_Session::get('user[user_id]')) {
         $this->view->userIsFollow = Model_Users::isFollowUser($user_data['user_id']);
         $this->view->follow_user = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user_data['user_id']);
     }
     $this->view->class_contaner = $request->getAction();
     $data = array('start' => 0, 'limit' => 3, 'filter_history_action' => Model_History_Abstract::REPIN);
     $history = new Model_History_Activity($data, 'from_user_id', $user_data['user_id']);
     $this->view->history_data = array();
     $this->view->title_right = $this->translate('Repins from');
     if (!$history->count()) {
         $this->view->title_right = $this->translate('Following');
         $data['filter_history_action'] = Model_History_Abstract::FOLLOW_USER;
         $history = new Model_History_Activity($data, 'from_user_id', $user_data['user_id']);
     }
     if ($history->count()) {
         foreach ($history as $r) {
             $ud = array();
             foreach ($r as $k => $v) {
                 if (strpos($k, 'user_') === 0) {
                     $ud[substr($k, 5)] = $v;
                 }
             }
             $this->view->history_data[] = array('title' => $r['user_fullname'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $r['user_user_id']), 'avatars' => Helper_Uploadimages::userAvatars($ud));
         }
     }
     //extensions
     $user_data['user_social_icons'] = array();
     $user_login_buttons = Model_Extensions::getByMethod('user_login');
     $tmp = $user_data;
     foreach ($user_login_buttons as $id => $login) {
         $user_data['user_social_icons'][] = $this->view->callChildren('modules_' . $login . '_profileicons', (array) $tmp);
     }
     ////metas
     $user_data['meta_title'] = $user_data['fullname'] . ' ' . sprintf($this->translate('on %s'), Helper_Config::get('site_name'));
     $this->getLayout()->placeholder('title', $user_data['meta_title']);
     JO_Layout::getInstance()->placeholder('header_metas', $this->view->callChildren('users/header_metas', $user_data));
     return $user_data;
 }
Ejemplo n.º 8
0
 private function getTemplates($ignore = array())
 {
     $template_path = JO_Layout::getInstance()->getTemplatePath();
     $list = glob($template_path . '*');
     $templates = array();
     if ($list) {
         foreach ($list as $dir) {
             if (!in_array(basename($dir), $ignore)) {
                 $templates[] = basename($dir);
             }
         }
     }
     return $templates;
 }
Ejemplo n.º 9
0
 /**
  * @param string $action
  */
 public function dispatch($controller, $action, $param = '')
 {
     $request = $this->getRequest();
     if ($action == 'error404') {
         $request->setParams(array('controller' => 'error', 'action' => 'error404'));
     }
     $name = $controller;
     $view = $this->initView();
     $this->preDispatch();
     if (null === $this->_classMethods) {
         $this->_classMethods = get_class_methods($this);
     }
     $script = $action;
     $action = $action . 'Action';
     $throw = '';
     if (in_array($action, $this->_classMethods)) {
         //			ob_start(array(new JO_Error, 'error_handler'));
         ob_start(array(new JO_Error(), 'fatal_error_handler'));
         $this->{$action}($param);
     } else {
         $displayExceptions = JO_Front::getInstance()->getParam('displayExceptions');
         if ($displayExceptions) {
             $throw = $this->call_error($action);
             $layout = JO_Layout::getInstance();
             $layout->content = '<pre>' . $throw . '<pre>';
             $response = $layout->response();
             return $this->getResponse()->appendBody($response);
         } else {
             if ($this->getRequest()->getForwarded() != 'error') {
                 $this->forward('error', 'error404');
             } else {
                 $this->forward('JO_Action', 'error404');
             }
         }
     }
     $this->postDispatch();
     if (!$this->getInvokeArg('noViewRenderer')) {
         $layout = JO_Layout::getInstance();
         if ($this->view_change) {
             $script = $this->view_change;
         }
         $layout->content = $view->render($script, $script == 'error404' ? 'error' : $name);
         if (JO_Registry::forceGet('viewSetCallback')) {
             $layout->content = call_user_func(JO_Registry::forceGet('viewSetCallback'), $layout->content);
         } elseif ($this->response_callback) {
             $layout->content = call_user_func($this->response_callback, $layout->content);
         }
         if ($this->isChildren) {
             return $layout->content;
         } elseif ($this->noLayout) {
             return $this->getResponse()->appendBody($layout->content);
         } else {
             $response = $layout->response();
             if ($this->response_callback) {
                 $response = call_user_func($this->response_callback, $response);
             }
             if (JO_Registry::isRegistered('static_cache_options') && JO_Registry::forceGet('static_cache_enable')) {
                 $options = (array) unserialize(JO_Registry::get('static_cache_options'));
                 $cache_object = new JO_Cache_Static($options);
                 $cache_object->add(false, $response);
             }
             return $this->getResponse()->appendBody($response);
         }
     }
 }
Ejemplo n.º 10
0
 public static function getTemplates()
 {
     $template_path = JO_Layout::getInstance()->getTemplatePath();
     $list = glob($template_path . '*');
     $templates = array();
     if ($list) {
         foreach ($list as $dir) {
             $templates[] = basename($dir);
         }
     }
     return $templates;
 }
Ejemplo n.º 11
0
 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'];
 }
Ejemplo n.º 12
0
 public static function returnHtmlDetail($event, $banners = false)
 {
     //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();
     }
     /*
     $next_pin = Model_Pins::getNextPin($event['event_id']);
     if($next_pin) {
     	$view->next_navigation_pin = WM_Router::create( $request->getBaseUrl() . '?controller=pin&event_id=' . $next_pin['event_id'] );
     }
     $prev_pin = Model_Pins::getPrevPin($event['event_id']);
     if($prev_pin) {
     	$view->prev_navigation_pin = WM_Router::create( $request->getBaseUrl() . '?controller=pin&event_id=' . $prev_pin['event_id'] );
     }
     */
     $image = call_user_func(array(self::formatUploadModule($event['store']), 'getEventImage'), $event, '_B');
     if ($image) {
         $event['thumb'] = $image['image'];
         $event['thumb_width'] = $image['width'];
         $event['thumb_height'] = $image['height'];
         $event['original_image'] = $image['original'];
     } else {
         JO_Action::getInstance()->forward('error', 'error404');
     }
     $image = call_user_func(array(self::formatUploadModule($event['store']), 'getEventImage'), $event, '_D');
     if ($image) {
         $event['popup'] = $image['image'];
         $event['popup_width'] = $image['width'];
         $event['popup_height'] = $image['height'];
         $event['original_image'] = $image['original'];
     } else {
         //JO_Action::getInstance()->forward('error', 'error404');
         $image = call_user_func(array(self::formatUploadModule($event['store']), 'getEventImage'), $event, '_B');
         if ($image) {
             $event['popup'] = $image['image'];
             $event['popup_width'] = $image['width'];
             $event['popup_height'] = $image['height'];
             $event['original_image'] = $image['original'];
         }
     }
     $event_description = self::descriptionFix($event['description']);
     $event['real_description'] = self::descriptionFix($event['description']);
     $event['description'] = self::descriptionFix($event['description']);
     $event['href'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']);
     //$event['date_event'] = Model_Events::cambiafyh_espanol($event['date_event']);
     $event["sport_category"] = Model_Boards::getCategoryTitle($event["sport_category"]);
     $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_user_id' => $event["user_id"]);
     $users = Model_Users::getUsers($data);
     if ($users) {
         $event['fullname'] = $users[0]["fullname"];
         $event['descriptionUser'] = $users[0]["description"];
         $avataruser = Helper_Uploadimages::avatar($users[0], '_B');
         $event['avataruser'] = $avataruser['image'];
         $event['userHref'] = 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']);
     }
     $event['pinmarklet_href'] = WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_pinmarklet'));
     //$event['onto_href'] = WM_Router::create( $request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $event['user_id'] . '&board_id=' . $event['board_id'] );
     //$event['price_formated'] = WM_Currency::format($event['price']);
     // esto es del autor del evento
     /*
     		
     		$view->author = $event['user_id'];
     		
     		$avatar = Helper_Uploadimages::avatar($event['user_id'], '_A');
     		$view->author['avatar'] = $avatar['image'];
     		
     		$view->author['profile'] = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id'] );
     		
     * 
     * 
     */
     //comentarios
     $view->comments = array();
     if ($event['latest_comments']) {
         foreach ($event['latest_comments'] as $key => $comment) {
             if (!isset($comment['user']['store'])) {
                 unset($event['latest_comments'][$key]);
                 continue;
             }
             $avatar = Helper_Uploadimages::avatar($comment['user'], '_A');
             $comment['user']['avatar'] = $avatar['image'];
             $comment['user']['profile'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $comment['user_id']);
             $comment['delete'] = '';
             if (!Model_Events::commentIsReported($comment['comment_id'])) {
                 $comment['report'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=reportComment&comment_id=' . $comment['comment_id']);
             } else {
                 $comment['report'] = '';
             }
             if (JO_Session::get('user[user_id]')) {
                 if (JO_Session::get('user[is_admin]') || JO_Session::get('user[user_id]') == $comment['user_id']) {
                     $comment['delete'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=deleteComment&comment_id=' . $comment['comment_id']);
                 }
             }
             $view->comments[] = $comment;
         }
     }
     $view->get_user_friends = WM_Router::create($request->getBaseUrl() . '?controller=users&action=friends');
     $view->totalFollow = WM_Router::create($request->getBaseUrl() . '?controller=events&action=totalFollow');
     // no se pa que vale
     /*
     		$view->via = array();
     		$view->via_repin = array();
     		if($event['via'] && $event['user_via']) {
     			$view->via = array(
     				'profile' => WM_Router::create( $request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['via'] ),
     				'fullname' => $event['user_via']['fullname']
     			);
     		}
     		
     		$view->replin_info = false;
     		if($request->isXmlHttpRequest()) {
     			$view->target_repin = false;
     			if($event['repin_from']) {
     				$event_repin = Model_Pins::getPin($event['repin_from']);
     				if($event_repin) {
     					$view->source = array();
     					$view->source['source'] = $event_repin['board'];
     					$event['from'] = WM_Router::create( $request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $event_repin['user_id'] . '&board_id=' . $event_repin['board_id'] );
     					$view->target_repin = true;
     				} else {
     					$view->source = Model_Source::getSource($event['source_id']);
     				}
     			} else {
     				$view->source = Model_Source::getSource($event['source_id']);
     			}
     		} else {
     			$view->source = Model_Source::getSource($event['source_id']);
     			
     			
     			if($event['repin_from']) {
     				$repina = Model_Pins::getPin($event['repin_from']);
     				if($repina) {
     					$view->replin_info = array(
     						'pin_href' => WM_Router::create( $request->getBaseUrl() . '?controller=pin&event_id=' . $event['repin_from'] ),
     						'profile' => WM_Router::create( $request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $repina['user_id'] ),
     						'fullname' => $repina['user']['fullname']
     					);
     				}
     			}
     			
     		}
     		if($event['from'] && !preg_match('/^https?:\/\//',$event['from'])) {
     			$event['from'] = 'http://' . $event['from'];
     		}
     		if($event['from_repin'] && !preg_match('/^https?:\/\//',$event['from_repin'])) {
     			$event['from_repin'] = 'http://' . $event['from_repin'];
     		}
     		
     		$event['onto_board'] = $event['onto_board2'] = array();
     		$event['originally_pinned'] = $event['originally_pinned2'] = array();
     */
     /*
     if($request->isXmlHttpRequest()) {
     	$event['onto_board'] = self::getBoardPins($event['board_id']);
     	$event['originally_pinned'] = self::getOriginallyPinned( $event['via']?$event['via']:$event['user_id'] ); 
     } else {
     	$event['onto_board2'] = self::getBoardPins($event['board_id']);
     	$event['originally_pinned2'] = self::getOriginallyPinned( $event['via']?$event['via']:$event['user_id'] );
     }
     
     if($view->source && $request->isXmlHttpRequest()) {
     	$event['source_pins'] = self::getSourcePins($event['source_id']);
     } else {
     	$event['source_pins'] = array();
     }
     
     $event['boardIsFollow'] = Model_Users::isFollow(array(
     	'board_id' => $event['board_id']
     ));
     
     $event['userIsFollow'] = Model_Users::isFollowUser($event['user_id']);
     if($event['via']) {
     	$event['userViaIsFollow'] = Model_Users::isFollowUser($event['via']);
     } else {
     	$event['userViaIsFollow'] = Model_Users::isFollowUser($event['user_id']);
     }
     
     $event['userFollowIgnore'] = $event['user_id'] == JO_Session::get('user[user_id]');
     $event['userViaFollowIgnore'] = ($event['via']?$event['via']:$event['user_id']) == JO_Session::get('user[user_id]');
     
     $view->follow = WM_Router::create( $request->getBaseUrl() . '?controller=boards&action=follow&user_id=' . $event['user_id'] . '&board_id=' . $event['board_id'] );
     $view->follow_user = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $event['user_id'] );
     if($event['via']) {
     	$view->follow_user_via = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $event['via'] );
     } else {
     	$view->follow_user_via = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $event['user_id'] );
     }
     
     $view->get_user_friends = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=friends' );
     
     if(JO_Session::get('user[user_id]')) {
     	$view->enable_follow = $event['user_id'] != JO_Session::get('user[user_id]');
     } else {
     	$view->enable_follow = false;
     }
     */
     if (JO_Session::get('user[user_id]')) {
         $event['url_like'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=like&event_id=' . $event['event_id']);
         $event['url_repin'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=repin&event_id=' . $event['event_id']);
         $event['url_comment'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=comment&event_id=' . $event['event_id']);
         $event['comment'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=comment&event_id=' . $event['event_id']);
         $event['edit'] = JO_Session::get('user[user_id]') == $event['user_id'] ? WM_Router::create($request->getBaseUrl() . '?controller=events&action=events&event_id=' . $event['event_id']) : false;
     } else {
         $event['url_like'] = $event['url_repin'] = $event['url_comment'] = $event['comment'] = WM_Router::create($request->getBaseUrl() . '?controller=landing');
         $event['edit'] = false;
     }
     /*
     $likes = self::getPinLikes($event['event_id']);
     $event['likes'] = $likes['data'];
     $event['likes_total'] = $likes['total'];
     
     $event['repins'] = self::getRePins($event['event_id']);
     
     $event['pinIsReported'] = Model_Pins::pinIsReported($event['event_id']);
     
     $date_dif = array_shift( WM_Date::dateDiff($event['date_added'], time()) );
     $event['date_dif'] = $date_dif;
     */
     $view->loged = JO_Session::get('user[user_id]');
     $view->owner = JO_Session::get('user[user_id]') == $event["user_id"];
     $view->site_name = JO_Registry::get('site_name');
     if ($view->loged) {
         $avatar = Helper_Uploadimages::avatar(JO_Session::get('user'), '_A');
         $view->self_avatar = $avatar['image'];
         $view->self_profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $view->loged);
         $view->self_fullname = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]');
     }
     /*
     if($event['is_video']) {
     	$auto = new Helper_AutoEmbed();
     	if( $event['repin_from'] && $auto->parseUrl($event['from_repin']) ) {
     		$auto->setWidth('100%');
     		$auto->setHeight('350');
     		$event['video_code'] = $auto->getEmbedCode();
     		$attr = $auto->getObjectAttribs();
     		$event['thumb_width'] = $attr['width'];
     		$event['thumb_height'] = $attr['height'];
     	} else {
     		if( $auto->parseUrl($event['from']) ) {
     			$auto->setWidth('100%');
     			$auto->setHeight('350');
     			$event['video_code'] = $auto->getEmbedCode();
     			$attr = $auto->getObjectAttribs();
     			$event['thumb_width'] = $attr['width'];
     			$event['thumb_height'] = $attr['height'];
     		} else {
     			$event['is_video'] = false;
     		}
     	}
     } else 
                       {
     
     	$auto = new Helper_AutoEmbed();
     	if( $event['repin_from'] && $auto->parseUrl($event['from_repin']) ) {
     		$auto->setWidth('100%');
     		$auto->setHeight('350');
     		$event['video_code'] = $auto->getEmbedCode();
     		$attr = $auto->getObjectAttribs();
     		$event['thumb_width'] = $attr['width'];
     		$event['thumb_height'] = $attr['height'];
     		$event['is_video'] = true;
     	} else if( $auto->parseUrl($event['from']) ) {
     		$auto->setWidth('100%');
     		$auto->setHeight('350');
     		$event['video_code'] = $auto->getEmbedCode();
     		$attr = $auto->getObjectAttribs();
     		$event['thumb_width'] = $attr['width'];
     		$event['thumb_height'] = $attr['height'];
     		$event['is_video'] = true;
     	} else {
     		$event['is_video'] = false;
     	}
     }
     */
     $view->event_url = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']);
     //WM_Router::create( $request->getBaseUrl() . '?controller=events&event_id=' . $event['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['event_id'] . '&userio_id=' . $event['user_id']);
     $view->eventIsLike = Model_Events::isLikeEvent($event['event_id'], JO_Session::get('user[user_id]'));
     $view->editEvent_url = WM_Router::create($request->getBaseUrl() . '?controller=events&action=add?event_id=' . $event['event_id']);
     $view->follow_event = WM_Router::create($request->getBaseUrl() . '?controller=events&action=follow&event_id=' . $event['event_id'] . '&userio_id=' . $event['user_id']);
     $view->eventIsFollow = Model_Events::isFollowEvent($event['event_id'], JO_Session::get('user[user_id]'));
     //Model_Pins::updateViewed($event['event_id']);
     JO_Layout::getInstance()->meta_title = $event['eventname'] . ' - ' . strip_tags(html_entity_decode($event_description));
     JO_Layout::getInstance()->placeholder('pin_url', $view->event_url);
     JO_Layout::getInstance()->placeholder('pin_description', $event_description);
     $params = array();
     $params['content'] = html_entity_decode($event_description . ' ' . $event['eventname'], ENT_QUOTES, 'UTF-8');
     //page content
     $keywords = new WM_Keywords($params);
     $get_keywords = $keywords->get_keywords();
     if ($get_keywords) {
         JO_Layout::getInstance()->placeholder('keywords', $get_keywords);
     }
     JO_Layout::getInstance()->placeholder('pin_image', $event['thumb']);
     JO_Layout::getInstance()->placeholder('board_title', $event['eventname']);
     /*
     $view->banners = array();
     if($banners) {
     	foreach($banners AS $banner1) {
     		foreach($banner1 AS $e) {
     			$e['html'] = html_entity_decode($e['html']);
     			$view->banners[] = $e;
     		}
     	}
     }
     */
     $view->event = $event;
     return $view->render('eventBoxDetail', 'events');
 }
Ejemplo n.º 13
0
 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('&amp;', '&', $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);
 }
Ejemplo n.º 14
0
 public function indexAction()
 {
     $this->noLayout(true);
     $invate_code = $this->getRequest()->getParam('invate_code');
     $og_data = false;
     if ($invate_code && strlen($invate_code) == 32) {
         if (!$this->getRequest()->isFacebookBot()) {
             $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=modules_facebook_invated&code=' . $invate_code));
         } else {
             $og_data = $this->getRequest()->getParam('og_data');
         }
     }
     //if($this->getRequest()->isFacebookBot()) {
     $meta_data = Helper_Config::get('extra_metatags');
     if ($meta_data) {
         $settings = Model_Extensions::getSettingsPairs('facebook');
         $this->view->site_name = Helper_Config::get('site_name');
         //$this->view->is_facebook = $this->getRequest()->isFacebookBot();
         $this->view->is_facebook = true;
         $this->view->oauth_fb_key = trim(Helper_Config::get('facebook_oauth_key'));
         $this->view->oauth_fb_secret = trim(Helper_Config::get('facebook_oauth_secret'));
         $this->view->og_namespace = trim(Helper_Config::get('facebook_og_namespace'));
         $this->view->og_recipe = trim(Helper_Config::get('facebook_og_recipe'));
         if (!$this->view->og_recipe) {
             $this->view->og_namespace = '';
         }
         if (isset($settings['facebook_module_status_enable']) && $settings['facebook_module_status_enable']) {
             if (isset($settings['facebook_og_meta_tags']) && $settings['facebook_og_meta_tags']) {
                 if (isset($meta_data['user']) && is_array($meta_data['user'])) {
                     $this->setViewChange('user');
                     $this->view->user = $meta_data['user'];
                     if ($this->view->og_namespace) {
                         JO_Layout::getInstance()->head_attributes = ' prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# ' . $this->view->og_namespace . ': http://ogp.me/ns/fb/' . $this->view->og_namespace . '#"';
                     }
                 } else {
                     if (isset($meta_data['pin']) && is_array($meta_data['pin'])) {
                         $this->setViewChange('pin');
                         $this->view->pin = $meta_data['pin'];
                         if ($this->view->og_namespace) {
                             JO_Layout::getInstance()->head_attributes = ' prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# ' . $this->view->og_namespace . ': http://ogp.me/ns/fb/' . $this->view->og_namespace . '#"';
                         }
                     } else {
                         if (isset($meta_data['board']) && is_array($meta_data['board'])) {
                             $this->setViewChange('board');
                             $this->view->board = $meta_data['board'];
                             if ($this->view->og_namespace) {
                                 JO_Layout::getInstance()->head_attributes = ' prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# ' . $this->view->og_namespace . ': http://ogp.me/ns/fb/' . $this->view->og_namespace . '#"';
                             }
                         } else {
                             $this->noViewRenderer(true);
                         }
                     }
                 }
             }
         }
     } elseif ($og_data) {
         $settings = Model_Extensions::getSettingsPairs('facebook');
         $this->view->site_name = Helper_Config::get('site_name');
         //$this->view->is_facebook = $this->getRequest()->isFacebookBot();
         $this->view->is_facebook = true;
         $this->view->oauth_fb_key = trim(Helper_Config::get('facebook_oauth_key'));
         $this->view->oauth_fb_secret = trim(Helper_Config::get('facebook_oauth_secret'));
         $this->view->og_namespace = trim(Helper_Config::get('facebook_og_namespace'));
         $this->view->og_recipe = trim(Helper_Config::get('facebook_og_recipe'));
         if (!$this->view->og_recipe) {
             $this->view->og_namespace = '';
         }
         if (isset($settings['facebook_module_status_enable']) && $settings['facebook_module_status_enable']) {
             if (isset($settings['facebook_og_meta_tags']) && $settings['facebook_og_meta_tags']) {
                 $this->setViewChange('og_data');
                 $og_data['url'] = $this->getRequest()->getFullUrl();
                 $this->view->og_data = $og_data;
                 if ($this->view->og_namespace) {
                     JO_Layout::getInstance()->head_attributes = ' prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# ' . $this->view->og_namespace . ': http://ogp.me/ns/fb/' . $this->view->og_namespace . '#"';
                 }
             }
         }
     } else {
         $this->noViewRenderer(true);
     }
     //} else {
     //	$this->noViewRenderer(true);
     //}
 }
Ejemplo n.º 15
0
 /**
  * Set Layout configuration settings
  *
  * @param  array $options
  * @return JO_Layout
  */
 public function setLayout($options)
 {
     $this->_layout = JO_Layout::getInstance($options);
     return $this->_layout;
 }
Ejemplo n.º 16
0
 /**
  * @return JO_Layout
  */
 public function getLayout()
 {
     if ($this->layout == null) {
         $this->setLayout(JO_Layout::getInstance());
     }
     return $this->layout;
 }
Ejemplo n.º 17
0
 public function header_partAction()
 {
     $request = $this->getRequest();
     if (JO_Session::get('user[user_id]') && JO_Session::get('category_id')) {
         new Model_Users_Edit(JO_Session::get('user[user_id]'), array('first_login' => '0'));
         JO_Session::clear('category_id');
         $template = Model_Notification::getTemplate('welcome');
         if ($template) {
             $template_data = array('user_id' => JO_Session::get('user[user_id]'), 'user_firstname' => JO_Session::get('user[firstname]'), 'user_lastname' => JO_Session::get('user[lastname]'), 'user_fullname' => JO_Session::get('user[fullname]'), 'user_username' => JO_Session::get('user[username]'), 'site_url' => $request->getBaseUrl(), 'site_name' => Helper_Config::get('site_name'), 'mail_footer' => html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8'));
             if (!$template['title']) {
                 $template['title'] = $this->translate('Welcome to ${site_name}!');
             }
             $title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data);
             $body = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data);
             Model_Email::send(JO_Session::get('user[email]'), Helper_Config::get('noreply_mail'), $title, $body);
         }
     }
     $this->view->show_landing = !Helper_Config::get('enable_free_registration');
     $this->getLayout()->placeholder('site_name', Helper_Config::get('site_name'));
     $this->view->site_name = Helper_Config::get('site_name');
     $this->view->meta_title = Helper_Config::get('meta_title');
     $this->getLayout()->placeholder('google_analytics', html_entity_decode(Helper_Config::get('google_analytics'), ENT_QUOTES, 'utf-8'));
     $this->view->baseUrl = $request->getBaseUrl();
     $this->view->site_logo = $request->getBaseUrl() . 'data/images/logo.png';
     if (Helper_Config::get('site_logo') && file_exists(BASE_PATH . '/uploads' . Helper_Config::get('site_logo'))) {
         $this->view->site_logo = $request->getBaseUrl() . 'uploads' . Helper_Config::get('site_logo');
     }
     ///global metas
     if (!JO_Layout::getInstance()->placeholder('header_metas')) {
         $to_title = '';
         if (JO_Session::get('user[user_id]')) {
             $to_title = JO_Session::get('user[fullname]') . ' / ';
         }
         $this->getLayout()->placeholder('title', $to_title . Helper_Config::get('meta_title'));
         JO_Layout::getInstance()->placeholder('header_metas', $this->view->callChildren('layout/header_metas', array('meta_title' => Helper_Config::get('meta_title'), 'meta_description' => Helper_Config::get('meta_description'), 'meta_keywords' => Helper_Config::get('meta_keywords'), 'site_logo' => $this->view->site_logo)));
     }
     if (Helper_Config::get('favicon') && file_exists(BASE_PATH . '/uploads' . Helper_Config::get('favicon'))) {
         $this->getLayout()->placeholder('favicon', $request->getBaseUrl() . 'uploads' . Helper_Config::get('favicon'));
     }
     $this->getLayout()->placeholder('site_logo', $this->view->site_logo);
     $this->view->show_header_invate = !JO_Session::get('user[user_id]');
     $this->view->controller_open = $request->getController();
     //==== brand =====//
     $this->view->show_brand = false;
     /*if( JO_Registry::get('license_powered_check') == 'false' && Helper_Config::get('config_hide_brand') ) {
     			$this->view->show_brand = false;
     		}*/
     ////////// CURRENCY
     //autoupdate currency if set
     if (Helper_Config::get('config_currency_auto_update')) {
         WM_Currency::updateCurrencies();
     }
     //////////// Categories ////////////
     $this->view->categories = array();
     $this->view->category_active = false;
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['href'] = WM_Router::create($request->getBaseUrl() . '?controller=category&category_id=' . $category['category_id']);
         $category['active'] = $category['category_id'] == $request->getRequest('category_id');
         if ($category['active']) {
             $this->view->category_active = $category['title'];
         } else {
         }
         $this->view->categories[] = $category;
     }
     ////////////////////////////// USER MENU ///////////////////////////
     $this->view->is_loged = JO_Session::get('user[user_id]');
     if ($this->view->is_loged) {
         $model_images = new Helper_Images();
         $avatar = Helper_Uploadimages::avatar(JO_Session::get('user'), '_A');
         $this->view->self_avatar = Helper_Uploadimages::userAvatars(JO_Session::get('user'));
         $this->view->self_profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $this->view->is_loged);
         $this->view->self_firstname = JO_Session::get('user[firstname]');
         $this->view->logout = WM_Router::create($request->getBaseUrl() . '?controller=users&action=logout');
         $this->view->user_pins = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $this->view->is_loged);
         $this->view->user_pins_likes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $this->view->is_loged . '&filter=likes');
         $this->view->settings = WM_Router::create($request->getBaseUrl() . '?controller=settings');
     }
     $this->view->login = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
     $this->view->landing = WM_Router::create($request->getBaseUrl() . '?controller=landing');
     $this->view->registration = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register');
     ////////////////////////////// GIFTS ///////////////////////////
     $this->view->gifts = WM_Router::create($request->getBaseUrl() . '?controller=gifts');
     $this->view->giftSums = array();
     $sums = Model_Gifts::getAll();
     foreach ($sums as $sum) {
         if ($sum['price_from'] || $sum['price_to']) {
             $title = WM_Currency::format($sum['price_from']);
             $url = '';
             if ($sum['price_to']) {
                 $title .= ' - ';
                 $title .= WM_Currency::format($sum['price_to']);
                 $url = '&price_to=' . $sum['price_to'];
             } else {
                 $title .= '+';
             }
             $this->view->giftSums[] = array('title' => $title, 'href' => WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=' . $sum['price_from'] . $url));
         }
     }
     //////////// Video ////////////
     $this->view->video_url = WM_Router::create($request->getBaseUrl() . '?controller=videos');
     //////////// Popular ////////////
     $this->view->popular_url = WM_Router::create($request->getBaseUrl() . '?controller=popular');
     //////////// ALL PINS ////////////
     $this->view->all_url = WM_Router::create($request->getBaseUrl() . '?controller=all');
     ////////////////////////////// SEARCH ///////////////////////////
     //$this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search');
     if ($request->getAction() != 'index' && $request->getController() == 'search') {
         $with_action = $request->getAction();
         $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search&action=' . $request->getAction());
     } else {
         $with_action = 0;
         $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search');
     }
     $this->view->search_autocomplete = WM_Router::create($request->getBaseUrl() . '?controller=search&action=autocomplete');
     if (strpos($this->view->search, '?') !== false) {
         $this->view->show_hidden = true;
         $this->view->with_action = $with_action;
     }
     $this->view->keywords = $request->issetQuery('q') ? $request->getQuery('q') : $this->translate('Search');
     ////////////////////////////// ADD PIN ///////////////////////////
     $this->view->addPin = WM_Router::create($request->getBaseUrl() . '?controller=addpin');
     ////////////////////////////// user ignore search engine ///////////////////////////
     if ($request->getRequest('user_id')) {
         $user_info = Model_Users::getUser($request->getRequest('user_id'));
         if ($user_info && $user_info['dont_search_index']) {
             $this->getLayout()->placeholder('inhead', '<meta name="robots" content="noindex"/>');
         }
     }
     ////////////////////////////// ABOUT MENU ///////////////////////////
     $about_menu = Model_Pages::getMenu(0);
     $this->view->about_menu = array();
     foreach ($about_menu as $row => $page) {
         $class = '';
         if ($row == 0) {
             $class .= ' first';
         } else {
             if (count($about_menu) - 1 == $row) {
                 $class .= ' last';
             }
         }
         if ($page['page_id'] == -1) {
             $has = true;
         } else {
             if ($page['status']) {
                 if (isset($has) && $has) {
                     $class .= " group";
                     $has = false;
                 }
                 $this->view->about_menu[] = array('class' => trim($class), 'title' => $page['title'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page['page_id']));
             }
             $has = false;
         }
     }
     ////////////////////////////// NEW PASSWORD ///////////////////////////
     $this->view->show_new_password = false;
     if (JO_Session::get('user[user_id]') && JO_Session::get('user[email]') != JO_Session::get('user[new_email]')) {
         /*switch(true) {
         			case 'index' == $request->getController():
         			case 'all' == $request->getController():
         			case 'category' == $request->getController():
         			case 'videos' == $request->getController():
         			case 'popular' == $request->getController():
         			case 'gifts' == $request->getController():
         				$this->view->show_new_password = true;
         			break;
         		}*/
         $this->view->show_new_password = true;
     }
     ////////////////////////////// Board category ///////////////////////////
     if (($board_info = JO_Registry::forceGet('board_category_change')) instanceof ArrayObject) {
         $this->view->board_category_change = array('title' => $board_info['board_title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board_info['board_user_id'] . '&board_id=' . $board_info['board_board_id']));
     }
     ///////////////////// invate menu user /////////////////////////////
     $methodsforinvates = $this->view->callChildrenView('invates/methodsforinvates');
     $this->view->methodsforinvates = (array) $methodsforinvates->user_invate_friends;
     ///////////////////// extra metatags /////////////////////////////
     $extra_metas = '';
     $extra_metas_get = Model_Extensions::getByMethod('extra_metas');
     foreach ($extra_metas_get as $id => $mod) {
         $extra_metas .= $this->view->callChildren('modules_' . $mod . '_extrametas');
     }
     if ($extra_metas) {
         JO_Layout::getInstance()->placeholder('header_metas', $extra_metas);
     }
 }