Ejemplo n.º 1
0
         $action = 'add_to_table';
     }
 }
 switch ($action) {
     // In case we want to log out
     case 'logout':
         user_logout();
         break;
         // The only case when we could possibly arrive here with a session created
         // and a "login" action is when the user refreshed the page. In that case,
         // we redraw the page with the last information saved in the session variables.
     // The only case when we could possibly arrive here with a session created
     // and a "login" action is when the user refreshed the page. In that case,
     // we redraw the page with the last information saved in the session variables.
     case 'login':
         redraw_page();
         break;
     case 'view_logs':
         view_logs();
         break;
     case 'edit_config':
         edit_config();
         break;
     case 'edit_admins':
         edit_admins();
         break;
     case 'add_admin':
         add_admin();
         break;
     case 'remove_admin':
         remove_admin();
Ejemplo n.º 2
0
/**
 * Used to load the requested page from POST or GET
 * @global type $input
 */
function load_page()
{
    global $input;
    $action = $input['action'];
    $redraw = false;
    //
    // Actions
    //
    // Controller goes here
    switch ($action) {
        // The user clicked on an album, we display its content to them
        // Display the help page
        case 'view_help':
            view_help();
            break;
        case 'view_settings':
            view_settings();
            break;
            // In case we want to log out
        // In case we want to log out
        case 'logout':
            user_logout();
            break;
            // The only case when we could possibly arrive here with a session created
            // and a "login" action is when the user refreshed the page. In that case,
            // we redraw the page with the last information saved in the session variables.
        // The only case when we could possibly arrive here with a session created
        // and a "login" action is when the user refreshed the page. In that case,
        // we redraw the page with the last information saved in the session variables.
        case 'login':
            redraw_page();
            break;
        case 'anonymous_login':
            anonymous_login();
            break;
        case 'admin_mode_update':
            admin_mode_update();
            break;
        case 'view_album_assets':
            view_album_assets();
            break;
        case 'view_asset_details':
            view_asset_details();
            break;
        case 'view_asset_bookmark':
            view_asset_bookmark();
            break;
        case 'search_bookmark':
            bookmarks_search();
            break;
        case 'sort_asset_bookmark':
            bookmarks_sort();
            break;
        case 'add_asset_bookmark':
            bookmark_add();
            break;
        case 'add_asset_thread':
            thread_add();
            break;
        case 'add_thread_comment':
            comment_add();
            break;
        case 'add_thread_comment_answer':
            comment_add_reply();
            break;
        case 'update_thread_comment':
            comment_edit();
            break;
        case 'update_asset_thread':
            thread_edit();
            break;
        case 'thread_details_view':
            thread_details_update();
            break;
        case 'delete_asset_thread':
            thread_delete();
            break;
        case 'delete_thread_comment':
            comment_delete();
            break;
        case 'edit_settings':
            preferences_update();
            break;
        case 'edit_asset_meta':
            asset_edit_meta();
            break;
        case 'vote':
            vote_add();
            break;
        case 'approve':
            comment_edit_approval();
            break;
        case 'threads_list_view':
            threads_list_update();
            break;
        case 'copy_bookmark':
            bookmark_copy();
            break;
        case 'share_popup':
            share_popup();
            break;
        case 'bookmark_popup':
            bookmark_popup();
            break;
        case 'bookmarks_popup':
            bookmarks_popup();
            break;
        case 'remove_asset_bookmark':
            bookmark_delete();
            break;
        case 'remove_asset_bookmarks':
            bookmarks_delete_all();
            break;
        case 'view_import':
            view_import();
            break;
        case 'upload_bookmarks':
            bookmarks_upload();
            break;
        case 'import_bookmarks':
            bookmarks_import();
            break;
        case 'export_bookmarks':
            bookmarks_export();
            break;
        case 'export_album_bookmarks':
            bookmarks_export_all();
            break;
        case 'export_asset_bookmarks':
            bookmarks_export_all(true);
            break;
        case 'delete_bookmarks':
            bookmarks_delete();
            break;
        case 'move_album_token':
            album_token_move();
            break;
        case 'delete_album_token':
            album_token_delete();
            break;
        case 'client_trace':
            client_trace();
            break;
            // No action selected: we choose to display the homepage again
        // No action selected: we choose to display the homepage again
        default:
            // TODO: check session var here
            view_main();
    }
}
Ejemplo n.º 3
0
/**
 * Processes media submission 
 * Used only by old web browsers (when xhr2 is not supported)
 * @global type $input 
 */
function submit_media()
{
    global $input;
    global $php_cli_cmd;
    global $recorder_mam_insert_pgm;
    global $submit_upload_dir;
    global $head_code;
    global $dir_date_format;
    global $accepted_media_types;
    // 1) Sanity checks
    $title = trim($input['title']);
    if (!isset($title) || empty($title)) {
        error_print_message('no Title');
        die;
    }
    if ($_FILES['media']['error'] > 0) {
        log_append('error', 'submit_media: an error occurred during file upload (code ' . $_FILES['media']['error'] . ')');
        error_print_message(template_get_message('upload_error', get_lang()));
        die;
    }
    if (!in_array($input['type'], $accepted_media_types)) {
        log_append('warning', 'submit_media: ' . $input['type'] . ' is not a valid media type');
        error_print_message(template_get_message('Invalid_type', get_lang()));
        die;
    }
    // 2) Creating the folder in the queue, and the metadata for the media
    $tmp_name = date($dir_date_format) . '_' . $input['album'];
    if ($input['moderation'] == 'false') {
        $moderation = "false";
    } else {
        $moderation = "true";
    }
    $metadata = array('course_name' => $input['album'], 'origin' => 'SUBMIT', 'title' => $input['title'], 'description' => $input['description'], 'record_type' => $input['type'], 'submitted_cam' => $_FILES['media']['name'], 'submitted_mimetype' => $_FILES['media']['type'], 'moderation' => $moderation, 'author' => $_SESSION['user_full_name'], 'netid' => $_SESSION['user_login'], 'record_date' => date($dir_date_format), 'super_highres' => $input['keepQuality'], 'intro' => $input['intro'], 'add_title' => $input['add_title'], 'downloadable' => $input['downloadable'], 'ratio' => $input['ratio']);
    //    assoc_array2metadata_file($metadata, './metadata_tmp.xml');
    $res = media_submit_create_metadata($tmp_name, $metadata);
    echo $res;
    if (!$res) {
        error_print_message(ezmam_last_error());
        die;
    }
    // 3) Uploading the media file inside the folder
    $path = $submit_upload_dir . '/' . $tmp_name . '/' . $input['type'] . '.mov';
    $res = move_uploaded_file($_FILES['media']['tmp_name'], $path);
    if (!$res) {
        error_print_message('submit_media: unable to move the uploaded file');
        die;
    }
    // 4) Calling cli_mam_insert.php so that it adds the file into ezmam
    $cmd = 'echo "' . $php_cli_cmd . ' ' . $recorder_mam_insert_pgm . ' ' . dirname($path) . ' >>' . dirname($path) . '/mam_insert.log 2>&1"|at now';
    exec($cmd, $output, $ret);
    if ($ret != 0) {
        error_print_message(' Error while trying to use cli_mam_insert: error code ' . $ret);
        die;
    }
    echo "success";
    return true;
    // 5) Displaying a confirmation alert.
    $head_code = '<script type="text/javascript">$(document).ready(function() {window.alert(\'Fichier envoyé et en cours de traitement.\');});</script>';
    redraw_page();
}