Beispiel #1
0
 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;
 }
Beispiel #2
0
 function process($params, $options)
 {
     $qparams = Url::getRequestQueryParams();
     $gpage = Url::tryQueryParam("gpage");
     $gpage = empty($gpage) ? "1" : $gpage;
     $redis = new redis\Activity();
     $pageSize = Config::getInstance()->get_value("main.page.items");
     $paginator = new \com\indigloo\ui\Pagination($qparams, $pageSize);
     $zsetKey = Nest::score("post", "likes");
     $members = $redis->getPagedZSet($zsetKey, $paginator);
     //first one is id, second one is score
     $count = 0;
     $scores = array();
     $ids = array();
     for ($i = 1; $i < sizeof($members); $i++) {
         if ($i % 2 == 0) {
             array_push($scores, $members[$i - 1]);
         } else {
             $itemId = $members[$i - 1];
             $postId = PseudoId::decode($itemId);
             array_push($ids, $postId);
         }
     }
     //get post rows using ids
     $postDao = new \com\indigloo\sc\dao\Post();
     $postDBRows = $postDao->getOnSearchIds($ids);
     $pageHeader = 'Most popular';
     $pageBaseUrl = '/pub/popular';
     $pageTitle = SeoData::getPageTitleWithNumber($gpage, "popular items");
     $metaKeywords = SeoData::getHomeMetaKeywords();
     $metaDescription = SeoData::getMetaDescriptionWithNumber($gpage, "popular items");
     $file = APP_WEB_DIR . '/view/tiles-page.php';
     include $file;
 }
Beispiel #3
0
 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;
 }
Beispiel #4
0
Datei: Home.php Projekt: rjha/sc
 function process($params, $options)
 {
     $gpage = Url::tryQueryParam("gpage");
     $gpage = empty($gpage) ? "1" : $gpage;
     if ($gpage == "1") {
         $this->loadHomePage($gpage);
     } else {
         $this->loadNextPage($gpage);
     }
 }
Beispiel #5
0
Datei: Lists.php Projekt: rjha/sc
 function process($params, $options)
 {
     if (is_null($params) || empty($params)) {
         $controller = new \com\indigloo\sc\controller\Http400();
         $controller->process();
         exit;
     }
     $plistId = Util::getArrayKey($params, "list_id");
     $listId = PseudoId::decode($plistId);
     $qparams = Url::getRequestQueryParams();
     $gpage = Url::tryQueryParam("gpage");
     $gpage = empty($gpage) ? "1" : $gpage;
     //@todo input check
     // people can type all sort of input garbage
     settype($listId, "int");
     $listDao = new \com\indigloo\sc\dao\Lists();
     $listDBRow = $listDao->getOnId($listId);
     if (empty($listDBRow)) {
         //not found
         $controller = new \com\indigloo\sc\controller\Http404();
         $controller->process();
         exit;
     }
     $listName = $listDBRow["name"];
     $listPubUrl = sprintf("%s/pub/list/%d/%s", Url::base(), $plistId, $listDBRow["seo_name"]);
     //get items from sc_list_item table
     $model = new \com\indigloo\sc\model\ListItem();
     $filter = new Filter($model);
     $filter->add($model::LIST_ID, Filter::EQ, $listId);
     $pageSize = Config::getInstance()->get_value("user.page.items");
     $filters = array();
     array_push($filters, $filter);
     $paginator = new \com\indigloo\ui\Pagination($qparams, $pageSize);
     $itemDBRows = $listDao->getPagedItems($paginator, $filters);
     $loginId = $listDBRow["login_id"];
     $userDao = new \com\indigloo\sc\dao\User();
     $userDBRow = $userDao->getOnLoginId($loginId);
     $template = APP_WEB_DIR . '/view/list/pub.php';
     //page variables
     $pageBaseUrl = $listPubUrl;
     $pageTitle = sprintf("page %d of %s", $gpage, $listDBRow["name"]);
     $description = Util::abbreviate($listDBRow["description"], 160);
     $metaDescription = SeoData::thisOrHomeDescription($description);
     $metaKeywords = SeoData::getHomeMetaKeywords();
     include $template;
 }
Beispiel #6
0
 function process($params, $options)
 {
     $postDao = new \com\indigloo\sc\dao\Post();
     $qparams = Url::getRequestQueryParams();
     $gpage = Url::tryQueryParam("gpage");
     $gpage = empty($gpage) ? "1" : $gpage;
     $pageSize = Config::getInstance()->get_value("main.page.items");
     $paginator = new \com\indigloo\ui\Pagination($qparams, $pageSize);
     $postDBRows = $postDao->getPaged($paginator);
     $pageHeader = '';
     $pageBaseUrl = $options["path"];
     $pageTitle = SeoData::getPageTitleWithNumber($gpage, "recent items");
     $metaKeywords = SeoData::getHomeMetaKeywords();
     $metaDescription = SeoData::getMetaDescriptionWithNumber($gpage, "recent items");
     $file = APP_WEB_DIR . '/view/tiles-page.php';
     include $file;
 }
Beispiel #7
0
 static function render($options, $default)
 {
     $tab = Url::tryQueryParam("tab", $default);
     if (Util::tryEmpty($tab)) {
         $tab = $default;
     }
     if (!array_key_exists($tab, $options)) {
         $tab = $default;
     }
     $buffer = '';
     $item = '<li class="%s"> <a href="%s">%s</a></li>';
     foreach ($options as $key => $value) {
         $pageURI = Url::addQueryParameters($_SERVER['REQUEST_URI'], array("tab" => $key));
         $class = $tab == $key ? 'active' : '';
         $strItem = sprintf($item, $class, $pageURI, $value);
         $buffer .= $strItem;
     }
     $buffer = '<ul class="nav nav-tabs">' . $buffer . '</ul>';
     $data = array("buffer" => $buffer, "active" => $tab);
     return $data;
 }
Beispiel #8
0
 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;
 }
Beispiel #9
0
Datei: Site.php Projekt: rjha/sc
 function process($params, $options)
 {
     if (is_null($params) || empty($params)) {
         $controller = new \com\indigloo\sc\controller\Http400();
         $controller->process();
         exit;
     }
     $siteId = Util::tryArrayKey($params, "site_id");
     $cname = Url::tryQueryParam("cname");
     if (empty($siteId) || empty($cname)) {
         $controller = new \com\indigloo\sc\controller\Http400();
         $controller->process();
         exit;
     }
     $siteDao = new \com\indigloo\sc\dao\Site();
     $postDBRows = $siteDao->getPostsOnId($siteId, 50);
     $pageHeader = $cname;
     $pageTitle = SeoData::getHomePageTitle();
     $metaDescription = SeoData::getHomeMetaDescription();
     $metaKeywords = SeoData::getHomeMetaKeywords();
     $file = APP_WEB_DIR . '/view/tiles.php';
     include $file;
 }
Beispiel #10
0
Datei: Group.php Projekt: rjha/sc
 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;
 }
Beispiel #11
0
Datei: login.php Projekt: rjha/sc
include APP_WEB_DIR . '/inc/header.inc';
use com\indigloo\Util;
use com\indigloo\Url;
use com\indigloo\ui\form\Sticky;
use com\indigloo\Constants;
use com\indigloo\Configuration as Config;
use com\indigloo\ui\form\Message as FormMessage;
$gWeb = \com\indigloo\core\Web::getInstance();
//do we already have a login?
if (\com\indigloo\sc\auth\Login::hasSession()) {
    header("Location: / ");
}
$qUrl = Url::tryBase64QueryParam("q", "/user/dashboard/index.php");
$fUrl = Url::current();
// should login do some action?
$gSessionAction = Url::tryQueryParam("g_session_action");
if (!empty($gSessionAction)) {
    $gWeb->store("global.session.action", $gSessionAction);
}
$fUrl = Url::current();
$sticky = new Sticky($gWeb->find(Constants::STICKY_MAP, true));
$stoken = Util::getMD5GUID();
$gWeb->store("mik_state_token", $stoken);
//Facebook OAuth2
$fbAppId = Config::getInstance()->get_value("facebook.app.id");
$host = Url::base();
$fbCallback = $host . "/callback/fb2.php";
$fbDialogUrl = "https://www.facebook.com/dialog/oauth?client_id=" . $fbAppId;
$fbDialogUrl .= "&redirect_uri=" . urlencode($fbCallback) . "&scope=email&state=" . $stoken;
//Google OAuth2
$googleClientId = Config::getInstance()->get_value("google.client.id");
Beispiel #12
0
<?php

//sc/user/account/reset-password.php
include 'sc-app.inc';
include APP_WEB_DIR . '/inc/header.inc';
use com\indigloo\Util;
use com\indigloo\Url;
use com\indigloo\Constants;
use com\indigloo\exception\DBException;
try {
    $token = Url::tryQueryParam('token');
    $email = Url::tryQueryParam('email');
    if (empty($token) || empty($email)) {
        printf("Required parameters are missing");
        exit;
    }
    $email = urldecode($email);
    $mailDao = new \com\indigloo\sc\dao\Mail();
    $mailDao->checkResetPassword($email, $token);
    //tokens for use in next screen
    $ftoken = Util::getMD5GUID();
    $femail = Util::encrypt($email);
    $gWeb = \com\indigloo\core\Web::getInstance();
    $gWeb->store("change.password.email", $femail);
    $gWeb->store("change.password.token", $ftoken);
    $title = $email;
    $qUrl = base64_encode("/user/account/login-now.php");
    $fUrl = Url::current();
    $submitUrl = "/user/account/form/change-password.php";
    include APP_WEB_DIR . '/user/account/inc/password-form.inc';
} catch (DBException $ex) {
Beispiel #13
0
Datei: users.php Projekt: rjha/sc
$fparams = $qparams;
// unset extra ft params and search token param
unset($fparams["ft"]);
unset($fparams["gt"]);
//ft urls start with page 1
$fparams["gpage"] = 1;
//create filter Urls
$ftBaseUrl = Url::createUrl("/monitor/users.php", $fparams);
//search clear link
$sparams = $qparams;
unset($sparams["gt"]);
$clearSearchUrl = Url::createUrl("/monitor/users.php", $sparams);
//filters
$filters = array();
$model = new \com\indigloo\sc\model\User();
$ft = Url::tryQueryParam("ft");
$ftname = "";
$gtoken = Util::tryArrayKey($qparams, "gt");
$userId = NULL;
if (empty($ft) && strlen($gtoken) > 5 && strcmp(substr($gtoken, 0, 5), "user:"******"user";
    $userId = substr($gtoken, 5);
    //reset search token
    $gtoken = NULL;
}
if (empty($ft) && !empty($gtoken)) {
    $ft = "name";
}
if (!is_null($ft)) {
    switch ($ft) {
        case "24HR":
Beispiel #14
0
Datei: User.php Projekt: rjha/sc
 private function processLists($params, $options)
 {
     $pubUserId = Util::getArrayKey($params, "login_id");
     $loginId = PseudoId::decode($pubUserId);
     $qparams = Url::getRequestQueryParams();
     $userDao = new \com\indigloo\sc\dao\User();
     $userDBRow = $userDao->getOnLoginId($loginId);
     $this->isValidUser($userDBRow);
     $gpage = Url::tryQueryParam("gpage");
     $gpage = empty($gpage) ? "1" : $gpage;
     $listDao = new \com\indigloo\sc\dao\Lists();
     $qparams = Url::getRequestQueryParams();
     $pageSize = Config::getInstance()->get_value("user.page.items");
     $paginator = new \com\indigloo\ui\Pagination($qparams, $pageSize);
     $listDBRows = $listDao->getPagedOnLoginId($paginator, $loginId);
     $template = APP_WEB_DIR . '/view/user/lists.php';
     //page variables
     $pageBaseUrl = "/pub/user/" . $pubUserId;
     $pageTitle = sprintf("page %d of lists by %s", $gpage, $userDBRow["name"]);
     $metaKeywords = SeoData::getHomeMetaKeywords();
     $metaDescription = SeoData::getHomeMetaDescription();
     include $template;
 }