Source de theme.inc
<?
define("THEMES_DIR","/themes/");
define("DEFAULT_THEME","tian");
define("DEFAULT_FONT_SIZE",90);
define("MAX_FONT_SIZE",200);
define("MIN_FONT_SIZE",50);
define("INCREMENT_FONT_SIZE",20);
define("TAB_INDEX_THEME_LIST",61);
define("TAB_INDEX_THEME_SUBMIT",62);
define("TAB_INDEX_THEME_DOWN",63);
define("TAB_INDEX_THEME_DEFAULT",64);
define("TAB_INDEX_THEME_UP",65);
define("TAB_INDEX_THEME_RESET",66);
define("NO_GROUP", "no");
class Theme
{
var $noNavigation;
var $currentTheme;
var $imgExt = "png";
var $themesList = array(
"tian" => array("Tian",true, "classic"),
/* "compact" => array("Compact",true, "classic"), */
"carnet" => array("Carnet",true, "classic"),
"winter" => array("M. Winter",true, "classic"),
"desert" => array("Désert",true, "menu"),
"flof" => array("Flof",true, "menu"),
"negatif" => array("Négatif",true, "menu"),
"old" => array("Vieilli",true, "menu"),
/* "blue_dream" => array("Blue Dream",true, "simple"), */
"white" => array("Blanc",true, "simple"),
"terminal" => array("Terminal",true, "simple"),
"zen" => array("Zen",true, "simple"),
"empty" => array("Sans thème",false, "simple")
);
var $themesGroups = array(
"classic" => "Classiques",
"menu" => "Originaux",
"simple" => "Epurés"
);
function Theme($noNavigation)
{
@session_start();
$previousValue = true;
$this->noNavigation = $noNavigation;
if (!isset($_SESSION['set_theme']))
{
if (isset($_COOKIE['theme']) && (array_key_exists($_COOKIE['theme'], $this->themesList)))
{
$_SESSION['set_theme'] = $_COOKIE['theme'];
$tmp_theme = $_SESSION['set_theme'];
}
else
{
$previousValue = false;
$tmp_theme = DEFAULT_THEME;
$_SESSION['set_theme'] = DEFAULT_THEME;
}
}
else
{
if (isset($_COOKIE['theme']) && ($_COOKIE['theme'] != $_SESSION['set_theme']) && (array_key_exists($_COOKIE['theme'], $this->themesList)))
{
$_SESSION['set_theme'] = $_COOKIE['theme'];
}
}
if (isset($_REQUEST['change_theme']) && isset($_REQUEST['thm-command']))
{
$tmp_theme = basename($_REQUEST['change_theme']);
if (!array_key_exists($tmp_theme, $this->themesList))
{
$tmp_theme = DEFAULT_THEME;
}
$_SESSION['set_theme'] = $tmp_theme;
setCookie('theme', $tmp_theme, time() + (365*24*3600), "/");
unset($_REQUEST['thm-command']);
}
else
{
if (!$previousValue)
{
// No session for the first time (useful for search bots which
// don't like PHPSESSID)
if (!isset($_SESSION['sadminlogin']))
{
session_destroy();
ini_set("url_rewriter.tags","");
}
}
else
{
$tmp_theme = basename($_SESSION['set_theme']);
}
}
if (isset($_REQUEST['fsz-command']))
{
$fs = (isset($_COOKIE['fontSize']) ? $_COOKIE['fontSize'] : DEFAULT_FONT_SIZE);
switch(html_entity_decode($_REQUEST['fsz-command'][0]))
{
case '-':
if (($fs - INCREMENT_FONT_SIZE) >= MIN_FONT_SIZE) $fs -= INCREMENT_FONT_SIZE;
break;
case '+':
if (($fs + INCREMENT_FONT_SIZE) <= MAX_FONT_SIZE) $fs += INCREMENT_FONT_SIZE;
break;
case 'D' :
$fs = DEFAULT_FONT_SIZE;
break;
}
setCookie('fontSize', $fs, time() + (12*30*24*3600), "/");
$_COOKIE['fontSize'] = $fs;
unset($_REQUEST['fsz-command']);
}
if (isset($_REQUEST['rst-command']))
{
$this->resetPreferences();
$tmp_theme = DEFAULT_THEME;
unset($_REQUEST['rst-command']);
}
$this->currentTheme = $tmp_theme;
}
function resetPreference($cookie,$cgi='')
{
setCookie($cookie,'',time()-3600);
unset($_COOKIE[$cookie]);
if ($cgi != '')
{
unset($_REQUEST[$cgi]);
}
}
function resetPreferences()
{
$this->resetPreference('boxesState');
$this->resetPreference('boxesBar', 'bx-command');
$this->resetPreference('fontSize', 'fsz-command');
$this->resetPreference('theme', 'thm-command');
$this->resetPreference(session_name(),session_name());
}
function getFontSizeControls($tab1,$tab2,$tab3, $idPostfix="",$idScroll="prefs")
{
$fs = (isset($_COOKIE['fontSize']) ? $_COOKIE['fontSize'] : DEFAULT_FONT_SIZE);
if (($fs - INCREMENT_FONT_SIZE) < MIN_FONT_SIZE)
{
$minState = 'class="disabled-button" disabled="disabled"';
}
else
{
$minState = 'class="submit-button"';
}
if (($fs + INCREMENT_FONT_SIZE) > MAX_FONT_SIZE)
{
$maxState = 'class="disabled-button" disabled="disabled"';
}
else
{
$maxState = 'class="submit-button"';
}
$result = ' <script type="text/javascript">writeFontSizeControls('.$tab1.','.$tab2.','.$tab3.',"'.$idPostfix.'","'.$idScroll.'");</script>
<noscript>
';
if ($idPostfix == "")
{
$result .= ' <div id="font-size-controls'.$idPostfix.'">
<label>Taille du texte</label>
';
}
else
{
$result .= ' <fieldset><legend>Taille du texte<br /></legend>
';
}
$result .=' <input value="-" type="submit" name="fsz-command" id="font-size-down'.$idPostfix.'" '.$minState.' tabindex="'.$tab1.'" title="Diminuer la taille du texte" />
<input value="Défaut" type="submit" name="fsz-command" id="font-size-default'.$idPostfix.'" class="submit-button" tabindex="'.$tab2.'" title="Rétablir la taille par défaut" />
<input value="+" type="submit" name="fsz-command" id="font-size-up'.$idPostfix.'" '.$maxState.' tabindex="'.$tab3.'" title="Augmenter la taille du texte" />
';
if ($idPostfix == "")
{
$result .= ' </div>
';
}
else
{
$result .= ' </fieldset>
';
}
$result .= ' </noscript>
';
return $result;
}
function getDefaultPrefsControl($tab,$withFieldset = false)
{
$result = ' <script type="text/javascript">writeResetDefaultPrefs('.$tab.',"'.$withFieldset.'");</script>
<noscript>';
if ($withFieldset)
{
$result .= ' <fieldset><legend>Préférences d\'origine<br /></legend>
';
}
else
{
$result .= ' <div id="default-prefs">
<label>Préférences d\'origine</label>
';
}
$result .= '<input value="Réinitialiser" type="submit" name="rst-command" class="submit-button" tabindex="'.$tab.'" title="Rétablir les valeurs par défaut de toutes les préférences" />
';
if ($withFieldset)
{
$result .= ' </fieldset>
';
}
else
{
$result .= ' </div>
';
}
$result .= ' </noscript>';
return $result;
}
function getThemeForm($id = 'theme-form',$onlyTheme = false)
{
if (isset($_SERVER["REDIRECT_URL"]))
{
$method = "post";
}
else
{
$method = "get";
}
$method = "post";
if ($onlyTheme) $idPostfix = "2";
else $idPostfix = "";
$action = str_replace('user_email','validated_email',$_SERVER['REQUEST_URI']);
$result = ' <form id="'.$id.'" action="'.$action.'" method="'.$method.'" onsubmit="return switchTheme(\''.$idPostfix.'\')">
';
if ($onlyTheme)
{
$result .= " <fieldset>\n";
$result .= " <legend>Thème<br /></legend>\n";
$result .= " <label for=\"change-theme$idPostfix\">Selection</label>\n";
}
else
{
$result .= " <div>\n";
$result .= " <label for=\"change-theme$idPostfix\">Thème</label>\n";
}
$tabIndexThemeList = TAB_INDEX_THEME_LIST + ($onlyTheme ? 100 : 0);
$result .= " <select name=\"change_theme\" id=\"change-theme$idPostfix\" tabindex=\"".$tabIndexThemeList."\" title=\"Sélectionnez un thème pour changer l'apparence du site\">\n";
reset($this->themesList);
$listMap = array();
while (list($value, $info) = each($this->themesList))
{
$listMap[$info[2]][$value] = $info;
}
while (list($group, $list) = each($listMap))
{
$result .= " <optgroup label=\"".$this->themesGroups[$group]."\">\n";
while (list($value, $info) = each($list))
{
if ($value != $this->currentTheme)
{
$result .= " <option value=\"".$value."\">".$info[0]."</option>\n";
}
else
{
$result .= " <option selected=\"selected\" value=\"".$value."\">".$info[0]."</option>\n";
}
}
$result .= " </optgroup>\n";
}
$result .= " </select>\n";
$tabIndexThemeSubmit = TAB_INDEX_THEME_SUBMIT + ($onlyTheme ? 100 : 0);
$result .= ' <input type="submit" class="submit-button" name="thm-command" value="Changer" tabindex="'.$tabIndexThemeSubmit.'" title="Appliquer le changement de thème" />
';
if ( ((strlen(session_id())) != 0) && (!isset($_COOKIE[session_name()])) )
{
$result .= ' <input type="hidden" name="'.session_name().'" value="'.session_id().'" />
';
}
if ($onlyTheme)
{
$result .= ' </fieldset>';
}
else
{
$result .= ' </div>
';
$result .= $this->getFontSizeControls(TAB_INDEX_THEME_DOWN,TAB_INDEX_THEME_DEFAULT,TAB_INDEX_THEME_UP);
// $result .= $this->getDefaultPrefsControl(TAB_INDEX_THEME_RESET);
$result .= ' <div class="box-link" id="pref-link">
<a href="/preferences.php" title="Quelques possibilités supplémentaires pour la gestion de vos préférences">Modifier vos préférences</a>
</div>
';
}
$result .= ' </form>';
return $result;
}
function getThemeName()
{
return $this->currentTheme;
}
function doesThemeRequireInit()
{
return $this->themesList[$this->currentTheme][1];
}
function getStyleSheetCommonPath($name="")
{
if ($name == "")
{
return THEMES_DIR.$this->currentTheme."/common.css";
}
else
{
return THEMES_DIR.$name."/common.css";
}
}
function getStyleSheetNoNavPath()
{
return THEMES_DIR.$this->currentTheme."/nonav.css";
}
function getStylesheetLink()
{
$cssLink = ' <link type="text/css" rel="stylesheet" media="screen" href="'.$this->getStyleSheetCommonPath().'" title="Courant ('.$this->themesList[$this->currentTheme][0].')" />';
$cssLink .= "\n";
if ($this->noNavigation)
{
$cssLink .= ' <link type="text/css" rel="stylesheet" media="screen" href="'.$this->getStyleSheetNoNavPath().'" />';
$cssLink .= "\n";
}
$cssLink .= ' <link type="text/css" rel="stylesheet" media="print" href="'.THEMES_DIR.'print.css" />';
$cssLink .= "\n";
return $cssLink;
}
function getAlternateStyleSheetLinks()
{
reset($this->themesList);
$cssAltLink = "";
// Toutes les feuilles. Desactive car utilisant trop de BP
/*
while (list($value, $info) = each($this->themesList))
{
if ($value != $this->currentTheme)
{
$cssAltLink .= ' <link type="text/css" rel="alternate stylesheet" media="all" href="'.$this->getStyleSheetCommonPath($value).'" title="'.$info[0].'" />
';
}
}*/
// Seulement la feuille sans theme
$value = 'empty';
$info = $this->themesList[$value];
$cssAltLink .= ' <link type="text/css" rel="alternate stylesheet" media="all" href="'.$this->getStyleSheetCommonPath($value).'" title="'.$info[0].'" />
';
return $cssAltLink;
}
function getStyleSheetLinks()
{
reset($this->themesList);
$cssLinks = "";
$cssLinks = $this->getStylesheetLink();
$cssLinks .= $this->getAlternateStyleSheetLinks();
return $cssLinks;
while (list($value, $info) = each($this->themesList))
{
if ($value == $this->currentTheme)
{
$properties = 'rel="stylesheet"';
}
else
{
$properties = 'rel="alternate stylesheet"';
}
$cssLinks .= ' <link type="text/css" '.$properties.' media="screen" href="'.$this->getStyleSheetCommonPath($value).'" title="'.$info[0].'" />
';
}
if ($this->noNavigation)
{
$cssLinks .= ' <link type="text/css" rel="stylesheet" media="screen" href="'.$this->getStyleSheetNoNavPath().'" />
';
}
$cssLinks .= ' <link type="text/css" rel="stylesheet" media="print" href="'.THEMES_DIR.'print.css" />
';
return $cssLinks;
}
function getSizeStyleSheetLink()
{
$result = "";
$fs = (isset($_COOKIE['fontSize']) ? $_COOKIE['fontSize'] : DEFAULT_FONT_SIZE);
if ($fs != DEFAULT_FONT_SIZE)
{
$result = ' <link type="text/css" rel="stylesheet" media="screen" href="'.THEMES_DIR.$fs.'.css" />
';
}
return $result;
}
function getSponsorCode($file, $width, $height, $format, $channel, $div, $alternate='')
{
$content = file_get_contents($_SERVER["DOCUMENT_ROOT"].THEMES_DIR.$this->currentTheme.'/'.$file);
if (strlen($content) == 0) return '';
$result = '<div id="'.$div.'">
<script type="text/javascript"><!--
google_ad_client = "pub-4307499573025532";';
if ($alternate != '')
{
$result .= '
google_alternate_ad_url = "'.$alternate;
if (preg_match('/php/', $alternate))
{
preg_match('/google_color_border = "(.*)";\ngoogle_color_bg = "(.*)";\ngoogle_color_link = "(.*)";\ngoogle_color_url = "(.*)";\ngoogle_color_text = "(.*)"/m', $content, $values);
$result .= '?border='.$values[1].'&bg='.$values[2].'&title='.$values[3].'&text='.$values[5];
}
$result .= '"';
}
$result .= '
google_ad_width = '.$width.';
google_ad_height = '.$height.';
google_ad_format = "'.$format.'";
google_ad_type = "text";
google_ad_channel = "'.$channel.'";
'.$content.
'google_language = "fr";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>';
return $result;
}
function getSponsorHeader()
{
return $this->getSponsorCode('sponsorheader',
468,
15,
'468x15_0ads_al',
'0934924967',
'sponsor-header');
}
function getSponsorContent()
{
return $this->getSponsorCode('sponsorcontent',
468,
60,
'468x60_as',
'6058331098',
'sponsor-content');
}
function getSponsorFooter()
{
return $this->getSponsorCode('sponsorfooter',
468,
60,
'468x60_as',
'8092616782',
'sponsor-footer',
'http://www.c-sait.net/sponsor_substitution.php');
// 'http://www.c-sait.net/google_adsense_script.html');
}
function getSponsorBox()
{
return $this->getSponsorCode('sponsorbox',
120,
240,
'120x240_as',
'8604719340',
'sponsor-box',
'http://www.c-sait.net/sponsor_substitution.html');
}
}
?>
define("THEMES_DIR","/themes/");
define("DEFAULT_THEME","tian");
define("DEFAULT_FONT_SIZE",90);
define("MAX_FONT_SIZE",200);
define("MIN_FONT_SIZE",50);
define("INCREMENT_FONT_SIZE",20);
define("TAB_INDEX_THEME_LIST",61);
define("TAB_INDEX_THEME_SUBMIT",62);
define("TAB_INDEX_THEME_DOWN",63);
define("TAB_INDEX_THEME_DEFAULT",64);
define("TAB_INDEX_THEME_UP",65);
define("TAB_INDEX_THEME_RESET",66);
define("NO_GROUP", "no");
class Theme
{
var $noNavigation;
var $currentTheme;
var $imgExt = "png";
var $themesList = array(
"tian" => array("Tian",true, "classic"),
/* "compact" => array("Compact",true, "classic"), */
"carnet" => array("Carnet",true, "classic"),
"winter" => array("M. Winter",true, "classic"),
"desert" => array("Désert",true, "menu"),
"flof" => array("Flof",true, "menu"),
"negatif" => array("Négatif",true, "menu"),
"old" => array("Vieilli",true, "menu"),
/* "blue_dream" => array("Blue Dream",true, "simple"), */
"white" => array("Blanc",true, "simple"),
"terminal" => array("Terminal",true, "simple"),
"zen" => array("Zen",true, "simple"),
"empty" => array("Sans thème",false, "simple")
);
var $themesGroups = array(
"classic" => "Classiques",
"menu" => "Originaux",
"simple" => "Epurés"
);
function Theme($noNavigation)
{
@session_start();
$previousValue = true;
$this->noNavigation = $noNavigation;
if (!isset($_SESSION['set_theme']))
{
if (isset($_COOKIE['theme']) && (array_key_exists($_COOKIE['theme'], $this->themesList)))
{
$_SESSION['set_theme'] = $_COOKIE['theme'];
$tmp_theme = $_SESSION['set_theme'];
}
else
{
$previousValue = false;
$tmp_theme = DEFAULT_THEME;
$_SESSION['set_theme'] = DEFAULT_THEME;
}
}
else
{
if (isset($_COOKIE['theme']) && ($_COOKIE['theme'] != $_SESSION['set_theme']) && (array_key_exists($_COOKIE['theme'], $this->themesList)))
{
$_SESSION['set_theme'] = $_COOKIE['theme'];
}
}
if (isset($_REQUEST['change_theme']) && isset($_REQUEST['thm-command']))
{
$tmp_theme = basename($_REQUEST['change_theme']);
if (!array_key_exists($tmp_theme, $this->themesList))
{
$tmp_theme = DEFAULT_THEME;
}
$_SESSION['set_theme'] = $tmp_theme;
setCookie('theme', $tmp_theme, time() + (365*24*3600), "/");
unset($_REQUEST['thm-command']);
}
else
{
if (!$previousValue)
{
// No session for the first time (useful for search bots which
// don't like PHPSESSID)
if (!isset($_SESSION['sadminlogin']))
{
session_destroy();
ini_set("url_rewriter.tags","");
}
}
else
{
$tmp_theme = basename($_SESSION['set_theme']);
}
}
if (isset($_REQUEST['fsz-command']))
{
$fs = (isset($_COOKIE['fontSize']) ? $_COOKIE['fontSize'] : DEFAULT_FONT_SIZE);
switch(html_entity_decode($_REQUEST['fsz-command'][0]))
{
case '-':
if (($fs - INCREMENT_FONT_SIZE) >= MIN_FONT_SIZE) $fs -= INCREMENT_FONT_SIZE;
break;
case '+':
if (($fs + INCREMENT_FONT_SIZE) <= MAX_FONT_SIZE) $fs += INCREMENT_FONT_SIZE;
break;
case 'D' :
$fs = DEFAULT_FONT_SIZE;
break;
}
setCookie('fontSize', $fs, time() + (12*30*24*3600), "/");
$_COOKIE['fontSize'] = $fs;
unset($_REQUEST['fsz-command']);
}
if (isset($_REQUEST['rst-command']))
{
$this->resetPreferences();
$tmp_theme = DEFAULT_THEME;
unset($_REQUEST['rst-command']);
}
$this->currentTheme = $tmp_theme;
}
function resetPreference($cookie,$cgi='')
{
setCookie($cookie,'',time()-3600);
unset($_COOKIE[$cookie]);
if ($cgi != '')
{
unset($_REQUEST[$cgi]);
}
}
function resetPreferences()
{
$this->resetPreference('boxesState');
$this->resetPreference('boxesBar', 'bx-command');
$this->resetPreference('fontSize', 'fsz-command');
$this->resetPreference('theme', 'thm-command');
$this->resetPreference(session_name(),session_name());
}
function getFontSizeControls($tab1,$tab2,$tab3, $idPostfix="",$idScroll="prefs")
{
$fs = (isset($_COOKIE['fontSize']) ? $_COOKIE['fontSize'] : DEFAULT_FONT_SIZE);
if (($fs - INCREMENT_FONT_SIZE) < MIN_FONT_SIZE)
{
$minState = 'class="disabled-button" disabled="disabled"';
}
else
{
$minState = 'class="submit-button"';
}
if (($fs + INCREMENT_FONT_SIZE) > MAX_FONT_SIZE)
{
$maxState = 'class="disabled-button" disabled="disabled"';
}
else
{
$maxState = 'class="submit-button"';
}
$result = ' <script type="text/javascript">writeFontSizeControls('.$tab1.','.$tab2.','.$tab3.',"'.$idPostfix.'","'.$idScroll.'");</script>
<noscript>
';
if ($idPostfix == "")
{
$result .= ' <div id="font-size-controls'.$idPostfix.'">
<label>Taille du texte</label>
';
}
else
{
$result .= ' <fieldset><legend>Taille du texte<br /></legend>
';
}
$result .=' <input value="-" type="submit" name="fsz-command" id="font-size-down'.$idPostfix.'" '.$minState.' tabindex="'.$tab1.'" title="Diminuer la taille du texte" />
<input value="Défaut" type="submit" name="fsz-command" id="font-size-default'.$idPostfix.'" class="submit-button" tabindex="'.$tab2.'" title="Rétablir la taille par défaut" />
<input value="+" type="submit" name="fsz-command" id="font-size-up'.$idPostfix.'" '.$maxState.' tabindex="'.$tab3.'" title="Augmenter la taille du texte" />
';
if ($idPostfix == "")
{
$result .= ' </div>
';
}
else
{
$result .= ' </fieldset>
';
}
$result .= ' </noscript>
';
return $result;
}
function getDefaultPrefsControl($tab,$withFieldset = false)
{
$result = ' <script type="text/javascript">writeResetDefaultPrefs('.$tab.',"'.$withFieldset.'");</script>
<noscript>';
if ($withFieldset)
{
$result .= ' <fieldset><legend>Préférences d\'origine<br /></legend>
';
}
else
{
$result .= ' <div id="default-prefs">
<label>Préférences d\'origine</label>
';
}
$result .= '<input value="Réinitialiser" type="submit" name="rst-command" class="submit-button" tabindex="'.$tab.'" title="Rétablir les valeurs par défaut de toutes les préférences" />
';
if ($withFieldset)
{
$result .= ' </fieldset>
';
}
else
{
$result .= ' </div>
';
}
$result .= ' </noscript>';
return $result;
}
function getThemeForm($id = 'theme-form',$onlyTheme = false)
{
if (isset($_SERVER["REDIRECT_URL"]))
{
$method = "post";
}
else
{
$method = "get";
}
$method = "post";
if ($onlyTheme) $idPostfix = "2";
else $idPostfix = "";
$action = str_replace('user_email','validated_email',$_SERVER['REQUEST_URI']);
$result = ' <form id="'.$id.'" action="'.$action.'" method="'.$method.'" onsubmit="return switchTheme(\''.$idPostfix.'\')">
';
if ($onlyTheme)
{
$result .= " <fieldset>\n";
$result .= " <legend>Thème<br /></legend>\n";
$result .= " <label for=\"change-theme$idPostfix\">Selection</label>\n";
}
else
{
$result .= " <div>\n";
$result .= " <label for=\"change-theme$idPostfix\">Thème</label>\n";
}
$tabIndexThemeList = TAB_INDEX_THEME_LIST + ($onlyTheme ? 100 : 0);
$result .= " <select name=\"change_theme\" id=\"change-theme$idPostfix\" tabindex=\"".$tabIndexThemeList."\" title=\"Sélectionnez un thème pour changer l'apparence du site\">\n";
reset($this->themesList);
$listMap = array();
while (list($value, $info) = each($this->themesList))
{
$listMap[$info[2]][$value] = $info;
}
while (list($group, $list) = each($listMap))
{
$result .= " <optgroup label=\"".$this->themesGroups[$group]."\">\n";
while (list($value, $info) = each($list))
{
if ($value != $this->currentTheme)
{
$result .= " <option value=\"".$value."\">".$info[0]."</option>\n";
}
else
{
$result .= " <option selected=\"selected\" value=\"".$value."\">".$info[0]."</option>\n";
}
}
$result .= " </optgroup>\n";
}
$result .= " </select>\n";
$tabIndexThemeSubmit = TAB_INDEX_THEME_SUBMIT + ($onlyTheme ? 100 : 0);
$result .= ' <input type="submit" class="submit-button" name="thm-command" value="Changer" tabindex="'.$tabIndexThemeSubmit.'" title="Appliquer le changement de thème" />
';
if ( ((strlen(session_id())) != 0) && (!isset($_COOKIE[session_name()])) )
{
$result .= ' <input type="hidden" name="'.session_name().'" value="'.session_id().'" />
';
}
if ($onlyTheme)
{
$result .= ' </fieldset>';
}
else
{
$result .= ' </div>
';
$result .= $this->getFontSizeControls(TAB_INDEX_THEME_DOWN,TAB_INDEX_THEME_DEFAULT,TAB_INDEX_THEME_UP);
// $result .= $this->getDefaultPrefsControl(TAB_INDEX_THEME_RESET);
$result .= ' <div class="box-link" id="pref-link">
<a href="/preferences.php" title="Quelques possibilités supplémentaires pour la gestion de vos préférences">Modifier vos préférences</a>
</div>
';
}
$result .= ' </form>';
return $result;
}
function getThemeName()
{
return $this->currentTheme;
}
function doesThemeRequireInit()
{
return $this->themesList[$this->currentTheme][1];
}
function getStyleSheetCommonPath($name="")
{
if ($name == "")
{
return THEMES_DIR.$this->currentTheme."/common.css";
}
else
{
return THEMES_DIR.$name."/common.css";
}
}
function getStyleSheetNoNavPath()
{
return THEMES_DIR.$this->currentTheme."/nonav.css";
}
function getStylesheetLink()
{
$cssLink = ' <link type="text/css" rel="stylesheet" media="screen" href="'.$this->getStyleSheetCommonPath().'" title="Courant ('.$this->themesList[$this->currentTheme][0].')" />';
$cssLink .= "\n";
if ($this->noNavigation)
{
$cssLink .= ' <link type="text/css" rel="stylesheet" media="screen" href="'.$this->getStyleSheetNoNavPath().'" />';
$cssLink .= "\n";
}
$cssLink .= ' <link type="text/css" rel="stylesheet" media="print" href="'.THEMES_DIR.'print.css" />';
$cssLink .= "\n";
return $cssLink;
}
function getAlternateStyleSheetLinks()
{
reset($this->themesList);
$cssAltLink = "";
// Toutes les feuilles. Desactive car utilisant trop de BP
/*
while (list($value, $info) = each($this->themesList))
{
if ($value != $this->currentTheme)
{
$cssAltLink .= ' <link type="text/css" rel="alternate stylesheet" media="all" href="'.$this->getStyleSheetCommonPath($value).'" title="'.$info[0].'" />
';
}
}*/
// Seulement la feuille sans theme
$value = 'empty';
$info = $this->themesList[$value];
$cssAltLink .= ' <link type="text/css" rel="alternate stylesheet" media="all" href="'.$this->getStyleSheetCommonPath($value).'" title="'.$info[0].'" />
';
return $cssAltLink;
}
function getStyleSheetLinks()
{
reset($this->themesList);
$cssLinks = "";
$cssLinks = $this->getStylesheetLink();
$cssLinks .= $this->getAlternateStyleSheetLinks();
return $cssLinks;
while (list($value, $info) = each($this->themesList))
{
if ($value == $this->currentTheme)
{
$properties = 'rel="stylesheet"';
}
else
{
$properties = 'rel="alternate stylesheet"';
}
$cssLinks .= ' <link type="text/css" '.$properties.' media="screen" href="'.$this->getStyleSheetCommonPath($value).'" title="'.$info[0].'" />
';
}
if ($this->noNavigation)
{
$cssLinks .= ' <link type="text/css" rel="stylesheet" media="screen" href="'.$this->getStyleSheetNoNavPath().'" />
';
}
$cssLinks .= ' <link type="text/css" rel="stylesheet" media="print" href="'.THEMES_DIR.'print.css" />
';
return $cssLinks;
}
function getSizeStyleSheetLink()
{
$result = "";
$fs = (isset($_COOKIE['fontSize']) ? $_COOKIE['fontSize'] : DEFAULT_FONT_SIZE);
if ($fs != DEFAULT_FONT_SIZE)
{
$result = ' <link type="text/css" rel="stylesheet" media="screen" href="'.THEMES_DIR.$fs.'.css" />
';
}
return $result;
}
function getSponsorCode($file, $width, $height, $format, $channel, $div, $alternate='')
{
$content = file_get_contents($_SERVER["DOCUMENT_ROOT"].THEMES_DIR.$this->currentTheme.'/'.$file);
if (strlen($content) == 0) return '';
$result = '<div id="'.$div.'">
<script type="text/javascript"><!--
google_ad_client = "pub-4307499573025532";';
if ($alternate != '')
{
$result .= '
google_alternate_ad_url = "'.$alternate;
if (preg_match('/php/', $alternate))
{
preg_match('/google_color_border = "(.*)";\ngoogle_color_bg = "(.*)";\ngoogle_color_link = "(.*)";\ngoogle_color_url = "(.*)";\ngoogle_color_text = "(.*)"/m', $content, $values);
$result .= '?border='.$values[1].'&bg='.$values[2].'&title='.$values[3].'&text='.$values[5];
}
$result .= '"';
}
$result .= '
google_ad_width = '.$width.';
google_ad_height = '.$height.';
google_ad_format = "'.$format.'";
google_ad_type = "text";
google_ad_channel = "'.$channel.'";
'.$content.
'google_language = "fr";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>';
return $result;
}
function getSponsorHeader()
{
return $this->getSponsorCode('sponsorheader',
468,
15,
'468x15_0ads_al',
'0934924967',
'sponsor-header');
}
function getSponsorContent()
{
return $this->getSponsorCode('sponsorcontent',
468,
60,
'468x60_as',
'6058331098',
'sponsor-content');
}
function getSponsorFooter()
{
return $this->getSponsorCode('sponsorfooter',
468,
60,
'468x60_as',
'8092616782',
'sponsor-footer',
'http://www.c-sait.net/sponsor_substitution.php');
// 'http://www.c-sait.net/google_adsense_script.html');
}
function getSponsorBox()
{
return $this->getSponsorCode('sponsorbox',
120,
240,
'120x240_as',
'8604719340',
'sponsor-box',
'http://www.c-sait.net/sponsor_substitution.html');
}
}
?>
Si avez des problèmes ou des questions concernant ce fichier source, vous pouvez utiliser le Forum Sources du site