|
|
@@ -92,6 +92,29 @@ function DIE_ERR($str){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// Create the user directory within the UCD if it doesn't exist. Returns true on success or false on failure.
|
|
|
+function CREATE_USER_CONTENT_DIR($username){
|
|
|
+
|
|
|
+ // Attempt to create the directory if it doesn't exist.
|
|
|
+ $user_content_dir = USER_CONTENT_DIR . "/" . $username;
|
|
|
+ if (!file_exists($user_content_dir)){
|
|
|
+
|
|
|
+ mkdir($user_content_dir, 0777, true);
|
|
|
+ }
|
|
|
+ // Check and make sure it now exists.
|
|
|
+ if (!file_exists($user_content_dir)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+// Returns full path to the user's directory within the UCD.
|
|
|
+function GET_USER_CONTENT_DIR_PATH($username){
|
|
|
+
|
|
|
+ return USER_CONTENT_DIR . "/" . $username;
|
|
|
+}
|
|
|
+
|
|
|
// Check user authorization.
|
|
|
function CHECK_USER(&$err){
|
|
|
|
|
|
@@ -167,14 +190,14 @@ function CHECK_IMAGE_PRELIM_DATA(&$err){
|
|
|
|
|
|
if (filesize($_FILES['image']['tmp_name']) > 0){
|
|
|
|
|
|
- if (isset($allowed_mime_types[$_FILES['image']['type']])){
|
|
|
+ if (!in_array($_FILES['image']['type'], $allowed_mime_types)){
|
|
|
|
|
|
$err = null;
|
|
|
return true;
|
|
|
}
|
|
|
else{
|
|
|
|
|
|
- $err = "error_415_3";
|
|
|
+ $err = "error_415_1";
|
|
|
return false;
|
|
|
}
|
|
|
}
|