$privacy_max = $group->group_privacy_max($user); if (!($privacy_max & $group->group_info['group_privacy'])) { exit; } if (!($privacy_max & $group->group_info['group_upload'])) { exit; } // GET ALBUM INFO $groupalbum_info = $database->database_fetch_assoc($database->database_query("SELECT * FROM se_groupalbums WHERE groupalbum_group_id='{$group->group_info['group_id']}' LIMIT 1")); // SET RESULT AND ERROR VARS $result = ""; $is_error = 0; $show_uploader = 1; $file_result = array(); // GET TOTAL SPACE USED $space_used = $group->group_media_space(); if ($group->groupowner_level_info['level_group_album_storage']) { $space_left = $group->groupowner_level_info['level_group_album_storage'] - $space_used; } else { $space_left = $dfs = disk_free_space("/") ? $dfs : pow(2, 32); } // UPLOAD FILES if ($task == "doupload") { $isAjax = $_POST['isAjax']; $file_result = array(); // WORKAROUND FOR FLASH UPLOADER if ($_FILES['file1']['type'] == "application/octet-stream" && $isAjax) { $file_types = explode(",", str_replace(" ", "", strtolower($group->groupowner_level_info['level_group_album_mimes']))); $_FILES['file1']['type'] = $file_types[0]; } // RUN FILE UPLOAD FUNCTION FOR EACH SUBMITTED FILE
function he_wall_group_photo_upload($group_id, $media_desc, $new_action_id) { global $user, $url, $misc, $setting; $group = new se_group($user->user_info['user_id'], $group_id); // CHECK IF USER IS ALLOWED TO UPLOAD PHOTOS $privacy_max = $group->group_privacy_max($user); if (!($privacy_max & $group->group_info['group_privacy']) || !($privacy_max & $group->group_info['group_upload'])) { $result = array('result' => 0, 'error' => SE_Language::get(690706101)); } $album_id = he_wall::get_group_album($group_id); // GET TOTAL SPACE USED $space_used = $group->group_media_space(); if ($group->groupowner_level_info['level_group_album_storage']) { $space_left = $group->groupowner_level_info['level_group_album_storage'] - $space_used; } else { $space_left = $dfs = disk_free_space("/") ? $dfs : pow(2, 32); } $update_album = 0; $file_result = $group->group_media_upload('wall_photo', $album_id, $space_left); if ($file_result['is_error'] == 0) { $media_path = str_replace('./', '', $group->group_dir($group->group_info['group_id']) . $file_result['groupmedia_id'] . "_thumb.jpg"); $media_link = "group_album_file.php?group_id={$group->group_info['group_id']}&groupmedia_id={$file_result['groupmedia_id']}"; if (file_exists($media_path)) { $thumb_width = (int) $setting['setting_he_wall_photo_thumb_width']; $thumb_height = (int) $setting['setting_he_wall_photo_thumb_height']; $media_width = $misc->photo_size($media_path, $thumb_width, $thumb_height, "w"); $media_height = $misc->photo_size($media_path, $thumb_width, $thumb_height, "h"); $result = array('result' => 1, 'media_path' => $media_path, 'media_width' => $media_width, 'media_height' => $media_height); } // UPDATE ALBUM UPDATED DATE he_wall::update_group_album($album_id); he_wall::update_group_album_media($file_result['groupmedia_id'], $media_desc); he_wall::add_group_album_media($new_action_id, $file_result['groupmedia_id']); // UPDATE LAST UPDATE DATE (SAY THAT 10 TIMES FAST) $group->group_lastupdate(); } else { $error_msg = sprintf(SE_Language::_get($file_result['is_error']), $file_result['file_name']); $result = array('result' => 0, 'error' => $error_msg); } return $result; }