* Lists:
- Unsure mails are moderated -FRU
+ * Forums:
+ - Ban system -THD
+
Bug/Wish:
* Emails:
* OG : Olivier Guillaumin <olivier.guillaumin@m4x.org>
* PIK: Fabien Laborde (pika) <fabien.laborde@m4x.org>
* SHK: Jeremy Lainé (Sharky) <jeremy.laine@m4x.org>
+ * THD: Thomas Deniau (Totom) <thomas.deniau@m4x.org>
* VP : Vincent Palatin <vincent.palatin@m4x.org>
* XdX: Alexandre Hô (XandreX) <alexandre.ho@m4x.org>
* VZA: Vincent Zanotti (vinZ2) <vincent.zanotti@m4x.org>
$this->sortfield = $idfield;
$this->idfield_editable = $editid;
$this->whereclause = '1';
- $r = XDB::iterator("SHOW COLUMNS FROM $table");
+ $r = XDB::iterator("SHOW FULL COLUMNS FROM $table");
$this->vars = array();
while ($a = $r->next()) {
// desc will be the title of the column
elseif (substr($a['Type'],0,10) == 'timestamp(' || $a['Type'] == 'datetime') {
$a['Type'] = 'timestamp';
}
+ elseif ($a['Comment'] == 'ip_address') {
+ $a['Type']='ip_address';
+ }
$this->vars[$a['Field']] = $a;
}
$date =& $entry[$field];
$date = preg_replace('/([0-9]{4})-?([0-9]{2})-?([0-9]{2})/', '\3/\2/\1', $date);
}
+ if ($descr['Type'] == 'ip_address') {
+ $ip = & $entry[$field];
+ $ip = long2ip($ip);
+ }
}
return $entry;
}
$page->trig($this->delete_message);
} else {
$page->trig("L'entrée ".$id." a été supprimée.");
- }
+ }
} else {
$page->trig("Impossible de supprimer l'entrée.");
}
elseif ($descr['Type'] == 'date') {
$val = preg_replace('/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})/', '\3-\2-\1', $val);
}
+ elseif ($descr['Type'] == 'ip_address') {
+ $val = ip2long($val);
+ }
$val = "'".addslashes($val)."'";
} else {
$cancel = true;
$id = XDB::insertId();
}
} else
- $page->trig("Impossible de mette à jour.");
+ $page->trig("Impossible de mettre à jour.");
if (!$this->auto_return) {
return $this->apply($page, 'edit', $id);
}
$mailer->assign("deletion", true);
$mailer->send();
break;
+
+ case "b_edit":
+ XDB::execute("DELETE FROM forums.innd WHERE uid = {?}", $mr['user_id']);
+ if (Env::v('write_perm') != "" || Env::v('read_perm') != "" || Env::v('commentaire') != "" ) {
+ XDB::execute("INSERT INTO forums.innd
+ SET ipmin = '0',
+ ipmax = '4294967295',
+ write_perm = {?},
+ read_perm = {?},
+ comment = {?},
+ priority = '200',
+ uid = {?}",
+ Env::v('write_perm'), Env::v('read_perm'), Env::v('comment'), $mr['user_id']);
+ }
+ break;
}
}
}
$page->assign('mr',$mr);
+
+ // Bans forums
+ $res = XDB::query("SELECT write_perm, read_perm, comment
+ FROM forums.innd
+ WHERE uid = {?}", $mr['user_id']);
+ $bans = $res->fetchOneAssoc();
+ $page->assign('bans', $bans);
}
}
$table_editor->describe('ext','extension du screenshot',false);
$table_editor->apply($page, $action, $id);
}
+
function handler_postfix_blacklist(&$page, $action = 'list', $id = null) {
$page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Blacklist');
$page->assign('title', 'Blacklist de postfix');
// 'banana/profile' => $this->make_hook('profile', AUTH_MDP),
// 'banana/subscribe' => $this->make_hook('subscription', AUTH_COOKIE),
'banana/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS),
+ 'admin/forums' => $this->make_hook('forums_bans', AUTH_MDP, 'admin'),
);
}
exit;
}
+ function handler_forums_bans(&$page, $action = 'list', $id = null)
+ {
+ $page->assign('xorg_title','Polytechnique.org - Administration - Bannissements des forums');
+ $page->assign('title', 'Gestion des mises au ban');
+ $table_editor = new PLTableEditor('admin/forums','forums.innd','id_innd');
+ $table_editor->describe('ipmin','min plage IP',true);
+ $table_editor->describe('ipmax','max plage IP',true);
+ $table_editor->describe('uid','utilisateur',true);
+ $table_editor->describe('write_perm','perm. poster',true);
+ $table_editor->describe('read_perm','perm. lire',true);
+ $table_editor->describe('priority','priorite',true);
+ $table_editor->describe('comment','commentaire',true);
+ $table_editor->apply($page, $action, $id);
+ }
+
static function run_banana(&$page, $params = null)
{
$page->changeTpl('banana/index.tpl');
<a href="survey/admin">Gestion des sondages</a>
</td>
</tr>
+ <tr class="pair">
+ <td>
+ <strong>Forums :</strong>
+ <a href="admin/forums">Gestion des mises au ban</a>
+ </td>
+ </tr>
</table>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{if $mr}
<p class="smaller">
-Derniére connexion le <strong>{$lastlogin|date_format:"%d %B %Y, %T"}</strong>
+Dernière connexion le <strong>{$lastlogin|date_format:"%d %B %Y, %T"}</strong>
depuis <strong>{$host}</strong>
</p>
document.forms.fwds.clean_fwd.value = fwd;
document.forms.fwds.submit();
}
+function ban_write()
+{
+ document.forms.bans.write_perm.value = "!xorg.*";
+}
+function ban_read()
+{
+ document.forms.bans.read_perm.value = "!xorg.*";
+}
+
// ]]>
</script>
{/literal}
<input type="text" name="promoN" size="4" maxlength="4" value="{$mr.promo}" />
</td>
</tr>
- <tr class "impair">
+ <tr class="impair">
<td class="titre">
Surveillance
</td>
</table>
</form>
+<form id="bans" method="post" action="admin/user">
+ <table cellspacing="0" cellpadding="2" class="tinybicol">
+ <tr>
+ <th colspan="4">
+ Permissions sur les forums
+ </th>
+ </tr>
+ <tr class="impair">
+ <td class="titre">
+ Poster :
+ </td>
+ <td>
+ <input type="text" name="write_perm" size="40" maxlength="255" value="{$bans.write_perm}" />
+ </td>
+ <td class="action">
+ <a href="javascript:ban_write()">Bannir</a>
+ </td>
+ </tr>
+ <tr class="pair">
+ <td class="titre">
+ Lire :
+ </td>
+ <td>
+ <input type="text" name="read_perm" size="40" maxlength="255" value="{$bans.read_perm}" />
+ </td>
+ <td class="action">
+ <a href="javascript:ban_read()">Bannir</a>
+ </td>
+ </tr>
+ <tr class="impair">
+ <td class="titre">
+ Commentaire
+ </td>
+ <td>
+ <input type="text" name="comment" size="40" maxlength="255" value="{$bans.comment}" />
+ </td>
+ <td/>
+ </tr>
+ <tr class="center">
+ <td colspan="3">
+ <input type="hidden" name="user_id" value="{$mr.user_id}" />
+ <input type="submit" name="b_edit" value="Modifier" />
+ </td>
+ </tr>
+ </table>
+</form>
+
<p>
<strong>* à ne modifier qu'avec l'accord express de l'utilisateur !!!</strong>
</p>
{**************************************************************************}
-<h1>Télépaiments</h1>
+<h1>Télépaiements</h1>
{if $erreur}
<p>Aucun paiement n'a été effectué.</p>
--- /dev/null
+CREATE TABLE `forums.innd` (
+ `id_innd` int(10) unsigned NOT NULL auto_increment,
+ `ipmin` int(10) unsigned default '0' COMMENT 'ip_address',
+ `ipmax` int(10) unsigned default '4294967295' COMMENT 'ip_address',
+ `uid` smallint(5) unsigned default NULL,
+ `read_perm` varchar(100) default '!*',
+ `write_perm` varchar(100) default '!*',
+ `priority` tinyint(1) unsigned default '255',
+ `comment` text,
+ PRIMARY KEY (`id_innd`)
+) DEFAULT CHARSET=utf8;
+
+INSERT INTO `forums.innd` VALUES (1,0,4294967295,NULL,'xorg.*,!xorg.prive.*','xorg.*,!xorg.prive.*,!xorg.pa.emploi',0,'par defaut pour tous');