if (is_string($needle)) {
        array_walk($haystack, 'arr_strtolower');
    }
    return in_array(strtolower($needle), $haystack, $strict);
}
function arr_strtolower(&$value, $key)
{
    $value = strtolower($value);
}
$example = array('AbC', 'DeF', 'G');
for ($i = 0; $i < 4; $i++) {
    $s_time = microtime(true);
    switch ($i) {
        case 0:
            for ($j = 0; $j < $iterations; $j++) {
                $res = in_array_i('g', $example);
            }
            break;
        case 1:
            for ($j = 0; $j < $iterations; $j++) {
                $res = in_array_i2('g', $example);
            }
            break;
        case 2:
            for ($j = 0; $j < $iterations; $j++) {
                $res = in_array_i3('g', $example);
            }
            break;
        case 3:
            for ($j = 0; $j < $iterations; $j++) {
                $res = in_array_i4('g', $example);
Exemple #2
0
								}
							}
						}
					}
				}
			}
			else {
				while (!feof($fp)) {
					$ligne = fgets($fp, 4096);
					if(trim($ligne)!="") {
						if(!preg_match("/;Moyenne DNB/", $ligne)) {
							$tab=explode(";",trim($ligne));
							if((isset($tab[0]))&&($tab[0]!='')&&(isset($tab[1]))&&($tab[1]!='')) {
								$current_login_ele=$tab[0];

								if(!in_array_i($current_login_ele, $current_group['eleves']['all']['list'])) {
									$nb_ele_autre_groupe++;
									$info_ele_autre_groupe.=", ".get_nom_prenom_eleve($current_login_ele);
								}
								else {
									$sql="DELETE FROM notanet_saisie WHERE login='******' AND matiere='$matiere';";
									$del=mysqli_query($GLOBALS["mysqli"], $sql);

									$sql="INSERT INTO notanet_saisie SET login='******', matiere='$matiere', note='".$tab[1]."';";
									//echo "$sql<br />";
									$register=mysqli_query($GLOBALS["mysqli"], $sql);
									if (!$register) {
										$msg .= "Erreur lors de l'enregistrement des données pour ".$current_login_ele.".<br />";
									}
									else {
										$nb_reg++;
Exemple #3
0
         <span class="norme_absence_bleu">* Si aucun élève n'est sélectionné, la classe entière sera sélectionnée.</span><br /><br />
      <?php } ?>
      </td>
      <td class="td_tableau_selection">
	<form method="post" action="<?php echo $page; ?>.php?action=ajouter&amp;type=<?php echo $type; ?>" name="form2">
            <p>Sélection :<br />
			<?php
				//echo "$requete_liste_eleve<br />";
			?>
            <select name="eleve_absent[]" size="10" <?php if ($type == "D" or $type == "I") {} else {?>multiple="multiple"<?php } ?> style="width: 350px;">
            <?php
			$resultat_liste_eleve = mysqli_query($GLOBALS["mysqli"], $requete_liste_eleve) or die('Erreur SQL !'.$requete_liste_eleve.'<br />'.mysqli_error($GLOBALS["mysqli"]));
            while($data_liste_eleve = mysqli_fetch_array($resultat_liste_eleve))
			{
				//if (in_array($data_liste_eleve['login'], $test_cpe) OR $test_nbre_eleves_cpe === 0) {
				if (in_array_i($data_liste_eleve['login'], $test_cpe) OR $test_nbre_eleves_cpe === 0) {
			?>

                <option value="<?php echo $data_liste_eleve['login']; ?>"><?php echo strtoupper($data_liste_eleve['nom'])." ".ucfirst($data_liste_eleve['prenom']); ?>&nbsp;(<?php echo $data_liste_eleve['classe']; ?>)</option>
            <?php
            	}
			} ?>
            </select>
         <input type="hidden" name="classe_choix" value="<?php echo $classe_choix; ?>" /></p>
         <p><input type="submit" name="submit" value="Valider votre sélection" /></p>
        </form>
      </td>
    </tr>
  </table>
<?php /* fin du div de centrage du tableau pour ie5 */ ?>
</div>
 for ($i = 0; $i < count($codes); $i++) {
     $usedopentags[] = $codes[$i]['open_tag'];
     $usedclosetags[] = $codes[$i]['close_tag'];
     $usedskeys[] = $codes[$i]['shortcut_key'];
     $usednames[] = $codes[$i]['name'];
 }
 if (in_array_i($name, $usednames)) {
     message_die(GENERAL_MESSAGE, $lang['MyBBCode_Name_already_in_use']);
 }
 if (in_array_i($open_tag, $usedopentags)) {
     message_die(GENERAL_MESSAGE, $lang['MyBBCode_Open_Tag_already_in_use']);
 }
 if (in_array_i($close_tag, $usedclosetags)) {
     message_die(GENERAL_MESSAGE, $lang['MyBBCode_Close_Tag_already_in_use']);
 }
 if (in_array_i($shortcut_key, $usedskeys) && $shortcut_key != "") {
     message_die(GENERAL_MESSAGE, $lang['MyBBCode_Shortcut_Key_already_in_use']);
 }
 $quicktip = 'return \'' . $quicktip_pure ? stripslashes($quicktip) : $quicktup . '\';';
 if ($code_id) {
     $sql = "UPDATE " . MYBBCODE_TABLE . " SET\n\t\t\t\t\t\t`name`='" . str_replace("\\'", "''", $name) . "',\n\t\t\t\t\t\t`open_tag`='" . str_replace("\\'", "''", $open_tag) . "',\n\t\t\t\t\t\t`close_tag`='" . str_replace("\\'", "''", $close_tag) . "',\n\t\t\t\t\t\t`tag_open`='" . str_replace("\\'", "''", $tag_open) . "',\n\t\t\t\t\t\t`tag_close`='" . str_replace("\\'", "''", $tag_close) . "',\n\t\t\t\t\t\t`attr_chars`='" . str_replace("\\'", "''", $attr_chars) . "',\n\t\t\t\t\t\t`attr_chars_pure`={$attr_chars_pure},\n\t\t\t\t\t\t`content_chars`='" . str_replace("\\'", "''", $content_chars) . "',\n\t\t\t\t\t\t`content_chars_pure`={$content_chars_pure},\n\t\t\t\t\t\t`include_file`='" . str_replace("\\'", "''", $include_file) . "',\n\t\t\t\t\t\t`parse_func_1`='" . str_replace("\\'", "''", $parse_func_1) . "',\n\t\t\t\t\t\t`parse_func_2`='" . str_replace("\\'", "''", $parse_func_2) . "',\n\t\t\t\t\t\t`help`='" . str_replace("\\'", "''", $help) . "',\n\t\t\t\t\t\t`shortcut_key`='" . str_replace("\\'", "''", $shortcut_key) . "',\n\t\t\t\t\t\t`quicktip`='" . str_replace("\\'", "''", $quicktip) . "',\n\t\t\t\t\t\t`quicktip_pure`={$quicktip_pure},\n\t\t\t\t\t\t`show_button`={$show_button},\n\t\t\t\t\t\t`style='" . str_replace("\\'", "''", $style) . "',\n\t\t\t\t\t\t`disabled`=0\n\t\t\t\t\t\t\t\tWHERE `id`=" . $code_id;
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, "Couldn't update bbcode data", "", __LINE__, __FILE__, $sql);
     }
     message_die(GENERAL_MESSAGE, $lang['MyBBCode_BBCode_updated_successfully']);
 } else {
     // Cheap trick - MAN am I lazy
     $sql = "INSERT INTO " . MYBBCODE_TABLE . " SET\n\t\t\t\t\t\t`name`='" . str_replace("\\'", "''", $name) . "',\n\t\t\t\t\t\t`open_tag`='" . str_replace("\\'", "''", $open_tag) . "',\n\t\t\t\t\t\t`close_tag`='" . str_replace("\\'", "''", $close_tag) . "',\n\t\t\t\t\t\t`tag_open`='" . str_replace("\\'", "''", $tag_open) . "',\n\t\t\t\t\t\t`tag_close`='" . str_replace("\\'", "''", $tag_close) . "',\n\t\t\t\t\t\t`attr_chars`='" . str_replace("\\'", "''", $attr_chars) . "',\n\t\t\t\t\t\t`attr_chars_pure`={$attr_chars_pure},\n\t\t\t\t\t\t`content_chars`='" . str_replace("\\'", "''", $content_chars) . "',\n\t\t\t\t\t\t`content_chars_pure`={$content_chars_pure},\n\t\t\t\t\t\t`include_file`='" . str_replace("\\'", "''", $include_file) . "',\n\t\t\t\t\t\t`parse_func_1`='" . str_replace("\\'", "''", $parse_func_1) . "',\n\t\t\t\t\t\t`parse_func_2`='" . str_replace("\\'", "''", $parse_func_2) . "',\n\t\t\t\t\t\t`help`='" . str_replace("\\'", "''", $help) . "',\n\t\t\t\t\t\t`shortcut_key`='" . str_replace("\\'", "''", $shortcut_key) . "',\n\t\t\t\t\t\t`quicktip`='" . str_replace("\\'", "''", $quicktip) . "',\n\t\t\t\t\t\t`quicktip_pure`={$quicktip_pure},\n\t\t\t\t\t\t`show_button`={$show_button},\n\t\t\t\t\t\t`style='" . str_replace("\\'", "''", $style) . "'";
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, "Couldn't add bbcode", "", __LINE__, __FILE__, $sql);
     }
 function checkField($field, $value)
 {
     if (empty($this->cache[$field])) {
         return true;
     }
     return !in_array_i($value, $this->cache[$field]);
 }
Exemple #6
0
     $current_login_gepi = $lig_test->login_gepi;
     // On vérifie si le login correspond bien à un compte responsable
     $sql = "SELECT * FROM utilisateurs WHERE login='******';";
     $res_u = mysqli_query($GLOBALS["mysqli"], $sql);
     if (mysqli_num_rows($res_u) > 0) {
         $lig_u = mysqli_fetch_object($res_u);
         if ($lig_u->statut == 'responsable' || $lig_u->statut == 'eleve') {
             // ANOMALIE
             // Ce devrait être un compte de personnel.
         }
     } else {
         // ANOMALIE
         echo "\n\t<tr class='white_hover' style='background-color:red' title=\"ANOMALIE : Le login actuellement enregistré {$current_login_gepi} \n           ne correspond à personne.\n           Vous devriez supprimer les enregistrements associés à l'aide\n           du lien\n                 SCORIES : Supprimer ces scories.\n           en page d'index, et refaire ensuite une importation.\">\n\t\t<td><!--input type='checkbox' name='ligne[]' id='ligne_{$cpt}' value='{$cpt}' onchange=\"change_graisse({$cpt})\" /--></td>\n\t\t<td>" . $tab[0] . "</td>\n\t\t<td>" . $tab[1] . "</td>\n\t\t<td>" . $tab[2] . "</td>\n\t\t<td>" . $tab[3] . "</td>\n\t\t<td></td>\n\t</tr>";
     }
 } else {
     if (in_array_i($tab[1] . " " . $tab[2], $tab_nom_prenom_deja_aff)) {
         $chaine_tmp = $cpt . "_" . remplace_accents($tab[1] . " " . $tab[2], "all");
         $tab_doublon_possible[] = $chaine_tmp;
         $ancre_doublon_ou_pas = "******";
         $style_css = " style='background-color:red' title=\"Il existe au moins un homonyme dans le CSV.\nSi les homonymes correspondent à un même élève, vous allez devoir identifier le bon GUID\n(choisir un des homonymes au hasard, et demander à l'élève de tester.\nsi cela ne fonctionne pas, corriger l'association élève en mettant le GUID de l'homonyme).\"";
     } else {
         $ancre_doublon_ou_pas = "";
         $style_css = "";
     }
     $tab_nom_prenom_deja_aff[] = $tab[1] . " " . $tab[2];
     $alt = $alt * -1;
     echo "\n\t<tr class='lig{$alt} white_hover'{$style_css}>\n\t\t<td><input type='checkbox' name='ligne[]' id='ligne_{$cpt}' value='{$cpt}' onchange=\"change_graisse({$cpt})\" />{$ancre_doublon_ou_pas}</td>\n\t\t<td><label for='ligne_{$cpt}'>" . $tab[0] . "</label></td>\n\t\t<td><label for='ligne_{$cpt}'><span id='nom_{$cpt}'>" . $tab[1] . "</span></label></td>\n\t\t<td><label for='ligne_{$cpt}'><span id='prenom_{$cpt}'>" . $tab[2] . "</span></label></td>\n\t\t<td><label for='ligne_{$cpt}'>" . $tab[3] . "</label></td>";
     $sql = "SELECT * FROM utilisateurs WHERE nom='" . mysqli_real_escape_string($GLOBALS["mysqli"], $tab[1]) . "' AND prenom='" . mysqli_real_escape_string($GLOBALS["mysqli"], $tab[2]) . "' AND statut!='eleve' AND statut!='responsable' ORDER BY statut;";
     $res = mysqli_query($GLOBALS["mysqli"], $sql);
     if (mysqli_num_rows($res) == 1) {
         // Un seul personnel correspond