protected function sendReport($sendLogObject)
 {
     if (is_object($sendLogObject->report_processed->ex_schedule_report)) {
         $file_name = $sendLogObject->report_processed->getFileName($sendLogObject->report_processed->ex_schedule_report);
         $file_path = $sendLogObject->report_processed->full_file_name;
         if ($sendLogObject->destination->method === 'mail') {
             $this->logger->log(__METHOD__, array('method' => $sendLogObject->destination->method, 'email' => $sendLogObject->destination->destination_email));
             $mail_params = array('actuality_time' => $sendLogObject->created, 'schedule_period' => '', 'report_file_name' => $file_name, 'link' => '', 'report_type' => $sendLogObject->report_processed->ex_schedule_report->report_type);
             $subject = Yii::t('letter', 'scheduled_report_mail_subject', $mail_params, null, 'en');
             $settings = Settings::model()->findByPk(1);
             $mailSender = new mailSender('odss_reports', array());
             $sendResult = $mailSender->setAttachments(array(array('file_path' => $file_path, 'file_name' => $file_name)))->setRecipient($sendLogObject->destination->destination_email)->setFrom($settings->mail__sender_address, $settings->mail__sender_name)->setSubject($subject)->setHtmlBody()->send();
             if ($sendResult !== false) {
                 $sendLogObject->sent = 1;
                 $sendLogObject->save();
             }
             $this->logger->log(__METHOD__ . ' $sendResult: ' . $sendResult);
             $this->logger->log(__METHOD__ . ' Message send with attached file');
             $this->logger->log(__METHOD__ . ' Deliver via mail DONE.');
         } else {
             if ($sendLogObject->destination->method === 'ftp') {
                 // use it if you have some superstition about "../"
                 //                    $fileCopier = new FileCopier;
                 //                    $file_path = $fileCopier->rmPathSteps($file_path);
                 $ftpClient = new FtpClient();
                 $errors = $ftpClient->connect($sendLogObject->destination->destination_ip, $sendLogObject->destination->destination_ip_port)->login($sendLogObject->destination->destination_ip_user, $sendLogObject->destination->destination_ip_password)->setFolder($sendLogObject->destination->destination_ip_folder)->openLocalFile($file_path)->upload($file_name)->closeLocalFile()->getErrors();
                 if (!count($errors)) {
                     $sendLogObject->sent = 1;
                     $sendLogObject->save();
                 } else {
                     $sendLogObject->send_logs = serialize($errors);
                     $sendLogObject->save();
                 }
                 $this->logger->log(__METHOD__ . " ftp errors:" . print_r($errors, 1));
                 $this->logger->log(__METHOD__ . ' Deliver via ftp DONE.');
             } else {
                 if ($sendLogObject->destination->method === 'local_folder') {
                     $this->logger->log(__METHOD__, array('report_type' => $sendLogObject->report_processed->ex_schedule_report->report_type, 'method' => $sendLogObject->destination->method, 'destination_folder' => $sendLogObject->destination->destination_local_folder));
                     $destinationPath = $sendLogObject->report_processed->getFileDir() . DIRECTORY_SEPARATOR . $sendLogObject->destination->destination_local_folder;
                     $this->logger->log(__METHOD__ . ' $file_path: ' . $file_path);
                     $this->logger->log(__METHOD__ . ' $destinationPath: ' . $destinationPath);
                     $this->logger->log(__METHOD__ . ' $file_name: ' . $file_name);
                     $fileCopier = new FileCopier();
                     $errors = $fileCopier->copy($file_path, $destinationPath . DIRECTORY_SEPARATOR . $file_name)->getErrors();
                     if (!count($errors)) {
                         $sendLogObject->sent = 1;
                         $sendLogObject->save();
                     } else {
                         $sendLogObject->send_logs = serialize($errors);
                         $sendLogObject->save();
                     }
                     $this->logger->log(__METHOD__ . ' errors:' . print_r($errors, 1));
                     $this->logger->log(__METHOD__ . ' Deliver to local folder DONE.');
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
<?php

include "include/engine.inc.php";
include __DIR_PATH__ . "include/global.php";
$lib = new libraryClass();
$method = new methodController();
$mysql = new mysqlConnection();
$mailSender = new mailSender();
$validator = new validator();
$method->method_param("POST", "chk_agreement,chk_private,id,password,password02,nick,sex,phone,telephone");
$lib->security_filter("referer");
$lib->security_filter("request_get");
/*
검사
*/
if ($member['me_level'] < 10) {
    $validator->validt_diserror("", "이미 회원가입이 되어 있습니다.");
}
$validator->validt_checked("chk_agreement", "이용약관에 동의해야 합니다.");
$validator->validt_checked("chk_private", "개인정보취급방침에 동의해야 합니다.");
$validator->validt_email("id", 1, "");
$validator->validt_password("password", 1, "");
if ($password != $password02) {
    $validator->validt_diserror("password02", "");
}
$validator->validt_nick("nick", 1, "");
$validator->validt_phone("phone", 0, "");
$validator->validt_phone("telephone", 0, "");
$password_val = "password('{$password}')";
/*
이미 존재하는 아이디인지 검사
Exemplo n.º 3
0
 public function deliverReport()
 {
     $this->_logger->log(__METHOD__);
     if (count($this->data) == 0) {
         return false;
     }
     ini_set('memory_limit', '-1');
     $this->_logger->log(__METHOD__, array('ex_schedule_id' => $this->schedule_type_report->ex_schedule_id));
     $this->_logger->log(__METHOD__ . ' :' . print_r($this->schedule_type_report, 1));
     $destinations = ScheduleTypeReportDestination::getList($this->schedule_type_report->ex_schedule_id);
     $total = count($destinations);
     $this->_logger->log(__METHOD__, array('destination_count' => $total));
     //$this->_logger->log(__METHOD__ . ' :'. print_r($destinations,1));
     $file_path = $this->schedule_type_report_processed->full_file_name;
     //        $report_type = strtoupper($this->schedule_info->report_type);
     $file_name = $this->schedule_type_report_processed->check_period_start . '-' . $this->schedule_type_report_processed->check_period_end . '.' . $this->schedule_type_report->report_format;
     //$this->schedule_type_report->report_format;
     $report_type = $this->schedule_type_report->report_type;
     //$this->schedule_type_report_processed->file_content;
     if (count($destinations) > 0) {
         foreach ($destinations as $i => $destination) {
             if ($destination->method === 'mail') {
                 $this->_logger->log(__METHOD__, array('destination' => $i + 1, 'report_type' => $report_type, 'method' => $destination->method, 'email' => $destination->destination_email));
                 $mail_params = array('station_id_code' => $this->schedule_type_report->station_type, 'actuality_time' => $this->schedule_type_report->created, 'schedule_period' => Yii::app()->params['schedule_generation_period'][$this->schedule_type_report->period], 'report_file_name' => $file_name, 'link' => '', 'report_type' => $report_type);
                 $subject = Yii::t('letter', 'scheduled_report_mail_subject', $mail_params, null, 'en');
                 $settings = Settings::model()->findByPk(1);
                 $mailSender = new mailSender('odss_reports', $mail_params);
                 $sendResult = $mailSender->setAttachments(array(array('file_path' => $file_path, 'file_name' => $file_name)))->setRecipient($destination->destination_email)->setFrom($settings->mail__sender_address, $settings->mail__sender_name)->setSubject($subject)->setHtmlBody()->send();
                 $this->_logger->log(__METHOD__ . ' $sendResult: ' . $sendResult);
                 $this->_logger->log(__METHOD__ . ' Message send with attached file');
                 $this->_logger->log(__METHOD__ . ' Deliver via mail DONE.');
             } else {
                 if ($destination->method === 'ftp') {
                     // use it if you have some superstition about "../"
                     //                    $fileCopier = new FileCopier;
                     //                    $file_path = $fileCopier->rmPathSteps($file_path);
                     $ftpClient = new FtpClient();
                     $errors = $ftpClient->connect($destination->destination_ip, $destination->destination_ip_port)->login($destination->destination_ip_user, $destination->destination_ip_password)->setFolder($destination->destination_ip_folder)->openLocalFile($file_path)->upload($file_name)->closeLocalFile()->getErrors();
                     $this->_logger->log(__METHOD__ . " ftp errors:" . print_r($errors, 1));
                     $this->_logger->log(__METHOD__ . ' Deliver via ftp DONE.');
                 } else {
                     if ($destination->method === 'local_folder') {
                         $this->_logger->log(__METHOD__, array('destination' => $i + 1, 'report_type' => $report_type, 'method' => $destination->method, 'destination_folder' => $destination->destination_local_folder));
                         $destinationPath = $this->schedule_type_report_processed->getFileDir() . DIRECTORY_SEPARATOR . $destination->destination_local_folder;
                         $this->_logger->log(__METHOD__ . ' $file_path: ' . $file_path);
                         $this->_logger->log(__METHOD__ . ' $destinationPath: ' . $destinationPath);
                         $this->_logger->log(__METHOD__ . ' $file_name: ' . $file_name);
                         $fileCopier = new FileCopier();
                         $errors = $fileCopier->copy($file_path, $destinationPath . DIRECTORY_SEPARATOR . $file_name)->getErrors();
                         $this->_logger->log(__METHOD__ . print_r($errors, 1));
                         $this->_logger->log(__METHOD__ . ' Deliver to local folder DONE.');
                     }
                 }
             }
         }
     }
     $this->_logger->log(__METHOD__ . ' Delivery completed.');
 }
Exemplo n.º 4
0
if (isset($admin_email)) {
    $newemail = $admin_email;
} else {
    $newemail = $_POST['email'];
}
//Validation rules
if ($pw1 != $pw2) {
    echo '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Password fields must match</div><div id="returnVal" style="display:none;">false</div>';
} elseif (strlen($pw1) < 4) {
    echo '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Password must be at least 4 characters</div><div id="returnVal" style="display:none;">false</div>';
} elseif (!filter_var($newemail, FILTER_VALIDATE_EMAIL) == true) {
    echo '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Must provide a valid email address</div><div id="returnVal" style="display:none;">false</div>';
} else {
    if (isset($_POST['newuser']) && !empty(str_replace(' ', '', $_POST['newuser'])) && isset($_POST['password1']) && !empty(str_replace(' ', '', $_POST['password1']))) {
        //Tries inserting into database and add response to variable
        $a = new newUserForm();
        $response = $a->createUser($newuser, $newid, $newemail, $newpw);
        //Success
        if ($response == 'true') {
            echo '<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' . $signupthanks . '</div><div id="returnVal" style="display:none;">true</div>';
            //Send verification email
            $m = new mailSender();
            $m->sendMail($newemail, $newuser, $newid, 'Verify');
        } else {
            mySqlErrors($response);
        }
    } else {
        //Validation error from empty form variables
        echo 'An error occurred on the form... try again';
    }
}
Exemplo n.º 5
0
require 'scripts/class.loginscript.php';
include 'config.php';
// Pulls variables from url. Can pass 1 (verified) or 0 (unverified/blocked) into url
$uid = $_GET['uid'];
$verify = $_GET['v'];
$e = new selectEmail();
$eresult = $e->emailPull($uid);
$email = $eresult['email'];
$username = $eresult['username'];
$v = new verify();
if (isset($uid) && !empty(str_replace(' ', '', $uid)) && isset($verify) && !empty(str_replace(' ', '', $verify))) {
    //Updates the verify column on user
    $vresponse = $v->verifyUser($uid, $verify);
    //Success
    if ($vresponse == 'true') {
        echo $activemsg;
        //Send verification email
        $m = new mailSender();
        $m->sendMail($email, $username, $uid, 'Active');
    } else {
        //Echoes error from MySQL
        echo $vresponse;
    }
} else {
    //Validation error from empty form variables
    echo 'An error occurred... click <a href="index.php">here</a> to go back.';
}
?>
</body>
</html>