Copyright 2004-2016 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you
did not receive this file, see http://www.horde.org/licenses/lgpl21.
/* Which forums page are we on? Default to page 0. */ $forum_page = Horde_Util::getFormData('forum_page', 0); $forums_per_page = $prefs->getValue('forums_per_page'); $forum_start = $forum_page * $forums_per_page; /* Get the list of forums. */ try { $forums_list = $forums->getForums(0, true, $sort_by, $sort_dir, true, $forum_start, $forums_per_page); $forums_count = $forums->countForums(); } catch (Horde_Exception_NotFound $e) { $forums_count = 0; } /* Set up the column headers. */ $col_headers = array('forum_name' => _("Forum"), 'forum_description' => _("Description"), 'message_count' => _("Posts"), 'thread_count' => _("Threads"), 'message_timestamp' => _("Last Post"), 'message_author' => _("Posted by"), 'message_date' => _("Date")); $col_headers = Agora::formatColumnHeaders($col_headers, $sort_by, $sort_dir, 'forums'); /* Set up the template tags. */ $view = new Agora_View(); $view->col_headers = $col_headers; $view->forums_list = $forums_list; Horde::startBuffer(); $notification->notify(array('listeners' => 'status')); $view->notify = Horde::endBuffer(); $view->actions = empty($actions) ? null : $actions; /* Set up pager. */ $vars = Horde_Variables::getDefaultVariables(); $pager_ob = new Horde_Core_Ui_Pager('forum_page', $vars, array('num' => $forums_count, 'url' => 'forums.php', 'perpage' => $forums_per_page)); $pager_ob->preserve('scope', $scope); $view->pager_link = $pager_ob->render(); $page_output->addLinkTag(array('href' => Horde::url('rss/index.php', true, -1)->add('scope', $scope), 'title' => _("Forums"))); $page_output->header(array('title' => _("All Forums"))); echo $view->render('forums'); $page_output->footer();
* * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.horde.org/licenses/gpl. * * @author Duck <*****@*****.**> * @package Folks */ require_once __DIR__ . '/lib/base.php'; $title = _("Popularity"); $count = $folks_driver->countUsers(); if ($count instanceof PEAR_Error) { $notification->push($count); $count = 0; } $page = Horde_Util::getGet('page', 0); $perpage = $prefs->getValue('per_page'); $criteria = array('sort_by' => 'popularity', 'sort_dir' => 0); $users = $folks_driver->getUsers($criteria, $page * $perpage, $perpage); if ($users instanceof PEAR_Error) { $notification->push($users); $users = array(); } $vars = Horde_Variables::getDefaultVariables(); $pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $count, 'url' => 'popularity.php', 'perpage' => $perpage)); $pager->preserve($criteria); $list_url = Folks::getUrlFor('list', 'popularity'); $page_output->addScriptFile('stripe.js', 'horde'); $page_output->header(array('title' => $title)); $page_output->footer(); $notification->notify(array('listeners' => 'status')); require FOLKS_TEMPLATES . '/list/list.php';
$section = $vars->section; $types = Vilma::getUserMgrTypes(); if (!isset($types[$section])) { $vars->section = $section = 'all'; } $tabs = Vilma::getUserMgrTabs($vars); try { $addresses = $vilma->driver->getAddresses($curdomain['domain_name'], $section); } catch (Exception $e) { $notification->push($e); Horde::url('index.php', true)->redirect(); } // Page results $perpage = $prefs->getValue('addresses_perpage'); $url = Horde::url('users/index.php')->add('section', $section); $pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => count($addresses), 'url' => $url, 'page_count' => 10, 'perpage' => $perpage)); $addresses = array_slice($addresses, $vars->page * $perpage, $perpage); foreach ($addresses as &$address) { $type = $address['type']; $id = $address['id']; switch ($type) { case 'alias': $address['edit_url'] = Horde::url('users/editAlias.php')->add(array('alias' => $id, 'section' => $section)); $address['add_alias_url'] = $address['add_forward_url'] = false; break; case 'forward': $address['edit_url'] = Horde::url('users/editForward.php')->add(array('forward' => $id, 'section' => $section)); $address['add_alias_url'] = $address['add_forward_url'] = false; break; default: $params = array('address' => $id, 'section' => $section);
Horde::url('forums.php', true)->redirect(); } elseif (empty($messages_list)) { $messages_count = 0; $notification->push(_("No messages are waiting for moderation."), 'horde.message'); } else { $messages_count = count($messages_list); $messages_list = array_slice($messages_list, $messages_start, $messages_per_page); } /* Set up the column headers. */ $col_headers = array('forum_id' => _("Forum"), 'message_subject' => _("Subject"), 'message_author' => _("Posted by"), 'message_body' => _("Body"), 'message_timestamp' => _("Date")); $col_headers = Agora::formatColumnHeaders($col_headers, $sort_by, $sort_dir, 'moderate'); /* Set up the template tags. */ $view = new Agora_View(); $view->col_headers = $col_headers; $view->messages = $messages_list; $view->buttons = array(_("Approve"), _("Delete")); $view->session_tag = Horde_Util::formInput(); Horde::startBuffer(); $notification->notify(array('listeners' => 'status')); $view->notify = Horde::endBuffer(); /* Set up pager. */ $vars = Horde_Variables::getDefaultVariables(); $pager_ob = new Horde_Core_Ui_Pager('moderate_page', $vars, array('num' => $messages_count, 'url' => Horde::selfUrl(true), 'perpage' => $messages_per_page)); $pager_ob->preserve('agora', Horde_Util::getFormData('agora')); $view->pager = $pager_ob->render(); if (isset($api_call)) { return $view->render('moderate'); } $page_output->header(array('title' => _("Messages Awaiting Moderation"))); echo $view->render('moderate'); $page_output->footer();
/** * Returns all threads of a forum in a threaded view. * * @param string $forum_name The unique name for the forum. * @param boolean $bodies Whether to include message bodies in the view. * @param string $scope The application that the specified forum belongs to. * @param string $base_url An alternate link where edit/delete/reply links * point to. * @param string $template_file Template file to use. * * @return string The HTML code of the thread view. */ public static function render($forum_name, $scope = 'agora', $base_url = null, $template_file = false) { $forums = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create($scope); $forum_id = $forums->getForumId($forum_name); if ($forum_id === null) { return ''; } $messages = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create($scope, $forum_id); if ($messages instanceof PEAR_Error) { return $messages->getMessage(); } if (($view_bodies = Horde_Util::getPost('bodies')) !== null) { $GLOBALS['prefs']->setValue('comments_view_bodies', $view_bodies); } else { $view_bodies = $GLOBALS['prefs']->getValue('comments_view_bodies'); } if ($messages->_forum['message_count'] == 0) { return ''; } $sort_by = Agora::getSortBy('comments'); $sort_dir = Agora::getSortDir('comments'); $html = '<div class="header">' . _("Comments") . ' (' . $messages->_forum['message_count'] . ')' . ' '; if (!$GLOBALS['prefs']->isLocked('comments_view_bodies')) { $rss = Horde::url('rss/threads.php', true, -1)->add(array('scope' => $scope, 'forum_id' => $forum_id)); $html .= '<span style="font-size: 0.8em;">'; $html .= '<form action=' . urldecode($base_url) . ' method="post" name="sorter" style="display: inline;">'; $html .= _("View") . ' <select name="bodies" onchange="document.sorter.submit()" >'; $html .= '<option value="2">' . _("Flat") . '</option>'; $html .= '<option value="1" ' . ($view_bodies == 1 ? 'selected="selected"' : '') . '>' . _("Thread") . '</option>'; $html .= '</select>'; if ($view_bodies != '1') { $html .= ' ' . _("Sort by") . ' '; $html .= '<select name="comments_sortby" onchange="document.sorter.submit()" >'; $html .= '<option value="message_timestamp" ' . ($sort_by == 'message_timestamp' ? 'selected="selected"' : '') . '>' . _("Date") . '</option>'; $html .= '<option value="message_author" ' . ($sort_by == 'message_author' ? 'selected="selected"' : '') . '>' . _("Author") . '</option>'; $html .= '<option value="message_subject" ' . ($sort_by == 'message_subject' ? 'selected="selected"' : '') . '>' . _("Subject") . '</option>'; $html .= '</select>'; $html .= ' ' . _("Sort direction") . ' '; $html .= '<select name="comments_sortdir" onchange="document.sorter.submit()" >'; $html .= '<option value="0">' . _("Ascending") . '</option>'; $html .= '<option value="1" ' . ($sort_dir == 1 ? 'selected="selected"' : '') . '>' . _("Descending") . '</option>'; $html .= '</select>'; } $html .= '<link rel="alternate" title="' . _("Threads") . '" href="' . $rss . '" type="application/rss+xml" />'; $html .= ' <a href="' . $rss . '" />RSS</a> '; $html .= '</form></span>'; } $html .= '</div>'; $col_headers = array('message_thread' => _("Subject"), 'message_thread_class_plain' => 'msgThreadPlain', 'message_author' => _("Posted by"), 'message_author_class_plain' => 'msgAuthorPlain', 'message_timestamp' => _("Date"), 'message_timestamp_class_plain' => 'msgTimestampPlain'); if ($view_bodies == 1) { $threads = $messages->getThreads(0, true, 'message_thread', 0, true, '', $base_url); $html .= $messages->getThreadsUi($threads, $col_headers, true, $template_file); } else { $thread_page = Horde_Util::getFormData('comments_page', 0); $thread_per_page = $GLOBALS['prefs']->getValue('comments_per_page'); $thread_start = $thread_page * $thread_per_page; if (empty($template_file)) { $template_file = 'messages/flat'; } if ($messages->_forum['message_count'] > $thread_per_page && $view_bodies == 2) { $vars = new Horde_Variables(array('comments_page' => $thread_page)); $pager_ob = new Horde_Core_Ui_Pager('comments_page', $vars, array('num' => $messages->_forum['message_count'], 'url' => $base_url, 'perpage' => $thread_per_page)); $pager_html = $pager_ob->render(); } else { $pager_html = ''; } $threads_list = $messages->getThreads(0, true, $sort_by, $sort_dir, 1, '', $base_url, $thread_start, $thread_per_page); if ($threads_list instanceof PEAR_Error) { $html .= $threads_list->getDebugInfo(); } else { $html .= $pager_html . $messages->getThreadsUi($threads_list, $col_headers, true, $template_file) . $pager_html; } } return $html; }
try { $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($gallery_id); } catch (Ansel_Exception $e) { $notification->push($e->getMessage(), 'horde.error'); Ansel::getUrlFor('view', array('gallery' => $gallery_id))->redirect(); exit; } if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) { $notification->push(_("Access denied editing this gallery."), 'horde.error'); Ansel::getUrlFor('view', array('gallery' => $gallery_id))->redirect(); exit; } $gallery->setDate(Ansel::getDateParameter()); $page = Horde_Util::getFormData('page', 0); $perpage = min($prefs->getValue('tilesperpage'), $conf['thumbnail']['perpage']); $images = $gallery->getImages($page * $perpage, $perpage); $reloadimage = Horde::img('reload.png'); $customimage = Horde::img('layout.png'); $customurl = Horde::url('faces/custom.php')->add('page', $page); $face = $injector->getInstance('Ansel_Faces'); $autogenerate = $face->canAutogenerate(); $vars = Horde_Variables::getDefaultVariables(); $pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $gallery->countImages(), 'url' => 'faces/gallery.php', 'perpage' => $perpage)); $pager->preserve('gallery', $gallery_id); $title = sprintf(_("Searching for faces in %s"), Ansel::getUrlFor('view', array('gallery' => $gallery_id, 'view' => 'Gallery'))->link() . $gallery->get('name') . '</a>'); $page_output->addScriptFile('stripe.js', 'horde'); $page_output->addScriptFile('popup.js', 'horde'); $page_output->header(array('title' => $title)); $notification->notify(array('listeners' => 'status')); require ANSEL_TEMPLATES . '/faces/gallery.inc'; $page_output->footer();
// Try a view link. $url = $view_url->copy()->add(array('type' => $val['type'], 'file' => $val['name'], 'dir' => Gollem::$backend['dir'], 'driver' => Gollem::$backend['driver'])); $item['link'] = Horde::link('#', '', '', '_blank', Horde::popupJs($url)) . $name . '</a>'; break; } $entry[] = $item; } /* Set up the variables needed for the header row. */ $sortby = $prefs->getValue('sortby'); $sortdir = $prefs->getValue('sortdir'); if ($total) { // Set start/end items (according to current page) $start = $page * $perpage + 1; $end = min($total, $start + $perpage - 1); $vars->set('page', $page); $pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $total, 'url' => $refresh_url, 'page_count' => 10, 'perpage' => $perpage)); $page_caption = $pager->render(); } $headers = array(); foreach ($columns as $head) { $hdr = array('class' => ''); $sort = null; switch ($head) { case 'type': $hdr['width'] = '3%'; $hdr['label'] = _("Type"); $hdr['align'] = 'right'; $hdr['id'] = 's' . Gollem::SORT_TYPE; $sort = Gollem::SORT_TYPE; break; case 'name':
/** * @TODO: these should be injected when we refactor to Horde_View * @global $prefs * @global $session */ public function display() { global $prefs, $session; $driver = $GLOBALS['injector']->getInstance('Turba_Factory_Driver')->create(Turba::$source); $hasDelete = $driver->hasPermission(Horde_Perms::DELETE); $hasEdit = $driver->hasPermission(Horde_Perms::EDIT); $hasExport = $GLOBALS['conf']['menu']['import_export'] && !empty($GLOBALS['cfgSources'][Turba::$source]['export']); $vars = Horde_Variables::getDefaultVariables(); list($addToList, $addToListSources) = $this->getAddSources(); if ($this->type == 'search') { $page = $vars->get('page', 0); $numitem = count($this); $maxpage = $prefs->getValue('maxpage'); $perpage = $prefs->getValue('perpage'); $min = $page * $perpage; while ($min > $numitem) { $page--; $min = $page * $perpage; } $max = $min + $perpage; $start = $page * $perpage + 1; $end = min($numitem, $start + $perpage - 1); $listHtml = $this->getPage($numDisplayed, $min, $max, $vars->get('page')); $crit = array(); if ($session->get('turba', 'search_mode') == 'advanced') { $map = $driver->getCriteria(); foreach (array_keys($map) as $key) { if ($key != '__key' && !empty($vars->{$key})) { $crit[$key] = $vars->{$key}; } } } $params = array_merge($crit, array('criteria' => $vars->criteria, 'val' => $vars->val, 'source' => $vars->get('source', Turba::$source))); $viewurl = Horde::url('search.php')->add($params); $pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $numitem, 'url' => $viewurl, 'page_limit' => $maxpage, 'perpage' => $perpage)); $pager->preserve('search', $vars->get('search')); $pagerHeader = 'numPager.inc'; } else { if (count($this) > $prefs->getValue('perpage')) { $page = $vars->get('page', 'A'); if (!preg_match('/^[A-Za-z*]$/', $page)) { $page = 'A'; } } else { $page = $vars->get('page', '*'); if (!preg_match('/^[A-Za-z*]$/', $page)) { $page = '*'; } } $listHtml = $this->getAlpha($numDisplayed, $page); $pagerHeader = 'alphaPager.inc'; $viewurl = Horde::url('browse.php')->add(array('show' => $vars->get('show', 'all'))); if (isset($vars->key)) { $viewurl->add('key', $vars->key); } } if ($numDisplayed) { $copymove_source_options = ''; foreach ($GLOBALS['copymoveSources'] as $key => $curSource) { if ($key != Turba::$source) { $copymove_source_options .= '<option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($curSource['title']) . '</option>'; } } require TURBA_TEMPLATES . '/browse/actions.inc'; require TURBA_TEMPLATES . '/list/' . $pagerHeader; echo $listHtml; } else { require TURBA_TEMPLATES . '/list/' . $pagerHeader; echo '<p><em>' . _("No matching contacts") . '</em></p>'; } }
* See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.horde.org/licenses/gpl. * * @author Duck <*****@*****.**> */ require_once 'tabs.php'; $page = Horde_Util::getFormData('page', 0); $perpage = $prefs->getValue('facesperpage'); $owner = Horde_Util::getGet('owner', $GLOBALS['registry']->getAuth()); if (!$owner) { $title = _("From system galleries"); } elseif ($owner == $GLOBALS['registry']->getAuth()) { $title = _("From my galleries"); } else { $title = sprintf(_("From galleries of %s"), $owner); } try { $count = $faces->countOwnerFaces($owner); $results = $faces->ownerFaces($owner, $page * $perpage, $perpage); } catch (Ansel_Exception $e) { $notification->push($e->getMessage(), 'horde.err'); $results = array(); $count = 0; } $vars = Horde_Variables::getDefaultVariables(); $pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $count, 'url' => 'faces/search/owner.php', 'perpage' => $perpage)); $pager->preserve('owner', $owner); $page_output->header(array('title' => $title)); $notification->notify(array('listeners' => 'status')); include ANSEL_TEMPLATES . '/faces/faces.inc'; $page_output->footer();
if ($form->isSubmitted() || $thread_page != null) { $form->getInfo($vars, $info); if (!empty($info['keywords'])) { $info['keywords'] = preg_split('/\\s+/', $info['keywords']); } $sort_by = Agora::getSortBy('thread'); $sort_dir = Agora::getSortDir('thread'); $thread_per_page = $prefs->getValue('thread_per_page'); $thread_start = $thread_page * $thread_per_page; $searchResults = $messages->search($info, $sort_by, $sort_dir, $thread_start, $thread_per_page); if ($searchResults instanceof PEAR_Error) { $notification->push($searchResults->getMessage(), 'horde.error'); Horde::url('search.php')->redirect(); } if ($searchResults['total'] > count($searchResults['results'])) { $pager_ob = new Horde_Core_Ui_Pager('thread_page', $vars, array('num' => $searchResults['total'], 'url' => 'search.php', 'perpage' => $thread_per_page)); foreach ($info as $key => $val) { if ($val) { if ($key == 'keywords') { $val = implode(' ', $val); } $pager_ob->preserve($key, $val); } } $view->pager_link = $pager_ob->render(); } $view->searchTotal = number_format($searchResults['total']); $view->searchResults = $searchResults['results']; } Horde::startBuffer(); $notification->notify(array('listeners' => 'status'));
$section = $vars->section; $types = Vilma::getUserMgrTypes(); if (!isset($types[$section])) { $vars->section = $section = 'all'; } $tabs = Vilma::getUserMgrTabs($vars); try { $addresses = $vilma->driver->getAddresses($curdomain['domain_name'], $section); } catch (Exception $e) { $notification->push($e); Horde::url('index.php', true)->redirect(); } // Page results $perpage = $prefs->getValue('addresses_perpage'); $url = Horde::url('users/index.php')->add('section', $section); $pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => count($addresses), 'url' => $url, 'page_count' => 10, 'perpage' => $perpage)); $addresses = array_slice($addresses, $vars->page * $perpage, $perpage); foreach ($addresses as &$address) { $type = $address['type']; $id = $address['id']; switch ($type) { case 'alias': $address['edit_url'] = Horde::url('users/editAlias.php')->add(array('alias' => $id, 'section' => $section)); $address['add_alias_url'] = $address['add_forward_url'] = false; break; case 'forward': $address['edit_url'] = Horde::url('users/editForward.php')->add(array('forward' => $id, 'section' => $section)); $address['add_alias_url'] = $address['add_forward_url'] = false; break; default: $params = array('address' => $id, 'section' => $section);