Fix previous commit by adding forgotten files

This commit is contained in:
Jerome Jutteau 2012-12-28 12:19:30 +01:00
parent 6924499c65
commit 6165f1ef9b
8 changed files with 70 additions and 37 deletions

View File

@ -37,7 +37,7 @@ if (isset ($_GET['h']) && !empty ($_GET['h']))
header ("HTTP/1.0 404 Not Found");
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="error"><p>Error 404: Not Found</p></div>';
echo '<div class="error"><p>' . _('Error 404: Not Found') . '</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
@ -80,8 +80,9 @@ if (isset ($_GET['h']) && !empty ($_GET['h']))
jirafeau_delete ($link_name);
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="error"><p>'.
_('The time limit of this file has expired.' .
'It has been deleted.') . '</p></div>';
_('The time limit of this file has expired.') . ' ' .
_('File has been deleted.') .
'</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
@ -96,9 +97,9 @@ if (isset ($_GET['h']) && !empty ($_GET['h']))
"<?php echo $_SERVER['REQUEST_URI']; ?>" method =
"post"> <input type = "hidden" name = "jirafeau" value =
"<?php echo JIRAFEAU_VERSION; ?>" /><fieldset>
<legend><?php echo _('Key protection');
<legend><?php echo _('Password protection');
?></legend> <table> <tr>
<td><?php echo _('Give the key of this file:');
<td><?php echo _('Give the password of this file:');
?><input type = "password" name =
"key" /></td> </tr> <tr> <td><input type =
"submit" value =
@ -114,7 +115,8 @@ if (isset ($_GET['h']) && !empty ($_GET['h']))
header ("HTTP/1.0 403 Forbidden");
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="error"><p>Error 403: Forbidden</p></div>';
echo '<div class="error"><p>' . _('Error 403: Forbidden') .
'</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
@ -139,7 +141,8 @@ if (isset ($_GET['h']) && !empty ($_GET['h']))
header ("HTTP/1.0 404 Not Found");
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="error"><p>Error 404: Not Found</p></div>';
echo '<div class="error"><p>' . _('Error 404: Not Found') .
'</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}

View File

@ -20,10 +20,10 @@
define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/');
define ('DEBUG', true);
require (JIRAFEAU_ROOT . 'lib/lang.php');
require (JIRAFEAU_ROOT . 'lib/config.php');
require (JIRAFEAU_ROOT . 'lib/settings.php');
require (JIRAFEAU_ROOT . 'lib/functions.php');
require (JIRAFEAU_ROOT . 'lib/lang.php');
/* check if the destination dirs are writable */
$writable = is_writable (VAR_FILES) && is_writable (VAR_LINKS);
@ -63,13 +63,13 @@ if ($writable && isset ($_POST['jirafeau']))
}
if (file_exists (JIRAFEAU_ROOT . 'install.php')
&& !file_exists (JIRAFEAU_ROOT.'lib/config.local.php'))
&& !file_exists (JIRAFEAU_ROOT . 'lib/config.local.php'))
{
header('Location: install.php');
exit;
}
require (JIRAFEAU_ROOT.'lib/template/header.php');
require (JIRAFEAU_ROOT . 'lib/template/header.php');
/* Checking for errors. */
if (!is_writable (VAR_FILES))
@ -108,20 +108,20 @@ if (!has_error () && !empty ($res))
}
echo '<div class="message">'.NL;
echo '<p>'._('File uploaded! Copy the following URL to get it:').
'<br />' . NL;
echo '<p>' . _('File uploaded! Copy the following URL to get it') .
':<br />' . NL;
echo '<a href="'.$link.'">'.$link.'</a>' . NL;
if ($time != JIRAFEAU_INFINITY)
{
echo '<br />'._('This file is valid until the following date:') .
'<br /><strong>' . strftime ('%c', $time) . '</strong>';
echo '<br />' . _('This file is valid until the following date') .
':<br /><strong>' . strftime ('%c', $time) . '</strong>';
}
echo '</p></div>';
echo '<div class="message">' . NL;
echo '<p>' . _('Keep the following URL to delete it:') . '<br />' . NL;
echo '<p>' . _('Keep the following URL to delete it at any moment') . ':<br />' . NL;
echo '<a href="' . $delete_link . '">' . $delete_link . '</a>' . NL;
echo '</p></div>';
}
@ -140,19 +140,19 @@ if (!has_error () && $writable)
<legend><?php echo _('Upload a file');
?></legend> <p><input type = "file" name = "file" size =
"30" /></p> <p class =
"config"><?php printf (_('Maximum file size: %dMB'),
jirafeau_get_max_upload_size () / (1024 *
1024));
"config"><?php printf ('%s: %dMB', _('Maximum file size'),
jirafeau_get_max_upload_size () / (1024 *
1024));
?></p> <p><input type = "submit" value =
"<?php echo _('Send'); ?>" /></p>
<hr /><div id = "moreoptions"> <p><label><input type =
"checkbox" name =
"one_time_download" /><?php echo _('One time download');
?></label></p> <p><label for = "input_key"
><?php echo _('Password:');
><?php echo _('Password') . ':';
?></label> <input type = "text" name = "key" id = "input_key" /></p>
<p><label for = "select_time"
><?php echo _('Time limit:');
><?php echo _('Time limit') . ':';
?></label>
<select name = "time" id = "select_time">
<option value = "none"><?php echo _('None');

View File

@ -262,7 +262,6 @@ case 2:
case 1:
default:
$languages = array ('' => 'English', 'fr_FR.UTF-8' => 'Français');
?><h2><?php printf (_('Installation of Jirafeau - step %d out of %d'),
1, 3);
?></h2> <div id = "install"> <form action =
@ -279,7 +278,7 @@ default:
?></label></td>
<td class = "field">
<select name = "lang" id = "select_lang">
<?php foreach ($languages as $key => $item)
<?php foreach ($languages_list as $key => $item)
{
echo '<option value="'.$key.'"'.($key ==
$cfg['lang'] ? ' selected="selected"'

View File

@ -21,9 +21,10 @@
* if you want to change this, overwrite in a config.local.php file
*/
/* don't forget the ending '/' */
global $cfg;
$cfg['web_root'] = '';
$cfg['var_root'] = '';
$cfg['lang'] = '';
$cfg['lang'] = 'auto';
$cfg['style'] = 'default';
$cfg['rewrite'] = false;
$cfg['password'] = '';

View File

@ -17,10 +17,41 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Translation (TODO)
function _($text)
global $languages_list;
$languages_list = array ('auto' => 'Automatic',
'en' => 'English',
'fr' => 'Français');
/* Translation */
function _ ($text)
{
return ("$text");
$cfg = $GLOBALS['cfg'];
$languages_list = $GLOBALS['languages_list'];
/* Detect user's langage if we are in automatic mode. */
if (strcmp ($cfg['lang'], 'auto') == 0)
$l = substr ($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
else
$l = $cfg['lang'];
/* Is the langage in the list ? */
$found = false;
foreach ($languages_list as $key => $v)
if (strcmp ($l, $key) == 0)
$found = true;
/* Get translation execpt for english. */
if ($found && strcmp ($l, "en"))
{
/* $tr is defined in this requirement. */
require (JIRAFEAU_ROOT . "lib/lang/$l.php");
foreach ($tr as $o => $t)
if (strcmp ($text, $o) == 0)
return "$t";
}
/* Return original text if no translation is found or already in english. */
return ($text);
}
?>

View File

@ -16,16 +16,15 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Jirafeau constants
/* Jirafeau constants */
define ('JIRAFEAU_PACKAGE', 'Jirafeau');
define ('JIRAFEAU_VERSION', '0.4');
// directories
define ('JIRAFEAU_VERSION', '0.9');
/* Directories. */
define ('VAR_FILES', $cfg['var_root'] . 'files/');
define ('VAR_LINKS', $cfg['var_root'] . 'links/');
// useful constants
/* Useful constants. */
if (!defined ('NL'))
define ('NL', "\n");

View File

@ -1,5 +1,5 @@
<div id="copyright">
<p><a href="https://gitorious.org/jirafeau/"><?php echo _('powered by Jirafeau'); ?></a><br /><a href="http://www.gnu.org/licenses/agpl.html">copyright</a> &copy; 2008-2009 <a href="https://gitorious.org/jirafeau/">Jirafeau Project</a></p>
<p><a href="https://gitorious.org/jirafeau/"><?php echo _('powered by Jirafeau'); ?></a><br /><a href="http://www.gnu.org/licenses/agpl.html">copyright</a> &copy; 2008-2012 <a href="https://gitorious.org/jirafeau/"><?php echo _('Jirafeau Project'); ?></a></p>
</div>
</div>

View File

@ -1,10 +1,10 @@
<?php
header("Vary: Accept");
if(stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) {
$content_type = 'application/xhtml+xml; charset=utf-8';
} else {
$content_type = 'text/html; charset=utf-8';
}
$content_type = 'text/html; charset=utf-8';
if (stristr ($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml'))
$content_type = 'application/xhtml+xml; charset=utf-8';
header('Content-Type: ' . $content_type);