Skip to content
Snippets Groups Projects
Commit 05cb8b80 authored by pyg77's avatar pyg77
Browse files

Merge pull request #8 from pascalchevrel/issue3-remove-get_server_name

enlève les appels à get_server_name() partout sauf dans un appel à sendM...
parents 51cefeb7 2e920a5e
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
<?php
<?php
//==========================================================================
//
//Université de Strasbourg - Direction Informatique
......@@ -10,10 +10,10 @@
//Ce logiciel est régi par la licence CeCILL-B soumise au droit français et
//respectant les principes de diffusion des logiciels libres. Vous pouvez
//utiliser, modifier et/ou redistribuer ce programme sous les conditions
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//sur le site "http://www.cecill.info".
//
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//pris connaissance de la licence CeCILL-B, et que vous en avez accepté les
//termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE.
//
......@@ -26,10 +26,10 @@
//borghesi@unistra.fr
//
//This software is governed by the CeCILL-B license under French law and
//abiding by the rules of distribution of free software. You can use,
//abiding by the rules of distribution of free software. You can use,
//modify and/ or redistribute the software under the terms of the CeCILL-B
//license as circulated by CEA, CNRS and INRIA at the following URL
//"http://www.cecill.info".
//"http://www.cecill.info".
//
//The fact that you are presently reading this means that you have had
//knowledge of the CeCILL-B license and that you accept its terms. You can
......@@ -37,16 +37,15 @@
//
//==========================================================================
// pour get_server_name()
include_once('fonctions.php');
function framanav()
{
if (file_exists($_SERVER['DOCUMENT_ROOT']."/framanav/nav.inc.html")) {
echo "\n".'<!-- Framanav --> '."\n";;
echo '<script src="/framanav/scripts/jquery.min.js" type="text/javascript"></script>'."\n";
include_once($_SERVER['DOCUMENT_ROOT']."/framanav/nav.inc.html");
echo '<!-- /Framanav --> '."\n";
echo "\n".'<!-- Framanav --> '."\n";;
echo '<script src="/framanav/scripts/jquery.min.js" type="text/javascript"></script>'."\n";
include_once($_SERVER['DOCUMENT_ROOT']."/framanav/nav.inc.html");
echo '<!-- /Framanav --> '."\n";
}
}
......@@ -73,7 +72,7 @@ function gAnalytics() {
function logo ()
{
if(defined('LOGOBANDEAU')) {
echo '<div class="logo"><img src="'.get_server_name().LOGOBANDEAU.'" height="74" alt="logo"></div>'."\n";
echo '<div class="logo"><img src="/' . LOGOBANDEAU . '" height="74" alt="logo"></div>'."\n";
}
}
......@@ -83,11 +82,11 @@ function bandeau_tete()
{
if ( IMAGE_TITRE ) {
echo '<div class="bandeau"><a href="'.get_server_name().'" title="Accueil '.NOMAPPLICATION.'"><img src="'.get_server_name().IMAGE_TITRE.'" title="Accueil '.NOMAPPLICATION.'" alt="'.NOMAPPLICATION.'"></a></div>'."\n";
echo '<div class="bandeau"><a href="/" title="Accueil '.NOMAPPLICATION.'"><img src="/' . IMAGE_TITRE. '" title="Accueil '.NOMAPPLICATION.'" alt="'.NOMAPPLICATION.'"></a></div>'."\n";
} else {
echo '<div class="bandeau"><a href="'.get_server_name().'" title="Accueil '.NOMAPPLICATION.'">'.NOMAPPLICATION.'</a></div>'."\n";
echo '<div class="bandeau"><a href="/" title="Accueil '.NOMAPPLICATION.'">'.NOMAPPLICATION.'</a></div>'."\n";
} ;
......@@ -104,12 +103,12 @@ function bandeau_titre($titre)
function liste_lang()
{
global $ALLOWED_LANGUAGES;
$str = '';
foreach ($ALLOWED_LANGUAGES as $k => $v ) {
$str .= '<a class="button small gray" href="' . $_SERVER['PHP_SELF'] . '?lang=' . $k . '">' . $v . '</a>' . "\n" ;
}
return $str;
}
......@@ -118,12 +117,12 @@ function liste_lang()
function sous_bandeau()
{
/*echo '<div class="sousbandeau">' .
'<a href="' . get_server_name() . 'index.php">'. _("Home") .'</a>' .
'<a href="/">'. _("Home") .'</a>' .
'<a href="' . getUrlSondage('aqg259dth55iuhwm').'">'. _("Example") .'</a>' .
'<a href="' . get_server_name() . 'contacts.php">'. _("Contact") .'</a>' .
//'<a href="' . get_server_name() . 'sources/sources.php">'. _("Sources") .'</a>' . //not implemented
'<a href="' . get_server_name() . 'apropos.php">'. _("About") .'</a>' .
'<a href="' . get_server_name() . 'admin/index.php">'. _("Admin") .'</a>' .
'<a href="/contacts.php">'. _("Contact") .'</a>' .
//'<a href="/sources/sources.php">'. _("Sources") .'</a>' . //not implemented
'<a href="/apropos.php">'. _("About") .'</a>' .
'<a href="/admin/index.php">'. _("Admin") .'</a>' .
'<span class="sousbandeau sousbandeaulangue">' .
liste_lang() . '</span>'.
'</div>' . "\n";*/
......@@ -133,25 +132,25 @@ function sous_bandeau()
function sous_bandeau_admin()
{
echo '<div class="sousbandeau">' .
'<a class="button small gray" href="' . get_server_name() . 'index.php">'. _("Home") .'</a>';
'<a class="button small gray" href="/">'. _("Home") .'</a>';
if(is_readable('logs_studs.txt')) {
echo '<a class="button small gray" href="' . get_server_name() . 'logs_studs.txt">'. _("Logs") .'</a>';
echo '<a class="button small gray" href="/logs_studs.txt">'. _("Logs") .'</a>';
}
echo '<a class="button small gray" href="' . get_server_name() . '../scripts/nettoyage_sondage.php">'. _("Cleaning") .'</a>' .
echo '<a class="button small gray" href="/../scripts/nettoyage_sondage.php">'. _("Cleaning") .'</a>' .
'<span class="sousbandeau sousbandeaulangue">' .
liste_lang() . '</span>'.
'</div>'."\n";
gAnalytics();
gAnalytics();
}
function sous_bandeau_choix()
{
/*echo '<div class="sousbandeau">' .
'<a href="' . get_server_name() . 'index.php">'. _("Home") .'</a>' .
'<a href="/">'. _("Home") .'</a>' .
'</div>'."\n";*/
}
......@@ -168,16 +167,16 @@ function bandeau_pied()
//echo '<div class="bandeaupied">'. _("Universit&eacute; de Strasbourg. Creation: Guilhem BORGHESI. 2008-2009") .'</div>'."\n";
echo '<div class="separateur">&nbsp;</div>';
echo '<div class="sousbandeau">' .
'<a class="button small gray" href="' . get_server_name() . 'index.php">'. _("Home") .'</a>' .
'<a class="button small gray" href="/">'. _("Home") .'</a>' .
'<a class="button small gray" href="' . getUrlSondage('aqg259dth55iuhwm').'">'. _("Example") .'</a>' .
'<a class="button small gray" href="' . get_server_name() . 'contacts.php">'. _("Contact") .'</a>' .
//'<a href="' . get_server_name() . 'sources/sources.php">'. _("Sources") .'</a>' . //not implemented
'<a class="button small gray" href="' . get_server_name() . 'apropos.php">'. _("About") .'</a>' .
//'<a class="button small gray" href="' . get_server_name() . 'admin/index.php">'. _("Admin") .'</a>' .
'<a class="button small gray" href="/contacts.php">'. _("Contact") .'</a>' .
//'<a href="/sources/sources.php">'. _("Sources") .'</a>' . //not implemented
'<a class="button small gray" href="/apropos.php">'. _("About") .'</a>' .
//'<a class="button small gray" href="/admin/index.php">'. _("Admin") .'</a>' .
'<span class="sousbandeau sousbandeaulangue">' .
liste_lang() . '</span>'.
'</div>' . "\n";
gAnalytics();
gAnalytics();
}
......@@ -187,14 +186,14 @@ function bandeau_pied_mobile()
'<div class="bandeaupiedmobile">'. _("Universit&eacute; de Strasbourg. Creation: Guilhem BORGHESI. 2008-2009") .'</div>'."\n";*/
echo '<div class="separateur">&nbsp;</div>';
echo '<div class="sousbandeau">' .
'<a class="button small gray" href="' . get_server_name() . 'index.php">'. _("Home") .'</a>' .
'<a class="button small gray" href="/">'. _("Home") .'</a>' .
'<a class="button small gray" href="' . getUrlSondage('aqg259dth55iuhwm').'">'. _("Example") .'</a>' .
'<a class="button small gray" href="' . get_server_name() . 'contacts.php">'. _("Contact") .'</a>' .
//'<a href="' . get_server_name() . 'sources/sources.php">'. _("Sources") .'</a>' . //not implemented
'<a class="button small gray" href="' . get_server_name() . 'apropos.php">'. _("About") .'</a>' .
//'<a class="button small gray" href="' . get_server_name() . 'admin/index.php">'. _("Admin") .'</a>' .
'<a class="button small gray" href="/contacts.php">'. _("Contact") .'</a>' .
//'<a href="/sources/sources.php">'. _("Sources") .'</a>' . //not implemented
'<a class="button small gray" href="/apropos.php">'. _("About") .'</a>' .
//'<a class="button small gray" href="/admin/index.php">'. _("Admin") .'</a>' .
'<span class="sousbandeau sousbandeaulangue">' .
liste_lang() . '</span>'.
'</div>' . "\n";
gAnalytics();
gAnalytics();
}
......@@ -10,10 +10,10 @@
//Ce logiciel est régi par la licence CeCILL-B soumise au droit français et
//respectant les principes de diffusion des logiciels libres. Vous pouvez
//utiliser, modifier et/ou redistribuer ce programme sous les conditions
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//sur le site "http://www.cecill.info".
//
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//pris connaissance de la licence CeCILL-B, et que vous en avez accepté les
//termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE.
//
......@@ -26,10 +26,10 @@
//borghesi@unistra.fr
//
//This software is governed by the CeCILL-B license under French law and
//abiding by the rules of distribution of free software. You can use,
//abiding by the rules of distribution of free software. You can use,
//modify and/ or redistribute the software under the terms of the CeCILL-B
//license as circulated by CEA, CNRS and INRIA at the following URL
//"http://www.cecill.info".
//"http://www.cecill.info".
//
//The fact that you are presently reading this means that you have had
//knowledge of the CeCILL-B license and that you accept its terms. You can
......@@ -78,7 +78,7 @@ $PDF->Text(140,240,utf8_decode($dsondage->nom_admin));
$PDF->SetFont('Arial','B',8);
// TODO: translate
$PDF->Text(35,275,"Cette lettre de convocation a été générée automatiquement par ".NOMAPPLICATION." sur ".get_server_name());
$PDF->Text(35,275,"Cette lettre de convocation a été générée automatiquement par ".NOMAPPLICATION." sur ". $_SERVER['SERVER_NAME']);
//Sortie
$PDF->Output();
......@@ -10,10 +10,10 @@
//Ce logiciel est régi par la licence CeCILL-B soumise au droit français et
//respectant les principes de diffusion des logiciels libres. Vous pouvez
//utiliser, modifier et/ou redistribuer ce programme sous les conditions
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//sur le site "http://www.cecill.info".
//
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//pris connaissance de la licence CeCILL-B, et que vous en avez accepté les
//termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE.
//
......@@ -26,10 +26,10 @@
//borghesi@unistra.fr
//
//This software is governed by the CeCILL-B license under French law and
//abiding by the rules of distribution of free software. You can use,
//abiding by the rules of distribution of free software. You can use,
//modify and/ or redistribute the software under the terms of the CeCILL-B
//license as circulated by CEA, CNRS and INRIA at the following URL
//"http://www.cecill.info".
//"http://www.cecill.info".
//
//The fact that you are presently reading this means that you have had
//knowledge of the CeCILL-B license and that you accept its terms. You can
......@@ -53,47 +53,35 @@ function connexion_base()
return $DB;
}
function get_server_name()
{
$scheme = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https' : 'http';
$get = explode('/', dirname($_SERVER["SCRIPT_NAME"]));
$folder = explode('/', str_replace('\\', '/', dirname(__FILE__)));
$communs = array_intersect($get, $folder);
$base = implode('/', $communs);
$url = sprintf("%s://%s%s", $scheme, STUDS_URL, $base);
if (!preg_match("|/$|", $url)) {
$url = $url."/";
}
return $url;
$scheme = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http';
return $scheme . '//' . $_SERVER['SERVER_NAME'] . '/';
}
function get_sondage_from_id($id)
{
global $connect;
// Ouverture de la base de données
if(preg_match(";^[\w\d]{16}$;i",$id)) {
$sql = 'SELECT sondage.*,sujet_studs.sujet FROM sondage
LEFT OUTER JOIN sujet_studs ON sondage.id_sondage = sujet_studs.id_sondage
WHERE sondage.id_sondage = '.$connect->Param('id_sondage');
$sql = $connect->Prepare($sql);
$sondage=$connect->Execute($sql, array($id));
if ($sondage === false) {
return false;
}
$psondage = $sondage->FetchObject(false);
$psondage->date_fin = strtotime($psondage->date_fin);
return $psondage;
}
return false;
}
......@@ -104,7 +92,7 @@ function is_error($cerr)
if ( $err == 0 ) {
return false;
}
return (($err & $cerr) != 0 );
}
......@@ -129,9 +117,9 @@ function print_header($js = false, $nom_sondage = '')
<title>'.NOMAPPLICATION.'</title>';
}
echo '
<link rel="stylesheet" type="text/css" href="'.get_server_name().'style.css">
<link rel="stylesheet" type="text/css" href="'.get_server_name().'print.css" media="print">';
<link rel="stylesheet" type="text/css" href="/style.css">
<link rel="stylesheet" type="text/css" href="/print.css" media="print">';
echo '</head>';
}
......@@ -157,7 +145,7 @@ function check_table_sondage()
function validateEmail($email)
{
$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';
return (bool)preg_match($pattern, $email);
}
......@@ -206,7 +194,7 @@ function issetAndNoEmpty($name, $tableau = null)
if ($tableau === null) {
$tableau = $_POST;
}
return (isset($tableau[$name]) === true && empty($tableau[$name]) === false);
}
......@@ -232,7 +220,7 @@ function getUrlSondage($id, $admin = false)
$url = get_server_name().'studs.php?sondage='.$id;
}
}
return $url;
}
......
......@@ -10,10 +10,10 @@
//Ce logiciel est régi par la licence CeCILL-B soumise au droit français et
//respectant les principes de diffusion des logiciels libres. Vous pouvez
//utiliser, modifier et/ou redistribuer ce programme sous les conditions
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//sur le site "http://www.cecill.info".
//
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//pris connaissance de la licence CeCILL-B, et que vous en avez accepté les
//termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE.
//
......@@ -26,10 +26,10 @@
//borghesi@unistra.fr
//
//This software is governed by the CeCILL-B license under French law and
//abiding by the rules of distribution of free software. You can use,
//abiding by the rules of distribution of free software. You can use,
//modify and/ or redistribute the software under the terms of the CeCILL-B
//license as circulated by CEA, CNRS and INRIA at the following URL
//"http://www.cecill.info".
//"http://www.cecill.info".
//
//The fact that you are presently reading this means that you have had
//knowledge of the CeCILL-B license and that you accept its terms. You can
......@@ -72,7 +72,7 @@ echo '<div class=corps>'."\n";
#echo '<p>'. _("Making polls to schedule meetings or events, quickly and easily. <br> You can also run polls to determine what will be your next meeting place, the meeting topic or anything like the country you would like to visit during your next holidays.") .'</p>'."\n".'<br>'."\n";
#echo '<div class="nouveau_sondage"><b>'. _("Make a poll") .'</b>';
# '<span>' .
# '<a href="' . get_server_name() . 'infos_sondage.php"><img alt="' . _('Make a poll') . '" src="images/next-32.png" /></a>' .
# '<a href="/infos_sondage.php"><img alt="' . _('Make a poll') . '" src="images/next-32.png" /></a>' .
# '</span>';
#echo '</div>' . "\n";
......@@ -97,4 +97,4 @@ echo '</form>'."\n";
bandeau_pied();
echo '</body>'."\n";
echo '</html>'."\n";
\ No newline at end of file
echo '</html>'."\n";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment