GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (4873)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/www/file/showfiles.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
//
4
// SourceForge: Breaking Down the Barriers to Open Source Development
5
// Copyright (c) Enalean, 2015. All Rights Reserved.
6
// Copyright 1999-2000 (c) The SourceForge Crew
7
// http://sourceforge.net
8
//
9
// 
10
11
require_once ('pre.php');
12
require_once ('www/file/file_utils.php');
13
require_once ('common/frs/FRSPackageFactory.class.php');
14
require_once ('common/frs/FRSReleaseFactory.class.php');
15
require_once ('common/frs/FRSFileFactory.class.php');
16
require_once ('common/frs/FileModuleMonitorFactory.class.php');
17
require_once ('common/permission/PermissionsManager.class.php');
18
require_once ('common/user/UserManager.class.php');
19
20
define("FRS_EXPANDED_ICON", util_get_image_theme("ic/toggle_minus.png"));
21
define("FRS_COLLAPSED_ICON", util_get_image_theme("ic/toggle_plus.png"));
22
23
$authorized_user = false;
24
25
$request =& HTTPRequest::instance();
26
$vGroupId = new Valid_GroupId();
27
$vGroupId->required();
28
if($request->valid($vGroupId)) {
29
    $group_id = $request->get('group_id');
30
} else {
31
    exit_no_group();
32
}
33
if (user_ismember($group_id, 'R2') || user_ismember($group_id, 'A')) {
34
    $authorized_user = true;
35
}
36
37
$frspf = new FRSPackageFactory();
38
$frsrf = new FRSReleaseFactory();
39
$frsff = new FRSFileFactory();
40
$packages = array();
41
$num_packages = 0;
42
// Retain only packages the user is authorized to access, or packages containing releases the user is authorized to access...
43
$res = $frspf->getFRSPackagesFromDb($group_id);
44
$user = UserManager::instance()->getCurrentUser();
45
foreach ($res as $package) {
0 ignored issues
show
The expression $res of type array|null is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
46
    if ($frspf->userCanRead($group_id, $package->getPackageID(), $user->getId())) {
47
        if ($request->existAndNonEmpty('release_id')) {
48
            if($request->valid(new Valid_UInt('release_id'))) {
49
        	    $release_id = $request->get('release_id');
50
                $row3 = & $frsrf->getFRSReleaseFromDb($release_id);
51
            }             	
52
        }
53
        if (!$request->existAndNonEmpty('release_id') || $row3->getPackageID() == $package->getPackageID()) {
54
            $packages[$package->getPackageID()] = $package;
55
            $num_packages++;
56
        }
57
    }
58
}
59
60
if ($request->valid(new Valid_Pv('pv'))) {
61
    $pv = $request->get('pv');
62
} else {
63
    $pv = false;
64
}
65
66
$hp = Codendi_HTMLPurifier::instance();
67
68
$pm = ProjectManager::instance();
69
$params = array (
70
    'title' => $Language->getText('file_showfiles',
71
    'file_p_for',
72
    $hp->purify($pm->getProject($group_id)->getPublicName())
73
), 'pv' => $pv);
74
75
76
if ($num_packages < 1) {
77
    file_utils_header($params);
78
    echo '<h3>' . $Language->getText('file_showfiles', 'no_file_p') . '</h3><p>' . $Language->getText('file_showfiles', 'no_p_available');
79
    if ($frspf->userCanAdmin($user, $group_id)) {
80
        echo '<p><a href="admin/package.php?func=add&amp;group_id='. $group_id .'">['. $GLOBALS['Language']->getText('file_admin_editpackages', 'create_new_p') .']</a></p>';
81
    }
82
    file_utils_footer($params);
83
    exit;
84
}
85
86
$html = '';
87
88
if ($pv) {
89
    $html .= '<h3>' . $Language->getText('file_showfiles', 'p_releases') . ':</h3>';
90
} else {
91
    $html .= "<TABLE width='100%'><TR><TD>";
92
    $html .= '<h3>' . $Language->getText('file_showfiles', 'p_releases') . ' ' . help_button('frs.html#delivery-manager-jargon') . '</h3>';
93
    $html .= "</TD>";
94
    $html .= "<TD align='left'> ( <A HREF='showfiles.php?group_id=$group_id&pv=1'><img src='" . util_get_image_theme("msg.png") . "' border='0'>&nbsp;" . $Language->getText('global', 'printer_version') . "</A> ) </TD>";
95
    $html .= "</TR></TABLE>";
96
97
    $html .= '<p>' . $Language->getText('file_showfiles', 'select_release') . '</p>';
98
99
}
100
// get unix group name for path
101
$pm = ProjectManager::instance();
102
$group_unix_name = $pm->getProject($group_id)->getUnixName();
103
104
$proj_stats['packages'] = $num_packages;
105
$pm = & PermissionsManager :: instance();
106
$fmmf = new FileModuleMonitorFactory();
107
 
108
$javascript_packages_array = array();
109
 
110
if (!$pv && $frspf->userCanAdmin($user, $group_id)) {
111
    $html .= '<p><a href="admin/package.php?func=add&amp;group_id='. $group_id .'">['. $GLOBALS['Language']->getText('file_admin_editpackages', 'create_new_p') .']</a></p>';
112
}
113
// Iterate and show the packages
114
while (list ($package_id, $package) = each($packages)) {
115
    $can_see_package = false;
116
    if ($package->isActive()) {
117
        $emphasis = 'strong';
118
        $can_see_package = true;
119
    } else if ($package->isHidden()){
120
        $emphasis = 'em';
121
        if ($frspf->userCanAdmin($user, $group_id)) {
122
            $can_see_package = true;
123
        }
124
    }
125
    if ($can_see_package) {
126
        detectSpecialCharactersInName($package->getName(), $GLOBALS['Language']->getText('file_showfiles', 'package'));
127
        $html .= '<fieldset class="package">';
128
        $html .= '<legend>';
129
        if (!$pv) {
130
            $html .= '<a href="#" onclick="javascript:toggle_package(\'p_'.$package_id.'\'); return false;" /><img src="'.FRS_EXPANDED_ICON.'" id="img_p_'.$package_id.'" /></a>&nbsp;';
131
        }
132
        $html .= " <$emphasis>". $hp->purify(util_unconvert_htmlspecialchars($package->getName())) ."</$emphasis>";
133
        if (!$pv) {
134
            if ($frspf->userCanAdmin($user, $group_id)) {
135
                $html .= '     <a href="admin/package.php?func=edit&amp;group_id='. $group_id .'&amp;id=' . $package_id . '" title="'.  $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'edit'), CODENDI_PURIFIER_CONVERT_HTML)  .'">';
136
                $html .= '       '. $GLOBALS['HTML']->getImage('ic/edit.png',array('alt'=> $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'edit'), CODENDI_PURIFIER_CONVERT_HTML) , 'title'=> $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'edit'), CODENDI_PURIFIER_CONVERT_HTML) ));
137
                $html .= '</a>';
138
                //$html .= '     &nbsp;&nbsp;&nbsp;&nbsp;<a href="admin/package.php?func=delete&amp;group_id='. $group_id .'&amp;id=' . $package_id .'" title="'. htmlentities($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), ENT_QUOTES, 'UTF-8') .'" onclick="return confirm(\''. htmlentities($GLOBALS['Language']->getText('file_admin_editpackages', 'warn'), ENT_QUOTES, 'UTF-8') .'\');">'. $GLOBALS['HTML']->getImage('ic/trash.png') .'</a>';
139
            }
140
            $html .= ' &nbsp; ';
141
            $html .= '  <a href="filemodule_monitor.php?filemodule_id=' . $package_id . '&group_id='.$group_id.'">';
142
            if ($fmmf->isMonitoring($package_id, $user, false)) {
143
                $html .= '<img src="'.util_get_image_theme("ic/notification_stop.png").'" alt="'.$Language->getText('file_showfiles', 'stop_monitoring').'" title="'.$Language->getText('file_showfiles', 'stop_monitoring').'" />';
144
            } else {
145
                $html .= '<img src="'.util_get_image_theme("ic/notification_start.png").'" alt="'.$Language->getText('file_showfiles', 'start_monitoring').'" title="'.$Language->getText('file_showfiles', 'start_monitoring').'" />';
146
            }
147
            $html .= '</a>';
148
            if ($frspf->userCanAdmin($user, $group_id)) {
149
                $html .= '     &nbsp;&nbsp;<a href="admin/package.php?func=delete&amp;group_id='. $group_id .'&amp;id=' . $package_id .'" title="'.  $hp->purify($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), CODENDI_PURIFIER_CONVERT_HTML)  .'" onclick="return confirm(\''.  $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'warn'), CODENDI_PURIFIER_CONVERT_HTML)  .'\');">'
150
                            . $GLOBALS['HTML']->getImage('ic/trash.png', array('alt'=> $hp->purify($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), CODENDI_PURIFIER_CONVERT_HTML) , 'title'=>  $hp->purify($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), CODENDI_PURIFIER_CONVERT_HTML) )) .'</a>';
151
            }
152
        }
153
        $html .= '</legend>';
154
        
155
        if ($package->isHidden()) {
156
            //TODO i18n
157
            $html .= '<div style="text-align:center"><em>'.$Language->getText('file_showfiles', 'hidden_package').'</em></div>';
158
        }
159
        // get the releases of the package
160
        // Order by release_date and release_id in case two releases
161
        // are published the same day
162
        $res_release = $frsrf->getFRSReleasesFromDb($package_id, null, $group_id);
163
        $num_releases = count($res_release);
164
    
165
        if (!isset ($proj_stats['releases']))
166
            $proj_stats['releases'] = 0;
167
        $proj_stats['releases'] += $num_releases;
168
    
169
        $javascript_releases_array = array();
170
        $html .= '<div id="p_'.$package_id.'">';
171
        if (!$pv && $frspf->userCanAdmin($user, $group_id)) {
172
            $html .= '<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>';
173
        }
174
        if (!$res_release || $num_releases < 1) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $res_release of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
175
            $html .= '<B>' . $Language->getText('file_showfiles', 'no_releases') . '</B>' . "\n";
176
        } else {
177
            $cpt_release = 0;
178
            // iterate and show the releases of the package
179
            foreach ($res_release as $package_release) {
180
                $can_see_release = false;
181
                if ($frsrf->userCanRead($group_id, $package_id, $package_release->getReleaseID(), $user->getId())) {
182
                    if ($package_release->isActive()) {
183
                        $emphasis = 'strong';
184
                        $can_see_release = true;
185
                    } else if($package_release->isHidden()){
186
                        $emphasis = 'em';
187
                        if ($frspf->userCanAdmin($user, $group_id)) {
188
                            $can_see_release = true;
189
                        }
190
                    }
191
                }
192
                if ($can_see_release) {
193
                    detectSpecialCharactersInName($package_release->getName(), $GLOBALS['Language']->getText('file_showfiles', 'release'));
194
                    
195
                    $permission_exists = $pm->isPermissionExist($package_release->getReleaseID(), 'RELEASE_READ');
196
                    
197
                    // Highlight the release if one was chosen
198
                    if ($request->existAndNonEmpty('release_id')) {
199
                        if($request->valid(new Valid_UInt('release_id'))) {
200
            	            $release_id = $request->get('release_id');
201
            	            if ($release_id == $package_release->getReleaseID()) {
202
            	            	$bgcolor = 'boxitemalt';
203
            	            }
204
                        } else {
205
                            $bgcolor = 'boxitem';
206
                        }
207
                    } else {
208
                        $bgcolor = 'boxitem';
209
                    }
210
                    $html .= '<table width="100%" class="release">';
211
                    $html .= ' <TR id="p_'.$package_id.'r_'.$package_release->getReleaseID().'">';
212
                    $html .= '  <TD>';
213
                    if (!$pv) {
214
                        $html .= '<a href="#" onclick="javascript:toggle_release(\'p_'.$package_id.'\', \'r_'.$package_release->getReleaseID().'\'); return false;" /><img src="'.FRS_EXPANDED_ICON.'" id="img_p_'.$package_id.'r_'.$package_release->getReleaseID().'" /></a>';
215
                    }
216
                    $html .= "     <$emphasis>". $hp->purify($package_release->getName()) . "</$emphasis>";
217
                    if (!$pv) {
218
                        if ($frspf->userCanAdmin($user, $group_id)) {
219
                            $html .= '     <a href="admin/release.php?func=edit&amp;group_id='. $group_id .'&amp;package_id='. $package_id .'&amp;id=' . $package_release->getReleaseID() . '" title="'.  $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'edit'), CODENDI_PURIFIER_CONVERT_HTML)  .'">'
220
                            . $GLOBALS['HTML']->getImage('ic/edit.png',array('alt'=> $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'edit'), CODENDI_PURIFIER_CONVERT_HTML) , 'title'=> $hp->purify($GLOBALS['Language']->getText('file_admin_editpackages', 'edit'), CODENDI_PURIFIER_CONVERT_HTML) )) .'</a>';
221
                        }
222
                        $html .= '&nbsp;';
223
                        $html .= '     <a href="shownotes.php?release_id=' . $package_release->getReleaseID() . '"><img src="'.util_get_image_theme("ic/text.png").'" alt="'.$Language->getText('file_showfiles', 'read_notes').'" title="'.$Language->getText('file_showfiles', 'read_notes').'" /></a>';
224
                    }
225
                    $html .= '  </td>';
226
                    $html .= ' <td style="text-align:center">';
227
                    if ($package_release->isHidden()) {
228
                        $html .= '<em>'.$Language->getText('file_showfiles', 'hidden_release').'</em>';
229
                    } 
230
                    $html .= '</td> ';
231
                    $html .= '  <TD class="release_date">' . format_date("Y-m-d", $package_release->getReleaseDate()) . '';
232
                    if (!$pv && $frspf->userCanAdmin($user, $group_id)) {
233
                        $html .= ' <a href="admin/release.php?func=delete&amp;group_id='. $group_id .'&amp;package_id='. $package_id .'&amp;id=' . $package_release->getReleaseID() . '" title="'.  $hp->purify($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), CODENDI_PURIFIER_CONVERT_HTML)  .'" onclick="return confirm(\''.  $hp->purify($GLOBALS['Language']->getText('file_admin_editreleases', 'warn'), CODENDI_PURIFIER_CONVERT_HTML) .'\');">'
234
                        . $GLOBALS['HTML']->getImage('ic/trash.png', array('alt'=> $hp->purify($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), CODENDI_PURIFIER_CONVERT_HTML) , 'title'=>  $hp->purify($GLOBALS['Language']->getText('file_admin_editreleases', 'delete'), CODENDI_PURIFIER_CONVERT_HTML) )) .'</a>';
235
                    }
236
                    $html .= '</TD></TR>' . "\n";
237
                    $html .= '</table>';
238
                    
239
                    // get the files in this release....
240
                    $res_file = $frsff->getFRSFileInfoListByReleaseFromDb($package_release->getReleaseID());
241
                    $num_files = count($res_file);
242
        
243
                    if (!isset ($proj_stats['files']))
244
                        $proj_stats['files'] = 0;
245
                    $proj_stats['files'] += $num_files;
246
        
247
                    $javascript_files_array = array();
248
                    if (!$res_file || $num_files < 1) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $res_file of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
249
                        $html .= '<span class="files" id="p_'.$package_id.'r_'.$package_release->getReleaseID().'f_0"><B>' . $Language->getText('file_showfiles', 'no_files') . '</B></span>' . "\n";
250
                        $javascript_files_array[] = "'f_0'";
251
                    } else {
252
                        $javascript_files_array[] = "'f_0'";
253
                        //get the file_type and processor type
254
                        $q = "select * from frs_filetype";
255
                        $res_filetype = db_query($q);
256
                        while ($resrow = db_fetch_array($res_filetype)) {
257
                            $file_type[$resrow['type_id']] = $resrow['name'];
258
                        }
259
        
260
                        $q = "select * from frs_processor";
261
                        $res_processor = db_query($q);
262
                        while ($resrow = db_fetch_array($res_processor)) {
263
                            $processor[$resrow['processor_id']] = $resrow['name'];
264
                        }
265
                        
266
                        $html .= '<span class="files" id="p_'.$package_id.'r_'.$package_release->getReleaseID().'f_0">';
267
                        
268
                        $title_arr = array ();
269
                        $title_arr[] = $Language->getText('file_admin_editreleases', 'filename');
270
                        $title_arr[] = $Language->getText('file_showfiles', 'size');
271
                        $title_arr[] = $Language->getText('file_showfiles', 'd_l');
272
                        $title_arr[] = $Language->getText('file_showfiles', 'arch');
273
                        $title_arr[] = $Language->getText('file_showfiles', 'type');
274
                        $title_arr[] = $Language->getText('file_showfiles', 'date');
275
                        $title_arr[] = $Language->getText('file_showfiles', 'md5sum');
276
                        $title_arr[] = $Language->getText('file_showfiles', 'user');
277
                        $html .= html_build_list_table_top($title_arr, false, false, true, null, "files_table") . "\n";
278
                        
279
                        // colgroup is used here in order to avoid table resizing when expand or collapse files, with CSS properties.
280
                        $html .= '<colgroup>';
281
                        $html .= ' <col class="frs_filename_col">';
282
                        $html .= ' <col class="frs_size_col">';
283
                        $html .= ' <col class="frs_downloads_col">';
284
                        $html .= ' <col class="frs_architecture_col">';
285
                        $html .= ' <col class="frs_filetype_col">';
286
                        $html .= ' <col class="frs_date_col">';
287
                        $html .= ' <col class="frs_md5sum_col">';
288
                        $html .= ' <col class="frs_user_col">';
289
                        $html .= '</colgroup>';
290
        
291
                            // now iterate and show the files in this release....
292
                        foreach($res_file as $file_release) {
293
                            $filename = $file_release['filename'];
294
                            $list = split('/', $filename);
295
                            $fname = $list[sizeof($list) - 1];
296
                            $html .= "\t\t" . '<TR id="p_'.$package_id.'r_'.$package_release->getReleaseID().'f_'.$file_release['file_id'].'" class="' . $bgcolor . '"><TD><B>';
297
                            
298
                            $javascript_files_array[] = "'f_".$file_release['file_id']."'";
299
                            
300
                            if (($package->getApproveLicense() == 0) && (isset ($GLOBALS['sys_frs_license_mandatory']) && !$GLOBALS['sys_frs_license_mandatory'])) {
301
                                // Allow direct download
302
                                $html .= '<A HREF="/file/download.php/' . $group_id . "/" . $file_release['file_id'] . "/" . $hp->purify($file_release['filename']) . '" title="' . $file_release['file_id'] . " - " . $hp->purify($fname) . '">' . $hp->purify($fname) . '</A>';
303
                            } else {
304
                                // Display popup
305
                                $html .= '<A HREF="javascript:showConfirmDownload(' . $group_id . ',' . $file_release['file_id'] . ')" title="' . $file_release['file_id'] . " - " . $hp->purify($fname) . '">' . $hp->purify($fname) . '</A>';
306
                            }
307
                            $size_precision = 0;
308
                            if ($file_release['file_size'] < 1024) {
309
                                $size_precision = 2;
310
                            }
311
                            $owner = UserManager::instance()->getUserById($file_release['user_id']);
312
                            $html .= '</B></TD>' . '<TD>' . FRSFile::convertBytesToKbytes($file_release['file_size'], $size_precision) . '</TD>' . '<TD>' . ($file_release['downloads'] ? $file_release['downloads'] : '0') . '</TD>';
313
                            $html .= '<TD>' . (isset ($processor[$file_release['processor']]) ?  $hp->purify($processor[$file_release['processor']], CODENDI_PURIFIER_CONVERT_HTML) : "") . '</TD>';
314
                            $html .= '<TD>' . (isset ($file_type[$file_release['type']]) ? $hp->purify($file_type[$file_release['type']]) : "") . '</TD>' . '<TD>' . format_date("Y-m-d", $file_release['release_time']) . '</TD>'.
315
                                  '<TD>' . (isset ($file_release['computed_md5'])? $hp->purify($file_release['computed_md5']): ""). '</TD>' .
316
                                  '<TD>' . (isset ($file_release['user_id'])? $hp->purify($owner->getRealName()): ""). '</TD>'
317
                            .'</TR>
318
                             <TR>
319
                                <TD class="frs_comment">
320
                                    <p class="help-block">'.
321
                                        $hp->purify($file_release['comment'], CODENDI_PURIFIER_BASIC, $group_id).'
322
                                    </p>
323
                                </TD>
324
                            </TR>';
325
                                 if (!isset ($proj_stats['size']))
326
                                $proj_stats['size'] = 0;
327
                            $proj_stats['size'] += $file_release['file_size'];
328
                            if (!isset ($proj_stats['downloads']))
329
                                $proj_stats['downloads'] = 0;
330
                            $proj_stats['downloads'] += $file_release['downloads'];
331
                        }
332
                        $html .= '</table>';
333
                        $html .= '</span>';
334
                    }
335
                    $javascript_releases_array[] = "'r_".$package_release->getReleaseID()."': [" . implode(",", $javascript_files_array) . "]";
336
                    $cpt_release = $cpt_release + 1;
337
                }
338
            }
339
            if (!$cpt_release) {
340
                $html .= '<B>' . $Language->getText('file_showfiles', 'no_releases') . '</B>' . "\n";
341
            }
342
        }
343
        $html .= '</div>';
344
        $html .= '</fieldset>';
345
        $javascript_packages_array[] = "'p_".$package_id."': {" . implode(",", $javascript_releases_array) . "}";
346
    }
347
}
348
349
file_utils_header($params);
350
?>
351
352
<SCRIPT language="JavaScript">
353
<!--
354
function showConfirmDownload(group_id,file_id) {
355
    url = "/file/confirm_download.php?popup=1&group_id=" + group_id + "&file_id=" + file_id;
356
    wConfirm = window.open(url,"confirm","width=520,height=450,resizable=1,scrollbars=1");
357
    wConfirm.focus();
358
}
359
360
function download(group_id,file_id,filename) {
361
    url = "/file/download.php/" + group_id + "/" + file_id +"/"+filename;
362
    wConfirm.close();
363
    self.location = url;
364
365
}
366
367
function toggle_package(package_id) {
368
    Element.toggle(package_id);
369
    toggle_image(package_id);
370
}
371
372
function toggle_release(package_id, release_id) {
373
    $A(packages[package_id][release_id]).each(function(file_id) {
374
        // toggle the content of the release (the files)
375
        Element.toggle(package_id + release_id + file_id);
376
    });
377
    toggle_image(package_id + release_id);
378
}
379
380
function toggle_image(image_id) {
381
    var img_element = $('img_' + image_id);
382
    if (img_element.src.indexOf('<?php echo FRS_COLLAPSED_ICON; ?>') != -1) {
383
        img_element.src = '<?php echo FRS_EXPANDED_ICON; ?>';
384
    } else {
385
        img_element.src = '<?php echo FRS_COLLAPSED_ICON; ?>';
386
    }
387
}
388
389
-->
390
391
</SCRIPT>
392
<?php
393
echo $html;
394
if (!$pv) {
395
    $javascript_array = 'var packages = {';
396
    $javascript_array .= implode(",", $javascript_packages_array);
397
    $javascript_array .= '}';
398
    print '<script language="javascript">'.$javascript_array.'</script>';
399
    
400
    ?>
401
    
402
    <script language="javascript">
403
    // at page loading, we only expand the first release of the package, and collapse the others
404
    var cpt_release;
405
    $H(packages).keys().each(function(package_id) {
406
        cpt_release = 0;
407
        $H(packages[package_id]).keys().each(function(release_id) {
408
            if (cpt_release > 0) {
409
                //Element.toggle(package_id + release_id);
410
                toggle_release(package_id, release_id); 
411
            }
412
            cpt_release++;
413
        });
414
    });
415
    </script>
416
    
417
    <?php
418
}
419
// project totals (statistics) 
420
if (isset ($proj_stats['size'])) {
421
	
422
    $total_size = FRSFile::convertBytesToKbytes($proj_stats['size']);
423
424
    print '<p>';
425
    print '<b>' . $Language->getText('file_showfiles', 'proj_total') . ': </b>';
426
    print $proj_stats['releases'].' '.$Language->getText('file_showfiles', 'stat_total_nb_releases').', ';
427
    print $proj_stats['files'].' '.$Language->getText('file_showfiles', 'stat_total_nb_files').', ';
428
    print $total_size.' '.$Language->getText('file_showfiles', 'stat_total_size').', ';
429
    print $proj_stats['downloads'].' '.$Language->getText('file_showfiles', 'stat_total_nb_downloads').'.';
430
    print '</p>';
431
}
432
433
file_utils_footer($params);
434