function process($params, $options) { $seoKey = Util::getArrayKey($params, "category_id"); $collectionDao = new \com\indigloo\sc\dao\Collection(); $zmember = $collectionDao->uizmemberOnSeoKey(Nest::ui_category(), $seoKey); if (is_null($zmember) || !isset($zmember["ui_code"])) { $controller = new \com\indigloo\sc\controller\Http404(); $controller->process(); exit; } $code = $zmember["ui_code"]; $catName = $zmember["name"]; $postDao = new \com\indigloo\sc\dao\Post(); $qparams = Url::getRequestQueryParams(); $gpage = Url::tryQueryParam("gpage"); $gpage = empty($gpage) ? "1" : $gpage; $pageSize = Config::getInstance()->get_value("search.page.items"); $paginator = new Pagination($qparams, $pageSize); $postDBRows = $postDao->getPagedOnCategory($paginator, $code); $pageHeader = $catName; $pageBaseUrl = "/category/{$seoKey}"; $pageTitle = SeoData::getPageTitleWithNumber($gpage, $catName); $metaKeywords = SeoData::getMetaKeywords($catName); $metaDescription = SeoData::getMetaDescriptionWithNumber($gpage, $catName); $file = APP_WEB_DIR . '/view/tiles-page.php'; include $file; }
function process($params, $options) { $token = Url::tryQueryParam("gt"); if (empty($token)) { header("Location: / "); } $gpage = Url::tryQueryParam("gpage"); $gpage = empty($gpage) ? "1" : $gpage; $sphinx = new \com\indigloo\sc\search\SphinxQL(); $qparams = Url::getRequestQueryParams(); $pageSize = Config::getInstance()->get_value("search.page.items"); $paginator = new Pagination($qparams, $pageSize); $ids = $sphinx->getPagedPosts($token, $paginator); $template = NULL; $searchTitle = NULL; if (sizeof($ids) > 0) { $pageHeader = "{$token}"; $pageBaseUrl = "/search/site"; $template = APP_WEB_DIR . '/view/search.php'; $postDao = new \com\indigloo\sc\dao\Post(); $postDBRows = $postDao->getOnSearchIds($ids); } else { $pageHeader = "No results"; $template = APP_WEB_DIR . '/view/notiles.php'; } $groupIds = $sphinx->getGroups($token, 0, 25); $groupDao = new \com\indigloo\sc\dao\Group(); $groupDBRows = $groupDao->getOnSearchIds($groupIds); $sphinx->close(); $pageTitle = SeoData::getPageTitleWithNumber($gpage, $token); $metaKeywords = SeoData::getMetaKeywords($token); $metaDescription = SeoData::getMetaDescriptionWithNumber($gpage, $token); include $template; }
function process($params, $options) { if (is_null($params) || empty($params)) { $controller = new \com\indigloo\sc\controller\Http400(); $controller->process(); exit; } // our router discards the query part from a URL so the // routing works with the query part as well (like /router/url?q1=x&q2=y $token = Util::getArrayKey($params, "location"); if (is_null($token)) { header("Location: / "); } //search sphinx index $sphinx = new \com\indigloo\sc\search\SphinxQL(); $qparams = Url::getRequestQueryParams(); $gpage = Url::tryQueryParam("gpage"); $gpage = empty($gpage) ? "1" : $gpage; $pageSize = Config::getInstance()->get_value("search.page.items"); $paginator = new Pagination($qparams, $pageSize); $ids = $sphinx->getPagedPosts($token, $paginator); $sphinx->close(); $template = NULL; $searchTitle = NULL; if (sizeof($ids) > 0) { $pageHeader = "{$token}"; $pageBaseUrl = "/search/location/{$token}"; $template = APP_WEB_DIR . '/view/tiles-page.php'; $postDao = new \com\indigloo\sc\dao\Post(); $postDBRows = $postDao->getOnSearchIds($ids); } else { $pageHeader = "No Results"; $template = APP_WEB_DIR . '/view/notiles.php'; } $pageTitle = SeoData::getPageTitleWithNumber($gpage, $token); $metaKeywords = SeoData::getMetaKeywords($token); $metaDescription = SeoData::getMetaDescriptionWithNumber($gpage, $token); include $template; }
function process($params, $options) { if (is_null($params) || empty($params)) { $controller = new \com\indigloo\sc\controller\Http400(); $controller->process(); exit; } $token = Util::getArrayKey($params, "name"); // group controller is invoked via the fixed links // (as opposed to users typing in search box) // so we (exact) match this token against post_groups index. $sphinx = new \com\indigloo\sc\search\SphinxQL(); $qparams = Url::getRequestQueryParams(); $gpage = Url::tryQueryParam("gpage"); $gpage = empty($gpage) ? "1" : $gpage; $pageSize = Config::getInstance()->get_value("search.page.items"); $paginator = new Pagination($qparams, $pageSize); $ids = $sphinx->getPagedPostByGroup($token, $paginator); $sphinx->close(); $template = NULL; $searchTitle = NULL; $groupName = \com\indigloo\util\StringUtil::convertKeyToName($token); if (sizeof($ids) > 0) { $pageHeader = "{$groupName}"; $pageBaseUrl = "/group/{$token}"; $template = APP_WEB_DIR . '/view/tiles-page.php'; $postDao = new \com\indigloo\sc\dao\Post(); $postDBRows = $postDao->getOnSearchIds($ids); } else { $pageHeader = "No results"; $template = APP_WEB_DIR . '/view/notiles.php'; } $pageTitle = SeoData::getPageTitleWithNumber($gpage, $groupName); $metaKeywords = SeoData::getMetaKeywords($groupName); $metaDescription = SeoData::getMetaDescriptionWithNumber($gpage, $groupName); include $template; }
function process($params, $options) { if (is_null($params) || empty($params)) { $controller = new \com\indigloo\sc\controller\Http400(); $controller->process(); exit; } $itemId = Util::getArrayKey($params, "item_id"); if ($itemId < 1200) { //@todo remove permanent redirect $redirectUrl = "/item/" . PseudoId::encode($itemId); header("HTTP/1.1 301 Moved Permanently"); header("Location: " . $redirectUrl); exit; } $postDao = new \com\indigloo\sc\dao\Post(); $postId = PseudoId::decode($itemId); $postDBRow = $postDao->getOnId($postId); if (empty($postDBRow)) { //not found $controller = new \com\indigloo\sc\controller\Http404(); $controller->process(); exit; } $options = array(); $options["group"] = true; $postView = \com\indigloo\sc\html\Post::createPostView($postDBRow, $options); // links is separate from postView for historical reasons $linksJson = $postDBRow['links_json']; $dblinks = json_decode($linksJson); $links = array(); foreach ($dblinks as $link) { $link = Url::addHttp($link); array_push($links, $link); } /* data for facebook/google+ dialogs */ $itemObj = new \stdClass(); $itemObj->appId = Config::getInstance()->get_value("facebook.app.id"); $itemObj->host = Url::base(); /* google+ cannot redirect to local box */ $itemObj->netHost = "http://www.3mik.com"; $itemObj->callback = $itemObj->host . "/callback/fb-share.php"; if ($postView->hasImage) { /* use original image for og snippets, smaller images may be ignored */ /* facebook and google+ dialogs need absolute URL */ $itemObj->picture = $postView->srcImage; } else { $itemObj->picture = $itemObj->host . "/css/asset/sc/logo.png"; } //do not urlencode - as we use this value as canonical url $itemObj->link = $itemObj->host . "/item/" . $itemId; $itemObj->netLink = $itemObj->netHost . "/item/" . $itemId; // title in DB is 128 chars long. // here on page we want to use a 70 char title. // also used in item images alt text // item description should be 160 chars. $itemObj->title = Util::abbreviate($postView->title, 70); $itemObj->title = sprintf("item %s - %s", $itemId, $itemObj->title); $itemObj->description = Util::abbreviate($postView->description, 160); $itemObj->description = sprintf("item %s - %s by user %s", $itemId, $itemObj->description, $postView->userName); $strItemObj = json_encode($itemObj); //make the item json string form safe $strItemObj = Util::formSafeJson($strItemObj); /* likes data */ $bookmarkDao = new \com\indigloo\sc\dao\Bookmark(); $likeDBRows = $bookmarkDao->getLikeOnItemId($itemId); $gWeb = \com\indigloo\core\Web::getInstance(); /* sticky is used by comment form */ $sticky = new Sticky($gWeb->find(Constants::STICKY_MAP, true)); $gRegistrationPopup = false; $loginIdInSession = \com\indigloo\sc\auth\Login::tryLoginIdInSession(); //show registration popup if (is_null($loginIdInSession)) { $register_popup = $gWeb->find("sc:browser:registration:popup"); $register_popup = is_null($register_popup) ? false : $register_popup; if (!$register_popup) { $gRegistrationPopup = true; $gWeb->store("sc:browser:registration:popup", true); } } $group_slug = $postDBRow["group_slug"]; $groupDao = new \com\indigloo\sc\dao\Group(); $group_names = $groupDao->tokenizeSlug($group_slug, ",", true); $pageTitle = $itemObj->title; $metaKeywords = SeoData::getMetaKeywords($group_names); $pageUrl = Url::base() . Url::current(); $file = APP_WEB_DIR . '/view/item.php'; include $file; }