Esempio n. 1
0
/**
 * Displays the asset details and bookmarks.
 * This function is called when a user selects a bookmark from the bookmarks 
 * tab in the assets page or when a user shares a link to a specific timecode 
 * with an other user.
 * @global type $input
 * @global type $repository_path
 * @global type $asset_meta
 * @global string $panel_display
 * @global type $album
 * @global type $user_files_path
 * @global type $is_bookmark
 * @global type $asset_bookmarks
 * @global type $timecode
 * @param type $refresh_center
 */
function view_asset_bookmark($refresh_center = true)
{
    global $appname;
    global $input;
    global $asset_meta;
    global $album;
    global $user_files_path;
    global $repository_path;
    global $ezplayer_url;
    // used in a popup window
    global $is_bookmark;
    global $asset_bookmarks;
    global $toc_bookmarks;
    global $default_bookmarks_order;
    global $default_toc_order;
    global $timecode;
    global $error_asset;
    global $login_error;
    // used to display error when anonymous user login
    // the video will be loaded by a different way
    $_SESSION['load_video'] = false;
    // determines if the user is logged and has album authorization
    $is_bookmark = false;
    $error_asset = '';
    // session has expired, the whole page has to be refreshed
    if ($_SESSION['reloaded']) {
        unset($input['click']);
        unset($_SESSION['reloaded']);
        $refresh_center = true;
    }
    // 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'];
    }
    if (isset($input['t'])) {
        $timecode = $input['t'];
    } else {
        $timecode = $_SESSION['timecode'];
    }
    if (isset($input['thread_id'])) {
        $thread_id = $input['thread_id'];
    }
    // init paths
    ezmam_repository_path($repository_path);
    user_prefs_repository_path($user_files_path);
    //
    // 0) Sanity checks
    //
    if (!isset($album) || !ezmam_album_exists($album)) {
        if ($input['click']) {
            // refresh a part of the page
            include_once template_getpath('error_album_not_found.php');
        } else {
            // refresh the whole page
            $error_path = template_getpath('error_album_not_found.php');
            include_once template_getpath('main.php');
        }
        log_append('warning', 'view_asset_bookmark: tried to access album ' . $album . ' which does not exist');
        die;
    }
    if (!ezmam_asset_exists($album, $asset)) {
        $error_asset = $asset;
        if ($input['click']) {
            include_once template_getpath('error_asset_not_found.php');
        } else {
            $error_path = template_getpath('error_asset_not_found.php');
            include_once template_getpath('main.php');
        }
        log_append('warning', 'view_asset_bookmark: tried to access asset ' . $asset . ' of album ' . $album . ' which does not exist');
        die;
    }
    // only users who have album authorization can access a specific bookmark
    // anonymous users cannot access a shared bookmark
    if (acl_has_album_permissions($album)) {
        $is_bookmark = true;
    } else {
        if (!ezmam_asset_token_check($album, $asset, $_SESSION['asset_token'])) {
            if ($input['click']) {
                include_once template_getpath('error_permission_denied.php');
            } else {
                $error_path = template_getpath('error_permission_denied.php');
                include_once template_getpath('main.php');
            }
            log_append('warning', 'view_asset_bookmark: no permission to asset ' . $input['asset'] . 'in album ' . $input['album']);
            die;
        }
    }
    if (acl_user_is_logged()) {
        if (user_prefs_watched_add($_SESSION['user_login'], $album, $asset) && acl_show_notifications()) {
            acl_update_watched_assets();
        }
    }
    // 1) info for the selected asset
    $asset_meta = ezmam_asset_metadata_get($album, $asset);
    if ($asset_meta['record_type'] == 'camslide' || $asset_meta['record_type'] == 'cam') {
        $asset_meta['high_cam_src'] = get_link_to_media($album, $asset, 'high_cam');
        $asset_meta['low_cam_src'] = get_link_to_media($album, $asset, 'low_cam');
        // #t=$timecode stands for W3C temporal Media Fragments URI (working in Firefox and Chrome)
        $asset_meta['src'] = $asset_meta['low_cam_src'] . '&origin=' . $appname . "#t=" . $timecode;
    }
    if ($asset_meta['record_type'] == 'camslide' || $asset_meta['record_type'] == 'slide') {
        $asset_meta['high_slide_src'] = get_link_to_media($album, $asset, 'high_slide');
        $asset_meta['low_slide_src'] = get_link_to_media($album, $asset, 'low_slide');
        if ($asset_meta['record_type'] == 'slide') {
            // #t=$timecode stands for W3C temporal Media Fragments URI (working in Firefox and Chrome)
            $asset_meta['src'] = $asset_meta['low_slide_src'] . "#t=" . $timecode;
        }
    }
    // user is logged and has acces to the selected album
    if ($is_bookmark) {
        $asset_bookmarks = user_prefs_asset_bookmarks_list_get($_SESSION['user_login'], $album, $asset);
        // sorts the bookmarks following user's prefs
        $order = acl_value_get("bookmarks_order");
        if (isset($order) && $order != '' && $order != $default_bookmarks_order) {
            $asset_bookmarks = array_reverse($asset_bookmarks);
        }
    }
    $toc_bookmarks = toc_asset_bookmark_list_get($album, $asset);
    // sorts the bookmarks following user's prefs
    $order = acl_value_get("toc_order");
    if (isset($order) && $order != '' && $order != $default_toc_order) {
        $toc_bookmarks = array_reverse($toc_bookmarks);
    }
    log_append('view_asset_bookmark: album = ' . $album . ", asset = " . $asset);
    $_SESSION['ezplayer_mode'] = 'view_asset_bookmark';
    // used in 'div_left_details.php'
    $_SESSION['album'] = $album;
    $_SESSION['asset'] = $asset;
    $_SESSION['timecode'] = $timecode;
    $_SESSION['current_thread'] = $thread_id;
    $_SESSION['loaded_type'] = $input['type'];
    if ($refresh_center) {
        if (acl_display_threads()) {
            if (isset($thread_id)) {
                // click from lvl 2 on a discussion
                $threads = threads_select_by_asset($album, $asset);
                $thread = thread_details_update(false);
                $_SESSION['thread_display'] = 'details';
            } else {
                // click from lvl 2 on a bookmark
                $threads = threads_select_by_asset($album, $asset);
                $_SESSION['thread_display'] = 'list';
            }
        }
        if ($input['click']) {
            // refresh the center of the page (local link)
            // lvl, action, album, asset, timecode, targeted type (cam|slide), record type (cam|slide|camslide), permissions (view official | add personal), origin
            trace_append(array('3', 'view_asset_timecode', $album, $asset, $timecode, $_SESSION['loaded_type'], $asset_meta['record_type'], $is_bookmark ? 'view_and_add' : 'view_only', 'from_ezplayer'));
            include_once template_getpath('div_assets_center.php');
        } else {
            // refresh the whole page (shared link)
            trace_append(array('3', 'view_asset_timecode', $album, $asset, $timecode, $_SESSION['loaded_type'], $asset_meta['record_type'], $is_bookmark ? 'view_and_add' : 'view_only', 'from_external'));
            include_once template_getpath('main.php');
        }
    } else {
        // refresh the right panel (import / export / edition / deletion / ...)
        include_once template_getpath('div_side_details.php');
    }
}
Esempio n. 2
0
, 'up');" title="®Move_up®"></a>
                    <?php 
            if ($index != count($albums) - 1) {
                ?>
<a class="down-arrow" href="javascript:move_album_token('<?php 
                echo $album['album'];
                ?>
', <?php 
                echo $index;
                ?>
, 'down');" title="®Move_down®"></a><?php 
            }
            ?>
                    </div>
                    <?php 
            if (acl_user_is_logged() && acl_show_notifications()) {
                $count = acl_global_count($album['album']);
                if ($count - acl_watched_count($album['album']) > 0) {
                    ?>
                            <div class="album_count green" title="<?php 
                    print_new_video($count - acl_watched_count($album['album']));
                    ?>
"><?php 
                    echo $count - acl_watched_count($album['album']);
                    ?>
</div>
                            <?php 
                }
            }
            ?>
 
Esempio n. 3
0
acl_update_settings();
?>

<form name="submit_settings_form" action="<?php 
global $ezplayer_safe_url;
echo $ezplayer_safe_url;
?>
/index.php" method="post">
    <input type="hidden" name="action" value="edit_settings" />
    <table>
        <th><span class="title left">Notifications</span></th><br/>
        <tr>
            <td><span>®Notification_new_video®</span><td>
            <td><input id="settings_notif_new_asset" name="display_new_video_notification" 
                       type="checkbox" <?php 
echo acl_show_notifications() ? 'checked' : '';
?>
/></td>
        </tr>
        <tr>
            <td><span>®Notification_during_video_playback®</span><td>
            <td><input id="settings_notif_threads" name="display_thread_notification" 
                       type="checkbox" <?php 
echo acl_display_thread_notification() ? 'checked' : '';
?>
/></td>
        </tr>
        <th><span class="title left">®General®</span></th><br/>
        <tr>
            <td><span>®Show_discussions®</span><td>
            <td><input id="settings_display_threads" name="display_threads" 
Esempio n. 4
0
            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 
        }
    }
    ?>
            </ul>
            <?php 
}
?>
    </div>
Esempio n. 5
0
/**
 * Updates the (locally stored) list of consulted albums and moderated albums 
 */
function acl_update_permissions_list()
{
    global $repository_path;
    ezmam_repository_path($repository_path);
    $courses_list_for_author = array();
    $consulted_albums = array();
    if (acl_user_is_logged()) {
        $courses_list_for_author = courses_list($_SESSION['user_login']);
        foreach ($courses_list_for_author as $key => $title) {
            if (!ezmam_album_exists("{$key}-pub")) {
                unset($courses_list_for_author[$key]);
            }
        }
        $album_tokens_list = user_prefs_tokens_get($_SESSION['user_login']);
        foreach ($album_tokens_list as $album_token) {
            $consulted_albums[] = $album_token['album'];
        }
        $_SESSION['acl_album_tokens'] = $album_tokens_list;
    } else {
        // anonymous user : every consulted album is directly stored in $_SESSION['acl_album_tokens']
        // tokens stored during action "view_album_assets" in web_index.php
        foreach ($_SESSION['acl_album_tokens'] as $album_token) {
            $consulted_albums[] = $album_token['album'];
        }
    }
    if (acl_show_notifications()) {
        acl_update_watched_assets();
    }
    $_SESSION['acl_consulted_albums'] = $consulted_albums;
    $_SESSION['acl_moderated_albums'] = $courses_list_for_author;
}