/** * Display a listing of the resource. * * @return Response */ public function index() { // redirect to home page if user has no access to this page if ($this->page_access) { return Redirect::to(strtolower(HOME_TITLE)); } // header and module properties $this->data['page_module'] = USER_MODULE; $this->data['page_title'] = USER_TITLE; // search variables here $s_firstname = $this->getInput('s_firstname', ''); $s_lastname = $this->getInput('s_lastname', ''); $s_status = $this->getInput('s_status', ACTIVE); // order variables here $sort_by = $this->getInput('sort_by', 'user.created_at'); $order_by = $this->getInput('order_by', DESCENDING); // search user status $users = User::userStatus($s_status)->userFirstname($s_firstname)->userLastname($s_lastname)->userSort($sort_by, $order_by)->paginate(PAGINATION_LIMIT); // user records $this->data["users"] = $users; // previous search values $this->data["s_firstname"] = $s_firstname; $this->data["s_lastname"] = $s_lastname; $this->data["s_status"] = $s_status; // list of status $this->data["status"] = getOptionStatus(USER_TITLE); // current record number $this->data["count"] = $users->getFrom(); // search parameter to the pagination $this->data["url_pagination"] = array('sort_by' => $sort_by, 'order_by' => $order_by, 's_firstname' => $s_firstname, 's_lastname' => $s_lastname, 's_status' => $s_status); // search parameter to the sorting $this->data["url_sort"] = array('sort_by' => $sort_by, 'order_by' => getSortOrder($order_by), 's_firstname' => $s_firstname, 's_lastname' => $s_lastname, 's_status' => $s_status, 'page' => $users->getCurrentPage()); // load the view and pass the user records return View::make('setup.user.index')->with('data', $this->data); }
/** * Display list of bus services on user's nearby area * * @return list of location */ public function index() { // search variables here $location_id = $this->getInput('location_id', ''); $stop_id = $this->getInput('stop_id', ''); // order variables here $sort_by = $this->getInput('sort_by', 'location.created_at'); $order_by = $this->getInput('order_by', DESCENDING); // search Location status $locations = Location::with(array('Stop' => function ($query) use($stop_id) { if (!empty($stop_id)) { $query->where('id', $stop_id); } }))->locationSort($sort_by, $order_by); // search location filters $this->data["s_locations"] = $locations->get(); // additional search conditions if (!empty($location_id)) { $locations = $locations->where('id', $location_id); } $locations = $locations->paginate(PAGINATION_LIMIT); // location records $this->data["locations"] = $locations; // previous search values $this->data["location_id"] = $location_id; $this->data["stop_id"] = $stop_id; // current record number $this->data["count"] = $locations->getFrom(); // search parameter to the pagination $this->data["url_pagination"] = array('sort_by' => $sort_by, 'order_by' => $order_by, 'location_id' => $location_id, 'stop_id' => $stop_id); // search parameter to the sorting $this->data["url_sort"] = array('sort_by' => $sort_by, 'order_by' => getSortOrder($order_by), 'location_id' => $location_id, 'stop_id' => $stop_id, 'page' => $locations->getCurrentPage()); // load the view and pass the check records return View::make('setup.check.index')->with('data', $this->data); }
$tplVars['userid'] = $userid; $tplVars['userinfo'] =& $userinfo; // Pagination $perpage = getPerPageCount(); if (isset($_GET['page']) && intval($_GET['page']) > 1) { $page = $_GET['page']; $start = ($page - 1) * $perpage; } else { $page = 0; $start = 0; } // Set template vars $tplVars['page'] = $page; $tplVars['start'] = $start; $tplVars['bookmarkCount'] = $start + 1; $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, NULL, NULL, getSortOrder(), true); $tplVars['sidebar_blocks'] = array('watchlist'); $tplVars['watched'] = true; $tplVars['total'] = $bookmarks['total']; $tplVars['bookmarks'] =& $bookmarks['bookmarks']; $tplVars['cat_url'] = createURL('tags', '%2$s'); $tplVars['nav_url'] = createURL('watchlist', '%s/%s%s'); if ($user == $currentUsername) { $title = T_('My Watchlist'); } else { $title = T_('Watchlist') . ': ' . $user; } $tplVars['pagetitle'] = $title; $tplVars['subtitle'] = $title; $tplVars['rsschannels'] = array(array(filter($sitename . ': ' . $title), createURL('rss', 'watchlist/' . filter($user, 'url')))); $templateservice->loadTemplate('bookmarks.tpl', $tplVars);
} // Header variables $tplVars['pagetitle'] = $pagetitle; $tplVars['loadjs'] = true; $tplVars['rsschannels'] = array(array(filter($sitename . ': ' . $pagetitle), createURL('rss', 'all/' . filter($cat, 'url')))); // Pagination $perpage = getPerPageCount(); if (isset($_GET['page']) && intval($_GET['page']) > 1) { $page = $_GET['page']; $start = ($page - 1) * $perpage; } else { $page = 0; $start = 0; } $tplVars['page'] = $page; $tplVars['start'] = $start; $tplVars['popCount'] = 25; $tplVars['currenttag'] = $cat; $tplVars['sidebar_blocks'] = array('related', 'popular'); $tplVars['subtitle'] = filter($pagetitle); $tplVars['bookmarkCount'] = $start + 1; $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, NULL, $cat, NULL, getSortOrder()); $tplVars['total'] = $bookmarks['total']; $tplVars['bookmarks'] =& $bookmarks['bookmarks']; $tplVars['cat_url'] = createURL('tags', '%2$s'); $tplVars['nav_url'] = createURL('tags', '%2$s%3$s'); $templateservice->loadTemplate('bookmarks.tpl', $tplVars); if ($usecache) { // Cache output if existing copy has expired $cacheservice->End($hash); }
break; } if (isset($s_user)) { if (is_numeric($s_user)) { $s_user = intval($s_user); } else { if (!($userinfo = $userservice->getUserByUsername($s_user))) { $tplVars['error'] = sprintf(T_('User with username %s was not found'), $s_user); $templateservice->loadTemplate('error.404.tpl', $tplVars); exit; } else { $s_user =& $userinfo[$userservice->getFieldName('primary')]; } } } } $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $s_user, NULL, $terms, getSortOrder(), $s_watchlist, $s_start, $s_end); $tplVars['page'] = $page; $tplVars['start'] = $start; $tplVars['popCount'] = 25; $tplVars['sidebar_blocks'] = array('recent'); $tplVars['range'] = $range; $tplVars['terms'] = $terms; $tplVars['pagetitle'] = T_('Search Bookmarks'); $tplVars['bookmarkCount'] = $start + 1; $tplVars['total'] = $bookmarks['total']; $tplVars['bookmarks'] =& $bookmarks['bookmarks']; $tplVars['cat_url'] = createURL('tags', '%2$s'); $tplVars['nav_url'] = createURL('search', $range . '/' . $terms . '/%3$s'); $templateservice->loadTemplate('bookmarks.tpl', $tplVars); }
$cachehash = md5($hashtext); // Cache for 30 minutes $cacheservice->Start($cachehash, 1800); } // Pagination $perpage = getPerPageCount($currentUser); if (intval(GET_PAGE) > 1) { $page = intval(GET_PAGE); $start = ($page - 1) * $perpage; } else { $page = 0; $start = 0; } if ($bookmark = $bookmarkservice->getBookmarkByHash($hash)) { // Template variables $bookmarks = $bookmarkservice->getBookmarks($start, $perpage, NULL, NULL, NULL, getSortOrder(), NULL, NULL, NULL, $hash); $tplVars['pagetitle'] = T_('History') . ': ' . $bookmark['bAddress']; $tplVars['subtitle'] = sprintf(T_('History for %s'), $bookmark['bAddress']); $tplVars['loadjs'] = true; $tplVars['page'] = $page; $tplVars['start'] = $start; $tplVars['bookmarkCount'] = $start + 1; $tplVars['total'] = $bookmarks['total']; $tplVars['bookmarks'] = $bookmarks['bookmarks']; $tplVars['hash'] = $hash; $tplVars['popCount'] = 50; $tplVars['sidebar_blocks'] = array('common'); //$tplVars['cat_url'] = createURL('tags', '%2$s'); $tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s'); $tplVars['nav_url'] = createURL('history', $hash . '/%3$s'); $tplVars['rsschannels'] = array();
die(T_('You are not allowed to do this action (admin access)')); }*/ // Check if queried format is xml if (isset($_REQUEST['xml']) && trim($_REQUEST['xml']) == 1) { $xml = true; } else { $xml = false; } // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && trim($_REQUEST['tag']) != '') { $tag = trim($_REQUEST['tag']); } else { $tag = NULL; } // Get the posts relevant to the passed-in variables. $bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag, NULL, getSortOrder()); // Set up the plain file and output all the posts. header('Content-Type: text/plain; charset=utf-8'); if (!$xml) { header('Content-Type: text/plain'); foreach ($bookmarks['bookmarks'] as $row) { if (checkUrl($row['bAddress'], false)) { echo $row['bAddress'] . "\n"; } } } else { header('Content-Type: text/xml'); echo '<GoogleCustomizations>' . "\n"; echo ' <Annotations>' . "\n"; foreach ($bookmarks['bookmarks'] as $row) { //if(substr($row['bAddress'], 0, 7) == "http://") {
echo ' - '; echo '<a href="' . createURL('bookmarks', $currentUser->getUsername() . '/' . $currenttag) . '">'; echo T_('Only your bookmarks for this tag') . '</a>'; //echo T_(' for these tags'); } } } ?> </p> <?php // PAGINATION // Ordering $sortOrder = ''; if (GET_SORT != '') { $sortOrder = 'sort=' . getSortOrder(); } $sortAmp = $sortOrder ? '&' . $sortOrder : ''; $sortQue = $sortOrder ? '?' . $sortOrder : ''; // Previous $perpage = getPerPageCount($currentUser); if (!$page || $page < 2) { $page = 1; $start = 0; $bfirst = '<span class="disable">' . T_('First') . '</span>'; $bprev = '<span class="disable">' . T_('Previous') . '</span>'; } else { $prev = $page - 1; $prev = 'page=' . $prev; $start = ($page - 1) * $perpage; $bfirst = '<a href="' . sprintf($nav_url, $user, $currenttag, '') . $sortQue . '">' . T_('First') . '</a>';
$tplVars['range'] = 'user'; // Pagination $perpage = getPerPageCount(); if (isset($_GET['page']) && intval($_GET['page']) > 1) { $page = $_GET['page']; $start = ($page - 1) * $perpage; } else { $page = 0; $start = 0; } // Set template vars $tplVars['rsschannels'] = array(array(filter($sitename . ': ' . $pagetitle), createURL('rss', filter($user, 'url') . $rssCat))); $tplVars['page'] = $page; $tplVars['start'] = $start; $tplVars['bookmarkCount'] = $start + 1; $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, $cat, $terms, getSortOrder()); $tplVars['total'] = $bookmarks['total']; $tplVars['bookmarks'] =& $bookmarks['bookmarks']; $tplVars['cat_url'] = createURL('bookmarks', '%s/%s'); $tplVars['nav_url'] = createURL('bookmarks', '%s/%s%s'); if ($user == $currentUsername) { $title = T_('My Bookmarks') . filter($catTitle); } else { $title = filter($pagetitle); } $tplVars['pagetitle'] = $title; $tplVars['subtitle'] = $title; } } $templateservice->loadTemplate($templatename, $tplVars); if ($usecache && $endcache) {
$tplVars['rsschannels'] = array(array(sprintf(T_('%s: Recent bookmarks'), $sitename), createURL('rss'))); if ($usecache) { // Generate hash for caching on $hashtext = $_SERVER['REQUEST_URI']; if ($userservice->isLoggedOn()) { $hashtext .= $userservice->getCurrentUserID(); } $hash = md5($hashtext); // Cache for 15 minutes $cacheservice->Start($hash, 900); } // Pagination $perpage = getPerPageCount(); $tplVars['page'] = 0; $tplVars['start'] = 0; $tplVars['popCount'] = 30; $tplVars['sidebar_blocks'] = array('recent'); $tplVars['range'] = 'all'; $tplVars['pagetitle'] = T_('Store, share and tag your favourite links'); $tplVars['subtitle'] = T_('Recent Bookmarks'); $tplVars['bookmarkCount'] = 1; $bookmarks =& $bookmarkservice->getBookmarks(0, $perpage, NULL, NULL, NULL, getSortOrder(), NULL); $tplVars['total'] = $bookmarks['total']; $tplVars['bookmarks'] =& $bookmarks['bookmarks']; $tplVars['cat_url'] = createURL('tags', '%2$s'); $tplVars['nav_url'] = createURL('index', '%3$s'); $templateservice->loadTemplate('bookmarks.tpl', $tplVars); if ($usecache) { // Cache output if existing copy has expired $cacheservice->End($hash); }
$templateservice->loadTemplate('error.404.tpl', $tplVars); //throw a 404 error exit; } } else { $userid = null; } } if ($cat) { $pagetitle .= ": " . str_replace('+', ' + ', $cat); } $tplVars['feedtitle'] = filter($GLOBALS['sitename'] . (isset($pagetitle) ? $pagetitle : '')); $tplVars['pagelink'] = addProtocolToUrl(ROOT); $tplVars['feedlink'] = addProtocolToUrl(ROOT) . 'rss?sort=' . getSortOrder(); $tplVars['feeddescription'] = sprintf(T_('Recent bookmarks posted to %s'), $GLOBALS['sitename']); $bookmarks = $bookmarkservice->getBookmarks(0, $rssEntries, $userid, $cat, null, getSortOrder(), $watchlist, null, null, null); $bookmarks_tmp = filter($bookmarks['bookmarks']); $bookmarks_tpl = array(); $latestdate = null; $guidBaseUrl = addProtocolToUrl(ROOT) . '#'; foreach ($bookmarks_tmp as $key => $row) { $_link = $row['bAddress']; // Redirection option if ($GLOBALS['useredir']) { $_link = $GLOBALS['url_redir'] . $_link; } if ($row['bDatetime'] > $latestdate) { $latestdate = $row['bDatetime']; } $_pubdate = gmdate('r', strtotime($row['bDatetime'])); $bookmarks_tpl[] = array('title' => $row['bTitle'], 'link' => $_link, 'description' => $row['bDescription'], 'creator' => SemanticScuttle_Model_UserArray::getName($row), 'pubdate' => $_pubdate, 'tags' => $row['tags'], 'guid' => $guidBaseUrl . $row['bId']);
$cacheservice->Start($hash, 900); } // Pagination $perpage = getPerPageCount(); if (isset($_GET['page']) && intval($_GET['page']) > 1) { $page = $_GET['page']; $start = ($page - 1) * $perpage; } else { $page = 0; $start = 0; } $dtend = date('Y-m-d H:i:s', strtotime('tomorrow')); $dtstart = date('Y-m-d H:i:s', strtotime($dtend . ' -' . $defaultRecentDays . ' days')); $tplVars['page'] = $page; $tplVars['start'] = $start; $tplVars['popCount'] = 30; $tplVars['sidebar_blocks'] = array('recent'); $tplVars['range'] = 'all'; $tplVars['pagetitle'] = T_('Store, share and tag your favourite links'); $tplVars['subtitle'] = T_('Recent Bookmarks'); $tplVars['bookmarkCount'] = $start + 1; $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, NULL, NULL, NULL, getSortOrder(), NULL, $dtstart, $dtend); $tplVars['total'] = $bookmarks['total']; $tplVars['bookmarks'] =& $bookmarks['bookmarks']; $tplVars['cat_url'] = createURL('tags', '%2$s'); $tplVars['nav_url'] = createURL('index', '%3$s'); $templateservice->loadTemplate('bookmarks.tpl', $tplVars); if ($usecache) { // Cache output if existing copy has expired $cacheservice->End($hash); }
// Header variables $pagetitle = T_('Popular Tags'); if (isset($user) && $user != '') { $userid = $userservice->getIdFromUser($user); if ($userid == NULL) { $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user); $templateservice->loadTemplate('error.404.tpl', $tplVars); //throw a 404 error exit; } $pagetitle .= ': ' . ucfirst($user); } else { $userid = NULL; } $tags = $b2tservice->getPopularTags($userid, 150); $tplVars['tags'] = $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder('alphabet_asc')); $tplVars['user'] = $user; if (isset($userid)) { $tplVars['cat_url'] = createURL('bookmarks', '%s/%s'); } else { $tplVars['cat_url'] = createURL('tags', '%2$s'); } $tplVars['sidebar_blocks'] = array('linked'); $tplVars['pagetitle'] = $pagetitle; $tplVars['subtitle'] = $pagetitle; $tplVars['loadjs'] = true; $templateservice->loadTemplate('tags.tpl', $tplVars); if ($usecache) { // Cache output if existing copy has expired $cacheservice->End($hash); }
$templateservice->loadTemplate('error.404.tpl', $tplVars); //throw a 404 error exit; } } $pagetitle .= ": " . $user; } else { $userid = NULL; } if ($cat) { $pagetitle .= ": " . str_replace('+', ' + ', $cat); } $tplVars['feedtitle'] = filter($GLOBALS['sitename'] . (isset($pagetitle) ? $pagetitle : '')); $tplVars['feedlink'] = $GLOBALS['root']; $tplVars['feeddescription'] = sprintf(T_('Recent bookmarks posted to %s'), $GLOBALS['sitename']); $bookmarks =& $bookmarkservice->getBookmarks(0, 15, $userid, $cat, NULL, getSortOrder(), $watchlist); $bookmarks_tmp =& filter($bookmarks['bookmarks']); $bookmarks_tpl = array(); foreach (array_keys($bookmarks_tmp) as $key) { $row =& $bookmarks_tmp[$key]; $_link = $row['bAddress']; // Redirection option if ($GLOBALS['useredir']) { $_link = $GLOBALS['url_redir'] . $_link; } $_pubdate = date("r", strtotime($row['bDatetime'])); $uriparts = explode('.', $_link); $extension = end($uriparts); unset($uriparts); $enclosure = array(); if ($keys = multi_array_search($extension, $GLOBALS['filetypes'])) {
// - doesn't include the filtered tag as an attribute on the root element (we do) //this page here is really not valid in any way $httpContentType = 'text/html'; // Force HTTP authentication first! require_once 'httpauth.inc.php'; /* Service creation: only useful services are created */ $bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark'); // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && trim($_REQUEST['tag']) != '') { //$_GET vars have + replaced to " " automatically $tag = str_replace(' ', '+', trim($_REQUEST['tag'])); } else { $tag = null; } // Get the posts relevant to the passed-in variables. $bookmarks = $bookmarkservice->getBookmarks(0, null, $userservice->getCurrentUserId(), $tag, null, getSortOrder()); // Set up the XML file and output all the posts. echo '<!DOCTYPE NETSCAPE-Bookmark-file-1>' . "\r\n"; echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" />'; echo '<!-- This is an automatically generated file. -->' . "\r\n"; echo '<TITLE>Bookmarks</TITLE>' . "\r\n"; echo '<H1 LAST_MODIFIED="' . date('U') . '">Bookmarks for ' . htmlspecialchars($currentUser->getUsername()) . '' . (is_null($tag) ? '' : ' tag="' . htmlspecialchars($tag) . '"') . " from " . $sitename . "</H1>\r\n"; echo '<DL>' . "\r\n"; foreach ($bookmarks['bookmarks'] as $row) { if (is_null($row['bDescription']) || trim($row['bDescription']) == '') { $description = ''; } else { $description = 'description="' . filter($row['bDescription'], 'xml') . '" '; } $taglist = ''; if (count($row['tags']) > 0) {
} // Header variables $pagetitle = T_('All Tags'); if (isset($user) && $user != '') { $userid = $userservice->getIdFromUser($user); if ($userid == NULL) { $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user); $templateservice->loadTemplate('error.404.tpl', $tplVars); exit; } $pagetitle .= ': ' . ucfirst($user); } else { $userid = NULL; } $tags =& $b2tservice->getTags($userid); $tplVars['tags'] =& $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder()); $tplVars['user'] = $user; if (isset($userid)) { $tplVars['cat_url'] = createURL('bookmarks', '%s/%s'); } else { $tplVars['cat_url'] = createURL('tags', '%2$s'); } $tplVars['sidebar_blocks'] = array('linked'); $tplVars['userid'] = $userid; $tplVars['loadjs'] = true; $tplVars['pagetitle'] = $pagetitle; $tplVars['subtitle'] = $pagetitle; $templateservice->loadTemplate('tags.tpl', $tplVars); if ($usecache) { // Cache output if existing copy has expired $cacheservice->End($hash);
} else { $page = 0; $start = 0; } // Set template vars $tplVars['rsschannels'] = array(array(sprintf(T_('%s: %s'), $sitename, $rssTitle), createURL('rss', filter($user, 'url')) . $rssCat . '?sort=' . getSortOrder())); if ($userservice->isLoggedOn()) { $currentUsername = $currentUser->getUsername(); if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) { array_push($tplVars['rsschannels'], array(sprintf(T_('%s: %s (+private %s)'), $sitename, $rssTitle, $currentUsername), createURL('rss', filter($currentUsername, 'url')) . $rssCat . '?sort=' . getSortOrder() . '&privateKey=' . $currentUser->getPrivateKey())); } } $tplVars['page'] = $page; $tplVars['start'] = $start; $tplVars['bookmarkCount'] = $start + 1; $bookmarks = $bookmarkservice->getBookmarks($start, $perpage, $userid, $cat, null, getSortOrder()); $tplVars['total'] = $bookmarks['total']; $tplVars['bookmarks'] = $bookmarks['bookmarks']; $tplVars['cat_url'] = createURL('bookmarks', '%s/%s'); $tplVars['nav_url'] = createURL('bookmarks', '%s/%s%s'); if ($userservice->isLoggedOn() && $user == $currentUsername) { $tplVars['pagetitle'] = T_('My Bookmarks') . $catTitle; $tplVars['subtitlehtml'] = T_('My Bookmarks') . $catTitleWithUrls; } else { $tplVars['pagetitle'] = $user . ': ' . $cat; $tplVars['subtitlehtml'] = $user . $catTitleWithUrls; } } } $tplVars['summarizeLinkedTags'] = true; $tplVars['pageName'] = PAGE_BOOKMARKS;