Skip to content

Commit

Permalink
bloc + mep + image
Browse files Browse the repository at this point in the history
  • Loading branch information
jipexu committed May 14, 2020
1 parent 148aebb commit 9fa014a
Show file tree
Hide file tree
Showing 4 changed files with 335 additions and 202 deletions.
139 changes: 83 additions & 56 deletions npds_glossaire/admin/glossadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/************************************************************************/
/* DUNE by NPDS */
/* */
/* NPDS Copyright (c) 2002-2019 by Philippe Brunier */
/* NPDS Copyright (c) 2002-2020 by Philippe Brunier */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
Expand All @@ -18,7 +18,7 @@

// cartouche de sécurité ==> requis !!
if (!strstr($_SERVER['PHP_SELF'],'admin.php')) Access_Error();
if (strstr($ModPath,"..") || strstr($ModStart,"..") || stristr($ModPath, "script") || stristr($ModPath, "cookie") || stristr($ModPath, "iframe") || stristr($ModPath, "applet") || stristr($ModPath, "object") || stristr($ModPath, "meta") || stristr($ModStart, "script") || stristr($ModStart, "cookie") || stristr($ModStart, "iframe") || stristr($ModStart, "applet") || stristr($ModStart, "object") || stristr($ModStart, "meta"))
if (strstr($ModPath,'..') || strstr($ModStart,'..') || stristr($ModPath, 'script') || stristr($ModPath, 'cookie') || stristr($ModPath, 'iframe') || stristr($ModPath, 'applet') || stristr($ModPath, 'object') || stristr($ModPath, 'meta') || stristr($ModStart, 'script') || stristr($ModStart, 'cookie') || stristr($ModStart, 'iframe') || stristr($ModStart, 'applet') || stristr($ModStart, 'object') || stristr($ModStart, 'meta'))
die();

$f_meta_nom ='npds_glossaire';
Expand All @@ -27,22 +27,22 @@
//<== controle droit

include ("modules/$ModPath/glossaire.conf.php");
include ("modules/$ModPath/lang/glossaire-$language.php");
include_once("modules/$ModPath/lang/glossaire-$language.php");

GraphicAdmin($hlpfile);
echo '<div id="adm_men">';
echo '<h2><img src="modules/npds_glossaire/npds_glossaire.png" alt="icon_npds_glossaire"> '.glo_translate("Glossaire").'</h2>';
// echo '<h3>Administration</h3>';
echo '
<div id="adm_men">
<h2><img src="modules/npds_glossaire/npds_glossaire.png" alt="icon_npds_glossaire" style="max-width:180px; max-height=180px;"><a href="admin.php?op=Extend-Admin-SubModule&amp;ModPath='.$ModPath.'&amp;ModStart=admin/glossadmin">'.glo_translate("Glossaire").'</a></h2><hr />';

function admin_glo() {
global $ModPath, $ModStart, $ok_submit, $activ_rech, $nb_affichage, $css, $NPDS_Prefix;

echo '<p><a class="btn btn-outline-primary btn-sm" href="admin.php?op=Extend-Admin-SubModule&amp;ModPath='.$ModPath.'&amp;ModStart='.$ModStart.'&amp;subop=admin_list">'.glo_translate("Liste des définitions").'</a></p>';

$TableRep = sql_query("SELECT * FROM ".$NPDS_Prefix."td_glossaire WHERE affiche='0'");
$avalider = sql_num_rows($TableRep);
echo '<p class="lead"><a class="" href="admin.php?op=Extend-Admin-SubModule&amp;ModPath='.$ModPath.'&amp;ModStart='.$ModStart.'&amp;subop=admin_list">'.glo_translate("Liste des définitions").'</a></p>';
if($avalider!=0) {
//Liste des demandes à valider

echo '
<p class="lead"><a data-toggle="collapse" href="#valglo" aria-expanded="true" aria-controls="valglo"><i data-toggle="tooltip" data-placement="top" title="'.glo_translate("Cliquer pour cacher ou déployer").'" class="toggle-icon fa fa-lg fa-caret-down"></i></a> '.glo_translate("Validation ou suppression des demandes").'</p>
<p class="lead"><a data-toggle="collapse" href="#valglo" aria-expanded="true" aria-controls="valglo"><i data-toggle="tooltip" data-placement="top" title="'.glo_translate("Cliquer pour cacher ou déployer").'" class="toggle-icon fa fa-lg fa-caret-down"></i></a> '.glo_translate("Validation ou suppression des demandes").'<span class="badge badge-danger float-right">'.$avalider.'</span></p>
<div id="valglo" class="collapse" role="tabpanel" aria-labelledby="">
<table class="table table-hover table-sm">
<thead>
Expand All @@ -55,25 +55,22 @@ function admin_glo() {
</tr>
</thead>
<tbody>';
$TableRep=sql_query("SELECT * FROM ".$NPDS_Prefix."td_glossaire WHERE affiche='0'");
while (list($id_terme,$gcat,$lettre,$terme,$terme_def) = sql_fetch_row($TableRep)) {
echo '
<tr>
<td>'.$id_terme.'</td><td>'.$gcat.'</td>
<td>'.$terme.'</td><td>'.$terme_def.'</td>
<td class="text-right">
<span class="mx-1"><a href="admin.php?op=Extend-Admin-SubModule&amp;ModPath='.$ModPath.'&amp;ModStart='.$ModStart.'&amp;subop=admin_add&amp;id='.$id_terme.'" title="'.glo_translate("Valider").'" data-toggle="tooltip"><i class="fa fa-check-square-o fa-lg" aria-hidden="true"></i></a></span>
<span class="mx-1"><a href="admin.php?op=Extend-Admin-SubModule&amp;ModPath='.$ModPath.'&amp;ModStart='.$ModStart.'&amp;subop=admin_supp&amp;id='.$id_terme.'"><i class="fa fa-trash-o fa-lg text-danger" title="'.glo_translate("Supprimer").'" data-toggle="tooltip"></i></a></span>
<span class="mx-1"><a href="admin.php?op=Extend-Admin-SubModule&amp;ModPath='.$ModPath.'&amp;ModStart='.$ModStart.'&amp;subop=admin_add&amp;id='.$id_terme.'" title="'.glo_translate("Valider").'" data-toggle="tooltip"><i class="far fa-check-square fa-lg" aria-hidden="true"></i></a></span>
<span class="mx-1"><a href="admin.php?op=Extend-Admin-SubModule&amp;ModPath='.$ModPath.'&amp;ModStart='.$ModStart.'&amp;subop=admin_supp&amp;id='.$id_terme.'"><i class="fas fa-trash fa-lg text-danger" title="'.glo_translate("Supprimer").'" data-toggle="tooltip"></i></a></span>
</td>
</tr>';
}
echo '
</tbody>
</table>
</div>';

</div>';}
//Soumettre une définition

echo '
<p class="lead"><a data-toggle="collapse" href="#soudef" aria-expanded="true" aria-controls="soudef"><i data-toggle="tooltip" data-placement="top" title="'.glo_translate("Cliquer pour cacher ou déployer").'" class="toggle-icon fa fa-lg fa-caret-down"></i></a> '.glo_translate("Soumettre une définition").'</p>
<div id="soudef" class="collapse" role="tabpanel" aria-labelledby="">
Expand Down Expand Up @@ -120,7 +117,6 @@ function admin_glo() {
<input class="btn btn-outline-primary btn-sm" type="submit" value="'.glo_translate("Valider").'" />
</form>
</div>';

//Configuration
echo '
<p class="lead"><a data-toggle="collapse" href="#confu" aria-expanded="true" aria-controls="confu"><i data-toggle="tooltip" data-placement="top" title="'.glo_translate("Cliquer pour cacher ou déployer").'" class="toggle-icon fa fa-lg fa-caret-down"></i></a> '.glo_translate("Configuration").'</p>
Expand All @@ -133,30 +129,46 @@ function admin_glo() {
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-3" for="">'.glo_translate("Autorise la soumission").'</label>';
echo "<div class=\"col-sm-2\">
<input type=\"radio\" name=\"oksubmit_new\" value=\"true\"".($ok_submit?" checked=\"checked\"":"")." /> ".glo_translate("Oui")."</div>";
echo "<div class=\"col-sm-2\"><input type=\"radio\" name=\"oksubmit_new\" value=\"false\"".(!$ok_submit?" checked=\"checked\"":"")." /> ".glo_translate("Non")."</div>";
echo '</div>
<label class="col-sm-3">'.glo_translate("Autorise la soumission").'</label>
<div class="col-sm-9">
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" id="oksubmit_new_y" name="oksubmit_new" value="true"'.($ok_submit?' checked="checked"':'').' />
<label class="custom-control-label" for="oksubmit_new_y">'.glo_translate("Oui").'</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" id="oksubmit_new_n" name="oksubmit_new" value="false"'.(!$ok_submit?' checked="checked"':'').' />
<label class="custom-control-label" for="oksubmit_new_n">'.glo_translate("Non").'</label>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-3" for="">'.glo_translate("Autorise la recherche").'</label>';
echo "<div class=\"col-sm-2\"><input type=\"radio\" name=\"activrech_new\" value=\"true\"".($activ_rech?" checked=\"checked\"":"")." /> ".glo_translate("Oui")."</div>";
echo "<div class=\"col-sm-2\"><input type=\"radio\" name=\"activrech_new\" value=\"false\"".(!$activ_rech?" checked=\"checked\"":"")." /> ".glo_translate("Non")."</div>";
echo '</div>';
echo '<input class="btn btn-outline-primary btn-sm" type="submit" value="'.glo_translate("Valider").'" />';
echo '
</form>
</div>
<label class="col-sm-3">'.glo_translate("Autorise la recherche").'</label>
<div class="col-sm-9">
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" id="activrech_new_y" name="activrech_new" value="true"'.($activ_rech?' checked="checked"':'').' />
<label class="custom-control-label" for="activrech_new_y">'.glo_translate("Oui").'</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" id="activrech_new_n" name="activrech_new" value="false"'.(!$activ_rech?' checked="checked"':'').' />
<label class="custom-control-label" for="activrech_new_n">'.glo_translate("Non").'
</div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-3 mr-sm-auto">
<input class="btn btn-primary btn-sm" type="submit" value="'.glo_translate("Valider").'" />
</div>
</div>
</form>
</div>
</div>';
}
//fin configuration

// administration de la liste complète
function admin_list() {
global $ModPath, $ModStart, $NPDS_Prefix;
echo '<p class="lead">'.glo_translate("Liste des définitions dans la base de données").'</p>';
echo '
<h4 class="lead">'.glo_translate("Liste des définitions dans la base de données").'</h4>
<table class="table table-sm " data-toggle="table" data-search="true" data-show-toggle="true" data-mobile-responsive="true" data-buttons-class="outline-secondary" data-icons="icons" data-icons-prefix="fa">
<thead>
<tr>
Expand Down Expand Up @@ -189,37 +201,52 @@ function admin_list() {

function admin_edit($id) {
global $ModPath, $ModStart, $NPDS_Prefix;

echo '<p class="lead">'.glo_translate("Edition d'une définition").'</p>';
$TableRep=sql_query("SELECT * FROM ".$NPDS_Prefix."td_glossaire WHERE id='$id'");
list($id_terme,$gcat,$lettre,$terme,$terme_def,$aff,$lien) = sql_fetch_row($TableRep);
echo '<form action="admin.php?op=Extend-Admin-SubModule&amp;ModPath='.$ModPath.'&amp;ModStart='.$ModStart.'" method="POST" name="adminForm">';
echo '<div class="form-group row">';
echo '<div class="col-sm-3"><label for="">'.glo_translate("Terme").'</label></div>';
echo '<div class="col-sm-8"><input class="form-control" type="text" name="terme" value="'.$terme.'"></div>';
echo '</div>';
echo '<div class="form-group row">';
echo '<div class="col-sm-3"><label for="">'.glo_translate("Catégorie").'</label></div>';
echo '<div class="col-sm-4"><input class="form-control" type="text" name="gcategory" value="'.stripslashes($gcat).'" size="25" maxlength="30"></div>';
echo '<div class="col-sm-4"><select class="form-control" name="sgcategory">';
echo '
<form action="admin.php?op=Extend-Admin-SubModule&amp;ModPath='.$ModPath.'&amp;ModStart='.$ModStart.'" method="POST" name="adminForm">
<div class="form-group row">
<label class="col-form-label col-sm-3" for="terme">'.glo_translate("Terme").'</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="terme" name="terme" value="'.$terme.'" />
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-3" for="gcategory">'.glo_translate("Catégorie").'</label>
<div class="col-sm-4">
<input class="form-control" type="text" id="gcategory" name="gcategory" value="'.stripslashes($gcat).'" size="25" maxlength="30">
</div>
<div class="col-sm-4">
<select class="form-control" name="sgcategory">';
$result = sql_query("SELECT DISTINCT gcat FROM ".$NPDS_Prefix."td_glossaire ORDER BY gcat");
while (list($dcategory) = sql_fetch_row($result)) {
$dcategory=stripslashes($dcategory);
echo '<option '.$sel.' value="'.$dcategory.'">'.$dcategory.'</option>';
echo '
<option '.$sel.' value="'.$dcategory.'">'.$dcategory.'</option>';
}
echo '</select></div>';
echo '</div>';
echo '<div class="form-group row">';
echo '<div class="col-sm-3"><label for="">'.glo_translate("Définition").'</div>';
echo '<div class="col-sm-8"><textarea class="form-control tin" rows="10" name="content">'.$terme_def.'</textarea>';
echo '
</select>
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-3" for="">'.glo_translate("Définition").'</label>
<div class="col-sm-8">
<textarea class="form-control tin" rows="10" name="content">'.$terme_def.'</textarea>';
// echo aff_editeur("content", "true");
echo '</div></div>';
echo '<div class="form-group row">';
echo '<div class="col-sm-3"><label for="">'.glo_translate("Site internet").'</div>';
echo '<div class="col-sm-8"><input class="form-control" type="text" name="xurl" value="'.$lien.'" size="45" maxsize="255"><small id="" class="form-text text-muted">exemple : http://npds.org</small></div>';
echo '</div>';
echo '<input type="hidden" name="id" value="'.$id.'"><input type="hidden" name="subop" value="admin_modify">';
echo '<input class="btn btn-outline-primary btn-sm" type="submit" value="'.glo_translate("Valider").'">';
echo '</div>
</div>
<div class="form-group row">
<div class="col-sm-3"><label for="xurl">'.glo_translate("Site internet").'</div>
<div class="col-sm-8">
<input class="form-control" type="text" id="xurl" name="xurl" value="'.$lien.'" maxsize="255" />
<span class="help-block text-muted text-right">exemple : http://npds.org</small>
</div>
</div>
<input type="hidden" name="id" value="'.$id.'">
<input type="hidden" name="subop" value="admin_modify">
<input class="btn btn-outline-primary btn-sm" type="submit" value="'.glo_translate("Valider").'" />';
}
settype($subop,'string');
switch ($subop) {
Expand Down
52 changes: 52 additions & 0 deletions npds_glossaire/glossaire_bloc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/************************************************************************/
/* DUNE by NPDS */
/* */
/* NPDS Copyright (c) 2002-2020 by Philippe Brunier */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/* Module npds_glossaire v 3.0 pour revolution 16 */
/* by team jpb/phr 2017 */
/* */
/* From Glossaire version 1.3 pour myPHPNuke 1.8 */
/* Copyright © 2001, Pascal Le Boustouller */
/* Tribal-dolphin 2008 */
/************************************************************************/

if (stristr($_SERVER['PHP_SELF'],'glossaire_bloc.php')) die();
global $language;
$ModPath='npds_glossaire';
$ModStart='index';
include_once('modules/'.$ModPath.'/lang/glossaire-'.$language.'.php');

$content ='';
$content .= '<div class="d-flex w-100 justify-content-center"><a href="modules.php?ModPath=npds_glossaire&amp;ModStart=index"><img src="modules/npds_glossaire/npds_glossaire.png" alt="icon_npds_glossaire" style="max-width:180px; max-height=180px;"></a></div>';
$content .= '
<p class="lead text-center">';

$alphabet = array ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',''.glo_translate("Autres").'');
$num = count($alphabet) - 1;
$counter = 0;
$listletter='';

foreach($alphabet as $ltr) {
if ($ltr!=translate("Other"))
$listletter .= '<a href="modules.php?ModPath='.$ModPath.'&amp;ModStart='.$ModStart.'&amp;op=rech_lettre&amp;lettre='.$ltr.'">'.$ltr.'</a>';
else
$listletter .= '<a href="modules.php?ModPath='.$ModPath.'&amp;ModStart='.$ModStart.'&amp;op=rech_lettre&amp;lettre=!AZ">'.$ltr.'</a>';
if ( $counter != $num )
$listletter .= ' | ';
$counter++;
}
$content .= $listletter.'</p>';
if ($admin)
$content .='
<div class="mt-2 text-right">
<a href="admin.php?op=Extend-Admin-SubModule&amp;ModPath='.$ModPath.'&amp;ModStart=admin/glossadmin" data-toggle="tooltip" title="[french]Admin[/french][english]Admin[/english]"><i class="fa fa-cogs fa-lg" aria-hidden="true"></i></a>
</div>';
$content = aff_langue($content);

?>
Loading

0 comments on commit 9fa014a

Please sign in to comment.