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`).

_actions.php
wget 'https://lists2.roe3.org/pmnl3/include/php/_actions.php'
View Content
<?php
if($action=='purge_mailq'&&$page=='manager_mailq'&&$exec_available){
    $path_postsuper=exec('locate postsuper | grep bin');
    if(trim($path_postsuper)!=''&&substr($path_postsuper,0,1)=='/'){
        $newsletter = getConfig($cnx, $list_id, $row_config_globale['table_listsconfig']);
        $sender = $newsletter['from_addr'];
        $old_locale = getlocale(LC_ALL);
        setlocale(LC_ALL, 'C');
        $mailq_path = exec('command -v mailq');
        $current_object = array();
        $pipe = popen($mailq_path, 'r');
        while($pipe) {
            $line = fgets($pipe);
            if(trim($line)=='Mail queue is empty'){
                echo "<h4 class='alert_success'><b>".tr("NO_MAIL_IN_PROCESS")."</b></h4>";
                $do_purge = false;
                pclose($pipe);
                setlocale(LC_ALL, $old_locale);
                exit(1);
            } else {
                $do_purge = true;
                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) {
                    if($matches[4]==$sender){
                        $tab_failed    = trim(fgets($pipe));
                        $tab_recipient = trim(fgets($pipe));
                        $current_object[] = array(
                                'id' => $matches[1],
                                'size' => intval($matches[2]),
                                'date' => strftime($matches[3]),
                                'sender' => $matches[4],
                                'failed' => $tab_failed,
                                'recipients' => $tab_recipient
                        );
                    }
                }
            }
        }
        pclose($pipe);
        setlocale(LC_ALL, $old_locale);
        if($do_purge){
            $mails_en_cours = count($current_object);
            if($mails_en_cours>0){
                foreach($current_object as $item){
                    if(trim($item['recipients'])!=''){
                        $cnx->query("INSERT INTO ".$row_config_globale['table_email_deleted']." (id,email,list_id,hash,error,status,type)
                            SELECT id,email,list_id,hash,'Y','".($cnx->CleanInput($item['failed']))."','hard'
                                FROM ".$row_config_globale['table_email']."
                                    WHERE email = '".($cnx->CleanInput($item['recipients']))."'");
                        $cnx->query("DELETE FROM ".$row_config_globale['table_email']." WHERE email='".($cnx->CleanInput($item['recipients']))."'");
                        exec('sudo '.$path_postsuper.' -d '.$item['id']);
                    }
                }
            }
        }
    } else {
        $alerte_purge_mailq = "<h4 class='alert_error'>".tr("ROOT_TO_FLUSH_MAIL_QUEUE")."</h4>";
    }
}
if($action=='delete_id_from_mailq'&&$page=='manager_mailq'&&!empty($id_mailq)&&$exec_available){
    $path_postsuper=exec('locate postsuper | grep bin');
    if(trim($path_postsuper)!=''&&substr($path_postsuper,0,1)=='/'){
        $result = exec('sudo '.$path_postsuper.' -d '.$id_mailq);
        $cnx->query("INSERT INTO ".$row_config_globale['table_email_deleted']." (id,email,list_id,hash,error,status,type)
                        SELECT id,email,list_id,hash,'Y','".($cnx->CleanInput(urldecode($_GET['status'])))."','hard'
                            FROM ".$row_config_globale['table_email']."
                                WHERE email = '".($cnx->CleanInput(urldecode($_GET['mail'])))."'");
        $cnx->query("DELETE FROM ".$row_config_globale['table_email']." WHERE email='".($cnx->CleanInput(urldecode($_GET['mail'])))."'");
    } else {
        $alerte_purge_mailq = "<h4 class='alert_error'>".tr("ROOT_TO_FLUSH_MAIL_QUEUE")."</h4>";
    }
}
if($action=='flush_and_force_mailq'&&$page=='manager_mailq'&&!empty($id_mailq)&&$exec_available){
    $path_postsuper=exec('locate postsuper | grep bin');
    if(trim($path_postsuper)!=''&&substr($path_postsuper,0,1)=='/'){
        $result = exec('sudo '.$path_postsuper.' -i '.$id_mailq);
    } else {
        $alerte_purge_mailq = "<h4 class='alert_error'>".tr("ROOT_TO_FLUSH_MAIL_QUEUE")."</h4>";
    }
}
if($page=='listes'){
    switch($action){
        case 'stopsend':
            var_dump($_GET);
            if (file_exists("logs/__SEND_PROCESS__" . $_GET['list_id'] . ".pid" )){
                if (unlink("logs/__SEND_PROCESS__" . $_GET['list_id'] . ".pid" )) {   
                    echo "success";
                } else {
                    echo "fail";    
                }   
            } else {
                echo "file does not exist";
            }
            die();
        break;
        case 'delete':
            $deleted=deleteNewsletter($cnx,$row_config_globale['table_listsconfig'],$row_config_globale['table_archives'],
                                   $row_config_globale['table_email'],$row_config_globale['table_temp'],
                                   $row_config_globale['table_send'],$row_config_globale['table_tracking'],
                                   $row_config_globale['table_sauvegarde'],$list_id);
            $cnx->query('DELETE FROM '.$row_config_globale['table_email_deleted'].' WHERE list_id='.$list_id.'');
        break;
        case 'duplicate':
            $newsletter_modele = getConfig($cnx, $list_id, $row_config_globale['table_listsconfig']);
            $new_id=createNewsletter($cnx,$row_config_globale['table_listsconfig'],tr("NEWSLETTER_NEW_LETTER"),$newsletter_modele['from_addr'],
                                  $newsletter_modele['from_name'],$newsletter_modele['subject'],$newsletter_modele['header'],$newsletter_modele['footer'],
                                  $newsletter_modele['subscription_subject'],$newsletter_modele['subscription_body'],$newsletter_modele['welcome_subject'],
                                  $newsletter_modele['welcome_body'],$newsletter_modele['quit_subject'],$newsletter_modele['quit_body'],$newsletter_modele['preview_addr']);
            $subscribers=get_subscribers($cnx,$row_config_globale['table_email'],$list_id);
            foreach ($subscribers as $row) {
                $add_r=add_subscriber($cnx,$row_config_globale['table_email'],$new_id,$row['email'],$row_config_globale['table_email_deleted']);
            }
            $list_id=$new_id;
        break;
        case 'mix':
            if(!empty($_POST['mix_list_id'])&&is_array($_POST['mix_list_id'])){
                $list_id_to_duplicate = $_POST['mix_list_id'][0];
                $newsletter_modele = getConfig($cnx, $list_id_to_duplicate, $row_config_globale['table_listsconfig']);
                $new_id=createNewsletter($cnx,$row_config_globale['table_listsconfig'],tr("NEWSLETTER_NEW_LETTER"),$newsletter_modele['from_addr'],
                                      $newsletter_modele['from_name'],$newsletter_modele['subject'],$newsletter_modele['header'],$newsletter_modele['footer'],
                                      $newsletter_modele['subscription_subject'],$newsletter_modele['subscription_body'],$newsletter_modele['welcome_subject'],
                                      $newsletter_modele['welcome_body'],$newsletter_modele['quit_subject'],$newsletter_modele['quit_body'],$newsletter_modele['preview_addr']);
                foreach($_POST['mix_list_id'] as $id_to_load){
                    $subscribers=get_subscribers($cnx,$row_config_globale['table_email'],$id_to_load);
                    foreach ($subscribers as $row) {
                        $add_r=add_subscriber($cnx,$row_config_globale['table_email'],$new_id,$row['email'],$row_config_globale['table_email_deleted']);
                    }
                }
                $list_id=$new_id;
            }
        break;
        case 'empty':
            $cnx->query('DELETE FROM '.$row_config_globale['table_email'].' WHERE list_id='.$list_id.'');
        break;
        default:
        break;
    }
}
_vars.php
wget 'https://lists2.roe3.org/pmnl3/include/php/_vars.php'
View Content
<?php
$op            = (empty($_GET['op'])?"":$_GET['op']);
$op            = (empty($_POST['op'])?$op:$_POST['op']);
$list_id       = (empty($_GET['list_id'])?"":$_GET['list_id']);
$list_id       = (empty($_POST['list_id'])?$list_id:$_POST['list_id']);
$action        = (empty($_GET['action'])?"":$_GET['action']);
$action        = (empty($_POST['action'])?$action:$_POST['action']);
$page          = (empty($_GET['page'])?"listes":$_GET['page']);
$page          = (empty($_POST['page'])?$page:$_POST['page']);
$data          = (empty($_GET['data'])?"ch":$_GET['data']);
$id_mailq      = (empty($_GET['id_mailq'])?"":$_GET['id_mailq']);
$l             = (empty($_GET['l'])?"l":$_GET['l']);
$t             = (empty($_GET['t'])?"":$_GET['t']);
$tm            = (empty($_GET['tm'])?"":$_GET['tm']);
$t             = (empty($_POST['t'])?$t:$_POST['t']);
$startprofils  = (empty($_GET['st'])?1:$_GET['st']);
$startprofils  = (empty($_POST['st'])?$startprofils:$_POST['st']);
$limiteprofils = (empty($_GET['li'])?30:$_GET['li']);
$limiteprofils = (empty($_POST['li'])?$limiteprofils:$_POST['li']);
$error_list    = false;
$subscriber_op_msg = '';
$smtp_manage_msg   = '';
$smtp_id       = (empty($_GET['smtp_id'])?'':$_GET['smtp_id']);
$smtp_id       = (empty($_POST['smtp_id'])?$smtp_id:$_POST['smtp_id']);
$ta            = (!empty($_GET['ta'])&&$_GET['ta']=='all'?'all':(int)$list_id);
$array_profils_item = array(15,30,50,100,500,-1);
$itemp         = (int)(!empty($_GET['itemp'])&&in_array($_GET['itemp'], $array_profils_item)?$_GET['itemp']:30);
$array_sort_item = array('alpha','clics','cmpo');
$sort          = (!empty($_GET['sort'])&&in_array($_GET['sort'], $array_sort_item)?$_GET['sort']:'alpha');
$viewms        = (empty($_GET['viewms'])?"list":$_GET['viewms']);
$viewms        = (empty($_POST['viewms'])?$viewms:$_POST['viewms']);
$account       = (empty($_GET['account'])?"":$_GET['account']);
$account       = (empty($_POST['account'])?$account:$_POST['account']);