$media_width = $misc->photo_size($media_path, "100", "100", "w"); $media_height = $misc->photo_size($media_path, "100", "100", "h"); $action_media[] = array('media_link' => $media_link, 'media_path' => $media_path, 'media_width' => $media_width, 'media_height' => $media_height); } $update_album = 1; } else { $file_result[$fileid]['message'] = $file_result[$fileid]['is_error']; } SE_Language::_preload($file_result[$fileid]['message']); } } // UPDATE ALBUM UPDATED DATE AND ALBUM COVER IF FILE UPLOADED if ($update_album) { $database->database_query("UPDATE se_groupalbums SET groupalbum_dateupdated='" . time() . "' WHERE groupalbum_id='{$groupalbum_info['groupalbum_id']}'"); // UPDATE LAST UPDATE DATE (SAY THAT 10 TIMES FAST) $group->group_lastupdate(); // INSERT ACTION $group_title = $group->group_info['group_title']; if (strlen($group_title) > 100) { $group_title = substr($group_title, 0, 97) . "..."; } $actions->actions_add($user, "newgroupmedia", array($user->user_info['user_username'], $user->user_displayname, $group->group_info['group_id'], $group_title), $action_media, 60, FALSE, "group", $group->group_info['group_id'], $group->group_info['group_privacy']); } // OUTPUT JSON RESULT if ($isAjax) { SE_Language::load(); if ($update_album) { $result = "success"; $size = sprintf(SE_Language::_get($file_result['file1']['message']), $file_result['file1']['file_name']); $error = null; } else {
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; }