Skip to content

Commit

Permalink
Corrections strlen -> mb_strlen
Browse files Browse the repository at this point in the history
  • Loading branch information
Regis85 committed Nov 1, 2011
1 parent 3f616b3 commit 46e5823
Show file tree
Hide file tree
Showing 31 changed files with 146 additions and 607 deletions.
2 changes: 1 addition & 1 deletion aide_gepipath.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

$temp = $url['path'];

$d = strlen($temp) - strlen("aide_gepipath.php") - 1;
$d = mb_strlen($temp) - mb_strlen("aide_gepipath.php") - 1;

$gepi_path = substr($temp, 0, $d);

Expand Down
2 changes: 1 addition & 1 deletion class_php/RSSFeed/RSSFeed.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function setImage($url, $title, $link, $description='', $width=0, $height
***************************************************/
public function setLanguage($language)
{
if(!empty($language) && (2 === strlen($language)))
if(!empty($language) && (2 === mb_strlen($language)))
{
$this->_language = $language;
}
Expand Down
2 changes: 1 addition & 1 deletion class_php/gepi_pdf.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function drawRows($w,$h,$txt,$border=0,$align='J',$fill=0,$maxline=0,$prn=0) {
$w=$this->w-$this->rMargin-$this->x;
$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
$s=str_replace("\r",'',$txt);
$nb=strlen($s);
$nb=mb_strlen($s);
if($nb>0 and $s[$nb-1]=="\n")
$nb--;
$b=0;
Expand Down
4 changes: 2 additions & 2 deletions groupes/popup.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
$enseignement="VIE SCOLAIRE";
}
else{
if(strlen(my_ereg_replace("[0-9]","",$id_groupe))!=0){
if(mb_strlen(my_ereg_replace("[0-9]","",$id_groupe))!=0){
header("Location: ../accueil.php?msg=Numero_de_groupe_non_valide");
die();
}
Expand All @@ -97,7 +97,7 @@
if(isset($id_classe)){

// A FAIRE: TESTER LE CARACTERE NUMERIQUE DE $id_classe
if(strlen(my_ereg_replace("[0-9]","",$id_classe))!=0){
if(mb_strlen(my_ereg_replace("[0-9]","",$id_classe))!=0){
header("Location: ../accueil.php?msg=Numero_de_classe_non_valide");
die();
}
Expand Down
8 changes: 4 additions & 4 deletions matieres/matieres_categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
// On filtre un peu
if (!is_numeric($_POST['priority'])) $_POST['priority'] = "0";
// Le reste passera sans soucis, mais on coupe quand même si jamais c'est trop long
if (strlen($_POST['nom_court']) > 250) $_POST['nom_court'] = substr($_POST['nom_court'], 0, 250);
if (strlen($_POST['nom_complet']) > 250) $_POST['nom_complet'] = substr($_POST['nom_complet'], 0, 250);
if (mb_strlen($_POST['nom_court']) > 250) $_POST['nom_court'] = substr($_POST['nom_court'], 0, 250);
if (mb_strlen($_POST['nom_complet']) > 250) $_POST['nom_complet'] = substr($_POST['nom_complet'], 0, 250);
// On enregistre
if ($_POST['nom_court'] == '') {
$msg .= "Le nom court ne peut pas être vide.<br/>";
Expand Down Expand Up @@ -87,8 +87,8 @@
if (!is_numeric($_POST['priority'])) $_POST['priority'] = "0";
if (!is_numeric($_POST['categorie_id'])) $_POST['categorie_id'] = "0";
// Le reste passera sans soucis, mais on coupe quand même si jamais c'est trop long
if (strlen($_POST['nom_court']) > 250) $_POST['nom_court'] = substr($_POST['nom_court'], 0, 250);
if (strlen($_POST['nom_complet']) > 250) $_POST['nom_complet'] = substr($_POST['nom_complet'], 0, 250);
if (mb_strlen($_POST['nom_court']) > 250) $_POST['nom_court'] = substr($_POST['nom_court'], 0, 250);
if (mb_strlen($_POST['nom_complet']) > 250) $_POST['nom_complet'] = substr($_POST['nom_complet'], 0, 250);

if ($_POST['nom_court'] == '') {
$msg .= "Le nom court ne peut pas être vide.<br/>";
Expand Down
8 changes: 2 additions & 6 deletions matieres/matieres_csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,15 @@
$ligne=explode(";",$tmp_lig);

$affiche[0]=traitement_magic_quotes(corriger_caracteres(dbase_filter(trim($ligne[0]))));
if((strlen(preg_replace("/[A-Za-z0-9_ &]/","",strtr($affiche[0],"-","_")))!=0)&&($affiche[0]!="")){
//if((strlen(my_ereg_replace("[A-Za-zÀÄÂÉÈÊËÎÏÔÖÙÛÜÇçàäâéèêëîïôöùûü0-9_ &]","",strtr($affiche[$i],"-","_")))!=0)&&($affiche[$i]!="")){
if((mb_strlen(preg_replace("/[A-Za-z0-9_ &]/","",strtr($affiche[0],"-","_")))!=0)&&($affiche[0]!="")){
$temoin_erreur="oui";
//echo "<!-- -->\n";
$msg.="Le nom <font color='red'>$affiche[0]</font> ne convient pas.<br />\n";
$nb_reg_no++;
}

$affiche[1]=traitement_magic_quotes(corriger_caracteres(dbase_filter(trim($ligne[1]))));
//if((strlen(my_ereg_replace("[A-Za-z0-9_ &]","",strtr($affiche[$i],"-","_")))!=0)&&($affiche[$i]!="")){
//echo "\$affiche[1]=$affiche[1]<br />";
//echo "my_ereg_replace(\"[A-Za-zÀÄÂÉÈÊËÎÏÔÖÙÛÜÇçàäâéèêëîïôöùûü0-9_ &]\",\"\",$affiche[1])=".my_ereg_replace("[A-Za-zÀÄÂÉÈÊËÎÏÔÖÙÛÜÇçàäâéèêëîïôöùûü0-9_ &]","",$affiche[1])."<br />";
if((strlen(preg_replace("/[A-Za-zÀÄÂÉÈÊËÎÏÔÖÙÛÜÇçàäâéèêëîïôöùûü0-9_ &]/","",strtr($affiche[1],"-","_")))!=0)&&($affiche[1]!="")){
if((mb_strlen(preg_replace("/[A-Za-zÀÄÂÉÈÊËÎÏÔÖÙÛÜÇçàäâéèêëîïôöùûü0-9_ &]/","",strtr($affiche[1],"-","_")))!=0)&&($affiche[1]!="")){
$temoin_erreur="oui";
//echo "<!-- -->\n";
$msg.="Le nom <font color='red'>$affiche[1]</font> ne convient pas.<br />\n";
Expand Down
2 changes: 1 addition & 1 deletion mod_genese_classes/affect_eleves_classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@ function change_display(id) {

//===================================
echo "<td>\n";
if(($moy!="")&&(strlen(my_ereg_replace("[0-9.,]","",$moy))==0)) {
if(($moy!="")&&(mb_strlen(my_ereg_replace("[0-9.,]","",$moy))==0)) {
if($num_per2>0) {
echo "<a href=\"#\" onclick=\"afficher_div('div_bull_simp','y',-100,40); affiche_bull_simp('$lig->login','".$id_classe_actuelle[$j]."','1','$num_per2');return false;\" style='text-decoration:none;'>";
}
Expand Down
4 changes: 2 additions & 2 deletions mod_genese_classes/affiche_listes.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ function moyenne($tab_notes) {
// Formulaire d'ajout de requêtes:
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">\n";

if((isset($_GET['editer_requete']))&&(isset($_GET['id_req'])&&($_GET['id_req']!="")&&(strlen(my_ereg_replace("[0-9]","",$_GET['id_req']))==0))) {
if((isset($_GET['editer_requete']))&&(isset($_GET['id_req'])&&($_GET['id_req']!="")&&(mb_strlen(my_ereg_replace("[0-9]","",$_GET['id_req']))==0))) {
$id_req=$_GET['id_req'];
echo "<p class='bold'>Modification de la requête n°$id_req</p>\n";
echo "<input type='hidden' name='modifier_requete' value='y' />\n";
Expand Down Expand Up @@ -1573,7 +1573,7 @@ function affiche_set_profil(cpt) {

// Niveau...
$contenu_affichage_requete_courante.="<td>\n";
if(($moy!="")&&(strlen(preg_replace("/[0-9\.,]/","",$moy))==0)) {
if(($moy!="")&&(mb_strlen(preg_replace("/[0-9\.,]/","",$moy))==0)) {
if($num_per2>0) {
$contenu_affichage_requete_courante.="<a href=\"#\" onclick=\"afficher_div('div_bull_simp','y',-100,40); affiche_bull_simp('$lig->login','".$id_classe_actuelle[$j]."','1','$num_per2');return false;\" style='text-decoration:none;'>";
}
Expand Down
2 changes: 1 addition & 1 deletion mod_genese_classes/genere_ods.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function suppr_accents($chaine){
$fich_source_csv=fopen("../temp/".$user_temp_directory."/$fichier_csv","r");
while(!feof($fich_source_csv)) {
$ligne=fgets($fich_source_csv,4096);
$n=strlen(preg_replace("/[^;]/","",$ligne));
$n=mb_strlen(preg_replace("/[^;]/","",$ligne));
if($n>$nb_ptvirg) {$nb_ptvirg=$n;}
}
$nb_ptvirg=$nb_ptvirg-1; // On supprime le point virgule en fin de ligne
Expand Down
Loading

0 comments on commit 46e5823

Please sign in to comment.