416 |
raphael |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* @author Raphaël Droz <raphael@tela-botanica.org>
|
|
|
4 |
* @copyright 2013, Tela-Botanica
|
|
|
5 |
* @license GPL v3
|
|
|
6 |
* @license CECILL v2
|
|
|
7 |
*/
|
|
|
8 |
|
|
|
9 |
// eg: php clical.php amorphophallus_et_araceae|html2text
|
|
|
10 |
if (PHP_SAPI !== 'cli') die;
|
|
|
11 |
|
|
|
12 |
// for standalone use
|
|
|
13 |
// WARNING: this uses cache !
|
|
|
14 |
// php-cli user could have != permission than a webserver
|
|
|
15 |
// then cache file created could become inaccessible to webserver
|
|
|
16 |
error_reporting(E_ALL ^ E_STRICT ^ E_NOTICE ^ E_DEPRECATED);
|
|
|
17 |
date_default_timezone_set('Europe/Paris');
|
|
|
18 |
|
|
|
19 |
$path = '/home/vpopmail/domains';
|
|
|
20 |
$domaine = 'tela-botanica.org';
|
|
|
21 |
|
421 |
raphael |
22 |
/*
|
|
|
23 |
List (ezmlm_threads::listmessages()), /calendrier_messages.php,
|
|
|
24 |
Recent (ezmlm_listinfo::show_recentmsgs()), /derniers_messages.php?domaine=&liste=
|
|
|
25 |
Month (ezmlm_listinfo::show_month(X)), /messages_mois.php?domaine=&liste=&actionargs[]=201306
|
|
|
26 |
month/Thread (ezmlm_listinfo::show_month(X)), /messages_thread.php?domaine=&liste=&actionargs[]=201306
|
|
|
27 |
XXX: Show (ezmlm_msgdisplay::display(X)), /message.php?domaine=&liste=&action=show_msg&actionargs[]=18&actionargs[]=09
|
416 |
raphael |
28 |
|
421 |
raphael |
29 |
-p: path
|
|
|
30 |
-d: domaine
|
|
|
31 |
|
|
|
32 |
*/
|
|
|
33 |
$options = getopt("LRMTp:d:");
|
|
|
34 |
if(isset($options['p'])) $path = $options['p'];
|
|
|
35 |
if(isset($options['d'])) $domaine = $options['d'];
|
|
|
36 |
$liste = array_slice($argv, -1)[0];
|
|
|
37 |
|
416 |
raphael |
38 |
if(!$liste || !$domaine || !$path) die;
|
|
|
39 |
|
|
|
40 |
include_once 'ezmlm-php-2.0/ezmlm.php' ;
|
|
|
41 |
|
|
|
42 |
// Parametrage de la liste
|
421 |
raphael |
43 |
if(array_key_exists('R', $options) || array_key_exists('M', $options)) {
|
|
|
44 |
$info = new ezmlm_listinfo();
|
|
|
45 |
} else { // cal & show threads
|
|
|
46 |
$info = new ezmlm_threads();
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
|
416 |
raphael |
50 |
if (!$info) die('Les fichiers de la liste ne sont pas visible sur le serveur');
|
|
|
51 |
|
|
|
52 |
$info->forcehref = $url;
|
|
|
53 |
$info->listdir = $path . '/' . $domaine . '/' . $liste ;
|
|
|
54 |
$info->listname = $liste;
|
|
|
55 |
$info->listdomain = $domaine ;
|
|
|
56 |
|
421 |
raphael |
57 |
if(array_key_exists('R', $options)) {
|
|
|
58 |
echo $info->show_recentmsgs();
|
|
|
59 |
}
|
|
|
60 |
elseif(array_key_exists('M', $options)) {
|
|
|
61 |
echo $info->show_month("201307");
|
|
|
62 |
}
|
|
|
63 |
elseif(array_key_exists('T', $options)) {
|
|
|
64 |
$info->tempdir = '/tmp' ; echo $info->load("201306");
|
|
|
65 |
}
|
|
|
66 |
else {
|
|
|
67 |
echo $info->listmessages(); // ezmlm_threads
|
|
|
68 |
}
|