]> git.p6c8.net - jirafeau.git/blobdiff - lib/functions.php
[BUGFIX] Print nice error when install.php is missing and we need it.
[jirafeau.git] / lib / functions.php
index 46c004a101606e77623e07b860e6fa01bd8d35f2..95a5595ce4a647a9e7ee6bb42cca981176ff0800 100644 (file)
@@ -229,6 +229,21 @@ function jirafeau_get_max_upload_size()
     return jirafeau_human_size(jirafeau_get_max_upload_size_bytes());
 }
 
+/**
+ * get the maximal upload size for a data chunk in async uploads
+ * @param max_upload_chunk_size_bytes
+ */
+function jirafeau_get_max_upload_chunk_size_bytes($max_upload_chunk_size_bytes = 0)
+{
+    if ($max_upload_chunk_size_bytes > 0) {
+        return min(
+            jirafeau_get_max_upload_size_bytes(),
+            $max_upload_chunk_size_bytes
+        );
+    }
+    return jirafeau_get_max_upload_size_bytes();
+}
+
 /**
  * gets a string explaining the error
  * @param $code the error code
@@ -564,13 +579,15 @@ function show_errors()
 
 function check_errors($cfg)
 {
-    if (file_exists(JIRAFEAU_ROOT . 'install.php')
-        && !($cfg['installation_done'] === true)) {
-        header('Location: install.php');
-        exit;
+    if (!($cfg['installation_done'] === true)) {
+        if (file_exists(JIRAFEAU_ROOT . 'install.php')) {
+            header('Location: install.php');
+            exit;
+        } else {
+            add_error(t('INSTALL_FILE_NOT_FOUND_TITLE'), t('INSTALL_FILE_NOT_FOUND_DESC'));
+        }
     }
 
-    /* Checking for errors. */
     if (!is_writable(VAR_FILES)) {
         add_error(t('FILE_DIR_W'), VAR_FILES);
     }
@@ -835,7 +852,8 @@ function jirafeau_admin_bug_report($cfg)
         'enable_crypt',
         'preview',
         'maximal_upload_size',
-        'store_uploader_ip'
+        'store_uploader_ip',
+        'max_upload_chunk_size_bytes'
     ];
     foreach ($jirafeau_options as &$o) {
         $v = $cfg[$o];

patrick-canterino.de