Exemple #1
0
function send_mail($to, $subj, $msg)
{
    global $CONF, $CONF_MAIL, $dbConnection;
    if (get_conf_param('mail_type') == "sendmail") {
        $mail = new PHPMailer();
        $mail->CharSet = 'UTF-8';
        $mail->IsSendmail();
        $mail->AddReplyTo($CONF_MAIL['from'], $CONF['name_of_firm']);
        $mail->AddAddress($to, $to);
        $mail->SetFrom($CONF_MAIL['from'], $CONF['name_of_firm']);
        $mail->Subject = $subj;
        $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
        $mail->MsgHTML($msg);
        $mail->Send();
    } else {
        if (get_conf_param('mail_type') == "SMTP") {
            $mail = new PHPMailer();
            $mail->CharSet = 'UTF-8';
            $mail->IsSMTP();
            $mail->SMTPAuth = $CONF_MAIL['auth'];
            // enable SMTP authentication
            if (get_conf_param('mail_auth_type') != "none") {
                $mail->SMTPSecure = $CONF_MAIL['auth_type'];
            }
            $mail->Host = $CONF_MAIL['host'];
            $mail->Port = $CONF_MAIL['port'];
            $mail->Username = $CONF_MAIL['username'];
            $mail->Password = $CONF_MAIL['password'];
            $mail->AddReplyTo($CONF_MAIL['from'], $CONF['name_of_firm']);
            $mail->AddAddress($to, $to);
            $mail->SetFrom($CONF_MAIL['from'], $CONF['name_of_firm']);
            $mail->Subject = $subj;
            $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
            // optional - MsgHTML will create an alternate automatically
            $mail->MsgHTML($msg);
            $mail->Send();
        }
    }
}
Exemple #2
0
        ?>
">
    </div>
  </div>
  
      <div class="form-group">
    <label for="password" class="col-sm-4 control-label"><small><?php 
        echo lang('CONF_mail_pass');
        ?>
</small></label>
    <div class="col-sm-8">
      <input type="password" class="form-control input-sm" id="password" placeholder="<?php 
        echo lang('CONF_mail_pass');
        ?>
" value="<?php 
        echo get_conf_param('mail_password');
        ?>
">
    </div>
  </div>
  
  </div>
  

    <div class="col-md-offset-3 col-md-6">
<center>
    <button type="submit" id="conf_edit_mail" class="btn btn-success"><i class="fa fa-pencil"></i> <?php 
        echo lang('CONF_act_edit');
        ?>
</button>
Exemple #3
0
     } catch (Exception $e) {
         echo $e->getMessage();
         //Boring error messages from anything else!
     }
 } else {
     if (get_conf_param('mail_type') == "SMTP") {
         $mail = new PHPMailer(true);
         // the true param means it will throw exceptions on errors, which we need to catch
         $mail->IsSMTP();
         // telling the class to use SMTP
         try {
             $mail->SMTPDebug = 2;
             // enables SMTP debug information (for testing)
             $mail->SMTPAuth = $CONF_MAIL['auth'];
             // enable SMTP authentication
             if (get_conf_param('mail_auth_type') != "none") {
                 $mail->SMTPSecure = $CONF_MAIL['auth_type'];
             }
             $mail->Host = $CONF_MAIL['host'];
             $mail->Port = $CONF_MAIL['port'];
             $mail->Username = $CONF_MAIL['username'];
             $mail->Password = $CONF_MAIL['password'];
             $mail->AddReplyTo($CONF_MAIL['from'], $CONF['name_of_firm']);
             $mail->AddAddress($CONF['mail'], 'admin helpdesk');
             $mail->SetFrom($CONF_MAIL['from'], $CONF['name_of_firm']);
             $mail->Subject = 'test message via smtp';
             $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
             // optional - MsgHTML will create an alternate automatically
             $mail->MsgHTML("test message");
             $mail->Send();
             echo "Message Sent OK<p></p>\n";
Exemple #4
0
<?php

include_once 'conf.php';
include_once 'sys/class.phpmailer.php';
include_once 'sys/Parsedown.php';
require 'library/HTMLPurifier.auto.php';
date_default_timezone_set('Europe/Kiev');
$dbConnection = new PDO('mysql:host=' . $CONF_DB['host'] . ';dbname=' . $CONF_DB['db_name'], $CONF_DB['username'], $CONF_DB['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$CONF = array('title_header' => get_conf_param('title_header'), 'hostname' => get_conf_param('hostname'), 'mail' => get_conf_param('mail'), 'days2arch' => get_conf_param('days2arch'), 'name_of_firm' => get_conf_param('name_of_firm'), 'fix_subj' => get_conf_param('fix_subj'), 'first_login' => get_conf_param('first_login'), 'file_uploads' => get_conf_param('file_uploads'), 'file_types' => '(' . get_conf_param('file_types') . ')', 'file_size' => get_conf_param('file_size'));
$CONF_MAIL = array('active' => get_conf_param('mail_active'), 'host' => get_conf_param('mail_host'), 'port' => get_conf_param('mail_port'), 'auth' => get_conf_param('mail_auth'), 'auth_type' => get_conf_param('mail_auth_type'), 'username' => get_conf_param('mail_username'), 'password' => get_conf_param('mail_password'), 'from' => get_conf_param('mail_from'), 'debug' => 'false');
if ($CONF_HD['debug_mode'] == false) {
    error_reporting(E_ALL ^ E_NOTICE);
    error_reporting(0);
}
include_once 'inc/mail.inc.php';
$forhostname = substr($CONF['hostname'], -1);
if ($forhostname == "/") {
    $CONF['hostname'] = $CONF['hostname'];
} else {
    if ($forhostname != "/") {
        $CONF['hostname'] = $CONF['hostname'] . "/";
    }
}
function get_user_lang()
{
    global $dbConnection;
    $mid = $_SESSION['helpdesk_user_id'];
    $stmt = $dbConnection->prepare('SELECT lang from users where id=:mid');
    $stmt->execute(array(':mid' => $mid));
Exemple #5
0
{
    $time = time() - $time;
    return floor($time / 86400);
}
$dbConnection = new PDO('mysql:host=' . $CONF_DB['host'] . ';dbname=' . $CONF_DB['db_name'], $CONF_DB['username'], $CONF_DB['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
function get_conf_param($in)
{
    global $dbConnection;
    $stmt = $dbConnection->prepare('SELECT value FROM perf where param=:in');
    $stmt->execute(array(':in' => $in));
    $con = $stmt->fetch(PDO::FETCH_ASSOC);
    return $con['value'];
}
$CONF = array('days2arch' => get_conf_param('days2arch'));
/*   
5 0 * * * /usr/bin/php5 -f /var/www/hd_prod/sys/4cron.php > /var/www/hd_prod/4cron.log 2>&1
*/
$stmt = $dbConnection->prepare('SELECT id, ok_by, ok_date,date_create
							from tickets
							where arch=:n1 and ok_by !=:n2');
$stmt->execute(array(':n1' => '0', ':n2' => '0'));
$res1 = $stmt->fetchAll();
foreach ($res1 as $row) {
    $m = $row['id'];
    $td = humanTiming_old(strtotime($row['ok_date'])) . "<br>";
    if ($td > $CONF['days2arch']) {
        $stmt = $dbConnection->prepare('update tickets set arch=:n1, last_update=now() where id=:m');
        $stmt->execute(array(':n1' => '1', ':m' => $m));
        $stmt = $dbConnection->prepare('INSERT INTO ticket_log (msg, date_op, ticket_id)