function dateSort($a, $b) { if ($a[commitDateTime] == $b[commitDateTime]) { return 0; } return $a[commitDateTime] > $b[commitDateTime] ? -1 : 1; } if (isLoggedIn()) { /* Show the user the most recent changes if they're logged in */ $title = 'Welcome'; $subtitle = Config::get('siteName'); $content = '<h2 class="indent">Recent Activity</h2>' . "\n"; $content .= '<div id="commits" class="indent"></div>' . "\n"; $content .= '<div id="pagination" class="indent pagination"></div><br/>'; $userId = $_SESSION['userId']; $repos = getUserRepositoryIds($userId); /* Get all the repos the user is watching */ $commits = array(); foreach ($repos as &$repo) { /* Get a list of all the commits from those repos */ $commits = array_merge($commits, getLimitedCommits($repo)); } usort($commits, "dateSort"); /* Sort by datetime descending */ $js = 'var commits = new Array('; for ($i = 0; $i < count($commits); $i++) { $js .= ' { "commitMessage": "' . addslashes($commits[$i]['commitMessage']) . '", "commitVal": "' . $commits[$i]['commitVal'] . '", "commitDateTime": "' . $commits[$i]['commitDateTime'] . '", "commitAuthor": "' . $commits[$i]['commitAuthor'] . '", "commitId": "' . $commits[$i]['commitId'] . '",
You should have received a copy of the GNU General Public License along with Repository-Aggregator. If not, see <http://www.gnu.org/licenses/>. */ require_once 'lib/functions.lib.php'; $framework = frameworkDir(); require_once 'config/Config.class.php'; require_once $framework . '/lib/authentication.php'; authorize(); /* Are you allowed here? */ // Library File require_once $framework . '/lib/library.php'; $title = 'Add a Repository'; $subtitle = Config::get('siteName'); $existingRepos = getAllRepositories(); /* Get all the repositories in the database */ $userRepos = getUserRepositoryIds($_SESSION['userId']); /* Get all the repositories of the user */ /* HTML */ $content = <<<EOT <div id="addRepository"> <h3 class="indent">Add a new repository to watch</h3> <form method="POST" action="insertRepository.php" class="indent"> <table> \t\t\t<tr> \t\t\t\t<td> \t\t\t\t\t<label for="name">Project Name:</label> \t\t\t\t</td> \t\t\t\t<td> \t\t\t\t\t<input type="text" id="name" name="name" /> \t\t\t\t</td> \t\t\t</tr>