$banana is the only global variable !
[banana.git] / include / banana.inc.php.in
CommitLineData
2dbc0167 1<?php
2/********************************************************************************
3* install.d/config.inc.php : configuration file
4* --------------------------
5*
6* This file is part of the banana distribution
7* Copyright: See COPYING files that comes with this distribution
8********************************************************************************/
9
2dbc0167 10require_once("include/misc.inc.php");
11require_once("include/groups.inc.php");
12require_once("include/format.inc.php");
13require_once("include/error.inc.php");
2dbc0167 14
15class Banana
16{
17 var $maxspool = 3000;
18
19 var $hdecode = array('from','name','organization','subject');
20 var $parse_hdr = array('content-transfer-encoding', 'content-type', 'date', 'followup-to', 'from',
21 'message-id', 'newsgroups', 'organization', 'references', 'subject', 'x-face');
22 var $show_hdr = array('from', 'subject', 'newsgroups', 'followup', 'date', 'organization', 'references', 'x-face');
23
24
25 var $tbefore = 5;
26 var $tafter = 5;
27 var $tmax = 50;
28
29 var $wrap = 74;
30
31 var $custom = "Content-Type: text/plain; charset=iso-8859-15\nMime-Version: 1.0\nContent-Transfer-Encoding: 8bit\nUser-Agent: Banana @VERSION@\n";
32
33 var $host = 'news://localhost:119/';
34
35 var $profile = Array( 'name' => 'Anonymous <anonymouse@example.com', 'sig' => '', 'org' => '',
36 'customhdr' =>'', 'display' => 0, 'lastnews' => 0, 'lang' => 'fr', 'subscribe' => array());
37
38 var $nntp;
39 var $spool;
b9ea5b30 40 var $post;
2dbc0167 41
42 function Banana()
43 {
44 if (function_exists('hook_banana')) {
45 hook_banana($this);
46 }
47 $this->_setupProfile();
48 require_once('include/NetNNTP.inc.php');
49 $this->nntp = new nntp($this->host);
50 }
51
52 function newSpool($group, $disp=0, $since='') {
53 require_once('include/spool.inc.php');
54 $this->spool = new BananaSpool($group, $disp, $since);
55 if (!$this->spool) { error('nntpspool'); }
56 }
57
b9ea5b30 58 function newPost($id)
59 {
60 require_once("include/post.inc.php");
61 $this->post = new BananaPost($id);
62 }
63
2dbc0167 64 function _setupProfile()
65 {
66 if (function_exists('hook_getprofile')) {
67 $this->profile = hook_getprofile();
68 } else {
69 session_start();
70 }
71
72 setlocale(LC_ALL, $this->profile['locale']);
73 }
74}
75
76$banana = new Banana;
77
58d1740e 78switch (basename($_SERVER['SCRIPT_NAME'])) {
79 case "thread.php":
80 if (!isset($_SESSION['bananapostok'])) {
81 $_SESSION['bananapostok']=true;
82 }
83 break;
84
85 default:
86 $_SESSION['bananapostok']=true;
87 break;
88}
89
2dbc0167 90if (empty($css)) {
91$css = array(
92 'bananashortcuts' => 'bananashortcuts',
93 'bicol' => 'bicol',
94 'bicoltitre' => 'bicoltitre',
95 'bicolvpadd' => 'bicolvpadd',
96 'pair' => 'pair',
97 'impair' => 'impair',
98 'bouton' => 'bouton',
99 'error' => 'error',
100 'normal' => 'normal',
101 'total' => 'total',
102 'unread' => 'unread',
103 'group' => 'group',
104 'description' => 'description',
105 'date' => 'date',
106 'subject' => 'subject',
107 'from' => 'from',
108 'author' => 'author',
109 'nopadd' => 'nopadd',
110 'overview' => 'overview',
111 'tree' => 'tree'
112 );
113}
114?>