Exemplo n.º 1
0
function show_newest_releases()
{
    global $Language;
    $return = "";
    $hp = Codendi_HTMLPurifier::instance();
    // Fetch releases that are no more than 3 months old
    $start_time = strval(time() - 3 * 30 * 24 * 3600);
    $query = new_utils_get_new_releases_short($start_time);
    $res_newrel = db_query($query);
    // print each one but only show one release per project
    $count = 0;
    $DONE = array();
    $frspf = new FRSPackageFactory();
    $frsrf = new FRSReleaseFactory();
    while (($row_newrel = db_fetch_array($res_newrel)) && $count < 10) {
        if (!isset($DONE[$row_newrel['group_id']])) {
            //if ((!permission_exist("PACKAGE_READ",$row_newrel['package_id'] ))&&
            //    (!permission_exist("RELEASE_READ",$row_newrel['release_id'] ))) {
            if ($frspf->userCanRead($row_newrel['group_id'], $row_newrel['package_id'], 100) && $frsrf->userCanRead($row_newrel['group_id'], $row_newrel['package_id'], $row_newrel['release_id'], 100)) {
                $return .= '(' . $hp->purify($row_newrel['release_version'], CODENDI_PURIFIER_CONVERT_HTML) . ')&nbsp;' . '<A href="/projects/' . $row_newrel['unix_group_name'] . '/">' . $hp->purify(util_unconvert_htmlspecialchars($row_newrel['group_name']), CODENDI_PURIFIER_CONVERT_HTML) . "</A><BR>\n";
                $count++;
                $DONE[$row_newrel['group_id']] = true;
            }
        }
    }
    $return .= '<center><A href="/new/?func=releases">[ ' . $Language->getText('include_features_boxes', 'more') . ' ]</A></center>';
    return $return;
}
Exemplo n.º 2
0
 /**
  * Function userCanRead : determine if the user can view this release or not
  *
  * @param int $user_id if not given or 0 take the current user
  * @return boolean true if user has Read access to this release, false otherwise
  */
 function userCanRead($user_id = 0)
 {
     $release_factory = new FRSReleaseFactory();
     return $release_factory->userCanRead($this->getGroupID(), $this->getPackageID(), $this->getReleaseID(), $user_id);
 }
Exemplo n.º 3
0
print " <channel>\n";
print "  <copyright>" . $Language->getText('export_rss_sfnewreleases', 'copyright', array($GLOBALS['sys_long_org_name'], $GLOBALS['sys_name'], date('Y', time()))) . "</copyright>\n";
print "  <pubDate>" . gmdate('D, d M Y g:i:s', time()) . " GMT</pubDate>\n";
print "  <description>" . $Language->getText('export_rss_sfnewreleases', 'new_releases', $GLOBALS['sys_name']) . "</description>\n";
print "  <link>" . get_server_url() . "</link>\n";
print "  <title>" . $Language->getText('export_rss_sfnewreleases', 'new_releases', $GLOBALS['sys_name']) . "</title>\n";
list($host, $port) = explode(':', $GLOBALS['sys_default_domain']);
print "  <webMaster>webmaster@" . $host . "</webMaster>\n";
print "  <language>en-us</language>\n";
// ## item outputs
$outputtotal = 0;
$frspf = new FRSPackageFactory();
$frsrf = new FRSReleaseFactory();
while ($row = db_fetch_array($res)) {
    if (!$G_RELEASE["{$row['group_id']}"]) {
        if ($frspf->userCanRead($row['group_id'], $row['package_id'], 100) && $frsrf->userCanRead($row['group_id'], $row['package_id'], $row_newrel['release_id'], 100)) {
            print "  <item>\n";
            print "   <title>" . htmlspecialchars($row['group_name'] . " " . $row['release_version']) . "</title>\n";
            print "   <link>" . get_server_url() . "/file/showfiles.php?group_id={$row['group_id']}</link>\n";
            print "   <description>" . rss_description($row['short_description']) . "</description>\n";
            print "  </item>\n";
            $outputtotal++;
            // ## eliminate dupes, only do $limit of these
            $G_RELEASE[$row['group_id']] = 1;
            if ($outputtotal >= $limit) {
                break;
            }
        }
    }
}
// ## end output
Exemplo n.º 4
0
     $proj_stats['releases'] = 0;
 }
 $proj_stats['releases'] += $num_releases;
 $javascript_releases_array = array();
 print '<div id="p_' . $package_id . '">';
 if (!$pv && $frspf->userCanAdmin($user, $group_id)) {
     echo '<p><a href="admin/release.php?func=add&amp;group_id=' . $group_id . '&amp;package_id=' . $package_id . '">[' . $GLOBALS['Language']->getText('file_admin_editpackages', 'add_releases') . ']</a></p>';
 }
 if (!$res_release || $num_releases < 1) {
     print '<B>' . $Language->getText('file_showfiles', 'no_releases') . '</B>' . "\n";
 } else {
     $cpt_release = 0;
     // iterate and show the releases of the package
     foreach ($res_release as $package_release) {
         $can_see_release = false;
         if ($frsrf->userCanRead($group_id, $package_id, $package_release->getReleaseID(), $user->getId())) {
             if ($package_release->isActive()) {
                 $emphasis = 'strong';
                 $can_see_release = true;
             } else {
                 if ($package_release->isHidden()) {
                     $emphasis = 'em';
                     if ($frspf->userCanAdmin($user, $group_id)) {
                         $can_see_release = true;
                     }
                 }
             }
         }
         if ($can_see_release) {
             $permission_exists = $pm->isPermissionExist($package_release->getReleaseID(), 'RELEASE_READ');
             // Highlight the release if one was chosen