예제 #1
0
파일: Auth.php 프로젝트: model3/model3
 /**
  *
  * @param string $user
  * @param string $pass
  * @return bool
  */
 public function authenticate($user, $pass)
 {
     $dbs = Registry::getInstance()->get('databases');
     $em = $dbs[$this->_config['cnx']];
     /* @var $em Doctrine\ORM\EntityManager */
     $user = $em->getRepository($this->_config['table'])->findOneBy(array($this->_config['user'] => $user));
     if ($user) {
         $method = 'get' . ucwords($this->_config['pass']);
         if ($user->{$method}() == $pass) {
             $_SESSION['__M3']['Credentials'] = $user->getData();
             return true;
         }
         return false;
     }
 }
예제 #2
0
파일: Site.php 프로젝트: model3/model3
 public static function baseUrl()
 {
     $registry = Registry::getInstance();
     $config = $registry->get('config');
     $carray = $config->getArray();
     return $carray['general']['url'];
 }