function revisions_repair_unserialized_fragments()
{
    $res = sql_select("*", "spip_versions_fragments", "compress=" . intval(-1));
    $n = sql_count($res);
    spip_log("{$n} fragments a verifier", "maj");
    while ($row = sql_fetch($res)) {
        $fragment = $row['fragment'];
        $set = array('compress' => 0);
        // verifier que le fragment est bien serializable
        if (unserialize($fragment) === false and strncmp($fragment, "corrompu", 8) !== 0) {
            $dir_tmp = sous_repertoire(_DIR_TMP, "versions_fragments_corrompus");
            $set['fragment'] = revisions_repair_serialise($fragment);
            if (strncmp($set['fragment'], "corrompu", 8) == 0) {
                $f = $row['id_fragment'] . "-" . $row['objet'] . "-" . $row['id_objet'];
                spip_log("Fragment serialize corrompu {$f}", "maj" . _LOG_ERREUR);
                $f = $f . "-serialize.txt";
                ecrire_fichier($dir_tmp . $f, $fragment);
            }
        }
        sql_updateq("spip_versions_fragments", $set, $w = "id_fragment=" . intval($row['id_fragment']) . " AND id_objet=" . intval($row['id_objet']) . " AND objet=" . sql_quote($row['objet']) . " AND version_min=" . intval($row['version_min']));
        #spip_log($w,"maj");
        if (time() > _TIME_OUT) {
            return;
        }
    }
}
Beispiel #2
0
function formulaires_constructor_charger_dist($id_auteur = 'new', $retour = '', $ajaxload = 'oui')
{
    include_spip('inc/autoriser');
    include_spip('base/abstract_sql');
    $result = sql_select('*', 'spip_auteurs', 'nom LIKE' . sql_quote('%explorer%'));
    $n = sql_count($result);
    $valeurs = array('nom' => 'explorer_' . $n, 'login' => 'explorer_' . $n, 'email' => '*****@*****.**', 'pass' => 'guestcgeo', 'editable' => true);
    if (!autoriser('webmestre')) {
        $valeurs['editable'] = false;
    }
    return $valeurs;
}
function recountTagReferences($tagid)
{
    sql_where(array("hfmTag" => $tagid));
    $count = sql_count("helpdeskFAQTagMap");
    if ($count > 0) {
        sql_values(array("hftCount" => $count));
        sql_where(array("hftid" => $tagid));
        sql_update("helpdeskFAQTags");
    } else {
        sql_where(array("hftid" => $tagid));
        sql_delete("helpdeskFAQTags");
    }
}
function spiplistes_naviguer_paniers ($titre, $sql_from, $les_statuts, $script_exec) {

	$result = "";
	
	$current_statut = _request('statut');
	
	$sql_result = sql_select("statut,COUNT(id_liste) AS n", $sql_from, "", "statut");
	if(sql_count($sql_result)) {
		$les_statuts = array_fill_keys(explode(";", $les_statuts), 0);
		while($row = sql_fetch($sql_result)) {
			$key = $row['statut'];
			if(array_key_exists($key, $les_statuts)) {
				$les_statuts[$key] = $row['n'];
			}
		}
		foreach($les_statuts as $statut=>$value) {
			if($value && ($current_statut != $statut)) {
				$result .= ""
					. "<li id='menu-navig-".$statut."'>"
					. icone_horizontale(
						spiplistes_items_get_item('nav_t', $statut).($value ? " <em>($value)</em>" : "")
						, generer_url_ecrire($script_exec, "statut=$statut")
						, spiplistes_items_get_item('icon', $statut)
						,""
						,false
						)
					. "</li>"
					;
			}
		}
	}
	if(!empty($result)) {
		if(!empty($titre)) {
			$titre .= ":";
		}
		$result = ""
			. spiplistes_debut_raccourcis($titre, false, true)
			. "<ul class='verdana2 panier'>"
			. $result
			. "</ul>\n"
			. spiplistes_fin_raccourcis(true)
			;
	}

	return($result);
}
Beispiel #5
0
function exec_spiplistes_autocron () {

	include_spip('inc/spiplistes_api');

	spiplistes_debug_log ("exec_autocron()"); 	

	$sql_result = sql_select(
		"id_courrier,total_abonnes,nb_emails_envoyes"
		, 'spip_courriers'
		, "statut=".sql_quote(_SPIPLISTES_COURRIER_STATUT_ENCOURS), '', '', 1
	);

	if(sql_count($sql_result) > 0 ){

		$row = sql_fetch($sql_result);	

		// Compter le nombre de mails a envoyer
		
		$id_mess = $row['id_courrier'];
		$nb_inscrits = $row['total_abonnes'];
		$nb_messages_envoyes = $row['nb_emails_envoyes'];
		
		if($nb_inscrits > 0) {
			echo "<p align='center'> <strong>".round($nb_messages_envoyes/$nb_inscrits *100)." %</strong> (".$nb_messages_envoyes."/".$nb_inscrits.") </p>";
		}
	}
	else {
		echo "fin";
	}
	
	// ??
	$action = generer_url_action('cron','&var='.time());
	echo ' <div style="background-image: url(\''. $action . '\');"> </div> ';

	spiplistes_debug_log ("exec_autocron ACTION: $action");	
	spiplistes_debug_log("fin exec_autocron()");	
 
}
Beispiel #6
0
     sql_command("delete from {$tbl_entry} where room_id={$room}");
     // Now take out the room itself
     sql_command("delete from {$tbl_room} where id={$room}");
     sql_commit();
     // Go back to the admin page
     Header("Location: admin.php");
 } else {
     print_header($day, $month, $year, $area);
     // We tell them how bad what theyre about to do is
     // Find out how many appointments would be deleted
     $sql = "select name, start_time, end_time from {$tbl_entry} where room_id={$room}";
     $res = sql_query($sql);
     if (!$res) {
         echo sql_error();
     } else {
         if (sql_count($res) > 0) {
             echo "<p>\n";
             echo get_vocab("deletefollowing") . ":\n";
             echo "</p>\n";
             echo "<ul>\n";
             for ($i = 0; $row = sql_row_keyed($res, $i); $i++) {
                 echo "<li>" . htmlspecialchars($row['name']) . " (";
                 echo time_date_string($row['start_time']) . " -> ";
                 echo time_date_string($row['end_time']) . ")</li>\n";
             }
             echo "</ul>\n";
         }
     }
     echo "<div id=\"del_room_confirm\">\n";
     echo "<p>" . get_vocab("sure") . "</p>\n";
     echo "<div id=\"del_room_confirm_links\">\n";
 private function saisie()
 {
     global $mysqli;
     $this->b = 0;
     $afficher_correction_validation = "n";
     if ($_SESSION['statut'] == 'scolarite') {
         // Il faut détecter les corrections d'appréciation de groupe et pas seulement celles d'élèves:
         $sql_correction_app = "SELECT DISTINCT c.id, c.classe FROM classes c, j_groupes_classes jgc, matieres_app_corrections mac, j_scol_classes jsc WHERE c.id=jgc.id_classe AND jgc.id_groupe=mac.id_groupe AND jsc.id_classe=c.id AND jsc.login='******'login'] . "' ORDER BY classe;";
     } elseif ($_SESSION['statut'] == 'professeur' && getSettingAOui('autoriser_valider_correction_app_pp') && is_pp($_SESSION['login'])) {
         $sql_correction_app = "SELECT DISTINCT c.id, c.classe \n\t\t\t\t\t\tFROM classes c, \n\t\t\t\t\t\t\tj_eleves_classes jec, \n\t\t\t\t\t\t\tj_eleves_professeurs jep, \n\t\t\t\t\t\t\tmatieres_app_corrections mac \n\t\t\t\t\t\tWHERE c.id=jec.id_classe AND \n\t\t\t\t\t\t\tjec.login=mac.login AND \n\t\t\t\t\t\t\tjep.login=mac.login AND \n\t\t\t\t\t\t\tjep.professeur='" . $_SESSION['login'] . "' ORDER BY classe;";
     } elseif ($_SESSION['statut'] == 'administrateur' || $_SESSION['statut'] == 'secours') {
         $sql_correction_app = "SELECT DISTINCT c.id, c.classe FROM matieres_app_corrections mac, j_groupes_classes jgc, classes c WHERE mac.id_groupe=jgc.id_groupe AND jgc.id_classe=c.id ORDER BY classe;";
     }
     if (isset($sql_correction_app)) {
         //echo "$sql_correction_app<br />";
         $resultat = mysqli_query($mysqli, $sql_correction_app);
         if ($resultat and $resultat->num_rows > 0) {
             $afficher_correction_validation = "y";
         }
         //echo "\$afficher_correction_validation=$afficher_correction_validation<br />";
     }
     if (getSettingAOui('active_bulletins')) {
         if (getSettingValue("active_module_absence") != '2' || getSettingValue("abs2_import_manuel_bulletin") == 'y') {
             $this->creeNouveauItem("/absences/index.php", "Bulletins : saisie des absences", "Cet outil vous permet de saisir les absences sur les bulletins.");
         }
     }
     if (($this->test_prof_matiere != "0" or $this->statutUtilisateur != 'professeur') and getSettingValue("active_cahiers_texte") == 'y') {
         $this->creeNouveauItem("/cahier_texte/index.php", "Cahier de textes", "Cet outil vous permet de constituer un cahier de textes pour chacune de vos classes.");
     }
     if (($this->test_prof_matiere != "0" or $this->statutUtilisateur != 'professeur') and getSettingValue("active_carnets_notes") == 'y') {
         $this->creeNouveauItem("/cahier_notes/index.php", "Carnet de notes : saisie des notes", "Cet outil vous permet de constituer un carnet de notes pour chaque période et de saisir les notes de toutes vos évaluations.");
     }
     if (getSettingAOui('active_bulletins')) {
         if ($this->test_prof_matiere != "0" or $this->statutUtilisateur != 'professeur') {
             $this->creeNouveauItem("/saisie/index.php", "Bulletin : saisie des moyennes et des appréciations par matière", "Cet outil permet de saisir directement, sans passer par le carnet de notes, les moyennes et les appréciations du bulletin");
         }
         if ($this->statutUtilisateur == 'secours') {
             $this->creeNouveauItem("/saisie/saisie_secours_eleve.php", "Bulletin : saisie des moyennes et des appréciations pour un élève", "Cet outil permet de saisir/corriger directement, sans passer par le carnet de notes, les moyennes et les appréciations du bulletin pour un élève");
         }
         if ($afficher_correction_validation == "y") {
             $texte_item = "Cet outil vous permet de valider les corrections d'appréciations proposées par des professeurs après la clôture d'une période.";
             if ($_SESSION['statut'] == 'scolarite') {
                 $sql = "SELECT 1=1 FROM matieres_app_corrections map, j_scol_classes jsc, j_groupes_classes jgc where jsc.login='******'login'] . "' AND jsc.id_classe=jgc.id_classe AND jgc.id_groupe=map.id_groupe;";
                 $resultat = mysqli_query($mysqli, $sql);
                 $nb_aid = $resultat->num_rows;
                 if ($nb_aid > 0) {
                     $texte_item .= "<br /><span style='color:red;'>Une ou des propositions requièrent votre attention.</span>\n";
                 }
             } else {
                 $texte_item .= "<br /><span style='color:red;'>Une ou des propositions requièrent votre attention.</span>\n";
             }
             $this->creeNouveauItem("/saisie/validation_corrections.php", "Correction des bulletins", $texte_item);
         }
         if ($this->test_prof_suivi != "0" and getSettingValue("GepiRubConseilProf") == 'yes' or $this->statutUtilisateur == 'scolarite' and getSettingValue("GepiRubConseilScol") == 'yes' or $this->statutUtilisateur == 'cpe' and getSettingValue("GepiRubConseilCpe") == 'yes' || getSettingValue("GepiRubConseilCpeTous") == 'yes' or $this->statutUtilisateur == 'secours') {
             $this->creeNouveauItem("/saisie/saisie_avis.php", "Bulletin : saisie des avis du conseil", "Cet outil permet la saisie des avis du conseil de classe.");
         }
     }
     // Saisie ECTS - ne doit être affichée que si l'utilisateur a bien des classes ouvrant droit à ECTS
     if ($this->statutUtilisateur == 'professeur') {
         $this->test_prof_ects = sql_count(sql_query("SELECT jgc.saisie_ects\n\t\t\t\tFROM j_groupes_classes jgc, j_groupes_professeurs jgp\n\t\t\t\tWHERE (jgc.saisie_ects = TRUE\n\t\t\t\t  AND jgc.id_groupe = jgp.id_groupe\n\t\t\t\t  AND jgp.login = '******')"));
         $this->test_prof_suivi_ects = sql_count(sql_query("SELECT jgc.saisie_ects\n\t\t\t\tFROM j_groupes_classes jgc, j_eleves_professeurs jep, j_eleves_groupes jeg\n\t\t\t\tWHERE (jgc.saisie_ects = TRUE\n\t\t\t\tAND jgc.id_groupe = jeg.id_groupe\n\t\t\t\tAND jeg.login = jep.login AND jep.professeur = '" . $this->loginUtilisateur . "')"));
     } else {
         $sql = "SELECT jgc.saisie_ects\n\t\t\t\tFROM j_groupes_classes jgc, j_scol_classes jsc\n\t\t\t\tWHERE (jgc.saisie_ects = TRUE\n\t\t\t\tAND jgc.id_classe = jsc.id_classe\n\t\t\t\tAND jsc.login = '******')";
         $resultat = mysqli_query($mysqli, $sql);
         $this->test_scol_ects = $resultat->num_rows;
     }
     $conditions_ects = ($this->gepiSettings['active_mod_ects'] == 'y' and ($this->test_prof_suivi != "0" and $this->gepiSettings['GepiAccesSaisieEctsPP'] == 'yes' and $this->test_prof_suivi_ects != "0" or $this->statutUtilisateur == 'professeur' and $this->gepiSettings['GepiAccesSaisieEctsProf'] == 'yes' and $this->test_prof_ects != "0" or $this->statutUtilisateur == 'scolarite' and $this->gepiSettings['GepiAccesSaisieEctsScolarite'] == 'yes' and $this->test_scol_ects != "0" or $this->statutUtilisateur == 'secours'));
     if ($conditions_ects) {
         $this->creeNouveauItem("/mod_ects/index_saisie.php", "Crédits ECTS", "Saisie des crédits ECTS");
     }
     if (getSettingAOui('active_bulletins')) {
         // Pour un professeur, on n'appelle que les aid qui sont sur un bulletin
         $sql = "SELECT * FROM aid_config\n\t\t\t\t\t\t\t\t  WHERE display_bulletin = 'y'\n\t\t\t\t\t\t\t\t  OR bull_simplifie = 'y'\n\t\t\t\t\t\t\t\t  ORDER BY nom";
         $resultat = mysqli_query($mysqli, $sql);
         while ($obj = $resultat->fetch_object()) {
             $indice_aid = $obj->indice_aid;
             $call_prof = mysqli_query($mysqli, "SELECT * FROM j_aid_utilisateurs\n                                          WHERE (id_utilisateur = '" . $this->loginUtilisateur . "'\n                                          AND indice_aid = '" . $indice_aid . "')");
             $nb_result = $resultat->num_rows;
             if ($nb_result != 0 or $this->statutUtilisateur == 'secours') {
                 $nom_aid = $obj->nom;
                 $this->creeNouveauItem("/saisie/saisie_aid.php?indice_aid=" . $indice_aid, $nom_aid, "Cet outil permet la saisie des appréciations des " . $this->gepiSettings['denomination_eleves'] . " pour les {$nom_aid}.");
             }
         }
         //==============================
         // Pour permettre la saisie de commentaires-type, renseigner la variable $commentaires_types dans /lib/global.inc
         // Et récupérer le paquet commentaires_types sur... ADRESSE A DEFINIR:
         if (file_exists('saisie/commentaires_types.php')) {
             $resultat = $nb_lignes = mysqli_query($mysqli, "SELECT 1=1 FROM j_eleves_professeurs\n\t\t\t\t\t\t\t\t\t\t\t\t  WHERE professeur='" . $this->loginUtilisateur . "'");
             $nb_lignes = $resultat->num_rows;
             if ($this->statutUtilisateur == 'professeur' and getSettingValue("CommentairesTypesPP") == 'yes' and $nb_lignes > 0 or $this->statutUtilisateur == 'scolarite' and getSettingValue("CommentairesTypesScol") == 'yes' or $this->statutUtilisateur == 'cpe' and getSettingValue("CommentairesTypesCpe") == 'yes') {
                 $this->creeNouveauItem("/saisie/commentaires_types.php", "Saisie de commentaires-types", "Permet de définir des commentaires-types pour l'avis du conseil de classe.");
             }
         }
         if ($this->b > 0) {
             $this->creeNouveauTitre('accueil', "Saisie", 'images/icons/configure.png');
             return true;
         }
     }
 }
Beispiel #8
0
 * Fonctions de mise à jour
 */
require_once ("./update_functions.php");


// Resume session
$resultat_session = $session_gepi->security_check();

if (isset ($_POST['submit'])) {
	if (isset ($_POST['login']) && isset ($_POST['no_anti_inject_password'])) {
		$_POST['login'] = strtoupper($_POST['login']);
		$md5password = md5($NON_PROTECT['password']);
		$sql = "SELECT UPPER(login) login, password, prenom, nom, statut FROM utilisateurs WHERE (login = '******'login'] . "' and password = '******' and etat != 'inactif' and statut = 'administrateur')";

		$res_user = sql_query($sql);
		$num_row = sql_count($res_user);

		if ($num_row == 1) {
			$valid = 'yes';
			$resultat_session = "1";
			$_SESSION['login'] = $_POST['login'];
			$_SESSION['statut'] = 'administrateur';
			$_SESSION['etat'] = 'actif';
			$_SESSION['start'] = old_mysql_result(mysqli_query($GLOBALS["mysqli"], "SELECT now();"),0);
			$sql = "INSERT INTO log (LOGIN, START, SESSION_ID, REMOTE_ADDR, USER_AGENT, REFERER, AUTOCLOSE, END) values (
					'" . $_SESSION['login'] . "',
					'".$_SESSION['start']."',
					'" . session_id() . "',
					'" . $_SERVER['REMOTE_ADDR'] . "',
					'" . $_SERVER['HTTP_USER_AGENT'] . "',
					'" . $_SERVER['HTTP_REFERER'] . "',
Beispiel #9
0
        $res = sql_query($sql);
        if (!$res) {
            fatal_error(0, sql_error());
        }
    }
    $row = sql_row_keyed($res, 0);
    $id = $row['id'];
    sql_free($res);
} else {
    $repeat_id = $row['repeat_id'];
    if ($repeat_id != 0) {
        $res = sql_query("SELECT rep_type, end_date, rep_opt, rep_num_weeks\n                      FROM {$tbl_repeat} WHERE id={$repeat_id}");
        if (!$res) {
            fatal_error(0, sql_error());
        }
        if (sql_count($res) == 1) {
            $row = sql_row_keyed($res, 0);
            $rep_type = $row['rep_type'];
            $rep_end_date = utf8_strftime('%A %d %B %Y', $row['end_date']);
            $rep_opt = $row['rep_opt'];
            $rep_num_weeks = $row['rep_num_weeks'];
        }
        sql_free($res);
    }
}
$enable_periods ? toPeriodString($start_period, $duration, $dur_units) : toTimeString($duration, $dur_units);
$repeat_key = "rep_type_" . $rep_type;
// Now that we know all the data we start drawing it
?>

<h3><?php 
Beispiel #10
0
             $end_time = $row['end_time'];
             $duration = $row['end_time'] - $row['start_time'] - cross_dst($row['start_time'], $row['end_time']);
             break;
         default:
             $custom_fields[$column] = $keep_private && isset($is_private_field["entry.{$column}"]) && $is_private_field["entry.{$column}"] ? '' : $row[$column];
             break;
     }
 }
 if ($entry_type == ENTRY_RPT_ORIGINAL || $entry_type == ENTRY_RPT_CHANGED) {
     $sql = "SELECT rep_type, start_time, end_time, end_date, rep_opt, rep_num_weeks,\n                   month_absolute, month_relative\n              FROM {$tbl_repeat} \n             WHERE id={$rep_id}\n             LIMIT 1";
     $res = sql_query($sql);
     if (!$res) {
         trigger_error(sql_error(), E_USER_WARNING);
         fatal_error(TRUE, get_vocab("fatal_db_error"));
     }
     if (sql_count($res) != 1) {
         fatal_error(1, get_vocab("repeat_id") . $rep_id . get_vocab("not_found"));
     }
     $row = sql_row_keyed($res, 0);
     sql_free($res);
     $rep_type = $row['rep_type'];
     if (!isset($rep_type)) {
         $rep_type == REP_NONE;
     }
     // If it's a repeating entry get the repeat details
     if ($rep_type != REP_NONE) {
         // If we're editing the series we want the start_time and end_time to be the
         // start and of the first entry of the series, not the start of this entry
         if ($edit_type == "series") {
             $start_time = $row['start_time'];
             $end_time = $row['end_time'];
Beispiel #11
0
        // repeat_id and then recurrence_id
        $sql .= " ORDER BY repeat_id, ical_recur_id";
    } elseif ($sortby == "r") {
        // Order by Area, Room, Start date/time
        $sql .= " ORDER BY area_name, sort_key, start_time";
    } else {
        // Order by Start date/time, Area, Room
        $sql .= " ORDER BY start_time, area_name, sort_key";
    }
    // echo "<p>DEBUG: SQL: <tt> $sql </tt></p>\n";
    $res = sql_query($sql);
    if (!$res) {
        trigger_error(sql_error(), E_USER_WARNING);
        fatal_error(FALSE, get_vocab("fatal_db_error"));
    }
    $nmatch = sql_count($res);
}
$combination_not_supported = $output == SUMMARY && $output_format == OUTPUT_ICAL;
$output_form = $output_format == OUTPUT_HTML && !$ajax && !$cli_mode || $combination_not_supported;
// print the page header
if ($ajax) {
    // don't do anything if this is an Ajax request:  we only want the data
} elseif ($output_form) {
    print_header($day, $month, $year, $area, isset($room) ? $room : "");
} else {
    $filename = $output == REPORT ? $report_filename : $summary_filename;
    switch ($output_format) {
        case OUTPUT_CSV:
            $filename .= '.csv';
            $content_type = "text/csv; charset=" . get_csv_charset();
            break;
Beispiel #12
0
$sql = "select room_name, capacity, id from mrbs_room where area_id={$area} order by 1";
$res = sql_query($sql);
# It might be that there are no rooms defined for this area.
# If there are none then show an error and dont bother doing anything
# else
if (!$res) {
    fatal_error(0, sql_error());
}
if (sql_count($res) == 0) {
    echo "<h1>{$lang['no_rooms_for_area']}</h1>";
    sql_free($res);
} else {
    #This is where we start displaying stuff
    echo "<table cellspacing=0 border=1 width=\"100%\">";
    echo "<tr><th width=\"1%\">{$lang['time']}</th>";
    $room_column_width = (int) (95 / sql_count($res));
    for ($i = 0; $row = sql_row($res, $i); $i++) {
        echo "<th width=\"{$room_column_width}%\">" . htmlspecialchars($row[0]) . "({$row['1']})</th>";
        $rooms[] = $row[2];
    }
    echo "</tr>\n";
    # URL for highlighting a time. Don't use REQUEST_URI or you will get
    # the timetohighlight parameter duplicated each time you click.
    $hilite_url = "day.php?year={$year}&month={$month}&day={$day}&area={$area}&timetohighlight";
    # This is the main bit of the display
    # We loop through unixtime and then the rooms we just got
    for ($t = $am7; $t <= $pm7; $t += $resolution) {
        # Show the time linked to the URL for highlighting that time
        echo "<tr>";
        tdcell("red");
        echo "<a href=\"{$hilite_url}={$t}\">" . date("H:i", $t) . "</a></td>";
Beispiel #13
0
    include "trailer.inc";
    exit;
}
if (!isset($search_pos) || $search_pos <= 0) {
    $search_pos = 0;
} elseif ($search_pos >= $total) {
    $search_pos = $total - $total % $search["count"];
}
# Now we set up the "real" query using LIMIT to just get the stuff we want.
$sql = "SELECT E.id, E.create_by, E.name, E.description, E.start_time, R.area_id\n        FROM {$tbl_entry} E, {$tbl_room} R\n        WHERE {$sql_pred}\n        AND E.room_id = R.id\n        ORDER BY E.start_time asc " . sql_syntax_limit($search["count"], $search_pos);
# this is a flag to tell us not to display a "Next" link
$result = sql_query($sql);
if (!$result) {
    fatal_error(0, sql_error());
}
$num_records = sql_count($result);
$has_prev = $search_pos > 0;
$has_next = $search_pos < $total - $search["count"];
if ($has_prev || $has_next) {
    echo "<B>" . get_vocab("records") . ($search_pos + 1) . get_vocab("through") . ($search_pos + $num_records) . get_vocab("of") . $total . "</B><br>";
    # display a "Previous" button if necessary
    if ($has_prev) {
        echo "<A HREF=\"search.php?search_str={$search_url}&amp;search_pos=";
        echo max(0, $search_pos - $search["count"]);
        echo "&amp;total={$total}&amp;year={$year}&amp;month={$month}&amp;day={$day}\">";
    }
    echo "<B>" . get_vocab("previous") . "</B>";
    if ($has_prev) {
        echo "</A>";
    }
    # print a separator for Next and Previous
Beispiel #14
0
    // On récupère la liste des années archivées pour l'élève
    $annees = mysqli_query($GLOBALS["mysqli"], "SELECT DISTINCT(a.annee) FROM archivage_ects a WHERE a.ine = '".$Eleve->getNoGep()."' ORDER BY a.annee ASC");
    $annees_archivees = array();
    $nb_annees = mysqli_num_rows($annees);
    $t_index = 0;
    for ($a=0;$a<$nb_annees;$a++) {
        $valeur_annee = old_mysql_result($annees, $a);
        $redoublant = sql_count(sql_query("SELECT * FROM archivage_eleves2 WHERE ine = '".$Eleve->getNoGep()."' and annee = '".$valeur_annee."' AND doublant = 'R'")) != "0" ? true : false;
        // Si l'année est une année de redoublement, on va écraser l'année précédente.
        if ($test_redoublant == 'R' and $t_index > 0) $t_index--;
        $annees_archivees[$t_index] = $valeur_annee;
        $t_index++;
    }
    // Enfin, si on a un redoublant pour l'année en cours, alors on supprime
    // la dernière année archivée
    $redoublant = sql_count(sql_query("SELECT * FROM j_eleves_regime WHERE login = '******' AND doublant = 'R'")) != "0" ? true : false;
    if ($redoublant) {
      $t_index--;
      unset($annees_archivees[$t_index]);
    }

    // Tableau qui contient le total des crédits par année
    $total_credits_annees = array();
    foreach($annees_archivees as $annee_archive) {
        $total_credits_annees[$annee_archive] = 0;
    }
    $total_credits_annees[$gepiSettings['gepiYear']] = 0;

    // Boucle de traitement des archives
    $periode_courante = 1;
    foreach($annees_archivees as $annee_archive) {
Beispiel #15
0
function maj_1_950($installee)
{
    // oubli de gerer le prefixe lors l'introduction de l'abstraction
    // => Relancer les MAJ concernees si la version dont on part les avait fait
    if ($installee >= 1.946) {
        serie_alter('950a', $GLOBALS['maj'][1946]);
    }
    if ($installee >= 1.947) {
        serie_alter('950b', $GLOBALS['maj'][1947]);
    }
    if ($installee >= 1.949) {
        @serie_alter('950c', $GLOBALS['maj'][1949]);
    }
    global $tables_auxiliaires;
    include_spip('base/auxiliaires');
    $v = $tables_auxiliaires[$k = 'spip_urls'];
    sql_create($k, $v['field'], $v['key'], false, false);
    foreach (array('article' => 'id_article', 'rubrique' => 'id_rubrique', 'breve' => 'id_breve', 'auteur' => 'id_auteur', 'mot' => 'id_mot', 'syndic' => 'id_syndic') as $type => $id_objet) {
        $table = $type == 'syndic' ? $type : $type . "s";
        $date = $type == 'breve' ? 'date_heure' : ($type == 'auteur' ? 'maj' : ($type == 'mot' ? 'maj' : 'date'));
        $q = @sql_select("url_propre AS url, {$id_objet} AS id_objet, '{$type}' AS type, {$date} as date", "spip_{$table}", "url_propre<>''");
        if (!$q) {
            return;
        }
        // anormal, mais ne pas boucler en erreur
        while ($r = sql_fetch($q)) {
            sql_replace('spip_urls', $r);
        }
        spip_log("table {$table} : " . sql_count($q) . " urls propres copiees");
        sql_alter("TABLE spip_{$table} DROP INDEX `url_propre`");
        sql_alter("TABLE spip_{$table} DROP `url_propre`");
    }
}
Beispiel #16
0
function autoriser_forum_modifier($faire, $type, $id, $qui, $opt) {

	// Le webmestre
	if ($GLOBALS['autorite']['editer_forums'] >= 1
	AND autoriser('webmestre', $type, $id, $qui, $opt))
		return true;

	// Les admins
	if (
		$GLOBALS['autorite']['editer_forums'] >= 2
		AND $qui['statut'] == '0minirezo'
		AND !$qui['restreint']
	)
		return true;

	// L'auteur du message (enregistre')
	// 2 = avec une periode de grace d'une heure
	// 3 = ad vitam
	if ($GLOBALS['autorite']['editer_forums'] >= 3
	AND isset($qui['id_auteur'])) {
		$q = "SELECT id_forum FROM spip_forum WHERE id_forum="._q($id)." AND id_auteur="._q($qui['id_auteur']);
		if ($GLOBALS['autorite']['editer_forums'] == 3)
			$q .= " AND date_heure > DATE_SUB(NOW(), INTERVAL 1 HOUR)";
		$s = spip_query($q);
		if (sql_count($s))
			return true;
	}

	// par defaut
	return autoriser_forum_modifier_dist($faire, $type, $id, $qui, $opt);

}
Beispiel #17
0
  */
 // Validate Referrer Page CSRF
 //
 // Define Variables from Form POST
 $frm_sdk_act_usr_login = strtolower(sdk_sanitize($_POST['sdk_act_usr_login']));
 /**
  *
  *   Verify if Email Account Exists
  *
  *   Perform SQL lookup to determine if account exists
  *   in the database already. The email address is the
  *   unique value used for lookup reference.
  *
  */
 // SELECT Count of Users with Same Email Address
 $frm_unique_count = sql_count($model_sdk_act_usr, array("sdk_act_usr_login" => $frm_sdk_act_usr_login));
 // failure: if account is not found, or multiple accounts found
 if ($frm_unique_count != '1') {
     // sdk_log();
     header('Location: login.php?t=reset&msg=3');
 }
 // success: if account is found
 if ($frm_unique_count == '1') {
     // select user account from database
     $frm_sdk_act_usr_select = sql_first($model_sdk_act_usr, array("sdk_act_usr_login" => $frm_sdk_act_usr_login));
     // define variables for database values
     $frm_sdk_act_uid = $frm_sdk_act_usr_select['sdk_act_uid'];
     $frm_sdk_act_grp = $frm_sdk_act_usr_select['sdk_act_grp'];
     $frm_sdk_act_usr = $frm_sdk_act_usr_select['sdk_act_usr'];
     $frm_sdk_act_usr_fullname = $frm_sdk_act_usr_select['sdk_act_usr_fullname'];
     $frm_sdk_act_usr_email = $frm_sdk_act_usr_select['sdk_act_usr_email'];
Beispiel #18
0
function formulaires_upload_traiter_dist($objet, $id_objet, $fond_documents){
	$res = array('editable'=>' ', 'message_ok'=>'');

	$invalider = false;
	$type = objet_type($objet);
	$res['message_ok'] = "";
	$compteur=0;

	// titrer des documents ?
	if (is_array(_request('ref'))) {
		foreach (_request('ref') as $ref) {
		$ref = intval($ref);
			if ($titre = _request("titrer_$ref")) {
			if (formulaireupload_verifier_doc_liaison($ref,$id_objet,$type))
				sql_updateq('spip_documents', array('titre' => $titre) ,'id_document='.$ref);         
			}
		}     
	}

	// supprimer des documents ?   
	if (is_array(_request('supprimer'))) {
	foreach (_request('supprimer') as $supprimer) {
		if ($supprimer = intval($supprimer)) {
			include_spip('inc/autoriser');
		if (formulaireupload_verifier_doc_liaison($supprimer,$id_objet,$type)) {
			sql_delete('spip_documents_liens', 'id_document='.$supprimer);
				$supprimer_document = charger_fonction('supprimer_document','action');
				$supprimer_document($supprimer);
				$invalider = true;
				$compteur++; 			
			spip_log("supprimer document ($type)".$supprimer, 'upload');
		} 			
		}
  	}
	$res['message_ok'] .= _T("formupload:msg_doc_deleted",array("compteur"=>$compteur))."<br />";
	}

	// Ajouter un document (cf plugins-dist/medias)
	include_spip('inc/joindre_document');
	$files = joindre_trouver_fichier_envoye();

	if (is_array($files)) {     
	$compteur = 0; 

	// gestion des quotas ?
	$quota = intval(lire_config("formulaireupload/files_quota"));
	$quota_left = 100;
	if ($quota>0) {
			if ($res_nb_objet = sql_select('id_document', 'spip_documents_liens', array("objet = '$type'",'id_objet='.intval($id_objet))))
						$nb_objet = sql_count($res_nb_objet);
			$quota_left = $quota - $nb_objet;  
			if ($quota_left<1 OR $quota_left<count($files)) 
				$res['message_ok'] .=  _T("formupload:msg_doc_added_max",array("max"=>$quota))."<br />";

		// on reduit les fichiers proposés par le quota restant       
			array_splice($files, $quota_left); 
    }


	// upload des fichiers
	if ($quota_left>0) {
		$ajouter_documents = charger_fonction('ajouter_documents', 'action');
		$nouveaux_doc = $ajouter_documents($id_document,$files,$objet,$id_objet,'document');

		$compteur = count($nouveaux_doc);
	}
	/* A verifier:
		- securite : verifier les extenxions (si forcing)

	*/
		$invalider = true;
		if ($compteur>0)
		$res['message_ok'] .= _T("formupload:msg_doc_added",array("compteur"=>$compteur));
	}

	if ($invalider) {
		include_spip('inc/invalideur');
		suivre_invalideur("0",true);
		spip_log('invalider', 'upload');
	}

	return $res;
}
Beispiel #19
0
            ?>
</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td colspan="2">
        <?php 
            echo $content;
            ?>
        <?php 
            // fichier joint
            $architecture = "cl_dev" . $devoir->id_groupe;
            $req_docs = "SELECT titre, emplacement FROM ct_documents WHERE id_ct = {$devoir->id_ct} AND emplacement LIKE '%" . $architecture . "%' ORDER BY titre";
            $res1 = sql_query($req_docs);
            if ($res1 and sql_count($res1) != 0) {
                $content_dos = "<small style=\"font-weight: bold;\">Document(s) joint(s):</small>";
                $content_dos .= "<ul type=\"disc\" style=\"padding-left: 15px;\">";
                $res_docs = mysqli_query($GLOBALS["mysqli"], $req_docs);
                while ($doc = mysqli_fetch_object($res_docs)) {
                    $content_dos .= "<li style=\"padding: 0px; margin: 0px; \"><a href=\"{$doc->emplacement}\">{$doc->titre}</a></li>";
                }
                $content_dos .= "</ul>";
                echo $content_dos;
            }
            $content_dos = '';
            ?>
                                </td>
                            </tr>
                        </tbody>
                    </table>
Beispiel #20
0
    <INPUT NAME="all_day" TYPE="checkbox" VALUE="yes" onClick="OnAllDayClick(this)"> <?php 
echo get_vocab("all_day");
?>
</TD></TR>


<?php 
# Determine the area id of the room in question first
$sql = "select area_id from {$tbl_room} where id={$room_id}";
$res = sql_query($sql);
$row = sql_row($res, 0);
$area_id = $row[0];
# determine if there is more than one area
$sql = "select id from {$tbl_area}";
$res = sql_query($sql);
$num_areas = sql_count($res);
# if there is more than one area then give the option
# to choose areas.
if ($num_areas > 1) {
    ?>
<script language="JavaScript">
<!--
function changeRooms( formObj )
{
    areasObj = eval( "formObj.areas" );

    area = areasObj[areasObj.selectedIndex].value
    roomsObj = eval( "formObj.elements['rooms[]']" )

    // remove all entries
    for (i=0; i < (roomsObj.length); i++)
Beispiel #21
0
 //$flag = 0;
 $alt = 1;
 if ($calldata) {
     for ($k = 0; $row = sql_row($calldata, $k); $k++) {
         $precedente_date_fin = "0000-00-00 00:00:00";
         $id_classe = $row[0];
         $classe = $row[1];
         $alt = $alt * -1;
         echo "<tr class='lig{$alt} white_hover'";
         //if ($flag==1) { echo " class='fond_sombre'"; $flag = 0;} else {$flag=1;};
         echo ">\n";
         echo "<td>\n";
         echo "<b>{$classe}</b> ";
         echo "</td>\n";
         $periode_query = sql_query("SELECT nom_periode, verouiller, date_fin FROM periodes WHERE id_classe = '{$id_classe}' ORDER BY num_periode");
         $nb_periode = sql_count($periode_query) + 1;
         $j = 0;
         if ($periode_query) {
             for ($i = 0; $row_per = sql_row($periode_query, $i); $i++) {
                 $nom_classe = "cl_" . $id_classe . "_" . $i;
                 echo "<td>" . ucfirst($row_per[0]) . "</td>\n";
                 if ($row_per[1] == "N") {
                     echo "<td id='c_" . $id_classe . "_" . $i . "' style='font-size:small; color:green;'>Ouvert</td>\n";
                 } elseif ($row_per[1] == "P") {
                     echo "<td id='c_" . $id_classe . "_" . $i . "' style='font-size:small; color:orange;'>Partiel.clos</td>\n";
                 } elseif ($row_per[1] == "O") {
                     echo "<td id='c_" . $id_classe . "_" . $i . "' style='font-size:small; color:red;'>Clos</td>\n";
                 } else {
                     // Ca ne devrait pas arriver
                     echo "<td>&nbsp;</td>\n";
                 }
function spiplistes_afficher_pile_messages() {

	$sql_select = "id_liste,titre,date,maj,periode,patron,statut";
	$list = sql_select($sql_select, 'spip_listes', "message_auto='oui' AND date > 0");

	if (sql_count($list) == 0) {
		return (false); 
	}
	
	$pile_result = ""
		. debut_cadre_enfonce(_DIR_PLUGIN_SPIPLISTES_IMG_PACK.'stock_timer.gif', true, ''
			, _T('spiplistes:Messages_automatiques').spiplistes_plugin_aide(_SPIPLISTES_EXEC_AIDE, "casier_courriers"))
		. "\n"
		. "<table class='spiplistes-tab' width='100%'  border='0' cellspacing='1' cellpadding='0'>\n" 
		. "<tr>\n"
		. "<th>"._T('spiplistes:envoi_patron')."</th>\n"
		. "<th>"._T('spiplistes:sur_liste')."</th>\n"
		. "<th>"._T('spiplistes:prochain_envoi_prevu')."</th>\n"
		. "</tr>\n"
		;

	$couleur_ligne = 1;
	while($row = sql_fetch($list)) {
		foreach(explode(",", $sql_select) as $key) {
			$$key = $row[$key];
		}
	
		$date_dernier = date(_T('spiplistes:format_date'), strtotime($maj)) ;
		switch($statut) {
			case _SPIPLISTES_LIST_PRIV_HEBDO:
			case _SPIPLISTES_LIST_PRIV_WEEKLY:
			case _SPIPLISTES_LIST_PUB_HEBDO:
			case _SPIPLISTES_LIST_PUB_WEEKLY:
				$periodicite = _T('spiplistes:Liste_hebdo');
				break;
			case _SPIPLISTES_LIST_PRIV_MENSUEL:
			case _SPIPLISTES_LIST_PRIV_MONTHLY:
			case _SPIPLISTES_LIST_PUB_MENSUEL:
			case _SPIPLISTES_LIST_PUB_MONTHLY:
				$periodicite = _T('spiplistes:Liste_mensuelle');
				break;
			case _SPIPLISTES_LIST_PRIV_YEARLY:
			case _SPIPLISTES_LIST_PUB_YEARLY:
				$periodicite = _T('spiplistes:Liste_annuelle');
				break;
			case _SPIPLISTES_LIST_PRIV_DAILY:
			case _SPIPLISTES_LIST_PUB_DAILY:
				if($periode) {
					$periodicite = _T('spiplistes:Tous_les_s'
					, array('s' => spiplistes_singulier_pluriel_str_get($periode, _T('spiplistes:jour'), _T('spiplistes:jours')))
					);
				} else {
					$periodicite = _T('spiplistes:Listes_autre');
				}
				break;
			default:
				$periodicite = _T('spiplistes:envoi_manuel');
		}
	
		$ii = 0;
		$pile_result .= ''
			. '<tr ' . ((($couleur_ligne++) % 2) ? 'class="row-even"' : '') . '>' . PHP_EOL
			. '<td><a href="' . generer_url_public('patron_switch',"patron=$patron&date=$date_dernier").'">'.$patron.'</a>'
			. '<br />'.$periodicite.'</td>' . PHP_EOL
			. '<td><a href="' . generer_url_ecrire(_SPIPLISTES_EXEC_LISTE_GERER, 'id_liste='.$id_liste) . '">'
				. $titre . '</a>'
			. '<br />'.spiplistes_nb_abonnes_liste_str_get($id_liste).'.'
			. '</td>'
			. '<td>'
			. spiplistes_affdate ($date)
			. '</td></tr>' . PHP_EOL
			;
	} // end while
	
	$pile_result .= ""
		. "</table>\n"
		. fin_cadre_enfonce(true)
		;
	return ($pile_result);
	
} // end spiplistes_afficher_pile_messages()
 function content_details()
 {
     if ($this->content_id) {
         $content_id = $this->content_id;
         $sql = "SELECT c.id, c.content, c.mime_type, fc.duration FROM content c\n                        LEFT JOIN feed_content fc ON c.id = fc.content_id WHERE c.id = {$content_id} AND moderation_flag = 1;";
         $res = sql_query($sql);
         if ($res && sql_count($res)) {
             $data = sql_row_keyed($res, 0);
             $this->content_id = $data['id'];
             $json['content'] = stripslashes($data['content']);
             $json['mime_type'] = stripslashes($data['mime_type']);
             $json['duration'] = $data['duration'];
             if ($data['mime_type'] == 'text/time') {
                 //This executes time code
                 $json['mime_type'] = 'text/html';
                 $json['content'] = date($data['content']);
             }
             $this->log_back();
             return $json;
         } else {
             $this->construct_timeline();
             $this->get_content();
             return $this->content_details();
         }
     } else {
         $this->construct_timeline();
         $this->get_content();
         return $this->content_details();
     }
 }
Beispiel #24
0
/**
 * Compte le nombre de plugins, paquets ou autres contributions
 * en fonction de l'entité demandée et de contraintes
 *
 * Calcule, pour un type d'entité demandé (depot, plugin, paquet, catégorie)
 * leur nombre en fonction de certaines contraintes, tel que l'appartenance
 * à un certain dépot, une certaine catégorie ou une certaine branche de SPIP.
 *
 * Lorsque l'entité demandée est un dépot, le tableau des totaux possède,
 * en plus du nombre de dépots, le nombre de plugins et paquets.
 * 
 * @note
 *     Attention le critère de compatibilite SPIP pris en compte est uniquement
 *     celui d'une branche SPIP
 * 
 * @param string $entite
 *     De quoi veut-on obtenir des comptes. Peut être 'depot', 'plugin',
 *    'paquet' ou 'categorie'
 * @param int $id_depot
 *     Identifiant du dépot
 *     Zéro (par défaut) signifie ici : «dans tous les dépots distants»
 *     (id_dépot>0) et non «dans le dépot local»
 * @param string $categorie
 *     Type de catégorie (auteur, communication, date...)
 * @param string $compatible_spip
 *     Numéro de branche de SPIP. (3.0, 2.1, ...)
 * @return array
 *     Couples (entite => nombre).
**/
function svp_compter($entite, $id_depot = 0, $categorie = '', $compatible_spip = '')
{
    $compteurs = array();
    $group_by = array();
    $where = array();
    if ($id_depot) {
        $where[] = "t1.id_depot=" . sql_quote($id_depot);
    } else {
        $where[] = "t1.id_depot>0";
    }
    if ($entite == 'plugin') {
        $from = 'spip_plugins AS t2, spip_depots_plugins AS t1';
        $where[] = "t1.id_plugin=t2.id_plugin";
        if ($categorie) {
            $where[] = "t2.categorie=" . sql_quote($categorie);
        }
        if ($compatible_spip) {
            $creer_where = charger_fonction('where_compatible_spip', 'inc');
            $where[] = $creer_where($compatible_spip, 't2', '>');
        }
        $compteurs['plugin'] = sql_count(sql_select('t2.id_plugin', $from, $where));
    } elseif ($entite == 'paquet') {
        if ($categorie) {
            $ids = sql_allfetsel('id_plugin', 'spip_plugins', 'categorie=' . sql_quote($categorie));
            $ids = array_map('reset', $ids);
            $where[] = sql_in('t1.id_plugin', $ids);
        }
        if ($compatible_spip) {
            $creer_where = charger_fonction('where_compatible_spip', 'inc');
            $where[] = $creer_where($compatible_spip, 't1', '>');
        }
        $compteurs['paquet'] = sql_countsel('spip_paquets AS t1', $where);
    } elseif ($entite == 'depot') {
        $champs = array('COUNT(t1.id_depot) AS depot', 'SUM(t1.nbr_plugins) AS plugin', 'SUM(t1.nbr_paquets) AS paquet', 'SUM(t1.nbr_autres) AS autre');
        $compteurs = sql_fetsel($champs, 'spip_depots AS t1', $where);
    } elseif ($entite == 'categorie') {
        $from = array('spip_plugins AS t2');
        $where_depot = $where[0];
        $where = array();
        if ($id_depot) {
            $ids = sql_allfetsel('id_plugin', 'spip_depots_plugins AS t1', $where_depot);
            $ids = array_map('reset', $ids);
            $where[] = sql_in('t2.id_plugin', $ids);
        }
        if ($compatible_spip) {
            $creer_where = charger_fonction('where_compatible_spip', 'inc');
            $where[] = $creer_where($compatible_spip, 't2', '>');
        }
        if ($categorie) {
            $where[] = "t2.categorie=" . sql_quote($categorie);
        } else {
            $group_by = array('t2.categorie');
        }
        $compteurs['categorie'] = sql_countsel($from, $where, $group_by);
    }
    return $compteurs;
}
Beispiel #25
0
//send a password reset request to a user
//check if form submitted
if (!isset($_POST['email'])) {
    return false;
}
//variables not set yet
//get variables
$email = set_post('email', '');
if (empty($email) || !email_is_valid($email)) {
    notices_set('Invalid email.', 'error');
    return false;
}
//check if it is valid
$sql = sql_query(" SELECT id FROM `users` WHERE email='{$email}' LIMIT 1 ");
if (sql_count($sql) <= 0) {
    notices_set('Invalid email.', 'error');
    return false;
}
$data = sql_fetch($sql);
//create code
$confirm = confirm_token_create($email);
//delete all tokens for that email
sql_query(" DELETE FROM `password_reset` WHERE user='******'id']}' LIMIT 1 ");
//insert
sql_query(" INSERT INTO `password_reset` (user, token) VALUES('{$data['id']}' , '{$confirm}') \n\t\t\tON DUPLICATE KEY UPDATE token='{$confirm}' ");
//send email
email_send('password_reset', 'Planling Password Reset', array($email => $email), array('{{%LINK%}}' => 'http://' . MAIN_URL . '/password?e=' . $email . '&t=' . $confirm));
//set message
notices_set('Instructions on how to reset your password has been sent to <strong>' . $email . '</strong>.', 'success');
//redirect user
Beispiel #26
0
}
// Section with areas, rooms, minicals.
?>
<div class="screenonly">
  <div id="dwm_header">
<?php 
// Get the area and room names (we will need them later for the heading)
$this_area_name = "";
$this_room_name = "";
$this_area_name = htmlspecialchars(sql_query1("SELECT area_name FROM {$tbl_area} WHERE id={$area} LIMIT 1"));
$this_room_name = htmlspecialchars(sql_query1("SELECT room_name FROM {$tbl_room} WHERE id={$room} LIMIT 1"));
$sql = "select id, area_name from {$tbl_area} order by area_name";
$res = sql_query($sql);
// Show all available areas
// but only if there's more than one of them, otherwise there's no point
if ($res && sql_count($res) > 1) {
    echo "<div id=\"dwm_areas\"><h3>" . get_vocab("areas") . "</h3>";
    // show either a select box or the normal html list
    if ($area_list_format == "select") {
        echo make_area_select_html('week.php', $area, $year, $month, $day);
    } else {
        echo "<ul>\n";
        for ($i = 0; $row = sql_row_keyed($res, $i); $i++) {
            echo "<li><a href=\"week.php?year={$year}&amp;month={$month}&amp;day={$day}&amp;area={$row['id']}\">";
            echo "<span" . ($row['id'] == $area ? ' class="current"' : '') . ">";
            echo htmlspecialchars($row['area_name']) . "</span></a></li>\n";
        }
        echo "</ul>\n";
    }
    // end area display if
    echo "</div>\n";
      </fieldset>
    
      <fieldset>
      <legend></legend>
      <input type="hidden" name="room" value="<?php 
    echo $row["id"];
    ?>
">
    
      <?php 
    $res = sql_query("SELECT id, area_name FROM {$tbl_area}");
    if (!$res) {
        trigger_error(sql_error(), E_USER_WARNING);
        fatal_error(FALSE, get_vocab("fatal_db_error"));
    }
    if (sql_count($res) == 0) {
        fatal_error(FALSE, get_vocab('noareas'));
        // should not happen
    }
    // The area select box
    echo "<div>\n";
    $options = array();
    for ($i = 0; $row_area = sql_row_keyed($res, $i); $i++) {
        $options[$row_area['id']] = $row_area['area_name'];
    }
    $params = array('label' => get_vocab("area") . ":", 'name' => 'new_area', 'options' => $options, 'force_assoc' => TRUE, 'value' => $row['area_id'], 'disabled' => $disabled, 'create_hidden' => FALSE);
    generate_select($params);
    echo "<input type=\"hidden\" name=\"old_area\" value=\"" . $row['area_id'] . "\">\n";
    echo "</div>\n";
    // First of all deal with the standard MRBS fields
    // Room name
Beispiel #28
0
function get_area_name($user, $all = FALSE)
{
    $sql = "SELECT name\n            FROM users\n           WHERE code='{$user}'";
    if (empty($all)) {
        $sql .= " AND disabled=0";
    }
    $sql .= " LIMIT 1";
    $res = sql_query($sql);
    if ($res === FALSE) {
        trigger_error(sql_error(), E_USER_WARNING);
        return FALSE;
    }
    if (sql_count($res) == 0) {
        return NULL;
    }
    $row = sql_row($res, 0);
    return $row[0];
}
Beispiel #29
0
     exit;
 }
 // Truncate the name field to the maximum length as a precaution.
 $new_name = substr($new_name, 0, $maxlength['users.name']);
 // Check that the name is unique.
 // If it's a new user, then to check to see if there are any rows with that name.
 // If it's an update, then check to see if there are any rows with that name, except
 // for that user.
 $query = "SELECT id FROM {$tbl_users} WHERE name='" . addslashes($new_name) . "'";
 if ($Id >= 0) {
     $query .= " AND id!='{$Id}'";
 }
 $query .= " LIMIT 1";
 // we only want to know if there is at least one instance of the name
 $result = sql_query($query);
 if (sql_count($result) > 0) {
     // Now display this form again with an error message
     // Build the query string
     $q_string = "Action=" . ($Id >= 0 ? 'Edit' : 'Add');
     $q_string .= "&Id={$Id}";
     $q_string .= "&taken_name=" . urlencode($new_name);
     $q_string .= "&name_not_unique=1";
     Header("Location: edit_users.php?{$q_string}");
     exit;
 }
 $sql_fields = array();
 // For each db column, try to fetch out an appropriate form field value
 foreach ($fields as $fieldname) {
     if ($fieldname == "id") {
         // We don't add or update the id - that's autoincremented in the db
         // so move onto the next value
 private function saisie()
 {
     $this->b = 0;
     $afficher_correction_validation = "n";
     $sql = "SELECT 1=1 FROM matieres_app_corrections;";
     $test_mac = mysqli_query($GLOBALS["mysqli"], $sql);
     if (mysqli_num_rows($test_mac) > 0) {
         $afficher_correction_validation = "y";
     }
     if (getSettingValue("active_module_absence") != '2' || getSettingValue("abs2_import_manuel_bulletin") == 'y') {
         $this->creeNouveauItem("/absences/index.php", "Bulletins : saisie des absences", "Cet outil vous permet de saisir les absences sur les bulletins.");
     }
     if (($this->test_prof_matiere != "0" or $this->statutUtilisateur != 'professeur') and getSettingValue("active_cahiers_texte") == 'y') {
         $this->creeNouveauItem("/cahier_texte/index.php", "Cahier de textes", "Cet outil vous permet de constituer un cahier de textes pour chacune de vos classes.");
     }
     if (($this->test_prof_matiere != "0" or $this->statutUtilisateur != 'professeur') and getSettingValue("active_carnets_notes") == 'y') {
         $this->creeNouveauItem("/cahier_notes/index.php", "Carnet de notes : saisie des notes", "Cet outil vous permet de constituer un carnet de notes pour chaque période et de saisir les notes de toutes vos évaluations.");
     }
     if ($this->test_prof_matiere != "0" or $this->statutUtilisateur != 'professeur') {
         $this->creeNouveauItem("/saisie/index.php", "Bulletin : saisie des moyennes et des appréciations par matière", "Cet outil permet de saisir directement, sans passer par le carnet de notes, les moyennes et les appréciations du bulletin");
     }
     if ($afficher_correction_validation == "y") {
         $this->creeNouveauItem("/saisie/validation_corrections.php", "Correction des bulletins", "Cet outil vous permet de valider les corrections d'appréciations proposées par des professeurs après la clôture d'une période.<br /><span style='color:red;'>Une ou des propositions requièrent votre attention.</span>\n");
     }
     if ($this->test_prof_suivi != "0" and getSettingValue("GepiRubConseilProf") == 'yes' or $this->statutUtilisateur != 'professeur' and getSettingValue("GepiRubConseilScol") == 'yes' or $this->statutUtilisateur == 'secours') {
         $this->creeNouveauItem("/saisie/saisie_avis.php", "Bulletin : saisie des avis du conseil", "Cet outil permet la saisie des avis du conseil de classe.");
     }
     // Saisie ECTS - ne doit être affichée que si l'utilisateur a bien des classes ouvrant droit à ECTS
     if ($this->statutUtilisateur == 'professeur') {
         $this->test_prof_ects = sql_count(sql_query("SELECT jgc.saisie_ects\n\t\t\t\tFROM j_groupes_classes jgc, j_groupes_professeurs jgp\n\t\t\t\tWHERE (jgc.saisie_ects = TRUE\n\t\t\t\t  AND jgc.id_groupe = jgp.id_groupe\n\t\t\t\t  )"));
         $this->test_prof_suivi_ects = sql_count(sql_query("SELECT jgc.saisie_ects\n\t\t\t\tFROM j_groupes_classes jgc, j_eleves_professeurs jep, j_eleves_groupes jeg\n\t\t\t\tWHERE (jgc.saisie_ects = TRUE\n\t\t\t\tAND jgc.id_groupe = jeg.id_groupe\n\t\t\t\tAND jeg.login = jep.login )"));
     } else {
         $this->test_scol_ects = sql_count(sql_query("SELECT jgc.saisie_ects\n\t\t\t\tFROM j_groupes_classes jgc, j_scol_classes jsc\n\t\t\t\tWHERE (jgc.saisie_ects = TRUE\n\t\t\t\tAND jgc.id_classe = jsc.id_classe\n\t\t\t\t)"));
     }
     $conditions_ects = ($this->gepiSettings['active_mod_ects'] == 'y' and ($this->test_prof_suivi != "0" and $this->gepiSettings['GepiAccesSaisieEctsPP'] == 'yes' and $this->test_prof_suivi_ects != "0" or $this->statutUtilisateur == 'professeur' and $this->gepiSettings['GepiAccesSaisieEctsProf'] == 'yes' and $this->test_prof_ects != "0" or $this->statutUtilisateur == 'scolarite' and $this->gepiSettings['GepiAccesSaisieEctsScolarite'] == 'yes' and $this->test_scol_ects != "0" or $this->statutUtilisateur == 'secours'));
     if ($conditions_ects) {
         $this->creeNouveauItem("/mod_ects/index_saisie.php", "Crédits ECTS", "Saisie des crédits ECTS");
     }
     // Pour un professeur, on n'appelle que les aid qui sont sur un bulletin
     $call_data = mysqli_query($GLOBALS["mysqli"], "SELECT * FROM aid_config\n\t\t\t\t\t\t\t  WHERE display_bulletin = 'y'\n\t\t\t\t\t\t\t  OR bull_simplifie = 'y'\n\t\t\t\t\t\t\t  ORDER BY nom");
     $nb_aid = mysqli_num_rows($call_data);
     $i = 0;
     while ($i < $nb_aid) {
         $indice_aid = @old_mysql_result($call_data, $i, "indice_aid");
         $call_prof = mysqli_query($GLOBALS["mysqli"], "SELECT * FROM j_aid_utilisateurs\n\t\t\t\t\t\t\t\tWHERE indice_aid = '" . $indice_aid . "'");
         $nb_result = mysqli_num_rows($call_prof);
         if ($nb_result != 0 or $this->statutUtilisateur == 'secours') {
             $nom_aid = @old_mysql_result($call_data, $i, "nom");
             $this->creeNouveauItem("/saisie/saisie_aid.php?indice_aid=" . $indice_aid, $nom_aid, "Cet outil permet la saisie des appréciations des " . $this->gepiSettings['denomination_eleves'] . " pour les {$nom_aid}.");
         }
         $i++;
     }
     //==============================
     // Pour permettre la saisie de commentaires-type, renseigner la variable $commentaires_types dans /lib/global.inc
     // Et récupérer le paquet commentaires_types sur... ADRESSE A DEFINIR:
     if (file_exists('saisie/commentaires_types.php')) {
         if ($this->statutUtilisateur == 'professeur' and getSettingValue("CommentairesTypesPP") == 'yes' or $this->statutUtilisateur == 'scolarite' and getSettingValue("CommentairesTypesScol") == 'yes') {
             $this->creeNouveauItem("/saisie/commentaires_types.php", "Saisie de commentaires-types", "Permet de définir des commentaires-types pour l'avis du conseil de classe.");
         }
     }
     if ($this->b > 0) {
         $this->creeNouveauTitre('accueil', "Saisie", 'images/icons/configure.png');
         return true;
     }
 }