Plog 1.0.1 > Class / Action / Admin / Adminloginaction.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

Adminloginaction.class.php:


<?php

    
include_once( PLOG_CLASS_PATH."class/action/action.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/view/admin/admindashboardview.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/view/admin/admindefaultview.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/dao/users.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/dao/blogs.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/net/http/session/sessioninfo.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/config/config.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/misc/version.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/locale/locales.class.php" );
    include_once( 
PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );

    
/**
     * \ingroup Action
     * @private
     *
     * When the user fills in the login form,  we jump to this action which will show
     * another form when the user will choose to which of the blog he or she wants to
     * carry out administrative tasks.
     */
    
class AdminLoginAction extends Action 
    
{

        var 
$_userName;
        var 
$_userPassword;
        var 
$_op;
        var 
$_locale;

        
/**
         * Constructor. If nothing else,  it also has to call the constructor of the parent
         * class,  BlogAction with the same parameters
         */
        
function AdminLoginAction$actionInfo,  $request )
        {
            
$this->Action$actionInfo,  $request );

            
$config =& Config::getConfig();
            
$this->_locale =& Locales::getLocale$config->getValue"default_locale" ));

        
// data validation
        
$this->registerFieldValidator"userName",  new StringValidator());
        
$this->registerFieldValidator"userPassword",  new StringValidator());
        
$view = new AdminDefaultView();
        
$view->setErrorMessage$this->_locale->tr("error_incorrect_username_or_password"));
        
$this->setValidationErrorView$view );
        }

        
/**
         * Carries out the specified action
         */
        
function perform()
        {
            
// get the parameters,  which have already been validated
            
$this->_userName     $this->_request->getValue"userName" );
            
$this->_userPassword $this->_request->getValue"userPassword" );
            
$this->_op           $this->_request->getValue"op" );

        
// create a plugin manager
            
$pm =& PluginManager::getPluginManager();    
        
            
// try to authenticate the user
            
$users = new Users();
            if( !
$users->authenticateUser$this->_userName,  $this->_userPassword )) {
                
$this->_view = new AdminDefaultView();
                
$this->_view->setErrorMessage$this->_locale->tr("error_incorrect_username_or_password"));
                
$this->setCommonData();
                
                
$pm->notifyEventEVENT_LOGIN_FAILURE,  Array( "user" => $this->_userName ));
                return 
false;
            }
            
            
// if the user is correct,  get and put his or her information in the session
            
$userInfo $users->getUserInfo$this->_userName,  $this->_userPassword );
            
            if( !
$userInfo ) {
                
$this->_view = new AdminDefaultView();
                
$this->_view->setErrorMessage$this->_locale->tr("error_incorrect_username_or_password"));
                
$this->setCommonData();
                
                
$pm->notifyEventEVENT_LOGIN_FAILURE,  Array( "user" => $this->_userName ));
                return 
false;
            }
            
            
$pm->notifyEventEVENT_USER_LOADED,  Array( "user" => &$userInfo,  "from" => "Login" ));
            
//$sessionInfo = $_SESSION["SessionInfo"];
            
$session HttpVars::getSession();
            
$sessionInfo $session["SessionInfo"];

            
$sessionInfo->setValue"userInfo",  $userInfo );
            
$session["SessionInfo"] = $sessionInfo;
            
HttpVars::setSession$session );

            
// get the list of blogs to which the user belongs
            
$userBlogs $users->getUsersBlogs$userInfo->getId());

            
// but if he or she does not belong to any yet,  we quit
            
if( empty($userBlogs)) {
                
$this->_view = new AdminDefaultView();
                
$this->_view->setErrorMessage$this->_locale->tr("error_dont_belong_to_any_blog"));
                
$this->setCommonData();

                return 
false;
            }
            
            
$pm->notifyEventEVENT_BLOGS_LOADED,  Array( "blogs" => &$userBlogs,  "from" => "Login" ));            
            
            
$this->_view = new AdminDashboardView$userInfo,  $userBlogs );
            
// better to return true if everything's fine
            
return true;
        }
    }
?>



Other Blog Scripts:

WebMaster Resources Home

©RingsWorld.com