/** * Flash upload form * * @param int album_id album_id upload media * @return string HTML * */ function MG_SWFUpload($album_id) { global $_USER, $_CONF, $_MG_CONF, $LANG_MG01, $LANG_MG03; $retval = ''; if ($_MG_CONF['verbose']) { COM_errorLog('***Inside MG_SWFUpload()***'); } $root_album = new mgAlbum(0); // construct the album selectbox ... $album_selectbox = MG_buildAlbumBox($root_album, $album_id, 3, -1, 'upload'); if (empty($album_selectbox)) { return ''; } // construct the album jumpbox... $album_jumpbox = MG_buildAlbumJumpbox($root_album, $album_id); // tell the flash uploader what the maximum file size can be. $file_size_limit = MG_getUploadLimit($album_id) . ' bytes'; if ($_MG_CONF['verbose']) { COM_errorLog('file_size_limit=' . $file_size_limit); } // determine the valid filetypes for the current album $allowed_file_types = MG_getValidFileTypes($album_id); if ($_MG_CONF['verbose']) { COM_errorLog('allowed_file_types=' . $allowed_file_types); } // the flash uploader does not play nice with cookies, therefore we need to pass the uid // and a token to use as a second authentication factor. let's make the token good for 4 hours // if the token expires, then the user will have to visit the swfupload page again, but // unfortunately because the upload handler runs in the background, there is really no way // to inform the users that the upload(s) failed (yet). $user_id = $_USER['uid']; // $user_token = SEC_createTokenGeneral( 'swfupload', 14400 );////////////////////////////////////////// $T = COM_newTemplate(MG_getTemplatePath($album_id)); $T->set_file('mupload', 'swfupload.thtml'); $T->set_var(array('start_block' => COM_startBlock($LANG_MG03['upload_media']), 'end_block' => COM_endBlock(), 'navbar' => MG_navbar($LANG_MG01['swfupload_media'], $album_id), 'site_url' => $_CONF['site_url'], 'album_id' => $album_id, 'album_select' => $album_selectbox, 'jumpbox' => $album_jumpbox, 'lang_destination' => $LANG_MG01['destination_album'], 'upload_url' => 'swfupload/swfupload.php', 'flash_url' => 'swfupload/swfupload.swf', 'user_id' => $user_id, 'user_token' => $user_token, 'swfupload_usage' => $LANG_MG01['swfupload_usage'], 'swfupload_allowed_types' => $LANG_MG01['swfupload_allowed_types'], 'swfupload_file_types' => $allowed_file_types, 'swfupload_file_size_limit' => $LANG_MG01['swfupload_file_size_limit'], 'swfupload_size_limit' => $file_size_limit, 'swfupload_pending' => $LANG_MG01['swfupload_pending'], 'swfupload_q_too_many' => $LANG_MG01['swfupload_q_too_many'], 'sfwupload_q_limit' => $LANG_MG01['swfupload_q_limit'], 'swfupload_q_select' => $LANG_MG01['swfupload_q_select'], 'swfupload_q_up_to' => $LANG_MG01['swfupload_q_up_to'], 'swfupload_files' => $LANG_MG01['swfupload_files'], 'swfupload_one_file' => $LANG_MG01['swfupload_one_file'], 'swfupload_err_filesize' => $LANG_MG01['swfupload_err_filesize'], 'swfupload_err_zerosize' => $LANG_MG01['swfupload_err_zerosize'], 'swfupload_err_filetype' => $LANG_MG01['swfupload_err_filetype'], 'swfupload_err_general' => $LANG_MG01['swfupload_err_general'], 'swfupload_uploading' => $LANG_MG01['swfupload_uploading'], 'swfupload_complete' => $LANG_MG01['swfupload_complete'], 'swfupload_error' => $LANG_MG01['swfupload_error'], 'swfupload_failed' => $LANG_MG01['swfupload_failed'], 'swfupload_io_error' => $LANG_MG01['swfupload_io_error'], 'swfupload_sec_error' => $LANG_MG01['swfupload_sec_error'], 'swfupload_limit_exceeded' => $LANG_MG01['swfupload_limit_exceeded'], 'swfupload_fail_validation' => $LANG_MG01['swfupload_fail_validation'], 'swfupload_cancelled' => $LANG_MG01['swfupload_cancelled'], 'swfupload_stopped' => $LANG_MG01['swfupload_stopped'], 'swfupload_unhandled' => $LANG_MG01['swfupload_unhandled'], 'swfupload_file' => $LANG_MG01['swfupload_file'], 'swfupload_uploaded' => $LANG_MG01['swfupload_uploaded'], 'swfupload_types_desc' => $LANG_MG01['swfupload_types_desc'], 'swfupload_queue' => $LANG_MG01['swfupload_queue'], 'swfupload_continue' => $LANG_MG01['swfupload_continue'], 'swfupload_cancel_all' => $LANG_MG01['swfupload_cancel_all'], 'swfupload_noscript' => $LANG_MG01['swfupload_noscript'], 'swfupload_is_loading' => $LANG_MG01['swfupload_is_loading'], 'swfupload_not_loading' => $LANG_MG01['swfupload_not_loading'], 'swfupload_didnt_load' => $LANG_MG01['swfupload_didnt_load'], 'save_exit' => $LANG_MG01['save_exit'], 'title' => $LANG_MG01['title'], 'description' => $LANG_MG01['description'])); $T->parse('output', 'mupload'); $retval .= $T->finish($T->get_var('output')); return $retval; }
function MG_HTML5Upload($album_id) { global $album_jumpbox, $album_selectbox, $MG_albums, $_FILES, $_USER, $_CONF, $_TABLES, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG02, $LANG_MG03, $_POST; $retval = ''; $valid_albums = 0; $level = 0; $select = $album_id; if ($_MG_CONF['verbose']) { COM_errorLog('***Inside MG_HTML5Upload()***'); } // construct the album selectbox ... $album_selectbox = '<select name="album_id" onChange="onAlbumChange()">'; $valid_albums += $MG_albums[0]->buildAlbumBox($select, 3, -1, 'upload'); $album_selectbox .= '</select>'; // tell the flash uploader what the maximum file size can be. $file_size_limit = MG_getUploadLimit($album_id) . ' B'; if ($_MG_CONF['verbose']) { COM_errorLog('file_size_limit=' . $file_size_limit); } // determine the valid filetypes for the current album $allowed_file_types = MG_getValidFileTypes($album_id); if ($_MG_CONF['verbose']) { COM_errorLog('allowed_file_types=' . $allowed_file_types); } $user_id = $_USER['uid']; $user_token = SEC_createTokenGeneral('html5upload', 14400); $T = new Template(MG_getTemplatePath($album_id)); $T->set_file('mupload', 'html5upload.thtml'); $T->set_var(array('site_url' => $_MG_CONF['site_url'], 'album_id' => $album_id, 'album_select' => $album_selectbox, 'lang_destination' => $LANG_MG01['destination_album'], 'user_id' => $user_id, 'user_token' => $user_token, 'html5upload_usage' => $LANG_MG01['html5upload_usage'], 'html5upload_allowed_types' => $LANG_MG01['html5upload_allowed_types'], 'html5upload_file_types' => $allowed_file_types, 'html5upload_file_size_limit' => $LANG_MG01['html5upload_file_size_limit'], 'html5upload_size_limit' => $file_size_limit)); $T->parse('output', 'mupload'); $retval .= $T->finish($T->get_var('output')); return $retval; }
} require_once $_CONF['path'] . 'plugins/mediagallery/include/common.php'; if ($_MG_CONF['verbose']) { COM_errorLog('album_rpc.php: invocation ------------------------'); } if (!isset($_REQUEST['aid'])) { COM_errorLog('album_rpc.php: invocation with no album parameter'); exit(0); } // retrieve the album_id passed $album_id = COM_applyFilter($_REQUEST['aid'], true); $album_data = MG_getAlbumData($album_id, array('album_id'), false); // check to ensure we have a valid album_id if (isset($album_data['album_id']) && $album_data['album_id'] == $album_id) { // retrieve the upload filesize limit $size_limit = MG_getUploadLimit($album_id); // retrieve the valid filetypes $valid_types = MG_getValidFileTypes($album_id); if ($_MG_CONF['verbose']) { COM_errorLog('album_id = ' . $album_id); COM_errorLog('size_limit = ' . $size_limit); COM_errorLog('valid_types = ' . $valid_types); COM_errorLog('album_rpc.php: normal termination ----------------'); } } else { COM_errorLog('album_rpc.php: invalid album id = ' . $album_id); $size_limit = 0; $valid_types = ''; } // return the album-specific data echo $size_limit . '%' . $valid_types;