Example #1
0
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.min.js"></script>
</head>

<body>
<?php 
require_once './include/class.progressbar.php';
echo 'Starting&hellip;<br />';
$p = new ProgressBar();
echo '<div style="width: 300px;">';
$p->render();
echo '</div>';
for ($i = 0; $i < ($size = 100); $i++) {
    $p->setProgress($i * 100 / $size);
    usleep(1000000 * 0.1);
}
$p->setProgress(100);
echo 'Done.<br />';
?>


   

</body>

</html>
Example #2
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Expected integer, but got string for argument 1
  */
 public function testSizeMustBeAnInteger()
 {
     $this->progressBar->render('abc', array());
 }
Example #3
0
function sendMail()
{
    $checkbox_value = 0;
    $cfg = new ini_file();
    $cfg->setFileName('./include/config/account.ini');
    $cfg->load();
    $user_mail = $cfg->getElementValue('user', 'mail');
    $p = new ProgressBar();
    $mail = new PHPMailer();
    $mail->IsSMTP();
    //$mail->SMTPDebug= 2;
    //konfiguracja serwera
    $mail->PluginDir = "phpmailer/";
    $mail->Mailer = "smtp";
    $mail->Host = $cfg->getElementValue('server-config', 'Host');
    $mail->SMTPSecure = $cfg->getElementValue('server-config', 'SMTPSecure');
    $mail->Port = $cfg->getElementValue('server-config', 'Port');
    //
    $mail->SMTPKeepAlive = true;
    $mail->SMTPAuth = true;
    $mail->Username = $cfg->getElementValue('server-config', 'Login');
    $mail->Password = $cfg->getElementValue('server-config', 'Passwort');
    //koniec połączenia
    //baza danych
    $mydb = new Db();
    $qwery = "SELECT `id`, `email` FROM mail_data Where sended=" . $checkbox_value;
    $request = $mydb->getMysqli()->query($qwery);
    if ($request === false) {
        die('Nie można było odebrać danych do bazy' . ' z powodu blendu:' . $mydb->getMysqli()->error);
    }
    if ($request->num_rows == 0) {
        echo 'Brak danych w bazie';
        exit(1);
    }
    $i = 0;
    $size = $request->num_rows;
    $p->render();
    while ($row = $request->fetch_assoc()) {
        $id = $row['id'];
        $address = $row['email'];
        $token = md5(time());
        $mail->SetLanguage("pl", "phpmailer/language/");
        $mail->CharSet = "UTF-8";
        $mail->ContentType = "text/html";
        $mail->isHTML(true);
        $html = new HtmlParser("./mailform/form1 - Kopia.html");
        $mail->From = $user_mail;
        $mail->FromName = $cfg->getElementValue('user', 'FromName');
        $mail->Subject = "Tytuł wiadomości";
        $mail->msgHTML($html->getHtml());
        $mail->AddAddress($address);
        try {
            if ($mail->Send()) {
                $p->setProgress($i * 100 / $size);
            } else {
                throw new Exception("E-mail nie mógł zostać wysłany, przyczyna : {$mail->ErrorInfo}");
            }
        } catch (Exeption $e) {
            var_dump($e);
            exit;
        }
        $i++;
    }
    echo 'wysłano mail: ';
    $p->setProgress(100);
    //echo $html->getHtml();
    $mail->SmtpClose();
    //zamykamy połączeie
}