PHPIndex

This page lists files in the current directory. You can view content, get download/execute commands for Wget, Curl, or PowerShell, or filter the list using wildcards (e.g., `*.sh`).

autosave.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/autosave.php'
View Content
<?php
if(file_exists("../config.php")){
    session_start();
    include("../../_loader.php");
    $token=(empty($_POST['token'])?"":$_POST['token']);
    if(!isset($token) || $token=="")$token=(empty($_GET['token']) ? "" : $_GET['token']);
    if(!tok_val($token)){
        header("Location:../../login.php?error=2");
    }
    $cnx->query("SET NAMES UTF8");
    $row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
    if(empty($row_config_globale['language']))$row_config_globale['language']="english";
    include("../lang/".$row_config_globale['language'].".php");
    $subject  = addslashes($_POST['subject']);
    $textarea = addslashes($_POST['message']);
    $list_id  = $_POST['list_id'];
    $type     = $_POST['format'];
    $sender_id= $_POST['sender_id'];
    $preheader= $_POST['preheader'];
    if($sender_id!='') {
        $sender_email = $sender_id;
    }else{
        $sender_email = $row_config_globale['admin_email'];
    }
    if($_SESSION['timezone']!=''){
        date_default_timezone_set($_SESSION['timezone']);
    }elseif(file_exists('include/config.php')) {
        date_default_timezone_set('Europe/Paris');
    }
    $x = $cnx->query("SELECT * 
                          FROM ".$row_config_globale['table_sauvegarde']." 
                      WHERE list_id='".($cnx->CleanInput($list_id))."'")->fetchAll();
    if(count($x)==0){
        if($cnx->query("INSERT INTO ".$row_config_globale['table_sauvegarde']."
                            (list_id,subject,textarea,type,sender_email,preheader) 
                        VALUES ('".($cnx->CleanInput($list_id))."',
                                '".($cnx->CleanInput($subject))."',
                                '".($cnx->CleanInput($textarea, true, false, false))."',
                                '".($cnx->CleanInput($type))."',
                                '".($cnx->CleanInput($sender_email))."',
                                '".($cnx->CleanInput($preheader))."')")){
            echo '<h6 class="alert alert-success">'.tr('SAVED_MESSAGE_AT').date('H:i:s').'</h6>';
        } else {
            echo '<h6 class=alert alert-danger>'.tr('UNSAVED_MESSAGE').'</h6>';
        }
    } elseif (count($x)==1){
        if($cnx->query("UPDATE ".$row_config_globale['table_sauvegarde']." 
            SET textarea = '".($cnx->CleanInput($textarea, true, false, false))."',
                  subject='".($cnx->CleanInput($subject))."',
                  type='".($cnx->CleanInput($type))."',
                  sender_email='".($cnx->CleanInput($sender_email))."',
                  preheader='".($cnx->CleanInput($preheader))."'
                WHERE list_id='".($cnx->CleanInput($list_id))."'")){
            echo '<h6 class="alert alert-success">'.tr('SAVED_MESSAGE_AT').date('H:i:s').'</h6>';
        } else {
            echo '<h6 class="alert alert-danger">'.tr('UNSAVED_MESSAGE').'</h6>';
        }
    }  elseif (count($x)>1){
        $cnx->query("DELETE FROM ".$row_config_globale['table_sauvegarde']." WHERE list_id='$list_id'");
        if($cnx->query("INSERT INTO ".$row_config_globale['table_sauvegarde']."
                            (list_id,subject,textarea,type,sender_email,preheader) 
                        VALUES ('".($cnx->CleanInput($list_id))."','".($cnx->CleanInput($subject))."',
                                '".($cnx->CleanInput($textarea, true, false, false))."',
                                '".($cnx->CleanInput($type))."',
                                '".($cnx->CleanInput($sender_email))."',
                                '".($cnx->CleanInput($preheader))."')")){
            echo '<h6 class="alert alert-success">'.tr('SAVED_MESSAGE_AT').date('H:i:s').'</h6>';
        } else {
            echo '<h6 class="alert alert-danger">'.tr('UNSAVED_MESSAGE').'</h6>';
        }
    }
}
backup_db.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/backup_db.php'
View Content
<?php
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json'); 
if(!file_exists("../config.php")) {
	header("Location:../../install.php");
	exit;
} else {
	session_start();
	include("../../_loader.php");
	if(isset($_POST['token'])){$token=$_POST['token'];}else{$token='';}
	if(!tok_val($token)){
		header("Location:../../login.php?error=2");
		die();
	}
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0)?$r='SUCCESS':$r='';
if($r != 'SUCCESS') {
	include("../lang/english.php");
	echo "<div class='error'>".tr($r)."<br>";
	echo "</div>";
	die();
}
if(empty($row_config_globale['language']))$row_config_globale['language']="english";
include("../lang/".$row_config_globale['language'].".php");
$backup_dir = "../backup_db";
if(!is_dir($backup_dir)){
	if(mkdir("$backup_dir",0755)){
		// continue
	} else {
		$arr=array(
			'status'=>'error',
			'successmsg'=>'erreur de création du répertoire de sauvegarde include/backup_db.<br>'. tr("CHECK_PERMISSIONS_OR_CREATE") . ' "include/backup_db" ' . tr("MANUALLY")
		);
		echo json_encode($arr, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
		die();
	}
}
require('../lib/class.bkpmnl.php');
new BackupMySQL(array(
	'host'		=> $hostname,
	'username'	=> $login,
	'passwd'	=> $pass,
	'dbname'	=> $database,
	'dossier'	=> $backup_dir.'/',
	'prefixe'	=> $prefix,
	'token'		=> $token,
	'racine'	=> '',
	'nbr_fichiers'	=> $nb_backup
));
bounce.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/bounce.php'
View Content
<?php
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json'); 
if(!file_exists("../config.php")) {
    header("Location:../../install.php");
    exit;
} else {
    session_start();
    include("../../_loader.php");
    if(isset($_POST['token'])){$token=$_POST['token'];}elseif(isset($_GET['token'])){$token=$_GET['token'];}else{$token='';}
    if(!tok_val($token)){
        header("Location:../../login.php?error=2");
        die();
    }
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0)?$r='SUCCESS':$r='';
if($r != 'SUCCESS') {
    include("../lang/english.php");
    echo "<div class='error'>".tr($r)."<br>";
    echo "</div>";
    die();
}
if(empty($row_config_globale['language']))$row_config_globale['language']="english";
include("../lang/".$row_config_globale['language'].".php");
$list_id = (!empty($_POST['list_id'])) ? intval($_POST['list_id']) : '';
$list_id = (!empty($_GET['list_id']) && empty($list_id)) ? intval($_GET['list_id']) : intval($list_id);
$campaign_id = $cnx->SqlRow("SELECT MAX(id_mail) AS id_mail FROM ".$row_config_globale['table_send']." WHERE id_list=$list_id");
if(file_exists("../config_bounce.php")){
    include('../config_bounce.php');
    include('../lib/class.cws.mbh.php');
    $cwsMailBounceHandler = new CwsMailBounceHandler();
    $cwsMailBounceHandler->test_mode            = ($type_env=='prod' ? false : true);                               // false : mode prod, true : mode dev et debug
    $cwsMailBounceHandler->debug_verbose        = ($type_env=='prod' ? CWSMBH_VERBOSE_QUIET : CWSMBH_VERBOSE_DEBUG);// default CWSMBH_VERBOSE_QUIET (silenceux) mode VERBOSE : CWSMBH_VERBOSE_DEBUG
    $cwsMailBounceHandler->open_mode            = CWSMBH_OPEN_MODE_IMAP;                                            // ouverture générique du bounce
    switch($row_config_globale['sending_method']){
        case 'smtp_gmail':
            $cwsMailBounceHandler->disable_delete       = true;                                                     //pour supprimer un mail chez Google il faut faire un move dans Trash...
            $cwsMailBounceHandler->move_hard            = true;
            $cwsMailBounceHandler->folder_hard          = 'INBOX.Trash';
            $cwsMailBounceHandler->host                 = 'imap.gmail.com';                                         // Mail host pop|imap server ; default 'localhost'
            $cwsMailBounceHandler->username             = $row_config_globale['smtp_login'];                        // Mailbox username
            $cwsMailBounceHandler->password             = $row_config_globale['smtp_pass'];                         // Mailbox password
            $cwsMailBounceHandler->port                 = 993;                                                      // the port to access your mailbox ; default 143, other common choices are 110 (pop3), 995 (gmail)
            $cwsMailBounceHandler->service              = 'imap';                                                   // the service to use (imap or pop3) ; default 'imap'
            $cwsMailBounceHandler->service_option       = 'ssl';                                                    // the service options (none, tls, notls, ssl) ; default 'notls'
            $cwsMailBounceHandler->boxname              = 'bounce';
            break;
        default:
            $cwsMailBounceHandler->disable_delete       = ($type_env=='prod' ? false : true);                       // on supprime les messages en erreur du serveur:false, on supprime rien : true. !!! Si test_mode=true alors disable_delete=true
            $cwsMailBounceHandler->host                 = (trim($bounce_host)=='' ? 'localhost' : $bounce_host);    // Mail host pop|imap server ; default 'localhost'
            $cwsMailBounceHandler->username             = $bounce_user;                                             // Mailbox username
            $cwsMailBounceHandler->password             = $bounce_pass;                                             // Mailbox password
            $cwsMailBounceHandler->port                 = $bounce_port;                                             // the port to access your mailbox ; default 143, other common choices are 110 (pop3), 995 (gmail)
            $cwsMailBounceHandler->service              = $bounce_service;                                          // the service to use (imap or pop3) ; default 'imap'
            $cwsMailBounceHandler->service_option       = $bounce_option;                                           // the service options (none, tls, notls, ssl) ; default 'notls'
        break;
    }
    $cwsMailBounceHandler->cert                 = CWSMBH_CERT_NOVALIDATE;                                           // certificates validation (CWSMBH_CERT_VALIDATE or CWSMBH_CERT_NOVALIDATE) if service_option is 'tls' or 'ssl' ;
    if ($cwsMailBounceHandler->openImapRemote()) {
        $result = $cwsMailBounceHandler->processMails();
    }
    echo tr("BOUNCE_TOTAL_MAILS").    ' : '.$result['counter']['total'].'<br>'
        .tr("BOUNCE_FETCHED").        ' : '.$result['counter']['fetched'].'<br>'
        .tr("BOUNCE_PROCESSED").      ' : '.$result['counter']['processed'].'<br>'
        .tr("BOUNCE_UNPROCESSED").    ' : '.$result['counter']['unprocessed'].'<br>'
        .tr("BOUNCE_COUNTER_DELETED").' : '.$result['counter']['deleted'].'<br>'
        .tr("BOUNCE_COUNTER_MOVED").  ' : '.$result['counter']['moved'];
    if(count($result)>0){
        foreach($result['msgs'] as $item){
            $expl = @$cwsMailBounceHandler->findStatusExplanationsByCode($item['recipients'][0]['status']);
            if($item['processed']&&$item['recipients'][0]['action']=='failed'&&$type_env=='prod'){
                UpdateEmailError($cnx , $row_config_globale['table_email'] , $item['recipients'][0]['list_id'] , 
                                 $item['recipients'][0]['email'] , $item['recipients'][0]['status'] ,
                                 $item['recipients'][0]['bounce_type'] , $item['recipients'][0]['bounce_cat'] ,
                                 $expl['third_subcode']['title'] , $expl['third_subcode']['desc'] , 
                                 $item['recipients'][0]['id_mail'] , $row_config_globale['table_email_deleted'] , 
                                 $row_config_globale['table_send'] , $item['recipients'][0]['hash']);
                                 
            }elseif($item['recipients'][0]['action']=='failed'&&$type_env=='dev'){
                echo "###\n###table_email=".$row_config_globale['table_email']."###\n###list_id=".
                    $item['recipients'][0]['list_id']."###\n###email=".
                    $item['recipients'][0]['email']."###\n###status=".
                    $item['recipients'][0]['status'] ."###\n###bounce_type=".
                    $item['recipients'][0]['bounce_type']."###\n###bounce_cat=".
                    $item['recipients'][0]['bounce_cat'] ."###\n###title=".
                    $expl['third_subcode']['title']."###\n###desc=".
                    $expl['third_subcode']['desc']."###\n###id_mail=".
                    $item['recipients'][0]['id_mail']."###\n###table_email_deleted=".
                    $row_config_globale['table_email_deleted']."###\n###table_send=".
                    $row_config_globale['table_send']."###\n###hash=".
                    $item['recipients'][0]['hash']."\n";
            }
        }
    }
} else {
    echo '<h4 class="alert_error">'.tr("BOUNCE_NOT_CONFIGURED").'</h4>';
}

del_mails.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/del_mails.php'
View Content
<?php
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: text/plain'); 
if(!file_exists("../config.php")) {
	header("Location:../../install.php");
	exit;
} else {
	include("../../_loader.php");
	$token=(empty($_POST['token'])?"":$_POST['token']);
	if(!isset($token) || $token=="")$token=(empty($_GET['token']) ? "" : $_GET['token']);
	if(!tok_val($token)){
		header("Location:../../login.php?error=2");
		exit;
	}
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0) ? $r='SUCCESS' : $r='';
if($r != 'SUCCESS') {
	include("../lang/english.php");
	echo "<div class='error'>".tr($r)."<br>";
	echo "</div>";
	exit;
}
if(empty($row_config_globale['language'])){
	$row_config_globale['language']="english";
}else{
	include("../lang/".$row_config_globale['language'].".php");
}
$q = (empty($_POST['search']) ? "" : $_POST['search']);
$list_id = (empty($_POST['list_id']) ? "" : $_POST['list_id']);
if(!empty($q)&&!empty($list_id)){
	$cpt_to_delete=$cnx->query("SELECT email
			FROM ".$row_config_globale['table_email']." 
				WHERE email=".escape_string($cnx,$q)." 
					AND list_id='".(int)$list_id."'")->fetchAll();
	if (count($cpt_to_delete)>0) {
		$deleted = delete_subscriber($cnx,$row_config_globale['table_email'],$list_id,$q,$row_config_globale['table_email_deleted'],'by_admin');
		if($deleted){
			echo "<h4 class='alert alert-success'>".tr("SUBSCRIBER_DELETED","<i>$q</i>")."</h4>";
		} else {
			echo "<h4 class='alert alert-danger'>".tr("ERROR_DELETING_SUBSCRIBER","<i>$q</i>")."</h4>";
		}
	} else {
		echo '<h4 class="alert alert-danger">'.tr("SUBSCRIPTION_UNKNOWN_EMAIL_ADDRESS").'</h4>';
	}
}




mailqueue.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/mailqueue.php'
View Content
<?php
session_start();
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: text/plain'); 
if(!file_exists("../config.php")) {
    header("Location:../../install.php");
    exit;
} else {
    include("../../_loader.php");
    $token=(empty($_SESSION['_token'])?"":$_SESSION['_token']);
    if(!isset($token) || $token=="")$token=(empty($_GET['token'])?"":$_GET['token']);
    if(!tok_val($token)){
        header("Location:../../login.php?error=2");
        exit;
    }
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0)?$r='SUCCESS':$r='';
if($r != 'SUCCESS') {
    include("../lang/english.php");
    echo "<div class='error'>".tr($r)."<br>";
    echo "</div>";
    exit;
}
if($exec_available){
    if(empty($row_config_globale['language']))$row_config_globale['language']="english";
    include("../lang/".$row_config_globale['language'].".php");
    $results = array();
    $current_object = null;
    $old_locale = getlocale(LC_ALL);
    setlocale(LC_ALL, 'C');
    $mailq_path = 'mailq';
    $current_object = array();
    $pipe = popen($mailq_path, 'r');
    while($pipe) {
        $line = fgets($pipe);
        if(trim($line)=='Mail queue is empty'){
            echo '<button type="button" class="btn btn-primary btn-sm">'.tr("NO_MAIL_IN_PROCESS").'</button>';
            pclose($pipe);
            setlocale(LC_ALL, $old_locale);
            exit(1);
        } else {
            if ($line === false)break;
            if (strncmp($line, '-', 1) === 0)continue;
            $line = trim($line);
            $res = preg_match('/(\w+)\*{0,1}\s+(\d+)\s+(\w+\s+\w+\s+\d+\s+\d+:\d+:\d+)\s+([^ ]+)/', $line, $matches);
            if ($res) {
                $current_object[] = array(
	            'id' => $matches[1],
	            'size' => intval($matches[2]),
	            'date' => strftime($matches[3]),
	            'sender' => $matches[4],
	            'failed' => false,
	            'recipients' => ''
                );
            }
        }
    }
    pclose($pipe);
    setlocale(LC_ALL, $old_locale);
    $mails_en_cours = count($current_object);
    if($mails_en_cours>0){
        echo '<a href="?page=manager_mailq&token='.$token.'" title="'.tr("PENDING_MAILS_MANAGEMENT").'" class="clearbtn btn btn-warning btn-sm">'.$mails_en_cours.' '.tr("PENDING_MAILS").'</a>';
    } else {
        echo '<button type="button" class="btn btn-primary btn-sm">'.tr("NO_MAIL_IN_PROCESS").'</button>';
    }
}


manager_mails.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/manager_mails.php'
View Content
<?php
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: text/plain'); 
if(!file_exists("../config.php")) {
    header("Location:../../install.php");
    exit;
} else {
    include("../../_loader.php");
    $token=(empty($_POST['token'])?"":$_POST['token']);
    if(!isset($token) || $token=="")$token=(empty($_GET['token']) ? "" : $_GET['token']);
    if(!tok_val($token)){
        header("Location:../../login.php?error=2");
        exit;
    }
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0) ? $r='SUCCESS' : $r='';
if($r != 'SUCCESS') {
    include("../lang/english.php");
    echo "<div class='error'>".tr($r)."<br>";
    echo "</div>";
    exit;
}
if(empty($row_config_globale['language']))$row_config_globale['language']="english";
include("../lang/".$row_config_globale['language'].".php");
$actions_possibles=array('update','delete','restore');
if(isset($_POST['action'])&&in_array($_POST['action'],$actions_possibles)) {
    $action=$_POST['action'];
} else {
    header("Location:../../login.php?error=2");
    exit;
}
$continue=true;
isset($_POST['hash'])?$hash=escape_string($cnx,$_POST['hash']):$continue=false;
isset($_POST['list_id'])?$list_id=escape_string($cnx,$_POST['list_id']):$continue=false;
isset($_POST['this_mail'])?$email=escape_string($cnx,$_POST['this_mail']):$continue=false;
if ($continue) {
    switch($action){
        case 'delete':
            $cpt_to_delete=$cnx->query("SELECT email
                                    FROM ".$row_config_globale['table_email']." 
                                        WHERE email=$email 
                                            AND list_id=$list_id AND hash=$hash")->fetchAll();
            if (count($cpt_to_delete)>0) {
	            if($cnx->query("INSERT INTO ".$row_config_globale['table_email_deleted']."
	                                SELECT *
	                                    FROM ".$row_config_globale['table_email']." 
	                                        WHERE email=$email 
	                                            AND list_id=$list_id AND hash=$hash")) {
	                $cnx->query("UPDATE ".$row_config_globale['table_email']." SET error='N', type='' WHERE email=$email AND list_id=$list_id");
	                $cnx->query("DELETE FROM ".$row_config_globale['table_email']." WHERE email=$email AND list_id=$list_id AND hash=$hash");
	                echo '<h4 class="alert_success">'.tr("MAIL_DELETED", htmlentities($_POST['this_mail'])).'</h4>';
	            } else {
	                echo '<h4 class="alert_error">'.tr("MAIL_ERROR_TO_DELETE", htmlentities($_POST['this_mail'])).'</h4>';
	            }
            } else {
                echo '<h4 class="alert_error">'.tr("SUBSCRIPTION_UNKNOWN_EMAIL_ADDRESS").'</h4>';
            }
        break;
        case 'update':
            if($cnx->query("INSERT INTO ".$row_config_globale['table_email']." (email,list_id,hash)
                                SELECT $email,list_id,hash
                                    FROM ".$row_config_globale['table_email_deleted']." 
                                        WHERE list_id=$list_id 
                                            AND hash=$hash")) {
	            if($cnx->query("DELETE FROM ".$row_config_globale['table_email_deleted']." WHERE list_id=$list_id AND hash=$hash")){
	                echo '<h4 class="alert_success">'.tr("MAIL_CORRECTED", htmlentities($_POST['this_mail'])).'</h4>';
	            } else {
	                echo '<h4 class="alert_error">'.tr("MAIL_ERROR_TO_CORRECT", htmlentities($_POST['this_mail'])).'</h4>.';
	            }
            }
        break;
        case 'restore':
            if($cnx->query("INSERT INTO ".$row_config_globale['table_email']." (email,list_id,hash)
                                SELECT email,list_id,hash
                                    FROM ".$row_config_globale['table_email_deleted']." 
                                        WHERE email=$email 
                                            AND list_id=$list_id 
                                            AND hash=$hash")) {
                if($cnx->query("DELETE FROM ".$row_config_globale['table_email_deleted']." WHERE email=$email AND list_id=$list_id AND hash=$hash")){
                    echo '<h4 class="alert_success">'.tr("MAIL_RESTORED", htmlentities($_POST['this_mail'])).'</h4>';
                } else {
                    echo '<h4 class="alert_error">'.tr("MAIL_ERROR_TO_RESTORE", htmlentities($_POST['this_mail'])).'</h4>.';
                }
            }
        break;
        default:
            echo '<h4 class="alert_error">Oups !</h4>';
        break;
    }
}













manager_pj.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/manager_pj.php'
View Content
<?php
session_start();
if(!file_exists("../config.php")) {
    header("Location:../../install.php");
    exit;
} else {
    include("../../_loader.php");
    $token=(empty($_POST['token'])?"":$_POST['token']);
    if(!isset($token) || $token=="")$token=(empty($_GET['token'])?"":$_GET['token']);
    if(!tok_val($token)){
        header("Location:../../login.php?error=2");
        exit;
    }
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0)?$r='SUCCESS':$r='';
if($r != 'SUCCESS') {
    include("../lang/english.php");
    echo "<div class='error'>".tr($r)."<br>";
    echo "</div>";
    exit;
}
if(empty($row_config_globale['language']))$row_config_globale['language']="english";
include("../lang/".$row_config_globale['language'].".php");
$actions_possibles=array('delete');
if(isset($_POST['action'])&&in_array($_POST['action'],$actions_possibles)) {
    $action=$_POST['action'];
} else {
    header("Location:../../login.php?error=2");
    exit;
}
$continue=true;
isset($_POST['list_id'])?$list_id=escape_string($cnx,$_POST['list_id']):$continue=false;
isset($_POST['id'])?$id=escape_string($cnx,$_POST['id']):$continue=false;
if ($continue) {
    switch($action){
        case 'delete':
            $name_pj = $cnx->query("SELECT name FROM ".$row_config_globale['table_upload']." WHERE id=$id AND list_id=$list_id AND msg_id=0")->fetch(PDO::FETCH_ASSOC);
            unlink('../../upload/'.$name_pj['name']);
            if($cnx->query("DELETE FROM ".$row_config_globale['table_upload']." WHERE id=$id AND list_id=$list_id AND msg_id=0 AND name='".$name_pj['name']."'")){
                echo tr("PJ_DELETED");
            } else {
                echo tr("PJ_ERROR_DELETE");
            }
        break;
        default:
            echo '<h4 class="alert_error">Oups !/h4>';
        break;
    }
}
pjq.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/pjq.php'
View Content
<?php
if(!file_exists("../config.php")) {
    header("Location:../../install.php");
    exit;
} else {
    include("../../_loader.php");
    $token=(empty($_POST['token'])?"":$_POST['token']);
    if(!isset($token) || $token=="")$token=(empty($_GET['token'])?"":$_GET['token']);
    if(!tok_val($token)){
        header("Location:../../login.php?error=2");
        exit;
    }
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0)?$r='SUCCESS':$r='';
if($r != 'SUCCESS') {
    include("../lang/english.php");
    echo "<div class='error'>".tr($r)."<br>";
    echo "</div>";
    exit;
}
if(empty($row_config_globale['language']))$row_config_globale['language']="english";
include("../lang/".$row_config_globale['language'].".php");
$list_id  = (!empty($_POST['list_id'])) ? $_POST['list_id'] : '';
$list_pj = $cnx->query("SELECT * FROM ".$row_config_globale['table_upload']." 
    WHERE list_id=$list_id 
        AND msg_id=0 
    ORDER BY id ASC")->fetchAll(PDO::FETCH_ASSOC);
if(count($list_pj)==0)echo '<h5>'.tr("NO_ATTACHMENTS").'.</h5>';
foreach  ($list_pj as $item) {
    echo '<div id="'.$item['id'].'" style="margin-bottom:5px;"><span class="actionPj glyphicon glyphicon-trash pointer" /></span> 
        <span data-toggle="tooltip" data-original-title="'.$item['name'].'">';
    if(strlen($item['name'])>30){
        echo mb_strimwidth($item['name'], 0, 30,'...') ;
    } else {
        echo $item['name'] ;
    }
    echo '</span></div>';
}
?>
<script>
$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip({
        placement : 'top'
    });
});
$(".actionPj").click(function(){
    var hideItem='#'+$(this).closest("div").attr('id');
    $.ajax({type: "POST",
        url: "include/ajax/manager_pj.php",
        data: "token=<?php echo $token;?>&list_id=<?php echo $list_id;?>&id="+$(this).closest("div").attr('id')+"&action=delete",
        success: function(data){
            $(hideItem).html(data).addClass('success').hide('slow');
        }
    });
});
</script>
pmnl_backup_dl.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/pmnl_backup_dl.php'
View Content
<?php
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json'); 
if(!file_exists("../config.php")) {
	header("Location:../../install.php");
	exit;
} else {
	session_start();
	include("../../_loader.php");
	if(isset($_GET['token'])){$token=$_GET['token'];}else{$token='';}
	if(!tok_val($token)){
		header("Location:../../login.php?error=2");
		die();
	}
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0)?$r='SUCCESS':$r='';
if($r != 'SUCCESS') {
	include("../lang/english.php");
	echo "<div class='error'>".tr($r)."<br>";
	echo "</div>";
	die();
}
if(empty($row_config_globale['language']))$row_config_globale['language']="english";
include("../lang/".$row_config_globale['language'].".php");
$backup_dir = "../backup_db";
if (strpos($_GET['t'], "\0") !== false) {
	die('');
} else {
	$backup = basename($_GET['t']);
}
define('ALLOWED_REFERRER', $row_config_globale['base_url']);
if (ALLOWED_REFERRER !== '' && (!isset($_SERVER['HTTP_REFERER']) || strpos(strtoupper($_SERVER['HTTP_REFERER']), strtoupper(ALLOWED_REFERRER)) === false)) {
    die("Internal server error. Please contact system administrator.");
}
$PmnlBackUpToDownload = $backup_dir.'/'. $backup ;
$fsize = filesize($PmnlBackUpToDownload);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$backup\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $fsize);
$file = @fopen($PmnlBackUpToDownload, "rb");
if ($file) {
    while (!feof($file)) {
        print(fread($file, 1024*8));
        flush();
        if (connection_status()!=0) {
            @fclose($file);
            die();
        }
    }
    @fclose($file);
}
save.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/save.php'
View Content
<?php
if(file_exists("../config.php")){
    session_start();
    include("../../_loader.php");
    $token=(empty($_POST['token'])?"":$_POST['token']);
    if(!isset($token) || $token=="")$token=(empty($_GET['token']) ? "" : $_GET['token']);
    if(!tok_val($token)){
        header("Location:../../login.php?error=2");
    }
    $row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
    $subject  = addslashes($_POST['subject']);
    $textarea = addslashes($_POST['html']);
    $list_id  = $_POST['list_id'];
    $draft    = addslashes(trim(preg_replace('/<!--(.|\s)*?-->/','',$_POST['draft'])));
    if($_SESSION['timezone']!=''){
        date_default_timezone_set($_SESSION['timezone']);
    }elseif(file_exists('include/config.php')) {
        date_default_timezone_set('Europe/Paris');
    }
    $x = $cnx->query("SELECT * FROM ".$row_config_globale['table_sauvegarde']." 
        WHERE list_id='".($cnx->CleanInput($list_id))."'")->fetchAll();
    if(count($x)==0){
        if($cnx->query("INSERT INTO ".$row_config_globale['table_sauvegarde']."
                            (list_id,textarea,draft) 
                        VALUES ('".($cnx->CleanInput($list_id))."',
                                '".($cnx->CleanInput($textarea, true, false, false))."',
                                '".($cnx->CleanInput($draft, true, false, false))."')")){
        }
    } elseif (count($x)==1){
        if($cnx->query("UPDATE ".$row_config_globale['table_sauvegarde']." 
            SET textarea = '".($cnx->CleanInput($textarea, true, false, false))."',
                draft    = '".($cnx->CleanInput($draft, true, false, false))."' 
                WHERE list_id='".($cnx->CleanInput($list_id))."'")){
        }
    }  elseif (count($x)>1){
        $cnx->query("DELETE FROM ".$row_config_globale['table_sauvegarde']." WHERE list_id='$list_id'");
        if($cnx->query("INSERT INTO ".$row_config_globale['table_sauvegarde']."
                            (list_id,textarea,draft) 
                        VALUES ('".($cnx->CleanInput($list_id))."',
                                '".($cnx->CleanInput($textarea, true, false, false))."',
                                '".($cnx->CleanInput($draft, true, false, false))."')")){
        }
    }
}
search.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/search.php'
View Content
<?php
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: text/plain'); 
if(!file_exists("../config.php")) {
	header("Location:../../install.php");
	exit;
} else {
	include("../../_loader.php");
	$token=(empty($_POST['token'])?"":$_POST['token']);
	if(!isset($token) || $token=="")$token=(empty($_GET['token'])?"":$_GET['token']);
	if(!tok_val($token)){
		header("Location:../../login.php?error=2");
		exit;
	}
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0)?$r='SUCCESS':$r='';
if($r != 'SUCCESS') {
	include("../lang/english.php");
	echo "<div class='error'>".tr($r)."<br>";
	echo "</div>";
	exit;
}
!empty($_POST['search']) ? $q=$_POST['search'] : $q='';
!empty($_POST['list_id']) ? $list_id=$_POST['list_id'] : $list_id='';
if(!empty($q) && !empty($list_id)){
	$tabMails = $cnx->query("SELECT email 
			FROM ".$row_config_globale['table_email'] ."
				WHERE email like '%$q%' 
					AND LIST_ID='$list_id' LIMIT 0,5")->fetchAll(PDO::FETCH_ASSOC);
	if(count($tabMails)>0){
		foreach($tabMails as $row){
			$q_strong = '<strong>'.$q.'</strong>';
			$show_mail = str_ireplace($q, $q_strong, $row['email']);
			echo "<div class='row'><div align='left' class='show col-md-5'>".$show_mail."</div></div>";
		}    
	}
}
test_dns.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/test_dns.php'
View Content
<?php
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: text/plain'); 
if(!file_exists("../config.php")) {
	header("Location:../../install.php");
	exit;
} else {
	include("../../_loader.php");
	$token=(empty($_POST['token'])?"":$_POST['token']);
	if(!isset($token) || $token=="")$token=(empty($_GET['token'])?"":$_GET['token']);
	if(!tok_val($token)){
		header("Location:../../login.php?error=2");
		exit;
	}
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0)?$r='SUCCESS':$r='';
if($r != 'SUCCESS') {
	include("../lang/english.php");
	echo "<div class='error'>".tr($r)."<br>";
	echo "</div>";
	exit;
}
if(empty($row_config_globale['language']))$row_config_globale['language']="english";
include("../lang/".$row_config_globale['language'].".php");
$alertes = 0;
$hostToCheck = substr(strrchr($row_config_globale['admin_email'], "@"), 1);
$key_dkim=$_POST['key_dkim'];
$rs_dmarc = dns_get_record("_dmarc.$hostToCheck", DNS_TXT);
if(empty($rs_dmarc)){
	echo '<div class="alert alert-danger"><div><i class="glyphicon glyphicon-remove" style="color:red;"></i> Pas d\'enregistrement DMARC trouvé.</div></div>';
	$alertes++;
}else{
	echo '<div class="alert alert-success"><div><i class="glyphicon glyphicon-ok" style="color:green;"></i> Enregistrement DMARC OK</div>';
	echo '<b>Sélecteur</b> : <i>'.$rs_dmarc[0]['host'].'</i><br>';
	echo '<b>Durée</b> : <i>'.$rs_dmarc[0]['ttl'].'</i><br>';
	echo '<b>Type</b> : <i>'.$rs_dmarc[0]['type'].'</i><br>';
	echo '<span style="width:736px; word-wrap:break-word; display:inline-block;"><b>Enregistrement</b> : <i>'.$rs_dmarc[0]['entries'][0].'</span></i></div>';
}
if(!empty($key_dkim)) {
	$rs_dkim = dns_get_record("$key_dkim._domainkey.$hostToCheck", DNS_TXT);
	if(empty($rs_dkim)){
		echo '<div class="alert alert-danger"><div><i class="glyphicon glyphicon-remove" style="color:red;"></i> Pas d\'enregistrement DKIM trouvé avec ce sélecteur pour : <i>'.$key_dkim.'._domainkey.'.$hostToCheck.'</i></div></div>';
		$alertes++;
	}else{
		echo '<div class="alert alert-success"><div><i class="glyphicon glyphicon-ok" style="color:green;"></i> Enregistrement DKIM OK</div>';
		echo '<b>Sélecteur</b> : <i>'.$rs_dkim[0]['host'].'</i><br>';
		echo '<b>Durée</b> : <i>'.$rs_dkim[0]['ttl'].'</i><br>';
		echo '<b>Type</b> : <i>'.$rs_dkim[0]['type'].'</i><br>';
		echo '<span style="width:736px; word-wrap:break-word; display:inline-block;"><b>Enregistrement</b> : <i>'.$rs_dkim[0]['entries'][0].'</span></i></div>';
	}
} else {
	echo '<div class="alert alert-danger"><div><i class="glyphicon glyphicon-remove" style="color:red;"></i> Sélecteur DKIM non renseigné</div></div>';
	$alertes++;
}
$rs_spf = dns_get_record($hostToCheck, DNS_TXT);
if(empty($rs_spf)){
	echo '<div class="alert alert-danger"><div><i class="glyphicon glyphicon-remove" style="color:red;"></i> Pas d\'enregistrement SPF trouvé.</div></div>';
	$alertes++;
}else{
	echo '<div class="alert alert-success"><div><i class="glyphicon glyphicon-ok" style="color:green;"></i> Enregistrement SPF OK</div>';
	echo '<b>Sélecteur</b> : <i>'.$rs_spf[0]['host'].'</i><br>';
	echo '<b>Durée</b> : <i>'.$rs_spf[0]['ttl'].'</i><br>';
	echo '<b>Type</b> : <i>'.$rs_spf[0]['type'].'</i><br>';
	echo '<span style="width:736px; word-wrap:break-word; display:inline-block;"><b>Enregistrement</b> : <i>'.$rs_spf[0]['entries'][0].'</span></i></div>';
}
switch($alertes){
	case '0':
		echo '<div class="alert alert-success"><div><i class="glyphicon glyphicon-ok" style="color:green;"></i> 
		Pas d\'anomalie ! Bravo !<br>
		Vous avez mis toutes les chances de votre coté, vous devriez pouvoir envoyer vos campagnes sans trop de soucis.<br>
		(Attention : ce test ne prédit en rien la qualité de vos campagnes et ne vérifie pas si la ou les IPs du serveur sont blacklistées ou non !)</div>';
	break;
	case '1':
		echo '<div class="alert alert-warning"><div>
		Une anomalie a été détectée.<br>Vous devriez mettre à jour vos enregistrements DNS assez rapidement.<br>
		Mettez toutes les chances de votre coté !<br>
		<b>NB : Si vous venez de mettre à jour vos enregistrements, ceux-ci peuvent être en cours de propagation, il conviendra de renouveler le test dans 24 heures !</b><br>
		(Attention : ce test ne prédit en rien la qualité de vos campagnes et ne vérifie pas si la ou les IPs du serveur sont blacklistées ou non !)</div>';
	break;
	case '2':
		echo '<div class="alert alert-warning"><div>
		Deux anomalies ont été détectées.<br>Il devient impératif de mettre à jour les enregistrements signalés comme défaillants !<br>
		Il y a de fortes chances que vous soyiez classé comme spammeur avec cette configuration.<br>
		Mettez toutes les chances de votre coté !<br>
		<b>NB : Si vous venez de mettre à jour vos enregistrements, ceux-ci peuvent être en cours de propagation, il conviendra de renouveler le test dans 24 heures !</b><br>
		(Attention : ce test ne prédit en rien la qualité de vos campagnes et ne vérifie pas si la ou les IPs du serveur sont blacklistées ou non !)</div>';
	break;
	case '3':
		echo '<div class="alert alert-danger"><div>
		<b>STOP ! Ne faites rien partir !</b><br>
		Trois anomalies ont été détectées.<br>Il devient impératif de mettre à jour les enregistrements signalés comme défaillants !<br>
		En l\'état, si vous faites partir une campagne, les taux d\'ouverture seront catastrophiques et votre IP sera blacklistée !<br>
		Ne faites rien sans avoir corrigé ces 3 anomalies !<br>
		<b>NB : Si vous venez de mettre à jour vos enregistrements, ceux-ci peuvent être en cours de propagation, il conviendra de renouveler le test dans 24 heures !</b><br>
		(Attention : ce test ne prédit en rien la qualité de vos campagnes et ne vérifie pas si la ou les IPs du serveur sont blacklistées ou non !)</div>';
	break;
}










test_imap.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/test_imap.php'
View Content
<?php
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: text/plain'); 
if(!file_exists("../config.php")) {
    header("Location:../../install.php");
    exit;
} else {
    include("../../_loader.php");
    $token=(empty($_POST['token'])?"":$_POST['token']);
    if(!isset($token) || $token=="")$token=(empty($_GET['token'])?"":$_GET['token']);
    if(!tok_val($token)){
        header("Location:../../login.php?error=2");
        exit;
    }
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0)?$r='SUCCESS':$r='';
if($r != 'SUCCESS') {
    include("../lang/english.php");
    echo "<div class='error'>".tr($r)."<br>";
    echo "</div>";
    exit;
}
if(empty($row_config_globale['language']))$row_config_globale['language']="english";
include("../lang/".$row_config_globale['language'].".php");
$bounce_host=$_POST['bounce_host'];
$bounce_user=$_POST['bounce_user'];
$bounce_pass=$_POST['bounce_pass'];
$bounce_port=$_POST['bounce_port'];
$bounce_service='/'.$_POST['bounce_service'];
$mail_folder='';
$_POST['bounce_option'] !=''    ? $bounce_option='/'.$_POST['bounce_option'] : '';
$_POST['bounce_service']=='pop3'? $mail_folder='INBOX' : '';
$_POST['bounce_service']=='imap'? $option=OP_READONLY   : '';
if(!imap_open("{".$bounce_host.":".$bounce_port.$bounce_service.$bounce_option."}".$mail_folder,$bounce_user,$bounce_pass,$option,1)){
    echo '<span style="color:red;font-weight:bold">'.tr("IMAP_DOWN").' : {'.$bounce_host.':'.$bounce_port.$bounce_service.$bounce_option.'}'
        .$mail_folder.','.$bounce_user.',********* : '.imap_last_error().'</span>';
}else{
    echo '<span style="color:green;font-weight:bold">'.tr("IMAP_OK").' : {'.$bounce_host.':'.$bounce_port.$bounce_service.$bounce_option.'}'
        .$mail_folder.','.$bounce_user.',*********</span>';
}












upload.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/upload.php'
View Content
<?php
session_start();
header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: text/plain'); 
if(!file_exists("../config.php")) {
    header("Location:../../install.php");
    exit;
} else {
    include("../../_loader.php");
    $token=(empty($_SESSION['_token'])?"":$_SESSION['_token']);
    if(!isset($token) || $token=="")$token=(empty($_GET['token'])?"":$_GET['token']);
    if(!tok_val($token)){
        header("Location:../../login.php?error=2");
        exit;
    }
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
(count($row_config_globale)>0)?$r='SUCCESS':$r='';
if($r != 'SUCCESS') {
    include("../lang/english.php");
    echo "<div class='error'>".tr($r)."<br>";
    echo "</div>";
    exit;
}
if (isset($_FILES['ImageFile']) && $_FILES['ImageFile']['error'] == UPLOAD_ERR_OK) {
    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    $mime = finfo_file($finfo, $_FILES['ImageFile']['tmp_name']);
    finfo_close($finfo);
    $array = array('image/gif', 'image/jpeg', 'image/png');
    if(in_array($mime, $array)) {
        $filename = '../../images/' . preg_replace("/ {1,}/", "-",$_FILES['ImageFile']['name']);
        $PATH = ($row_config_globale['path'] == '/' ? $row_config_globale['path'] : '/' . $row_config_globale['path']);
        $full_url = $row_config_globale['base_url'].$PATH.'images/' . preg_replace("/ {1,}/", "-",$_FILES['ImageFile']['name']);
        if(!is_uploaded_file($_FILES['ImageFile']['tmp_name']) or !copy($_FILES['ImageFile']['tmp_name'], $filename)) {
            echo "Could not save file as $filename!";
            exit();
        } else {
            echo $full_url;
        }
    }
}
veriflinks.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/ajax/veriflinks.php'
View Content
<?php
if(file_exists("../config.php")){
	session_start();
	include("../../_loader.php");
	$token=(empty($_POST['token'])?"":$_POST['token']);
	if(!isset($token) || $token=="")$token=(empty($_GET['token']) ? "" : $_GET['token']);
	if(!tok_val($token)){
		header("Location:../../login.php?error=2");
	}
	$cnx->query("SET NAMES UTF8");
	$row_config_globale = $cnx->SqlRow("SELECT * FROM $table_global_config");
	$list_id  = $_POST['list_id'];
	$nl = getConfig($cnx, $list_id, $row_config_globale['table_sauvegarde']);
	$textarea = $nl['textarea'];
	$pattern = '#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#';
	$txError = 0;
	$txSucces = 0;
	$error = '';
	$redir = '';
	if($num_found = preg_match_all($pattern, $textarea, $out)){
		foreach ($out[0] as $url) {
			$curl = curl_init();
			if (preg_replace("/^[\w]{2,6}:\/\/([\w\d\.\-]+).*$/", "$1", $url)!='www.w3.org') {
				curl_setopt($curl, CURLOPT_URL, $url);
				curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
				curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
				curl_setopt($curl, CURLOPT_CONNECTTIMEOUT ,2);
				curl_setopt($curl, CURLOPT_TIMEOUT, 3);
				$result = curl_exec($curl);
				if ($result === false) {
					$error .= $url."<br>";
					$txError++;
				} else {
					$newUrl = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
					if ($newUrl !== $url) {
						$redir .= $url . ' redirigée sur : ' . $newUrl .'<br>';
					} else {
						$txSucces++;
					}
				}
			} else {
				$txSucces++;
			}
		}
		curl_close($curl);
		echo "<h4>$num_found liens testés.</h4><br>";
		if($txError>1) {
			echo "<span style='color:red;font-weight:bold'>$txError erreurs :<br>";
			echo $error;
			echo "</span>";
		} elseif($txError==1) {
			echo "<span style='color:red;font-weight:bold'>1 erreur :<br>";
			echo $error;
			echo "</span>";
		}
		if($txSucces==$num_found) {
			echo "<span style='color:green;font-weight:bold'>$txSucces Liens OK</span>";
		} 
	}    
}