Blame Automation/Php/Webenv/admin/content.php

Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
/***
Alain Reguera Delgado 8f60cb
 * Content Template
Alain Reguera Delgado 8f60cb
 *
Alain Reguera Delgado 8f60cb
 */
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
//-----------/* Show error if called directly */
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    if ( basename( $_SERVER['PHP_SELF'] ) <> 'index.php')
Alain Reguera Delgado 8f60cb
    {
Alain Reguera Delgado 8f60cb
        echo '

Sorry, this page can\'t be served directly. ';

Alain Reguera Delgado 8f60cb
        echo 'Try this instead.';
Alain Reguera Delgado 8f60cb
        exit;
Alain Reguera Delgado 8f60cb
    }
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
//-----------/* Sanitize URL variables */
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    foreach ( $_GET as $key => $value )
Alain Reguera Delgado 8f60cb
    {
Alain Reguera Delgado 8f60cb
        if ( sanitize_url_var($key) )
Alain Reguera Delgado 8f60cb
        {
Alain Reguera Delgado 8f60cb
            $url[$key] = $value;
Alain Reguera Delgado 8f60cb
        }
Alain Reguera Delgado 8f60cb
    }
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
//----------/* Page Selector */
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    if ( isset( $url['page'] ) ) 
Alain Reguera Delgado 8f60cb
    {
Alain Reguera Delgado 8f60cb
        switch ( $url['page'] )
Alain Reguera Delgado 8f60cb
        {
Alain Reguera Delgado 8f60cb
            case 'entries':
Alain Reguera Delgado 8f60cb
                /* Build relation between "Entries" sublinks and its pages */
Alain Reguera Delgado 8f60cb
                if ( isset($url['action'] ) ) 
Alain Reguera Delgado 8f60cb
                {
Alain Reguera Delgado 8f60cb
                    switch ( $url['action'] ) 
Alain Reguera Delgado 8f60cb
                    {
Alain Reguera Delgado 8f60cb
                        case "add":
Alain Reguera Delgado 8f60cb
                            $page = 'p_entries_add.php';
Alain Reguera Delgado 8f60cb
                            break;
Alain Reguera Delgado 8f60cb
    
Alain Reguera Delgado 8f60cb
                        case "update":
Alain Reguera Delgado 8f60cb
                            $page = 'p_entries_update.php';
Alain Reguera Delgado 8f60cb
                            break;
Alain Reguera Delgado 8f60cb
                    }
Alain Reguera Delgado 8f60cb
                }
Alain Reguera Delgado 8f60cb
                else
Alain Reguera Delgado 8f60cb
                {
Alain Reguera Delgado 8f60cb
                    $page = 'p_entries.php';
Alain Reguera Delgado 8f60cb
                }
Alain Reguera Delgado 8f60cb
                break;
Alain Reguera Delgado 8f60cb
        
Alain Reguera Delgado 8f60cb
                case 'pages':
Alain Reguera Delgado 8f60cb
                    // Just if user has admin rights.
Alain Reguera Delgado 8f60cb
                    if ( is_user('administrator') )
Alain Reguera Delgado 8f60cb
                    {
Alain Reguera Delgado 8f60cb
                        /* Build relation between "Pages" sublinks and its pages */
Alain Reguera Delgado 8f60cb
                        if ( isset($url['action'] ) ) 
Alain Reguera Delgado 8f60cb
                        {
Alain Reguera Delgado 8f60cb
                            switch ( $url['action'] ) 
Alain Reguera Delgado 8f60cb
                            {
Alain Reguera Delgado 8f60cb
                                case 'add':
Alain Reguera Delgado 8f60cb
                                    $page = 'p_pages_add.php';
Alain Reguera Delgado 8f60cb
                                        break;
Alain Reguera Delgado 8f60cb
                                    
Alain Reguera Delgado 8f60cb
                                case 'update':
Alain Reguera Delgado 8f60cb
                                    $page = 'p_pages_update.php';
Alain Reguera Delgado 8f60cb
                                    break;
Alain Reguera Delgado 8f60cb
                            }
Alain Reguera Delgado 8f60cb
                        }
Alain Reguera Delgado 8f60cb
                        else
Alain Reguera Delgado 8f60cb
                        {
Alain Reguera Delgado 8f60cb
                            $page = 'p_pages.php';
Alain Reguera Delgado 8f60cb
                        }
Alain Reguera Delgado 8f60cb
                    }
Alain Reguera Delgado 8f60cb
                    break;
Alain Reguera Delgado 8f60cb
        
Alain Reguera Delgado 8f60cb
                case 'categories':
Alain Reguera Delgado 8f60cb
                    // Just if user has admin rights.
Alain Reguera Delgado 8f60cb
                    if ( is_user('administrator') )
Alain Reguera Delgado 8f60cb
                    {
Alain Reguera Delgado 8f60cb
                        /* Build relation between "Categories" sublinks and its pages */
Alain Reguera Delgado 8f60cb
                        if ( isset($url['action'] ) ) 
Alain Reguera Delgado 8f60cb
                        {
Alain Reguera Delgado 8f60cb
                            switch ( $url['action'] )
Alain Reguera Delgado 8f60cb
                            {
Alain Reguera Delgado 8f60cb
                                case 'add':
Alain Reguera Delgado 8f60cb
                                    $page = 'p_categories_add.php';
Alain Reguera Delgado 8f60cb
                                    break;
Alain Reguera Delgado 8f60cb
                                case 'update':
Alain Reguera Delgado 8f60cb
                                    $page = 'p_categories_update.php';
Alain Reguera Delgado 8f60cb
                                    break;
Alain Reguera Delgado 8f60cb
                                case 'tree':
Alain Reguera Delgado 8f60cb
                                    $page = 'p_categories_tree.php';
Alain Reguera Delgado 8f60cb
                                    break;
Alain Reguera Delgado 8f60cb
                            }
Alain Reguera Delgado 8f60cb
                        }
Alain Reguera Delgado 8f60cb
                        else
Alain Reguera Delgado 8f60cb
                        {
Alain Reguera Delgado 8f60cb
                           $page = 'p_categories.php'; 
Alain Reguera Delgado 8f60cb
                        }
Alain Reguera Delgado 8f60cb
                    }
Alain Reguera Delgado 8f60cb
                    break;
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
                case 'comments':
Alain Reguera Delgado 8f60cb
                    // Just if user has admin rights.
Alain Reguera Delgado 8f60cb
                    if ( is_user('administrator') )
Alain Reguera Delgado 8f60cb
                    {
Alain Reguera Delgado 8f60cb
                        /* Build relation between "Links" sublinks and its pages */
Alain Reguera Delgado 8f60cb
                        if ( isset($url['action'] ) ) 
Alain Reguera Delgado 8f60cb
                        {
Alain Reguera Delgado 8f60cb
                            switch ( $url['action'] )
Alain Reguera Delgado 8f60cb
                            {
Alain Reguera Delgado 8f60cb
                                case 'add':
Alain Reguera Delgado 8f60cb
                                    $page = 'p_comments_add.php';
Alain Reguera Delgado 8f60cb
                                    break;
Alain Reguera Delgado 8f60cb
                                case 'update':
Alain Reguera Delgado 8f60cb
                                    $page = 'p_comments_update.php';
Alain Reguera Delgado 8f60cb
                                    break;
Alain Reguera Delgado 8f60cb
                            }
Alain Reguera Delgado 8f60cb
                        }
Alain Reguera Delgado 8f60cb
                        else
Alain Reguera Delgado 8f60cb
                        {
Alain Reguera Delgado 8f60cb
                            $page = 'p_comments.php'; 
Alain Reguera Delgado 8f60cb
                        }
Alain Reguera Delgado 8f60cb
                    }
Alain Reguera Delgado 8f60cb
                    break;
Alain Reguera Delgado 8f60cb
                
Alain Reguera Delgado 8f60cb
                case 'links':
Alain Reguera Delgado 8f60cb
                    // Just if user has admin rights.
Alain Reguera Delgado 8f60cb
                    if ( is_user('administrator') )
Alain Reguera Delgado 8f60cb
                    {
Alain Reguera Delgado 8f60cb
                        /* Build relation between "Links" sublinks and its pages */
Alain Reguera Delgado 8f60cb
                        if ( isset($url['action'] ) ) 
Alain Reguera Delgado 8f60cb
                        {
Alain Reguera Delgado 8f60cb
                            switch ( $url['action'] )
Alain Reguera Delgado 8f60cb
                            {
Alain Reguera Delgado 8f60cb
                                case 'add':
Alain Reguera Delgado 8f60cb
                                    $page = 'p_links_add.php';
Alain Reguera Delgado 8f60cb
                                    break;
Alain Reguera Delgado 8f60cb
                            }
Alain Reguera Delgado 8f60cb
                        }
Alain Reguera Delgado 8f60cb
                        else
Alain Reguera Delgado 8f60cb
                        {
Alain Reguera Delgado 8f60cb
                            $page = 'p_links.php'; 
Alain Reguera Delgado 8f60cb
                        }
Alain Reguera Delgado 8f60cb
                    }
Alain Reguera Delgado 8f60cb
                    break;
Alain Reguera Delgado 8f60cb
        
Alain Reguera Delgado 8f60cb
                case 'users':
Alain Reguera Delgado 8f60cb
                    // Just if user has admin rights.
Alain Reguera Delgado 8f60cb
                    if ( is_user('administrator') )
Alain Reguera Delgado 8f60cb
                    {
Alain Reguera Delgado 8f60cb
                        /* Build relation between "Links" sublinks and its pages */
Alain Reguera Delgado 8f60cb
                        if ( isset($url['action'] ) ) 
Alain Reguera Delgado 8f60cb
                        {
Alain Reguera Delgado 8f60cb
                            switch ( $url['action'] )
Alain Reguera Delgado 8f60cb
                            {
Alain Reguera Delgado 8f60cb
                                case 'add':
Alain Reguera Delgado 8f60cb
                                    $page = 'p_users_add.php';
Alain Reguera Delgado 8f60cb
                                    break;
Alain Reguera Delgado 8f60cb
                            }
Alain Reguera Delgado 8f60cb
                        }
Alain Reguera Delgado 8f60cb
                        else
Alain Reguera Delgado 8f60cb
                        {
Alain Reguera Delgado 8f60cb
                            $page = 'p_users.php';
Alain Reguera Delgado 8f60cb
                        }
Alain Reguera Delgado 8f60cb
                    }
Alain Reguera Delgado 8f60cb
                    break;
Alain Reguera Delgado 8f60cb
    
Alain Reguera Delgado 8f60cb
                default:
Alain Reguera Delgado 8f60cb
                    $page = 'p_index.php';
Alain Reguera Delgado 8f60cb
                    break;
Alain Reguera Delgado 8f60cb
            }
Alain Reguera Delgado 8f60cb
        }
Alain Reguera Delgado 8f60cb
        else
Alain Reguera Delgado 8f60cb
        {
Alain Reguera Delgado 8f60cb
            $page = 'p_index.php'; 
Alain Reguera Delgado 8f60cb
        }
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
//--------/* Verify file before include it
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    if ( file_exists( ABSPATH . 'admin/' . $page ) )
Alain Reguera Delgado 8f60cb
    {
Alain Reguera Delgado 8f60cb
        include (ABSPATH . 'admin/' . $page );
Alain Reguera Delgado 8f60cb
    }
Alain Reguera Delgado 8f60cb
?>