From: x2003bruneau Date: Sun, 14 Jan 2007 18:43:10 +0000 (+0000) Subject: Update ChangeLog and remove obsolete functions X-Git-Tag: xorg/0.9.13~137 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=bdcd055922730202286c3ed1f13a73fa627713ba;p=platal.git Update ChangeLog and remove obsolete functions git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1334 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/ChangeLog b/ChangeLog index b3b2b05..a987c47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,9 @@ New: - Tips. -FRU/Car - Split Events in 2 modules: events and newsletter -FRU + * Lists: + - Use Banana to power mail moderation -FRU + * Newsletter: - New skin -mYk @@ -48,6 +51,7 @@ Bug/Wish: * Lists: - #588: Auto-select mail to moderate -FRU - #598: Ask for confirmation -FRU + - #616: Fix encoding issues with mail to moderate -FRU * Register: - #277: Improve ergonomy. -FRU diff --git a/modules/banana/banana.inc.php b/modules/banana/banana.inc.php deleted file mode 100644 index 7e92033..0000000 --- a/modules/banana/banana.inc.php +++ /dev/null @@ -1,241 +0,0 @@ -getHeaderValue('x-org-id')) { - return $address . ' ' - . ''; - } elseif ($id = Banana::$message->getHeaderValue('x-org-mail')) { - list($id, $domain) = explode('@', $id); - return $address . ' ' - . ''; - } else { - return $address; - } - } - if (!empty($text)) { - $text .= ', '; - } - $text .= $address; - } - return $text; - - case 'subject': - $link = null; - $text = stripslashes($_text); - if (preg_match('/^(.+?)\s*\[=> (.*?)\]\s*$/u', $text, $matches)) { - $text = $matches[1]; - $group = $matches[2]; - if (Banana::$group == $group) { - $link = ' [=> ' . $group . ']'; - } else { - $link = ' [=> ' . Banana::$page->makeLink(array('group' => $group, 'text' => $group)) . ']'; - } - } - $text = banana_catchFormats(banana_htmlentities($text)); - if ($in_spool) { - return array($text, $link); - } - return $text . $link; - } - return null; -} - -function hook_checkcancel($_headers) -{ - return ($_headers['x-org-id'] == S::v('forlife') or S::has_perms()); -} - -function hook_makeLink($params) { - global $globals; - $base = $globals->baseurl . '/banana'; - if (isset($params['page'])) { - return $base . '/' . $params['page']; - } - if (@$params['action'] == 'subscribe') { - return $base . '/subscription'; - } - if (isset($params['xface'])) { - return $base . '/xface/' . strtr(base64_encode($params['xface']), '+/', '.:'); - } - - if (!isset($params['group'])) { - return $base; - } - $base .= '/' . $params['group']; - - if (isset($params['first'])) { - return $base . '/from/' . $params['first']; - } - if (isset($params['artid'])) { - if (@$params['part'] == 'xface') { - $base .= '/xface'; - } elseif (@$params['action'] == 'new') { - $base .= '/reply'; - } elseif (@$params['action'] == 'cancel') { - $base .= '/cancel'; - } else { - $base .= '/read'; - } - if (isset($params['part']) && $params['part'] != 'xface') { - return $base . '/' . $params['artid'] . '?part=' . urlencode($params['part']); - } else { - return $base . '/' . $params['artid']; - } - } - - if (@$params['action'] == 'new') { - return $base . '/new'; - } - return $base; -} - -function hook_makeImg($img, $alt, $height, $width) -{ - $url = 'images/banana/' . $img; - - if (!is_null($width)) { - $width = ' width="' . $width . '"'; - } - if (!is_null($height)) { - $height = ' height="' . $height . '"'; - } - - return '' . $alt . ''; -} - -class PlatalBanana extends Banana -{ - function __construct($params = null) - { - global $globals; - Banana::$msgedit_canattach = false; - array_push(Banana::$msgparse_headers, 'x-org-id', 'x-org-mail'); - Banana::$nntp_host = 'news://web_'.S::v('forlife') - . ":{$globals->banana->password}@{$globals->banana->server}:{$globals->banana->port}/"; - parent::__construct($params); - } - - public function run() - { - global $platal, $globals; - - // Update last unread time - $time = null; - if (!is_null($this->params) && isset($this->params['updateall'])) { - $time = intval($this->params['updateall']); - $_SESSION['banana_last'] = $time; - } - - // Get user profile from SQL - $req = XDB::query("SELECT nom, mail, sig, - FIND_IN_SET('threads',flags), FIND_IN_SET('automaj',flags) - FROM {$globals->banana->table_prefix}profils - WHERE uid={?}", S::i('uid')); - if (!(list($nom,$mail,$sig,$disp,$maj) = $req->fetchOneRow())) { - $nom = S::v('prenom')." ".S::v('nom'); - $mail = S::v('forlife')."@polytechnique.org"; - $sig = $nom." (".S::v('promo').")"; - $disp = 0; - $maj = 1; - } - if ($maj) { - $time = time(); - } - - // Build user profile - $req = XDB::query(" - SELECT nom - FROM {$globals->banana->table_prefix}abos - LEFT JOIN {$globals->banana->table_prefix}list ON list.fid=abos.fid - WHERE uid={?}", S::i('uid')); - Banana::$profile['headers']['From'] = utf8_encode("$nom <$mail>"); - Banana::$profile['headers']['Organization'] = 'Utilisateur de Polytechnique.org'; - Banana::$profile['signature'] = utf8_encode($sig); - Banana::$profile['display'] = $disp; - Banana::$profile['autoup'] = $maj; - Banana::$profile['lastnews'] = S::v('banana_last'); - Banana::$profile['subscribe'] = $req->fetchColumn(); - - // Update the "unread limit" - if (!is_null($time)) { - XDB::execute("UPDATE auth_user_quick - SET banana_last = FROM_UNIXTIME({?}) - WHERE user_id={?}", - $time, S::i('uid')); - } - - // Register custom Banana links and tabs - if (!Banana::$profile['autoup']) { - Banana::$page->registerAction('path . '", "updateall", ' . time() . ')\'>' - . 'Marquer tous les messages comme lus' - . '', array('forums', 'thread', 'message')); - } - Banana::$page->registerPage('profile', utf8_encode('Préférences'), null); - - - // Run Banana - return parent::run(); - } - - protected function action_saveSubs($groups) - { - global $globals; - $uid = S::v('uid'); - - Banana::$profile['subscribe'] = array(); - XDB::execute("DELETE FROM {$globals->banana->table_prefix}abos WHERE uid={?}", $uid); - if (!count($groups)) { - return true; - } - - $req = XDB::iterRow("SELECT fid,nom FROM {$globals->banana->table_prefix}list"); - $fids = array(); - while (list($fid,$fnom) = $req->next()) { - $fids[$fnom] = $fid; - } - - $diff = array_diff($groups, array_keys($fids)); - foreach ($diff as $g) { - XDB::execute("INSERT INTO {$globals->banana->table_prefix}list (nom) VALUES ({?})", $g); - $fids[$g] = XDB::insertId(); - } - - foreach ($groups as $g) { - XDB::execute("INSERT INTO {$globals->banana->table_prefix}abos (fid,uid) VALUES ({?},{?})", - $fids[$g], $uid); - Banana::$profile['subscribe'][] = $g; - } - } -} - -?>