Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
Bugdar - Blob - ViewGit - Blue Static
<?php
/*=====================================================================*\
|| ###################################################################
|| # Bugdar
|| # Copyright (c)2004-2009 Blue Static
|| #
|| # This program is free software; you can redistribute it and/or modify
|| # it under the terms of the GNU General Public License as published by
|| # the Free Software Foundation; version 2 of the License.
|| #
|| # This program is distributed in the hope that it will be useful, but
|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|| # more details.
|| #
|| # You should have received a copy of the GNU General Public License along
|| # with this program; if not, write to the Free Software Foundation, Inc.,
|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|| ###################################################################
\*=====================================================================*/

$fetchtemplates = array(
	'trackerhome',
	'trackerhome_bits',
	'list_head',
	'pagenav',
	'pagenav_bit'
);


$focus['index'] = 'focus';

require_once('./global.php');
require_once('./includes/class_sort.php');

if (!can_perform('canviewbugs'))
{
	$message->errorPermission();
}

$sort = new ListSorter('index');

require_once 'includes/pagination.php';
$pagination = new Pagination();
$pagination->processIncomingData();

// ###################################################################

$count = $db->queryFirst("
	SELECT COUNT(*) AS count
	FROM " . TABLE_PREFIX . "bug
	WHERE (!hidden OR (hidden AND product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (hidden AND userid = " . bugdar::$userinfo['userid'] . " AND product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ")
	AND product IN (" . fetch_on_bits('canviewbugs') . ")" . ((bugdar::$options['hidestatuses'] OR isset(bugdar::$userinfo['hidestatuses'])) ? "
	AND status NOT IN (" . (bugdar::$userinfo['hidestatuses'] != '' ? bugdar::$userinfo['hidestatuses'] : bugdar::$options['hidestatuses']) . ")" : "")
);

if (!$count['count'])
{
	$message->error(T('There are no bugs to display. This could be because you do not have permission to view bugs, or there may be none in the database.'));
}

$pagination->setTotal($count['count']);
$pagination->splitPages();

$bugs_fetch = $db->query($sort->fetchSqlQuery(null, $pagination->fetchLimit($pagination->getPage() - 1) . ", " . $pagination->getPerPage()));

foreach ($bugs_fetch as $bug)
{
	BSFunctions::swap_css_classes('altcolor', '');
	$bug = ProcessBugDataForDisplay($bug, BSFunctions::$cssClass);
	$bugs .= $sort->constructRow($bug);
}

$bugs_fetch->free();

$columnHeads = $sort->constructColumnHeaders(true, 'p=' . $pagination->page . '&amp;pp=' . $pagination->perpage);
$show['pagenav'] = ($pagination->getPageCount() > 1);

$tpl = new BSTemplate('trackerhome');
$tpl->vars = array(
	'columnHeads'	=> $columnHeads,
	'bugs'			=> $bugs,
	'pagenav'		=> $pagination->constructPageNav($sort->fetchSortLink($sort->sortkey))
);
$tpl->evaluate()->flush();

?>