spool_root = "/var/spool/banana"
mbox_helper = "/usr/bin/banana-mbox-helper"
+event_forum = ""
+event_reply = ""
+
[Geoloc]
webservice_url = ""
class ForumsBanana extends Banana
{
- function __construct($params = null)
+ private $forlife;
+
+ public function __construct($forlife, $params = null)
{
+ $this->forlife = $forlife;
+
global $globals;
Banana::$msgedit_canattach = false;
Banana::$spool_root = $globals->banana->spool_root;
array_push(Banana::$msgparse_headers, 'x-org-id', 'x-org-mail');
- Banana::$nntp_host = 'news://web_'.S::v('forlife')
+ Banana::$nntp_host = 'news://web_'.$forlife
. ":{$globals->banana->password}@{$globals->banana->server}:{$globals->banana->port}/";
if (S::has_perms()) {
Banana::$msgshow_mimeparts[] = 'source';
return parent::run();
}
+ public function post($dest, $reply, $subject, $body)
+ {
+ global $globals;
+ $res = XDB::query('SELECT nom, prenom, promo, b.alias AS bestalias
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS a ON (a.id = u.user_id)
+ INNER JOIN aliases AS b ON (b.id = a.id AND FIND_IN_SET(\'bestalias\', b.flags))
+ WHERE a.alias = {?}', $this->forlife);
+ list($nom, $prenom, $promo, $bestalias) = $res->fetchOneRow();
+ Banana::$profile['headers']['From'] = "$prenom $nom ($promo) <$bestalias@{$globals->mail->domain}>";
+ Banana::$profile['headers']['Organization'] = 'Utilisateur de Polytechnique.org';
+ return parent::post($dest, $reply, $subject, $body);
+ }
+
protected function action_saveSubs($groups)
{
global $globals;
function run_banana(&$page, $class, array $args)
{
- $banana = new $class($args);
+ $banana = new $class(S::v('forlife'), $args);
$page->assign('banana', $banana->run());
$page->addCssInline($banana->css());
$page->addCssLink('banana.css');
static public $listname;
static public $domain;
- function __construct($params = null)
+ function __construct($forlife, $params = null)
{
global $globals;
Banana::$spool_root = $globals->banana->spool_root;
static public $domain;
static public $client;
- function __construct($params = null)
+ function __construct($forlife, $params = null)
{
global $globals;
ModerationBanana::$client = $params['client'];
peremption={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide')",
$this->uid, $this->titre, $this->texte,
$this->peremption, $this->pmin, $this->pmax)) {
+ $eid = XDB::insertId();
if ($this->img) {
XDB::execute("INSERT INTO evenements_photo
SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}",
XDB::insertId(), $this->imgtype, $this->imgx, $this->imgy, $this->img);
}
+ global $globals;
+ if ($globals->banana->event_forum) {
+ require_once 'user.func.inc.php';
+ $forlife = get_user_forlife($this->uid);
+ require_once 'banana/forum.inc.php';
+ $banana = new ForumsBanana($forlife);
+ $post = $banana->post($globals->banana->event_forum,
+ $globals->banana->event_reply,
+ $this->titre, pl_entity_decode(strip_tags($this->texte)));
+ if ($post != -1) {
+ XDB::execute("UPDATE evenements
+ SET creation_date = creation_date, post_id = {?}
+ WHERE id = {?}", $post, $eid);
+ }
+ }
return true;
}
return false;
$_SESSION = array_merge($row, $_SESSION);
require_once 'banana/forum.inc.php';
- $banana = new ForumsBanana(array('group' => $group, 'action' => 'rss2'));
+ $banana = new ForumsBanana(S::v('forlife'), array('group' => $group, 'action' => 'rss2'));
$banana->run();
exit;
}
if (!$sum->total()) {
return false;
}
- $sql = "SELECT e.id,e.titre,e.texte,a.user_id,a.nom,a.prenom,a.promo,l.alias AS forlife,
+ $sql = "SELECT e.id,e.titre,e.texte,e.post_id,a.user_id,a.nom,a.prenom,a.promo,l.alias AS forlife,
p.x, p.y, p.attach IS NOT NULL AS img
FROM evenements AS e
LEFT JOIN evenements_photo AS p ON (e.id = p.eid)
exit;
}
require_once('banana/ml.inc.php');
- $banana = new MLBanana(Array('listname' => $liste, 'domain' => $domain, 'action' => 'rss2'));
+ $banana = new MLBanana(S::v('forlife'), Array('listname' => $liste, 'domain' => $domain, 'action' => 'rss2'));
$banana->run();
}
exit;
<tr class="impair">
<td class="half">
<div>
- {* if $ev.img *}
+ {if $ev.img}
<div style="float: {$position}; padding-{if $position eq right}left{else}right{/if}: 0.5em">
<img src="events/photo/{$ev.id}" alt="{$ev.title}" />
</div>
- {* /if *}
+ {/if}
<div style="text-align: justify">
{tidy}
{$ev.texte|smarty:nodefaults|nl2br}
</td>
</tr>
<tr class="pair">
- <td class="half">
- <a href="events#pagetop" style="display:block; float: right; padding-left:1em">
- <img alt="Sommaire" title="Remonter tout en haut" src="images/up.png"/>
- </a>
- <span class="smaller">
- Annonce proposée par
- <a href="profile/{$ev.forlife}" class="popup2">
- {$ev.prenom} {$ev.nom} X{$ev.promo}
+ <td class="half smaller">
+ <div style="display:block; float: right; padding-left:1em">
+ <a href="events#pagetop">
+ {if $ev.post_id}
+ <a href="banana/{#globals.banana.event_reply#|default:#globals.banana.event_forum#}/read/{$ev.post_id}">
+ {icon name="comments" title="Discussion"}Suivre la discussion
+ </a> •
+ {/if}
+ <a href="events#pagetop">
+ <img alt="Sommaire" title="Remonter tout en haut" src="images/up.png"/>
</a>
- </span>
+ </div>
+ Annonce proposée par
+ <a href="profile/{$ev.forlife}" class="popup2">
+ {$ev.prenom} {$ev.nom} X{$ev.promo}
+ </a>
</td>
</tr>
</table>
alter table evenements change flags flags set('valide', 'archive', 'important') not null;
+alter table evenements add post_id smallint(4) unsigned default NULL;
create table evenements_photo (
eid smallint(4) unsigned not null,
attachmime enum('jpeg', 'png', 'gif') not null default 'jpeg',