bcom/discuts.php

44 lines
1.6 KiB
PHP

<?php
session_start ();
include_once 'includes/inter.php';
?><!DOCTYPE html><html><head>
<?php include 'includes/meta.php'; ?>
</head><body>
<?php include 'includes/header.php'; ?>
<br />
<?php
$discs = getDiscuts ();
$adminLevel = - 1;
if (isConnected ())
$adminLevel = getAdminLevel ();
foreach ( $discs as $disc ) {
if ($disc ['autorized'] === 'p' or
(preg_match ( "#^a[0-9]+$#", $disc ['autorized'] ) == 1) ? (intval ( substr ( $disc ['autorized'], 1 ) ) <= $adminLevel) : FALSE or
preg_match ( '#^x([0-9];)*' . $_SESSION ['session_id'] . '(;[0-9])*$#', $disc ['autorized'] ) == 1 or
$adminLevel >= 14) {
echo '<a href="discut.php?d=' . $disc ['ID'] . '">' . $disc ['name'] . ' par ' . getPseudoOf ( $disc ['creator_id'] ) . '</a><br/>';
}
}
?>
<br />
<?php if(isConnected() && getAdminLevel()>=2){?>
<span id="createNewDiscBefore">Creer une nouvelle discussion</span> <form id="createNewDiscForm" action="creating_discussion.php" method="post"> <label for="newDiscText"></label> <input id="newDiscText" type="text" name="name" /> <input type="submit" value="Cr&eacute;er la discussion" /> </form> <script type="text/javascript">
var span = document.getElementById('createNewDiscBefore');
span.addEventListener('click',function(){
document.getElementById('createNewDiscBefore').style.display = 'none';
document.getElementById('createNewDiscForm').style.display = 'block';
});
</script> <br /> <br />
<?php }?>
<?php include 'includes/footer.php'; ?>
</body></html>