Files
qcmmaker/current_version/index.php

156 lines
5.9 KiB
PHP
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/*
* Copyright (C) 2010 Francois Lutran.
*
* 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 3 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, see http://www.gnu.org/licenses/gpl.html.
*/
/* First page on load */
//connection
session_start();
$sScriptStartTime = microtime();
require_once('config.php');
$oConnection = connection();
//clean data
cleanPost($_POST);
cleanPost($_GET);
cleanPost($_REQUEST);
//Page Management
$sRequestedPage = isset($_GET['page'])?$_GET['page']:DEFAULT_LOGGED_PAGE;
$sPage = pageAccessManagement($sRequestedPage);
$sPagePath = $sPage.'.php';
//Admin
$bConnected = checkSession();
$iUserId = $bConnected?$_SESSION['user']:false;
$bAdmin = isAdmin();
//display header
$asGeneralDisplay['beta'] = ($bAdmin && IS_BETA)?getA('?page=version', '&beta;', 'Envoyer un feedback', 'beta rounded'):'';
//display info
$sPageDesc = getPageDescription($sPage);
$asInfoDisplay['title'] = getHtml($sPageDesc, 'p', 'pageTitle rounded');
$asInfoDisplay['search'] = '';
if($bAdmin)
{
$asInfoDisplay['search'] = '<form name="search" method="post" action="?page=search" onSubmit="this.elements[\'keywords\'].value = concatenateKeyWords(this.elements[\'keywords\'].value);">
Recherche <input type="text" name="keywords" style="border-color:black;" value="'.(isset($_REQUEST['keywords'])?str_replace('+', ' ', $_REQUEST['keywords']):'').'" />
</form>';
}
$sConnectedUser = $bConnected?'Connect&eacute; : '.getHtml(ucwords($_SESSION['firstName'].' '.$_SESSION['lastName']), 'strong'):'Non connect&eacute;';
$asInfoDisplay['connectedUser'] = getHtml($sConnectedUser, 'p', 'connectedUser rounded');
$asGeneralDisplay['info'] = getHtml(getHtml(getHtml($asInfoDisplay, 'td', 'blank', 'padding:0;width:33%;'), 'tr'), 'table', 'maxWidth', 'border-spacing:0;');
//display browser warning
if(getBrowser() == 'msie')
{
$asGeneralDisplay['main']['browser'] = getWarning(array('Le navigateur Internet Explorer est d&eacute;conseill&eacute; pour cette application',
'Nous vous conseillons un navigateur optimis&eacute; (et gratuit) tel que
<a href="http://www.mozilla-europe.org/fr/firefox/" title="T&eacute;l&eacute;charger Firefox">Firefox</a>'));
}
/**
* Get included file
* Available variables within file:
* $bNoTemplate Boolean Display the application template
* $oConnection Object Database connection handle
* $iUserId Integer User Id (===false is not connected)
* $bAdmin Boolean Is the current user an admin
* $sPage String Page displayed
* $sScriptStartTime String  Time at which the script started to be executed
*/
$bNoTemplate = false;
ob_start();
require_once($sPagePath);
$asGeneralDisplay['main']['file'] = ob_get_clean();
//display message
$asGeneralDisplay['message'] = getCleanMessage();
if($bAdmin && $sPage==DEFAULT_LOGGED_PAGE)
{
$asGeneralDisplay['message'] .= getCleanPublication($iUserId);
}
//display included file
if($bNoTemplate)
{
echo $asGeneralDisplay['main']['file'];
die();
}
//display Menu
$asGeneralDisplay['menu'] = getMenu($sPage, $bAdmin);
//display footer
$sLogLink = 'Version '.CURRENT_VERSION;
$asGeneralDisplay['rss'] = '';
if($bAdmin)
{
$sLogLink = getA('?page=version', $sLogLink, 'changelog et t&eacute;l&eacute;chargement');
$asGeneralDisplay['rss'] = getHtml(getA('?page=rss', getImage('images/feedIcon.png', 'flux rss'), 'flux rss'), 'p');
}
$asGeneralDisplay['version'] = $sLogLink;
//close SQL connection
if($oConnection)
{
mysql_close($oConnection);
}
//combine main part
$asGeneralDisplay['main'] = $asGeneralDisplay['message']."\n".implode("\n", $asGeneralDisplay['main']);
?>
<!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=utf-8" />
<meta name="author" content="Franzz" />
<link href="style.css" rel="stylesheet" type="text/css" />
<!--[if IE]>
<link href="styleIe.css" rel="stylesheet" type="text/css" />
<![endif]-->
<script type="text/javascript" src="functions.js"></script>
<link rel="shortcut icon" href="images/favicon.ico" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="?page=rss"/>
<title>QCM - <?php echo $sPageDesc; ?></title>
</head>
<body id="top">
<img src="images/button_gradient_hover.gif" class="preload" alt="preloaded image" />
<img src="images/qcm_selection_hover.gif" class="preload" alt="preloaded image" />
<div id="layer" class="layer" style="display:none;"></div>
<?php echo $asGeneralDisplay['beta']; ?>
<div id="header" class="rounded">
<h1>&Eacute;valuation par <span class="logo">Q</span>CM</h1>
<h3>Coll&egrave;ge International</h3>
</div>
<div id="topMenu"><?php echo $asGeneralDisplay['menu']; ?></div>
<div id="main" class="rounded">
<div id="info"><?php echo $asGeneralDisplay['info']; ?></div>
<?php echo $asGeneralDisplay['main']; ?>
</div>
<div id="footer">
<p>
Page charg&eacute;e en <?php echo getElapsedTime($sScriptStartTime); ?> seconde(s). Application r&eacute;alis&eacute;e par M. Lutran pour le coll&egrave;ge International de Fontainebleau.
<br />Projet sous licence <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GPLv3</a>. <?php echo $asGeneralDisplay['version']; ?>
</p>
<?php echo $asGeneralDisplay['rss']; ?>
</div>
</body>
</html>