由于1。12版里没有getUserInfo这个方法了!所以下面的这个外部登陆运行不了。。请问要怎样修改?
<?php
if (!defined( "PLOG_CLASS_PATH" )) {
define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
}
include_once( PLOG_CLASS_PATH."class/controller/admincontroller.class.php" );
include_once( PLOG_CLASS_PATH."class/net/http/session/sessionmanager.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
$userName = "xxxxx";
$userPassword = "xxxxx";
// initialize the session
SessionManager::init();
// 產生一個新的 user 物件
$users = new Users();
if( $users->authenticateUser( $userName, $userPassword )) {
// 取得 userInfo 物件 (透過正確的 username 與 password)
$userInfo = $users->getUserInfo( $userName, $userPassword );
// 取得使用者的 blog list
$userBlogs = $users->getUsersBlogs( $userInfo->getId(), BLOG_STATUS_ACTIVE );
// 用第一個 blog 來當作 blogID,並取得這個 blog ID 的 blogInfo
$blogInfo = end( $userBlogs );
// 取得 session
//print_r($session = HttpVars::getSession());
$session = HttpVars::getSession();
$sessionInfo = $session["SessionInfo"];
// 並且把資料寫入session
$sessionInfo->setValue( "userInfo", $userInfo );
$sessionInfo->setValue( "blogInfo", $blogInfo );
$session["SessionInfo"] = $sessionInfo;
HttpVars::setSession( $session );
echo "<script language='Javascript'>";
echo "location.href='../../web/plog/login.php';";
echo "</script>";
//header("location: ../../web/plog/login.php");
}else{
echo "用户名或密码有误!重新<a href='javascript:window.history.back()'>登录</a>";
}
?>