예제 #1
0
 public function ouvrir($nom)
 {
     $xml_site = new xml_struct();
     $ret = $xml_site->ouvrir($nom);
     if ($ret) {
         // Lecture des modules
         $nb_modules = $xml_site->compter_elements(_SITE_MODULE);
         for ($cpt_module = 0; $cpt_module < $nb_modules; $cpt_module++) {
             $module = $xml_site->lire_valeur_n(_SITE_MODULE, $cpt_module);
             $this->modules[] = $module;
         }
         // Lecture des langues
         $nb_langues = $xml_site->compter_elements(_SITE_LANGUE);
         for ($cpt_langue = 0; $cpt_langue < $nb_langues; $cpt_langue++) {
             $code_langue = $xml_site->lire_valeur_n(_SITE_LANGUE, $cpt_langue);
             $this->codes_langues[] = $code_langue;
         }
         // Lecture du plan du site
         $has_plan = $xml_site->compter_elements(_SITE_PLAN) > 0;
         if ($has_plan) {
             $xml_site->pointer_sur_balise(_SITE_PLAN);
             $nb_pages = $xml_site->compter_elements(_SITE_PLAN_PAGE);
             $xml_site->pointer_sur_balise(_SITE_PLAN_PAGE);
             $cpt_ref = 0;
             for ($cpt = 0; $cpt < $nb_pages; $cpt++) {
                 $ref = $xml_site->lire_n_attribut(_SITE_PLAN_PAGE_ATTR_REF, $cpt);
                 if (strlen($ref) > 0) {
                     $nom = $xml_site->lire_n_valeur(_SITE_PLAN_PAGE_NOM, $cpt);
                     $touche = $xml_site->lire_n_valeur(_SITE_PLAN_PAGE_TOUCHE, $cpt);
                     $parent = $xml_site->lire_n_valeur(_SITE_PLAN_PAGE_PARENT, $cpt);
                     $this->plan[$cpt_ref][_SITE_PLAN_PAGE_ATTR_REF] = $ref;
                     $this->plan[$cpt_ref][_SITE_PLAN_PAGE_NOM] = $nom;
                     $this->plan[$cpt_ref][_SITE_PLAN_PAGE_TOUCHE] = $touche;
                     $this->plan[$cpt_ref][_SITE_PLAN_PAGE_PARENT] = $parent;
                     $cpt_ref += 1;
                 }
             }
             $xml_site->pointer_sur_origine();
         }
         // Liens sociaux
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_FACEBOOK);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_FACEBOOK] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_TWITTER);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_TWITTER] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_GOOGLE_PLUS);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_GOOGLE_PLUS] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_PINTEREST);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_PINTEREST] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_TUMBLR);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_TUMBLR] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_INSTAGRAM);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_INSTAGRAM] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_LINKEDIN);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_LINKEDIN] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_YOUTUBE);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_YOUTUBE] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_FLICKR);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_FLICKR] = $lien;
         }
         // Autres éléments du fichier general.xml
         $this->ins_url_racine($xml_site->lire_valeur(_SITE_RACINE));
         $this->ins_proprietaire($xml_site->lire_valeur(_SITE_PROPRIETAIRE));
         $this->ins_adresse($xml_site->lire_valeur(_SITE_ADR_PROPRIETAIRE));
         $this->ins_telephone($xml_site->lire_valeur(_SITE_TEL_PROPRIETAIRE));
         $this->ins_rcs($xml_site->lire_valeur(_SITE_RCS_PROPRIETAIRE));
         $this->ins_siret($xml_site->lire_valeur(_SITE_SIRET_PROPRIETAIRE));
         $this->ins_redacteur($xml_site->lire_valeur(_SITE_REDACTEUR));
         $this->ins_hebergeur($xml_site->lire_valeur(_SITE_HEBERGEUR));
         $this->ins_cnil($xml_site->lire_valeur(_SITE_CNIL));
         $loi_cookie = $xml_site->lire_valeur(_SITE_LOI_COOKIE);
         if (strlen($loi_cookie) > 0) {
             if (strcmp($loi_cookie, _SITE_ATTR_LOI_COOKIE_MOYEN) && strcmp($loi_cookie, _SITE_ATTR_LOI_COOKIE_FORT)) {
                 $this->loi_cookie = _SITE_ATTR_LOI_COOKIE_FAIBLE;
             } else {
                 $this->loi_cookie = $loi_cookie;
             }
         }
         $this->ins_pied_de_page($xml_site->lire_valeur(_SITE_PIED_DE_PAGE));
         // Elements du fichier site.xml
         $this->set_style_titre_1($xml_site->lire_valeur(_SITE_STYLE_TITRE_1));
         $this->set_style_titre_2($xml_site->lire_valeur(_SITE_STYLE_TITRE_2));
         $this->set_style_titre_3($xml_site->lire_valeur(_SITE_STYLE_TITRE_3));
         $this->set_style_paragraphe($xml_site->lire_valeur(_SITE_STYLE_TEXTE));
         $this->set_couleur_exterieur($xml_site->lire_valeur(_SITE_COULEUR_EXTERIEUR));
         $this->set_motif_exterieur($xml_site->lire_valeur(_SITE_MOTIF_EXTERIEUR));
         $this->set_papierpeint_exterieur($xml_site->lire_valeur(_SITE_PAPIERPEINT_EXTERIEUR));
         $this->set_couleur_interieur($xml_site->lire_valeur(_SITE_COULEUR_INTERIEUR));
         $this->set_motif_interieur($xml_site->lire_valeur(_SITE_MOTIF_INTERIEUR));
         $this->set_largeur($xml_site->lire_valeur(_SITE_LARGEUR));
         $this->set_largeur_max($xml_site->lire_valeur(_SITE_LARGEUR_MAX));
         $this->set_largeur_responsive($xml_site->lire_valeur(_SITE_LARGEUR_RESPONSIVE));
         $this->set_largeur_min($xml_site->lire_valeur(_SITE_LARGEUR_MIN));
     }
     return $ret;
 }
예제 #2
0
 private function lire_journal()
 {
     $nom_journal = _XML_PATH_MAIL . _XML_MAIL_JOURNAL . _XML_EXT;
     if (!@file_exists($nom_journal)) {
         $nom_modele_journal = _XML_PATH_INTERNE . _XML_MAIL_MODELE_JOURNAL . _XML_EXT;
         $this->anti_flooding = @copy($nom_modele_journal, $nom_journal);
     }
     if ($this->anti_flooding) {
         $xml_journal = new xml_struct();
         $this->anti_flooding = $xml_journal->ouvrir($nom_journal);
     }
     if ($this->anti_flooding) {
         $nb_ip = $xml_journal->compter_enfants();
         for ($cpt_ip = 0; $cpt_ip < $nb_ip; $cpt_ip++) {
             $ip = $xml_journal->lire_balise_enfant($cpt_ip);
             if (strlen($ip) > 0) {
                 $this->tab_journal[$ip] = new ip_flood_info($ip);
             }
         }
         foreach ($this->tab_journal as $adr_ip => $obj_ip) {
             $xml_journal->pointer_sur_origine();
             $xml_journal->pointer_sur_balise($adr_ip);
             $horodatage_succes = $xml_journal->lire_valeur(_MAIL_FLOOD_HORODATAGE_SUCCES);
             if (strlen($horodatage_succes) > 0) {
                 $obj_ip->set_horodatage_succes($horodatage_succes);
             }
             $horodatage_echec = $xml_journal->lire_valeur(_MAIL_FLOOD_HORODATAGE_ECHEC);
             if (strlen($horodatage_echec) > 0) {
                 $obj_ip->set_horodatage_echec($horodatage_echec);
             }
             $comptage_envois = $xml_journal->lire_valeur(_MAIL_FLOOD_COMPTAGE_ENVOIS);
             if (strlen($comptage_envois) > 0) {
                 $obj_ip->set_comptage_envois($comptage_envois);
             }
         }
     }
 }