function phorum_check_upload_limits($is_install) { global $PHORUM; if ($is_install) { return array(PHORUM_SANITY_SKIP, NULL, NULL); } // Keep track if uploads are used. $upload_used = false; // Get the maximum file upload size for PHP. list($system_max_upload, $php_max_upload, $db_max_upload) = phorum_api_system_get_max_upload(); // Check limits for file uploading in personal profile. if ($PHORUM["file_uploads"] && $PHORUM["max_file_size"]) { $upload_used = true; $res = phorum_single_check_upload_limits($PHORUM["max_file_size"] * 1024, "the Max File Size option for user file uploads " . "(in their profile)", $php_max_upload, $db_max_upload); if ($res != NULL) { return $res; } } // Check limits for attachment uploading in forums. require_once './include/api/forums.php'; $forums = phorum_api_forums_get(NULL, NULL, NULL, NULL, PHORUM_FLAG_INCLUDE_INACTIVE | PHORUM_FLAG_FORUMS); foreach ($forums as $id => $forum) { if ($forum["max_attachments"] > 0 && $forum["max_attachment_size"]) { $upload_used = true; $res = phorum_single_check_upload_limits($forum["max_attachment_size"] * 1024, "the Max File Size option for uploading attachments\n in the forum \"{$forum['name']}\"", $php_max_upload, $db_max_upload); if ($res != NULL) { return $res; } } } // No upload functionality found so far? Then we're done. if (!$upload_used) { return array(PHORUM_SANITY_OK, NULL); } // Check if the upload temp directory can be written. $tmpdir = get_cfg_var('upload_tmp_dir'); if (!empty($tmpdir)) { $fp = @fopen("{$tmpdir}/sanity_checks_dummy_uploadtmpfile", "w"); if (!$fp) { return array(PHORUM_SANITY_CRIT, "The system is unable to write files\n to PHP's upload tmpdir \"" . htmlspecialchars($tmpdir) . "\".\n The system error was:<br/><br/>" . htmlspecialchars($php_errormsg) . ".", "Change the upload_tmp_dir setting in your php.ini file\n or give your webserver more permissions for the current\n upload directory."); } fclose($fp); unlink("{$tmpdir}/sanity_checks_dummy_uploadtmpfile"); } return array(PHORUM_SANITY_OK, NULL, NULL); }
/** * @deprecated Replaced by {@link phorum_api_system_get_max_upload()}. */ function phorum_get_system_max_upload() { require_once PHORUM_PATH . '/include/api/system.php'; return phorum_api_system_get_max_upload(); }