$group_logo_url = util_make_url("/plugins/mediawiki/wiki/" .
$group_unix_name . "/images/.wgLogo.png");
+$incoming = False;
+if (forge_get_config('use_manual_uploads')) {
+ $incoming = forge_get_config('groupdir_prefix')."/$group_unix_name/incoming";
+
+ if ( (! is_dir($incoming)) || (! opendir($incoming)) ) {
+ $error_msg = sprintf( _("Not a directory or could not access contents of %s"), $incoming);
+ }
+}
+
+/* As the cronjob creates images subdirs in project data only if the uploads are enabled, there are chances the upload may fail */
+if (! forge_get_config('enable_uploads', 'mediawiki')) {
+ $error_msg .= _("Mediawiki plugin's configuration may require to enable uploads ('enable_uploads'). Contact your admin.");
+}
+
if (getStringFromRequest("logo_submit")) {
$userfile = getUploadedFile('userfile');
$userfile_name = $userfile['name'];
util_make_url("/plugins/mediawiki/dumps/" . $group_unix_name . ".xml"));
echo "</p>\n";
-echo "<h2>\$wgLogo</h2>\n";
+echo '<h2>'. _("This project's wiki logo : \$wgLogo") . "</h2>\n";
echo '<div style="border:solid 1px black; margin:3px; padding:3px;">';
if (file_exists($group_logo)) {
echo "\n <p>" . _("Current logo:") . ' (<a href="' . $group_logo_url .
<p><?php echo _('Upload a new file') ?>: <input type="file" name="userfile"
size="30" /></p>
<?php if (forge_get_config('use_manual_uploads')) {
-$incoming = forge_get_config('groupdir_prefix')."/$group_unix_name/incoming" ;
-
- echo '<p>';
- printf(_('Alternatively, you can use a file you already uploaded (by SFTP or SCP) to the <a href="%2$s">project\'s incoming directory</a> (%1$s).'),
+ echo '<p>';
+ printf(_('Alternatively, you can use a file you already uploaded (by SFTP or SCP) to the <a href="%2$s">project\'s incoming directory</a> (%1$s).'),
$incoming, "sftp://" . forge_get_config('web_host') . $incoming . "/");
- echo ' ' . _('This direct <tt>sftp://</tt> link only works with some browsers, such as Konqueror.') . '<br />';
- echo _('Choose an already uploaded file:').'<br />';
- $manual_files_arr=ls($incoming,true);
- echo html_build_select_box_from_arrays($manual_files_arr,$manual_files_arr,'manual_filename',''); ?>
- </p>
-<?php } ?>
+ echo ' ' . _('This direct <tt>sftp://</tt> link only works with some browsers, such as Konqueror.') . '<br />';
+ $manual_files_arr=ls($incoming,true);
+ if ( count($manual_files_arr) > 0 ) {
+ echo _('Choose an already uploaded file:').'<br />';
+ echo html_build_select_box_from_arrays($manual_files_arr,$manual_files_arr,'manual_filename','');
+ } else {
+ echo '<input type="hidden" name="manual_filename" value="">';
+ } ?>
+ </p>
+ <?php } ?>
<p><input type="checkbox" name="logo_nuke" value="1" /><?php
echo _("… or delete the currently uploaded logo and revert to the site default"); ?></p>
<p><input type="submit" name="logo_submit" value="<?php echo _("Upload new logo"); ?>" /></p>