get rid of some notices, and other tiny clean up. Also start removing blank variables from url's

This commit is contained in:
robert%accettura.com 2005-12-23 01:48:30 +00:00
parent 2ae90d2f22
commit 6ce52ca155
6 changed files with 90 additions and 52 deletions

View File

@ -48,23 +48,57 @@ header("Cache-control: private"); //IE 6 Fix
printheaders();
$content = initializeTemplate();
$content->assign('report_description', $_GET['report_description']);
$content->assign('report_useragent', $_GET['report_useragent']);
$content->assign('report_gecko', $_GET['report_gecko']);
$content->assign('report_language', $_GET['report_language']);
$content->assign('report_platform', $_GET['report_platform']);
$content->assign('report_oscpu', $_GET['report_oscpu']);
$content->assign('product_options', $config['products']);
$content->assign('report_product', $_GET['report_product']);
$content->assign('report_file_date_start', $_GET['report_file_date_start']);
$content->assign('report_file_date_end', $_GET['report_file_date_end']);
$content->assign('show', $_GET['show']);
$content->assign('count', $_GET['count']);
$content->assign('host_hostname', $_GET['host_hostname']);
$content->assign('report_problem_type', $_GET['report_problem_type']);
$content->assign('report_behind_login', $_GET['report_behind_login']);
$content->assign('products', $products);
$content->assign('problem_types', $problemTypes);
if(isset($_GET['report_description'])){
$content->assign('report_description', $_GET['report_description']);
}
if(isset($_GET['report_useragent'])){
$content->assign('report_useragent', $_GET['report_useragent']);
}
if(isset($_GET['report_gecko'])){
$content->assign('report_gecko', $_GET['report_gecko']);
}
if(isset($_GET['report_language'])){
$content->assign('report_language', $_GET['report_language']);
}
if(isset($_GET['report_platform'])){
$content->assign('report_platform', $_GET['report_platform']);
}
if(isset($_GET['report_oscpu'])){
$content->assign('report_oscpu', $_GET['report_oscpu']);
}
if(isset($config['products'])){
$content->assign('product_options', $config['products']);
}
if(isset($_GET['report_product'])){
$content->assign('report_product', $_GET['report_product']);
}
if(isset($_GET['report_file_date_start'])){
$content->assign('report_file_date_start', $_GET['report_file_date_start']);
}
if(isset($_GET['report_file_date_end'])){
$content->assign('report_file_date_end', $_GET['report_file_date_end']);
}
if(isset($_GET['show'])){
$content->assign('show', $_GET['show']);
}
if(isset($_GET['count'])){
$content->assign('count', $_GET['count']);
}
if(isset($_GET['host_hostname'])){
$content->assign('host_hostname', $_GET['host_hostname']);
}
if(isset($_GET['report_problem_type'])){
$content->assign('report_problem_type', $_GET['report_problem_type']);
}
if(isset($_GET['report_behind_login'])){
$content->assign('report_behind_login', $_GET['report_behind_login']);
}
if(isset($products)){
$content->assign('products', $products);
}
if(isset($problemTypes)){
$content->assign('problem_types', $problemTypes);
}
// Remove fields that you can't manually select
foreach ($config['unselectablefields'] as $unselectableChild){
@ -72,7 +106,7 @@ foreach ($config['unselectablefields'] as $unselectableChild){
}
$content->assign('selected_options', $config['fields']);
if ($_GET['selected']){
if (isset($_GET['selected'])){
$content->assign('selected', $_GET['selected']);
}
else {

View File

@ -48,7 +48,7 @@ session_start();
header("Cache-control: private"); //IE 6 Fix
printheaders();
if ($_SESSION['login'] != true){
if (!isset($_SESSION['login']) || $_SESSION['login'] != true){
if(isset($_POST['do_login'])){
$login = false;

View File

@ -63,6 +63,10 @@ $db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = new query;
$query_input = $query->getQueryInputs();
$continuity_params = $query->continuityParams($query_input);
$columnHeaders = $query->columnHeaders($query_input, $continuity_params);
$result = $query->doQuery($query_input['selected'],
$query_input['where'],
$query_input['orderby'],
@ -72,8 +76,6 @@ $result = $query->doQuery($query_input['selected'],
$query_input['count']
);
$continuity_params = $query->continuityParams($query_input);
$output = $query->outputHTML($result, $query_input, $continuity_params, $columnHeaders);
// disconnect database
@ -98,7 +100,7 @@ if($result['totalResults'] < 2000){
}
$content->assign('continuity_params', $continuity_params);
$content->assign('column', $query->columnHeaders($query_input, $continuity_params));
$content->assign('column', $columnHeaders);
$content->assign('row', $output['data']);
$content->assign('continuityParams', $continuity_params[1]);
$content->assign('count', $result['totalResults']);

View File

@ -62,8 +62,6 @@ $query =& $db->Execute("SELECT *
// disconnect database
$db->Close();
$title = "Report for - ".$query->fields['host_hostname'];
$content = initializeTemplate();
if (!$query->fields){
@ -72,6 +70,7 @@ if (!$query->fields){
exit;
}
$title = "Report for ".$query->fields['host_hostname']." - ".$query->fields['report_id'];
$content->assign('report_id', $query->fields['report_id']);
$content->assign('report_url', $query->fields['report_url']);
$content->assign('host_url', $config['base_url'].'/app/query/?host_hostname='.$query->fields['host_hostname'].'&amp;submit_query=Query');
@ -126,8 +125,6 @@ if(isset($_SESSION['reportList'])){
$content->assign('showReportNavigation', false);
}
$title = 'Mozilla Reporter: '.$query->fields['report_id'];
displayPage($content, 'report', 'report.tpl', $title);
?>

View File

@ -49,10 +49,12 @@ class query
function getQueryInputs(){
global $config;
$artificialReportID = false;
/*******************
* ASCDESC
*******************/
if (strtolower($_GET['ascdesc']) == 'asc' || strtolower($_GET['ascdesc']) == 'asc'){
if (isset($_GET['ascdesc']) && (strtolower($_GET['ascdesc']) == 'asc' || strtolower($_GET['ascdesc']) == 'asc')){
$ascdesc = $_GET['ascdesc'];
} else {
$ascdesc = 'desc';
@ -61,21 +63,21 @@ class query
/*******************
* SHOW (really "Limit")
*******************/
if (!$_GET['show']){
if (!isset($_GET['show']) ||
$_GET['show'] == null ||
$_GET['show'] > 200)
{
$show = $config['show'];
} else {
$show = $_GET['show'];
}
// no more than 200 results per page
if (!$_GET['show'] > 200){
$show = 200;
}
/*******************
* PAGE (really other part of "Limit"
*******************/
if (!$_GET['page']){
if (!isset($_GET['page']) ||
$_GET['page'] == null)
{
$page = 1;
} else {
$page = $_GET['page'];
@ -84,6 +86,7 @@ class query
/*******************
* Count
*******************/
$count = null;
if (isset($_GET['count'])){
$count = 'host_id'; // XX limitation for now
}
@ -98,7 +101,7 @@ class query
If user defines what to select and were not counting, just
use their input.
*/
if ($_GET['selected'] && !isset($_GET['count'])){
if (isset($_GET['selected']) && !isset($_GET['count'])){
foreach($_GET['selected'] as $selectedChild){
if(in_array(strtolower($selectedChild), $this->approved_selects)){
$selected[$selectedChild] = $config['fields'][$selectedChild];
@ -115,7 +118,7 @@ class query
* ORDER BY
*******************/
$orderby = array();
if(in_array(strtolower($_GET['orderby']), $this->approved_selects)){
if(isset($_GET['orderby']) && in_array(strtolower($_GET['orderby']), $this->approved_selects)){
$orderby[] = $_GET['orderby'];
}
$orderby = array_merge($orderby, $this->calcOrderBy($selected));
@ -220,15 +223,15 @@ class query
$sql_where .= $where_child[0].' '.$where_child[1].' '.$db->quote($where_child[2]).' AND ';
}
// Dates ar special
// Dates aar special
// if the user didn't delete the default YYYY-MM-DD mask, we do it for them
if ($_GET['report_file_date_start'] == 'YYYY-MM-DD'){
if (isset($_GET['report_file_date_start']) && $_GET['report_file_date_start'] == 'YYYY-MM-DD'){
$_GET['report_file_date_start'] = null;
}
if ($_GET['report_file_date_end'] == 'YYYY-MM-DD'){
if (isset($_GET['report_file_date_end']) && $_GET['report_file_date_end'] == 'YYYY-MM-DD'){
$_GET['report_file_date_end'] = null;
}
if (($_GET['report_file_date_start'] != null) || ($_GET['report_file_date_end'] != null)){
if (isset($_GET['report_file_date_start']) &&(($_GET['report_file_date_start'] != null) || ($_GET['report_file_date_end'] != null))){
// if we have both, we do a BETWEEN
if ($_GET['report_file_date_start'] && $_GET['report_file_date_end']){
@ -274,11 +277,12 @@ class query
/*******************
* Count
*******************/
$sql_groupby = null;
if (isset($_GET['count'])){
$sql_groupby = 'GROUP BY host_id DESC ';
}
$sql = $sql_select." \r".$sql_from." \r".$sql_where." \r".$sql_groupby.$sql_orderby." \r".$sql_subOrder;
$sql = $sql_select." \r".$sql_from." \r".$sql_where." \r".$sql_groupby.$sql_orderby;
// Calculate Start
$start = ($page-1)*$show;
@ -316,9 +320,10 @@ class query
function continuityParams($query_input){
reset($query_input['where']);
$standard = '';
$complete = '';
foreach($query_input['where'] as $node => $item){
if($item[0] == 'report_id' && $query_input['artificialReportID']){
} else {
if(!($item[0] == 'report_id' && $query_input['artificialReportID'])){
if(is_numeric($item[2])){
$standard .= $item[0].'='.$item[2].'&amp;';;
} else {
@ -326,17 +331,17 @@ class query
}
}
}
foreach($query_input['selected'] as $selected_node => $selected_item){
if($selected_node == 'report_id' && $query_input['artificialReportID']){
} else {
if($selected_node == 'count'){
$complete .= 'selected%5B%5D='.$selected_node.'&amp;';
} else {
$standard .= 'selected%5B%5D='.$selected_node.'&amp;';
if(isset($query_input['selected']) && sizeof($query_input['selected']) > 0){
foreach($query_input['selected'] as $selected_node => $selected_item){
if(!($selected_node == 'report_id' && $query_input['artificialReportID'])){
if($selected_node == 'count'){
$complete .= 'selected%5B%5D='.$selected_node.'&amp;';
} else {
$standard .= 'selected%5B%5D='.$selected_node.'&amp;';
}
}
}
}
// make complete = standard + complete
$complete = $standard.$complete;

View File

@ -61,7 +61,7 @@ class securitylib {
}
function isLoggedIn(){
if ($_SESSION['user_username'] && $_SESSION['login'] == true){
if (isset($_SESSION['user_username']) && $_SESSION['login'] == true){
return true;
}
return false;