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;
}
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;
}
"<?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 =
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;
}
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;
}
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);
}
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))
}
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>';
}
<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');
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 =
?></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"'
* 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'] = '';
* along with this program. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
\r
-// Translation (TODO)\r
-function _($text)\r
+ global $languages_list;\r
+ $languages_list = array ('auto' => 'Automatic',\r
+ 'en' => 'English',\r
+ 'fr' => 'Français');\r
+\r
+/* Translation */\r
+function _ ($text)\r
{\r
- return ("$text");\r
+ $cfg = $GLOBALS['cfg'];\r
+ $languages_list = $GLOBALS['languages_list'];\r
+\r
+ /* Detect user's langage if we are in automatic mode. */\r
+ if (strcmp ($cfg['lang'], 'auto') == 0)\r
+ $l = substr ($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);\r
+ else\r
+ $l = $cfg['lang'];\r
+\r
+ /* Is the langage in the list ? */\r
+ $found = false;\r
+ foreach ($languages_list as $key => $v)\r
+ if (strcmp ($l, $key) == 0)\r
+ $found = true;\r
+\r
+ /* Get translation execpt for english. */\r
+ if ($found && strcmp ($l, "en"))\r
+ {\r
+ /* $tr is defined in this requirement. */\r
+ require (JIRAFEAU_ROOT . "lib/lang/$l.php");\r
+\r
+ foreach ($tr as $o => $t)\r
+ if (strcmp ($text, $o) == 0)\r
+ return "$t";\r
+ }\r
+ /* Return original text if no translation is found or already in english. */\r
+ return ($text);\r
}\r
\r
?>
\ No newline at end of file
* 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");
<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> © 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> © 2008-2012 <a href="https://gitorious.org/jirafeau/"><?php echo _('Jirafeau Project'); ?></a></p>
</div>
</div>
<?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);