function Manage_Spider_Calendar()
{
    global $wpdb;
    if (!function_exists('print_html_nav')) {
        require_once "nav_function/nav_html_func.php";
    }
    require_once "calendar_functions.php";
    // add functions for Spider_Video_Player
    require_once "calendar_functions.html.php";
    // add functions for vive Spider_Video_Player
    if (isset($_GET["task"])) {
        $task = esc_html($_GET["task"]);
    } else {
        $task = "";
    }
    if (isset($_GET["id"])) {
        $id = (int) $_GET["id"];
    } else {
        $id = 0;
    }
    if (isset($_GET["calendar_id"])) {
        $calendar_id = (int) $_GET["calendar_id"];
    } else {
        $calendar_id = 0;
    }
    switch ($task) {
        case 'calendar':
            show_spider_calendar();
            break;
        case 'add_calendar':
            add_spider_calendar();
            break;
        case 'published':
            $nonce_sp_cal = $_REQUEST['_wpnonce'];
            if (!wp_verify_nonce($nonce_sp_cal, 'nonce_sp_cal')) {
                die("Are you sure you want to do this?");
            }
            spider_calendar_published($id);
            show_spider_calendar();
            break;
        case 'Save':
            if (!$id) {
                check_admin_referer('nonce_sp_cal', 'nonce_sp_cal');
                apply_spider_calendar(-1);
            } else {
                check_admin_referer('nonce_sp_cal', 'nonce_sp_cal');
                apply_spider_calendar($id);
            }
            show_spider_calendar();
            break;
        case 'Apply':
            if (!$id) {
                check_admin_referer('nonce_sp_cal', 'nonce_sp_cal');
                apply_spider_calendar(-1);
                $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "spidercalendar_calendar");
            } else {
                check_admin_referer('nonce_sp_cal', 'nonce_sp_cal');
                apply_spider_calendar($id);
            }
            edit_spider_calendar($id);
            break;
        case 'edit_calendar':
            edit_spider_calendar($id);
            break;
        case 'remove_calendar':
            check_admin_referer('nonce_sp_cal', 'nonce_sp_cal');
            remove_spider_calendar($id);
            show_spider_calendar();
            break;
            // Events.
        // Events.
        case 'show_manage_event':
            show_spider_event($calendar_id);
            break;
        case 'add_event':
            add_spider_event($calendar_id);
            break;
        case 'save_event':
            if ($id) {
                check_admin_referer('nonce_sp_cal', 'nonce_sp_cal');
                apply_spider_event($calendar_id, $id);
            } else {
                check_admin_referer('nonce_sp_cal', 'nonce_sp_cal');
                apply_spider_event($calendar_id, -1);
            }
            show_spider_event($calendar_id);
            break;
        case 'apply_event':
            if ($id) {
                check_admin_referer('nonce_sp_cal', 'nonce_sp_cal');
                apply_spider_event($calendar_id, $id);
            } else {
                check_admin_referer('nonce_sp_cal', 'nonce_sp_cal');
                apply_spider_event($calendar_id, -1);
                $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "spidercalendar_event");
            }
            edit_spider_event($calendar_id, $id);
            break;
        case 'edit_event':
            edit_spider_event($calendar_id, $id);
            break;
        case 'remove_event':
            $nonce_sp_cal = $_REQUEST['_wpnonce'];
            if (!wp_verify_nonce($nonce_sp_cal, 'nonce_sp_cal')) {
                die("Are you sure you want to do this?");
            }
            remove_spider_event($calendar_id, $id);
            show_spider_event($calendar_id);
            break;
        case 'published_event':
            $nonce_sp_cal = $_REQUEST['_wpnonce'];
            if (!wp_verify_nonce($nonce_sp_cal, 'nonce_sp_cal')) {
                die("Are you sure you want to do this?");
            }
            published_spider_event($calendar_id, $id);
            show_spider_event($calendar_id);
            break;
        default:
            show_spider_calendar();
            break;
    }
}
Beispiel #2
0
function Manage_Spider_Calendar()
{
    global $wpdb;
    // wp_enqueue_script('media-upload');
    //wp_admin_css('thickbox')
    if (!function_exists('print_html_nav')) {
        require_once "nav_function/nav_html_func.php";
    }
    require_once "calendar_functions.php";
    // add functions for Spider_Video_Player
    require_once "calendar_functions.html.php";
    // add functions for vive Spider_Video_Player
    /*
    	?>
       <form action="" method="post">
        <input type="text" value="asdgadsfg" id="narek" />
        <input type="button" onclick="alert(document.getElementById('narek').value);"  />
    	<a href="<?php echo plugins_url("calendar_function.html.php",__FILE__) ?>?TB_iframe=1&amp;width=640&amp;height=394" class="thickbox add_media" id="content-add_media" title="Add Video" onclick="return false;">Insert Video</a>
    	</form>
    	<?php
    */
    if (isset($_GET["task"])) {
        $task = $_GET["task"];
    } else {
        $task = "default";
    }
    if (isset($_GET["id"])) {
        $id = (int) $_GET["id"];
    } else {
        $id = 0;
    }
    if (isset($_GET["calendar_id"])) {
        $calendar_id = (int) $_GET["calendar_id"];
    } else {
        $calendar_id = 0;
    }
    switch ($task) {
        case 'calendar':
            show_spider_calendar();
            break;
        case 'add_calendar':
            add_spider_calendar();
            break;
        case 'published':
            spider_calendar_published($id);
            show_spider_calendar();
            break;
        case 'Save':
            if (!$id) {
                save_spider_calendar();
            } else {
                apply_spider_calendar($id);
            }
            show_spider_calendar();
            break;
        case 'Apply':
            if (!$id) {
                save_spider_calendar();
                $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "spidercalendar_calendar");
            } else {
                apply_spider_calendar($id);
            }
            edit_spider_calendar($id);
            break;
        case 'edit_calendar':
            edit_spider_calendar($id);
            break;
        case 'remove_calendar':
            remove_spider_calendar($id);
            show_spider_calendar();
            break;
            ////////////////////////////
            ////////////////////////////    EVENTS
            ////////////////////////////
        ////////////////////////////
        ////////////////////////////    EVENTS
        ////////////////////////////
        case 'show_manage_event':
            show_spider_event($calendar_id);
            break;
        case 'add_event':
            add_spider_event($calendar_id);
            break;
        case 'save_event':
            if ($id) {
                apply_spider_event($calendar_id, $id);
            } else {
                save_spider_event($calendar_id);
            }
            show_spider_event($calendar_id);
            break;
        case 'apply_event':
            if ($id) {
                apply_spider_event($calendar_id, $id);
            } else {
                save_spider_event($calendar_id);
                $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "spidercalendar_event");
            }
            edit_spider_event($calendar_id, $id);
            break;
        case 'edit_event':
            edit_spider_event($calendar_id, $id);
            break;
        case 'remove_event':
            remov_spider_event($calendar_id, $id);
            show_spider_event($calendar_id);
            break;
        case 'published_event':
            published_spider_event($id);
            show_spider_event($calendar_id);
            break;
        default:
            show_spider_calendar();
            break;
    }
}