Exemplo n.º 1
0
function commits_header($params)
{
    global $group_id, $Language;
    $params['toptab'] = 'cvs';
    $params['group'] = $group_id;
    $pm = ProjectManager::instance();
    $project = $pm->getProject($group_id);
    if (!$project->usesCVS()) {
        exit_error($Language->getText('global', 'error'), $Language->getText('cvs_commit_utils', 'error_off'));
    }
    echo site_project_header($params);
    echo '<P><B><A HREF="/cvs/?func=info&group_id=' . $group_id . '">' . $Language->getText('cvs_commit_utils', 'menu_info') . '</A>';
    if ($project->isPublic() || user_isloggedin()) {
        $uri = session_make_url('/cvs/viewvc.php/?root=' . $project->getUnixName(false) . '&roottype=cvs');
        echo ' | <A HREF="' . $uri . '">' . $Language->getText('cvs_commit_utils', 'menu_browse') . '</A>';
    }
    if (user_isloggedin()) {
        echo ' | <A HREF="/cvs/?func=browse&group_id=' . $group_id . '&set=my">' . $Language->getText('cvs_commit_utils', 'menu_my') . '</A>';
        echo ' | <A HREF="/cvs/?func=browse&group_id=' . $group_id . '">' . $Language->getText('cvs_commit_utils', 'menu_query') . '</A>';
    }
    if (user_ismember($group_id, 'A')) {
        echo ' | <A HREF="/cvs/?func=admin&group_id=' . $group_id . '">' . $Language->getText('cvs_commit_utils', 'menu_admin') . '</A>';
    }
    if (!isset($params['help'])) {
        $params['help'] = "cvs.html";
    }
    echo ' | ' . help_button($params['help'], false, $Language->getText('global', 'help'));
    echo '</B>';
    echo ' <hr width="300" size="1" align="left" noshade>';
}
Exemplo n.º 2
0
 /**
  * Check access permissions for wiki and wiki pages.
  *
  * Check restriction for:
  *  wiki: whole wiki can be restricted.
  *  wikipage: each page of the wiki can be restricted.
  */
 function checkPermissions()
 {
     // Check if user can access to whole wiki
     if (!$this->wiki->isAutorized(user_getid())) {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_phpwiki_wikiservice', 'acces_denied_whole', session_make_url("/project/memberlist.php?group_id=" . $this->gid)), CODENDI_PURIFIER_DISABLED);
         exit_permission_denied();
     }
     // Check if user can access to selected page
     if (!empty($_REQUEST['pagename'])) {
         $wp = new PHPWikiPage($this->gid, $_REQUEST['pagename']);
         if (!$wp->isAutorized(user_getid())) {
             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_phpwiki_wikiservice', 'acces_denied_page', session_make_url("/project/memberlist.php?group_id=" . $this->gid)), CODENDI_PURIFIER_DISABLED);
             exit_permission_denied();
         }
     }
 }
Exemplo n.º 3
0
 $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")) {
             $prefix_title = basename($path) . ' - ';
         }
         $GLOBALS['HTML']->addStylesheet('/viewvc-static/styles.css');
         svn_header(array('title' => $prefix_title . $Language->getText('svn_utils', 'browse_tree'), 'path' => '/' . urlencode(viewvc_utils_getfile("/svn/viewvc.php"))));
     }
     viewvc_utils_passcommand();
     if ($display_header_footer) {
         site_footer(array());
     }
Exemplo n.º 4
0
require_once 'www/file/file_utils.php';
list(, $group_id, $file_id) = explode('/', $_SERVER['PATH_INFO']);
// Must have a group_id and file_id otherwise
// we cannot do much
$vGroupId = new Valid_groupId();
$vGroupId->required();
$vFileId = new Valid_UInt();
$vFileId->required();
if (!$vFileId->validate($file_id) || !$vGroupId->validate($group_id)) {
    exit_missing_param();
}
// Now make an innerjoin on the 4 tables to be sure
// that the file_id we have belongs to the given group_id
$frsff = new FRSFileFactory();
$file =& $frsff->getFRSFileFromDb($file_id, $group_id);
if (!$file || $file->isError()) {
    exit_error($Language->getText('file_download', 'incorrect_release_id'), $Language->getText('file_download', 'report_error', $GLOBALS['sys_name']));
}
// Check permissions for downloading the file, and check that the file has the active status
if (!$file->userCanDownload() || !$file->isActive()) {
    exit_error($Language->getText('file_download', 'access_denied'), $Language->getText('file_download', 'access_not_authorized', session_make_url("/project/memberlist.php?group_id={$group_id}")));
}
if (!$file->fileExists()) {
    exit_error($Language->getText('global', 'error'), $Language->getText('file_download', 'file_not_available'));
}
// Log the download in the Log system
$file->logDownload(user_getid());
// Start download
if (!$file->download()) {
    exit_error($Language->getText('global', 'error'), $Language->getText('file_download', 'file_not_available'));
}
Exemplo n.º 5
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();
}
Exemplo n.º 6
0
//	Originally written by Laurent Julliard 2001- 2003 Codendi Team, Xerox
//
if (!$group_id) {
    exit_no_group();
    // need a group_id !!!
}
commits_header(array('title' => $Language->getText('cvs_intro', 'title')));
// Table for summary info
print '<TABLE width="100%"><TR valign="top"><TD width="65%">' . "\n";
// Get group properties
$res_grp = db_query("SELECT * FROM groups WHERE group_id={$group_id}");
$row_grp = db_fetch_array($res_grp);
// Show CVS access information
if ($row_grp['cvs_preamble'] != '') {
    echo util_unconvert_htmlspecialchars($row_grp['cvs_preamble']);
} else {
    include $Language->getContent('cvs/intro');
}
// Summary info
print '</TD><TD width="25%">';
print $HTML->box1_top($Language->getText('cvs_intro', 'repo_history'));
echo format_cvs_history($group_id);
// CVS Browsing Box
$uri = session_make_url('/cvs/viewvc.php/?root=' . $row_grp['unix_group_name'] . '&roottype=cvs');
print '<HR><B>' . $Language->getText('cvs_intro', 'browse_title') . '</B>
<P>' . $Language->getText('cvs_intro', 'browse_msg') . '
<UL>
<LI><A href="' . $uri . '"><B>' . $Language->getText('cvs_commit_utils', 'menu_browse') . '</B></A></LI>';
print $HTML->box1_bottom();
print '</TD></TR></TABLE>';
commits_footer(array());
 function getContent()
 {
     $request =& HTTPRequest::instance();
     $group_id = $request->get('group_id');
     $pm = ProjectManager::instance();
     $project = $pm->getProject($group_id);
     if ($project->usesHomePage()) {
         print "<A ";
         if (substr($project->getHomePage(), 0, 1) != "/") {
             // Absolute link -> open new window on click
             print "target=_blank ";
         }
         print 'href="' . $project->getHomePage() . '">';
         html_image("ic/home16b.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'homepage')));
         print '&nbsp;' . $GLOBALS['Language']->getText('include_project_home', 'proj_home') . '</A>';
     }
     // ################## forums
     if ($project->usesForum()) {
         print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getForumPage() . '">';
         html_image("ic/notes16.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'public_forums')));
         print '&nbsp;' . $GLOBALS['Language']->getText('include_project_home', 'public_forums') . '</A>';
         $res_count = db_query("SELECT count(forum.msg_id) AS count FROM forum,forum_group_list WHERE " . "forum_group_list.group_id={$group_id} AND forum.group_forum_id=forum_group_list.group_forum_id " . "AND forum_group_list.is_public=1");
         $row_count = db_fetch_array($res_count);
         $pos = strpos($project->getForumPage(), '/forum/');
         if ($pos === 0) {
             print ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'msg', $row_count['count']) . ' ';
             $res_count = db_query("SELECT count(*) AS count FROM forum_group_list WHERE group_id={$group_id} " . "AND is_public=1");
             $row_count = db_fetch_array($res_count);
             print $GLOBALS['Language']->getText('include_project_home', 'forums', $row_count['count']) . " )\n";
         }
         /*
             $sql="SELECT * FROM forum_group_list WHERE group_id='$group_id' AND is_public=1";
             $res2 = db_query ($sql);
             $rows = db_numrows($res2);
             for ($j = 0; $j < $rows; $j++) {
                 echo '<BR> &nbsp; - <A HREF="forum.php?forum_id='.db_result($res2, $j, 'group_forum_id').'&et=0">'.
                     db_result($res2, $j, 'forum_name').'</A> ';
                 //message count
                 echo '('.db_result(db_query("SELECT count(*) FROM forum WHERE group_forum_id='".db_result($res2, $j, 'group_forum_id')."'"),0,0).' msgs)';
             }
         */
     }
     // ##################### Doc Manager (only for Active)
     if ($project->usesDocman()) {
         print '
         <HR SIZE="1" width="99%" NoShade>
         <A href="/docman/?group_id=' . $group_id . '">';
         html_image("ic/docman16b.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'doc')));
         print '&nbsp;' . $GLOBALS['Language']->getText('include_project_home', 'doc_man') . '</A>';
         /*
             $res_count = db_query("SELECT count(*) AS count FROM support WHERE group_id=$group_id");
             $row_count = db_fetch_array($res_count);
             $res_count = db_query("SELECT count(*) AS count FROM support WHERE group_id=$group_id AND support_status_id='1'");
             $row_count2 = db_fetch_array($res_count);
             print " ( <B>$row_count2[count]</B>";
             print " open requests, <B>$row_count[count]</B> total )";
         */
     }
     // ##################### Mailing lists (only for Active)
     if ($project->usesMail()) {
         print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getMailPage() . '">';
         html_image("ic/mail16b.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'mail_lists')));
         print '&nbsp;' . $GLOBALS['Language']->getText('include_project_home', 'mail_lists') . '</A>';
         $res_count = db_query("SELECT count(*) AS count FROM mail_group_list WHERE group_id={$group_id} AND is_public=1");
         $row_count = db_fetch_array($res_count);
         print ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'public_mail_lists', $row_count['count']) . ' )';
     }
     // ######################### Wiki (only for Active)
     if ($project->usesWiki()) {
         print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getWikiPage() . '">';
         html_image("ic/wiki.png", array('width' => '18', 'height' => '12', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'wiki')));
         print ' ' . $GLOBALS['Language']->getText('include_project_home', 'wiki') . '</A>';
         $wiki = new Wiki($group_id);
         $pos = strpos($project->getWikiPage(), '/wiki/');
         if ($pos === 0) {
             echo ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'nb_wiki_pages', $wiki->getProjectPageCount()) . ' )';
         }
     }
     // ######################### Surveys (only for Active)
     if ($project->usesSurvey()) {
         print '<HR SIZE="1" width="99%" NoShade><A href="/survey/?group_id=' . $group_id . '">';
         html_image("ic/survey16b.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'surveys')));
         print ' ' . $GLOBALS['Language']->getText('include_project_home', 'surveys') . '</A>';
         $sql = "SELECT count(*) from surveys where group_id='{$group_id}' AND is_active='1'";
         $result = db_query($sql);
         echo ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'nb_surveys', db_result($result, 0, 0)) . ' )';
     }
     // ######################### CVS (only for Active)
     if ($project->usesCVS()) {
         print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getCvsPage() . '">';
         html_image("ic/cvs16b.png", array('width' => '20', 'height' => '20', 'alt' => 'CVS'));
         print ' ' . $GLOBALS['Language']->getText('include_project_home', 'cvs_repo') . '</A>';
         // LJ Cvs checkouts added
         $sql = "SELECT SUM(cvs_commits) AS commits, SUM(cvs_adds) AS adds, SUM(cvs_checkouts) AS checkouts from stats_project where group_id='{$group_id}'";
         $result = db_query($sql);
         $cvs_commit_num = db_result($result, 0, 0);
         $cvs_add_num = db_result($result, 0, 1);
         $cvs_co_num = db_result($result, 0, 2);
         if (!$cvs_commit_num) {
             $cvs_commit_num = 0;
         }
         if (!$cvs_add_num) {
             $cvs_add_num = 0;
         }
         if (!$cvs_co_num) {
             $cvs_co_num = 0;
         }
         $uri = session_make_url('/cvs/viewvc.php/?root=' . $project->getUnixName(false) . '&roottype=cvs');
         echo ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'commits', $cvs_commit_num) . ', ' . $GLOBALS['Language']->getText('include_project_home', 'adds', $cvs_add_num) . ', ' . $GLOBALS['Language']->getText('include_project_home', 'co', $cvs_co_num) . ' )';
         if ($cvs_commit_num || $cvs_add_num || $cvs_co_num) {
             echo '<br> &nbsp; - <a href="' . $uri . '">' . $GLOBALS['Language']->getText('include_project_home', 'browse_cvs') . '</a>';
         }
     }
     // ######################### Subversion (only for Active)
     if ($project->usesService('svn')) {
         print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getSvnPage() . '">';
         html_image("ic/svn16b.png", array('width' => '20', 'height' => '20', 'alt' => 'Subversion'));
         print ' ' . $GLOBALS['Language']->getText('include_project_home', 'svn_repo') . '</A>';
         $sql = "SELECT SUM(svn_access_count) AS accesses from group_svn_full_history where group_id='{$group_id}'";
         $result = db_query($sql);
         $svn_accesses = db_result($result, 0, 0);
         if (!$svn_accesses) {
             $svn_accesses = 0;
         }
         echo ' ( ' . $GLOBALS['Language']->getText('include_project_home', 'accesses', $svn_accesses) . ' )';
         if ($svn_accesses) {
             $uri = session_make_url('/svn/viewvc.php/?root=' . $project->getUnixName(false) . '&roottype=svn');
             echo '<br> &nbsp; - <a href="' . $uri . '">' . $GLOBALS['Language']->getText('include_project_home', 'browse_svn') . '</a>';
         }
     }
     // ######################### File Releases (only for Active)
     if ($project->usesFile()) {
         echo $project->services['file']->getPublicArea();
     }
     // ######################### Trackers (only for Active)
     if ($project->usesTracker()) {
         print '<HR SIZE="1" width="99%" NoShade><A href="' . $project->getTrackerPage() . '">';
         html_image("ic/tracker20w.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'trackers')));
         print ' ' . $GLOBALS['Language']->getText('include_project_home', 'trackers') . '</A>';
         //
         //  get the Group object
         //
         $pm = ProjectManager::instance();
         $group = $pm->getProject($group_id);
         if (!$group || !is_object($group) || $group->isError()) {
             exit_no_group();
         }
         $atf = new ArtifactTypeFactory($group);
         if (!$group || !is_object($group) || $group->isError()) {
             exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('include_project_home', 'no_arttypefact'));
         }
         // Get the artfact type list
         $at_arr = $atf->getArtifactTypes();
         if (!$at_arr || count($at_arr) < 1) {
             echo '<br><i>' . $GLOBALS['Language']->getText('include_project_home', 'no_trackers_accessible') . '</i>';
         } else {
             for ($j = 0; $j < count($at_arr); $j++) {
                 if ($at_arr[$j]->userCanView()) {
                     echo '<br><i>-&nbsp;
                 <a href="/tracker/?atid=' . $at_arr[$j]->getID() . '&group_id=' . $group_id . '&func=browse">' . $at_arr[$j]->getName() . '</a></i>';
                 }
             }
         }
     }
     // ######################## AnonFTP (only for Active)
     if ($project->isActive()) {
         print '<HR SIZE="1" width="99%" NoShade>';
         list($host, $port) = explode(':', $GLOBALS['sys_default_domain']);
         if ($GLOBALS['sys_disable_subdomains']) {
             $ftp_subdomain = "";
         } else {
             $ftp_subdomain = $project->getUnixName() . ".";
         }
         print "<A href=\"ftp://" . $ftp_subdomain . $host . "/pub/" . $project->getUnixName(false) . "/\">";
         // keep the first occurence in lower case
         print html_image("ic/ftp16b.png", array('width' => '20', 'height' => '20', 'alt' => $GLOBALS['Language']->getText('include_project_home', 'anon_ftp_space')));
         print $GLOBALS['Language']->getText('include_project_home', 'anon_ftp_space') . '</A>';
     }
     // ######################## Plugins
     $areas = array();
     $params = array('project' => &$project, 'areas' => &$areas);
     $em =& EventManager::instance();
     $em->processEvent(Event::SERVICE_PUBLIC_AREAS, $params);
     foreach ($areas as $area) {
         print '<HR SIZE="1" width="99%" NoShade>';
         print $area;
     }
 }
Exemplo n.º 8
0
function util_make_url($loc)
{
    return session_make_url($loc);
}