Plog 1.0.1 > Class / Action / Admin / Adminaction.class.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Plog 1.0.1

Download:
plog-1.0.1.zip

Category:
Blog

Archive Content:

Plog 1.0.1

Plog 1.0.1 > Class

Plog 1.0.1 > Class > Action

Plog 1.0.1 > Class > Action > Admin

Plog 1.0.1 > Class > Action

Plog 1.0.1 > Class > Bayesian

Plog 1.0.1 > Class > Config

Plog 1.0.1 > Class > Controller

Plog 1.0.1 > Class > Dao

Plog 1.0.1 > Class > Dao > Customfields

Plog 1.0.1 > Class > Dao

Plog 1.0.1 > Class > Dao > Status

Plog 1.0.1 > Class > Dao

Plog 1.0.1 > Class > Data

Plog 1.0.1 > Class > Data > Date

Plog 1.0.1 > Class > Data

Plog 1.0.1 > Class > Data > Forms

Plog 1.0.1 > Class > Data

Plog 1.0.1 > Class > Data > Pager

Plog 1.0.1 > Class > Data

Plog 1.0.1 > Class > Data > Validator

Plog 1.0.1 > Class > Data > Validator > Rules

Plog 1.0.1 > Class > Data > Validator

Plog 1.0.1 > Class > Database

Plog 1.0.1 > Class > Database > Adodb

Plog 1.0.1 > Class > Database > Adodb > Datadict

Plog 1.0.1 > Class > Database > Adodb > Docs

Plog 1.0.1 > Class > Database > Adodb > Drivers

Plog 1.0.1 > Class > Database > Adodb > Lang

Plog 1.0.1 > Class > Database > Adodb

Plog 1.0.1 > Class > Database > Adodb > Perf

Plog 1.0.1 > Class > Database > Adodb

Plog 1.0.1 > Class > Database

Plog 1.0.1 > Class

Plog 1.0.1 > Class > File

Plog 1.0.1 > Class > File > Finder

Plog 1.0.1 > Class > File > Unpacker

Plog 1.0.1 > Class > Gallery

Plog 1.0.1 > Class > Gallery > Dao

Plog 1.0.1 > Class > Gallery > Data

Plog 1.0.1 > Class > Gallery

Plog 1.0.1 > Class > Gallery > Getid3

Plog 1.0.1 > Class > Gallery > Helperapps

Plog 1.0.1 > Class > Gallery > Resizers

Plog 1.0.1 > Class > Gallery > Template

Plog 1.0.1 > Class > Locale

Plog 1.0.1 > Class > Logger

Plog 1.0.1 > Class > Logger > Appender

Plog 1.0.1 > Class > Logger > Config

Plog 1.0.1 > Class > Logger > Layout

Plog 1.0.1 > Class > Logger > Logger

Plog 1.0.1 > Class > Logger

Plog 1.0.1 > Class > Mail

Plog 1.0.1 > Class > Mail > Phpmailer

Plog 1.0.1 > Class > Mail > Phpmailer > Language

Plog 1.0.1 > Class > Mail > Phpmailer

Plog 1.0.1 > Class > Misc

Plog 1.0.1 > Class > Net

Plog 1.0.1 > Class > Net > Http

Plog 1.0.1 > Class > Net > Http > Phpsniff

Plog 1.0.1 > Class > Net > Http > Session

Plog 1.0.1 > Class > Net > Http

Plog 1.0.1 > Class > Net

Plog 1.0.1 > Class > Net > Xmlrpc

Plog 1.0.1 > Class > Net

Plog 1.0.1 > Class > Object

Plog 1.0.1 > Class > Plugin

Plog 1.0.1 > Class > Security

Plog 1.0.1 > Class > Summary

Plog 1.0.1 > Class > Summary > Action

Plog 1.0.1 > Class > Summary > Dao

Plog 1.0.1 > Class > Summary > Data

Plog 1.0.1 > Class > Summary > Data > Validator

Plog 1.0.1 > Class > Summary > Mail

Plog 1.0.1 > Class > Summary > View

Plog 1.0.1 > Class > Template

Plog 1.0.1 > Class > Template > Menu

Plog 1.0.1 > Class > Template > Smarty

Plog 1.0.1 > Class > Template > Smarty > Core

Plog 1.0.1 > Class > Template > Smarty

Plog 1.0.1 > Class > Template > Smarty > Plugins

Plog 1.0.1 > Class > Template > Smarty

Plog 1.0.1 > Class > Template

Plog 1.0.1 > Class > Template > Templatesets

Plog 1.0.1 > Class > Template

Plog 1.0.1 > Class > View

Plog 1.0.1 > Class > View > Admin

Plog 1.0.1 > Class > View

Plog 1.0.1 > Class > Xml

Plog 1.0.1 > Class > Xml > Parser

Plog 1.0.1 > Class > Xml

Plog 1.0.1 > Class > Xml > Rssparser

Plog 1.0.1 > Class > Xml > Rssparser > Magpierss

Plog 1.0.1 > Class > Xml > Rssparser > Magpierss > Extlib

Plog 1.0.1 > Class > Xml > Rssparser > Magpierss

Plog 1.0.1 > Class > Xml > Rssparser

Plog 1.0.1 > Class > Xml > Tree

Plog 1.0.1 > Class > Xml

Plog 1.0.1

Plog 1.0.1 > Config

Plog 1.0.1

Plog 1.0.1 > Gallery

Plog 1.0.1

Plog 1.0.1 > Imgs

Plog 1.0.1 > Imgs > .xvpics

Plog 1.0.1 > Imgs > Admin

Plog 1.0.1 > Imgs

Plog 1.0.1

Plog 1.0.1 > Install

Plog 1.0.1 > Js

Plog 1.0.1 > Js > Calendar

Plog 1.0.1 > Js > Editor

Plog 1.0.1 > Js > Htmlarea

Plog 1.0.1 > Js > Htmlarea > Docs

Plog 1.0.1 > Js > Htmlarea

Plog 1.0.1 > Js > Htmlarea > Images

Plog 1.0.1 > Js > Htmlarea > Lang

Plog 1.0.1 > Js > Htmlarea > Plugins

Plog 1.0.1 > Js > Htmlarea > Plugins > CharacterMap

Plog 1.0.1 > Js > Htmlarea > Plugins > CharacterMap > Img

Plog 1.0.1 > Js > Htmlarea > Plugins > CharacterMap > Lang

Plog 1.0.1 > Js > Htmlarea > Plugins > CharacterMap > Popups

Plog 1.0.1 > Js > Htmlarea > Plugins > ContextMenu

Plog 1.0.1 > Js > Htmlarea > Plugins > ContextMenu > Lang

Plog 1.0.1 > Js > Htmlarea > Plugins > ContextMenu

Plog 1.0.1 > Js > Htmlarea > Plugins > CSS

Plog 1.0.1 > Js > Htmlarea > Plugins > CSS > Lang

Plog 1.0.1 > Js > Htmlarea > Plugins > DynamicCSS

Plog 1.0.1 > Js > Htmlarea > Plugins > DynamicCSS > Lang

Plog 1.0.1 > Js > Htmlarea > Plugins > EnterParagraphs

Plog 1.0.1 > Js > Htmlarea > Plugins > EnterParagraphs > Lang

Plog 1.0.1 > Js > Htmlarea > Plugins > FullPage

Plog 1.0.1 > Js > Htmlarea > Plugins > FullPage > Img

Plog 1.0.1 > Js > Htmlarea > Plugins > FullPage > Lang

Plog 1.0.1 > Js > Htmlarea > Plugins > FullPage > Popups

Plog 1.0.1 > Js > Htmlarea > Plugins > FullPage

Plog 1.0.1 > Js > Htmlarea > Plugins > InsertSmiley

Plog 1.0.1 > Js > Htmlarea > Plugins > InsertSmiley > Emoticons

Plog 1.0.1 > Js > Htmlarea > Plugins > InsertSmiley > Img

Plog 1.0.1 > Js > Htmlarea > Plugins > InsertSmiley

Plog 1.0.1 > Js > Htmlarea > Plugins > InsertSmiley > Lang

Plog 1.0.1 > Js > Htmlarea > Plugins > InsertSmiley > Popups

Plog 1.0.1 > Js > Htmlarea > Plugins > ListType

Plog 1.0.1 > Js > Htmlarea > Plugins > ListType > Lang

Plog 1.0.1 > Js > Htmlarea > Plugins > ListType

Plog 1.0.1 > Js > Htmlarea > Plugins

Plog 1.0.1 > Js > Htmlarea > Plugins > TableOperations

Plog 1.0.1 > Js > Htmlarea > Plugins > TableOperations > Img

Plog 1.0.1 > Js > Htmlarea > Plugins > TableOperations > Lang

Plog 1.0.1 > Js > Htmlarea > Plugins > TableOperations

Plog 1.0.1 > Js > Htmlarea

Plog 1.0.1 > Js > Htmlarea > Popups

Plog 1.0.1 > Js > Htmlarea

Plog 1.0.1 > Js > Ie7

Plog 1.0.1 > Js > Ie7 > Src

Plog 1.0.1 > Js

Plog 1.0.1 > Js > Ui

Plog 1.0.1

Plog 1.0.1 > Locale

Plog 1.0.1 > Locale > Unsupport

Plog 1.0.1 > Plugins

Plog 1.0.1

Plog 1.0.1 > Styles

Plog 1.0.1

Plog 1.0.1 > Templates

Plog 1.0.1 > Templates > Admin

Plog 1.0.1 > Templates > Admin > Xml

Plog 1.0.1 > Templates > Blueish

Plog 1.0.1 > Templates > Grey

Plog 1.0.1 > Templates > Misc

Plog 1.0.1 > Templates > Rss

Plog 1.0.1 > Templates > Standard

Plog 1.0.1 > Templates > Standard > Imgs

Plog 1.0.1 > Templates > Standard

Plog 1.0.1 > Templates > Summary

Plog 1.0.1 > Templates > Summary > Rss

Plog 1.0.1 > Templates > Summary

Plog 1.0.1 > Templates > Wizard

Plog 1.0.1 > Tmp

Plog 1.0.1

Adminaction.class.php:


<?php

    
include_once( PLOG_CLASS_PATH."class/action/action.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/locale/locales.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/net/http/httpvars.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/template/templateservice.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/misc/version.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/template/cachecontrol.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/view/admin/admindefaultview.class.php" );

    
/**
     * \ingroup Action
     *
     * In the same way BlogAction sets some predefined information to be available for every action
     * for the public side of the blog,  this one does the same but for the administrative interface.
     * So far it fetches information from the session,  such as the UserInfo and the BlogInfo objects
     * so that they are available for every template.
     *
     * This is the most basic action for the admin interface and it allows all users to see them. If you
     * need to create an action that can only be accessed by users with certain privileges,
     * please use BlogOwnerAdminAction and SiteAdminAction.
     *
     * @see BlogOwnerAdminAction
     * @see SiteAdminAction
     */
    
class AdminAction extends Action 
    
{

        var 
$_blogInfo;
        var 
$_userInfo;
        var 
$_session;
        var 
$_config;
        var 
$_locale;
        var 
$_pm;

        
/**
         * Constructor.
         *
         * @param actionInfo An ActionInfo object as provided by the constroller
         * @param request A valid HTTP request
         */
        
function AdminAction$actionInfo,  $request )
        {
            
$this->Action$actionInfo,  $request );
    
            
// get information about the session
            
$session HttpVars::getSession();
            
$this->_session $session["SessionInfo"];

            
$this->_config  =& Config::getConfig();

            
// get the information about the user and quit if we don't have it...
            
$this->_getUserInfo();
            if( 
$this->_userInfo == "" ) {
                
header"HTTP/1.0 403 Forbidden" );
                print(
$this->mustAuthenticatePage());
                die();
            }

            
// do the same with the information about the blog
            
$this->_getBlogInfo();
            if( 
$this->_blogInfo == "" ) {
                if( 
$this->_actionInfo->getActionParamValue() != "blogSelect" ) {
                    
header"HTTP/1.0 403 Forbidden" );
                    print(
$this->mustAuthenticatePage());
                    die();
                }
            }
            
            
// prepare the plugin manager in case we'd like to throw events
            
$this->_pm =& PluginManager::getPluginManager();            
            
            
// fetch the site locale
            
$this->_locale =& $this->getLocale();
        }

        
/**
         * Retrieves the blogInfo object from the session
         * @private
         */
        
function _getBlogInfo()
        {
            
$session HttpVars::getSession();
            
$sessionInfo $session["SessionInfo"];

            
$this->_blogInfo $sessionInfo->getValue"blogInfo" );
        }

        
/**
         * Retrieves the userInfo object from the session
         * @private
         */
        
function _getUserInfo()
        {
            
$session HttpVars::getSession();
            
$sessionInfo $session["SessionInfo"];
            
$this->_userInfo $sessionInfo->getValue("userInfo");
        }

        
/**
         * sets the default locale,  in case we want to send localized messages to the user.
         * @private
         */
        
function &getLocale()
        {
            
// don't like this so much...
            
if( $this->_blogInfo != "" ) {
                
$this->_blogSettings $this->_blogInfo->getSettings();
                
//$locale =& Locales::getLocale( $this->_blogSettings->getValue("locale"));
                
$locale =& $this->_blogInfo->getLocale();
            }
            else {
                
$locale =& Locales::getLocale$this->_config->getValue("default_locale"));
            }
            
            return 
$locale;
        }

        
/**
         * Adds some common data to the view. this function must be manually called once
         * we've set up a view.
         *
         * @param copyFormValues
         * @see Action::setCommonData()
         */
        
function setCommonData$copyFormValues false )
        {    
            
parent::setCommonData$copyFormValues );

            
// initialiaze plugins
            
$this->_pm->setBlogInfo$this->_blogInfo );
            
$this->_pm->setUserInfo$this->_userInfo );
            
$this->_pm->getPlugins();            
            
            
$this->_view->setValue"user",  $this->_userInfo );
            
$this->_view->setUserInfo$this->_userInfo );
            
$this->_view->setValue"blog",  $this->_blogInfo );
            
$this->_view->setValue"blogsettings",  $this->_blogInfo->getSettings());
            
$this->_view->setValue"op",  $this->_actionInfo->_actionParamValue );
            
$this->_view->setValue"locale",  $this->_locale );
            
$this->_view->setValue"config",  $this->_config );
        }

        
/**
         * Saves the session data
         * @private
         */
        
function saveSession()
        {
            
$this->_session->setValue"blogInfo",  $this->_blogInfo );
            
$this->_session->setValue"userInfo",  $this->_userInfo );
            
//$_SESSION["SessionInfo"] = $this->_session;
            
$session HttpVars::getSession();
            
$session["SessionInfo"] = $this->_session;
            
HttpVars::setSession$session );
        }

        
/**
         * Generates a page which shows an "access forbidden" message,  prompting the user to
         * authenticate first using the login page.
         * @private
         */
        
function mustAuthenticatePage()
        {
            
$view = new AdminDefaultView();
            
$locale $this->getLocale();
            
$view->setErrorMessage$locale->tr("error_access_forbidden" ));
            return 
$view->render();
        }
        
        
/**
         * centralized way of throwing events,  it also adds some useful information so that
         * child classes do not have to do it
         *
         * @param eventType
         * @param params
         *
         * @see PluginManager::notifyEvent()
         */
        
function notifyEvent$eventType,  $params = Array())
        {
            
$params"from" ] = $this->_actionInfo->getActionParamValue();
            
$params"request" ] = $this->_request;
            
            return 
$this->_pm->notifyEvent$eventType,  $params );
        }
    }
?>



Other Blog Scripts:

WebMaster Resources Home

©RingsWorld.com