/* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
license. */
-require_once ("inc/settings.php");
+// using include because that file may be sourced even if config file has not
+// been created.
+@include_once ("inc/settings.php");
function getthumbsdir () {
if (THUMBSDIR) {
function thumb_url_from_imgpath ($filename) {
if (defined ("THUMBSDIRURL") && (strlen (THUMBSDIRURL) != 0)) {
- return rtrim (THUMBSDIRURL, '/') . "/_mini" . rawurlencode ($filename);
+ return rtrim (THUMBSDIRURL, '/') . "/mini_" . rawurlencode ($filename);
}
return full_url_from_path (getthumbsdir () . "/mini_" . rawurlencode ($filename));
}
return true;
}
-
-function safe_create_dir ($dirname) {
- if (is_dir ($dirname)) {
- return;
- }
- if (file_exists ($dirname)) {
- par_error ($dirname . ": " . trans ('exist but is not a directory'));
- }
- if (!mkdir ($dirname)) {
- par_error ($dirname . ": " . trans ('could not create directory'));
- } else {
- par_success ($dirname . ": " . trans ('directory created'));
- }
-}
-
-function safe_create_writable_dir ($dirname) {
- safe_create_dir ($dirname);
- if (!is_writeable ($dirname) || !is_executable ($dirname)) {
- par_error ($dirname . ": " . trans ('could not write in directory'));
- }
-}
-
-function leave () {
- exit ("\n</body></html>");
-}
-function par_success ($message) {
- printf ("<p class=\"success center\">%s</p>", $message);
-}
-function par_error ($message) {
- printf ("<p class=\"error center\">%s</p>", $message);
- leave ();
-}
-function par_warn ($message) {
- printf ("<p class=\"warn center\">%s</p>", $message);
-}
?>