- var $hdecode = array('from','name','organization','subject');
- var $parse_hdr = array('content-disposition', 'content-transfer-encoding', 'content-type', 'date', 'followup-to', 'from',
- 'message-id', 'newsgroups', 'organization', 'references', 'subject', 'x-face');
- var $show_hdr = array('from', 'subject', 'newsgroups', 'followup', 'date', 'organization', 'references', 'x-face');
-
-
- var $tbefore = 5;
- var $tafter = 5;
- var $tmax = 50;
-
- var $wrap = 74;
-
- var $boundary = "bananaBoundary42";
- var $custom = "Content-Type: text/plain; charset=utf-8\nMime-Version: 1.0\nContent-Transfer-Encoding: 8bit\nUser-Agent: Banana @VERSION@\n";
- var $custom_mp = "Content-Type: multipart/mixed; boundary=\"bananaBoundary42\"\nContent-Transfer-Encoding: 7bit\nUser-Agent: Banana @VERSION@\n";
- var $custom_bd = "Content-Type: text/plain; charset=utf-8\nContent-Transfert-Encoding: 8bit";
-
- var $host = 'news://localhost:119/';
-
- var $profile = Array( 'name' => 'Anonymous <anonymouse@example.com>', 'sig' => '', 'org' => '',
- 'customhdr' =>'', 'display' => 0, 'lastnews' => 0, 'locale' => 'fr_FR', 'subscribe' => array());
-
- var $state = Array('group' => null, 'artid' => null);
- var $nntp;
- var $groups;
- var $newgroups;
- var $post;
- var $spool;
-
- function Banana()
- {
- $this->_require('NetNNTP');
- setlocale(LC_ALL, $this->profile['locale']);
- $this->nntp = new nntp($this->host);
- }
-
- function run($class = 'Banana')
+#######
+# Configuration variables
+#######
+
+### General ###
+ static public $profile = Array( 'signature' => '',
+ 'headers' => array('From' => 'Anonymous <anonymouse@example.com>'),
+ 'display' => 0,
+ 'lastnews' => 0,
+ 'locale' => 'fr_FR',
+ 'subscribe' => array(),
+ 'autoup' => 1);
+ static public $boxpattern;
+
+### Spool ###
+ static public $spool_max = 3000;
+ static public $spool_tbefore = 5;
+ static public $spool_tafter = 5;
+ static public $spool_tmax = 50;
+
+### Message processing ###
+ static public $msgparse_headers = array('content-disposition', 'content-transfer-encoding',
+ 'content-type', 'content-id', 'date', 'followup-to',
+ 'from', 'message-id', 'newsgroups', 'organization',
+ 'references', 'subject', 'x-face', 'in-reply-to',
+ 'to', 'cc', 'reply-to');
+
+### Message display ###
+ static public $msgshow_headers = array('from', 'newsgroups', 'followup-to', 'to', 'cc', 'reply-to',
+ 'organization', 'date', 'references', 'in-reply-to');
+ static public $msgshow_mimeparts = array('multipart/report', 'multipart/mixed', 'text/html', 'text/plain', 'text/enriched', 'text', 'message');
+ static public $msgshow_xface = true;
+ static public $msgshow_wrap = 78;
+
+ /** Match an url
+ * Should be included in a regexp delimited using /, !, , or @ (eg: "/$url_regexp/ui")
+ * If it matches, return 3 main parts :
+ * \\1 and \\3 are delimiters
+ * \\2 is the url
+ *
+ * eg : preg_match("!$url_regexp!i", "[http://www.polytechnique.org]", $matches);
+ * $matches[1] = "["
+ * $matches[2] = "http://www.polytechnique.org"
+ * $matches[3] = "]"
+ */
+ static public $msgshow_url = '(["\[])?((?:[a-z]+:\/\/|www\.)(?:[\.\,\;\!]*[a-z\@0-9~%$£µ&i#\-+=_\/\?]+)+)(["\]])?';
+
+### Message edition ###
+ static public $msgedit_canattach = true;
+ static public $msgedit_maxfilesize = 100000;
+ /** Global headers to use for messages
+ */
+ static public $msgedit_headers = array('Mime-Version' => '1.0', 'User-Agent' => 'Banana @VERSION@');
+ /** Mime type order for quoting
+ */
+ static public $msgedit_mimeparts = array('multipart/report', 'multipart/mixed', 'text/plain', 'text/enriched', 'text/html', 'text', 'message');
+
+### Protocole ###
+ /** News serveur to use
+ */
+ static public $nntp_host = 'news://localhost:119/';
+
+ static public $mbox_path = '/var/mail';
+
+### Debug ###
+ static public $debug_nntp = false;
+ static public $debug_smarty = false;
+
+
+#######
+# Constants
+#######
+
+ // Actions
+ const ACTION_BOX_NEEDED = 1; // mask
+ const ACTION_BOX_LIST = 2;
+ const ACTION_BOX_SUBS = 4;
+ const ACTION_MSG_LIST = 3;
+ const ACTION_MSG_READ = 5;
+ const ACTION_MSG_NEW = 9;
+ const ACTION_MSG_CANCEL = 17;
+
+ // Box list view
+ const BOXES_ALL = 0;
+ const BOXES_SUB = 1;
+ const BOXES_NEW = 2;
+
+ // Spool view mode
+ const SPOOL_ALL = 0;
+ const SPOOL_UNREAD = 1;
+
+
+#######
+# Runtime variables
+#######
+
+ static public $protocole = null;
+ static public $spool = null;
+ static public $message = null;
+ static public $page = null;
+
+ static public $group = null;
+ static public $artid = null;
+ static public $action = null;
+ static public $part = null;
+ static public $first = null;
+
+ /** Class parameters storage
+ */
+ public $params;
+
+
+#######
+# Banana Implementation
+#######
+
+ /** Build the instance of Banana
+ * This constructor only call \ref loadParams, connect to the server, and build the Smarty page
+ * @param protocole Protocole to use
+ */
+ public function __construct($params = null, $protocole = 'NNTP', $pageclass = 'BananaPage')