New:
* Admin:
- - Switch to the new URI scheme. -Car
+ - New table editor. -Car
+ - Switch to the new URI scheme. -Car
* Auth:
- Switch to the new URI scheme. -MC
Bug/Wish:
+ * Admin:
+ - #430: Specify date format on downtime admin page. -Car
+
* Carnet:
- #435: Calendar contains yearly events for all the contacts. -FRU
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2006 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+class PLTableEditor {
+ // the plat/al name of the page
+ var $pl;
+ // the table name
+ var $table;
+ // joint tables to delete when deleting an entry
+ var $jtables = array();
+ // the id field
+ var $idfield;
+ // possibility to edit the field
+ var $idfield_editable;
+ // vars
+ var $vars;
+ // number of displayed fields
+ var $nbfields;
+ /* table editor for platal
+ * $plname : the PLname of the page, ex: admin/payments
+ * $table : the table to edit, ex: profile_medals
+ * $idfield : the field of the table which is the id, ex: id
+ * $editid : is the id editable or not (if not, it is considered as an int)
+ */
+ function PLTableEditor($plname, $table, $idfield, $editid=false) {
+ $this->pl = $plname;
+ $this->table = $table;
+ $this->idfield = $idfield;
+ $this->idfield_editable = $editid;
+ $r = XDB::iterator("SHOW COLUMNS FROM $table");
+ $this->vars = array();
+ while ($a = $r->next()) {
+ // desc will be the title of the column
+ $a['desc'] = $a['Field'];
+ $a['display'] = true;
+
+ if (substr($a['Type'],0,8) == 'varchar(') {
+ // limit editing box size
+ $a['Size'] = $a['Maxlength'] = substr($a['Type'], 8, strlen($a['Type']) - 9);
+ if ($a['Size'] > 40) $a['Size'] = 40;
+ // if too big, put a textarea
+ $a['Type'] = ($a['Maxlength']<200)?'varchar':'varchar200';
+ }
+ elseif ($a['Type'] == 'text' || $a['Type'] == 'mediumtext')
+ $a['Type'] = 'textarea';
+ elseif (substr($a['Type'],0,4) == 'set(') {
+ // get the list of options
+ $a['List'] = explode('§',str_replace("','","§",substr($a['Type'], 5, strlen($a['Type']) - 7)));
+ $a['Type'] = 'set';
+ }
+ elseif (substr($a['Type'],0,5) == 'enum(') {
+ // get the list of options
+ $a['List'] = explode('§',str_replace("','","§",substr($a['Type'], 6, strlen($a['Type']) - 8)));
+ $a['Type'] = 'enum';
+ }
+ elseif (substr($a['Type'],0,10) == 'timestamp(') {
+ $a['Type'] = 'timestamp';
+ }
+
+ $this->vars[$a['Field']] = $a;
+ }
+ $this->vars[$idfield]['desc'] = 'id';
+ }
+ // called before editing $entry
+ function prepare_edit(&$entry) {
+ foreach ($this->vars as $field => $descr) {
+ if ($descr['Type'] == 'set') {
+ // get the list of options selected
+ $selected = explode(',', $entry[$field]);
+ $entry[$field] = array();
+ foreach ($selected as $option)
+ $entry[$field][$option] = 1;
+ }
+ if ($descr['Type'] == 'timestamp') {
+ // set readable timestamp
+ $date =& $entry[$field];
+ $date = preg_replace('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', '\3/\2/\1 \4:\5:\6', $date);
+ }
+ }
+ return $entry;
+ }
+ // change display of a field
+ function describe($name, $desc, $display) {
+ $this->vars[$name]['desc'] = $desc;
+ $this->vars[$name]['display'] = $display;
+ }
+ // add a join table, when deleting a row corresponding entries will be deleted in these tables
+ function add_join_table($name,$joinid,$joindel,$joinextra="") {
+ if ($joindel)
+ $this->jtables[$name] = array("joinid" => $joinid,"joinextra" => $joinextra?(" AND ".$joinextra):"");
+ }
+ // call when done
+ function apply(&$page, $action, $id = false) {
+ $page->changeTpl('table-editor.tpl');
+ $list = true;
+ if ($action == 'delete') {
+ foreach ($this->jtables as $table => $j)
+ XDB::execute("DELETE FROM {$table} WHERE {$j['joinid']} = {?}{$j['joinextra']}", $id);
+ XDB::execute("DELETE FROM {$this->table} WHERE {$this->idfield} = {?}",$id);
+ $page->trig("L'entrée ".$id." a été supprimée.");
+ }
+ if ($action == 'edit') {
+ $r = XDB::query("SELECT * FROM {$this->table} WHERE {$this->idfield} = {?}",$id);
+ $entry = $r->fetchOneAssoc();
+ $page->assign('entry', $this->prepare_edit($entry));
+ $page->assign('id', $id);
+ $list = false;
+ }
+ if ($action == 'new') {
+ if (!$this->idfield_editable) {
+ $r = XDB::query("SELECT MAX({$this->idfield})+1 FROM {$this->table}");
+ $page->assign('id', $r->fetchOneCell());
+ }
+ $list = false;
+ }
+ if ($action == 'update') {
+ $values = "";
+ $cancel = false;
+ foreach ($this->vars as $field => $descr) {
+ if ($values) $values .= ',';
+ if (($field == $this->idfield) && !$this->idfield_editable)
+ $val = "'".addslashes($id)."'";
+ elseif ($descr['Type'] == 'set') {
+ $val = "";
+ if (Post::has($field)) foreach (Post::v($field) as $option) {
+ if ($val) $val .= ',';
+ $val .= $option;
+ }
+ $val = "'".addslashes($val)."'";
+ } elseif (Post::has($field)) {
+ $val = Post::v($field);
+ if ($descr['Type'] == 'timestamp') {
+ $val = preg_replace('/([0-9]{2})\/([0-9]{2})\/([0-9]{4}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/', '\3\2\1\4\5\6', $val);
+ }
+ $val = "'".addslashes($val)."'";
+ } else {
+ $cancel = true;
+ $page->trig("Il manque le champ ".$field);
+ }
+ $values .= $val;
+ }
+ if (!$cancel) {
+ if ($this->idfield_editable && ($id != Post::v($this->idfield)) && $action != 'new')
+ XDB::execute("UPDATE {$this->table} SET {$this->idfield} = {?} WHERE {$this->idfield} = {?}", Post::v($this->idfield), $id);
+ XDB::execute("REPLACE INTO {$this->table} VALUES ($values)");
+ if ($id !== false)
+ $page->trig("L'entrée ".$id." a été mise à jour.");
+ else
+ $page->trig("Une nouvelle entrée a été créée.");
+ } else
+ $page->trig("Impossible de mette à jour.");
+ }
+ if ($list) {
+ $it = XDB::iterator("SELECT * FROM {$this->table}");
+ $this->nbfields = 0;
+ foreach ($this->vars as $field => $descr)
+ if ($descr['display']) $this->nbfields++;
+ $page->assign('list', $it);
+ }
+ $page->assign('t', $this);
+ }
+}
+
+?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('applis_def','id');
-$page->assign('xorg_title','Polytechnique.org - Administration - Formations');
-$editor->add_join_table('applis_ins','aid',true);
-
-$editor->describe('text','intitulé',true);
-$editor->describe('type','type',true,'set');
-$editor->describe('url','site web',false);
-
-$editor->assign('title', 'Gestion des formations');
-
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('groupesx_auth','id');
-$page->assign('xorg_title','Polytechnique.org - Administration - Auth groupes X');
-
-$editor->describe('name','nom',true);
-$editor->describe('privkey','clé privée',false);
-$editor->describe('datafields','champs renvoyés',true);
-
-$editor->assign('title', 'Gestion de l\'authentification centralisée');
-
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('binets_def','id');
-$page->assign('xorg_title','Polytechnique.org - Administration - Groupes X');
-
-$editor->add_join_table('binets_ins','binet_id',true);
-
-$editor->describe('text','intitulé',true);
-$editor->assign('title', 'Gestion des binets');
-
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('coupures','id');
-$page->assign('xorg_title','Polytechnique.org - Administration - Coupures');
-
-$editor->describe('debut','date',true,'timestamp');
-$editor->describe('duree','durée',false);
-$editor->describe('resume','résumé',true);
-$editor->describe('services','services affectés',true,'set');
-$editor->describe('description','description',false,'textarea');
-
-$editor->assign('title', 'Gestion des coupures');
-
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('profile_medals', 'id');
-$page->assign('xorg_title','Polytechnique.org - Administration - Distinctions');
-
-$editor->describe('type', 'type', true, 'set');
-$editor->describe('text', 'intitulé', true);
-$editor->describe('img', 'nom de l\'image', false);
-
-$editor->assign('title', 'Gestion des Distinctions');
-
-if (Post::v('frm_id')) {
- $page->changeTpl('admin/gerer_decos.tpl');
-
- $mid = Post::i('frm_id');
-
- if (Post::v('act') == 'del') {
- XDB::execute('DELETE FROM profile_medals_grades WHERE mid={?} AND gid={?}', $mid, Post::i('gid'));
- } elseif (Post::v('act') == 'new') {
- XDB::execute('INSERT INTO profile_medals_grades (mid,gid) VALUES({?},{?})',
- $mid, max(array_keys(Post::v('grades', array(0))))+1);
- } else {
- foreach (Post::v('grades', array()) as $gid=>$text) {
- XDB::execute('UPDATE profile_medals_grades SET pos={?}, text={?} WHERE gid={?}', $_POST['pos'][$gid], $text, $gid);
- }
- }
- $res = XDB::iterator('SELECT gid, text, pos FROM profile_medals_grades WHERE mid={?} ORDER BY pos', $mid);
- $page->assign('grades', $res);
-}
-
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('groupesx_def','id');
-$page->assign('xorg_title','Polytechnique.org - Administration - Groupes X');
-$editor->add_join_table('groupesx_ins','gid',true);
-
-$editor->describe('text','intitulé',true);
-$editor->describe('url','site web',false);
-
-$editor->assign('title', 'Gestion des Groupes X');
-
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('paiement.paiements','id');
-$page->assign('xorg_title','Polytechnique.org - Administration - Paiements');
-
-$editor->add_join_table('paiement.transactions','ref',true);
-
-$editor->describe('text','intitulé',true);
-$editor->describe('url','site web',false);
-$editor->describe('montant_def','montant par défaut',false);
-$editor->describe('montant_min','montant minimum',false);
-$editor->describe('montant_max','montant maximum',false);
-$editor->describe('mail','email contact',true);
-$editor->describe('confirmation','message confirmation',false,'textarea');
-$editor->describe('flags','flags', true, 'set');
-
-$editor->assign('title', 'Gestion des télépaiements');
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('skins','id');
-$page->assign('xorg_title','Polytechnique.org - Administration - Skins');
-$editor->describe('name','nom',true);
-$editor->describe('skin_tpl','nom du template',true);
-$editor->describe('auteur','auteur',false);
-$editor->describe('comment','commentaire',true,'textarea');
-$editor->describe('date','date',false);
-$editor->describe('ext','extension du screenshot',false);
-
-$editor->assign('title', 'Gestion des skins');
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('logger.actions','id');
-$page->assign('xorg_title','Polytechnique.org - Administration - Actions');
-$editor->add_join_table('logger.events','action',true);
-
-$editor->describe('text','intitulé',true);
-$editor->describe('description','description',true);
-
-$editor->assign('title', 'Gestion des actions de logger');
-
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('newsletter_cat','cid');
-$page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : Catégories');
-
-$editor->describe('titre','intitulé',true);
-$editor->describe('pos','position',true);
-
-$editor->assign('title', 'Gestion des catégories de la newsletter');
-
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('postfix_blacklist','email',true);
-$page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Blacklist');
-
-$editor->assign('title', 'Blacklist de postfix');
-$editor->hide_id();
-
-$editor->describe('email','email',true);
-$editor->describe('reject_text','Texte de rejet',true);
-
-$editor->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-$DONT_FIX_GPC = 1;
-
-require_once('xorg.inc.php');
-new_admin_table_editor('postfix_whitelist','email',true);
-$page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Whitelist');
-
-$editor->assign('title', 'Whitelist de postfix');
-$editor->hide_id();
-
-$editor->describe('email','email',true);
-
-$editor->run();
-?>
}
// }}}
-// {{{ function new_admin_table_editor()
-
-function new_admin_table_editor($table, $idfield, $idedit=false)
-{
- global $editor;
- new_admin_page('table-editor.tpl');
- require_once('xorg.table-editor.inc.php');
- $editor = new XOrgAdminTableEditor($table, $idfield, $idedit);
-}
-
-// }}}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-require_once('diogenes/diogenes.table-editor.inc.php');
-
-class XOrgAdminTableEditor extends DiogenesTableEditor {
- function XOrgTableEditor($table,$idfield,$editid=false) {
- $this->DiogenesTableEditor($table,$idfield,$editid);
- }
-
- function assign($var_name, $contenu) {
- global $page;
- $page->assign($var_name, $contenu);
- }
-
- function run() {
- global $page;
- $page->fakeDiogenes();
- parent::run($page);
- $page->run();
- }
-}
-
-?>
{
return array(
'admin' => $this->make_hook('default', AUTH_MDP, 'admin'),
- 'admin/postfix/delayed' => $this->make_hook('postfix_delayed', AUTH_MDP, 'admin'),
- 'admin/postfix/regexp_bounces' => $this->make_hook('postfix_regexpsbounces', AUTH_MDP, 'admin'),
- 'admin/logger' => $this->make_hook('logger', AUTH_MDP, 'admin'),
- 'admin/logger/actions' => $this->make_hook('logger_action', AUTH_MDP, 'admin'),
- 'admin/user' => $this->make_hook('user', AUTH_MDP, 'admin'),
- 'admin/homonyms' => $this->make_hook('homonyms', AUTH_MDP, 'admin'),
+ 'admin/auth-groupes-x' => $this->make_hook('authgroupesx', AUTH_MDP, 'admin'),
'admin/ax-xorg' => $this->make_hook('ax_xorg', AUTH_MDP, 'admin'),
+ 'admin/binets' => $this->make_hook('binets', AUTH_MDP, 'admin'),
'admin/deaths' => $this->make_hook('deaths', AUTH_MDP, 'admin'),
- 'admin/synchro_ax' => $this->make_hook('synchro_ax', AUTH_MDP, 'admin'),
+ 'admin/medals' => $this->make_hook('medals', AUTH_MDP, 'admin'),
+ 'admin/downtime' => $this->make_hook('downtime', AUTH_MDP, 'admin'),
'admin/events' => $this->make_hook('events', AUTH_MDP, 'admin'),
'admin/formations' => $this->make_hook('formations', AUTH_MDP, 'admin'),
- 'admin/newsletter' => $this->make_hook('newsletter', AUTH_MDP, 'admin'),
- 'admin/newsletter/edit' => $this->make_hook('newsletter_edit', AUTH_MDP, 'admin'),
- 'admin/lists' => $this->make_hook('lists', AUTH_MDP, 'admin'),
- 'admin/validate' => $this->make_hook('validate', AUTH_MDP, 'admin'),
'admin/geoloc' => $this->make_hook('geoloc', AUTH_MDP, 'admin'),
'admin/geoloc/dynamap' => $this->make_hook('geoloc_dynamap', AUTH_MDP, 'admin'),
+ 'admin/groupes-x' => $this->make_hook('groupesx', AUTH_MDP, 'admin'),
+ 'admin/homonyms' => $this->make_hook('homonyms', AUTH_MDP, 'admin'),
+ 'admin/lists' => $this->make_hook('lists', AUTH_MDP, 'admin'),
+ 'admin/logger' => $this->make_hook('logger', AUTH_MDP, 'admin'),
+ 'admin/logger/actions' => $this->make_hook('logger_actions', AUTH_MDP, 'admin'),
+ 'admin/newsletter' => $this->make_hook('newsletter', AUTH_MDP, 'admin'),
+ 'admin/newsletter/categories' => $this->make_hook('newsletter_cat', AUTH_MDP, 'admin'),
+ 'admin/newsletter/edit' => $this->make_hook('newsletter_edit', AUTH_MDP, 'admin'),
+ 'admin/payments' => $this->make_hook('payments', AUTH_MDP, 'admin'),
+ 'admin/postfix/blacklist' => $this->make_hook('postfix_blacklist', AUTH_MDP, 'admin'),
+ 'admin/postfix/delayed' => $this->make_hook('postfix_delayed', AUTH_MDP, 'admin'),
+ 'admin/postfix/regexp_bounces' => $this->make_hook('postfix_regexpsbounces', AUTH_MDP, 'admin'),
+ 'admin/postfix/whitelist' => $this->make_hook('postfix_whitelist', AUTH_MDP, 'admin'),
+ 'admin/skins' => $this->make_hook('skins', AUTH_MDP, 'admin'),
+ 'admin/synchro_ax' => $this->make_hook('synchro_ax', AUTH_MDP, 'admin'),
'admin/trombino' => $this->make_hook('trombino', AUTH_MDP, 'admin'),
+ 'admin/user' => $this->make_hook('user', AUTH_MDP, 'admin'),
+ 'admin/validate' => $this->make_hook('validate', AUTH_MDP, 'admin'),
);
}
$page->assign('forlife', $forlife);
}
-
+
+ function handler_binets(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Binets');
+ $page->assign('title', 'Gestion des binets');
+ $table_editor = new PLTableEditor('admin/binets', 'binets_def', 'id');
+ $table_editor->add_join_table('binets_ins','binet_id',true);
+ $table_editor->describe('text','intitulé',true);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_formations(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Formations');
+ $page->assign('title', 'Gestion des formations');
+ $table_editor = new PLTableEditor('admin/formations','applis_def','id');
+ $table_editor->add_join_table('applis_ins','aid',true);
+ $table_editor->describe('text','intitulé',true);
+ $table_editor->describe('url','site web',false);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_groupesx(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Groupes X');
+ $page->assign('title', 'Gestion des Groupes X');
+ $table_editor = new PLTableEditor('admin/groupes-x','groupesx_def','id');
+ $table_editor->add_join_table('groupesx_ins','gid',true);
+ $table_editor->describe('text','intitulé',true);
+ $table_editor->describe('url','site web',false);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_skins(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Skins');
+ $page->assign('title', 'Gestion des skins');
+ $table_editor = new PLTableEditor('admin/skins','skins','id');
+ $table_editor->describe('name','nom',true);
+ $table_editor->describe('skin_tpl','nom du template',true);
+ $table_editor->describe('auteur','auteur',false);
+ $table_editor->describe('comment','commentaire',true);
+ $table_editor->describe('date','date',false);
+ $table_editor->describe('ext','extension du screenshot',false);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_authgroupesx(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Auth groupes X');
+ $page->assign('title', 'Gestion de l\'authentification centralisée');
+ $table_editor = new PLTableEditor('admin/auth-groupes-x','groupesx_auth','id');
+ $table_editor->describe('name','nom',true);
+ $table_editor->describe('privkey','clé privée',false);
+ $table_editor->describe('datafields','champs renvoyés',true);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_postfix_blacklist(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Blacklist');
+ $page->assign('title', 'Blacklist de postfix');
+ $table_editor = new PLTableEditor('admin/postfix/blacklist','postfix_blacklist','email', true);
+ $table_editor->describe('reject_text','Texte de rejet',true);
+ $table_editor->describe('email','email',true);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_postfix_whitelist(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Whitelist');
+ $page->assign('title', 'Whitelist de postfix');
+ $table_editor = new PLTableEditor('admin/postfix/whitelist','postfix_whitelist','email', true);
+ $table_editor->describe('email','email',true);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_logger_actions(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Actions');
+ $page->assign('title', 'Gestion des actions de logger');
+ $table_editor = new PLTableEditor('admin/logger/actions','logger.actions','id');
+ $table_editor->describe('text','intitulé',true);
+ $table_editor->describe('description','description',true);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_downtime(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Coupures');
+ $page->assign('title', 'Gestion des coupures');
+ $table_editor = new PLTableEditor('admin/downtime','coupures','id');
+ $table_editor->describe('debut','date',true);
+ $table_editor->describe('duree','durée',false);
+ $table_editor->describe('resume','résumé',true);
+ $table_editor->describe('services','services affectés',true);
+ $table_editor->describe('description','description',false);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_newsletter_cat(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : Catégories');
+ $page->assign('title', 'Gestion des catégories de la newsletter');
+ $table_editor = new PLTableEditor('admin/newsletter/categories','newsletter_cat','cid');
+ $table_editor->describe('titre','intitulé',true);
+ $table_editor->describe('pos','position',true);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_payments(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Paiements');
+ $page->assign('title', 'Gestion des télépaiements');
+ $table_editor = new PLTableEditor('admin/payments','paiement.paiements','id');
+ $table_editor->add_join_table('paiement.transactions','ref',true);
+ $table_editor->describe('text','intitulé',true);
+ $table_editor->describe('url','site web',false);
+ $table_editor->describe('montant_def','montant par défaut',false);
+ $table_editor->describe('montant_min','montant minimum',false);
+ $table_editor->describe('montant_max','montant maximum',false);
+ $table_editor->describe('mail','email contact',true);
+ $table_editor->describe('confirmation','message confirmation',false);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_medals(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Distinctions');
+ $page->assign('title', 'Gestion des Distinctions');
+ $table_editor = new PLTableEditor('admin/medals','profile_medals','id');
+ $table_editor->describe('text', 'intitulé', true);
+ $table_editor->describe('img', 'nom de l\'image', false);
+ $table_editor->apply($page, $action, $id);
+ if ($id && $action == 'edit') {
+ $page->changeTpl('admin/gerer_decos.tpl');
+
+ $mid = $id;
+
+ if (Post::v('act') == 'del') {
+ XDB::execute('DELETE FROM profile_medals_grades WHERE mid={?} AND gid={?}', $mid, Post::i('gid'));
+ } elseif (Post::v('act') == 'new') {
+ XDB::execute('INSERT INTO profile_medals_grades (mid,gid) VALUES({?},{?})',
+ $mid, max(array_keys(Post::v('grades', array(0))))+1);
+ } else {
+ foreach (Post::v('grades', array()) as $gid=>$text) {
+ XDB::execute('UPDATE profile_medals_grades SET pos={?}, text={?} WHERE gid={?}', $_POST['pos'][$gid], $text, $gid);
+ }
+ }
+ $res = XDB::iterator('SELECT gid, text, pos FROM profile_medals_grades WHERE mid={?} ORDER BY pos', $mid);
+ $page->assign('grades', $res);
+ }
+ }
}
?>
</script>
{/literal}
-<form method="post" action='{$smarty.server.PHP_SELF}#form_grade' id='form_grade'>
+<form method="post" action='{$t->pl}/edit/{$id}#form_grade' id='form_grade'>
<table class='bicol'>
<tr>
<th>id</th>
Nouveau ...
</td>
<td class='action'>
- <a href='javascript:new_grade()'>nouveau</a>
+ <a href='javascript:new_grade()'>nouveau{icon name=add title='nouveau grade'}</a>
</td>
</tr>
{iterate from=$grades item=g}
<input type='text' maxlength='2' value="{$g.pos}" name="pos[{$g.gid}]" />
</td>
<td class='action'>
- <a href='javascript:del_grade({$g.gid})'>suppr.</a>
+ <a href='javascript:del_grade({$g.gid})'>{icon name=delete title='supprimer grade'}</a>
</td>
</tr>
{/iterate}
<tr class="impair">
<td>
<strong>Postfix :</strong>
- <a href="admin_old/postfix_blacklist.php">Blacklist</a>
+ <a href="admin/postfix/blacklist">Blacklist</a>
|
- <a href="admin_old/postfix_whitelist.php">Whitelist</a>
+ <a href="admin/postfix/whitelist">Whitelist</a>
|
<a href="admin/postfix/delayed">Retardés</a>
|
<strong>Sécurité :</strong>
<a href="admin/logger">Logs des sessions</a>
|
- <a href="admin_old/logger_actions.php">Actions</a>
+ <a href="admin/logger/actions">Actions</a>
</td>
</tr>
</table>
<tr class="pair">
<td>
<strong>Infos dynamiques :</strong>
- <a href="admin_old/gerer_coupure.php">Coupures</a>
+ <a href="admin/downtime">Coupures</a>
</td>
</tr>
<tr class="impair">
<td>
<strong>Champs profil :</strong>
- <a href="admin/formations.php">Formations</a>
+ <a href="admin/formations">Formations</a>
|
- <a href="admin_old/gerer_binets.php">Binets</a>
+ <a href="admin/binets">Binets</a>
|
- <a href="admin_old/gerer_groupesx.php">Groupes X</a>
+ <a href="admin/groupes-x">Groupes X</a>
|
- <a href="admin_old/gerer_skins.php">Skins</a>
+ <a href="admin/skins">Skins</a>
|
- <a href="admin_old/gerer_decos.php">Décorations</a>
+ <a href="admin/medals">Décorations</a>
</td>
</tr>
<tr class="pair">
<strong>Newsletter :</strong>
<a href="admin/newsletter">Liste</a>
|
- <a href="admin_old/newsletter_cat.php">Catégories</a>
+ <a href="admin/newsletter/categories">Catégories</a>
</td>
</tr>
<tr class="impair">
<td>
<strong>Administrer :</strong>
- <a href="admin/gerer_auth-groupex.php">Auth Groupes X</a>
+ <a href="admin/auth-groupes-x">Auth Groupes X</a>
|
<a href="admin/lists">Listes</a>
</td>
<strong>Trésorerie :</strong>
<a href="trezo/gere_operations.php">Comptes</a>
|
- <a href="admin/gerer_paiement.php">Paiements</a>
+ <a href="admin/payments">Paiements</a>
</td>
</tr>
<tr class="pair">
<h1>{$title}</h1>
-{if !$doedit}
-{if !$readonly}
-
-{literal}
-<script type="text/javascript">
- <!--
- function del( myid ) {
- if (confirm ("You are about to delete this entry. Do you want to proceed?")) {
- document.forms.operations.action.value = "del";
- document.forms.operations.{/literal}{$prefix}{literal}id.value = myid;
- document.forms.operations.submit();
- return true;
- }
- }
- function edit( myid ) {
- document.forms.operations.action.value = "edit";
- document.forms.operations.{/literal}{$prefix}{literal}id.value = myid;
- document.forms.operations.submit();
- return true;
- }
- // -->
-</script>
-{/literal}
-{/if}
-
-<form method="post" action="{$smarty.server.PHP_SELF}" id="operations">
- <div>
- <input type="hidden" name="action" value="" />
- <input type="hidden" name="{$prefix}id" value="" />
- </div>
-</form>
+{if $list}
<table class="bicol">
<tr>
- {if $idsum}<th>id</th>{/if}
- {foreach from=$vars item=myval}
- {if $myval.sum}<th>{$myval.desc}</th>{/if}
- {/foreach}
+ {foreach from=$t->vars item=myval}{if $myval.display}
+ <th>{$myval.desc}</th>
+ {/if}{/foreach}
{if !$hideactions}
<th>action</th>
{/if}
</tr>
{if !$readonly}
<tr class="impair">
- <td colspan="{$ncols}"><strong>nouvelle entrée</strong></td>
+ <td colspan="{$t->nbfields}"><strong>nouvelle entrée</strong></td>
<td class="action">
- <a href="javascript:edit('');">create</a>
+ <a href="{$t->pl}/new">créer{icon name=add title='nouvelle entrée'}</a>
</td>
</tr>
{/if}
-{foreach from=$rows item=myrow}{assign var="myarr" value=$myrow[1]}
+{iterate from=$list item=myrow}
<tr class="{cycle values="pair,impair"}">
- {if $idsum}<td>{$myrow[0]}</td>{/if}
-{foreach from=$vars key=mykey item=myval}
-{if $myval.sum}
+{foreach from=$t->vars item=myval}{if $myval.display}
<td>
- {if $myval.type=="timestamp"}
- <span class="smaller">{$myarr.$mykey|date_format:"%x %X"}</span>
- {elseif $myval.type=="set" and $myval.trans}
- {$myval.trans[$myval.value]}
- {elseif $myval.type=="ext"}
- {extval table=$table field=$mykey value=$myarr.$mykey vtable=$myval.vtable vjoinid=$myval.vjoinid vfield=$myval.vfield}
- {else}
- {$myarr.$mykey}
- {/if}
+ {assign var="myfield" value=$myval.Field}
+ {if $myfield eq $t->idfield}
+ {assign var="idval" value=$myrow.$myfield}
+ {/if}
+ {if $myval.Type eq 'timestamp'}
+ <span class="smaller">{$myrow.$myfield|date_format:"%x %X"}</span>
+ {else}
+ {$myrow.$myfield}
+ {/if}
</td>
-{/if}
-{/foreach}
+{/if}{/foreach}
{if !$hideactions}
<td class="action">
{if !$readonly}
- <a href="javascript:edit('{$myrow[0]}');">edit</a>
- <a href="javascript:del('{$myrow[0]}');">delete</a>
+ <a href="{$t->pl}/edit/{$idval}">{icon name=date_edit title='éditer'}</a>
+ <a href="{$t->pl}/delete/{$idval}">{icon name=delete title='supprimer'}</a>
{/if}
- {foreach from=$myrow[2] item=myaction}
- {a lnk=$myaction}
- {/foreach}
</td>
{/if}
</tr>
-{/foreach}
+{/iterate}
</table>
{if ($p_prev > -1) || ($p_next > -1)}
{else}
-<form method="post" action="{$smarty.server.PHP_SELF}">
+<form method="post" action="{$t->pl}/update/{$id}">
<table class="bicol">
<tr class="impair">
<th colspan="2">
- <input type="hidden" name="action" value="update" />
- {if $id!=''}
- modification de l'entrée
- <input type="hidden" name="{$prefix}id" value="{$id}" />
+ {if $id}
+ modification de l'entrée
{else}
- nouvelle entrée
+ nouvelle entrée
{/if}
</th>
</tr>
- {foreach from=$vars key=mykey item=myval}
+ {foreach from=$t->vars item=myval}{assign var="myfield" value=$myval.Field}{if ($myfield neq $t->idfield) or ($t->idfield_editable)}
<tr class="{cycle values="pair,impair"}">
<td>
<strong>{$myval.desc}</strong>
- {if $myval.type=="password"}<br /><em>(blank=no change)</em>{/if}
</td>
<td>
- {if $myval.edit}
- {if $myval.type=="textarea"}
- <textarea name="{$prefix}{$mykey}" rows="10" cols="70">{$myval.value}</textarea>
- {elseif $myval.type=="set"}
- {if $myval.trans}
- {flags table=$table field=$mykey name="$prefix$mykey" selected=$myval.trans[$myval.value] trans=$myval.trans}
- {else}
- {flags table=$table field=$mykey name="$prefix$mykey" selected=$myval.value}
- {/if}
- {elseif $myval.type=="ext"}
- {extval table=$table field=$mykey name="$prefix$mykey" vtable=$myval.vtable vjoinid=$myval.vjoinid vfield=$myval.vfield selected=$myval.value}
- {elseif $myval.type=="timestamp"}
- <input type="text" name="{$prefix}{$mykey}" value="{$myval.value|date_format:"%x %X"}" />
- {elseif $myval.type=="password"}
- <input type="password" name="{$prefix}{$mykey}" size="40" />
- {else}
- <input type="{$myval.type}" name="{$prefix}{$mykey}" size="40" value="{$myval.value}" />
- {/if}
+ {if $myval.Type eq 'set'}
+ <select name="{$myfield}[]" multiple="multiple">
+ {foreach from=$myval.List item=option}
+ <option value="{$option}" {if $entry.$myfield.$option}selected="selected"{/if}>{$option}</option>
+ {/foreach}
+ </select>
+ {elseif $myval.Type eq 'enum'}
+ <select name="{$myfield}">
+ {foreach from=$myval.List item=option}
+ <option value="{$option}" {if $entry.$myfield.$option}selected="selected"{/if}>{$option}</option>
+ {/foreach}
+ </select>
+ {elseif ($myval.Type eq 'textarea') or ($myval.Type eq 'varchar200')}
+ <textarea name="{$myfield}" rows="{if $myval.Type eq 'varchar200'}3{else}10{/if}" cols="70">{$entry.$myfield}</textarea>
{else}
- {$myval.value}
+ <input type="text" name="{$myfield}" value="{$entry.$myfield}" {if $myval.Size}size="{$myval.Size}" maxlength="{$myval.Maxlength}"{/if}/>
+ {if $myval.Type eq 'timestamp'}<em>jj/mm/aaaa hh:mm:ss</em>{/if}
+ {if $myval.Type eq 'time'}<em>hh:mm:ss</em>{/if}
{/if}
</td>
</tr>
- {/foreach}
+ {/if}{/foreach}
</table>
<p class="center">
</form>
<p>
-<a href="{$smarty.server.PHP_SELF}">back</a>
+<a href="{$t->pl}">back</a>
</p>
{/if}