// 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/svn/svn_utils.php'; if (user_isloggedin()) { $vRoot = new Valid_String('root'); $vRoot->required(); if (!$request->valid($vRoot)) { exit_no_group(); } $root = $request->get('root'); $group_id = group_getid_by_name($root); if ($group_id === false) { exit_no_group(); } $vRootType = new Valid_WhiteList('roottype', array('svn')); $vRootType->setErrorMessage($Language->getText('svn_viewvc', 'bad_roottype')); $vRootType->required(); if ($request->valid($vRootType)) { if (!svn_utils_check_access(user_getname(), $root, viewvc_utils_getfile("/svn/viewvc.php"))) { exit_error($Language->getText('svn_viewvc', 'access_denied'), $Language->getText('svn_viewvc', 'acc_den_comment', session_make_url("/project/memberlist.php?group_id={$group_id}"))); } viewvc_utils_track_browsing($group_id, 'svn'); $display_header_footer = viewvc_utils_display_header(); if ($display_header_footer) { $prefix_title = ''; if ($path = viewvc_utils_getfile("/svn/viewvc.php")) {
* input parameters: * group_id : project where references are defined * text : HTML input text * output: HTML text with embedded references (links to goto script) */ require_once 'pre.php'; require_once 'common/include/HTTPRequest.class.php'; require_once 'common/reference/ReferenceManager.class.php'; header('Content-type: text/html'); $reference_manager =& ReferenceManager::instance(); $request =& HTTPRequest::instance(); if (!$request->getValidated('group_id', 'GroupId')) { if (!$request->get('group_name')) { $group_id = 100; } else { $group_id = group_getid_by_name($request->get('group_name')); } } else { $group_id = $request->get('group_id'); } if (!$request->getValidated('text', 'text')) { # Empty string? return empty string... exit; } if ($request->get('help')) { echo $GLOBALS['Language']->getText('project_reference', 'insert_syntax'); exit; } $text = $request->get('text'); echo nl2br(util_make_links(htmlentities($text, ENT_QUOTES, 'UTF-8'), $group_id) . "\n"); exit;
<?php /** * PHP file called by the pre-commit hook */ try { include_once "pre.php"; include_once "common/reference/ReferenceManager.class.php"; $repository = $argv[1]; // retrieve the group name from repository $unix_group_name = substr($repository, strlen($GLOBALS['svn_prefix']) + 1); $group_id = group_getid_by_name($unix_group_name); $project = new Project($group_id); if ($project->isSVNMandatoryRef()) { $ref_manager = ReferenceManager::instance(); // open the standard error output $stderr = fopen('php://stderr', 'w'); $txn = $argv[2]; $logmsg = array(); exec("/usr/bin/svnlook log -t '{$txn}' '{$repository}'", $logmsg); $logmsg = implode("\n", $logmsg); $references_array = array(); $references_array = $ref_manager->extractReferences($logmsg, $project->getId()); if (sizeof($references_array) < 1) { // No reference has been found: commit is rejected fwrite($stderr, "\nYou must make at least one reference in the commit message.\n" . $unix_group_name); fclose($stderr); exit(1); } fclose($stderr); }
function group_get_object_by_name($groupname) { $pm = ProjectManager::instance(); return $pm->getProject(group_getid_by_name($groupname)); }
function get_group_id_from_repository($repository) { return group_getid_by_name(basename($repository)); }