Exemplo n.º 1
0
function cvs_get_revisions(&$project, $offset, $chunksz, $_tag = 100, $_branch = 100, $_commit_id = '', $_commiter = 100, $_srch = '', $order_by = '', $pv = 0)
{
    //if tag selected, and more to where clause
    if ($_tag != 100) {
        //for open tasks, add status=100 to make sure we show all
        $tag_str = "AND cvs_checkins.stickytag='{$_tag}'";
    } else {
        //no status was chosen, so don't add it to where clause
        $tag_str = '';
    }
    //if status selected, and more to where clause
    if ($_branch != 100) {
        //for open tasks, add status=100 to make sure we show all
        $branch_str = "AND cvs_checkins.branchid='{$_branch}'";
    } else {
        //no status was chosen, so don't add it to where clause
        $branch_str = '';
    }
    //if assigned to selected, and more to where clause
    if ($_commit_id != '') {
        $commit_str = "AND cvs_commits.id='{$_commit_id}' AND cvs_checkins.commitid != 0 ";
    } else {
        $commit_str = '';
    }
    if ($_commiter != 100) {
        $commiter_str = "AND user.user_id=cvs_checkins.whoid " . "AND user.user_name='{$_commiter}' ";
    } else {
        //no assigned to was chosen, so don't add it to where clause
        $commiter_str = '';
    }
    if ($_srch != '') {
        $srch_str = "AND cvs_descs.description like '%" . $_srch . "%' ";
    } else {
        $srch_str = "";
    }
    //build page title to make bookmarking easier
    //if a user was selected, add the user_name to the title
    //same for status
    //commits_header(array('title'=>'Browse Commits'.
    //	(($_assigned_to)?' For: '.user_getname($_assigned_to):'').
    //	(($_tag && ($_tag != 100))?' By Status: '. get_commits_status_nam//e($_status):''),
    //		   'help' => 'CommitsManager.html'));
    // get repository id
    $query = "SELECT id from cvs_repositories where cvs_repositories.repository='/cvsroot/" . $project->getUnixName(false) . "' ";
    $rs = db_query($query);
    $repo_id = db_result($rs, 0, 0);
    $repo_id = $repo_id ? $repo_id : -1;
    $select = 'SELECT distinct cvs_checkins.commitid as id, cvs_checkins.commitid as revision, cvs_descs.id as did, cvs_descs.description, cvs_commits.comm_when as c_when, cvs_commits.comm_when as date, cvs_commits.comm_when as f_when, user.user_name as who ';
    $from = "FROM cvs_descs, cvs_checkins, user, cvs_commits ";
    $where = "WHERE cvs_checkins.descid=cvs_descs.id " . "AND " . (check_cvs_access(user_getname(), $project->getUnixName(false), '') ? 1 : 0) . " " . "AND cvs_checkins.commitid=cvs_commits.id " . "AND user.user_id=cvs_checkins.whoid " . "AND cvs_checkins.repositoryid=" . $repo_id . " " . "{$commiter_str} " . "{$commit_str} " . "{$srch_str} " . "{$branch_str} ";
    if (!$pv) {
        $limit = " LIMIT {$offset},{$chunksz}";
    }
    if (!$order_by) {
        $order_by = " ORDER BY id desc, f_when desc ";
    }
    $sql = $select . $from . $where . $order_by . $limit;
    $result = db_query($sql);
    /* expensive way to have total rows number didn'get a cheaper one */
    $sql1 = $select . $from . $where;
    $result1 = db_query($sql1);
    $totalrows = db_numrows($result1);
    return array($result, $totalrows);
}
Exemplo n.º 2
0
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
//
require_once 'pre.php';
require_once 'viewvc_utils.php';
require_once 'www/cvs/commit_utils.php';
if (user_isloggedin()) {
    // be backwards compatible with old viewvc.cgi links that are now redirected
    if (!$root) {
        $root = $cvsroot;
    }
    $res_grp = db_query("SELECT * FROM groups WHERE unix_group_name='" . $root . "'");
    $row_grp = db_fetch_array($res_grp);
    $group_id = $row_grp['group_id'];
    if (!check_cvs_access(user_getname(), $root, viewvc_utils_getfile("/cvs/viewvc.php"))) {
        exit_error($Language->getText('cvs_viewvc', 'error_noaccess'), $Language->getText('cvs_viewvc', 'error_noaccess_msg', session_make_url("/project/memberlist.php?group_id={$group_id}")));
    }
    viewvc_utils_track_browsing($group_id, 'cvs');
    $display_header_footer = viewvc_utils_display_header();
    if ($display_header_footer) {
        commits_header(array('title' => $Language->getText('cvs_viewvc', 'title'), 'stylesheet' => array('/viewvc-static/styles.css')));
    }
    viewvc_utils_passcommand();
    if ($display_header_footer) {
        site_footer(array());
    }
} else {
    exit_not_logged_in();
}