* The rest Copyright 2002-2004 (c) GForge Team
* http://gforge.org/
*
- * @version $Id$
- *
* This file is part of GForge.
*
* GForge is free software; you can redistribute it and/or modify
*/
-require_once('pre.php');
-require_once('common/frs/FRSPackage.class');
-require_once('common/frs/FRSRelease.class');
-require_once('common/frs/FRSFile.class');
-require_once('www/frs/include/frs_utils.php');
+require_once('../../env.inc.php');
+require_once $gfwww.'include/pre.php';
+require_once $gfcommon.'frs/FRSPackage.class.php';
+require_once $gfcommon.'frs/FRSRelease.class.php';
+require_once $gfcommon.'frs/FRSFile.class.php';
+require_once $gfwww.'frs/include/frs_utils.php';
$group_id = getIntFromRequest('group_id');
$package_id = getIntFromRequest('package_id');
exit_error('Error',$frsr->getErrorMessage());
}
-//we make sure we are not receiving $sys_ftp_upload_dir by POST or GET, to prevent security problems
-global $sys_ftp_upload_dir;
-if (!$sys_ftp_upload_dir) {
- exit_error('Error','External sys_ftp_upload_dir detected');
-}
-$upload_dir = $sys_ftp_upload_dir . "/" . $g->getUnixName();
+$upload_dir = forge_get_config('ftp_upload_dir') . "/" . $g->getUnixName();
/*
if (!is_uploaded_file($uploaded_notes['tmp_name'])) {
exit_error('Error','Attempted File Upload Attack');
}
- $notes = addslashes(fread(fopen($uploaded_notes['tmp_name'],'r'),$uploaded_notes['size']));
- if (strlen($notes) < 20) {
- $feedback .= $Language->getText('project_admin_editrelease','release_notes_too_small');
+ if ($uploaded_notes['type'] !== 'text/plain') {
+ $feedback .= _('Release Notes Are not in Text');
$exec_changes = false;
+ } else {
+ $notes = addslashes(fread(fopen($uploaded_notes['tmp_name'],'r'),$uploaded_notes['size']));
+ if (strlen($notes) < 20) {
+ $feedback .= _('Release Notes Are Too Small');
+ $exec_changes = false;
+ }
}
} else {
$notes = $release_notes;
if (!is_uploaded_file($uploaded_changes['tmp_name'])) {
exit_error('Error','Attempted File Upload Attack');
}
- $changes = addslashes(fread(fopen($uploaded_changes['tmp_name'],'r'), $uploaded_changes['size']));
- if (strlen($changes) < 20) {
- $feedback .= $Language->getText('project_admin_editrelease','changelog_too_small');
+ if ($uploaded_changes['type'] !== 'text/plain') {
+ $feedback .= _('Change Log Is not in Text');
$exec_changes = false;
+ } else {
+ $changes = addslashes(fread(fopen($uploaded_changes['tmp_name'],'r'), $uploaded_changes['size']));
+ if (strlen($changes) < 20) {
+ $feedback .= _('Change Log Is Too Small');
+ $exec_changes = false;
+ }
}
} else {
$changes = $release_changes;
if (!$frsr->update($status_id,$release_name,$notes,$changes,$preformatted,$release_date)) {
exit_error('Error',$frsr->getErrorMessage());
} else {
- $feedback .= $Language->getText('project_admin_editrelease','data_saved');
+ $feedback .= _('Data Saved');
}
}
}
$userfile = getUploadedFile('userfile');
$userfile_name = $userfile['name'];
$type_id = getIntFromRequest('type_id');
+ $release_date = getStringFromRequest('release_date');
+ $release_date = strtotime($release_date);
$processor_id = getStringFromRequest('processor_id');
// Build a Unix time value from the supplied Y-m-d value
$group_unix_name=group_getunixname($group_id);
$ftp_filename = getStringFromRequest('ftp_filename');
- if (($userfile && is_uploaded_file($userfile['tmp_name'])) || ($sys_use_ftpuploads && $ftp_filename)){
- if ($sys_use_ftpuploads && $ftp_filename && util_is_valid_filename($ftp_filename) && is_file($upload_dir.'/'.$ftp_filename)) {
+ if (($userfile && is_uploaded_file($userfile['tmp_name'])) || (forge_get_config('use_ftpuploads') && $ftp_filename)){
+ if (forge_get_config('use_ftpuploads') && $ftp_filename && util_is_valid_filename($ftp_filename) && is_file($upload_dir.'/'.$ftp_filename)) {
//file was uploaded already via ftp
//use setuid prog to chown it
//$cmd = escapeshellcmd("$sys_ftp_upload_chowner $ftp_filename");
db_rollback();
exit_error('Error',$frsf->getErrorMessage());
}
- $feedback=$Language->getText('project_admin_editrelease','file_released');
+ $feedback=_('File Released');
}
}
}
if (!$frsf->delete()) {
exit_error('Error',$frsf->getErrorMessage());
} else {
- $feedback .= $Language->getText('project_admin_editrelease','file_deleted');
+ $feedback .= _('File Deleted');
}
}
} else {
- exit_error('Error',$Language->getText('general','error_missing_params'));
+ exit_error('Error',_('Missing Parameters'));
}
// Otherwise update the file information
} else {
if (!$frsf->update($type_id,$processor_id,$release_time,$new_release_id)) {
exit_error('Error',$frsf->getErrorMessage());
} else {
- $feedback .= $Language->getText('project_admin_editrelease','file_updated');
+ $feedback .= _('File Updated');
}
}
}
}
-frs_admin_header(array('title'=>$Language->getText('project_admin_editrelease','title'),'group'=>$group_id));
+frs_admin_header(array('title'=>_('Edit Releases'),'group'=>$group_id));
/*
* Show the forms for each step
*/
?>
-<h3><?php echo $Language->getText('project_admin_editrelease','step_1') ?></h3>
+<h3><?php echo _('Step 1: Edit Release') ?></h3>
-<form enctype="multipart/form-data" method="post" action="<?php echo getStringFromServer('PHP_SELF')."?group_id=$group_id&release_id=$release_id&package_id=$package_id"; ?>">
+<form enctype="multipart/form-data" method="post" action="<?php echo getStringFromServer('PHP_SELF')."?group_id=$group_id&release_id=$release_id&package_id=$package_id"; ?>">
<input type="hidden" name="step1" value="1" />
<table border="0" cellpadding="1" cellspacing="1">
<tr>
- <td width="10%"><strong><?php echo $Language->getText('project_admin_editrelease','release_date') ?>:<strong></td>
+ <td width="10%"><strong><?php echo _('Release date') ?>:</strong></td>
<td><input type="text" name="release_date" value="<?php echo date('Y-m-d H:i',$frsr->getReleaseDate()) ?>" size="16" maxlength="16" /></td>
</tr>
<tr>
- <td><strong><?php echo $Language->getText('project_admin_editrelease','release_name') ?>:<strong></td>
+ <td><strong><?php echo _('Release name') ?>:</strong></td>
<td><input type="text" name="release_name" value="<?php echo htmlspecialchars($frsr->getName()); ?>" /></td>
</tr>
<tr>
- <td><strong><?php echo $Language->getText('project_admin_editrelease','status') ?>:</strong></td>
+ <td><strong><?php echo _('Status') ?></strong></td>
<td>
<?php
echo frs_show_status_popup('status_id',$frsr->getStatus());
<tr>
<td colspan="2">
<br />
- <?php echo $Language->getText('project_admin_editrelease','note') ?>
+ <?php echo _('Edit the Release Notes or Change Log for this release of this package. These changes will apply to all files attached to this release.<br />You can either upload the release notes and change log individually, or paste them in together below.') ?>
</td>
</tr>
<tr>
- <td><strong><?php echo $Language->getText('project_admin_editrelease','upload_release_notes') ?>:</strong></td>
+ <td><strong><?php echo _('Upload Release Notes') ?>:</strong></td>
<td><input type="file" name="uploaded_notes" size="30" /></td>
</tr>
<tr>
- <td><strong><?php echo $Language->getText('project_admin_editrelease','upload_change_log') ?>:</strong></td>
+ <td><strong><?php echo _('Upload Change Log') ?>:</strong></td>
<td><input type="file" name="uploaded_changes" size="30" /></td>
</tr>
<tr>
<td colspan="2">
- <strong><?php echo $Language->getText('project_admin_editrelease','paste_release_notes') ?>:</strong><br />
- <textarea name="release_notes" rows="10" cols="60" wrap="soft"><?php echo $frsr->getNotes(); ?></textarea>
+ <strong><?php echo _('Paste The Notes In') ?>:</strong><br />
+ <textarea name="release_notes" rows="10" cols="60"><?php echo $frsr->getNotes(); ?></textarea>
</td>
</tr>
<tr>
<td colspan="2">
- <strong><?php echo $Language->getText('project_admin_editrelease','paste_changelog') ?>:</strong><br />
- <textarea name="release_changes" rows="10" cols="60" wrap="soft"><?php echo $frsr->getChanges(); ?></textarea>
+ <strong><?php echo _('Paste The Change Log In') ?>:</strong><br />
+ <textarea name="release_changes" rows="10" cols="60"><?php echo $frsr->getChanges(); ?></textarea>
</td>
</tr>
<tr>
<td>
<br />
- <input type="checkbox" name="preformatted" value="1" <?php echo (($frsr->getPreformatted())?'checked="checked"':''); ?> /> <?php echo $Language->getText('project_admin_editrelease','preserve_preformatted') ?>
+ <input type="checkbox" name="preformatted" value="1" <?php echo (($frsr->getPreformatted())?'checked="checked"':''); ?> /> <?php echo _('Preserve my pre-formatted text.') ?>
<p>
- <input type="submit" name="submit" value="<?php echo $Language->getText('project_admin_editrelease','submit_refresh') ?>"/></p>
+ <input type="submit" name="submit" value="<?php echo _('Submit/Refresh') ?>"/>
+ </p>
</td>
</tr>
</table>
</form>
-<p> </p>
<hr />
-<h3><?php echo $Language->getText('project_admin_editrelease','step_2') ?></h3>
-<p>
-<form enctype="multipart/form-data" method="post" action="<?php echo getStringFromServer('PHP_SELF')."?group_id=$group_id&release_id=$release_id&package_id=$package_id"; ?>">
-<input type="hidden" name="step2" value="1" />
-<span class="important">
-<?php echo $Language->getText('project_admin_editrelease','add_files_note') ?>
-</span><br />
-<?php echo $Language->getText('project_admin_editrelease','upload_new_file') ?>: <input type="file" name="userfile" size="30" />
-<?php if ($sys_use_ftpuploads) {
+<h3><?php echo _('Step 2: Add Files To This Release') ?></h3>
+<p><?php echo _('Now, choose a file to upload into the system.') ?></p>
+
+<form enctype="multipart/form-data" method="post" action="<?php echo getStringFromServer('PHP_SELF')."?group_id=$group_id&release_id=$release_id&package_id=$package_id"; ?>">
+<input type="hidden" name="step2" value="1" />
+<fieldset><legend><strong><?php echo _("File Name") ?></strong></legend>
+<?php echo _("Upload a new file") ?>: <input type="file" name="userfile" size="30" />
+<?php if (forge_get_config('use_ftpuploads')) {
echo '<p>';
- echo $Language->getText('project_admin_qrs','ftpupload_new_file',array($sys_ftp_upload_host)).'<br />';
- echo $Language->getText('project_admin_qrs','ftpupload_choosefile').'<br />';
+ printf(_('Alternatively, you can use FTP to upload a new file at %1$s'), forge_get_config('ftp_upload_host')).'<br />';
+ echo _('Choose an FTP file instead of uploading:').'<br />';
$arr[]='';
$ftp_files_arr=array_merge($arr,ls($upload_dir,true));
echo html_build_select_box_from_arrays($ftp_files_arr,$ftp_files_arr,'ftp_filename','',false); ?>
</p>
<?php } ?>
+<p>
+<span class="important">
+<?php echo _('NOTE: In some browsers you must select the file in the file-upload dialog and click "OK". Double-clicking doesn\'t register the file.').' ('._('Maximum upload file size:').' '. ini_get('upload_max_filesize')?>)
+</span>
+</p>
+<p>
+<?php echo _('Specify a new URL') ?>: <input type="text" name="userlink" size="50" />
+</p>
+</fieldset>
<table width="60%">
<tr>
<td>
-<h4><?php echo $Language->getText('project_admin_editrelease','file_type') ?>:</h4>
+<strong><?php echo _('File Type') ?>:</strong>
<?php
print frs_show_filetype_popup ('type_id');
?>
</td>
<td>
-<h4><?php echo $Language->getText('project_admin_editrelease','processor_type') ?>:</h4>
+<strong><?php echo _('Processor Type') ?>:</strong>
<?php
print frs_show_processor_popup ('processor_id');
?>
</tr>
</table>
<p>
-<input type="submit" name="submit" value="<?php echo $Language->getText('project_admin_editrelease','add_file') ?>" /></p>
-</form></p>
-<p> </p>
+<input type="submit" name="submit" value="<?php echo _('Add This File') ?>" /></p>
+</form>
<hr />
-<p> </p>
-<h3><?php echo $Language->getText('project_admin_editrelease','step_3') ?></h3>
+<h3><?php echo _('Step 3: Edit Files In This Release') ?></h3>
<?php
// Get a list of files associated with this release
- $res=db_query("SELECT * FROM frs_file WHERE release_id='$release_id'");
+ $res=db_query_params ('SELECT * FROM frs_file WHERE release_id=$1',
+ array($release_id));
$rows=db_numrows($res);
if($rows < 1) {
- print("<span class=\"error\">".$Language->getText('project_admin_editrelease','no_files_in_release')."</span>\n");
+ print("<span class=\"error\">"._('No Files In This Release')."</span>\n");
} else {
- print($Language->getText('project_admin_editrelease','file_list_note')."\n");
- $title_arr[]=$Language->getText('project_admin_editrelease','filename_release').'<br />';
- $title_arr[]=$Language->getText('project_admin_editrelease','processor_update').'<br />';
- $title_arr[]=$Language->getText('project_admin_editrelease','file_type_update').'<br />';
+ print(_('Once you have added files to this release you <strong>must</strong> update each of these files with the correct information or they will not appear on your download summary page.')."\n");
+ $title_arr[]=_('Filename<br />Release').'<br />';
+ $title_arr[]=_('Processor<br />Release Date').'<br />';
+ $title_arr[]=_('File Type<br />Update').'<br />';
echo $GLOBALS['HTML']->listTableTop ($title_arr);
for($x=0; $x<$rows; $x++) {
?>
- <form action="<?php echo getStringFromServer('PHP_SELF')."?group_id=$group_id&release_id=$release_id&package_id=$package_id"; ?>" method="post">
+ <form action="<?php echo getStringFromServer('PHP_SELF')."?group_id=$group_id&release_id=$release_id&package_id=$package_id"; ?>" method="post">
<input type="hidden" name="file_id" value="<?php echo db_result($res,$x,'file_id'); ?>" />
<input type="hidden" name="step3" value="1" />
<tr <?php echo $HTML->boxGetAltRowStyle($x); ?>>
- <td nowrap="nowrap"><?php echo db_result($res,$x,'filename'); ?></td>
+ <td style="white-space: nowrap;"><?php echo db_result($res,$x,'filename'); ?></td>
<td><?php echo frs_show_processor_popup ('processor_id', db_result($res,$x,'processor_id')); ?></td>
<td><?php echo frs_show_filetype_popup ('type_id', db_result($res,$x,'type_id')); ?></td>
</tr>
<tr <?php echo $HTML->boxGetAltRowStyle($x); ?>>
- file:///usr/share/ubuntu-artwork/home/index.html <td>
+ <td>
<?php echo frs_show_release_popup ($group_id, $name='new_release_id',db_result($res,$x,'release_id')); ?>
<input type="text" name="release_time" value="<?php echo date('Y-m-d',db_result($res,$x,'release_time')); ?>" size="10" maxlength="10" />
</td>
- <td><input type="submit" name="submit" value="<?php echo $Language->getText('project_admin_editrelease','update_refresh') ?> " /></td>
+ <td><input type="submit" name="submit" value="<?php echo _('Update/Refresh') ?> " /></td>
</tr>
</form>
<td> </td>
<td>
- <input type="submit" name="submit" value="<?php echo $Language->getText('project_admin_editrelease','delete_file') ?> " /> <input type="checkbox" name="im_sure" value="1" /> <?php echo $Language->getText('project_admin_editrelease','i_am_sure') ?>
+ <input type="submit" name="submit" value="<?php echo _('Delete File') ?> " /> <input type="checkbox" name="im_sure" value="1" /> <?php echo _('I\'m Sure') ?>
</td>
</tr>
echo $GLOBALS['HTML']->listTableBottom();
}
-echo '<br />'.$Language->getText('project_admin_editrelease', 'monitor_count', array($frsp->getMonitorCount()));
+echo '<p>' . sprintf(ngettext('There is %1$s user monitoring this package.', 'There are %1$s users monitoring this package.', $frsp->getMonitorCount()), $frsp->getMonitorCount()) . '</p>';
echo '<hr />';
frs_admin_footer();
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
?>