From: Jerome Jutteau Date: Wed, 5 Dec 2012 17:29:38 +0000 (+0000) Subject: Security fix, bug fix and project name change. X-Git-Tag: 1.0~33 X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/commitdiff_plain/ba6f06965a4d9846e23d99a0e9f74b1361c18c40 Security fix, bug fix and project name change. Security: we can now upload any type of file no matter how they are named. Bug fix: in Jyraphe 0.5 stable, we were not able to add several times the same file with a different link file. --- diff --git a/doc/COPYING b/COPYING similarity index 100% rename from doc/COPYING rename to COPYING diff --git a/clean.sh b/clean.sh deleted file mode 100755 index cb4932b..0000000 --- a/clean.sh +++ /dev/null @@ -1,19 +0,0 @@ -# Jyraphe, your web file repository -# Copyright (C) 2008 Julien "axolotl" BERNARD -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -WD="`dirname $0`" - -rm -f ${WD}/files/* ${WD}/links/* ${WD}/pub/* diff --git a/doc/README b/doc/README deleted file mode 100644 index 505431c..0000000 --- a/doc/README +++ /dev/null @@ -1,48 +0,0 @@ -Jyraphe, your web file repository -================================= - -Jyraphe is a web application of file repository, easy to install and easy to -use. Jyraphe is an entirely free application, it is distributed under the -terms of the GNU Affero General Public License, version 3 or later. See the -COPYING file in this directory. - -For more information, see: -http://home.gna.org/jyraphe/ - -Jyraphe 0.4 (20 april 2009) ---------------------------- - - - SECURITY: possible path traversal by uploading a file R0...0 (32 zeroes) - and calling file.php?h=../files/R0..0 - - BUG: possibility to download a protected file without a key - - FEATURE: better form (without tables) - - -Jyraphe 0.3 (28 may 2008) -------------------------- - - SECURITY: a forged link file could be uploaded and accessed with - get.php?h=../files/forgedfile so that any readable file could be accessed - - FEATURE: install.php script with randomised name of the var/ directory - - FEATURE: password protection - - FEATURE: time limit - - FEATURE: Javascript to show the extended options - - FEATURE: support for multiple CSS and better handling of images in the css - - FEATURE: better Content-Type handling and XHTML validation - - SECURITY: now prevent .php from upload, rename it in .phps - - FEATURE: renamed get.php in file.php (in prevision of thumb.php) - - -Jyrahe 0.2 (22 april 2008) --------------------------- - - SECURITY: .htaccess could be uploaded and change the access of var/ - - BUG: infinite loop when renaming a file in case of a collision - - BUG: warning of the substr_compare when null mime-type - - BUG: substr_compare not defined for old PHP4 - - -Jyraphe 0.1 (12 april 2008) ---------------------------- - - First release of Jyraphe - - KNOWN BUG: when not defining $cgf['web_root'] in config.local.php, and - having $cfg['use_redirect'] = true, the CSS does not appear in case of 404 - error. Workaround: define $cgf['web_root'] in your config.local.php diff --git a/doc/TODO b/doc/TODO deleted file mode 100644 index d98140f..0000000 --- a/doc/TODO +++ /dev/null @@ -1,25 +0,0 @@ -for next release - -- [feature] refactoring -- [feature] help links near the features that redirect on the documentation -- [feature] $cfg['trash']: put in trash/ or really delete -- [bug] in case of password, the true name is not sent (due to the HTTP POST request?) - see phpmyadmin and the dump function to see how it works for them - Cannot reproduce -- [bug] true name even in case of viewable files - - -if I have time - -- [doc] split the doc -> index(about)/user/hacker/developper -- [doc] add a note on the version number -- [doc] update and improve developper doc - - -later, much later (if people ask for it) - -- [feature] upload progress - http://www.haughin.com/2007/10/23/php-upload-progress-with-php-52-apc/ -- [feature] mail to the uploader -- [feature] mini images and icons (Entilope aka thumb.php) -- [feature] a list of the present files and possibility to purge them -- [feature] an XML-RPC interface diff --git a/doc/var.htaccess b/doc/var.htaccess deleted file mode 100644 index babdb06..0000000 --- a/doc/var.htaccess +++ /dev/null @@ -1,23 +0,0 @@ -# Jyraphe, your web file repository -# Copyright (C) 2008 Julien "axolotl" BERNARD -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -# This file prevents people to explore this directory -# For Apache httpd, you need to have the following line in yo configuration: -# AllowOverride Limit -# If you can, uncomment the following lines: - -# Order deny,allow -# Deny from all diff --git a/file.php b/file.php new file mode 100644 index 0000000..31c16da --- /dev/null +++ b/file.php @@ -0,0 +1,165 @@ + + * Copyright (C) 2012 Jerome Jutteau + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +define('JIRAFEAU_ROOT', dirname(__FILE__) . '/'); + +require(JIRAFEAU_ROOT . 'lib/config.php'); +require(JIRAFEAU_ROOT . 'lib/settings.php'); +require(JIRAFEAU_ROOT . 'lib/functions.php'); + +if(isset($_GET['h']) && !empty($_GET['h'])) { + $link_name = $_GET['h']; + + if(!ereg('[0-9a-f]{32}$', $link_name)) { + header("HTTP/1.0 404 Not Found"); + + require(JIRAFEAU_ROOT . 'lib/template/header.php'); + echo '

Error 404: Not Found

'; + require(JIRAFEAU_ROOT . 'lib/template/footer.php'); + exit; + } + + $link_file = VAR_LINKS . $link_name; + if(file_exists($link_file)) { + $content = file($link_file); + $file_name = trim($content[0]); + $mime_type = trim($content[1]); + $file_size = trim($content[2]); + $key = trim($content[3], NL); + $time = trim($content[4]); + $md5 = trim($content[5]); + $onetime = trim($content[6]); + + if(!file_exists(VAR_FILES . $md5)) { + if (file_exists(VAR_FILES . $md5 . '_count')) { + unlink(VAR_FILES . $md5 . '_count'); + } + unlink($link_file); + require(JIRAFEAU_ROOT . 'lib/template/header.php'); + echo '

' . _('File not available.') . '

'; + require(JIRAFEAU_ROOT . 'lib/template/footer.php'); + exit; + } + + $counter = 1; + if (file_exists(VAR_FILES . $md5 . '_count')) { + $content = file(VAR_FILES . $md5 . '_count'); + $counter = trim($content[0], NL); + } + + if($time != JIRAFEAU_INFINITY) { + if(time() > $time) { + unlink($link_file); + + $counter--; + if ($counter >= 1) { + $handle = fopen(VAR_FILES . $md5 . '_count', 'w'); + fwrite($handle, $counter); + fclose($handle); + } + elseif ($counter == 0) { + if (file_exists(VAR_FILES . $md5 . '_count')) { + unlink(VAR_FILES . $md5 . '_count'); + } + $new_name = jirafeau_detect_collision($md5 . '_' . $file_name, VAR_TRASH); + rename(VAR_FILES . $md5, VAR_TRASH . $new_name); + } + + require(JIRAFEAU_ROOT . 'lib/template/header.php'); + echo '

' . _('The time limit of this file has expired. It has been deleted.') . '

'; + require(JIRAFEAU_ROOT . 'lib/template/footer.php'); + exit; + } + } + + if(!empty($key)) { + if(!isset($_POST['key'])) { + require(JIRAFEAU_ROOT . 'lib/template/header.php'); +?> +
+
+ +
+ + + + + + + + +
+
+
+
+

Error 403: Forbidden

'; + require(JIRAFEAU_ROOT . 'lib/template/footer.php'); + exit; + } + } + } + + header('Content-Length: ' . $file_size); + header('Content-Type: ' . $mime_type); + if(!jirafeau_is_viewable($mime_type)) { + header('Content-Disposition: attachment; filename="' . $file_name . '"'); + } + readfile(VAR_FILES . $md5); + + if($onetime == 'O') { + unlink($link_file); + + $counter--; + if ($counter >= 1) { + $handle = fopen(VAR_FILES . $md5 . '_count', 'w'); + fwrite($handle, $counter); + fclose($handle); + } + elseif ($counter == 0) { + if (file_exists(VAR_FILES . $md5 . '_count')) { + unlink(VAR_FILES . $md5 . '_count'); + } + $new_name = jirafeau_detect_collision($md5 . '_' . $file_name, VAR_TRASH); + rename(VAR_FILES . $md5, VAR_TRASH . $new_name); + } + } + exit; + } else { + header("HTTP/1.0 404 Not Found"); + + require(JIRAFEAU_ROOT . 'lib/template/header.php'); + echo '

Error 404: Not Found

'; + require(JIRAFEAU_ROOT . 'lib/template/footer.php'); + exit; + } +} else { + header('Location: ' . $cfg['web_root']); + exit; +} + +?> diff --git a/pub/index.php b/index.php similarity index 79% rename from pub/index.php rename to index.php index 80a5230..af1efb4 100644 --- a/pub/index.php +++ b/index.php @@ -1,7 +1,8 @@ + * Copyright (C) 2012 Jerome Jutteau * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -17,47 +18,47 @@ * along with this program. If not, see . */ -define('JYRAPHE_ROOT', dirname(__FILE__) . '/'); +define('JIRAFEAU_ROOT', dirname(__FILE__) . '/'); define('DEBUG', true); -require(JYRAPHE_ROOT . 'lib/config.php'); -require(JYRAPHE_ROOT . 'lib/settings.php'); -require(JYRAPHE_ROOT . 'lib/functions.php'); +require(JIRAFEAU_ROOT . 'lib/config.php'); +require(JIRAFEAU_ROOT . 'lib/settings.php'); +require(JIRAFEAU_ROOT . 'lib/functions.php'); /* check if the destination dirs are writable */ $writable = is_writable(VAR_FILES) && is_writable(VAR_LINKS) && is_writable(VAR_TRASH); $res = array(); -if($writable && isset($_POST['jyraphe'])) { +if($writable && isset($_POST['jirafeau'])) { $key = $_POST['key']; $time = time(); switch($_POST['time']) { case 'minute': - $time += JYRAPHE_MINUTE; + $time += JIRAFEAU_MINUTE; break; case 'hour': - $time += JYRAPHE_HOUR; + $time += JIRAFEAU_HOUR; break; case 'day': - $time += JYRAPHE_DAY; + $time += JIRAFEAU_DAY; break; case 'week': - $time += JYRAPHE_WEEK; + $time += JIRAFEAU_WEEK; break; case 'month': - $time += JYRAPHE_MONTH; + $time += JIRAFEAU_MONTH; break; default: - $time = JYRAPHE_INFINITY; + $time = JIRAFEAU_INFINITY; break; } - $res = jyraphe_upload($_FILES['file'], isset($_POST['one_time_download']), $key, $time, $cfg); + $res = jirafeau_upload($_FILES['file'], isset($_POST['one_time_download']), $key, $time, $cfg); } -require(JYRAPHE_ROOT . 'lib/template/header.php'); +require(JIRAFEAU_ROOT . 'lib/template/header.php'); /* Checking for errors. */ if(!is_writable(VAR_FILES)) { @@ -73,7 +74,7 @@ if(!is_writable(VAR_TRASH)) { } /* Check if the install.php script is still in the directory. */ -if (file_exists(JYRAPHE_ROOT . 'install.php')) { +if (file_exists(JIRAFEAU_ROOT . 'install.php')) { add_error (_('Installer script still present'), _('Please make sure to delete the installer script "install.php" before continuing.')); } @@ -86,13 +87,13 @@ if(!has_error() && !empty($res)) { if($cfg['rewrite']) { $link .= 'file-' . $res['link']; } else { - $link .= 'file.php?h=' . $res['link']; // h because 'h' looks like a jyraphe ;) + $link .= 'file.php?h=' . $res['link']; // h because 'h' looks like a jirafeau ;) } echo '
' . NL; echo '

' . _('File uploaded! Copy the following URL to get it:') . '
' . NL; echo '' . $link . '' . NL; - if($time != JYRAPHE_INFINITY) { + if($time != JIRAFEAU_INFINITY) { echo '
' . _('This file is valid until the following date:') . '
' . strftime('%c' ,$time) . ''; } @@ -109,11 +110,11 @@ if(!has_error () && $writable) {

-
+

-

+


@@ -139,5 +140,5 @@ if(!has_error () && $writable) { diff --git a/pub/install.php b/install.php similarity index 75% rename from pub/install.php rename to install.php index faf7911..dfe094c 100644 --- a/pub/install.php +++ b/install.php @@ -1,6 +1,6 @@ * * This program is free software: you can redistribute it and/or modify @@ -17,29 +17,29 @@ * along with this program. If not, see . */ -define('JYRAPHE_ROOT', dirname(__FILE__) . '/'); +define('JIRAFEAU_ROOT', dirname(__FILE__) . '/'); define('NL', "\n"); define('QUOTE', "'"); -define('JYRAPHE_CFG', JYRAPHE_ROOT . 'lib/config.local.php'); -define('JYRAPHE_VAR_RAND_LENGTH', 15); +define('JIRAFEAU_CFG', JIRAFEAU_ROOT . 'lib/config.local.php'); +define('JIRAFEAU_VAR_RAND_LENGTH', 15); -require(JYRAPHE_ROOT . 'lib/config.php'); +require(JIRAFEAU_ROOT . 'lib/config.php'); -function jyraphe_quoted($str) { +function jirafeau_quoted($str) { return QUOTE . str_replace(QUOTE, "\'", $str) . QUOTE; } -function jyraphe_export_cfg($cfg) { - $handle = fopen(JYRAPHE_CFG, 'w'); +function jirafeau_export_cfg($cfg) { + $handle = fopen(JIRAFEAU_CFG, 'w'); fwrite($handle, ' $item) { - fwrite($handle, '$cfg[' . jyraphe_quoted($key) . '] = '); + fwrite($handle, '$cfg[' . jirafeau_quoted($key) . '] = '); if(is_bool($item)) { fwrite($handle, ($item ? 'true' : 'false')); } else if(is_string($item)) { - fwrite($handle, jyraphe_quoted($item)); + fwrite($handle, jirafeau_quoted($item)); } else { fwrite($handle, 'null'); } @@ -49,7 +49,7 @@ function jyraphe_export_cfg($cfg) { fclose($handle); } -function jyraphe_mkdir($path) { +function jirafeau_mkdir($path) { if(!file_exists($path)) { if(!@mkdir($path, 0755)) { return false; @@ -64,25 +64,25 @@ function jyraphe_mkdir($path) { * @param $path is the file or directory to be tested. * @return true if $path is writable. */ -function jyraphe_is_writable($path) { +function jirafeau_is_writable($path) { return is_writable($path) || @chmod($path, 0777); // "@" gets rid of error messages. } -function jyraphe_check_var_dir($path) { +function jirafeau_check_var_dir($path) { $mkdir_str1 = _('The following directory could not be created:'); $mkdir_str2 = _('You should create this directory by hand.'); $write_str1 = _('The following directory is not writable:'); $write_str2 = _('You should give the write right to the web server on this directory.'); $solution_str = _('Here is a solution:'); - if(!jyraphe_mkdir($path)) { + if(!jirafeau_mkdir($path)) { return array( 'has_error' => true, 'why' => $mkdir_str1 . '
' . $path . '
' . $solution_str . '
' . $mkdir_str2 ); } - if(!jyraphe_is_writable($path)) { + if(!jirafeau_is_writable($path)) { return array( 'has_error' => true, 'why' => $write_str1 . '
' . $path . '
' . $solution_str . '
' . $write_str2 @@ -92,14 +92,14 @@ function jyraphe_check_var_dir($path) { foreach(array('files', 'links', 'trash') as $subdir) { $subpath = $path . $subdir; - if(!jyraphe_mkdir($subpath)) { + if(!jirafeau_mkdir($subpath)) { return array( 'has_error' => true, 'why' => $mkdir_str1 . '
' . $subpath . '
' . $solution_str . '
' . $mkdir_str2 ); } - if(!jyraphe_is_writable($subpath)) { + if(!jirafeau_is_writable($subpath)) { return array( 'has_error' => true, 'why' => $write_str1 . '
' . $subpath . '
' . $solution_str . '
' . $write_str2 @@ -111,24 +111,24 @@ function jyraphe_check_var_dir($path) { return array('has_error' => false, 'why' => ''); } -function jyraphe_add_ending_slash($path) { +function jirafeau_add_ending_slash($path) { return $path . ((substr($path, -1) == '/') ? '' : '/'); } -if(!file_exists(JYRAPHE_CFG)) { +if(!file_exists(JIRAFEAU_CFG)) { // we try to create an empty one - if(!@touch(JYRAPHE_CFG)) { - require(JYRAPHE_ROOT . 'lib/template/header.php'); + if(!@touch(JIRAFEAU_CFG)) { + require(JIRAFEAU_ROOT . 'lib/template/header.php'); echo '

' . _('The local configuration file could not be created. Create a lib/config.local.php file and give the write right to the web server (preferred solution), or give the write right to the web server on the lib directory.') . '

'; - require(JYRAPHE_ROOT . 'lib/template/footer.php'); + require(JIRAFEAU_ROOT . 'lib/template/footer.php'); exit; } } -if (!is_writable(JYRAPHE_CFG) && !@chmod(JYRAPHE_CFG, '0666')) { - require(JYRAPHE_ROOT . 'lib/template/header.php'); +if (!is_writable(JIRAFEAU_CFG) && !@chmod(JIRAFEAU_CFG, '0666')) { + require(JIRAFEAU_ROOT . 'lib/template/header.php'); echo '

' . _('The local configuration is not writable by the web server. Give the write right to the web server on the lib/config.local.php file.') . '

'; - require(JYRAPHE_ROOT . 'lib/template/footer.php'); + require(JIRAFEAU_ROOT . 'lib/template/footer.php'); exit; } @@ -136,13 +136,13 @@ if(isset($_POST['step']) && isset($_POST['next'])) { switch($_POST['step']) { case 1: $cfg['lang'] = $_POST['lang']; - jyraphe_export_cfg($cfg); + jirafeau_export_cfg($cfg); break; case 2: - $cfg['web_root'] = jyraphe_add_ending_slash($_POST['web_root']); - $cfg['var_root'] = jyraphe_add_ending_slash($_POST['var_root']); - jyraphe_export_cfg($cfg); + $cfg['web_root'] = jirafeau_add_ending_slash($_POST['web_root']); + $cfg['var_root'] = jirafeau_add_ending_slash($_POST['var_root']); + jirafeau_export_cfg($cfg); break; default: @@ -151,8 +151,8 @@ if(isset($_POST['step']) && isset($_POST['next'])) { } -require(JYRAPHE_ROOT . 'lib/settings.php'); -require(JYRAPHE_ROOT . 'lib/template/header.php'); +require(JIRAFEAU_ROOT . 'lib/settings.php'); +require(JIRAFEAU_ROOT . 'lib/template/header.php'); $current = 1; if(isset($_POST['next'])) { @@ -166,16 +166,16 @@ if(isset($_POST['next'])) { switch($current) { case 3: ?> -

+

- +
- + @@ -187,12 +187,12 @@ switch($current) {

' . $err['why'] . '
' . NL; ?> - + @@ -205,16 +205,16 @@ switch($current) { case 2: ?> -

+

- +
- + @@ -234,10 +234,10 @@ switch($current) { $alphanum = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; $len_alphanum = strlen($alphanum); $var = 'var-'; - for($i = 0; $i < JYRAPHE_VAR_RAND_LENGTH; $i++) { + for($i = 0; $i < JIRAFEAU_VAR_RAND_LENGTH; $i++) { $var .= substr($alphanum, mt_rand(0, $len_alphanum - 1), 1); } - echo JYRAPHE_ROOT . $var . '/'; + echo JIRAFEAU_ROOT . $var . '/'; } else { echo $cfg['var_root']; } @@ -263,16 +263,16 @@ switch($current) { 'fr_FR.UTF-8' => 'Français' ); ?> -

+

- +
- + @@ -299,7 +299,7 @@ switch($current) { } -require(JYRAPHE_ROOT . 'lib/template/footer.php'); +require(JIRAFEAU_ROOT . 'lib/template/footer.php'); /** diff --git a/pub/jyraphe.js b/jirafeau.js similarity index 93% rename from pub/jyraphe.js rename to jirafeau.js index 246256e..658e9f9 100644 --- a/pub/jyraphe.js +++ b/jirafeau.js @@ -1,5 +1,5 @@ /* - * Jyraphe, your web file repository + * Jirafeau, your web file repository * Copyright (C) 2008 Julien "axolotl" BERNARD * * This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -function jyraphe_toggle(id) { +function jirafeau_toggle(id) { if(document.getElementById(id).style.display == 'block') { document.getElementById(id).style.display = 'none'; } else { diff --git a/l10n/Jyraphe.pot b/l10n/Jyraphe.pot deleted file mode 100644 index 856a6a6..0000000 --- a/l10n/Jyraphe.pot +++ /dev/null @@ -1,244 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-04-14 13:02+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: pub/file.php:54 -msgid "The time limit of this file has expired. It has been deleted." -msgstr "" - -#: pub/file.php:69 -msgid "Key protection" -msgstr "" - -#: pub/file.php:72 -msgid "Give the key of this file:" -msgstr "" - -#: pub/file.php:75 -msgid "I have the right to download this file" -msgstr "" - -#: pub/index.php:63 -msgid "An error occurred." -msgstr "" - -#: pub/index.php:72 -msgid "File uploaded! Copy the following URL to get it:" -msgstr "" - -#: pub/index.php:76 -msgid "This file is valid until the following date:" -msgstr "" - -#: pub/index.php:86 -msgid "The file directory is not writable!" -msgstr "" - -#: pub/index.php:90 -msgid "The link directory is not writable!" -msgstr "" - -#: pub/index.php:94 -msgid "The trash directory is not writable!" -msgstr "" - -#: pub/index.php:104 -msgid "Upload a file" -msgstr "" - -#: pub/index.php:106 -#, php-format -msgid "Maximum file size: %dMB" -msgstr "" - -#: pub/index.php:107 -msgid "Send in the binary chaos" -msgstr "" - -#: pub/index.php:112 -msgid "One time download" -msgstr "" - -#: pub/index.php:113 -msgid "File key:" -msgstr "" - -#: pub/index.php:114 -msgid "Time limit:" -msgstr "" - -#: pub/index.php:116 -msgid "None" -msgstr "" - -#: pub/index.php:117 -msgid "One minute" -msgstr "" - -#: pub/index.php:118 -msgid "One hour" -msgstr "" - -#: pub/index.php:119 -msgid "One day" -msgstr "" - -#: pub/index.php:120 -msgid "One week" -msgstr "" - -#: pub/index.php:121 -msgid "One month" -msgstr "" - -#: pub/install.php:36 -msgid "" -"This file was generated by the install process. You can edit it. Please see " -"config.php to understand the configuration items." -msgstr "" - -#: pub/install.php:66 -msgid "The following directory could not be created:" -msgstr "" - -#: pub/install.php:67 -msgid "You should create this directory by hand." -msgstr "" - -#: pub/install.php:68 -msgid "The following directory is not writable:" -msgstr "" - -#: pub/install.php:69 -msgid "You should give the write right to the web server on this directory." -msgstr "" - -#: pub/install.php:70 -msgid "Here is a solution:" -msgstr "" - -#: pub/install.php:116 -msgid "" -"The local configuration file could not be created. Create a lib/config." -"local.php file and give the write right to the web server (preferred " -"solution), or give the write right to the web server on the lib " -"directory." -msgstr "" - -#: pub/install.php:124 -msgid "" -"The local configuration is not writable by the web server. Give the write " -"right to the web server on the lib/config.local.php file." -msgstr "" - -#: pub/install.php:163 pub/install.php:202 pub/install.php:258 -#, php-format -msgid "Installation of Jyraphe - step %d out of %d" -msgstr "" - -#: pub/install.php:169 -msgid "Finalisation" -msgstr "" - -#: pub/install.php:172 -msgid "" -"Jyraphe is setting the website according to the configuration you provided." -msgstr "" - -#: pub/install.php:175 pub/install.php:241 -msgid "Previous step" -msgstr "" - -#: pub/install.php:191 -msgid "Retry this step" -msgstr "" - -#: pub/install.php:196 -msgid "Your website is now fully operational:" -msgstr "" - -#: pub/install.php:208 -msgid "Information" -msgstr "" - -#: pub/install.php:211 -msgid "" -"The base address of Jyraphe is the first part of the URL, until (and " -"including) the last slash. For example: \"http://www.example.com/\". Do not " -"forget the ending slash!" -msgstr "" - -#: pub/install.php:214 -msgid "Base address:" -msgstr "" - -#: pub/install.php:222 -msgid "" -"The data directory is where your files and information about your files will " -"be stored. You should put it outside your web site, or at least restrict the " -"access of this directory. Do not forget the ending slash!" -msgstr "" - -#: pub/install.php:225 -msgid "Data directory:" -msgstr "" - -#: pub/install.php:242 pub/install.php:283 -msgid "Next step" -msgstr "" - -#: pub/install.php:264 -msgid "Language" -msgstr "" - -#: pub/install.php:267 -msgid "" -"The installation of Jyraphe is internationalised, so you can have it in your " -"own language if the translation is available." -msgstr "" - -#: pub/install.php:270 -msgid "Choose your language:" -msgstr "" - -#: pub/lib/functions.php:86 -msgid "Your file exceeds the maximum authorized file size." -msgstr "" - -#: pub/lib/functions.php:91 -msgid "Your file was not uploaded correctly. You may succeed in retrying." -msgstr "" - -#: pub/lib/functions.php:97 -msgid "Internal error. You may not succeed in retrying." -msgstr "" - -#: pub/lib/functions.php:103 -msgid "Unknown error." -msgstr "" - -#: pub/lib/functions.php:125 -msgid "This file is forbidden for security reasons." -msgstr "" - -#: pub/lib/template/footer.php:2 -msgid "powered by Jyraphe" -msgstr "" - -#: pub/lib/template/header.php:15 pub/lib/template/header.php:22 -msgid "Jyraphe, your web file repository" -msgstr "" diff --git a/l10n/po/fr_FR.UTF-8.po b/l10n/po/fr_FR.UTF-8.po deleted file mode 100644 index 0fa9c87..0000000 --- a/l10n/po/fr_FR.UTF-8.po +++ /dev/null @@ -1,285 +0,0 @@ -# Jyraphe translation file -# Copyright (C) 2008 Jyraphe Project -# This file is distributed under the same license as the Jyraphe package. -# Julien "axolotl" BERNARD , 2008. -# -msgid "" -msgstr "" -"Project-Id-Version: Jyraphe 0.1\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-04-14 13:02+0200\n" -"PO-Revision-Date: 2008-04-08 10:50+0200\n" -"Last-Translator: Julien Bernard \n" -"Language-Team: French\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: pub/file.php:54 -msgid "The time limit of this file has expired. It has been deleted." -msgstr "La durée limite de ce fichier a expiré. Il a été supprimé." - -#: pub/file.php:69 -msgid "Key protection" -msgstr "Protection par clef" - -#: pub/file.php:72 -msgid "Give the key of this file:" -msgstr "Donnez la clef de ce fichier :" - -#: pub/file.php:75 -msgid "I have the right to download this file" -msgstr "J'ai le droit de télécharger ce fichier" - -#: pub/index.php:63 -msgid "An error occurred." -msgstr "Une erreur s'est produite" - -#: pub/index.php:72 -msgid "File uploaded! Copy the following URL to get it:" -msgstr "Fichier chargé ! Copiez l'URL suivante pour l'obtenir :" - -#: pub/index.php:76 -msgid "This file is valid until the following date:" -msgstr "Ce fichier est valide juqu'à la date suivante :" - -#: pub/index.php:86 -msgid "The file directory is not writable!" -msgstr "Le répertoire des fichiers n'est pas accessible en écriture !" - -#: pub/index.php:90 -msgid "The link directory is not writable!" -msgstr "Le répertoire des liens n'est pas accessible en écriture !" - -#: pub/index.php:94 -msgid "The trash directory is not writable!" -msgstr "Le répertoire de corbeille n'est pas accessible en écriture !" - -#: pub/index.php:104 -msgid "Upload a file" -msgstr "Déposer un fichier" - -#: pub/index.php:106 -#, php-format -msgid "Maximum file size: %dMB" -msgstr "Taille de fichier maximale : %dMo" - -#: pub/index.php:107 -msgid "Send in the binary chaos" -msgstr "Envoyer dans le chaos binaire" - -#: pub/index.php:112 -msgid "One time download" -msgstr "Téléchargement à usage unique" - -#: pub/index.php:113 -msgid "File key:" -msgstr "Clef du fichier :" - -#: pub/index.php:114 -msgid "Time limit:" -msgstr "Durée limite :" - -#: pub/index.php:116 -msgid "None" -msgstr "Aucune" - -#: pub/index.php:117 -msgid "One minute" -msgstr "Une minute" - -#: pub/index.php:118 -msgid "One hour" -msgstr "Une heure" - -#: pub/index.php:119 -msgid "One day" -msgstr "Un jour" - -#: pub/index.php:120 -msgid "One week" -msgstr "Une semaine" - -#: pub/index.php:121 -msgid "One month" -msgstr "Un mois" - -#: pub/install.php:36 -msgid "" -"This file was generated by the install process. You can edit it. Please see " -"config.php to understand the configuration items." -msgstr "" -"Ce fichier a été généré par le processus d'installation. Vous pouvez " -"l'éditer. Veuillez regarder config.php pour comprendre les éléments de " -"configuration." - -#: pub/install.php:66 -msgid "The following directory could not be created:" -msgstr "Le répertoire suivant n'a pas pu être créé :" - -#: pub/install.php:67 -msgid "You should create this directory by hand." -msgstr "Vous devriez créer ce répertoire à la main." - -#: pub/install.php:68 -msgid "The following directory is not writable:" -msgstr "Le répertoire suivant n'est pas accessible en écriture :" - -#: pub/install.php:69 -msgid "You should give the write right to the web server on this directory." -msgstr "" -"Vous devriez donner les droits en écriture au serveur web sur ce répertoire." - -#: pub/install.php:70 -msgid "Here is a solution:" -msgstr "Voici une solution :" - -#: pub/install.php:116 -msgid "" -"The local configuration file could not be created. Create a lib/config." -"local.php file and give the write right to the web server (preferred " -"solution), or give the write right to the web server on the lib " -"directory." -msgstr "" -"La configuration locale n'a pas pu être créée. Créez un fichier lib/" -"config.local.php et donnez les droits d'écriture au serveur web " -"(solution préférée), ou donnez les droits d'écriture au serveur web sur le " -"répertoire lib." - -#: pub/install.php:124 -msgid "" -"The local configuration is not writable by the web server. Give the write " -"right to the web server on the lib/config.local.php file." -msgstr "" -"Le serveur web n'a pas les droits d'écriture sur la configuration locale. " -"Donnez les droits d'écriture au serveur web sur le fichier lib/config." -"local.php." - -#: pub/install.php:163 pub/install.php:202 pub/install.php:258 -#, php-format -msgid "Installation of Jyraphe - step %d out of %d" -msgstr "Installation de Jyraphe - étape %d sur %d" - -#: pub/install.php:169 -msgid "Finalisation" -msgstr "Finalisation" - -#: pub/install.php:172 -msgid "" -"Jyraphe is setting the website according to the configuration you provided." -msgstr "" -"Jyraphe est en train de mettre en place le site web en fonction de la " -"configuration que vous avez fournie." - -#: pub/install.php:175 pub/install.php:241 -msgid "Previous step" -msgstr "Étape précédente" - -#: pub/install.php:191 -msgid "Retry this step" -msgstr "Répéter cette étape" - -#: pub/install.php:196 -msgid "Your website is now fully operational:" -msgstr "Votre site web est maintenant pleinement opérationnel :" - -#: pub/install.php:208 -msgid "Information" -msgstr "Information" - -#: pub/install.php:211 -msgid "" -"The base address of Jyraphe is the first part of the URL, until (and " -"including) the last slash. For example: \"http://www.example.com/\". Do not " -"forget the ending slash!" -msgstr "" -"L'adresse de base de Jyraphe est la première partie de l'URL, jusqu'au slash " -"final (inclus). Par exemple : «http://www.exemple.fr/». N'oubliez pas le " -"slash final !" - -#: pub/install.php:214 -msgid "Base address:" -msgstr "Adresse de base :" - -#: pub/install.php:222 -msgid "" -"The data directory is where your files and information about your files will " -"be stored. You should put it outside your web site, or at least restrict the " -"access of this directory. Do not forget the ending slash!" -msgstr "" -"Le répertoire de données est le répertoire où vos fichiers et les " -"informations à propos de vos fichiers seront sauvegardées. Vous devriez le " -"placer en dehors de votre site web, ou au moins restreindre l'accès de ce " -"répertoire. N'oubliez pas le slash final !" - -#: pub/install.php:225 -msgid "Data directory:" -msgstr "Répertoire de données :" - -#: pub/install.php:242 pub/install.php:283 -msgid "Next step" -msgstr "Étape suivante" - -#: pub/install.php:264 -msgid "Language" -msgstr "Langue" - -#: pub/install.php:267 -msgid "" -"The installation of Jyraphe is internationalised, so you can have it in your " -"own language if the translation is available." -msgstr "" -"L'installation de Jyraphe est internationalisée, vous pouvez donc l'avoir " -"dans votre propre langue si la traduction est disponible." - -#: pub/install.php:270 -msgid "Choose your language:" -msgstr "Choisissez votre langue :" - -#: pub/lib/functions.php:86 -msgid "Your file exceeds the maximum authorized file size." -msgstr "Votre fichier excède la taille de fichier maximale autorisée." - -#: pub/lib/functions.php:91 -msgid "Your file was not uploaded correctly. You may succeed in retrying." -msgstr "" -"Votre fichier n'a pas été déposé correctement. Vous pouvez recommencer." - -#: pub/lib/functions.php:97 -msgid "Internal error. You may not succeed in retrying." -msgstr "Erreur interne." - -#: pub/lib/functions.php:103 -msgid "Unknown error." -msgstr "Erreur inconnue." - -#: pub/lib/functions.php:125 -msgid "This file is forbidden for security reasons." -msgstr "Ce fichier est interdit pour des raisons de sécurité." - -#: pub/lib/template/footer.php:2 -msgid "powered by Jyraphe" -msgstr "propulsé par Jyraphe" - -#: pub/lib/template/header.php:15 pub/lib/template/header.php:22 -msgid "Jyraphe, your web file repository" -msgstr "Jyraphe, votre dépôt de fichier en ligne" - -#~ msgid "Passwords are not the same. Try again." -#~ msgstr "Les mots de passe ne sont pas identiques. Essayez à nouveau." - -#~ msgid "More options:" -#~ msgstr "Plus d'options :" - -#~ msgid "activate password protection of the file" -#~ msgstr "activer la protection par mot de passe du fichier" - -#~ msgid "file password:" -#~ msgstr "mot de passe du fichier :" - -#~ msgid "file password again:" -#~ msgstr "mot de passe du fichier à nouveau :" - -#~ msgid "activate time limit of the file" -#~ msgstr "activer la durée limite du fichier" diff --git a/pub/lib/config.php b/lib/config.php similarity index 84% rename from pub/lib/config.php rename to lib/config.php index 33211ea..141d12c 100644 --- a/pub/lib/config.php +++ b/lib/config.php @@ -1,6 +1,6 @@ * * This program is free software: you can redistribute it and/or modify @@ -35,8 +35,8 @@ $cfg['rewrite'] = false; $cfg['password'] = ''; -if((basename(__FILE__) != 'config.local.php') && file_exists(JYRAPHE_ROOT . 'lib/config.local.php')) { - require(JYRAPHE_ROOT . 'lib/config.local.php'); +if((basename(__FILE__) != 'config.local.php') && file_exists(JIRAFEAU_ROOT . 'lib/config.local.php')) { + require(JIRAFEAU_ROOT . 'lib/config.local.php'); } -?> \ No newline at end of file +?> diff --git a/pub/lib/functions.php b/lib/functions.php similarity index 62% rename from pub/lib/functions.php rename to lib/functions.php index 76bd1cc..cb2226a 100644 --- a/pub/lib/functions.php +++ b/lib/functions.php @@ -1,7 +1,8 @@ + * Copyright (C) 2012 Jerome Jutteau * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -22,7 +23,7 @@ * @param $value the value from php.ini * @returns an integer for this value */ -function jyraphe_ini_to_bytes($value) { +function jirafeau_ini_to_bytes($value) { $modifier = substr($value, -1); $bytes = substr($value, 0, -1); switch(strtoupper($modifier)) { @@ -46,8 +47,8 @@ function jyraphe_ini_to_bytes($value) { * gets the maximum upload size according to php.ini * @returns the maximum upload size */ -function jyraphe_get_max_upload_size() { - return min(jyraphe_ini_to_bytes(ini_get('post_max_size')), jyraphe_ini_to_bytes(ini_get('upload_max_filesize'))); +function jirafeau_get_max_upload_size() { + return min(jirafeau_ini_to_bytes(ini_get('post_max_size')), jirafeau_ini_to_bytes(ini_get('upload_max_filesize'))); } /** @@ -56,7 +57,7 @@ function jyraphe_get_max_upload_size() { * @param $dir the directory to explore (finishing with a '/') * @returns an alternate filename, possibly the initial filename */ -function jyraphe_detect_collision($name, $dir) { +function jirafeau_detect_collision($name, $dir) { if(!file_exists($dir . $name)) { return $name; } @@ -79,7 +80,7 @@ function jyraphe_detect_collision($name, $dir) { * @param $code the error code * @returns a string explaining the error */ -function jyraphe_upload_errstr($code) { +function jirafeau_upload_errstr($code) { switch($code) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: @@ -114,55 +115,75 @@ function jyraphe_upload_errstr($code) { * 'error' => information on possible errors * 'link' => the link name of the uploaded file */ -function jyraphe_upload($file, $one_time_download, $key, $time, $cfg) { - if(!empty($file['tmp_name'])) { - - if($file['name'] == '.htaccess') { - return(array( - 'error' => array( - 'has_error' => true, - 'why' => _('This file is forbidden for security reasons.')), - 'link' => '') - ); - } - - - if(is_uploaded_file($file['tmp_name'])) { - - /* array representing no error */ - $noerr = array('has_error' => false, 'why' => ''); - - /* we check if this file is already here */ - $md5 = md5_file($file['tmp_name']); - $link_name = ($one_time_download ? 'O' : 'R') . $md5; - if(file_exists(VAR_LINKS . $link_name)) { - return(array('error' => $noerr, 'link' => $link_name)); - } - - $mime_type = $file['type']; - $final_name = trim($file['name']); +function jirafeau_upload($file, $one_time_download, $key, $time, $cfg) { + if(empty($file['tmp_name']) || !is_uploaded_file($file['tmp_name'])) { + return(array('error' => array('has_error' => true, 'why' => jirafeau_upload_errstr($file['error'])), 'link' => '')); + } - /* we prevent .php and make it a .phps for security reasons */ - if((strlen($final_name) >= 4) && (substr($final_name, -4) == '.php')) { - $final_name .= 's'; - $mime_type = 'application/x-httpd-php-source'; - } + /* array representing no error */ + $noerr = array('has_error' => false, 'why' => ''); - /* we check if there is a file with that name */ - $final_name = jyraphe_detect_collision($final_name, VAR_FILES); + /* file informations */ + $md5 = md5_file($file['tmp_name']); + $name = trim($file['name']); + $mime_type = $file['type']; + $size = $file['size']; - /* we move it to the right place and create the link */ - if(move_uploaded_file($file['tmp_name'], VAR_FILES . $final_name)) { - $handle = fopen(VAR_LINKS . $link_name, 'w'); - fwrite($handle, $final_name . NL . $mime_type . NL . $file['size'] . NL . $key . NL . $time . NL); - fclose($handle); + /* does file already exist ? */ + $rc = false; + if(file_exists(VAR_FILES . $md5)) { + $rc = unlink($file['tmp_name']); + } + elseif(move_uploaded_file($file['tmp_name'], VAR_FILES . $md5)) { + $rc = true; + } + if(!$rc) + { + return(array( + 'error' => array( + 'has_error' => true, + 'why' => _('Internal error during file creation.')), + 'link' => '') + ); + } - return(array('error' => $noerr, 'link' => $link_name)); - } + /* increment or create count file */ + $counter=0; + if(file_exists(VAR_FILES . $md5 . '_count')) { + $content = file(VAR_FILES . $md5 . '_count'); + $counter = trim($content[0]); + } + $counter++; + $handle = fopen(VAR_FILES . $md5 . '_count', 'w'); + fwrite($handle, $counter); + fclose($handle); + + /* create link file */ + $link_tmp_name = VAR_LINKS . $md5 . rand(0, 10000) . '.tmp'; + $handle = fopen($link_tmp_name, 'w'); + fwrite($handle, $name . NL . $mime_type . NL . $size . NL . $key . NL . $time . NL . $md5 . NL . ($one_time_download ? 'O' : 'R') . NL . date('U') . NL); + fclose($handle); + $md5_link = md5_file($link_tmp_name); + if(!rename($link_tmp_name, VAR_LINKS . $md5_link)) { + if ($counter > 1) { + $counter--; + $handle = fopen(VAR_FILES . $md5 . '_count', 'w'); + fwrite($handle, $counter); + fclose($handle); + } + else { + unlink($link_tmp_name); + unlink(VAR_FILE . $md5 . '_count'); + unlink(VAR_FILE . $md5); } + return(array( + 'error' => array( + 'has_error' => true, + 'why' => _('Internal error during file creation.')), + 'link' => '') + ); } - - return(array('error' => array('has_error' => true, 'why' => jyraphe_upload_errstr($file['error'])), 'link' => '')); + return(array('error' => $noerr, 'link' => $md5_link)); } /** @@ -170,7 +191,7 @@ function jyraphe_upload($file, $one_time_download, $key, $time, $cfg) { * @param $mime the mime type * @returns a boolean telling if a mime type is viewable */ -function jyraphe_is_viewable($mime) { +function jirafeau_is_viewable($mime) { if(!empty($mime)) { // actually, verify if mime-type is an image or a text $viewable = array('image', 'text'); diff --git a/pub/lib/settings.php b/lib/settings.php similarity index 66% rename from pub/lib/settings.php rename to lib/settings.php index 409235f..a54a3a7 100644 --- a/pub/lib/settings.php +++ b/lib/settings.php @@ -1,6 +1,6 @@ * * This program is free software: you can redistribute it and/or modify @@ -17,10 +17,10 @@ * along with this program. If not, see . */ -// Jyraphe constants +// Jirafeau constants -define('JYRAPHE_PACKAGE', 'Jyraphe'); -define('JYRAPHE_VERSION', '0.4'); +define('JIRAFEAU_PACKAGE', 'Jirafeau'); +define('JIRAFEAU_VERSION', '0.4'); // directories @@ -32,8 +32,8 @@ define('VAR_TRASH', $cfg['var_root'] . 'trash/'); setlocale(LC_ALL, $cfg['lang']); -bindtextdomain(JYRAPHE_PACKAGE, JYRAPHE_ROOT . 'lib/locale'); -textdomain(JYRAPHE_PACKAGE); +bindtextdomain(JIRAFEAU_PACKAGE, JIRAFEAU_ROOT . 'lib/locale'); +textdomain(JIRAFEAU_PACKAGE); // useful constants @@ -42,11 +42,11 @@ if(!defined('NL')) { define('NL', "\n"); } -define('JYRAPHE_INFINITY', -1); -define('JYRAPHE_MINUTE', 60); // 60 -define('JYRAPHE_HOUR', 3600); // JYRAPHE_MINUTE * 60 -define('JYRAPHE_DAY', 86400); // JYRAPHE_HOUR * 24 -define('JYRAPHE_WEEK', 604800); // JYRAPHE_DAY * 7 -define('JYRAPHE_MONTH', 2419200); // JYRAPHE_WEEK * 4 +define('JIRAFEAU_INFINITY', -1); +define('JIRAFEAU_MINUTE', 60); // 60 +define('JIRAFEAU_HOUR', 3600); // JIRAFEAU_MINUTE * 60 +define('JIRAFEAU_DAY', 86400); // JIRAFEAU_HOUR * 24 +define('JIRAFEAU_WEEK', 604800); // JIRAFEAU_DAY * 7 +define('JIRAFEAU_MONTH', 2419200); // JIRAFEAU_WEEK * 4 -?> \ No newline at end of file +?> diff --git a/lib/template/footer.php b/lib/template/footer.php new file mode 100644 index 0000000..488694b --- /dev/null +++ b/lib/template/footer.php @@ -0,0 +1,7 @@ + + + + + diff --git a/pub/lib/template/header.php b/lib/template/header.php similarity index 78% rename from pub/lib/template/header.php rename to lib/template/header.php index 551281d..7b06ae7 100644 --- a/pub/lib/template/header.php +++ b/lib/template/header.php @@ -12,11 +12,11 @@ header('Content-Type: ' . $content_type); - <?php echo _('Jyraphe, your web file repository'); ?> + <?php echo _('Jirafeau, your web file repository'); ?>
-

+

diff --git a/pub/media/default/error.png b/media/default/error.png similarity index 100% rename from pub/media/default/error.png rename to media/default/error.png diff --git a/pub/media/default/jyraphe.png b/media/default/jirafeau.png similarity index 100% rename from pub/media/default/jyraphe.png rename to media/default/jirafeau.png diff --git a/pub/media/default/ok.png b/media/default/ok.png similarity index 100% rename from pub/media/default/ok.png rename to media/default/ok.png diff --git a/pub/media/default/style.css.php b/media/default/style.css.php similarity index 94% rename from pub/media/default/style.css.php rename to media/default/style.css.php index 2342914..dbe946e 100644 --- a/pub/media/default/style.css.php +++ b/media/default/style.css.php @@ -1,6 +1,6 @@ * * This program is free software: you can redistribute it and/or modify @@ -18,7 +18,7 @@ */ /* - * This stylesheet is the default stylesheet for Jyraphe. + * This stylesheet is the default stylesheet for Jirafeau. * The content is dynamically generated for easier handling. */ @@ -44,7 +44,7 @@ h1 a { #content { padding: 0 4em; - background: url('jyraphe.png') left top repeat-y; + background: url('jirafeau.png') left top repeat-y; } #upload { @@ -175,4 +175,4 @@ h1 a { #install .navleft { float: left; -} \ No newline at end of file +} diff --git a/pub/.htaccess b/pub/.htaccess deleted file mode 100644 index 7071cd0..0000000 --- a/pub/.htaccess +++ /dev/null @@ -1,26 +0,0 @@ -# Jyraphe, your web file repository -# Copyright (C) 2008 Julien "axolotl" BERNARD -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -# This file allows you to have nice redirect URLs -# For Apache httpd, you need to have the following line in yo configuration: -# AllowOverride FileInfo -# If you can, uncomment the following lines: - - - RewriteEngine On - RewriteRule file.php - [L] - RewriteRule ^file-(.*)$ file.php?h=$1 - diff --git a/pub/file.php b/pub/file.php deleted file mode 100644 index 1abbec5..0000000 --- a/pub/file.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -define('JYRAPHE_ROOT', dirname(__FILE__) . '/'); - -require(JYRAPHE_ROOT . 'lib/config.php'); -require(JYRAPHE_ROOT . 'lib/settings.php'); -require(JYRAPHE_ROOT . 'lib/functions.php'); - -if(isset($_GET['h']) && !empty($_GET['h'])) { - $link_name = $_GET['h']; - - if(!ereg('^[OR][0-9a-f]{32}$', $link_name)) { - header("HTTP/1.0 404 Not Found"); - - require(JYRAPHE_ROOT . 'lib/template/header.php'); - echo '

Error 404: Not Found

'; - require(JYRAPHE_ROOT . 'lib/template/footer.php'); - exit; - } - - $link_file = VAR_LINKS . $link_name; - if(file_exists($link_file)) { - $content = file($link_file); - $file_name = trim($content[0]); - $mime_type = trim($content[1]); - $file_size = trim($content[2]); - $key = trim($content[3], NL); - $time = trim($content[4]); - - if($time != JYRAPHE_INFINITY) { - if(time() > $time) { - unlink($link_file); - $new_name = jyraphe_detect_collision($file_name, VAR_TRASH); - rename(VAR_FILES . $file_name, VAR_TRASH . $new_name); - - require(JYRAPHE_ROOT . 'lib/template/header.php'); - echo '

' . _('The time limit of this file has expired. It has been deleted.') . '

'; - require(JYRAPHE_ROOT . 'lib/template/footer.php'); - exit; - - } - } - - if(!empty($key)) { - if(!isset($_POST['key'])) { - require(JYRAPHE_ROOT . 'lib/template/header.php'); -?> -
- - -
- -
- - - - - - -
-
- -
-

Error 403: Forbidden

'; - require(JYRAPHE_ROOT . 'lib/template/footer.php'); - exit; - } - } - } - - header('Content-Length: ' . $file_size); - header('Content-Type: ' . $mime_type); - if(!jyraphe_is_viewable($mime_type)) { - header('Content-Disposition: attachment; filename="' . $file_name . '"'); - } - readfile(VAR_FILES . $file_name); - - if($link_name[0] == 'O') { - unlink($link_file); - $new_name = jyraphe_detect_collision($file_name, VAR_TRASH); - rename(VAR_FILES . $file_name, VAR_TRASH . $new_name); - } - exit; - } else { - header("HTTP/1.0 404 Not Found"); - - require(JYRAPHE_ROOT . 'lib/template/header.php'); - echo '

Error 404: Not Found

'; - require(JYRAPHE_ROOT . 'lib/template/footer.php'); - exit; - } -} else { - header('Location: ' . $cfg['web_root']); - exit; -} - -?> diff --git a/pub/lib/template/footer.php b/pub/lib/template/footer.php deleted file mode 100644 index da59fcb..0000000 --- a/pub/lib/template/footer.php +++ /dev/null @@ -1,7 +0,0 @@ - -
- - - diff --git a/update-mo.sh b/update-mo.sh deleted file mode 100755 index 00d4d17..0000000 --- a/update-mo.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# Jyraphe, your web file repository -# Copyright (C) 2008 Julien "axolotl" BERNARD -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# - -WD="`dirname $0`" - -PACKAGE=Jyraphe -POT="${WD}/l10n/${PACKAGE}.pot" - -for PO in `ls ${WD}/l10n/po/*.po` -do - LANG=`basename "${PO}" | sed 's/.po//'` - mkdir -p "${WD}/pub/lib/locale/${LANG}/LC_MESSAGES/" - msgfmt -o "${WD}/pub/lib/locale/${LANG}/LC_MESSAGES/${PACKAGE}.mo" "${PO}" -done diff --git a/update-po.sh b/update-po.sh deleted file mode 100755 index b8d36e8..0000000 --- a/update-po.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -# Jyraphe, your web file repository -# Copyright (C) 2008 Julien "axolotl" BERNARD -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# - -WD="`dirname $0`" - -PACKAGE=Jyraphe -POTFILES=`ls ${WD}/pub/*.php ${WD}/pub/lib/*.php ${WD}/pub/lib/template/*.php` -POT="${WD}/l10n/${PACKAGE}.pot" - -xgettext --language=PHP --output "${WD}/${PACKAGE}.po" ${POTFILES} - -if cmp -s "${WD}/${PACKAGE}.po" "${POT}" -then - rm -f "${WD}/${PACKAGE}.po" -else - mv -f "${WD}/${PACKAGE}.po" "${WD}/l10n/${PACKAGE}.pot" -fi - -for PO in `ls ${WD}/l10n/po/*.po` -do - LANG=`basename "${PO}" | sed 's/.po//'` - if msgmerge "${PO}" "${POT}" > "${WD}/${LANG}.pot" - then - mv -f "${WD}/${LANG}.pot" "${PO}" - echo "msgmerge of ${LANG} succeeded" - else - echo "msgmerge of ${LANG} failed" - rm -f "${WD}/${LANG}.pot" - fi -done