/**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aSession !== null) {
             if (!$this->aSession->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aSession->getValidationFailures());
             }
         }
         if ($this->aUser !== null) {
             if (!$this->aUser->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aUser->getValidationFailures());
             }
         }
         if (($retval = SingleSignOnKeyPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
示例#2
0
function InitPage($login)
{
    $page = $login;
    $lastPage = GetSessionVar('s_pageName');
    $User = GetSessionVar('User');
    if (empty($GLOBALS['page'])) {
        $GLOBALS['page'] = '';
    }
    if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], "login.php") == FALSE && strpos($_SERVER['REQUEST_URI'], "callback") == FALSE) {
        SetSessionVar('s_pageLast', $_SERVER['REQUEST_URI']);
    }
    $dbc = new DBConnection();
    global $dbh;
    $dbh = $dbc->connect();
    if ($login == "login" && !$User) {
        # Login required, but the User object isn't there.
        if (isset($_COOKIE[COOKIE_REMEMBER])) {
            # Try to fetch username from session
            require_once dirname(__FILE__) . "/../classes/system/session.class.php";
            $Session = new Session();
            if (!$Session->validate()) {
                exitTo("login.php");
            } else {
                $User = new User();
                $User->loadFromID($Session->_userid);
                SetSessionVar("User", $User);
            }
        } else {
            exitTo("login.php");
        }
    }
    $GLOBALS['g_PHPSELF'] = $GLOBALS['page'];
    $GLOBALS['g_PAGE'] = $page;
    if (isset($_SERVER['HTTP_HOST'])) {
        $GLOBALS['g_SITEURL'] = $_SERVER['HTTP_HOST'];
        $GLOBALS['g_SITENAME'] = substr($GLOBALS['g_SITEURL'], 0, strlen($GLOBALS['g_SITEURL']) - 4);
        $GLOBALS['g_TITLE'] = $GLOBALS['g_SITENAME'];
    }
    $GLOBALS['g_ERRSTRS'] = array("", "", "", "", "", "", "", "", "", "", "");
    $GLOBALS['DEBUG'] = "";
}
示例#3
0
<?php

session_name("easyTCGFM");
session_start();
define('VALID_INC', TRUE);
include 'class_lib.php';
$session = new Session();
if (isset($_POST['login'])) {
    $login = $session->start($_POST['username'], $_POST['password'], $_POST['remember']);
}
$validsession = $session->validate();
if (!$validsession) {
    $enablelogin = true;
    include "login.php";
    die;
} else {
    $username = $_SESSION['username'];
    $database = new Database();
}
$tradecount = $database->num_rows("SELECT * FROM `trades`");
if (isset($_GET['id']) && $database->num_rows("SELECT * FROM `tcgs` WHERE `id`='" . intval($_GET['id']) . "'") === 1) {
    $_SESSION['currTCG'] = intval($_GET['id']);
}
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="">