Ejemplo n.º 1
0
// 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
    $update_album = 0;
    $action_media = array();
    for ($f = 1; $f < 6; $f++) {
        $fileid = "file" . $f;
        if ($_FILES[$fileid]['name'] != "") {
            $file_result[$fileid] = $group->group_media_upload($fileid, $groupalbum_info['groupalbum_id'], $space_left);
            if ($file_result[$fileid]['is_error'] == 0) {
                $file_result[$fileid]['message'] = 2000248;
                $media_path = str_replace('./', '', $group->group_dir($group->group_info['group_id']) . $file_result[$fileid]['groupmedia_id'] . "_thumb.jpg");
                $media_link = "group_album_file.php?group_id={$group->group_info['group_id']}&groupmedia_id={$file_result[$fileid]['groupmedia_id']}";
                if (file_exists($media_path)) {
                    $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']);
        }
Ejemplo n.º 2
0
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;
}