Example #1
0
/**
 * Load settings from the database
 *
 * Query all the settings
 * Fetch the result in the $grrSettings associative array
 *
 * Returns true if all went good, false otherwise
 *
 *
 * @return bool The settings are loaded
 */
function loadSettings()
{
    global $grrSettings;
    // Pour tenir compte du changement de nom de la table setting à partir de la version 1.8
    $test = grr_sql_query1("select NAME  from ".TABLE_PREFIX."_setting where NAME='version'");
    if ($test != -1)
       $sql = "select `NAME`, `VALUE` from ".TABLE_PREFIX."_setting";
    else
        $sql = "select `NAME`, `VALUE` from setting";
    $res = grr_sql_query($sql);
    if (! $res) return (false);
    if (grr_sql_count($res) == 0) {
        return (false);
    } else {
        for ($i = 0; ($row = grr_sql_row($res, $i)); $i++) {
            $grrSettings[$row[0]] = $row[1];
        }
        return (true);
    }
}
Example #2
0
 static function load()
 {
     $test = grr_sql_query1("SELECT NAME FROM " . TABLE_PREFIX . "_setting WHERE NAME='version'");
     if ($test != -1) {
         $sql = "SELECT `NAME`, `VALUE` FROM " . TABLE_PREFIX . "_setting";
     } else {
         $sql = "SELECT `NAME`, `VALUE` FROM setting";
     }
     $res = grr_sql_query($sql);
     if (!$res) {
         return false;
     }
     if (grr_sql_count($res) == 0) {
         return false;
     } else {
         for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
             self::$grrSettings[$row[0]] = $row[1];
         }
         return true;
     }
 }
Example #3
0
if ($error_booking_in_past == 'yes') {
    $str_date = utf8_strftime('%d %B %Y, %H:%M', $date_now);
    print_header();
    echo '<h2>' . get_vocab('booking_in_past') . '</h2>';
    if ($rep_type != 0 && !empty($reps)) {
        echo '<p>' . get_vocab('booking_in_past_explain_with_periodicity') . $str_date . '</p>';
    } else {
        echo '<p>' . get_vocab('booking_in_past_explain') . $str_date . '</p>';
    }
    echo '<a href="' . $back . '&amp;Err=yes">' . get_vocab('returnprev') . '</a>';
    include 'include/trailer.inc.php';
    die;
}
if ($error_duree_max_resa_area == 'yes') {
    $area_id = grr_sql_query1('SELECT area_id FROM ' . TABLE_PREFIX . "_room WHERE id='" . protect_data_sql($room_id) . "'");
    $duree_max_resa_area = grr_sql_query1('SELECT duree_max_resa_area FROM ' . TABLE_PREFIX . "_area WHERE id='" . $area_id . "'");
    print_header();
    $temps_format = $duree_max_resa_area * 60;
    toTimeString($temps_format, $dur_units, true);
    echo '<h2>' . get_vocab('error_duree_max_resa_area') . $temps_format . ' ' . $dur_units . '</h2>';
    echo '<a href="' . $back . '&amp;Err=yes">' . get_vocab('returnprev') . '</a>';
    include 'include/trailer.inc.php';
    die;
}
if ($error_delais_max_resa_room == 'yes') {
    print_header();
    echo '<h2>' . get_vocab('error_delais_max_resa_room') . '</h2>';
    echo '<a href="' . $back . '&amp;Err=yes">' . get_vocab('returnprev') . '</a>';
    include 'include/trailer.inc.php';
    die;
}
Example #4
0
/**
 * Resume a session
 *
 * Check that all the expected data is present
 * Check login / password against database
 * Update the timeout in the ".TABLE_PREFIX."_log table
 *
 * Returns true if session resumes, false otherwise
 *
 *
 * @return boolean
 */
function grr_resumeSession()
{
    // Resuming session
    session_name(SESSION_NAME);
    @session_start();
    if (Settings::get('sso_statut') == 'lcs' and !isset($_SESSION['est_authentifie_sso']) and $_SESSION['source_login'] == "ext") {
        return false;
    }
    // La session est-elle expirée
    if (isset($_SESSION['login'])) {
        $test_session = grr_sql_query1("SELECT count(LOGIN) from " . TABLE_PREFIX . "_log where END > now() and LOGIN = '******'login']) . "'");
        if ($test_session == 0) {
            $_SESSION = array();
        }
    }
    if (!isset($_SESSION) or !isset($_SESSION['login'])) {
        return false;
    }
    if (Settings::get("disable_login") == 'yes' and $_SESSION['statut'] != "administrateur") {
        return false;
    }
    // To be removed
    // Validating session data
    $sql = "SELECT password = '******'password'] . "' PASSWORD, login = '******'login']) . "' LOGIN, statut = '" . $_SESSION['statut'] . "' STATUT\n\tfrom " . TABLE_PREFIX . "_utilisateurs where login = '******'login']) . "'";
    $res = grr_sql_query($sql);
    $row = grr_sql_row($res, 0);
    // Checking for a timeout
    $sql2 = "SELECT now() > END TIMEOUT from " . TABLE_PREFIX . "_log where SESSION_ID = '" . session_id() . "' and START = '" . $_SESSION['start'] . "'";
    if ($row[0] != "1" || $row[1] != "1" || $row[2] != "1") {
        return false;
    } else {
        if (grr_sql_query1($sql2)) {
            // Le temps d'inactivité est supérieur à la limite fixée.
            // cas d'une authentification LCS
            if (Settings::get('sso_statut') == 'lcs') {
                // l'utilisateur est authentifié par LCS, on renouvelle la session
                if ($is_authentified_lcs == 'yes') {
                    $sql = "UPDATE " . TABLE_PREFIX . "_log set END = now() + interval " . $_SESSION['maxLength'] . " minute where SESSION_ID = '" . session_id() . "' and START = '" . $_SESSION['start'] . "'";
                    $res = grr_sql_query($sql);
                    if (!$res) {
                        fatal_error(0, 'erreur mysql' . grr_sql_error());
                    }
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        } else {
            $sql = "UPDATE " . TABLE_PREFIX . "_log set END = now() + interval " . $_SESSION['maxLength'] . " minute where SESSION_ID = '" . session_id() . "' and START = '" . $_SESSION['start'] . "'";
            $res = grr_sql_query($sql);
            if (!$res) {
                fatal_error(0, 'erreur mysql' . grr_sql_error());
            }
            return true;
        }
    }
}
Example #5
0
?>
</h2>
<?php 
if (Settings::get("module_multisite") == "Oui") {
    if (authGetUserLevel(getUserName(), -1, 'area') >= 6) {
        $sql = "SELECT id,sitecode,sitename FROM " . TABLE_PREFIX . "_site ORDER BY sitename ASC";
    } else {
        // Administrateur de sites ou de domaines
        $sql = "SELECT DISTINCT id,sitecode,sitename FROM " . TABLE_PREFIX . "_site s ";
        // l'utilisateur est-il administrateur d'un site ?
        $test1 = grr_sql_query1("SELECT count(login) FROM " . TABLE_PREFIX . "_j_useradmin_site WHERE login='******'");
        if ($test1 > 0) {
            $sql .= ", " . TABLE_PREFIX . "_j_useradmin_site u";
        }
        // l'utilisateur est-il administrateur d'un domaine ?
        $test2 = grr_sql_query1("SELECT count(login) FROM " . TABLE_PREFIX . "_j_useradmin_area WHERE login='******'");
        if ($test2 > 0) {
            $sql .= ", " . TABLE_PREFIX . "_j_useradmin_area a, " . TABLE_PREFIX . "_j_site_area j";
        }
        $sql .= " WHERE (";
        if ($test1 > 0) {
            $sql .= "(s.id=u.id_site AND u.login='******') ";
        }
        if ($test1 > 0 && $test2 > 0) {
            $sql .= " or ";
        }
        if ($test2 > 0) {
            $sql .= "(j.id_site=s.id AND j.id_area=a.id_area AND a.login='******')";
        }
        $sql .= ") ORDER BY s.sitename ASC";
    }
Example #6
0
         }
     }
     echo '</span>' . PHP_EOL;
 } else {
     echo PHP_EOL . '<table class="table-header"><tr>';
     tdcell($d[$cday]["color"][$i]);
     if ($d[$cday]["res"][$i] != '-') {
         echo '<img src="img_grr/buzy.png" alt="', get_vocab("ressource actuellement empruntee"), '" title="', get_vocab("ressource actuellement empruntee"), '" width="20" height="20" class="image" />', PHP_EOL;
     }
     if (isset($d[$cday]["option_reser"][$i]) && $d[$cday]["option_reser"][$i] != -1) {
         echo '<img src="img_grr/small_flag.png" alt="', get_vocab("reservation_a_confirmer_au_plus_tard_le"), '" title="', get_vocab("reservation_a_confirmer_au_plus_tard_le"), ' ', time_date_string_jma($d[$cday]["option_reser"][$i], $dformat), '" width="20" height="20" class="image" />', PHP_EOL;
     }
     if (isset($d[$cday]["moderation"][$i]) && $d[$cday]["moderation"][$i] == 1) {
         echo '<img src="img_grr/flag_moderation.png" alt="', get_vocab("en_attente_moderation"), '" title="', get_vocab("en_attente_moderation"), '" class="image" />', PHP_EOL;
     }
     $Son_GenreRepeat = grr_sql_query1("SELECT " . TABLE_PREFIX . "_type_area.type_name FROM " . TABLE_PREFIX . "_type_area," . TABLE_PREFIX . "_entry  WHERE  " . TABLE_PREFIX . "_entry.type=" . TABLE_PREFIX . "_type_area.type_letter  AND " . TABLE_PREFIX . "_entry.id = '" . $d[$cday]["id"][$i] . "';");
     if ($Son_GenreRepeat == -1) {
         echo '<span class="small_planning">', PHP_EOL, '<b>', $d[$cday]["data"][$i], '</b><br>';
     } else {
         echo '<span class="small_planning">' . $d[$cday]["data"][$i] . '<br>' . $Son_GenreRepeat . '<br>' . PHP_EOL;
     }
     echo $d[$cday]["who1"][$i] . '<br>' . PHP_EOL;
     if ($d[$cday]["description"][$i] != "") {
         echo '<i>' . $d[$cday]["description"][$i] . '</i>' . PHP_EOL;
     }
     echo '</span>' . PHP_EOL;
 }
 echo '</td>' . PHP_EOL;
 echo '</tr>' . PHP_EOL;
 echo '</table>' . PHP_EOL;
 echo '</a>' . PHP_EOL;
Example #7
0
function cal($month, $year)
{
    global $weekstarts;
    if (!isset($weekstarts)) $weekstarts = 0;
    $s = "";
    $daysInMonth = getDaysInMonth($month, $year);
    $date = mktime(12, 0, 0, $month, 1, $year);
    $first = (strftime("%w",$date) + 7 - $weekstarts) % 7;
    $monthName = utf8_strftime("%B",$date);
    $s .= "<table class=\"calendar2\" border=\"1\" cellspacing=\"3\">\n";
    $s .= "<tr>\n";
    $s .= "<td class=\"calendarHeader2\" colspan=\"8\">$monthName&nbsp;$year</td>\n";
    $s .= "</tr>\n";
    $d = 1 - $first;
    $is_ligne1 = 'y';
    while ($d <= $daysInMonth)
    {
        $s .= "<tr>\n";
        for ($i = 0; $i < 7; $i++)
        {
            $basetime = mktime(12,0,0,6,11+$weekstarts,2000);
            $show = $basetime + ($i * 24 * 60 * 60);
            $nameday = utf8_strftime('%A',$show);
            $temp = mktime(0,0,0,$month,$d,$year);
            if ($i==0) $s .= "<td class=\"calendar2\" style=\"vertical-align:bottom;\"><b>S".numero_semaine($temp)."</b></td>\n";
            $s .= "<td class=\"calendar2\" align=\"center\" valign=\"top\">";
            if ($is_ligne1 == 'y') $s .=  '<b>'.ucfirst(substr($nameday,0,1)).'</b><br />';
            if ($d > 0 && $d <= $daysInMonth)
            {
                $s .= $d;
                $day = grr_sql_query1("SELECT day FROM ".TABLE_PREFIX."_calendar WHERE day='$temp'");
                $s .= "<br /><input type=\"checkbox\" name=\"$temp\" value=\"$nameday\" ";
                if (!($day < 0)) $s .= "checked=\"checked\" ";
                $s .= " />";
            } else {
                $s .= "&nbsp;";
            }
            $s .= "</td>\n";
            $d++;
        }
        $s .= "</tr>\n";
        $is_ligne1 = 'n';
    }
    $s .= "</table>\n";
    return $s;
}
Example #8
0
if (isset($result) and ($result != '')) {
    echo "<div class=\"page_sans_col_gauche\">";
    echo "<h2>".encode_message_utf8("Résultat de la mise à jour")."</h2>";
    echo encode_message_utf8($result);
    echo $result_inter;
    echo "</div>";
}

// Test de cohérence des types de réservation
if ($version_grr > "1.9.1") {
    $res = grr_sql_query("select distinct type from ".TABLE_PREFIX."_entry order by type");
    if ($res) {
        $liste = "";
        for ($i = 0; ($row = grr_sql_row($res, $i)); $i++)
        {
            $test = grr_sql_query1("select type_letter from ".TABLE_PREFIX."_type_area where type_letter='".$row[0]."'");
            if ($test == -1) $liste .= $row[0]." ";
        }
        if ($liste != "") {
            echo encode_message_utf8("<table border=\"1\" cellpadding=\"5\"><tr><td><p><span style=\"color:red;\"><b>ATTENTION : votre table des types de réservation n'est pas à jour :</b></span></p>");
            echo encode_message_utf8("<p>Depuis la version 1.9.2, les types de réservation ne sont plus définis dans le fichier config.inc.php
            mais directement en ligne. Un ou plusieurs types sont actuellement utilisés dans les réservations
            mais ne figurent pas dans la tables des types. Cela risque d'engendrer des messages d'erreur. <b>Il s'agit du ou des types suivants : ".$liste."</b>");
            echo encode_message_utf8("<br /><br />Vous devez donc définir dans <a href= './admin_type.php'>l'interface de gestion des types</a>, le ou les types manquants, en vous aidant éventuellement des informations figurant dans votre ancien fichier config.inc.php.</p></td></tr></table>");
        }
    }
}
// fin de l'affichage de la colonne de droite
if ($valid == 'no') echo "</td></tr></table>";
?>
</body>
Example #9
0
foreach ($_POST as $index => $valeur) {
    $index = stripslashes(trim($valeur));
}
$mail_entete = "MIME-Version: 1.0\r\n";
$mail_entete .= "From: {$_POST['nom']} " . "<{$_POST['email']}>\r\n";
$mail_entete .= 'Reply-To: ' . $_POST['email'] . "\r\n";
$mail_entete .= 'Content-Type: text/plain; charset="iso-8859-1"';
$mail_entete .= "\r\nContent-Transfer-Encoding: 8bit\r\n";
$mail_entete .= 'X-Mailer:PHP/' . phpversion() . "\r\n";
$mail_corps = "<html><head></head><body> Message de :" . $_POST['prenom'] . " " . $_POST['nom'] . "<br/>";
$mail_corps .= "Email : " . $_POST['email'] . "<br/>";
$mail_corps .= "Téléphone : " . $_POST['telephone'] . "<br/><br/>";
$mail_corps .= "<b> Sujet de la réservation :" . $_POST['sujet'] . "</b><br/><br/>";
$id .= $_POST['area'];
$sql_areaName .= "SELECT area_name FROM " . TABLE_PREFIX . "_area where id = \"{$id}\" ";
$res_areaName .= grr_sql_query1($sql_areaName);
$mail_corps .= "Domaines : " . $res_areaName . "<br/> ";
$mail_corps .= "Salle : " . $_POST['room'] . "<br/><br/>";
$mail_corps .= "Date  :" . $_POST['start_day'] . "/" . $_POST['start_month'] . "/" . $_POST['start_year'] . " <br/>";
$mail_corps .= "Heure réservation  : " . $_POST['heure'] . "h  " . $_POST['minutes'] . "min<br/>";
$mail_corps .= "Durée de la réservation : " . $_POST['duree'] . " \n";
$mail_corps .= " h " . $_POST['dureemin'] . " \n</body></html>";
$mail_destinataire = Settings::get("mail_destinataire");
$mail_method = Settings::get("grr_mail_method");
if ($mail_method == 'mail') {
    if (mail($mail_destinataire, 'Demande de réservation', $mail_corps, $mail_entete)) {
        header('Location: week_all.php');
    } else {
        echo "le message n'a pas été envoyé et donc mail n'est pas installé";
    }
} else {
Example #10
0
    destination = box.options[box.selectedIndex].value;
    if (destination) location.href = destination;
    }
    // -->
    </script>
    <noscript>
    <div><input type=\"submit\" value=\"Change\" /></div>
    </noscript>
    </form>";

echo $out_html;


$this_area_name = grr_sql_query1("select area_name from ".TABLE_PREFIX."_area where id=$id_area");
$this_room_name = grr_sql_query1("select room_name from ".TABLE_PREFIX."_room where id=$room");
$this_room_name_des = grr_sql_query1("select description from ".TABLE_PREFIX."_room where id=$room");
echo "</td>\n";

# Show all rooms in the current area
echo "<td><p><b>".get_vocab("rooms")."</b></p>";

# should we show a drop-down for the room list, or not?
$out_html = "<form id=\"room\" action=\"admin_email_manager.php\" method=\"post\">\n<div><select name=\"room\" onchange=\"room_go()\">\n";
$out_html .= "<option value=\"admin_email_manager.php?id_area=$id_area&amp;room=-1\">".get_vocab('select')."</option>\n";

    $sql = "select id, room_name, description from ".TABLE_PREFIX."_room where area_id=$id_area ";
    // on ne cherche pas parmi les ressources invisibles pour l'utilisateur
    foreach($tab_rooms_noaccess as $key){
      $sql .= " and id != $key ";
    };
    $sql .= "order by room_name";
Example #11
0
 }
 // On teste si l'utilisateur administre une ressource
 $test_room = grr_sql_query1("SELECT count(r.room_name) FROM " . TABLE_PREFIX . "_room r\n\t\t\t\tleft join " . TABLE_PREFIX . "_j_user_room j on r.id=j.id_room\n\t\t\t\tWHERE j.login = '******'");
 if ($test_room > 0 or $user_statut == 'administrateur') {
     $col[$i][3] .= "<span class=\"style_privilege\"> G</span>";
 } else {
     $col[$i][3] .= "";
 }
 // On teste si l'utilisateur gère les utilisateurs
 if ($user_statut == "gestionnaire_utilisateur") {
     $col[$i][3] .= "<span class=\"style_privilege\"> U</span>";
 } else {
     $col[$i][3] .= "";
 }
 // On teste si l'utilisateur reçoit des mails automatiques
 $test_mail = grr_sql_query1("SELECT count(r.room_name) FROM " . TABLE_PREFIX . "_room r\n\t\t\t\tleft join " . TABLE_PREFIX . "_j_mailuser_room j on r.id=j.id_room\n\t\t\t\tWHERE j.login = '******'");
 if ($test_mail > 0) {
     $col[$i][3] .= "<span class=\"style_privilege\"> E</span>";
 } else {
     $col[$i][3] .= " ";
 }
 // Affichage du statut
 if ($user_statut == "administrateur") {
     $color[$i] = 'style_admin';
     $col[$i][4] = get_vocab("statut_administrator");
 }
 if ($user_statut == "visiteur") {
     $color[$i] = 'style_visiteur';
     $col[$i][4] = get_vocab("statut_visitor");
 }
 if ($user_statut == "utilisateur") {
Example #12
0
     } else {
         for ($j = 0; $row_room = grr_sql_row($res_room, $j); $j++) {
             $is_gestionnaire .= $row_room[0] . "<br />";
         }
     }
 }
 $req_mail = "SELECT r.room_name from " . TABLE_PREFIX . "_room r\n\t\t\t\tleft join " . TABLE_PREFIX . "_j_mailuser_room j on r.id=j.id_room\n\t\t\t\tleft join " . TABLE_PREFIX . "_area a on r.area_id=a.id\n\t\t\t\twhere j.login = '******' and a.id='" . $row_area[0] . "'";
 $res_mail = grr_sql_query($req_mail);
 $is_mail = '';
 if ($res_mail) {
     for ($j = 0; $row_mail = grr_sql_row($res_mail, $j); $j++) {
         $is_mail .= $row_mail[0] . "<br />";
     }
 }
 if ($row_area[2] == 'r') {
     $test_restreint = grr_sql_query1("SELECT count(id_area) from " . TABLE_PREFIX . "_j_user_area j where j.login = '******' and j.id_area='" . $row_area[0] . "'");
     if ($test_restreint >= 1) {
         $is_restreint = 'y';
     } else {
         $is_restreint = 'n';
     }
 } else {
     $is_restreint = 'n';
 }
 if ($is_admin == 'y' || $is_restreint == 'y' || $is_gestionnaire != '' || $is_mail != '') {
     $a_privileges = 'y';
     echo "<h3>" . get_vocab("match_area") . get_vocab("deux_points") . $row_area[1];
     if ($row_area[2] == 'r') {
         echo " (" . $vocab["restricted"] . ")";
     }
     echo "</h3>";
Example #13
0
}

if (isset($_SESSION['default_language'])) {
    // si l'utilisateur a défini sa propre langue
    $locale = $_SESSION['default_language'];
} else if ($defaultlanguage) {
    // sinon, on utilise la variable stockée dans la base
    $locale = $defaultlanguage;
} else {
    // sinon, on fixe la valeur à "fr"
    $locale = 'fr';
}

// $pass_leng est utilisé dans les fichiers langue, d'où la ligne ci-dessous
$pass_leng = "";
if (isset($fichier_mysql_inc_est_present)) $pass_leng = grr_sql_query1("select VALUE from ".TABLE_PREFIX."_setting where NAME = 'pass_leng'");

// Fichier de traduction
if (@file_exists("language/lang." . $locale)) {
    $lang_file = "language/lang." . $locale;
} else {
    $lang_file = "language/lang.fr";
}

// Dans le cas où le script verif_auto_grr.php est utilisé en tâche cron, il faut ici, donner le chemin complet.
if (defined("CHEMIN_COMPLET_GRR")){
  chdir(CHEMIN_COMPLET_GRR);
}
include $lang_file;

Example #14
0
//Show all areas
echo "<td ><p><b>" . get_vocab("areas") . "</b></p>\n";
$out_html = '<form id="area" action="admin_right_admin.php" method="post">' . PHP_EOL . '<div>' . PHP_EOL . '<select class="form-control" name="area" onchange="area_go()">' . PHP_EOL;
$out_html .= '<option value="admin_right_admin.php?id_area=-1">' . get_vocab('select') . '</option>' . PHP_EOL;
$sql = "SELECT id, area_name FROM " . TABLE_PREFIX . "_area ORDER BY order_display";
$res = grr_sql_query($sql);
if ($res) {
    for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
        $selected = $row[0] == $id_area ? 'selected="selected"' : "";
        $link = 'admin_right_admin.php?id_area=' . $row[0];
        $out_html .= '<option ' . $selected . ' value="' . $link . '">' . htmlspecialchars($row[1]) . '</option>' . PHP_EOL;
    }
}
$out_html .= "</select>\n<script type=\"text/javascript\" >\n\t<!--\n\tfunction area_go()\n\t{\n\t\tbox = document.getElementById(\"area\").area;\n\t\tdestination = box.options[box.selectedIndex].value;\n\t\tif (destination) location.href = destination;\n\t}\n// -->\n</script>\n</div>\n<noscript>\n\t<div><input type=\"submit\" value=\"Change\" /></div>\n</noscript>\n</form>";
echo $out_html;
$this_area_name = grr_sql_query1("SELECT area_name FROM " . TABLE_PREFIX . "_area WHERE id={$id_area}");
echo '</td>' . PHP_EOL;
echo '</tr>' . PHP_EOL . '</table>' . PHP_EOL;
if ($id_area <= 0) {
    echo '<h1>' . get_vocab("no_area") . '</h1>' . PHP_EOL;
    // fin de l'affichage de la colonne de droite
    echo '</td>' . PHP_EOL . '</tr>' . PHP_EOL . '</table>' . PHP_EOL . '</body>' . PHP_EOL . '</html>' . PHP_EOL;
    exit;
}
//Show area:
echo '<table class="table table-bordered">' . PHP_EOL . '<tr>' . PHP_EOL;
$is_admin = 'yes';
?>
<td>
	<?php 
$exist_admin = 'no';
Example #15
0
		<?php 
}
?>
	<tr>
		<td>
			<b>
				<?php 
echo get_vocab("created_by"), get_vocab("deux_points");
?>
			</b>
		</td>
		<td>
			<?php 
echo affiche_nom_prenom_email($create_by, "", $option_affiche_nom_prenom_email);
if ($active_ressource_empruntee == 'y') {
    $id_resa = grr_sql_query1("SELECT id from " . TABLE_PREFIX . "_entry where room_id = '" . $room_id . "' and statut_entry='y'");
    if ($id_resa == $id) {
        echo '<span class="avertissement">(', get_vocab("reservation_en_cours"), ') <img src="img_grr/buzy_big.png" align=middle alt="', get_vocab("ressource actuellement empruntee"), '" title="', get_vocab("ressource actuellement empruntee"), '" border="0" width="30" height="30" class="print_image" /></span>', PHP_EOL;
    }
}
?>
		</td>
	</tr>
	<tr>
		<td>
			<b>
				<?php 
echo get_vocab("lastupdate"), get_vocab("deux_points");
?>
			</b>
		</td>
Example #16
0
 if (authGetUserLevel(getUserName(), -1) < 1) {
     showAccessDenied($back);
     exit;
 }
 if (!getWritable($info['beneficiaire'], getUserName(), $id)) {
     showAccessDenied($back);
     exit;
 }
 if (authUserAccesArea(getUserName(), $area) == 0) {
     showAccessDenied($back);
     exit;
 }
 if (Settings::get('automatic_mail') == 'yes') {
     $_SESSION['session_message_error'] = send_mail($id, 3, $dformat);
 }
 $room_id = grr_sql_query1('SELECT ' . TABLE_PREFIX . '_entry.room_id FROM ' . TABLE_PREFIX . '_entry, ' . TABLE_PREFIX . '_room WHERE ' . TABLE_PREFIX . '_entry.room_id = ' . TABLE_PREFIX . '_room.id AND ' . TABLE_PREFIX . "_entry.id='" . $id . "'");
 $date_now = time();
 get_planning_area_values($area);
 if (!verif_booking_date(getUserName(), $id, $room_id, -1, $date_now, $enable_periods) || verif_booking_date(getUserName(), $id, $room_id, -1, $date_now, $enable_periods) && $can_delete_or_create != 'y') {
     showAccessDenied($back);
     exit;
 }
 /* avant la suppression, dispatch de l'event */
 $event = new EntryEventClass(false, false, $id, false);
 $dispatcher->dispatch(DelEntryEvent::DELENTRY_START, $event);
 $result = mrbsDelEntry(getUserName(), $id, $series, 1);
 /* après la suppression, dispatch de l'event */
 $eventEnd = new EntryEventClass(false, false, $id, false);
 $dispatcher->dispatch(DelEntryEvent::DELENTRY_END, $eventEnd);
 if ($result) {
     $_SESSION['displ_msg'] = 'yes';
Example #17
0
  if ($cible != '')
	    echo "<input type=\"hidden\" name=\"cible\" value=\"".$cible."\" />\n";
  if ($type_cible != '')
	    echo "<input type=\"hidden\" name=\"type_cible\" value=\"".$type_cible."\" />\n";

	echo get_vocab("Objet du message").get_vocab("deux_points");
	echo "<br /><input type=\"text\" name=\"objet_message\" id=\"objet_message\" size=\"40\" maxlength=\"256\" value=''/>\n";

	echo "<textarea name=\"message\" cols=\"50\" rows=\"5\">".$corps_message."</textarea><br />";

	echo get_vocab("E-mail pour la reponse").get_vocab("deux_points");
	echo "<input type=\"text\" name=\"email_reponse\" id=\"email_reponse\" size=\"40\" maxlength=\"256\" ";
	if ($email_reponse != '') {
      echo "value='".$email_reponse."' ";
	} else if (($fin_session == 'n') and (getUserName()!='')) {
      $user_email = grr_sql_query1("select email from ".TABLE_PREFIX."_utilisateurs where login='******'");
      if (($user_email != "") and ($user_email != -1))
          echo "value='".$user_email."' ";
	}
	echo "/>\n";
	echo "<br />\n";

	echo "<p style=\"text-align:center;\">";
	echo "<input type='button' value='".get_vocab("submit")."' onclick='verif_et_valide_envoi();' />\n";
	echo "</p>\n";
  echo "</div>\n";
	echo "</form>\n";

	echo "<script type='text/javascript'>
	function verif_et_valide_envoi() {
	 if(document.getElementById('objet_message')) {
Example #18
0
}
// Description complète
if (authGetUserLevel($getUserName(), -1) >= Settings::get("acces_fiche_reservation") && $row["comment_room"] != '') {
    echo "<h3>" . get_vocab("match_descr") . "</h3>\n";
    echo "<div>" . $row["comment_room"] . "</div>\n";
}
// Afficher capacité
if ($row["capacity"] != '0') {
    echo "<h3>" . get_vocab("capacity_2") . "</h3>\n";
    echo "<p>" . $row["capacity"] . "</p>\n";
}
if ($row["max_booking"] != "-1") {
    echo "<p>" . get_vocab("msg_max_booking") . get_vocab("deux_points") . $row["max_booking"] . "</p>";
}
// Limitation par domaine
$max_booking_per_area = grr_sql_query1("SELECT max_booking FROM " . TABLE_PREFIX . "_area WHERE id = '" . protect_data_sql($id_area) . "'");
if ($max_booking_per_area >= 0) {
    echo "<p>" . get_vocab("msg_max_booking_area") . get_vocab("deux_points") . $max_booking_per_area . "</p>";
}
if ($row["delais_max_resa_room"] != "-1") {
    echo "<p>" . get_vocab("delais_max_resa_room_2") . " <b>" . $row["delais_max_resa_room"] . "</b></p>";
}
if ($row["delais_min_resa_room"] != "0") {
    echo "<p>" . get_vocab("delais_min_resa_room_2") . " <b>" . $row["delais_min_resa_room"] . "</b></p>";
}
$nom_picture = '';
if ($row['picture_room'] != '') {
    $nom_picture = "./images/" . $row['picture_room'];
}
echo "<div style=\"text-align:center; margin-top:30px\"><b>";
if (@file_exists($nom_picture) && $nom_picture) {
Example #19
0
/** supprimerReservationsUtilisateursEXT()
 *
 * Supprime les réservations des membres qui proviennent d'une source "EXT"
 *
 *
 * Returns:
 *   0        - An error occured
 *   non-zero - The entries were deleted
 */
function supprimerReservationsUtilisateursEXT($avec_resa, $avec_privileges)
{
    // Récupération de tous les utilisateurs de la source EXT
    $requete_users_ext = "SELECT login FROM " . TABLE_PREFIX . "_utilisateurs WHERE source='ext' and statut<>'administrateur'";
    $res = grr_sql_query($requete_users_ext);
    $logins = array();
    $logins_liaison = array();
    if ($res) {
        for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
            $logins[] = $row[0];
        }
    }
    // Construction des requêtes de suppression à partir des différents utilisateurs à supprimer
    if ($avec_resa == 'y') {
        // Pour chaque utilisateur, on supprime les réservations qu'il a créées et celles dont il est bénéficiaire
        // Table grr_entry
        $req_suppr_table_entry = "DELETE FROM " . TABLE_PREFIX . "_entry WHERE create_by = ";
        $first = 1;
        foreach ($logins as $log) {
            if ($first == 1) {
                $req_suppr_table_entry .= "'{$log}' OR beneficiaire='{$log}'";
                $first = 0;
            } else {
                $req_suppr_table_entry .= " OR create_by = '{$log}' OR beneficiaire = '{$log}' ";
            }
        }
        // Pour chaque utilisateur, on supprime les réservations périodiques qu'il a créées et celles dont il est bénéficiaire
        // Table grr_repeat
        $req_suppr_table_repeat = "DELETE FROM " . TABLE_PREFIX . "_repeat WHERE create_by = ";
        $first = 1;
        foreach ($logins as $log) {
            if ($first == 1) {
                $req_suppr_table_repeat .= "'{$log}' OR beneficiaire='{$log}'";
                $first = 0;
            } else {
                $req_suppr_table_repeat .= " OR create_by = '{$log}' OR beneficiaire = '{$log}' ";
            }
        }
        // Pour chaque utilisateur, on supprime les réservations périodiques qu'il a créées et celles dont il est bénéficiaire
        // Table grr_entry_moderate
        $req_suppr_table_entry_moderate = "DELETE FROM " . TABLE_PREFIX . "_entry_moderate WHERE create_by = ";
        $first = 1;
        foreach ($logins as $log) {
            if ($first == 1) {
                $req_suppr_table_entry_moderate .= "'{$log}' OR beneficiaire='{$log}'";
                $first = 0;
            } else {
                $req_suppr_table_entry_moderate .= " OR create_by = '{$log}' OR beneficiaire = '{$log}' ";
            }
        }
    }
    $req_j_mailuser_room = "";
    $req_j_user_area = "";
    $req_j_user_room = "";
    $req_j_useradmin_area = "";
    $req_j_useradmin_site = "";
    foreach ($logins as $log) {
        // Table grr_j_mailuser_room
        $test = grr_sql_query1("SELECT count(login) FROM " . TABLE_PREFIX . "_j_mailuser_room WHERE login='******'");
        if ($test >= 1) {
            if ($avec_privileges == "y") {
                if ($req_j_mailuser_room == "") {
                    $req_j_mailuser_room = "DELETE FROM " . TABLE_PREFIX . "_j_mailuser_room WHERE login='******'";
                } else {
                    $req_j_mailuser_room .= " OR login = '******'";
                }
            } else {
                $logins_liaison[] = strtolower($log);
            }
        }
        // Table grr_j_user_area
        $test = grr_sql_query1("SELECT count(login) FROM " . TABLE_PREFIX . "_j_user_area WHERE login='******'");
        if ($test >= 1) {
            if ($avec_privileges == "y") {
                if ($req_j_user_area == "") {
                    $req_j_user_area = "DELETE FROM " . TABLE_PREFIX . "_j_user_area WHERE login='******'";
                } else {
                    $req_j_user_area .= " OR login = '******'";
                }
            } else {
                $logins_liaison[] = strtolower($log);
            }
        }
        // Table grr_j_user_room
        $test = grr_sql_query1("SELECT count(login) FROM " . TABLE_PREFIX . "_j_user_room WHERE login='******'");
        if ($test >= 1) {
            if ($avec_privileges == "y") {
                if ($req_j_user_room == "") {
                    $req_j_user_room = "DELETE FROM " . TABLE_PREFIX . "_j_user_room WHERE login='******'";
                } else {
                    $req_j_user_room .= " OR login = '******'";
                }
            } else {
                $logins_liaison[] = strtolower($log);
            }
        }
        // Table grr_j_useradmin_area
        $test = grr_sql_query1("SELECT count(login) FROM " . TABLE_PREFIX . "_j_useradmin_area WHERE login='******'");
        if ($test >= 1) {
            if ($avec_privileges == "y") {
                if ($req_j_useradmin_area == "") {
                    $req_j_useradmin_area = "DELETE FROM " . TABLE_PREFIX . "_j_useradmin_area WHERE login='******'";
                } else {
                    $req_j_useradmin_area .= " OR login = '******'";
                }
            } else {
                $logins_liaison[] = strtolower($log);
            }
        }
        // Table grr_j_useradmin_site
        $test = grr_sql_query1("SELECT count(login) FROM " . TABLE_PREFIX . "_j_useradmin_site WHERE login='******'");
        if ($test >= 1) {
            if ($avec_privileges == "y") {
                if ($req_j_useradmin_site == "") {
                    $req_j_useradmin_site = "DELETE FROM " . TABLE_PREFIX . "_j_useradmin_site WHERE login='******'";
                } else {
                    $req_j_useradmin_site .= " OR login = '******'";
                }
            } else {
                $logins_liaison[] = strtolower($log);
            }
        }
    }
    // Suppression effective
    echo "<hr />\n";
    if ($avec_resa == 'y') {
        $nb = 0;
        $s = grr_sql_command($req_suppr_table_entry);
        if ($s != -1) {
            $nb += $s;
        }
        $s = grr_sql_command($req_suppr_table_repeat);
        if ($s != -1) {
            $nb += $s;
        }
        $s = grr_sql_command($req_suppr_table_entry_moderate);
        if ($s != -1) {
            $nb += $s;
        }
        echo "<p class='avertissement'>" . get_vocab("tables_reservations") . get_vocab("deux_points") . $nb . get_vocab("entres_supprimees") . "</p>\n";
    }
    $nb = 0;
    if ($avec_privileges == "y") {
        if ($req_j_mailuser_room != "") {
            $s = grr_sql_command($req_j_mailuser_room);
            if ($s != -1) {
                $nb += $s;
            }
        }
        if ($req_j_user_area != "") {
            $s = grr_sql_command($req_j_user_area);
            if ($s != -1) {
                $nb += $s;
            }
        }
        if ($req_j_user_room != "") {
            $s = grr_sql_command($req_j_user_room);
            if ($s != -1) {
                $nb += $s;
            }
        }
        if ($req_j_useradmin_area != "") {
            $s = grr_sql_command($req_j_useradmin_area);
            if ($s != -1) {
                $nb += $s;
            }
        }
        if ($req_j_useradmin_site != "") {
            $s = grr_sql_command($req_j_useradmin_site);
            if ($s != -1) {
                $nb += $s;
            }
        }
    }
    echo "<p class='avertissement'>" . get_vocab("tables_liaison") . get_vocab("deux_points") . $nb . get_vocab("entres_supprimees") . "</p>\n";
    if ($avec_privileges == "y") {
        // Enfin, suppression des utilisateurs de la source EXT qui ne sont pas administrateur
        $requete_suppr_users_ext = "DELETE FROM " . TABLE_PREFIX . "_utilisateurs WHERE source='ext' and statut<>'administrateur'";
        $s = grr_sql_command($requete_suppr_users_ext);
        if ($s == -1) {
            $s = 0;
        }
        echo "<p class='avertissement'>" . get_vocab("table_utilisateurs") . get_vocab("deux_points") . $s . get_vocab("entres_supprimees") . "</p>\n";
    } else {
        $n = 0;
        foreach ($logins as $log) {
            if (!in_array(strtolower($log), $logins_liaison)) {
                grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_utilisateurs WHERE login='******'");
                $n++;
            }
        }
        echo "<p class='avertissement'>" . get_vocab("table_utilisateurs") . get_vocab("deux_points") . $n . get_vocab("entres_supprimees") . "</p>\n";
    }
}
Example #20
0
        echo "<td><input type=\"radio\" name=\"id_type_par_defaut\" value=\"" . $col[$i][2] . "\" ";
        $test = grr_sql_query1("SELECT id_type_par_defaut FROM " . TABLE_PREFIX . "_area WHERE id = '" . $id_area . "'");
        if ($test == $col[$i][2]) {
            echo " checked=\"checked\"";
        }
        echo " /></td>";
        // Fin de la ligne courante
        echo "</tr>";
    }
    echo "<tr><td> </td>\n";
    echo "<td> </td>\n";
    echo "<td> </td>\n";
    echo "<td> </td>\n";
    echo "<td> </td>\n";
    echo "<td><input type=\"radio\" name=\"id_type_par_defaut\" value=\"-1\" ";
    $test = grr_sql_query1("SELECT id_type_par_defaut FROM " . TABLE_PREFIX . "_area WHERE id = '" . $id_area . "'");
    if ($test <= 0) {
        echo " checked=\"checked\"";
    }
    echo " />" . $vocab["nobody"] . "    </td>";
    echo "</tr>";
}
echo "</table>";
echo "</td></tr></table>";
echo "<div style=\"text-align:center;\"><input type=\"hidden\" name=\"id_area\" value=\"" . $id_area . "\" />";
echo "<input type=\"submit\" name=\"valider\" value=\"" . get_vocab("save") . "\" />\n";
echo "   <input type=\"submit\" name=\"change_done\" value=\"" . get_vocab("back") . "\" />";
echo "</div>";
echo "</form>\n";
echo "</div>";
?>
Example #21
0
<!--
function area_go()
{
box = document.getElementById(\"area\").area;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;
}
// -->
</script>
</div>
<noscript>
<div><input type=\"submit\" value=\"Change\" /></div>
</noscript>
</form>";
echo $out_html;
$this_area_name = grr_sql_query1("select area_name from ".TABLE_PREFIX."_area where id=$id_area");
echo "</td>\n";
echo "</tr></table>\n";


if ($id_area <= 0)
{
    echo "<h1>".get_vocab("no_area")."</h1>";
    // fin de l'affichage de la colonne de droite
    echo "</td></tr></table></body></html>";
    exit;
}
# Show area:
echo "<table border=\"1\" cellpadding=\"5\"><tr>";
$is_admin='yes';
Example #22
0
         $number_periodes = 10;
     } else {
         $number_periodes = $num_periodes;
     }
 }
 if ($row["enable_periods"] == 'y') {
     echo "<table id=\"menu2\" border=\"1\" cellspacing=\"1\" cellpadding=\"6\">";
 } else {
     echo "<table style=\"display:none\" id=\"menu2\" border=\"1\" cellspacing=\"1\" cellpadding=\"6\">";
 }
 echo "<tr><td>" . get_vocab("nombre_de_creneaux") . get_vocab("deux_points") . "</td>";
 echo "<td style=\"width:30%;\"><input type=\"text\" id=\"nb_per\" name=\"number_periodes\" size=\"1\" onkeypress=\"if (event.keyCode==13) return aff_creneaux()\" value=\"{$number_periodes}\" />\n\t\t\t<a href=\"#Per\" onclick=\"javascript:return(aff_creneaux())\">" . get_vocab("goto") . "</a>\n";
 echo "</td></tr>\n<tr><td colspan=\"2\">";
 $i = 0;
 while ($i < 50) {
     $nom_periode = grr_sql_query1("select nom_periode FROM " . TABLE_PREFIX . "_area_periodes where id_area='" . $id_area . "' and num_periode= '" . $i . "'");
     if ($nom_periode == -1) {
         $nom_periode = "";
     }
     echo "<table style=\"display:none\" id=\"c" . ($i + 1) . "\"><tr><td>" . get_vocab("intitule_creneau") . ($i + 1) . get_vocab("deux_points") . "</td>";
     echo "<td style=\"width:30%;\"><input type=\"text\" name=\"periode_" . $i . "\" value=\"" . htmlentities($nom_periode) . "\" size=\"20\" /></td></tr></table>\n";
     $i++;
 }
 // L'utilisateur ne peut reserver qu'une duree limitee (-1 desactivee), exprimee en jours
 if ($row["duree_max_resa_area"] > 0) {
     $nb_jour = max(round($row["duree_max_resa_area"] / 1440, 0), 1);
 } else {
     $nb_jour = -1;
 }
 echo "</td></tr>\n<tr><td>" . get_vocab("duree_max_resa_area2") . get_vocab("deux_points");
 echo "\n</td><td><input class=\"form-control\" type=\"text\" name=\"duree_max_resa_area2\" size=\"5\" value=\"" . $nb_jour . "\" /></td></tr>\n";
Example #23
0
File: year.php Project: Birssan/GRR
 echo "<tr>";
 tdcell("cell_hours");
 echo " </td>\n";
 //Corrige un bug avec certains fuseaux horaires (par exemple GMT-05:00 celui du Québec) :
 //plusieurs mois débutent par le dernier jours du mois précédent.
 //En changeant "gmmktime" par "mktime" le bug est corrigé
 //$t2=gmmktime(0,0,0,$month_num,1,$year_num);
 $t2 = mktime(0, 0, 0, $month_num, 1, $year_num);
 for ($k = 0; $k < $days_in_month; $k++) {
     $cday = date("j", $t2);
     $cmonth = date("m", $t2);
     $cweek = date("w", $t2);
     $cyear = date("Y", $t2);
     $name_day = ucfirst(utf8_strftime("%a<br />%d", $t2));
     $temp = mktime(0, 0, 0, $cmonth, $cday, $cyear);
     $jour_cycle = grr_sql_query1("SELECT Jours FROM " . TABLE_PREFIX . "_calendrier_jours_cycle WHERE DAY='{$temp}'");
     $t2 += 86400;
     // On inscrit le numéro du mois dans la deuxième ligne
     if ($display_day[$cweek] == 1) {
         echo tdcell("cell_hours");
         echo "<div><a title=\"" . htmlspecialchars(get_vocab("see_all_the_rooms_for_the_day")) . "\"   href=\"day.php?year={$year_num}&amp;month={$month_num}&amp;day={$cday}&amp;area={$area}\">{$name_day}</a>";
         if (Settings::get("jours_cycles_actif") == "Oui" && intval($jour_cycle) > -1) {
             if (intval($jour_cycle) > 0) {
                 echo "<br /><b><i>" . ucfirst(substr(get_vocab("rep_type_6"), 0, 1)) . $jour_cycle . "</i></b>";
             } else {
                 if (strlen($jour_cycle) > 5) {
                     $jour_cycle = substr($jour_cycle, 0, 3) . "..";
                 }
                 echo "<br /><b><i>" . $jour_cycle . "</i></b>";
             }
         }
Example #24
0
        if ($cible != '') {
            echo "<input type=\"hidden\" name=\"cible\" value=\"" . $cible . "\" />\n";
        }
        if ($type_cible != '') {
            echo "<input type=\"hidden\" name=\"type_cible\" value=\"" . $type_cible . "\" />\n";
        }
        echo get_vocab("Objet du message") . get_vocab("deux_points");
        echo "<br /><input type=\"text\" name=\"objet_message\" id=\"objet_message\" size=\"40\" maxlength=\"256\" value='' placeholder=\"Objet\"/>\n";
        echo "<textarea name=\"message\" cols=\"50\" rows=\"5\" placeholder=\"Votre message\">" . $corps_message . "</textarea><br />";
        echo get_vocab("E-mail pour la reponse") . get_vocab("deux_points");
        echo "<input type=\"text\" name=\"email_reponse\" id=\"email_reponse\" size=\"40\" maxlength=\"256\" ";
        if ($email_reponse != '') {
            echo "value='" . $email_reponse . "' ";
        } else {
            if ($fin_session == 'n' && getUserName() != '') {
                $user_email = grr_sql_query1("SELECT email FROM " . TABLE_PREFIX . "_utilisateurs WHERE login='******'");
                if ($user_email != "" && $user_email != -1) {
                    echo "value='" . $user_email . "' ";
                }
            }
        }
        echo "/>\n";
        echo "<br />\n";
        echo "<p style=\"text-align:center;\">";
        echo "<input type='button' value='" . get_vocab("submit") . "' onclick='verif_et_valide_envoi();' />\n";
        echo "</p>\n";
        echo "</div>\n";
        echo "</form>\n";
        echo "<script type='text/javascript'>\n\tfunction verif_et_valide_envoi() {\n\t\tif (document.getElementById('objet_message')) {\n\t\t\tobjet=document.getElementById('objet_message').value;\n\t\t\tif (objet=='') {\n\t\t\t\talert('Vous n\\'avez pas saisi d\\'objet au message. Ce champ est obligatoire.');\n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\t\tif (document.getElementById('email_reponse')) {\n\t\t\temail=document.getElementById('email_reponse').value;\n\t\t\tif (email=='') {\n\t\t\t\tconfirmation=confirm('Vous n\\'avez pas saisi d\\'adresse courriel/email.\\nVous ne pourrez pas recevoir de réponse par courrier électronique.\\nSouhaitez-vous néanmoins poster le message?');\n\t\t\t\tif (confirmation) {\n\t\t\t\t\tdocument.getElementById('doc').submit();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvar verif = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9.-]{2,}[.][a-zA-Z]{2,3}\$/\n\t\t\t\tif (verif.exec(email) == null) {\n\t\t\t\t\tconfirmation=confirm('L\\'adresse courriel/email saisie ne semble pas valide.\\nVeuillez contrôler la saisie et confirmer votre envoi si l\\'adresse est correcte.\\nSouhaitez-vous néanmoins poster le message?');\n\t\t\t\t\tif (confirmation) {\n\t\t\t\t\t\tdocument.getElementById('doc').submit();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdocument.getElementById('doc').submit();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tdocument.getElementById('doc').submit();\n\t\t}\n\t}\n</script>\n";
        break;
}
Example #25
0
 } else {
     $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['empruntee'] = false;
 }
 if (isset($d[$cday]['option_reser'][$i]) && $d[$cday]['option_reser'][$i] != -1) {
     $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['aConfirmerAuPlusTard'] = utf8_strftime($dformat, $d[$cday]['option_reser'][$i]);
     //echo '<img src="img_grr/small_flag.png" alt="',get_vocab('reservation_a_confirmer_au_plus_tard_le'),'" title="',get_vocab('reservation_a_confirmer_au_plus_tard_le'),' ',time_date_string_jma($d[$cday]['option_reser'][$i], $dformat),'" width="20" height="20" class="image" />',PHP_EOL;
 } else {
     $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['aConfirmerAuPlusTard'] = false;
 }
 if (isset($d[$cday]['moderation'][$i]) && $d[$cday]['moderation'][$i] == 1) {
     $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['moderation'] = true;
     //echo '<img src="img_grr/flag_moderation.png" alt="',get_vocab('en_attente_moderation'),'" title="',get_vocab('en_attente_moderation'),'" class="image" />',PHP_EOL;
 } else {
     $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['aConfirmerAuPlusTard'] = false;
 }
 $Son_GenreRepeat = grr_sql_query1('SELECT ' . TABLE_PREFIX . '_type_area.type_name FROM ' . TABLE_PREFIX . '_type_area,' . TABLE_PREFIX . '_entry  WHERE  ' . TABLE_PREFIX . '_entry.type=' . TABLE_PREFIX . '_type_area.type_letter  AND ' . TABLE_PREFIX . "_entry.id = '" . $d[$cday]['id'][$i] . "';");
 if ($Son_GenreRepeat == -1) {
     $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['repeat'] = false;
     //echo '<span class="small_planning">',$d[$cday]['data'][$i];
 } else {
     $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['repeat'] = $Son_GenreRepeat;
     //echo '<span class="small_planning">',$d[$cday]['data'][$i],'<br>',$Son_GenreRepeat,'<br>';
 }
 $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['data'] = $d[$cday]['data'][$i];
 $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['who1'] = $d[$cday]['who1'][$i];
 //echo $d[$cday]['who1'][$i].'<br/>'.PHP_EOL;
 if ($d[$cday]['description'][$i] != '') {
     //echo '<i>'.$d[$cday]['description'][$i].'</i>'.PHP_EOL;
     $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['description'] = $d[$cday]['description'][$i];
 } else {
     $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['description'] = false;
Example #26
0
    {
        showAccessDenied($day, $month, $year, $area,$back);
        exit;
    }
    if(authUserAccesArea(getUserName(), $area)==0)
    {
        showAccessDenied($day, $month, $year, $area,$back);
        exit();
    }

    grr_sql_begin();
    if (getSettingValue("automatic_mail") == 'yes') {
        $_SESSION['session_message_error'] = send_mail($id,3,$dformat);
    }
    // On vérifie les dates
    $room_id = grr_sql_query1("SELECT ".TABLE_PREFIX."_entry.room_id FROM ".TABLE_PREFIX."_entry, ".TABLE_PREFIX."_room WHERE ".TABLE_PREFIX."_entry.room_id = ".TABLE_PREFIX."_room.id AND ".TABLE_PREFIX."_entry.id='".$id."'");
    $date_now = mktime();
    get_planning_area_values($area); // Récupération des données concernant l'affichage du planning du domaine
    if ((!(verif_booking_date(getUserName(), $id, $room_id, -1, $date_now, $enable_periods))) or
    ((verif_booking_date(getUserName(), $id, $room_id, -1, $date_now, $enable_periods)) and ($can_delete_or_create!="y"))
    )
    {
          showAccessDenied($day, $month, $year, $area,$back);
          exit();
    }

    $result = mrbsDelEntry(getUserName(), $id, $series, 1);
    grr_sql_commit();
    if ($result)
    {
        $_SESSION['displ_msg'] = 'yes';
Example #27
0
File: day.php Project: swirly/GRR
$yd = date("d", $i);
$i = mktime(0, 0, 0, $month, $day, $year);
$jour_cycle = grr_sql_query1("SELECT Jours FROM " . TABLE_PREFIX . "_calendrier_jours_cycle WHERE day='{$i}'");
$ind = 1;
$test = 0;
while ($test == 0 && $ind <= 7) {
    $i = mktime(0, 0, 0, $month, $day + $ind, $year);
    $test = $display_day[date("w", $i)];
    $ind++;
}
$ty = date("Y", $i);
$tm = date("m", $i);
$td = date("d", $i);
$am7 = mktime($morningstarts, 0, 0, $month, $day, $year);
$pm7 = mktime($eveningends, $eveningends_minutes, 0, $month, $day, $year);
$this_area_name = grr_sql_query1("SELECT area_name FROM " . TABLE_PREFIX . "_area WHERE id='" . protect_data_sql($area) . "'");
$sql = "SELECT " . TABLE_PREFIX . "_room.id, start_time, end_time, name, " . TABLE_PREFIX . "_entry.id, type, beneficiaire, statut_entry, " . TABLE_PREFIX . "_entry.description, " . TABLE_PREFIX . "_entry.option_reservation, " . TABLE_PREFIX . "_entry.moderate, beneficiaire_ext\nFROM " . TABLE_PREFIX . "_entry, " . TABLE_PREFIX . "_room\nWHERE " . TABLE_PREFIX . "_entry.room_id = " . TABLE_PREFIX . "_room.id\nAND area_id = '" . protect_data_sql($area) . "'\nAND start_time < " . ($pm7 + $resolution) . " AND end_time > {$am7} ORDER BY start_time";
$res = grr_sql_query($sql);
if (!$res) {
    echo grr_sql_error();
} else {
    for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
        $start_t = max(round_t_down($row['1'], $resolution, $am7), $am7);
        $end_t = min(round_t_up($row['2'], $resolution, $am7) - $resolution, $pm7);
        $cellules[$row['4']] = ($end_t - $start_t) / $resolution + 1;
        $compteur[$row['4']] = 0;
        for ($t = $start_t; $t <= $end_t; $t += $resolution) {
            $today[$row['0']][$t]["id"] = $row['4'];
            $today[$row['0']][$t]["color"] = $row['5'];
            $today[$row['0']][$t]["data"] = "";
            $today[$row['0']][$t]["who"] = "";
Example #28
0
# liste des sites
echo "<td ><p><b>" . get_vocab("sites") . get_vocab("deux_points") . "</b></p>\n";
$out_html = "<form id=\"site\" action=\"admin_admin_site.php\" method=\"post\">\n<div><select name=\"id_site\" onchange=\"site_go()\">\n";
$out_html .= "<option value=\"admin_admin_site.php?id_site=-1\">" . get_vocab('select') . "</option>";
$sql = "select id, sitename from " . TABLE_PREFIX . "_site order by sitename";
$res = grr_sql_query($sql);
if ($res) {
    for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
        $selected = $row[0] == $id_site ? "selected=\"selected\"" : "";
        $link = "admin_admin_site.php?id_site={$row['0']}";
        $out_html .= "<option {$selected} value=\"{$link}\">" . htmlspecialchars($row[1]) . "</option>";
    }
}
$out_html .= "</select>\n\t<script type=\"text/javascript\" >\n\t\t<!--\n\t\tfunction site_go()\n\t\t{\n\t\t\tbox = document.getElementById(\"site\").id_site;\n\t\t\tdestination = box.options[box.selectedIndex].value;\n\t\t\tif (destination) location.href = destination;\n\t\t}\n\t-->\n</script>\n</div>\n<noscript>\n\t<div><input type=\"submit\" value=\"Change\" /></div>\n</noscript>\n</form>";
echo $out_html;
$this_site_name = grr_sql_query1("select sitename from " . TABLE_PREFIX . "_site where id={$id_site}");
echo "</td>\n";
echo "</tr></table>\n";
# Ne pas continuer si aucun site n'est défini
if ($id_site <= 0) {
    echo "<h1>" . get_vocab("no_site") . "</h1>";
    // fin de l'affichage de la colonne de droite
    echo "</td></tr></table></body></html>";
    exit;
}
echo "<table border=\"1\" cellpadding=\"5\"><tr><td>";
$is_admin = 'yes';
echo "<h3>" . get_vocab("administration_site") . get_vocab("deux_points") . "</h3>";
echo "<b>" . $this_site_name . "</b>";
?>
</td>
Example #29
0
function do_summary(&$count, &$hours, &$room_hash, &$breve_description_hash, $enable_periods, $decompte, $csv = "n")
{
    global $vocab;
    if ($csv != "n") {
        echo " ;";
    }
    // Make a sorted array of area/rooms, and of names, to use for column
    // and row indexes. Use the rooms and names hashes built by accumulate().
    // At PHP4 we could use array_keys().
    reset($room_hash);
    $rooms = array();
    while (list($room_key) = each($room_hash)) {
        $rooms[] = $room_key;
    }
    ksort($rooms);
    reset($breve_description_hash);
    $breve_descriptions = array();
    while (list($breve_description_key) = each($breve_description_hash)) {
        $breve_descriptions[] = $breve_description_key;
    }
    ksort($breve_descriptions);
    $n_rooms = sizeof($rooms);
    $n_names = sizeof($breve_descriptions);
    // On affiche uniquement pour une sortie HTML
    if ($csv == "n") {
        if ($_GET["sumby"] == "6") {
            $premiere_cellule = get_vocab("sum_by_creator");
        } else {
            if ($_GET["sumby"] == "3") {
                $premiere_cellule = get_vocab("sum_by_descrip");
            } else {
                if ($_GET["sumby"] == "5") {
                    $premiere_cellule = get_vocab("type");
                } else {
                    $premiere_cellule = grr_sql_query1("SELECT fieldname FROM " . TABLE_PREFIX . "_overload WHERE id='" . $_GET["sumby"] . "'");
                }
            }
        }
        if ($enable_periods == 'y') {
            echo "<hr /><h1>" . get_vocab("summary_header_per") . "</h1><table class=\"table table-bordered table-striped\">\n";
        } else {
            echo "<hr /><h1>" . get_vocab("summary_header") . "</h1><table class=\"table table-bordered table-striped\">\n";
        }
        echo "<tr><td class=\"BL\" align=\"left\"><b>" . $premiere_cellule . " \\ " . get_vocab("room") . "</b></td>\n";
    }
    $col_count_total = array();
    $col_hours_total = array();
    for ($c = 0; $c < $n_rooms; $c++) {
        if ($csv == "n") {
            echo "<td class=\"BL\" align=\"left\"><b>{$rooms[$c]}</b></td>\n";
        } else {
            echo "{$rooms[$c]};";
        }
        $col_count_total[$c] = 0;
        $col_hours_total[$c] = 0.0;
    }
    if ($csv == "n") {
        echo "<td class=\"BR\" align=\"right\"><br /><b>" . get_vocab("total") . "</b></td></tr>\n";
    } else {
        echo html_entity_decode($vocab['total']) . ";\r\n";
    }
    $grand_count_total = 0;
    $grand_hours_total = 0;
    for ($r = 0; $r < $n_names; $r++) {
        $row_count_total = 0;
        $row_hours_total = 0.0;
        $breve_description = $breve_descriptions[$r];
        if ($csv == "n") {
            echo "<tr><td class=\"BR\" align=\"right\"><b>{$breve_description}</b></td>\n";
        } else {
            echo "{$breve_description};";
        }
        for ($c = 0; $c < $n_rooms; $c++) {
            $room = $rooms[$c];
            if (isset($count[$room][$breve_description])) {
                $count_val = $count[$room][$breve_description];
                $hours_val = $hours[$room][$breve_description];
                cell($count_val, $hours_val, $csv, $decompte);
                $row_count_total += $count_val;
                $row_hours_total += $hours_val;
                $col_count_total[$c] += $count_val;
                $col_hours_total[$c] += $hours_val;
            } else {
                if ($csv == "n") {
                    echo "<td> </td>\n";
                } else {
                    echo ";";
                }
            }
        }
        cell($row_count_total, $row_hours_total, $csv, $decompte);
        if ($csv == "n") {
            echo "</tr>\n";
        } else {
            echo "\r\n";
        }
        $grand_count_total += $row_count_total;
        $grand_hours_total += $row_hours_total;
    }
    if ($csv == "n") {
        echo "<tr><td class=\"BR\" align=\"right\"><b>" . get_vocab("total") . "</b></td>\n";
    } else {
        echo html_entity_decode($vocab['total']) . ";";
    }
    for ($c = 0; $c < $n_rooms; $c++) {
        cell($col_count_total[$c], $col_hours_total[$c], $csv, $decompte);
    }
    cell($grand_count_total, $grand_hours_total, $csv, $decompte);
    if ($csv == "n") {
        echo "</tr></table>\n";
    }
}
Example #30
0
File: week.php Project: Birssan/GRR
     echo $d[$weekday][$slot - $decale_slot * $nb_case]["data"] . "";
     $Son_GenreRepeat = grr_sql_query1("SELECT type_name FROM " . TABLE_PREFIX . "_type_area ," . TABLE_PREFIX . "_entry  WHERE  " . TABLE_PREFIX . "_entry.id= " . $d[$weekday][$slot - $decale_slot * $nb_case]['id'] . " AND " . TABLE_PREFIX . "_entry.type= " . TABLE_PREFIX . "_type_area.type_letter");
     if ($Son_GenreRepeat != -1) {
         if ($enable_periods != 'y') {
             echo "<br />" . date('H:i', $d[$weekday][$slot - $decale_slot * $nb_case]["horaireDebut"]) . get_vocab("to") . date('H:i', $d[$weekday][$slot - $decale_slot * $nb_case]["horaireFin"]) . "";
         }
         echo " <br/>" . $Son_GenreRepeat . " <br/><br/>";
     }
     if ($d[$weekday][$slot - $decale_slot * $nb_case]["description"] != "") {
         echo "<i>" . $d[$weekday][$slot - $decale_slot * $nb_case]["description"] . "</i><br>";
     }
     $clef = grr_sql_query1("SELECT clef FROM " . TABLE_PREFIX . "_entry WHERE  " . TABLE_PREFIX . "_entry.id= " . $d[$weekday][$slot - $decale_slot * $nb_case]['id'] . "");
     if ($clef == 1) {
         echo '<img src="img_grr/skey.png" alt="clef">';
     }
     $courrier = grr_sql_query1("SELECT courrier FROM " . TABLE_PREFIX . "_entry WHERE  " . TABLE_PREFIX . "_entry.id= " . $d[$weekday][$slot - $decale_slot * $nb_case]['id'] . "");
     if (Settings::get('show_courrier') == 'y') {
         if ($courrier == 1) {
             echo '<img src="img_grr/scourrier.png" alt="courrier">' . PHP_EOL;
         } else {
             echo '<img src="img_grr/hourglass.png" alt="buzy">' . PHP_EOL;
         }
     }
     if ($acces_fiche_reservation) {
         echo "</a>";
     }
 }
 //if (!isset($d[$weekday][$slot-$decale_slot*$nb_case]["id"])) {
 //	echo tdcell($empty_color)."";
 //}
 if (isset($d[$weekday][$slot - $decale_slot * $nb_case]["statut"]) && $d[$weekday][$slot - $decale_slot * $nb_case]["statut"] != '-') {