Beispiel #1
0
function main()
{
    create_html_start();
    if (!isset($_SESSION['ms_username'])) {
        show_login();
    } else {
        show_main_page();
    }
    create_html_end();
}
Beispiel #2
0
function main()
{
    if (check_post_values()) {
        header('Location: index.php');
    }
    create_html_start();
    echo '<div id="edit_catalogues">';
    create_catalogue_edit_form();
    echo '</div>';
    echo '<div id="main_links">';
    echo '<a href="index.php">List catalogues</a>';
    echo '<a href="logout.php">Logout</a>';
    echo '</div>';
    create_html_end();
}
Beispiel #3
0
function main()
{
    create_html_start();
    echo '<div id="settings">';
    $ret = check_post_values();
    if ($ret == 0) {
        echo 'Password changed!';
    } else {
        if ($ret == 1) {
            echo 'Passwords did not match!';
        }
    }
    create_settings_page();
    create_html_end();
}
Beispiel #4
0
function main()
{
    if (isset($_GET['action']) && $_GET['action'] == 'remove') {
        if (isset($_GET['catalog'])) {
            delete_catalog($_GET['catalog']);
        } else {
            create_html_start();
            echo 'You must give catalog name too!<br />';
        }
    } else {
        create_html_start();
        if (isset($_GET['catalog'])) {
            show_confirmation_form($_GET['catalog']);
        } else {
            echo 'There is no catalog name given!<br>';
        }
    }
    echo '<center>';
    echo '<a href="index.php">Back to catalog list</a>';
    echo '</center>';
    create_html_end();
}
Beispiel #5
0
function main()
{
    if (isset($_GET['day'])) {
        $day = $_GET['day'];
    } else {
        $day = date('Y-m-d');
    }
    check_post_values();
    create_html_start();
    show_error_msg();
    create_edit_form($day);
    create_html_end();
}
Beispiel #6
0
function main()
{
    // Set day to show
    if (isset($_GET['day'])) {
        $day = $_GET['day'];
    } else {
        $day = date('Y-m-d');
    }
    create_html_start();
    // Check if there is POST-data
    check_post_values();
    // Show login or user own page
    if (user_logged()) {
        show_own_page($day);
    } else {
        show_login();
    }
    create_html_end();
}
Beispiel #7
0
function main()
{
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    } else {
        $action = 'list';
    }
    create_html_start();
    check_post_values();
    // Just list todos
    if ($action == 'list') {
        list_todos();
    } else {
        if ($action == 'edit') {
            show_edit();
        } else {
            if ($action == 'delete') {
                if (isset($_GET['id'])) {
                    delete_todo($_GET['id']);
                }
            } else {
                if ($action == 'finished') {
                    if (isset($_GET['id'])) {
                        finish_todo($_GET['id']);
                        list_todos();
                    }
                } else {
                    if ($action == 'show_finished') {
                        show_finished();
                    }
                }
            }
        }
    }
    create_html_end();
}
Beispiel #8
0
function main()
{
    create_html_start();
    // If check_post_values returns true, then new
    // user is succesfully created (or at least it should be...)
    // Note that show_error_msg shows message where is
    // message that user is registered succesfully!
    if (check_post_values()) {
        show_error_msg();
        echo '<br />';
        echo '<a href="index.php">Back to main page</a>';
    } else {
        show_error_msg();
        create_register_form();
    }
    create_html_end();
}
Beispiel #9
0
function main()
{
    create_html_start();
    check_post_values();
    $path = 'users/' . $_SESSION['ms_username'] . '/';
    if (!isset($_GET['catalog'])) {
        echo 'You must give catalog name!';
    } else {
        // Catalog file not found!
        if (!file_exists($path . $_GET['catalog̈́'])) {
            echo 'You don\'t have catalogue with that name!';
        } else {
            create_list($_GET['catalog']);
        }
        echo '<center>';
        echo '<br />';
        echo '<a href="index.php">Back to main page</a>';
        echo '</center><br />';
        create_html_end();
    }
}