示例#1
0
/**
 * Updates user preferences
 * @global type $input
 * @return boolean
 */
function preferences_update()
{
    /*   global $input;
          $display_new_video_notification = $input['display_new_video_notification'];
          $display_threads = $input['display_threads'];
          $display_thread_notification = $input['display_thread_notification'];
    
          user_prefs_settings_update($_SESSION['user_login'], "display_new_video_notification", $display_new_video_notification);
          user_prefs_settings_update($_SESSION['user_login'], "display_threads", $display_threads);
          user_prefs_settings_update($_SESSION['user_login'], "display_thread_notification", $display_thread_notification);
    
          acl_update_settings();
          include_once template_getpath('div_main_center.php');
          return true;
         */
    global $input;
    global $ezplayer_url;
    $display_new_video_notification = isset($input['display_new_video_notification']) && $input['display_new_video_notification'] === 'on' ? '1' : '0';
    $display_threads = isset($input['display_threads']) && $input['display_threads'] === 'on' ? '1' : '0';
    $display_thread_notification = isset($input['display_thread_notification']) && $input['display_thread_notification'] === 'on' ? '1' : '0';
    user_prefs_settings_update($_SESSION['user_login'], "display_new_video_notification", $display_new_video_notification);
    user_prefs_settings_update($_SESSION['user_login'], "display_threads", $display_threads);
    user_prefs_settings_update($_SESSION['user_login'], "display_thread_notification", $display_thread_notification);
    acl_update_settings();
    trace_append(array('0', 'preferences_update', $display_new_video_notification, $display_threads, $display_thread_notification));
    if ($display_new_video_notification) {
        acl_update_watched_assets();
    } else {
        unset($_SESSION['acl_watched_assets']);
    }
    $input['action'] = $_SESSION['ezplayer_mode'];
    if (count($input) > 0) {
        $ezplayer_url .= '/index.php?';
        foreach ($input as $key => $value) {
            $ezplayer_url .= "{$key}={$value}&";
        }
    }
    // 4) Displaying the previous page
    header("Location: " . $ezplayer_url);
    load_page();
}
示例#2
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;
}