Beispiel #1
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();
    }
}
Beispiel #2
0
             print json_encode($result);
             break;
         case "delete":
             $result = post_delete($url_parts[4]);
             header("Location: /" . $_SESSION["user_name"]);
             break;
     }
     break;
     // post
 // post
 case "comment":
     require_once "lib/api/comments.php";
     require_once "lib/api/likes.php";
     switch ($url_parts[3]) {
         case "add":
             $result = comment_add();
             header("Location: " . $_SERVER["HTTP_REFERER"] . "#comments");
             break;
         case "delete":
             $result = comment_delete($url_parts[4]);
             header("Location: " . $_SERVER["HTTP_REFERER"] . "#comments");
             break;
         case "like":
             $result = comment_like($url_parts[4], $url_parts[5]);
             header('Content-Type: application/json');
             print json_encode($result);
             break;
         case "unlike":
             $result = comment_unlike($url_parts[4], $url_parts[5]);
             header('Content-Type: application/json');
             print json_encode($result);
Beispiel #3
0
}
if (isset($_GET['do'])) {
    $to = isset($_GET['to']) ? $_GET['to'] : 0;
    $at = isset($_GET['at']) ? $_GET['at'] : 0;
    switch ($_GET['do']) {
        case 'view':
            post_view($to);
            break;
        case 'edit':
            post_edit($to);
            break;
        case 'delete':
            post_delete($to);
            break;
        case 'reply':
            comment_add($to, TRUE);
            break;
        case 'comment':
            comment_edit($to);
            break;
        case 'clear':
            comment_delete($to);
            break;
        case 'post':
            post_add($at);
            break;
        case 'board':
            board_view($at);
            break;
        case 'join':
            member_join();
Beispiel #4
0
    ?>
" alt="編輯"></a></span>
<?php 
}
?>
				<div id="post-text">
<!-- Start of Post -->
<?php 
echo show_text($row["post_content"]);
?>
<!-- End of Post -->
				</div>
<?php 
if (isset($mod_time) && isset($mod_who)) {
    ?>
				<span id="post-view-modified">本文章在 <?php 
    echo $mod_time;
    ?>
 由 <strong><?php 
    echo $mod_who;
    ?>
</strong> 做了最後一次修改</span>
<?php 
}
?>
			</div>
<?php 
comment_list($to, $comment_page = isset($_GET['comment_page']) ? $_GET['comment_page'] : -1, 5);
comment_add($to);
post_list($board['name'], $post_page = isset($_GET['post_page']) ? $_GET['post_page'] : 0, 10, $order = isset($_GET['list_order']) && $_GET['list_order'] == 'update' ? 'update' : 'post');
include load_template('footer');
Beispiel #5
0
        return ajax_echo('no method:' . $f);
    }
}
if ($f = _get('c')) {
    if ($f != 'logout') {
        logout();
    }
    if (function_exists($f)) {
        call_user_func($f);
    } else {
        return ajax_echo('no method:' . $f);
    }
}
if ($f = _get('d')) {
    if ($f != 'comment_add') {
        comment_add();
    }
    if (function_exists($f)) {
        call_user_func($f);
    } else {
        return ajax_echo('no method:' . $f);
    }
}
if ($f = _get('s')) {
    if ($f != 'get_search') {
        get_search();
    }
    if (function_exists($f)) {
        call_user_func($f);
    } else {
        return ajax_echo('no method:' . $f);