Fix various stupid warnings
Fix various stupid warnings

--- a/include/display.git_blobdiff_plain.php
+++ b/include/display.git_blobdiff_plain.php
@@ -10,7 +10,7 @@
  include_once('util.prep_tmpdir.php');
  include_once('gitutil.git_diff_print.php');
 
-function git_blobdiff_plain($projectroot,$project,$hash,$hashbase,$hashparent)
+function git_blobdiff_plain($projectroot,$project,$hash,$hashbase,$hashparent,$file)
 {
 	$ret = prep_tmpdir();
 	if ($ret !== TRUE) {

--- a/include/display.git_log.php
+++ b/include/display.git_log.php
@@ -48,23 +48,25 @@
 		$tpl->assign("age_string",$co['age_string']);
 		$tpl->display("log_info.tpl");
 	}
-	for ($i = ($page * 100); $i <= count($revlist); $i++) {
-		$tpl->clear_all_assign();
+	for ($i = ($page * 100); $i < count($revlist); $i++) {
 		$commit = $revlist[$i];
-		$co = git_read_commit($projectroot . $project, $commit);
-		$ad = date_str($co['author_epoch']);
-		$tpl->assign("project",$project);
-		$tpl->assign("commit",$commit);
-		if (isset($refs[$commit]))
-			$tpl->assign("commitref",$refs[$commit]);
-		$tpl->assign("agestring",$co['age_string']);
-		$tpl->assign("title",$co['title']);
-		$tpl->assign("authorname",$co['author_name']);
-		$tpl->assign("rfc2822",$ad['rfc2822']);
-		$tpl->assign("comment",$co['comment']);
-		if (count($co['comment']) > 0)
-			$tpl->assign("notempty",TRUE);
-		$tpl->display("log_item.tpl");
+		if (isset($commit) && strlen($commit) > 1) {
+			$tpl->clear_all_assign();
+			$co = git_read_commit($projectroot . $project, $commit);
+			$ad = date_str($co['author_epoch']);
+			$tpl->assign("project",$project);
+			$tpl->assign("commit",$commit);
+			if (isset($refs[$commit]))
+				$tpl->assign("commitref",$refs[$commit]);
+			$tpl->assign("agestring",$co['age_string']);
+			$tpl->assign("title",$co['title']);
+			$tpl->assign("authorname",$co['author_name']);
+			$tpl->assign("rfc2822",$ad['rfc2822']);
+			$tpl->assign("comment",$co['comment']);
+			if (count($co['comment']) > 0)
+				$tpl->assign("notempty",TRUE);
+			$tpl->display("log_item.tpl");
+		}
 	}
 }
 

--- a/include/display.git_shortlog.php
+++ b/include/display.git_shortlog.php
@@ -42,7 +42,7 @@
 	$tpl->display("shortlog_pagenav.tpl");
 
 	$alternate = FALSE;
-	for ($i = ($page * 100); $i <= count($revlist); $i++) {
+	for ($i = ($page * 100); $i < count($revlist); $i++) {
 		$tpl->clear_all_assign();
 		$commit = $revlist[$i];
 		if (strlen(trim($commit)) > 0) {

--- a/include/gitutil.git_read_commit.php
+++ b/include/gitutil.git_read_commit.php
@@ -26,7 +26,8 @@
 		$tok = strtok(" ");
 	}
 	$commit['parents'] = $parents;
-	$commit['parent'] = $parents[0];
+	if (isset($parents[0]))
+		$commit['parent'] = $parents[0];
 	$comment = array();
 	foreach ($lines as $i => $line) {
 		if (ereg("^tree ([0-9a-fA-F]{40})$",$line,$regs))
@@ -63,6 +64,7 @@
 	$age = time() - $commit['committer_epoch'];
 	$commit['age'] = $age;
 	$commit['age_string'] = age_string($age);
+	date_default_timezone_set("UTC");
 	if ($age > 60*60*24*7*2) {
 		$commit['age_string_date'] = date("Y-m-d",$commit['committer_epoch']);
 		$commit['age_string_age'] = $commit['age_string'];

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -1,5 +1,4 @@
 <?php
-error_reporting(E_ALL | E_STRICT);
 /*
  *  index.php
  *  gitphp: A PHP git repository browser
@@ -56,15 +55,15 @@
 					break;
 				case "tree":
 					include_once('include/display.git_tree.php');
-					git_tree($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f'],$_GET['hb']);
+					git_tree($gitphp_conf['projectroot'], $_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['f']) ? $_GET['f'] : NULL), (isset($_GET['hb']) ? $_GET['hb'] : NULL));
 					break;
 				case "shortlog":
 					include_once('include/display.git_shortlog.php');
-					git_shortlog($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['pg']);
+					git_shortlog($gitphp_conf['projectroot'],$_GET['p'],(isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['pg']) ? $_GET['pg'] : NULL));
 					break;
 				case "log":
 					include_once('include/display.git_log.php');
-					git_log($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['pg']);
+					git_log($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['pg']) ? $_GET['pg'] : NULL));
 					break;
 				case "commit":
 					include_once('include/display.git_commit.php');
@@ -72,12 +71,12 @@
 					break;
 				case "commitdiff":
 					include_once('include/display.git_commitdiff.php');
-					git_commitdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hp']);
+					git_commitdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'], (isset($_GET['hp']) ? $_GET['hp'] : NULL));
 					break;
 				case "commitdiff_plain":
 					$suppress_headers = TRUE;
 					include_once('include/display.git_commitdiff_plain.php');
-					git_commitdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hp']);
+					git_commitdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],(isset($_GET['hp']) ? $_GET['hp'] : NULL));
 					break;
 				case "heads":
 					include_once('include/display.git_heads.php');
@@ -94,30 +93,30 @@
 					break;
 				case "blob":
 					include_once('include/display.git_blob.php');
-					git_blob($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f'],$_GET['hb']);
+					git_blob($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['f']) ? $_GET['f'] : NULL), (isset($_GET['hb']) ? $_GET['hb'] : NULL));
 					break;
 				case "blob_plain":
 					$suppress_headers = TRUE;
 					include_once('include/display.git_blob_plain.php');
-					git_blob_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f']);
+					git_blob_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],(isset($_GET['f']) ? $_GET['f'] : NULL));
 					break;
 				case "blobdiff":
 					include_once('include/display.git_blobdiff.php');
-					git_blobdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'],$_GET['f']);
+					git_blobdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'],(isset($_GET['f']) ? $_GET['f'] : NULL));
 					break;
 				case "blobdiff_plain":
 					$suppress_headers = TRUE;
 					include_once('include/display.git_blobdiff_plain.php');
-					git_blobdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'],$_GET['f']);
+					git_blobdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'], (isset($_GET['f']) ? $_GET['f'] : NULL));
 					break;
 				case "snapshot":
 					$suppress_headers = TRUE;
 					include_once('include/display.git_snapshot.php');
-					git_snapshot($gitphp_conf['projectroot'],$_GET['p'],$_GET['h']);
+					git_snapshot($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL));
 					break;
 				case "history":
 					include_once('include/display.git_history.php');
-					git_history($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f']);
+					git_history($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL),$_GET['f']);
 					break;
 				default:
 					echo "Unknown action";

comments