public function generatePopularCacheAction() { Model_Pins::CmdPopular(); if (in_array('mobile', WM_Modules::getTemplates())) { JO_Registry::set('config_front_limit', 5); Model_Pins::CmdPopular(); } }
public function _initTranslate() { $request = JO_Request::getInstance(); if ($request->getModule() == 'install') { return ''; } $translate = new WM_Gettranslate(); JO_Registry::set('JO_Translate', WM_Translate::getInstance(array('data' => $translate->getTranslate()))); }
public static function getCachingPage($tables = array()) { $db = JO_Db::getDefaultAdapter(); $options = array('livetime' => 86400); JO_Registry::set('static_cache_options', serialize($options)); JO_Registry::set('static_cache_enable', true); $cache = new JO_Cache_Static($options); $cache_make_time = $cache->getCacheFileMTime(); if (!$cache_make_time) { return false; } $config_data = $db->getConfig(); $query1 = ''; foreach ($tables as $k => $table) { $table = str_replace('`', '', $table); $query1 .= $query1 ? ' OR ' : ''; if (strpos($table, '.') !== false) { $query1 .= "(`TABLE_SCHEMA`='" . array_shift(explode('.', $table)) . "' AND `TABLE_NAME`='" . end(explode('.', $table)) . "')"; } else { if (isset($config_data['dbname'])) { $query1 .= "("; if ($config_data['dbname']) { $query1 .= "`TABLE_SCHEMA`='" . $config_data['dbname'] . "' AND "; } $query1 .= "`TABLE_NAME`='" . $table . "')"; } } } if ($query1) { $query1 = "(" . $query1 . ") AND `UPDATE_TIME`>'" . date("Y-m-d H:i:s", $cache_make_time) . "'"; $r = $db->fetchRow("SELECT UPDATE_TIME FROM " . self::$info_table . " WHERE {$query1} ORDER BY UPDATE_TIME DESC LIMIT 1"); if ($r && strtotime($r['UPDATE_TIME']) >= $cache->getCacheFileMTime()) { return false; } else { if (date('Ymd', $cache->getCacheFileMTime()) < date('Ymd')) { return false; } $response = JO_Response::getInstance(); $md5_file = md5_file($cache->getCacheFile()); $response->addHeader("Etag: " . $md5_file); $response->addHeader("Last-Modified: " . gmdate("D, d M Y H:i:s", $cache_make_time) . " GMT"); $response->addHeader("Pragma: public"); $response->addHeader("Cache-store: server"); $response->appendBody($cache->get(), 9); exit; } } }
// Set Config $configs_files = glob(APPLICATION_PATH . '/config/config_*.ini'); if ($configs_files) { foreach ($configs_files as $file) { $config = new JO_Config_Ini($file); $application->setOptions($config->toArray()); JO_Registry::set(basename($file, '.ini'), $config->toArray()); } } // Set Routers links $routers_files = glob(APPLICATION_PATH . '/config/routers/*.ini'); if ($routers_files) { foreach ($routers_files as $file) { $config = new JO_Config_Ini($file, null, false, true); $application->setOptions($config->toArray()); JO_Registry::set('routers_' . basename($file, '.ini'), $config->toArray()); } } //dispatch application $application->dispatch(); // error handler function function myErrorHandler($errno, $errstr, $errfile, $errline) { if (!(error_reporting() & $errno)) { // This error code is not included in error_reporting return; } switch ($errno) { case E_USER_ERROR: echo "<b>My ERROR</b> [{$errno}] {$errstr}<br />\n"; echo " Fatal error on line {$errline} in file {$errfile}";
public function feedAction() { $request = $this->getRequest(); $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_user_id' => $request->getRequest('user_id')); $user_data = new Model_Users_User($request->getRequest('user_id')); if ($user_data->count()) { JO_Registry::set('meta_title', $user_data['fullname'] . ' - ' . Helper_Config::get('meta_title')); if ($user_data['pins']) { $pins = new Model_Pins_Users($data); $this->view->item = array(); if ($pins->count()) { $formatObject = new Helper_Format(); foreach ($pins->data as $pin) { $pin = $formatObject->fromatList($pin); $category_info = Model_Categories::getCategory($pin['category_id']); if ($category_info) { $pin['text_board'] = $category_info['title'] . ' >> ' . $pin['text_board']; } $this->view->item[] = array('guid' => $pin['pin_id'], 'enclosure' => $pin['images']['thumb_image_b'], 'description' => $pin['description'], 'title' => JO_Utf8::splitText($pin['description'], 60, '...'), 'link' => $pin['pin_url'], 'author' => $pin['author_profile']['fullname'], 'pubDate' => WM_Date::format($pin['date_added'], JO_Date::RSS_FULL), 'category' => $pin['text_board']); } } } } echo $this->renderScript('rss'); }
public function _initAmazon() { if (!JO_Registry::get('system_enable_amazon')) { JO_Registry::set('enable_amazon', false); } }
public function __construct() { $request = JO_Request::getInstance(); parent::__construct(); //set default timezone if is not set if (!ini_get('date.timezone')) { ini_set('date.timezone', 'UTC'); } WM_Users::initSession(JO_Session::get('user[user_id]')); if (!JO_Session::get('user[user_id]')) { JO_Session::set('user', array('user_id' => 0)); } //mobile version if ($request->issetParam('full_version')) { $re = $request->setCookie('full_version', 1, 86400, '/', '.' . $request->getDomain()); $this->redirect($request->getBaseUrl()); } else { if ($request->issetParam('remove_full_version')) { $re = $request->setCookie('full_version', 0, 86400, '/', '.' . $request->getDomain()); $this->redirect($request->getBaseUrl()); } } $mobile_detect = new JO_Mobile_Detect(); JO_Registry::set('isMobile', false); if ($mobile_detect->isMobile() && !$mobile_detect->isTablet() && in_array('mobile', WM_Modules::getTemplates())) { if (!$request->getCookie('full_version')) { JO_Registry::set('template', 'mobile'); Helper_Config::set('config_disable_js', 0); if (Helper_Config::get('site_logo_mobile')) { Helper_Config::set('site_logo', Helper_Config::get('site_logo_mobile')); } } JO_Registry::set('isMobile', true); } //is not ajax if (!$request->isXmlHttpRequest()) { WM_Licensecheck::checkIt(); if (Helper_Config::get('config_maintenance')) { if ($request->getController() != 'error' && $request->getAction() != 'maintenance') { $this->forward('error', 'maintenance'); } } ////first login if (JO_Session::get('user[user_id]')) { if (JO_Session::get('user[first_login]')) { if (!in_array($request->getController(), array('pages', 'smuk', 'crons', 'pin', 'boards', 'js', 'json', 'cache', 'data'))) { if ($request->getParam('direct_path') != 'true') { if ($request->getController() != 'welcome') { if ($request->getController() == 'users' && $request->getAction() == 'logout') { } else { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=welcome')); } } } } } else { if ($request->getController() == 'welcome') { JO_Action::getInstance()->redirect($request->getBaseUrl()); } } } elseif ($request->getController() == 'welcome') { JO_Action::getInstance()->redirect($request->getBaseUrl()); } } Helper_Config::check(); WM_Licensecheck::checkIt(); }
public function _initLicense() { $request = JO_Request::getInstance(); if ($request->getModule() == 'install') { return ''; } $license = new WM_License(); if (!$license->isValid()) { JO_Registry::set('LicenseError', $license->getErrors()); JO_Action::getInstance()->forward('error', 'noLicense'); } }
public static function cb2cb857e022883e361cf5f2f3ece525() { $license_file = BASE_PATH . '/cache/temporary.bin'; if (!file_exists($license_file)) { JO_Request::getInstance()->setModule('default'); JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'not_found', 'text' => 'Licence file is not found!'))); } else { $request = JO_Request::getInstance(); $decripted = JO_Encrypt_Md5::decrypt(file_get_contents($license_file), $request->getDomain() . 'pinterestclonescript.info', false, 256); if ($decripted) { $data = explode(';', $decripted); $parts = array(); foreach ($data as $row => $res) { $res = explode(':', $res); if (count($res) == 2) { $parts[$res[0]] = $res[1]; JO_Registry::set('license_' . $res[0], $res[1]); } } if (!isset($parts['powered_check'])) { JO_Request::getInstance()->setModule('default'); JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'missing_powered', 'text' => 'Missing powered information in licence file!'))); } else { if ($parts['powered_check'] != 'false') { JO_Request::getInstance()->setModule('default'); JO_Registry::set('viewSetCallbackChildren', array(new self(), 'PoweredCheck')); } } if (!isset($parts['domain'])) { JO_Request::getInstance()->setModule('default'); JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'missing_domain', 'text' => 'Missing domain information in licence file!'))); } else { if (mb_strtolower($parts['domain'], 'utf-8') != mb_strtolower($request->getDomain(), 'utf-8')) { JO_Request::getInstance()->setModule('default'); JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'not_match_domain', 'text' => 'Domain information in licence file is not match with ' . $request->getDomain() . '!'))); } } if (isset($parts['amazon_s3']) && $parts['amazon_s3'] == 'true') { JO_Registry::set('system_enable_amazon', true); } } else { JO_Request::getInstance()->setModule('default'); JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'parse_error', 'text' => 'Unable to parse licence file!'))); } } }
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); }
protected function _executeResource($resource) { $resourceName = strtolower($resource); if (in_array($resourceName, $this->_run)) { return; } if (isset($this->_started[$resourceName]) && $this->_started[$resourceName]) { throw new JO_Exception('Circular resource dependency detected'); } $classResources = $this->getClassResources(); if (array_key_exists($resourceName, $classResources)) { $this->_started[$resourceName] = true; $method = $classResources[$resourceName]; $return = $this->{$method}(); unset($this->_started[$resourceName]); $this->_markRun($resourceName); if (null !== $return) { JO_Registry::set($resourceName, $return); } return; } throw new JO_Exception('Resource matching "' . $resource . '" not found'); }
public function left_partAction() { $request = $this->getRequest(); $this->view->pin = JO_Registry::get('pin_info'); // $this->view->onto_board = Helper_Pin::getBoardPins( JO_Registry::getArray('pin_info[board_id]'), 9, 60 ); $boards = Model_Boards::getBoards(array('start' => 0, 'limit' => 1, 'filter_id_in' => JO_Registry::getArray('pin_info[board_id]'))); $this->view->has_edit_boards = true; $this->view->enable_sort = true; $this->view->onto_board = ''; if ($boards) { $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $view->enable_sort = false; $model_images = new Helper_Images(); foreach ($boards as $board) { $board['href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); $board['thumbs'] = array(); $get_big = false; for ($i = 0; $i < 5; $i++) { $image = isset($board['pins_array'][$i]) ? $board['pins_array'][$i]['image'] : false; if ($image) { if ($get_big) { $size = '_A'; } else { $size = '_C'; $get_big = true; } $data_img = Helper_Uploadimages::pin($board['pins_array'][$i], $size); if ($data_img) { $board['thumbs'][] = $data_img['image']; } else { $board['thumbs'][] = false; } } else { $board['thumbs'][] = false; } } $board['boardIsFollow'] = Model_Users::isFollow(array('board_id' => $board['board_id'])); $board['userFollowIgnore'] = $board['user_id'] != JO_Session::get('user[user_id]'); $board['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=follow&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); $board['edit'] = false; if ($board['user_id'] == JO_Session::get('user[user_id]')) { $board['edit'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); } $view->board = $board; $this->view->onto_board .= $view->render('box', 'boards'); } } $this->view->source = Model_Source::getSource(JO_Registry::getArray('pin_info[source_id]')); if ($this->view->source) { $this->view->source_pins = Helper_Pin::getSourcePins(JO_Registry::getArray('pin_info[source_id]'), 6, 75); $this->view->pin['from'] = WM_Router::create($request->getBaseUrl() . '?controller=source&source_id=' . $this->view->pin['source_id']); } else { if (JO_Registry::getArray('pin_info[repin_from]')) { $pin_repin = Model_Pins::getPin(JO_Registry::getArray('pin_info[repin_from]')); if ($pin_repin) { $this->view->source['source'] = $pin_repin['board']; $this->view->pin['from'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $pin_repin['user_id'] . '&board_id=' . $pin_repin['board_id']); $this->view->source_pins = Helper_Pin::getBoardPins($pin_repin['board_id'], 9, 75); } } } $this->view->boardIsFollow = Model_Users::isFollow(array('board_id' => JO_Registry::getArray('pin_info[board_id]'))); $this->view->follow = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=follow&user_id=' . $this->view->pin['user_id'] . '&board_id=' . $this->view->pin['board_id']); $this->view->loged = JO_Session::get('user[user_id]'); $this->view->pin['userFollowIgnore'] = ($this->view->pin['via'] ? $this->view->pin['via'] : $this->view->pin['user_id']) == JO_Session::get('user[user_id]'); // var_dump($this->view->onto_board); JO_Registry::set('pin_info', array()); }
public static function checkCache() { $request = JO_Request::getInstance(); if (in_array($request->getDomain(), self::$allowedLocals)) { return true; } self::domainCheck(); $license_file = BASE_PATH . '/cache/temporary.bin'; if (!file_exists($license_file)) { if ($request->getController() != 'error' && $request->getAction() != 'licence') { $request->setModule('default'); JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'not_found', 'text' => 'Licence file is not found!'))); } } else { $decripted = JO_Encrypt_Md5::decrypt(file_get_contents($license_file), self::$domain_check . 'pinterestclonescript.info', false, 256); if ($decripted) { $data = explode(';', $decripted); $parts = array(); foreach ($data as $row => $res) { $res = explode(':', $res); if (count($res) == 2) { $parts[$res[0]] = $res[1]; JO_Registry::set('license_' . $res[0], $res[1]); } } if (!isset($parts['powered_check'])) { if ($request->getController() != 'error' && $request->getAction() != 'licence') { $request->setModule('default'); JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'missing_powered', 'text' => 'Missing powered information in licence file!'))); } } else { if ($parts['powered_check'] != 'false') { JO_Request::getInstance()->setModule('default'); JO_Registry::set('viewSetCallbackChildren', array(new self(), 'PoweredCheck')); } } if (!isset($parts['domain'])) { if ($request->getController() != 'error' && $request->getAction() != 'licence') { $request->setModule('default'); JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'missing_domain', 'text' => 'Missing domain information in licence file!'))); } } else { if (mb_strtolower($parts['domain'], 'utf-8') != mb_strtolower(self::$domain_check, 'utf-8')) { $parts_lic = explode('.', $parts['domain']); $parts_host = explode('.', self::$domain_check); $expression = ''; for ($i = count($parts_lic); $i > 0; $i--) { if (isset($parts_host[$i])) { $expression = $parts_host[$i] . ($expression ? '.' : '') . $expression; } else { $expression .= md5(mt_rand(00, 9999)); } } if (mb_strtolower($expression, 'utf-8') != mb_strtolower(self::$domain_check, 'utf-8')) { if ($request->getController() != 'error' && $request->getAction() != 'licence') { $request->setModule('default'); JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'not_match_domain', 'text' => 'Domain information in licence file is not match with ' . $request->getDomain() . '!'))); } } } } } else { if ($request->getController() != 'error' && $request->getAction() != 'licence') { $request->setModule('default'); JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'parse_error', 'text' => 'Unable to parse licence file!'))); } } } }
/** * Run the application * * @return void */ public function dispatch() { $router = $this->getRouter(); $request = JO_Request::getInstance(); $matched = $router->match($request->getRequest('uri'), false); JO_Registry::set('router', $router); if ($matched) { foreach ($matched as $key => $value) { $request->setParams($key, $value); } } else { $router->addRoute('default', new JO_Router_Regex('([^\\/]+)?/?([^\\/]+)?/?', array('controller' => 'index', 'action' => 'index'), array(1 => 'controller', 2 => 'action'))); $matched = $router->match($request->getRequest('uri'), true); if ($matched) { foreach ($matched as $key => $value) { $request->setParams($key, $value); } } } $this->getBootstrap()->run(); $front = JO_Front::getInstance(); try { $front->dispatch(); } catch (JO_Exception $e) { throw new JO_Exception($e); } }
public function feedAction() { $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_user_id' => $request->getRequest('user_id')); if ($request->getQuery('filter') == 'likes') { unset($data['filter_user_id']); $data['filter_likes'] = $request->getRequest('user_id'); $this->view->active = 'likes'; } $user_data = Model_Users::getUser($request->getRequest('user_id')); if ($user_data) { JO_Registry::set('meta_title', $user_data['fullname'] . ' - ' . JO_Registry::get('meta_title')); $pins = Model_Pins::getPins($data); $this->view->item = array(); if ($pins) { $model_images = new Helper_Images(); foreach ($pins as $pin) { $data_img = Helper_Uploadimages::pin($pin, '_D'); if (!$data_img) { continue; } $enclosure = $data_img['image']; $category_info = Model_Categories::getCategory($pin['category_id']); if ($category_info) { $pin['board'] = $category_info['title'] . ' >> ' . $pin['board']; } $this->view->item[] = array('guid' => $pin['pin_id'], 'enclosure' => $enclosure, 'description' => Helper_Pin::descriptionFix($pin['description']), 'title' => Helper_Pin::descriptionFix(JO_Utf8::splitText($pin['description'], 60, '...')), 'link' => WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id']), 'author' => $pin['user']['fullname'], 'pubDate' => WM_Date::format($pin['date_added'], JO_Date::RSS_FULL), 'category' => $pin['board']); } } } echo $this->renderScript('rss'); }
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']; }