/** @param PDOStatement $query_result */
 private function treat_success($query_result)
 {
     $result_array = array();
     while ($query_obj = $query_result->fetchObject()) {
         $result_array[] = $query_obj;
     }
     parent::set_result('result_array', $result_array);
 }
Пример #2
0
 /**
  * @param PDOStatement $query_result
  */
 private function treat_success($query_result)
 {
     // Se o login e senha passado existem, inicia uma sessão, caso contrário, avisa o usuário.
     if ($result_obj = $query_result->fetchObject()) {
         // Define o nome no retorno
         parent::set_result('name', $result_obj->name);
         // Guarda o Id, para manter o login, e o Nome do usuário, para evitar uma consulta.
         TSession::set_value('id_user', $result_obj->id);
         TSession::set_value('name', $result_obj->name);
     } else {
         parent::set_error(1, "O par de usuário e senha não foi encontrado.");
     }
 }
Пример #3
0
 public function action()
 {
     parent::get_input('mailTo');
     //SMTP needs accurate times, and the PHP time zone MUST be set
     //This should be done in your php.ini, but this is how to do it if you don't have access to that
     date_default_timezone_set('Etc/UTC');
     //Create a new PHPMailer instance
     $mail = new PHPMailer();
     $this->setupDebug($mail);
     //$mail->isMail();
     //$this->setupSendMail($mail);
     $this->setupSMTP($mail);
     //Set who the message is to be sent from
     $mail->setFrom(parent::get_input('from_mail'), parent::get_input('from_name'));
     //Set who the message is to be sent to
     $mail->addAddress(parent::get_input('to_mail'), parent::get_input('to_name'));
     //Set an alternative reply-to address
     $mail->addReplyTo(parent::get_input('reply_mail'), parent::get_input('reply_name'));
     //Set the subject line
     $mail->Subject = parent::get_input('subject');
     //Read an HTML message body from an external file, convert referenced images to embedded,
     //convert HTML into a basic plain-text alternative body
     $mail->msgHTML(parent::get_input('body'));
     //Replace the plain text body with one created manually
     $mail->AltBody = parent::get_input('alt_body');
     //Attach an image file
     //$mail->addAttachment('images/phpmailer_mini.gif');
     //send the message, check for errors
     if (!$mail->send()) {
         TTransaction::log($mail->ErrorInfo);
         parent::set_error(1, "Mensagem não enviada!");
     } else {
         parent::set_result('Enviado', date('d.m.Y H:i:sy'));
     }
     return parent::get_result();
 }
Пример #4
0
 public function action()
 {
     parent::set_result('methods', $this->prepare());
     return parent::get_result();
 }