Changeset 251 for tags/2.0.2


Ignore:
Timestamp:
May 4, 2007 6:31:00 AM (17 years ago)
Author:
quinn
Message:

Added a isBlocked routine to Auth_SQL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/2.0.2/lib/Auth_SQL.inc.php

    r228 r251  
    573573            App::setBoomerangURL(absoluteMe(), 'login');
    574574            App::dieURL($this->_params['login_url']);
     575        }
     576    }
     577
     578    /**
     579     * This sets the 'blocked' field for a user in the db_table, and also
     580     * adds an optional reason
     581     *
     582     * @param  string   $reason      The reason for blocking the account.
     583     */
     584    function isBlocked($user_id=null)
     585    {
     586        $this->initDB();
     587
     588        if ($this->getParam('blocking')) {
     589            // Get user_id if specified.
     590            $user_id = isset($user_id) ? $user_id : $this->getVal('user_id');
     591            $qid = DB::query("
     592                SELECT 1
     593                FROM " . $this->_params['db_table'] . "
     594                WHERE blocked = 'true'
     595                AND " . $this->_params['db_primary_key'] . " = '" . DB::escapeString($user_id) . "'
     596            ");
     597            return mysql_num_rows($qid) === 1;
    575598        }
    576599    }
Note: See TracChangeset for help on using the changeset viewer.