Copyright 2005-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Автор: Jason Felice (jason.m.felice@gmail.com)
Наследование: extends Horde_Form
Пример #1
0
 * The Agora search page.
 *
 * Copyright 2005-2015 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author  Jason Felice <*****@*****.**>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('agora');
/* Set up the forums object. */
$scope = Horde_Util::getGet('scope', 'agora');
$messages = $injector->getInstance('Agora_Factory_Driver')->create($scope);
$vars = Horde_Variables::getDefaultVariables();
$form = new Agora_Form_Search($vars, $scope);
$thread_page = Horde_Util::getFormData('thread_page');
$view = new Agora_View();
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();