function view_media() { global $accepted_media_qualities; global $accepted_media_types; global $input; // 0) Sanity checks if (!ezmam_album_exists($input['album'])) { error_print_http(404); log_append('warning', 'view_media: tried to access non-existant album ' . $input['album']); die; } if (!ezmam_asset_exists($input['album'], $input['asset'])) { error_print_http(404); log_append('warning', 'view_media: tried to access non-existant asset ' . $input['asset'] . ' from album ' . $input['album']); die; } if (!ezmam_album_token_check($input['album'], $input['token']) && !ezmam_asset_token_check($input['album'], $input['asset'], $input['token'])) { error_print_http(404); log_append('warning', 'view_media: tried to access asset ' . $input['asset'] . ' from album ' . $input['album'] . ' with invalid token ' . $input['token']); die; } if (!isset($input['quality'])) { $input['quality'] = 'high'; } if (!accepted_quality($input['quality'])) { error_print_http(403); log_append('warning', 'view_media: tried to access forbidden quality "' . $input['quality'] . '"'); die; } if (!accepted_type($input['type'])) { error_print_http(403); log_append('warning', 'view_media: tried to access forbidden media type "' . $input['type'] . '"'); die; } // 1) First we retrieve the media path $quality = strtolower($input['quality']); $type = strtolower($input['type']); $media_name = $quality . '_' . $type; $media_handle = ezmam_media_getpath($input['album'], $input['asset'], $media_name, false); // If we couldn't find our file, we check whether it exists in another quality if (!$media_handle) { if ($quality == 'low') { $quality = 'high'; } else { if ($quality == 'high') { $quality = 'low'; } } $media_name = $quality . '_' . $type; $media_handle = ezmam_media_getpath($input['album'], $input['asset'], $media_name, false); // If we still can't find a file, we just tell the users so if (!$media_handle) { error_print_http(404); log_append('view_media: couldn\'t find the media file for asset ' . $input['asset'] . ' of album ' . $input['album']); die; } } // 2) Then we save some statistics on it ezmam_media_viewcount_increment($input['album'], $input['asset'], $media_name, $input['origin']); // 3) And finally, we deliver it! $filename = suffix_remove($input['album']); $filename .= '_-_'; $filename .= get_user_friendly_date($input['asset'], '_', true, 'fr-ASCII'); //add a quality part in filename if ($quality == 'low') { $quality_fn_part = 'SQ'; } else { $quality_fn_part = 'HQ'; } $filename .= '_' . $quality_fn_part; //add a type video/slide part in filename if ($type == 'cam') { $type_fn_part = 'video'; } else { $type_fn_part = 'slide'; } $filename .= '_' . $type_fn_part; // header('Content-Type: video/x-m4v'); header('Content-Type: video/mp4'); if (isset($_SERVER['HTTP_RANGE'])) { rangeDownload($media_handle); } else { header('Content-Disposition: attachment; filename=' . $filename . '.m4v'); //header('Content-Transfer-Encoding: binary'); //header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Content-Length: ' . filesize($media_handle)); header('Accept-Ranges: bytes'); //readfile($media_handle); //fpassthru($fh); passthru('/bin/cat ' . escapeshellarg($media_handle)); fclose($fh); } }
<b>®Description®: </b><?php print_info($personal_bookmark['description']); ?> <br/> <b>®Keywords®: </b><?php print_info($personal_bookmark['keywords']); ?> </div> </div></a> </div> <?php } else { ?> <div style="display: inline-block; width: 457px; padding-left: 8px;"> <span style="padding-left: 0px;"><b><?php print_info(substr(get_user_friendly_date($bookmark['asset'], '/', false, get_lang(), false), 0, 10)); ?> </b></span> <?php echo get_asset_title($bookmark['album'], $bookmark['asset']); ?> <div class="right-arrow"></div> <?php print_bookmark_title($bookmark['title']); ?> </div> <?php } ?> </li>
/** * This function shows the asset details div for the asset passed by POST, GET or SESSION * @global type $input * @global type $repository_path */ function view_asset_details() { global $input; global $repository_path; global $ezmanager_url; // Setting up various variables we'll need later if (isset($input['album'])) { $album = $input['album']; } else { $album = $_SESSION['album']; } if (isset($input['asset'])) { $asset = $input['asset']; } else { $asset = $_SESSION['asset']; } ezmam_repository_path($repository_path); // // 0) Sanity checks // if (!isset($album) || !ezmam_album_exists($album)) { error_print_message(template_get_message('Non-existant_album', get_lang())); log_append('warning', 'view_asset_details: tried to access album ' . $album . ' which does not exist'); die; } if (!ezmam_asset_exists($album, $asset)) { error_print_message(template_get_message('Non-existant_asset', get_lang())); log_append('warning', 'view_asset_details: tried to access asset ' . $asset . ' of album ' . $album . ' which does not exist'); die; } if (!acl_has_album_permissions($album)) { error_print_message(template_get_message('Unauthorized', get_lang())); log_append('warning', 'view_asset_details: tried to access album ' . $album . ' without permission'); die; } // // 1) We retrieve the metadata for the asset and its media // $asset_metadata = ezmam_asset_metadata_get($album, $asset); $media_metadata = ezmam_media_list_metadata_assoc($album, $asset); // // 2) Now we can set up the variables used in the template // $asset_name = $asset; // "Technical" asset name $author = $asset_metadata['author']; // Asset author $title = $asset_metadata['title']; // "user-friendly" asset name (title) $description = $asset_metadata['description']; // Asset description $date = get_user_friendly_date($asset_metadata['record_date'], ' ', true, get_lang(), true); // Recording date, i.e. asset creation date $origin = $asset_metadata['origin']; $status = $asset_metadata['status']; $public_album = album_is_public($album); // Whether the album the asset is public or not $has_cam = strpos($asset_metadata['record_type'], 'cam') !== false; // Whether or not the asset has a "live-action" video $has_slides = strpos($asset_metadata['record_type'], 'slide') !== false; // Whether or not the asset has slides $created_albums_list_with_descriptions = acl_authorized_albums_list_created(true); // List of all the created albums (used for asset move) $asset_token = ezmam_asset_token_get($album, $asset); // Asset token, used for embedded media player (preview) // Filling in the data about the media // all you want to know about high res camera video if (isset($media_metadata['high_cam'])) { $filesize_cam['HD'] = $media_metadata['high_cam']['file_size']; $dimensions_cam['HD'] = $media_metadata['high_cam']['width'] . ' x ' . $media_metadata['high_cam']['height']; $format_cam = $media_metadata['high_cam']['codec']; } // Everything about the low-res version of the camera video if (isset($media_metadata['low_cam'])) { $filesize_cam['SD'] = $media_metadata['low_cam']['file_size']; $dimensions_cam['SD'] = $media_metadata['low_cam']['width'] . ' x ' . $media_metadata['low_cam']['height']; } // Everything about the high-res slides video if (isset($media_metadata['high_slide'])) { $filesize_slides['HD'] = $media_metadata['high_slide']['file_size']; $dimensions_slides['HD'] = $media_metadata['high_slide']['width'] . ' x ' . $media_metadata['high_slide']['height']; $format_slides = $media_metadata['high_slides']['codec']; } // Everything about the low-res slides if (isset($media_metadata['low_slide'])) { $filesize_slides['SD'] = $media_metadata['low_slide']['file_size']; $dimensions_slides['SD'] = $media_metadata['low_slide']['width'] . ' x ' . $media_metadata['low_slide']['height']; } // To get the duration, we use the high cam media if it exists, or the high_slide // media otherwise. We assume at least one of these exists. $duration = $media_metadata['high_cam']['duration']; if (!isset($duration) || empty($duration)) { $duration = $media_metadata['high_slide']['duration']; } $duration = get_user_friendly_duration($duration); // Finally, we set up the URLs and view counts to the different media if ($has_cam) { $url_cam['HD'] = ezmam_media_geturl($album, $asset, 'high_cam'); $url_cam['SD'] = ezmam_media_geturl($album, $asset, 'low_cam'); // specific code that contains information about the media $code_cam['HD'] = get_code_to_media($album, $asset, 'high_cam'); $code_cam['SD'] = get_code_to_media($album, $asset, 'low_cam'); $view_count_cam = ezmam_media_viewcount_get($album, $asset, 'high_cam') + ezmam_media_viewcount_get($album, $asset, 'low_cam'); } if ($has_slides) { $url_slides['HD'] = ezmam_media_geturl($album, $asset, 'high_slide'); $url_slides['SD'] = ezmam_media_geturl($album, $asset, 'low_slide'); $code_slide['HD'] = get_code_to_media($album, $asset, 'high_slide'); $code_slide['SD'] = get_code_to_media($album, $asset, 'low_slide'); $view_count_slides = ezmam_media_viewcount_get($album, $asset, 'high_slide') + ezmam_media_viewcount_get($album, $asset, 'low_slide'); } $file_name = ''; if ($origin == 'SUBMIT') { if ($asset_metadata['submitted_cam'] != '' && $asset_metadata['submitted_slide'] != '') { $file_name = $asset_metadata['submitted_cam'] . ' & ' . $asset_metadata['submitted_slide']; } else { if ($asset_metadata['submitted_cam'] != '') { $file_name = $asset_metadata['submitted_cam']; } else { $file_name = $asset_metadata['submitted_slide']; } } } // // 3) We save the current state in session vars // $_SESSION['podman_mode'] = 'view_asset_details'; $_SESSION['podman_album'] = $input['album']; $_SESSION['podman_asset'] = $input['asset']; // // 4) Then display the asset and its content // require_once template_getpath('div_asset_details.php'); }
?> ) <?php echo get_album_title($album); ?> </li> <?php } $token = acl_token_get($album); $token = $token['token']; foreach ($album_threads as $asset => $asset_threads) { ?> <?php if ($asset_ref != $asset) { ?> <li class="asset_result"><div class="right-arrow"></div><?php print_info(substr(get_user_friendly_date($asset, '/', false, get_lang(), false), 0, 10)); ?> <?php echo get_asset_title($album, $asset); ?> </li> <?php } foreach ($asset_threads as $thread_id => $thread) { ?> <li id="result_thread_<?php echo $thread_id; ?> " class="result">
<li> <a class="item" id="asset-<?php echo $asset['name']; ?> " href="javascript:show_asset_details('<?php echo $album; ?> ', '<?php echo $asset['name']; ?> ', '<?php echo $asset['token']; ?> ');"> <b><?php print_info(substr(get_user_friendly_date($asset['metadata']['record_date'], '/', false, get_lang(), false), 0, 10)); ?> </b> <div style="display:inline-block; width: 16px; height:1px;"></div> <?php echo $asset['metadata']['title']; ?> <span class="<?php if (acl_show_notifications() && !acl_is_watched($album, $asset['metadata']['record_date'])) { echo 'new'; } ?> " title="®New_video®"></span> </a> </li> <?php
<div class="BlocPodcastMenu"> <?php require_once 'lib_various.php'; // Note: we can't use foreach() here because assets are ordered by date, oldest first, // and we want the assets to be displayed with the newest first if (isset($assets) && !empty($assets)) { foreach ($assets as $asset) { $asset_name = $asset['name']; $metadata = $asset['metadata']; // Testing purpose only: if the title does not exist, we replace it by // the asset (raw) name $title = isset($metadata['title']) ? $metadata['title'] : $asset_name; $status = $metadata['status']; // We want the date to be displayed in format dd-mm-YYYY // However, get_user_friendly_date returns dd-mm-YYYY-HH-ii, so we need to remove the last part $date = get_user_friendly_date($metadata['record_date'], '-', false); $date = substr($date, 0, -6); ?> <div> <input class="custom-checkbox" name="asset_downloadable" id="is_downloadable_<?php echo $asset_name; ?> " title="®Allow_download®" type="checkbox" onchange="asset_downloadable_set('<?php echo $album_name . ($public_album ? '-pub' : '-priv'); ?> ', '<?php echo $asset_name; ?> ')" <?php
/** * generate the title.xml file in render_dir for title processing * @global string $organization_name * @param string $album * @param string $asset_meta * @param string $render_dir */ function submit_itm_set_title($album_meta, $asset_meta, $render_dir) { global $organization_name, $copyright, $title_duration; //get date $human_date = get_user_friendly_date($asset_meta['record_date'], ' ', true, 'fr', false); $asset_title = $asset_meta['title']; //medium short titles should break after album name if (strlen($asset_title) <= 24) { $asset_title = str_replace(' ', utf8_encode(chr(160)), $asset_title); } //original title with no breaking spaces $title_info = array('album' => '[' . suffix_remove($album_meta['name']) . '] ' . $album_meta['description'], 'title' => suffix_remove($album) . " " . $asset_title, 'author' => $asset_meta['author'], 'date' => $human_date, 'organization' => $organization_name, 'copyright' => $copyright); //write the title xml file to the "shared directory" $res = assoc_array2metadata_file($title_info, $render_dir . "/title.xml"); if (!$res) { myerror("couldnt write title metadata to {$render_dir}/title.xml"); } return $res; }