function handler_default(&$page)
{
$page->changeTpl('admin/index.tpl');
- $page->setTitle('Polytechnique.org - Administration');
+ $page->setTitle('Administration');
}
function handler_postfix_delayed(&$page)
{
$page->changeTpl('admin/postfix_delayed.tpl');
- $page->setTitle('Polytechnique.org - Administration - Postfix : Retardés');
+ $page->setTitle('Administration - Postfix : Retardés');
if (Env::has('del')) {
$crc = Env::v('crc');
XDB::execute("UPDATE postfix_mailseen SET release = 'del' WHERE crc = {?}", $crc);
- $page->trigSuccess($crc." verra tous ses mails supprimés !");
+ $page->trigSuccess($crc." verra tous ses emails supprimés !");
} elseif (Env::has('ok')) {
$crc = Env::v('crc');
XDB::execute("UPDATE postfix_mailseen SET release = 'ok' WHERE crc = {?}", $crc);
function handler_postfix_regexpsbounces(&$page, $new = null) {
$page->changeTpl('admin/emails_bounces_re.tpl');
- $page->setTitle('Polytechnique.org - Administration - Postfix : Regexps Bounces');
+ $page->setTitle('Administration - Postfix : Regexps Bounces');
$page->assign('new', $new);
if (Post::has('submit')) {
$page->changeTpl('admin/logger-view.tpl');
- $page->setTitle('Polytechnique.org - Administration - Logs des sessions');
+ $page->setTitle('Administration - Logs des sessions');
}
function handler_user(&$page, $login = false)
{
global $globals;
$page->changeTpl('admin/utilisateurs.tpl');
- $page->setTitle('Polytechnique.org - Administration - Edit/Su/Log');
+ $page->setTitle('Administration - Edit/Su/Log');
require_once("emails.inc.php");
require_once("user.func.inc.php");
function handler_homonyms(&$page, $op = 'list', $target = null) {
$page->changeTpl('admin/homonymes.tpl');
- $page->setTitle('Polytechnique.org - Administration - Homonymes');
+ $page->setTitle('Administration - Homonymes');
require_once("homonymes.inc.php");
if ($target) {
function handler_ax_xorg(&$page) {
$page->changeTpl('admin/ax-xorg.tpl');
- $page->setTitle('Polytechnique.org - Administration - AX/X.org');
+ $page->setTitle('Administration - AX/X.org');
// liste des différences
$res = XDB::query(
function handler_deaths(&$page, $promo = 0, $validate = false) {
$page->changeTpl('admin/deces_promo.tpl');
- $page->setTitle('Polytechnique.org - Administration - Deces');
+ $page->setTitle('Administration - Deces');
if (!$promo)
$promo = Env::i('promo');
function handler_dead_but_active(&$page) {
$page->changeTpl('admin/dead_but_active.tpl');
- $page->setTitle('Polytechnique.org - Administration - Décédés');
+ $page->setTitle('Administration - Décédés');
$res = XDB::iterator(
"SELECT u.promo, u.nom, u.prenom, u.deces, u.matricule_ax, a.alias, DATE(MAX(s.start)) AS last
function handler_synchro_ax(&$page, $user = null, $action = null) {
$page->changeTpl('admin/synchro_ax.tpl');
- $page->setTitle('Polytechnique.org - Administration - Synchro AX');
+ $page->setTitle('Administration - Synchro AX');
require_once('synchro_ax.inc.php');
function handler_validate(&$page, $action = 'list', $id = null)
{
$page->changeTpl('admin/valider.tpl');
- $page->setTitle('Polytechnique.org - Administration - Valider une demande');
+ $page->setTitle('Administration - Valider une demande');
$page->addCssLink('nl.css');
$page->addJsLink('ajax.js');
require_once("validations.inc.php");
}
function handler_validate_answers(&$page, $action = 'list', $id = null) {
- $page->setTitle('Polytechnique.org - Administration - Réponses automatiques de validation');
+ $page->setTitle('Administration - Réponses automatiques de validation');
$page->assign('title', 'Gestion des réponses automatiques');
$table_editor = new PLTableEditor('admin/validate/answers','requests_answers','id');
$table_editor->describe('category','catégorie',true);
$table_editor->apply($page, $action, $id);
}
function handler_skins(&$page, $action = 'list', $id = null) {
- $page->setTitle('Polytechnique.org - Administration - Skins');
+ $page->setTitle('Administration - Skins');
$page->assign('title', 'Gestion des skins');
$table_editor = new PLTableEditor('admin/skins','skins','id');
$table_editor->describe('name','nom',true);
}
function handler_postfix_blacklist(&$page, $action = 'list', $id = null) {
- $page->setTitle('Polytechnique.org - Administration - Postfix : Blacklist');
+ $page->setTitle('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->apply($page, $action, $id);
}
function handler_postfix_whitelist(&$page, $action = 'list', $id = null) {
- $page->setTitle('Polytechnique.org - Administration - Postfix : Whitelist');
+ $page->setTitle('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_mx_broken(&$page, $action = 'list', $id = null) {
- $page->setTitle('Polytechnique.org - Administration - MX Défaillants');
+ $page->setTitle('Administration - MX Défaillants');
$page->assign('title', 'MX Défaillant');
$table_editor = new PLTableEditor('admin/mx/broken', 'mx_watch', 'host', true);
$table_editor->describe('host', 'Masque', true);
$table_editor->apply($page, $action, $id);
}
function handler_logger_actions(&$page, $action = 'list', $id = null) {
- $page->setTitle('Polytechnique.org - Administration - Actions');
+ $page->setTitle('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->apply($page, $action, $id);
}
function handler_downtime(&$page, $action = 'list', $id = null) {
- $page->setTitle('Polytechnique.org - Administration - Coupures');
+ $page->setTitle('Administration - Coupures');
$page->assign('title', 'Gestion des coupures');
$table_editor = new PLTableEditor('admin/downtime','coupures','id');
$table_editor->describe('debut','date',true);
$table_editor->apply($page, $action, $id);
}
- function handler_wiki(&$page, $action='list', $wikipage='', $wikipage2='')
+ function handler_wiki(&$page, $action = 'list', $wikipage = null, $wikipage2 = null)
{
- require_once 'wiki.inc.php';
-
if (S::v('core_rss_hash')) {
$page->setRssLink('Changement Récents',
'/Site/AllRecentChanges?action=rss&user=' . S::v('forlife') . '&hash=' . S::v('core_rss_hash'));
S::assert_xsrf_token();
$perms_read = Post::v('read');
- $perms_edot = Post::v('edit');
+ $perms_edit = Post::v('edit');
if ($perms_read || $perms_edit) {
- foreach ($_POST as $wiki_page => $val) if ($val == 'on') {
- $wiki_page = str_replace('_', '/', $wiki_page);
- if (!$perms_read || !$perms_edit)
- list($perms0, $perms1) = wiki_get_perms($wiki_page);
- if ($perms_read)
- $perms0 = $perms_read;
- if ($perms_edit)
- $perms1 = $perms_edit;
- wiki_set_perms($wiki_page, $perms0, $perms1);
+ foreach ($_POST as $wiki_page => $val) {
+ if ($val == 'on') {
+ $wp = new PlWikiPage(str_replace(array('_', '/'), '.', $wiki_page));
+ if ($wp->setPerms($perms_read ? $perms_read : $wp->readPerms(),
+ $perms_edit ? $perms_edit : $wp->writePerms())) {
+ $page->trigSuccess("Permission de la page $wiki_page mises à jour");
+ } else {
+ $page->trigError("Impossible de mettre les permissions de la page $wiki_page à jour");
+ }
+ }
}
}
- }
-
- if ($action == 'delete' && $wikipage != '') {
+ } else if ($action != 'list' && !empty($wikipage)) {
+ $wp = new PlWikiPage($wikipage);
S::assert_xsrf_token();
- if (wiki_delete_page($wikipage)) {
- $page->trigSuccess("La page ".$wikipage." a été supprimée.");
- } else {
- $page->trigError("Impossible de supprimer la page ".$wikipage.".");
- }
- }
-
- if ($action == 'rename' && $wikipage != '' && $wikipage2 != '' && $wikipage != $wikipage2) {
- S::assert_xsrf_token();
-
- if ($changedLinks = wiki_rename_page($wikipage, $wikipage2)) {
- $s = 'La page <em>'.$wikipage.'</em> a été déplacée en <em>'.$wikipage2.'</em>.';
- if (is_numeric($changedLinks)) {
- $s .= $changedLinks.' lien'.(($changedLinks>1)?'s ont été modifiés.':' a été modifié.');
+ if ($action == 'delete') {
+ if ($wp->delete()) {
+ $page->trigSuccess("La page ".$wikipage." a été supprimée.");
+ } else {
+ $page->trigError("Impossible de supprimer la page ".$wikipage.".");
+ }
+ } else if ($action == 'rename' && !empty($wikipage2) && $wikipage != $wikipage2) {
+ if ($changedLinks = $wp->rename($wikipage2)) {
+ $s = 'La page <em>'.$wikipage.'</em> a été déplacée en <em>'.$wikipage2.'</em>.';
+ if (is_numeric($changedLinks)) {
+ $s .= $changedLinks.' lien'.(($changedLinks>1)?'s ont été modifiés.':' a été modifié.');
+ }
+ $page->trigSuccess($s);
+ } else {
+ $page->trigError("Impossible de déplacer la page ".$wikipage);
}
- $page->trigSuccess($s);
- } else {
- $page->trigError("Impossible de déplacer la page ".$wikipage);
}
}
- $perms = wiki_perms_options();
+ $perms = PlWikiPage::permOptions();
// list wiki pages and their perms
- $wiki_pages = array();
- $dir = wiki_work_dir();
- if (is_dir($dir)) {
- if ($dh = opendir($dir)) {
- while (($file = readdir($dh)) !== false) if (substr($file,0,1) >= 'A' && substr($file,0,1) <= 'Z') {
- list($read,$edit) = wiki_get_perms($file);
- $wiki_pages[$file] = array('read' => $perms[$read], 'edit' => $perms[$edit]);
- if (is_file($dir . '/cache_' . wiki_filename($file) . '.tpl')) {
- $wiki_pages[$file]['cached'] = true;
- }
- }
- closedir($dh);
- }
- }
+ $wiki_pages = PlWikiPage::listPages();
ksort($wiki_pages);
$wiki_tree = array();
foreach ($wiki_pages as $file => $desc) {