enlève les appels à get_server_name() partout sauf dans un appel à sendMail(), réécriture de la fonction pour cet usage

This commit is contained in:
pascalc 2013-03-04 19:46:06 +01:00
parent 51cefeb7f9
commit 2e920a5e56
5 changed files with 190 additions and 203 deletions

View File

@ -324,7 +324,7 @@ if (isset($_POST["confirmesuppression"]) || isset($_POST["confirmesuppression_x"
echo '<div class="corps corpscentre">'."\n"; echo '<div class="corps corpscentre">'."\n";
print "<H2>" . _("Your poll has been removed!") . "</H2><br><br>"; print "<H2>" . _("Your poll has been removed!") . "</H2><br><br>";
print _("Back to the homepage of ") . ' <a href="'.get_server_name().'index.php"> '.NOMAPPLICATION.'</a>.'."\n"; print _("Back to the homepage of ") . ' <a href="/"> '.NOMAPPLICATION.'</a>.'."\n";
echo '<br><br><br>'."\n"; echo '<br><br><br>'."\n";
echo '</div>'."\n"; echo '</div>'."\n";
sur_bandeau_pied(); sur_bandeau_pied();
@ -1208,7 +1208,7 @@ echo _("Remove your poll") .' : <input type="image" name="suppressionsondage" va
echo '</form>'."\n"; echo '</form>'."\n";
if ($dsondage->format == "D" || $dsondage->format == "D+") { if ($dsondage->format == "D" || $dsondage->format == "D+") {
echo '<form name="formulaire2" action="'.get_server_name().'exportpdf.php" method="POST" onkeypress="javascript:process_keypress(event)" class="formulaire2">'."\n"; echo '<form name="formulaire2" action="/exportpdf.php" method="POST" onkeypress="javascript:process_keypress(event)" class="formulaire2">'."\n";
echo _("Generate the convocation letter (.PDF), choose the place to meet and validate") .'<br>'; echo _("Generate the convocation letter (.PDF), choose the place to meet and validate") .'<br>';
echo '<input type="text" name="lieureunion" size="100" value="" />'; echo '<input type="text" name="lieureunion" size="100" value="" />';
echo '<input type="hidden" name="sondage" value="$numsondageadmin" />'; echo '<input type="hidden" name="sondage" value="$numsondageadmin" />';

View File

@ -37,7 +37,6 @@
// //
//========================================================================== //==========================================================================
// pour get_server_name()
include_once('fonctions.php'); include_once('fonctions.php');
function framanav() function framanav()
@ -73,7 +72,7 @@ function gAnalytics() {
function logo () function logo ()
{ {
if(defined('LOGOBANDEAU')) { 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 ) { 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 { } 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";
} ; } ;
@ -118,12 +117,12 @@ function liste_lang()
function sous_bandeau() function sous_bandeau()
{ {
/*echo '<div class="sousbandeau">' . /*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="' . getUrlSondage('aqg259dth55iuhwm').'">'. _("Example") .'</a>' .
'<a href="' . get_server_name() . 'contacts.php">'. _("Contact") .'</a>' . '<a href="/contacts.php">'. _("Contact") .'</a>' .
//'<a href="' . get_server_name() . 'sources/sources.php">'. _("Sources") .'</a>' . //not implemented //'<a href="/sources/sources.php">'. _("Sources") .'</a>' . //not implemented
'<a href="' . get_server_name() . 'apropos.php">'. _("About") .'</a>' . '<a href="/apropos.php">'. _("About") .'</a>' .
'<a href="' . get_server_name() . 'admin/index.php">'. _("Admin") .'</a>' . '<a href="/admin/index.php">'. _("Admin") .'</a>' .
'<span class="sousbandeau sousbandeaulangue">' . '<span class="sousbandeau sousbandeaulangue">' .
liste_lang() . '</span>'. liste_lang() . '</span>'.
'</div>' . "\n";*/ '</div>' . "\n";*/
@ -133,13 +132,13 @@ function sous_bandeau()
function sous_bandeau_admin() function sous_bandeau_admin()
{ {
echo '<div class="sousbandeau">' . 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')) { 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">' . '<span class="sousbandeau sousbandeaulangue">' .
liste_lang() . '</span>'. liste_lang() . '</span>'.
'</div>'."\n"; '</div>'."\n";
@ -151,7 +150,7 @@ function sous_bandeau_admin()
function sous_bandeau_choix() function sous_bandeau_choix()
{ {
/*echo '<div class="sousbandeau">' . /*echo '<div class="sousbandeau">' .
'<a href="' . get_server_name() . 'index.php">'. _("Home") .'</a>' . '<a href="/">'. _("Home") .'</a>' .
'</div>'."\n";*/ '</div>'."\n";*/
} }
@ -168,12 +167,12 @@ function bandeau_pied()
//echo '<div class="bandeaupied">'. _("Universit&eacute; de Strasbourg. Creation: Guilhem BORGHESI. 2008-2009") .'</div>'."\n"; //echo '<div class="bandeaupied">'. _("Universit&eacute; de Strasbourg. Creation: Guilhem BORGHESI. 2008-2009") .'</div>'."\n";
echo '<div class="separateur">&nbsp;</div>'; echo '<div class="separateur">&nbsp;</div>';
echo '<div class="sousbandeau">' . 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="' . getUrlSondage('aqg259dth55iuhwm').'">'. _("Example") .'</a>' .
'<a class="button small gray" href="' . get_server_name() . 'contacts.php">'. _("Contact") .'</a>' . '<a class="button small gray" href="/contacts.php">'. _("Contact") .'</a>' .
//'<a href="' . get_server_name() . 'sources/sources.php">'. _("Sources") .'</a>' . //not implemented //'<a href="/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="/apropos.php">'. _("About") .'</a>' .
//'<a class="button small gray" href="' . get_server_name() . 'admin/index.php">'. _("Admin") .'</a>' . //'<a class="button small gray" href="/admin/index.php">'. _("Admin") .'</a>' .
'<span class="sousbandeau sousbandeaulangue">' . '<span class="sousbandeau sousbandeaulangue">' .
liste_lang() . '</span>'. liste_lang() . '</span>'.
'</div>' . "\n"; '</div>' . "\n";
@ -187,12 +186,12 @@ function bandeau_pied_mobile()
'<div class="bandeaupiedmobile">'. _("Universit&eacute; de Strasbourg. Creation: Guilhem BORGHESI. 2008-2009") .'</div>'."\n";*/ '<div class="bandeaupiedmobile">'. _("Universit&eacute; de Strasbourg. Creation: Guilhem BORGHESI. 2008-2009") .'</div>'."\n";*/
echo '<div class="separateur">&nbsp;</div>'; echo '<div class="separateur">&nbsp;</div>';
echo '<div class="sousbandeau">' . 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="' . getUrlSondage('aqg259dth55iuhwm').'">'. _("Example") .'</a>' .
'<a class="button small gray" href="' . get_server_name() . 'contacts.php">'. _("Contact") .'</a>' . '<a class="button small gray" href="/contacts.php">'. _("Contact") .'</a>' .
//'<a href="' . get_server_name() . 'sources/sources.php">'. _("Sources") .'</a>' . //not implemented //'<a href="/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="/apropos.php">'. _("About") .'</a>' .
//'<a class="button small gray" href="' . get_server_name() . 'admin/index.php">'. _("Admin") .'</a>' . //'<a class="button small gray" href="/admin/index.php">'. _("Admin") .'</a>' .
'<span class="sousbandeau sousbandeaulangue">' . '<span class="sousbandeau sousbandeaulangue">' .
liste_lang() . '</span>'. liste_lang() . '</span>'.
'</div>' . "\n"; '</div>' . "\n";

View File

@ -78,7 +78,7 @@ $PDF->Text(140,240,utf8_decode($dsondage->nom_admin));
$PDF->SetFont('Arial','B',8); $PDF->SetFont('Arial','B',8);
// TODO: translate // 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 //Sortie
$PDF->Output(); $PDF->Output();

View File

@ -53,22 +53,10 @@ function connexion_base()
return $DB; return $DB;
} }
function get_server_name() function get_server_name()
{ {
$scheme = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https' : 'http'; $scheme = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http';
return $scheme . '//' . $_SERVER['SERVER_NAME'] . '/';
$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;
} }
@ -129,8 +117,8 @@ function print_header($js = false, $nom_sondage = '')
<title>'.NOMAPPLICATION.'</title>'; <title>'.NOMAPPLICATION.'</title>';
} }
echo ' echo '
<link rel="stylesheet" type="text/css" href="'.get_server_name().'style.css"> <link rel="stylesheet" type="text/css" href="/style.css">
<link rel="stylesheet" type="text/css" href="'.get_server_name().'print.css" media="print">'; <link rel="stylesheet" type="text/css" href="/print.css" media="print">';
echo '</head>'; echo '</head>';
} }

View File

@ -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 '<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>'; #echo '<div class="nouveau_sondage"><b>'. _("Make a poll") .'</b>';
# '<span>' . # '<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>'; # '</span>';
#echo '</div>' . "\n"; #echo '</div>' . "\n";