Example #1
0
/**
 * Changes "priv" to "pub" and controversely. If the album name has neither suffix, returns the same string.
 * @param type $album_name 
 * @return string
 */
function suffix_replace($album_name)
{
    $res = $album_name;
    $res = suffix_remove($album_name);
    if (substr($album_name, -4) == "-pub") {
        $res .= '-priv';
    } else {
        if (substr($album_name, -5) == '-priv') {
            $res .= '-pub';
        }
    }
    return $res;
}
Example #2
0
    <div id="site_map">
        <a class="home-link" href="index.php" title="®Back_to_home®">®Home®</a>    
        <?php 
if (acl_has_album_permissions($album)) {
    $token = acl_token_get($album);
    $token = $token['token'];
    ?>
            <div class="right-arrow"></div>
            <a  href="javascript:show_album_assets('<?php 
    echo $album;
    ?>
', '<?php 
    echo $token;
    ?>
');" title="®Back_to_album®">(<?php 
    echo suffix_remove($album);
    ?>
) <?php 
    echo get_album_title($album);
    ?>
</a>   
        <?php 
}
?>
        <div class="right-arrow"></div><?php 
print_info($asset_meta['title']);
?>
    </div>

    <div id="video_player">
        <!-- #main_video : HTML5 video player.
Example #3
0
/**
 * Exports all bookmarks from the given album / asset
 * @global type $input
 * @global type $user_files_path
 * @global type $repository_path
 * @param type $export_asset false if all album's bookmarks must be exported;
 * true if only specified asset's bookmarks must be exported
 */
function bookmarks_export_all($export_asset = false)
{
    global $input;
    global $user_files_path;
    global $repository_path;
    $album = $input['album'];
    if ($export_asset) {
        $asset = $input['asset'];
    }
    // init paths
    ezmam_repository_path($repository_path);
    user_prefs_repository_path($user_files_path);
    // name for the file to be saved
    $filename = get_lang() == 'fr' ? 'signets' : 'bookmarks';
    $filename .= '_' . suffix_remove($album);
    if (isset($asset) && $asset != '') {
        $filename .= '_' . $asset;
    }
    $filename .= '.xml';
    // download popup
    if ($export_asset) {
        $bookmarks = user_prefs_asset_bookmarks_list_get($_SESSION['user_login'], $album, $asset);
    } else {
        $bookmarks = user_prefs_album_bookmarks_list_get($_SESSION['user_login'], $album);
    }
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Disposition: attachment; filename={$filename}");
    header("Content-Type: text/xml");
    header("Content-Transfer-Encoding: binary");
    // XML to save in the file
    $xml_txt = assoc_array2xml_string($bookmarks, "bookmarks", "bookmark");
    // Formating XML for pretty display
    $dom = new DOMDocument();
    $dom->preserveWhiteSpace = FALSE;
    $dom->loadXML($xml_txt);
    $dom->formatOutput = TRUE;
    ob_clean();
    flush();
    echo $dom->saveXml();
    log_append('export_asset_bookmarks: bookmarks exported from the album ' . $album);
}
Example #4
0
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);
    }
}
Example #5
0
        ?>
                <li>    
                    <a class="item <?php 
        if ($private) {
            echo 'private';
        }
        ?>
" href="javascript:show_album_assets('<?php 
        echo $album['album'];
        ?>
', '<?php 
        echo $album['token'];
        ?>
');">
                        <b style="text-transform:uppercase;"><?php 
        echo suffix_remove($album['album']);
        ?>
</b> 
                        <?php 
        if ($private) {
            echo '(®Private_album®)';
        }
        ?>
                        <br/><?php 
        print_info($album['title']);
        ?>

                    </a>
                </li>
                <?php 
        if (acl_user_is_logged()) {
Example #6
0
function view_edit_album()
{
    global $intros;
    global $titlings;
    global $downloadable;
    global $repository_path;
    global $default_add_title;
    global $default_downloadable;
    $album = suffix_remove($_SESSION['podman_album']);
    $moderation = album_is_private($_SESSION['podman_album']);
    $visibility = $moderation ? '-priv' : '-pub';
    ezmam_repository_path($repository_path);
    $album_meta = ezmam_album_metadata_get($album . $visibility);
    // for preselection in the form
    $album_intro = $album_meta['intro'];
    if (isset($album_meta['add_title'])) {
        $add_title = $album_meta['add_title'];
    } else {
        $add_title = $default_add_title;
    }
    // for the checkbox in the form
    $downloadable = isset($album_meta['downloadable']) ? $album_meta['downloadable'] : $default_downloadable;
    require_once template_getpath('popup_edit_album.php');
    die;
}
Example #7
0
<b class="blue-title" style="font-size: 14px" onclick="$('#bookmarks_result').toggle();">®Personal® </b>
<div id ="bookmarks_result">
<ul class="search_result">
    <?php 
$album_ref = '';
$asset_ref = '';
foreach ($bookmarks as $index => $bookmark) {
    if ($album_ref != $bookmark['album']) {
        ?>
            <li class="album_result">(<?php 
        echo suffix_remove($bookmark['album']);
        ?>
) <?php 
        echo get_album_title($bookmark['album']);
        ?>
</li>
        <?php 
    }
    ?>
        <?php 
    if ($asset_ref != $bookmark['asset']) {
        ?>
            <li class="asset_result"><div class="right-arrow"></div><?php 
        print_info(substr(get_user_friendly_date($bookmark['asset'], '/', false, get_lang(), false), 0, 10));
        ?>
 <?php 
        echo get_asset_title($bookmark['album'], $bookmark['asset']);
        ?>
</li>
        <?php 
    }
Example #8
0
/**
 * Checks whether a user has access to an album
 * @param string $album Name of the album we want to access
 * @return bool true if user can access $album, false otherwise
 */
function acl_has_album_permissions($album)
{
    if (!acl_user_is_logged()) {
        error_print_message('Error: acl_has_album_permissions: You are not logged in');
        return false;
    }
    return in_array(suffix_remove($album), $_SESSION['acl_permitted_albums']);
}
/**
 * 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;
}
Example #10
0
/**
 * Checks whether a user has moderation rights on an album
 * @param string $album Name of the album we want to access
 * @return bool true if user can moderate $album, false otherwise
 */
function acl_has_album_moderation($album)
{
    if (!acl_user_is_logged()) {
        //   error_print_message('Error: acl_has_album_permissions: You are not logged in');
        return false;
    }
    $album = suffix_remove($album);
    $moderated_albums = array_keys($_SESSION['acl_moderated_albums']);
    return in_array($album, $moderated_albums);
}