Pommo_Pending::getByEmail PHP Метод

getByEmail() публичный Метод

returns pending object (array) or false if not found.
public getByEmail ( $email = null )
    function getByEmail($email = null)
    {
        global $pommo;
        $dbo =& Pommo::$_dbo;
        $o = array();
        $query = "\n            SELECT\n                p.*\n            FROM\n                " . $dbo->table['subscriber_pending'] . " p,\n                " . $dbo->table['subscribers'] . " s\n            WHERE\n                s.subscriber_id = p.subscriber_id\n                AND s.email = '%s'\n                AND s.status IN(1,2)\n            LIMIT 1";
        $query = $dbo->prepare($query, array($email));
        while ($row = $dbo->getRows($query)) {
            $o = Pommo_Pending::makeDB($row);
        }
        return empty($o) ? false : $o;
    }

Usage Example

Пример #1
0
 */
/**********************************
	INITIALIZATION METHODS
*********************************/
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Pending.php';
Pommo::init(array('authLevel' => 0, 'noSession' => true));
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$smarty = new Pommo_Template();
$input = isset($_GET['input']) ? unserialize($_GET['input']) : array('Email' => NULL);
$pending = isset($input['adminID']) ? Pommo_Pending::getBySubID(0) : Pommo_Pending::getByEmail($input['Email']);
if (!$pending) {
    Pommo::redirect('login.php');
}
switch ($pending['type']) {
    case "add":
        $msg = Pommo::_T('subscription request');
        $pending['type'] = 'confirm';
        // normalize for Pommo_Helper_Messages::sendMessage
        break;
    case "change":
        $msg = Pommo::_T('record update request');
        $pending['type'] = 'update';
        // normalize for Pommo_Helper_Messages::sendMessage
        break;
    case "password":