From 45f97c3c11bdffe296ccfc853621fd2fff1732a1 Mon Sep 17 00:00:00 2001 From: www-data Date: Wed, 16 Jul 2014 01:05:25 +0200 Subject: [PATCH] reactivated project (dev: http://git-dev.pk910.de) --- htdocs/lib/GitCommand.class.php | 6 ++++-- htdocs/lib/ProjectLoader.class.php | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/lib/GitCommand.class.php b/htdocs/lib/GitCommand.class.php index 86174b5..198cc61 100644 --- a/htdocs/lib/GitCommand.class.php +++ b/htdocs/lib/GitCommand.class.php @@ -68,8 +68,10 @@ class GitCommand { if($ref) $args[] = $ref; $age = self::git_execute($args, $git_path); - preg_match("/[0-9]{9,}/i", $age, $result); - return $result[0]; + if(preg_match("/[0-9]{9,}/i", $age, $result)) + return $result[0]; + else + return -1; } private static function parse_commit($commit_data) { diff --git a/htdocs/lib/ProjectLoader.class.php b/htdocs/lib/ProjectLoader.class.php index 332a6e4..0e2cfdf 100644 --- a/htdocs/lib/ProjectLoader.class.php +++ b/htdocs/lib/ProjectLoader.class.php @@ -23,7 +23,7 @@ class ProjectLoader { $this->projects = array(); if(GitConfig::PROJECT_LIST) { foreach(file(GitConfig::PROJECT_LIST) as $entry) { - $entry = explode(" ", $entry); + $entry = explode(" ", str_replace(array("\r", "\n"), array("", ""), $entry)); if($load_details) { //check if project really exists @@ -33,7 +33,8 @@ class ProjectLoader { } else $project['name'] = $entry[0]; - $project['owner'] = $entry[1]; + if(count($entry) > 1) + $project['owner'] = $entry[1]; $this->projects[] = $project; } } else { @@ -69,7 +70,8 @@ class ProjectLoader { if(strtolower($p['name']) == strtolower($name)) { $found = true; $project['name'] = $p['name']; - $project['owner'] = $p['owner']; + if(isset($p['owner'])) + $project['owner'] = $p['owner']; break; } } -- 2.20.1