function scripts($js = '') { require_once 'lib/functions.lib.php'; $framework = frameworkDir(); $return = ''; if (preg_match('/index.php$/', this_page())) { $return .= <<<EOT <script src="{$framework}/scripts/jquery/jquery.min.js" language="javascript" type="text/javascript"></script> <script src="{$framework}/scripts/jquery/jquery.pagination.js" language="javascript" type="text/javascript"></script> <script src="{$framework}/scripts/paginationFrontPage.js" language="javascript" type="text/javascript"></script> EOT; } if (preg_match('/viewCommits\\.php$/', this_page())) { $return .= <<<EOT <script src="{$framework}/scripts/jquery/jquery.min.js" language="javascript" type="text/javascript"></script> <script src="{$framework}/scripts/jquery/jquery.pagination.js" language="javascript" type="text/javascript"></script> <script src="{$framework}/scripts/pagination.js" language="javascript" type="text/javascript"></script> EOT; } $return .= '<script src="' . $framework . '/scripts/script.js" language="javascript" type="text/javascript"></script>'; if ($js != '') { $return .= <<<EOT <script type="text/javascript" language="javascript"> \t{$js} </script> EOT; } return $return; /* include relative_address().'/'.frameworkDir().'/scripts/goHome.js'; include relative_address().'/'.frameworkDir().'/scripts/script.js';*/ }
function scripts() { require_once 'lib/functions.lib.php'; $framework = frameworkDir(); return <<<EOT <script src="{$framework}/scripts/script.js" language="javascript" type="text/javascript"></script> EOT; /* include relative_address().'/'.frameworkDir().'/scripts/goHome.js'; include relative_address().'/'.frameworkDir().'/scripts/script.js';*/ }
function authenticate($username, $password) { require_once 'lib/functions.lib.php'; $framework = frameworkDir(); require_once $framework . '/class/Database.class.php'; $link = new Database(); $link->connect(); $sql = 'SELECT * FROM users WHERE username = %1 AND password = %2 '; $result = $link->query($sql, $_POST['username'], md5($_POST['password'])); if (mysql_num_rows($result) == 1) { $data = mysql_fetch_object($result); $link->disconnect(); return $data; } else { $link->disconnect(); return false; } }
function create($repoId, $commitVal, $commitMessage, $commitDateTime, $commitAuthor) { $framework = frameworkDir(); /* Get the directory of the framework */ require_once $framework . '/class/Database.class.php'; $link = new Database(); $link->connect(); $sql = 'INSERT INTO commits VALUES ( NULL, %1 , %2 , %3 , %4 , %5 )'; $result = $link->query($sql, $repoId, $commitVal, $commitMessage, $commitDateTime, $commitAuthor); if (!$result) { die('Could not execute query'); } $this->_commitId = mysql_insert_id($link); $this->_repoId = $repoId; $this->_commitVal = $commitVal; $this->_commitMessage = $commitMessage; $this->_commitDateTime = $commitDateTime; $this->_commitAuthor = $commitAuthor; $link->disconnect(); }
/* Copyright 2009, All Rights Reserved. This file is part of Repository-Aggregator. Repository-Aggregator 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, either version 3 of the License, or (at your option) any later version. Repository-Aggregator 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 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 = 'View Repositories'; $subtitle = Config::get('siteName'); $content = ''; if (isset($_GET['action'])) { switch ($_GET['action']) { case 'added': $content .= '<h3 class="indent">Repository Added Successfully</h3>'; break; case 'watched':
function getLimitedCommits($repoId) { require_once 'class/Repository.class.php'; $framework = frameworkDir(); /* Database */ require_once $framework . '/class/Database.class.php'; $link = new Database(); $link->connect(); /* Query */ $sql = 'SELECT * FROM commits WHERE repoId = %1 ORDER BY commitDateTime DESC LIMIT 50'; $result = $link->query($sql, $repoId); $commits = array(); $files = array(); /* Get Ids */ while ($row = mysql_fetch_array($result)) { $sql = 'SELECT * FROM fileChanges WHERE commitId = %1'; /* Get the changes for the commit */ $fileResult = $link->query($sql, $row['commitId']); /* Fetch all the changes */ while ($fileRow = mysql_fetch_array($fileResult)) { $files[] = array('file' => htmlspecialchars($fileRow['file']), 'insertions' => $fileRow['insertions'], 'deletions' => $fileRow['deletions']); } $sql = 'SELECT name FROM repositories WHERE repoId = %1 '; $repoResult = $link->query($sql, $row['repoId']); $repoName = mysql_fetch_array($repoResult); /* Store the commit data and the changes */ $commits[] = array('commitVal' => $row['commitVal'], 'commitMessage' => htmlspecialchars($row['commitMessage']), 'commitDateTime' => $row['commitDateTime'], 'commitId' => htmlspecialchars($row['commitId']), 'commitAuthor' => htmlspecialchars($row['commitAuthor']), 'fileChanges' => $files, 'repoId' => $row['repoId'], 'repoName' => $repoName['name']); $files = array(); } return $commits; /* Return the repository Ids */ }
function delete() { $framework = frameworkDir(); /* Get the directory of the framework */ require_once $framework . '/class/Database.class.php'; $link = new Database(); $link->connect(); $sql = 'DELETE FROM repositories WHERE repoId = %1 '; $result = $link->query($sql, $this->_repoId); if (!$result) { die('Could not execute query'); } $link->disconnect(); }
function address() { require_once 'lib/functions.lib.php'; return 'http://' . $_SERVER['SERVER_NAME'] . '/aggregator/' . frameworkDir(); }