歡迎光臨, 訪客. 請先 登入註冊一個帳號.
四月 20, 2024, 12:26:53 下午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
  列出文章
頁: [1] 2 3 ... 7
1  開發 / 外掛程式 / Re: lifetype和discuz整合的思路 於: 三月 07, 2008, 10:23:50 上午
这个到底完整做成功了没有呢?如果哪位高手做成功了,直接把文件贡献出来,免得我们这些菜鸟再痛苦的测试啊,热烈期盼中~~~~
2  支援 / 安裝與設定 / 将plog1.0升级为lifetype的难度多大? 於: 五月 15, 2006, 02:57:57 下午
我们原来的blog是plog1.0(http://blog.asiaec.com),现在还有错误出现了,我们是想把它从plog1.0升级为lifetype1.03,这中间的难度多大,原来的是简体中文,而我看新的lifetype只提供utf-8简体中文,我该如何处理?
去年弄plog1.0的时候得到了mark的大力支持,在此特别感谢,现在如果要按我的描述去实现,请提供个思路,谢谢 吐舌頭
3  建議 / 要求與建議 / Re: 好久没时间弄plog了,现在发展成什么样子了? 於: 五月 11, 2006, 10:46:11 上午
谢谢,我看的很明白,现在开始要继续研究了,希望得到各位前辈继续的辅导。 眨眼睛
4  建議 / 要求與建議 / 好久没时间弄plog了,现在发展成什么样子了? 於: 五月 11, 2006, 10:17:20 上午
有一年时间都没时间弄plog了,现在改成了 lifeType 两者之间有什么关系,版本为什么还是1.01,哪有全面的资料让我了解一下。 
 
5  開發 / 外掛程式 / 关于站点整合用户注册的讨论 於: 八月 01, 2005, 02:22:46 下午
这个问题悬了这么久怎么没人作答啊,是不是不好解决哦?
6  開發 / 外掛程式 / 徵求 Moblog 測試 於: 六月 10, 2005, 10:41:36 上午
hi mark:
 我分别用sina的outlook方式就行,登陆它的邮件系统就不行,163.com,126.com(这两都是网易的)在自身的邮件登陆系统发送就可以,sohu.com的邮件系统登陆发送的没有,我从我们公司发出的也没有,这就是我的测试结果!

http://demo.lifetype.org.tw/index.php?blogId=5
7  開發 / 模版設計 / Re: 有办法了 於: 六月 07, 2005, 05:36:45 下午
引用自: php
有办法了,只要在模板中加入:
 <div align=left>
        ☉访问总数:{$blog->getViewedTotal()}<br/>
        ☉文章总数:{$blog->getTotalPosts()}<br/>
        ☉评论总数:{$blog->getTotalComments()}<br/>
        ☉引用总数:{$blog->getTotalTrackbacks()}<br/>
        </div>
就行了。


hi php
请问你页面的个人照片怎么实现的?
8  支援 / 使用與操作 / 1.0.1为何现在注册用户名的时候有限制? 於: 六月 07, 2005, 12:12:37 下午
这么说不让用中文注册的原因是不是也如此?那现在麻烦了,已有的用户如果升级就没法使用了吧
9  支援 / 使用與操作 / 1.0.1为何现在注册用户名的时候有限制? 於: 六月 06, 2005, 03:54:47 下午
各位,你们都没遇到吗?还是我安装有问题?
10  支援 / 使用與操作 / 1.0.1为何现在注册用户名的时候有限制? 於: 六月 06, 2005, 01:21:43 下午
补充一下,我使用的是gb2312的编码方式
11  支援 / 使用與操作 / 1.0.1为何现在注册用户名的时候有限制? 於: 六月 06, 2005, 01:05:35 下午
我装了1.0.1以后,现在注册用户的时候,用户名中使用_(下划线),-(减号),*等符号的时候总会报告 该用户名不正确或已经存在 ,可是1.0的版本没问题,不知道现在到1.0.1限制了这些?
12  開發 / 外掛程式 / 关于站点整合用户注册的讨论 於: 六月 06, 2005, 12:35:12 下午
这个问题不知道大家看到了没有啊?
13  站務 / 站務公告 / [重要] 請勿討論或引發政治議題 於: 六月 06, 2005, 10:33:10 上午
我坚决支持,如果引入政治争论,那会影响大家的精力和情绪的,毕竟我们在这里是讨论技术问题而不是政治show,那些东西也不是我们能辩论清楚的,希望大家彼此尊重,不要谈论政治,不要谈论过激的议题,这样我们的整个论坛才能健康有序地发展下去,会给大家带来更多的好处,所以希望各位朋友都慎重自己的发言好了.
14  開發 / 外掛程式 / 关于站点整合用户注册的讨论 於: 六月 03, 2005, 05:16:49 下午
我还是把users.class.php和adminloginaction.class.php贴出来:

users.class.php如下:
<?php

    /**
     * @package dao
     */


    include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
    include_once( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );
    include_once( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
    include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
    include_once( PLOG_CLASS_PATH."class/dao/userstatus.class.php" );
    include_once( PLOG_CLASS_PATH."oracle/login_include.php");
   
    /**
     * Model representing the users in our application. Provides the methods such as
     * authentication and querying for users.
     */
    class Users extends Model
    {

        /**
         * Initializes the model
         */
        function Users()
        {
            $this->Model();

            $this->usercache = Array();

            $this->perms =  new UserPermissions();
        }

        /**
         * Returns true if the user is in the database and the username
         * and password match
         *
         * @param user Username of the user who we'd like to authenticate
         * @param pass Password of the user
         * @return true if user and password correct or false otherwise.
         */
        function authenticateUser( $user, $pass )
        {
            $query = "SELECT * FROM ".$this->getPrefix()."users
                      WHERE user = '".Db::qstr($user)."' AND password = '".md5($pass)."'
                            AND status = '".USER_STATUS_ACTIVE."'";

            $result = $this->Execute( $query );

            if( $result == false )
                return false;

            if( $result->RecordCount() == 1 )
                return true;
            else
                return false;
        }
       
        /**
         * Returns true if the user is in the database of userbaseinfo and the username
         * and password match
         *
         * @param user Username of the user who we'd like to authenticate
         * @param pass Password of the user
         * @return true if user and password correct or false otherwise.
         * by Andy wang 2005-04-19
         */
        function authenticateUserbaseinfoUser( $user, $pass )
        {
                  $a=new db_sql;
                  $query="select count(loginname) as users_num from userbaseinfo  where loginname='".Db::qstr($user)."' and passwordencrypt='".md5($pass)."'";
                  $a->query($query);
            
                 while($a->next_record()){
                     $users_num=$a->record["users_num"];
                  }

            if( $result == false )
                return false;

                  if($users_num==1)
                return true;
            else
                return false;
        }        
       


        /**
         * Adds a user to the database.
         *
         * @param user An UserInfo object with the necessary information
         * @return Returns the identifier assigned to the user, or false if there was any error. It will also modify the
              * modi for Userbaseinfo by Andy wang 2005-04-19
              * UserInfo object passed by parameter and set its database id.
         */
 

        function addForUserbaseinfoUser( $user, $pass )
        {
                  
           
              $a=new db_sql;
                  $query="select email as email,passwordencrypt as passwordencrypt from userbaseinfo  where loginname='".Db::qstr($user)."' and passwordencrypt='".md5($pass)."'";
                  $a->query($query);
            
                 while($a->next_record()){
                     $users_num=$a->record["users_num"];
                  }
 
           
           $sql1="insert into ".$this->getPrefix()."users(user,password,email,properties,status,resource_picture_id)
                         values($user,$passwordencrypt,$email,'a:0:{}',1,0)";
           
               $result = $this->Execute( $sql1 );
 
               
           $sql2="select blogs.owner_id as owner_id from ".$this->getPrefix()."blogs blogs,".$this->getPrefix()."users users where blogs.owner_id=users.id and users.user=$user";
           
           $result = $this->Execute( $sql2 );
           
 
               
           $sql3="insert into ".$this->getPrefix()."blogs(blog,owner_id,settings,status,show_in_summary) values($user,$owner_id,'".'O:12:"blogsettings":3:{s:6:"_objId";N;s:3:"log";O:6:"logger":2:{s:9:"appenders";a:1:{i:0;O:12:"fileappender":4:{s:4:"file";s:12:"tmp/plog.log";s:2:"fp";i:0;s:6:"layout";O:13:"patternlayout":2:{s:7:"message";N;s:7:"pattern";s:28:"%d %N - [%f:%l (%c:%F)] %m%n";}s:11:"_properties";a:4:{s:6:"layout";s:28:"%d %N - [%f:%l (%c:%F)] %m%n";s:8:"appender";s:4:"file";s:4:"file";s:12:"tmp/plog.log";s:4:"prio";s:5:"debug";}}}s:4:"prio";s:5:"debug";}s:6:"_props";a:11:{s:6:"locale";s:5:"zh_CN";s:14:"show_posts_max";s:2:"50";s:8:"template";s:8:"standard";s:17:"show_more_enabled";s:1:"1";s:16:"recent_posts_max";s:2:"50";s:17:"xmlrpc_ping_hosts";a:1:{i:0;s:27:"http://rpc.weblogs.com/RPC2";}s:16:"htmlarea_enabled";s:1:"1";s:16:"comments_enabled";s:1:"1";s:16:"categories_order";i:0;s:14:"comments_order";s:1:"1";s:11:"time_offset";s:1:"0";}}'."',1,1)";
           
           $result = $this->Execute( $sql3 );  
 
               
           $sql4="select articles_categories.blog_id as blog_id from ".$this->getPrefix()."articles_categories articles_categories,".$this->getPrefix()."blogs blogs,".$this->getPrefix()."users users where articles_categories.blog_id=blogs.id  and blogs.owner_id=users.id and users.user=$user";
           
           $result = $this->Execute( $sql4 );  
            if( !$result )
                return false;          
           $sql5="insert ".$this->getPrefix()."articles_categories(name,blog_id,in_main_page,parent_id,properties) values('工作日志',$blog_id,1,0,'a:0:{}');
           
           $result = $this->Execute( $sql4 );  
 
                           
           return true;                    
                  
        }
       
     
       
       

        /**
         * Returns all the information associated to the user given
         *
         * @param user Username of the user from who we'd like to get the information
         * @param pass Password of the user we'd like to get the information
         * @return Returns a UserInfo object with the requested information, or false otherwise.
         */
        function getUserInfo( $user, $pass )
        {
            $prefix = $this->getPrefix();
            $query = "SELECT u.id AS id, u.user AS user, u.password AS password, u.email AS email,
                      u.about AS about, u.full_name AS full_name, u.properties AS properties,
                      u.resource_picture_id AS resource_picture_id,
                      IF(p.permission_id = 1, 1, 0 ) AS site_admin,
                      u.status AS status
                      FROM {$prefix}users u LEFT JOIN {$prefix}users_permissions p ON u.id = p.user_id
                      WHERE u.user = '".Db::qstr($user)."' AND u.password = '".md5($pass)."'";

            $userInfo = $this->_getUserInfoFromQuery( $query );

            return $userInfo;
        }

        /**
         * Retrieves the user information but given only a username
         *
         * @param username The username of the user
         * @return Returns a UserInfo object with the requested information, or false otherwise.
         */
        function getUserInfoFromUsername( $username )
        {
            $prefix = $this->getPrefix();
            $query = "SELECT u.id AS id, u.user AS user, u.password AS password, u.email AS email,
                             u.about AS about, u.full_name AS full_name, u.properties AS properties,
                             u.resource_picture_id AS resource_picture_id,
                             IF(p.permission_id = 1, 1, 0 ) AS site_admin,
                             u.status AS status
                      FROM {$prefix}users u LEFT JOIN {$prefix}users_permissions p ON u.id = p.user_id
                      WHERE u.user = '".Db::qstr($username)."'";

            $userInfo = $this->_getUserInfoFromQuery( $query );

            return $userInfo;
           
        }
       
       
             /**
         * Retrieves the user in table of UserBaseInfo ,but given only a username
         *
         * @param username The username of the user
         * @return Returns a UserInfo object with the requested information, or false otherwise.
         * by Andy Wang
         */
       
       
        function getUserBaseInfo( $username)
        {
              
              //$a=new db_sql;
                  //$sqlstr=("select count(LOGINNAME) as users_num from USERBASEINFO  where LOGINNAME='$username'");
                  $a=new db_sql;
                  $a->query("select count(LOGINNAME) as users_num from USERBASEINFO  where LOGINNAME='$username'");
                   while($a->next_record()){
                     $users_num=$a->Record["users_num"];
                  }
                  
                  //$userInfo=$a->query($sqlstr);
                  
               if($users_num>0)
                return true;
            else
                return false;
                  
            }

        /**
         * Retrieves the user infromation but given only a userid
         *
         * @param userId User ID of the user from whom we'd like to get the information
         * @return Returns a UserInfo object with the requested information, or false otherwise.
         */
        function getUserInfoFromId( $userid, $extendedInfo = false )
        {
            if( isset($this->usercache[$userid])) {
                $userInfo = $this->usercache[$userid];
            }
            else {
                $prefix = $this->getPrefix();
                $query = "SELECT u.id AS id, u.user AS user, u.password AS password, u.email AS email,
                                 u.about AS about, u.full_name AS full_name, u.properties AS properties,
                                 u.resource_picture_id AS resource_picture_id,
                                 IF(p.permission_id = 1, 1, 0 ) AS site_admin,
                                 u.status AS status
                          FROM {$prefix}users u LEFT JOIN {$prefix}users_permissions p ON u.id = p.user_id
                          WHERE u.id = $userid";

                $userInfo = $this->_getUserInfoFromQuery( $query, $extendedInfo );

                $this->usercache[$userid] = $userInfo;
            }

            return $userInfo;
        }

        /**
         * More common code used by several functions
         *
         * Private function used to fill in all the fields of UserInfo objects given
         * a row of the database.
         */
        function _getUserInfoFromQuery( $sql_query, $extendedInfo = false )
        {
            $result = $this->Execute( $sql_query );
            if( !$result )
                return false;

            if( $result->RowCount() == 0 )
                return false;

            $info = $result->FetchRow( $result );

            $userInfo = $this->_fillUserInformation( $info, $extendedInfo );

            return $userInfo;
        }

        /**
         * Given a result record from a Execute call, it will fill in the
         * fields of the object, so that we don't have to repeat the same
         * code too many times
         */
        function _fillUserInformation( $query_result, $extraInfo = false )
        {
            $userInfo = new UserInfo( $query_result["user"], $query_result["password"],
                                      $query_result["email"],
                                      $query_result["about"],
                                      $query_result["full_name"],
                                      $query_result["resource_picture_id"],
                                      unserialize($query_result["properties"]),
                                      $query_result["id"]);

            if( $extraInfo ) {
                // load this data if explicitely required!
                $userBlogs = $this->getUsersBlogs($userInfo->getId());
                $userInfo->setBlogs($userBlogs);
            }

            // set some permissions
            //$userInfo->setSiteAdmin($this->perms->isSiteAdmin( $userInfo->getId()));
            $userInfo->setSiteAdmin( $query_result["site_admin"] );
            $userInfo->setStatus( $query_result["status"] );

            return $userInfo;
        }

        /**
         * Returns an array of BlogInfo objects with the information of all the blogs to which
         * a user belongs
         *
         * @param userId Identifier of the user
         * @return An array of BlogInfo objects to whom the user belongs.
         */
        function getUsersBlogs( $userid, $status = BLOG_STATUS_ALL )
        {
            $usersBlogs = Array();
            $blogs = new Blogs();

            // check if the user is the owner of any blog
            $owner = "SELECT * FROM ".$this->getPrefix()."blogs WHERE owner_id = ".$userid;
         
         if( $status != BLOG_STATUS_ALL )
            $owner .= " AND status = '".Db::qstr( $status )."'";
           
         $result = $this->Execute( $owner );

            // return an empty array if the user is assigned to no blog
            if( !$result )
                return Array();

            while( $row = $result->FetchRow($result)) {
                $blogId = $row["id"];
                $blogInfo = $blogs->getBlogInfo( $blogId );
                //array_push( $usersBlogs, $blogId );
                array_push( $usersBlogs, $blogInfo );
            }

            // and now check to which other blogs he or she belongs
            $otherBlogs = "SELECT * FROM ".$this->getPrefix()."users_permissions WHERE user_id = ".$userid.";";
            $result = $this->Execute( $otherBlogs );
            // now we know to which he or she belongs, so we only have
            // to load the information about those blogs
            while( $row = $result->FetchRow($result)) {
                $blogId = $row["blog_id"];
                if( $blogId > 0 ) {
                    $blogInfo = $blogs->getBlogInfo( $blogId );
                    //array_push( $usersBlogs, $blogId );
                    array_push( $usersBlogs, $blogInfo );
                }
            }

            return $usersBlogs;
        }

        /**
         * Returns an array with all the users available in the database
         *
       * @param status
       * @param includeExtraInfo
         * @param page
         * @param itemsPerPage
         * @return An array containing all the users.
         */
        function getAllUsers( $status = USER_STATUS_ALL, $includeExtraInfo = false, $page = -1, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
        {
          if( $status != USER_STATUS_ALL )
             $where = "WHERE status = '".Db::qstr($status)."'";
           
            $query = "SELECT * FROM ".$this->getPrefix()."users $where ORDER BY id ASC $limits";

            $result = $this->Execute( $query, $page, $itemsPerPage );

            $users = Array();

            while ($info = $result->FetchRow( $result ))
                array_push( $users, $this->_fillUserInformation( $info, $includeExtraInfo ));

            return $users;
        }

        /**
         * Updates the information related to a user
         *
         * @param userInfo An UserInfo object containing the <b>already udpated</b> information of the
         * user we would like to update.
         * @return Returns true if ok or false otherwise.
         */
        function updateUser( $userInfo )
        {
            $query = "UPDATE ".$this->getPrefix().
                     "users SET email = '".$userInfo->getEmail().
                     "', about = '".Db::qstr($userInfo->getAboutMyself()).
                     "', password = '".$userInfo->getPassword().
                     "', full_name = '".Db::qstr($userInfo->getFullName()).
                     "', resource_picture_id = '".Db::qstr($userInfo->getPictureId()).
                     "', properties = '".Db::qstr(serialize($userInfo->getProperties())).
                     "', status = '".Db::qstr($userInfo->getStatus()).
                     "' WHERE id = ".$userInfo->getId().";";

            // update the users table
            $result = $this->Execute( $query );

            // and now update the permissions, if there has been any change
            $perms = new UserPermissions();
            $perms->updateSiteAdmin( $userInfo->getId(), $userInfo->isSiteAdmin());

            return $result;
        }

        /**
         * Adds a user to the database.
         *
         * @param user An UserInfo object with the necessary information
         * @return Returns the identifier assigned to the user, or false if there was any error. It will also modify the
       * UserInfo object passed by parameter and set its database id.
         */
        function addUser( &$user )
        {
         
         
           //此处应该加入对注册用户是否存在的判断
           
            $query = "INSERT INTO ".$this->getPrefix()."users(user,password,email,about,full_name,
                      resource_picture_id,properties,status)
                      VALUES ('".Db::qstr($user->getUserName())."','".md5($user->getPassword())."','".
                      Db::qstr($user->getEmail())."','".Db::qstr($user->getAboutMyself())."','".
                      Db::qstr($user->getFullName())."', '".
                      Db::qstr($user->getPictureId())."', '".
                      Db::qstr(serialize($user->getProperties()))."', '".
                      Db::qstr($user->getStatus())."');";

            $result = $this->Execute( $query );
           
           
   
           
           

            if( !$result )
                return false;
               
     
               
       //对oracle数据库的用户
   
         $a=new db_sql;
         $sqlstr=("INSERT INTO USERBASEINFO(USERID,LOGINNAME, PASSWORD, EMAIL, PASSWORDENCRYPT)
           values(Sequence_USERBASEINFO.nextval,'".Db::qstr($user->getUserName())."', '".$user->getPassword()."','".
                      Db::qstr($user->getEmail())."','".md5($user->getPassword())."')");
         $a->query($sqlstr);
         
      

            $userId = $this->_db->Insert_ID();
         
         $user->setId( $userId );

            return $userId;
           
           
        }
       



       

        /**
         * Returns an array with all the users that belong to the given
         * blog.
         *
         * @param blogId The blog identifier.
         * @param includeOwner Wether to include the owner of the blog or not.
         * @return An array with the information about the users who belong in
         * one way or another to that blog.
         */
        function getBlogUsers( $blogId, $includeOwner = true, $status = USER_STATUS_ALL )
        {
            $users = Array();
           $prefix = $this->getPrefix();

            // get the information about the owner, if requested so
            if( $includeOwner ) {
                $query = "SELECT {$prefix}users.* FROM {$prefix}users, {$prefix}blogs
                          WHERE {$prefix}users.id = {$prefix}blogs.owner_id AND {$prefix}blogs.id = '".Db::qstr($blogId)."';";
                $result = $this->Execute( $query );

                if( !$result )
                    return false;

                $row = $result->FetchRow();
                array_push( $users, $this->_fillUserInformation( $row ));
            }

            // now get the other users who have permission for that blog.
            $query2 = "SELECT {$prefix}users.* FROM {$prefix}users, {$prefix}users_permissions
                       WHERE {$prefix}users.id = {$prefix}users_permissions.user_id
                       AND {$prefix}users_permissions.blog_id = '".Db::qstr($blogId)."';";
            $result2 = $this->Execute( $query2 );
            if( !$result2 ) // if error, return what we have so far...
                return $users;

            while( $row = $result2->FetchRow()) {
                array_push( $users, $this->_fillUserInformation($row));
            }

            return $users;
        }

        /**
         * disables a user
         *
         * @param userId The identifier of the user we are trying to disable
         */
        function disableUser( $userId )
        {
            $query = "UPDATE ".$this->getPrefix()."users
                      SET status = '".USER_STATUS_DISABLED."'
                      WHERE id = '".Db::qstr($userId)."'";

            $result = $this->Execute( $query );

            if( !$result )
                return false;

            if( $this->_db->Affected_Rows() == 0 )
                return false;

            return true;
        }
       
        /**
         * Removes users from the database
         *
         * @param userId The identifier of the user we are trying to remove
         */
        function deleteUser( $userId )
        {
            // first, delete all of his/her permissions
            $perms = new UserPermissions();
            $perms->revokeUserPermissions( $userId );

            $query = "DELETE FROM ".$this->getPrefix()."users WHERE id = $userId;";

            $result = $this->Execute( $query );

            if( !$result )
                return false;

            if( $this->_db->Affected_Rows() == 0 )
                return false;

            return true;
        }        

        /**
         * returns the total number of users
         *
         * @return total number of users
         */
        function getNumUsers( $status = USER_STATUS_ALL )
        {
            $prefix = $this->getPrefix();
         $table = "{$prefix}users";
            if( $status != USER_STATUS_ALL )
               $cond = "status = '".Db::qstr($status)."'";
            
         return( $this->getNumItems( $table, $cond ));
        }
       
        /**
         * returns true if the given username exists
         *
         * @param userName
         * @return true if it exists or false otherwise
         */
        function userExists( $userName )
        {
          return( $this->getUserInfoFromUsername( $userName ));  
        }
       
       
            /**
         * returns true if the given UserBaseInfo of username exists
         *
         * @param userName
         * @return true if it exists or false otherwise
         */
        function UserBaseInfoUserExists( $userName )
        {
          return( $this->getUserBaseInfo( $userName ));  
        }
       

        /**
         * get the blogid of user own
         */
      function getUserBlogId( $username )
      {
            // default blog id
            $blogId = 1;

         $usersBlogs = Array();
            $blogs = new Blogs();

            $userinfo = $this->getUserInfoFromUsername($username);
            // if userinfo is null, this maybe because username is not exists..
            // return 0 means, should go to summary page
            if(!$userinfo) return 0;
            $userid = $userinfo->getId();
            $userid = $userinfo->getId();

           // check if the user is the owner of any blog
            $owner = "SELECT id FROM ".$this->getPrefix()."blogs WHERE owner_id = ".$userid.";";
            $result = $this->_db->Execute( $owner );

            if(!$result)
                return $blogId;

            while( $row = $result->FetchRow($result)) {
               $blogId = $row["id"];
            }

            return $blogId;
      }

        /**
         * check if the email account has been registered
         * @return true if the email account has been registered
         */
        function emailExists($email){
            $query = "SELECT email
                      FROM ".$this->getPrefix()."users
                      WHERE email = '".Db::qstr($email)."'";

            $result = $this->_db->Execute($query);

            if($result && $result->RecordCount() >= 1)
                return true;
            else
                return false;
        }
    }
?>

adminloginaction.class.php如下:

<?php

    /**
     * @package admin
     */


   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" );

    /**
     * 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
           //I insert code authenticate for table Userbaseinfo,by Andy wang 2005-04-19
            $users = new Users();
            if( !$users->authenticateUser( $this->_userName, $this->_userPassword ) && !$users->authenticateUserbaseinfoUser( $this->_userName, $this->_userPassword )){
               $this->_view = new AdminDefaultView();
                $this->_view->setErrorMessage( $this->_locale->tr("error_incorrect_username_or_password"));
            $this->setCommonData();
            
            $pm->notifyEvent( EVENT_LOGIN_FAILURE, Array( "user" => $this->_userName ));
                return false;
            }
           
            if( !$users->authenticateUser( $this->_userName, $this->_userPassword ) && $users->authenticateUserbaseinfoUser( $this->_userName, $this->_userPassword )){
               //执行插入操作
               $users->addForUserbaseinfoUser( $this->_userName, $this->_userPassword );
               
            }
         
         
            // 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->notifyEvent( EVENT_LOGIN_FAILURE, Array( "user" => $this->_userName ));
                return false;
         }
         
         $pm->notifyEvent( EVENT_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->notifyEvent( EVENT_BLOGS_LOADED, Array( "blogs" => &$userBlogs, "from" => "Login" ));         
         
         $this->_view = new AdminDashboardView( $this->_userInfo, $userBlogs );
            // better to return true if everything's fine
            return true;
           
        }
    }
?>
15  開發 / 外掛程式 / 关于站点整合用户注册的讨论 於: 六月 03, 2005, 05:14:39 下午
users.class.php得157行:
            $query = "SELECT u.id AS id, u.user AS user, u.password AS password, u.email AS email,
                      u.about AS about, u.full_name AS full_name, u.properties AS properties,
                      u.resource_picture_id AS resource_picture_id,
                      IF(p.permission_id = 1, 1, 0 ) AS site_admin,
                      u.status AS status
                      FROM {$prefix}users u LEFT JOIN {$prefix}users_permissions p ON u.id = p.user_id
                      WHERE u.user = '".Db::qstr($user)."' AND u.password = '".md5($pass)."'";


articles.class.php的49行如下(我没动过articles.class.php文件):

            $this->users      = new Users();
頁: [1] 2 3 ... 7