} else {
        if (isset($_POST['add'])) {
            $result = dbquery("INSERT INTO " . DB_T_TOURS . " (tour_name, tour_desc, tour_game, tour_date, tour_grid, tour_finished, tour_maxpl, tour_w1, tour_w2, tour_w3) VALUES ('" . $ttname . "', '" . $ttdesc . "', '" . $ttgame . "', '" . $ttdate . "', '0', '0', '" . $ttmaxpl . "', '0', '0', '0')");
        }
        if (isset($_POST['save'])) {
            $result = dbquery("UPDATE " . DB_T_TOURS . " SET tour_name='" . $ttname . "', tour_desc='" . $ttdesc . "', tour_game='" . $ttgame . "', tour_date='" . $ttdate . "', tour_maxpl='" . $ttmaxpl . "'");
        }
        if ($result) {
            redirect(FUSION_SELF . $aidlink . "&p=newtour&m=success");
        } else {
            $err = 4;
        }
    }
}
opentable("add tourney");
showAdminNav();
if (isset($_GET['a']) && $_GET['a'] == "edit" && isset($_GET['id']) && isnum($_GET['id'])) {
    $result = dbquery("SELECT * FROM " . DB_T_TOURS . " WHERE tour_id='" . $_GET['id'] . "'");
    if (dbrows($result)) {
        $data = dbarray($result);
        $tname = $data['tour_name'];
        $tgame = $data['tour_game'];
        $tdesc = $data['tour_desc'];
        $tday = date("j", $data['tour_date']);
        $tmon = date("n", $data['tour_date']);
        $tyear = date("Y", $data['tour_date']);
        $tmin = date("i", $data['tour_date']);
        $thour = date("G", $data['tour_date']);
        $tmaxpl = $data['tour_maxpl'];
        $tedit = true;
    } else {
Exemple #2
0
/** 
* Handles conditionals for admin functions
* 
* @return void
*/
function blog_admin_controller()
{
    $Blog = new Blog();
    getBlogUserPermissions();
    global $blogUserPermissions;
    showAdminNav();
    if (isset($_GET['edit_post']) && $blogUserPermissions['blogeditpost'] == true) {
        editPost($_GET['edit_post']);
    } elseif (isset($_GET['create_post']) && $blogUserPermissions['blogcreatepost'] == true) {
        editPost();
    } elseif (isset($_GET['categories']) && $blogUserPermissions['blogcategories'] == true) {
        if (isset($_GET['edit_category'])) {
            $add_category = $Blog->saveCategory($_POST['new_category']);
            if ($add_category == true) {
                echo '<div class="updated">';
                i18n(BLOGFILE . '/CATEGORY_ADDED');
                echo '</div>';
            } else {
                echo '<div class="error">';
                i18n(BLOGFILE . '/CATEGORY_ERROR');
                echo '</div>';
            }
        }
        if (isset($_GET['delete_category'])) {
            $Blog->deleteCategory($_GET['delete_category']);
        }
        edit_categories();
    } elseif (isset($_GET['auto_importer']) && $blogUserPermissions['blogrssimporter'] == true) {
        if (isset($_POST['post-rss'])) {
            $post_data = array();
            $post_data['name'] = $_POST['post-rss'];
            $post_data['category'] = $_POST['post-category'];
            $add_feed = $Blog->saveRSS($post_data);
            if ($add_feed == true) {
                echo '<div class="updated">';
                i18n(BLOGFILE . '/FEED_ADDED');
                echo '</div>';
            } else {
                echo '<div class="error">';
                i18n(BLOGFILE . '/FEED_ERROR');
                echo '</div>';
            }
        } elseif (isset($_GET['delete_rss'])) {
            $delete_feed = $Blog->deleteRSS($_GET['delete_rss']);
            if ($delete_feed == true) {
                echo '<div class="updated">';
                i18n(BLOGFILE . '/FEED_DELETED');
                echo '</div>';
            } else {
                echo '<div class="error">';
                i18n(BLOGFILE . '/FEED_DELETE_ERROR');
                echo '</div>';
            }
        }
        edit_rss();
    } elseif (isset($_GET['settings']) && $blogUserPermissions['blogsettings'] == true) {
        show_settings_admin();
    } elseif (isset($_GET['help']) && $blogUserPermissions['bloghelp'] == true) {
        show_help_admin();
    } elseif (isset($_GET['custom_fields']) && $blogUserPermissions['blogcustomfields'] == true) {
        $CustomFields = new customFields();
        if (isset($_POST['save_custom_fields'])) {
            $saveCustomFields = $CustomFields->saveCustomFields();
            if ($saveCustomFields) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/EDIT_OK') . '</div>';
            }
        }
        show_custom_fields();
    } else {
        if (isset($_GET['save_post'])) {
            savePost();
        } elseif (isset($_GET['delete_post']) && $blogUserPermissions['blogdeletepost'] == true) {
            $post_id = urldecode($_GET['delete_post']);
            $delete_post = $Blog->deletePost($post_id);
            if ($delete_post == true) {
                echo '<div class="updated">';
                i18n(BLOGFILE . '/POST_DELETED');
                echo '</div>';
            } else {
                echo '<div class="error">';
                i18n(BLOGFILE . '/FEED_DELETE_ERROR');
                echo '</div>';
            }
        }
        show_posts_admin();
    }
}