コード例 #1
0
 function check()
 {
     if (!$this->Email) {
         throw new Exception('Informe o e-mail.');
     } else {
         if (!$this->getEmail()) {
             throw new Exception('E-mail inválido.');
         } else {
             if ($busca = APP::getInstanceModel('Emails')->Lista('WHERE a.id != :id AND a.email = :email AND a.ref = :ref AND a.status != 99 LIMIT 1', ['id' => $this->getId(), 'email' => $this->getEmail(), 'ref' => $this->getRef()])) {
                 if ($busca[0]->getStatus() == 99) {
                     $this->getId($busca[0]->getId());
                     $this->setStatus(1);
                 } else {
                     throw new Exception('E-mail já está cadastrado.');
                 }
             }
         }
     }
 }
コード例 #2
0
 /**
  * 
  * @param boolean $Default
  * @param string $ADDReference
  * @return array|ImageVO
  */
 function imgList($Default = false, $ADDReference = null)
 {
     return APP::getInstanceModel('ImagensModel')->getByRef($this->getTable() . (string) $ADDReference, $this->getId(), $Default);
 }
コード例 #3
0
ファイル: core.php プロジェクト: jhonlennon/estrutura-mvc
/**
 * 
 * @param string $ModelName
 * @return Model
 */
function newModel($ModelName)
{
    return APP::getInstanceModel(ucfirst($ModelName));
}
コード例 #4
0
 /**
  * Retorna as configurações de envio
  * @return SmtpVO
  * @throws Exception
  */
 function getConfig()
 {
     if (!$this->Config) {
         $this->Config = APP::getInstanceModel('Smtp')->getConfig();
         if (empty($this->Config)) {
             throw new Exception('Não foi possível carregar as configurações SMTP.');
         }
         $this->SMTP->IsSMTP();
         $this->SMTP->IsHTML();
         $this->SMTP->CharSet = 'UTF-8';
         $this->SMTP->Host = $this->Config->getHost();
         $this->SMTP->Username = $this->Config->getLogin();
         $this->SMTP->Password = $this->Config->getSenha();
         $this->SMTP->Port = $this->Config->getPorta();
         $this->SMTP->SMTPAuth = $this->Config->getAutenticar() ? true : false;
         $this->SMTP->SMTPSecure = $this->Config->getProtocolo();
         $this->SMTP->Subject = $this->Config->getAssunto();
         $this->setFrom($this->Config->getNome(), $this->Config->getEmail());
     }
     return $this->Config;
 }