Daijoubuv2/acp.php

227 lines
7.0 KiB
PHP
Raw Permalink Blame History

<?php
session_start();
require_once('libs/lib.php'); //global used fonctions
@include('config.php'); //configuration file generated by install.php
if(!defined('CONFIG')) exit(setup());
clean_token(); //Destroy tokens for more security
if( !isset($_GET['crk']) )
clean_add_token();
elseif( isset($_GET['crk']) AND $_GET['crk'] != "addrelease" )
clean_add_token();
$wrong = '';
if(isset($_POST['pass']))
{
if($_POST['pass'] == $config['pass'])
{
$_SESSION['pass'] = $config['pass'];
}
else
{
$wrong = '<font color="red">Wrong Password !</font>';
}
}
ob_start();
if(isset($_SESSION['pass']) && $_SESSION['pass'] == $config['pass'])
{
define('ACPPAGE', true);
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" type="text/css" href="design/default.css" media="screen,projection" />
<link rel="alternate" type="application/rss+xml" title="<?php echo $config['team']; ?> Releases RSS Feed" href="rss.xml" />
<link rel="shortcut icon" href="design/favicon.ico" />
<title><?php echo $config['team']; ?> Release Portal</title>
<script>
function inputClick(valeur, obj)
{
if(valeur == obj.value) obj.value = '';
}
function getXhr()
{
var xhr = null;
if(window.XMLHttpRequest) // Firefox et autres
xhr = new XMLHttpRequest();
else if(window.ActiveXObject){ // Internet Explorer
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xhr;
}
function change(id)
{
document.getElementById('update' + id).style.display = 'inline';
document.getElementById('button' + id).value = "save";
}
function saverow(id)
{
var xhr = getXhr();
var name = document.getElementById('name' + id).value;
var url = document.getElementById('url' + id).value;
var fansuber = document.getElementById('fansuber' + id).value;
var token = document.getElementById('token').value;
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4 && xhr.status == 200){
document.getElementById('button' + id).value = "saved";
}
}
xhr.open("GET","acpajax.php?id=" + encodeURI(id) + "&name=" + encodeURI(name) + "&url=" + encodeURI(url) + "&fansuber=" + encodeURI(fansuber) + "&token=" + encodeURI(token),true);
xhr.send(null);
xhr.open("GET","acpajax.php?id=" + encodeURI(id) + "&name=" + encodeURI(name) + "&url=" + encodeURI(url) + "&fansuber=" + encodeURI(fansuber) + "&token=" + encodeURI(token),true);
xhr.send(null);
}
function delrow(id)
{
var xhr = getXhr();
var name = document.getElementById('name' + id).value;
var url = document.getElementById('url' + id).value;
var fansuber = document.getElementById('fansuber' + id).value;
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4 && xhr.status == 200){
document.getElementById('update' + id).style.display = 'none';
document.getElementById('sure' + id).style.display = 'inline';
}
}
xhr.open("GET","acpajax.php",true);
xhr.send(null);
}
function delrowsure(id)
{
var xhr = getXhr();
var name = document.getElementById('name' + id).value;
var url = document.getElementById('url' + id).value;
var fansuber = document.getElementById('fansuber' + id).value;
var hide = document.getElementById('hide' + id).value;
var token = document.getElementById('token').value;
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4 && xhr.status == 200){
document.getElementById('sure' + id).style.display = 'none';
document.getElementById('hide' + id).style.display = 'none';
}
}
xhr.open("GET","acpajax.php?id=" + encodeURI(id) + "&name=" + encodeURI(name) + "&url=" + encodeURI(url) + "&fansuber=" + encodeURI(fansuber) + "&token=" + encodeURI(token) + "&delete",true);
xhr.send(null);
xhr.open("GET","acpajax.php?id=" + encodeURI(id) + "&name=" + encodeURI(name) + "&url=" + encodeURI(url) + "&fansuber=" + encodeURI(fansuber) + "&token=" + encodeURI(token) + "&delete",true);
xhr.send(null);
}
function notsure(id)
{
var xhr = getXhr();
var name = document.getElementById('name' + id).value;
var url = document.getElementById('url' + id).value;
var fansuber = document.getElementById('fansuber' + id).value;
var hide = document.getElementById('hide' + id).value;
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4 && xhr.status == 200){
document.getElementById('update' + id).style.display = 'inline';
document.getElementById('sure' + id).style.display = 'none';
}
}
xhr.open("GET","acpajax.php",true);
xhr.send(null);
}
</script>
</head>
<body>
<div id="contentwrapper">
<div id="banner"><img src="<?php
$bannersListe = directoryToArray('design/banners'); //R<>cup<75>re la liste des banni<6E>res
$rand = mt_rand( 0 , count($bannersListe)-1 ); //Choisir une banni<6E>re au hasard
echo $bannersListe[$rand];
unset($bannersListe, $rand);
?>" alt="banniere" /></div>
<div id="menu">
<ul>
<li><a href="index.php?crk=releases">[ &#1103;eleases ]</a></li>
<li><a href="acp.php?crk=modifabout">[ Edit About ]</a></li>
<li><a href="acp.php?crk=addrelease">[ Add a &#1103;elease ]</a></li>
<li><a href="acp.php?crk=modifrlz">[ Edit &#1103;eleases ]</a></li>
<li><a href="acp.php?crk=delrelease">[ Delete &#1103;eleases ]</a></li>
<li><a href="acp.php?crk=rss">[ Update RSS feed ]</a></li>
<li><a href="acp.php?crk=editconfig">[ Edit Configuration File ]</a></li>
<li><a href="acp.php?crk=uninstall">[ Uninstall CMS ]</a></li>
<li><a href="acp.php?crk=about">[ About ]</a></li>
<li><a href="acp.php?crk=logout">[ Logout ]</a></li>
</ul>
</div>
<div id="maincontent"><?php
if(!empty($_GET['crk']))
{
$file = CleanVar($_GET['crk']);
if( file_exists ( 'acp/' . $file . '.php' ) )
require_once( 'acp/' . $file . '.php' );
else
include_once( 'bugslogger.php' );
}
else
require_once('acp/accueil.php');
?></div>
<div id="footer">
<p><?php echo $config['team']; ?> &#1071;elease Portal v0.2.7</p>
<p>&copy; <?php echo date('Y'), ' ', $config['team']; ?></p>
</div>
</div>
</body>
</html>
<?php
}
else
{
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="design/default.css" media="screen,projection" />
<link rel="shortcut icon" href="design/favicon.ico" />
<title><?php echo $config['team']; ?> Release Portal</title>
</head>
<body>
<div id="maincontent" style="float:none; margin:auto">
<br /><br /><hr />
<form action="acp.php" method="post">
<center>Password</center>
<center><input type="password" name="pass" /></center>
<center><input type="submit" value="Enter"/></center>
</form>
<center><?php echo $wrong; ?></center>
<hr />
</div>
</body>
</html><?php
}
ob_end_flush();