2 /* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
5 function safe_create_dir ($dirname) {
6 if (is_dir ($dirname)) {
9 if (file_exists ($dirname)) {
10 par_error_and_leave ($dirname . ": " . trans ('exist but is not a directory'));
12 if (!mkdir ($dirname)) {
13 par_error_and_leave ($dirname . ": " . trans ('could not create directory'));
15 par_success ($dirname . ": " . trans ('directory created'));
19 function safe_create_writable_dir ($dirname) {
20 safe_create_dir ($dirname);
21 if (!is_writeable ($dirname) || !is_executable ($dirname)) {
22 par_error_and_leave ($dirname . ": " . trans ('could not write in directory'));
27 exit ("\n</body></html>");
29 function par_success ($message) {
30 printf ("<p class=\"success center\">%s</p>", $message);
32 function par_error ($message) {
33 printf ("<p class=\"error center\">%s</p>", $message);
35 function par_warn ($message) {
36 printf ("<p class=\"warn center\">%s</p>", $message);
38 function par_error_and_leave ($message) {
39 printf ("<p class=\"error center\">%s</p>", $message);