/** @param PDOStatement $query_result */
 private function treat_success($query_result)
 {
     if ($query_result->rowCount() > 0) {
         (new Delete_invitation(array('id' => parent::get_input('id_invitation'))))->run();
     } else {
         TTransaction::rollback();
     }
 }
 /** @param PDOStatement $query_result */
 private function treat_success($query_result)
 {
     if ($query_result->rowCount() > 0 && TSession::try_get_value('id_user', $id_user)) {
         $id_transaction = TTransaction::get_last_inserted_id();
         (new Insert_user_transaction(array('id_user' => $id_user, 'id_transaction' => $id_transaction)))->run();
         if (!parent::get_error()) {
             (new Insert_event_transaction(array('id_event' => parent::get_input('id_event'), 'id_transaction' => $id_transaction)))->run();
         }
         if (parent::get_error()) {
             TTransaction::rollback();
         }
     } else {
         parent::set_error(102);
         TTransaction::rollback();
     }
 }
 public function action()
 {
     $attrs = array('id, name');
     $attrs_cond = array('%name');
     $sql = TTransaction::get_select_query('user', $attrs, $attrs_cond);
     // Parâmetros em ordem de aparição da query
     $query_values = array('%' . parent::get_input('name_frag') . '%');
     // Resultado da query
     $query_result = TTransaction::safe_execute($sql, $query_values);
     if ($query_result === false) {
         parent::set_error(101);
         TTransaction::rollback();
     } else {
         $this->treat_success($query_result);
     }
     return parent::get_result();
 }
 /** Checa se o usuário conectado foi convidado por quem ele deseja convidar. Caso positivo, é executado como se
  * tivesse aceitado a solicitação. */
 private function check_invitation()
 {
     $attrs = array('id');
     $attrs_cond = array('id_user1', 'id_user2');
     $sql = TTransaction::get_select_query('invitation', $attrs, $attrs_cond);
     // Parâmetros em ordem de aparição da query
     $query_values = array(parent::get_input('id_user2'), $this->connected);
     // Resultado da query
     $query_result = TTransaction::safe_execute($sql, $query_values);
     if ($query_result === false) {
         parent::set_error(101);
         TTransaction::rollback();
     } else {
         if ($query_obj = $query_result->fetchObject()) {
             (new Insert_user_user(array('id_user1' => parent::get_input('id_user2'), 'id_invitation' => $query_obj->id)))->run();
             return true;
         }
     }
     return false;
 }
示例#5
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();
 }
示例#6
0
 private function get_login_type()
 {
     return strpos(parent::get_input('login'), '@') === false ? 'username' : 'email';
 }