This commit is contained in:
Michael RICOIS 2011-01-12 08:38:01 +00:00
commit c3223526aa
10 changed files with 171 additions and 9 deletions

View File

@ -57,6 +57,10 @@ if (in_array(ENVIRONNEMENT, array('REC', 'DEV'))) {
} else {
define ('WEBSERVICE_URL','http://78.31.45.206:8088/ws/');
define ('WEBSERVICE_URI','http://78.31.45.206:8088/');
/*
define ('WEBSERVICE_URL','http://88.162.202.159:8080/ws/');
define ('WEBSERVICE_URI','http://88.162.202.159:8080/ws');
*/
}
//Webservice INFOGREFFE
define ('INFOGREFFE_WS_URL','https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE');

View File

@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS `maintenance` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mode` int(11) NOT NULL,
`message` int(11) NOT NULL,
`countMaintenance` int(11) NOT NULL,
`dateEven` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1

View File

@ -6,7 +6,7 @@ if ( hasPref('news') ){
require_once ('XML/RSS.php');
$url = 'http://news.google.fr/news?hl=fr&ned=fr&q='.
urlencode('"'.$etab['Nom'].'"').'&output=rss';
$firephp->log($url, 'url');
FB::log($url, 'url');
$rss = new XML_RSS($url);
$rss->parse();
$tabMonth = array('Jan' => 1, 'Feb' => 2, 'Mar' => 3, 'Apr' => 4,
@ -16,8 +16,8 @@ if ( hasPref('news') ){
foreach ($rss->getItems() as $i=>$item) {
if ($i == 0) {
?>
<span class="StyleInfoLib">Information presse (Source Google News &copy;)</span><br/>
<ul>
<span class="StyleInfoLib">Information presse (Source Google News &copy;)</span><br/>
<ul>
<?php
}
$tmp=explode(', ', $item['pubdate']);
@ -25,13 +25,19 @@ if ( hasPref('news') ){
$tabTime = explode(':', $tabDate[3]);
$pubDate = date('d/m/Y à H:i', gmmktime($tabTime[0]-1, $tabTime[1], $tabTime[2], $tabMonth[$tabDate[1]], $tabDate[0], $tabDate[2]));
$titre = $item['title'];
echo '<li><a href="' . $item['link'] . '" target="_blank">Le '. $pubDate ." - $titre</a></li>";
?>
<li>
<a href="<?php echo $item['link'];?>" target="_blank">
Le <?php echo $pubDate;?> - <?php echo $titre;?>
</a>
</li>
<?php
$i++; if ($i==15) break;
}
if ($i>0)
{
?>
</ul>
</ul>
<?php
}
}

View File

@ -0,0 +1,93 @@
<?php
function maintenanceActive()
{
if (!maintenanceMode()){
$link = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
if (!$link) {
return false;
}
$sql = "INSERT INTO sdv1.maintenance (mode, countMaintenance, dateEven) ".
"VALUES (1, 0, '".date('Y-m-d H:i:s')."')";
if (mysql_query($sql, $link)){
return true;
}
}
return false;
}
function maintenanceDesactive()
{
if(maintenanceMode()){
$link = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
if (!$link) {
return false;
}
$sql = "INSERT INTO sdv1.maintenance (mode, countMaintenance, dateEven) ".
"VALUES (0, 0, '".date('Y-m-d H:i:s')."')";
if (mysql_query($sql, $link)){
return true;
}
}
return false;
}
function maintenanceMode($error = false)
{
$countEvenMax = 70;
$link = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
if (!$link) {
return false;
}
$sql = 'SELECT * FROM sdv1.maintenance ORDER BY dateEven DESC, LIMIT 1';
$result = mysql_query($sql, $link);
if (!$result) {
return false;
}
if (mysql_num_rows($result) == 0){
return false;
}
$info = mysql_fetch_assoc($result);
if ($info[0]['countMaintenance']>=$countEventMax || $info[0]['mode']==1){
if ($error &&
$info[0]['countMaintenance']>=$countEventMax && $info[0]['mode']==0)
{
$sql = "UPDATE sdv1.maintenance SET mode=1, ".
"dateEven=".date('Y-m-d H:i:s').
" WHERE ".$info[0]['id'];
if (mysql_query($sql, $link)){
return true;
}
}
return true;
}
return false;
}
function maintenanceIncrement()
{
$link = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
if (!$link) {
return false;
}
$sql = 'SELECT id FROM sdv1.maintenance ORDER BY dateEven DESC, LIMIT 1';
$result = mysql_query($sql, $link);
if (!$result) {
return false;
}
if (mysql_num_rows($result)==0){
$sql = "INSERT INTO sdv1.maintenance (mode, countMaintenance, dateEven) ".
"VALUES (0, 0, '".date('Y-m-d H:i:s')."')";
$result = mysql_query($sql, $link);
}
$info = mysql_fetch_assoc($result);
$sql = "UPDATE sdv1.maintenance SET countMaintenance=countMaintenance+1, ".
"dateEven=".date('Y-m-d H:i:s');
" WHERE ".$info[0]['id'];
if (mysql_query($sql, $link)){
return true;
}
return false;
}

View File

@ -89,8 +89,10 @@ switch ( $subaction ) {
FB::log($idanResult, 'result');
//Limitation des événements
$eventLimits = array('5500');
foreach ( $eventLimits as $eventLimit ) {
if ( in_array($eventLimit, $idanResult['even']) && $idanResult['source']=='JT' ) {
foreach ( $eventLimits as $eventLimit )
{
if ( in_array($eventLimit, $idanResult['even']) && in_array($idanResult['source'], array('JT', 'ANTE')))
{
echo '<link rel="stylesheet" type="text/css" media="all" href="css/saisie.css"/>';
echo '<script type="text/javascript" src="js/saisieajax.js"></script>';
echo '<form id="saisie" name="saisie" action="/?page=saisieajax&q=annonces/edit" method="post">';

View File

@ -20,6 +20,8 @@ function processSoapFault($clientSoap, $fault, $tabInfo, $debug = FALSE){
global $firephp;
//maintenanceMode(true);
$message = 'Request : '. $clientSoap->__getLastRequest() . '\n\n' .
'Response : '.$clientSoap->__getLastResponse() . '\n\n';

View File

@ -7,6 +7,7 @@ require_once '../config/prepend.php';
require_once 'index.fct.php';
require_once 'fwk.php';
require_once 'default/_includes/mysql.php';
require_once 'maintenance/maintenance.php';
require_once 'index_auth.php';
require_once 'user/user.php';

View File

@ -1,5 +1,10 @@
<?php
/*
if (maintenanceMode()) {
require_once 'maintenance.php';
exit;
}
*/
$cle_cookie = 'sdjglsdkhmsoL68';
// Connection Login/IP
@ -241,6 +246,8 @@ if ((isset($_REQUEST['action']) && $_REQUEST['action'] == 'logon') ||
//Erreur SOAP
catch (SoapFault $fault)
{
//maintenanceMode(true);
if($fault->faultcode!='900')
{
require_once 'soaperror.php';

View File

@ -1,3 +1,3 @@
<?php
header('Location: '.EXTRANET_URL.'?page=main&action=logon&login=testreunica&checkIp=only');
header('Location: '.EXTRANET_URL.'?page=main&action=logon&login=testreunica&checkIp=only');
?>

39
www/maintenance.php Normal file
View File

@ -0,0 +1,39 @@
<?php
/*
Si la page est appellée directement avec les paramètres suivant
Placer en mode maintenance // toujours avant que cela ne fonctionne plus ?
maintenance.php?active&login=user&pass=password
Supprimer le mode maintenance
maintenance.php?desactive&login=user&pass=password
*/
//Affichage message de maintenance
$title = "Maintenance";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=CHARSET?>" />
<title>Extranet Scores &amp; D&eacute;cisions - <?=$title?></title>
</head>
<body>
<div id="container">
<div id="left"></div>
<div id="content">
<div id="page">
<div id="center">
Maintenance en cours...<br/>
Le service est momentanément indisponible.<br/>
</div>
<div id="footer">
<?php include('pagefooter.php');?>
</div>
</div> <!-- //page -->
</div> <!-- //content -->
</div> <!-- //container -->
</body>
</html>