Files
le-matelot/client/plugins/rewriting/rewriting_admin.php
2020-01-27 08:56:08 +01:00

269 lines
5.0 KiB
PHP

<?php
include_once(realpath(dirname(__FILE__)) . "/../../../fonctions/authplugins.php");
autorisation("rewriting");
include_once(realpath(dirname(__FILE__)) . "/Rewriting.class.php");
$r = new Rewriting();
if($_REQUEST['action'] == "modifier"):
if($_REQUEST['id']):
$result = $r->update($id, $url, $fond, $param, $lang, $actif);
if (result === FALSE):
$message = "Une erreur est survenue lors de la mise à jour de l'URL.";
else:
$message = "Mise à jour de l'URL effectuée";
endif;
else:
$r->add($url, $fond, $param, $lang, 1);
$message = "Nouvelle URL crée";
endif;
endif;
if($_REQUEST['action'] == "supprimer"):
$result = $r->delete($_REQUEST['id']);
if (result === FALSE):
$message = "Une erreur est survenue lors de la suppression de l'URL.";
else:
$message = "Suppression de l'URL effectuée";
endif;
endif;
if($_REQUEST['action'] == "configurer"):
$status = isset($_REQUEST['rewriting_afficher_urls_base']) ? intval($_REQUEST['rewriting_afficher_urls_base']) : 0;
Variable::ecrire(Rewriting::NOM_VARIABLE_CONFIG, $status);
endif;
$rewrites = $r->get_rewrites();
$langs = $r->get_langs();
$compt=0;
?>
<div id="contenu_int" style="width:978px;">
<p>
<a class="lien04" href="accueil.php">Accueil</a>
<img width="12" height="9" border="0" src="gfx/suivant.gif"><a class="lien04" href="module_liste.php">Modules</a>
<img width="12" height="9" border="0" src="gfx/suivant.gif"><a class="lien04" href="module.php?nom=rewriting">Gestions des r&eacute;ecritures</a>
</p>
<table width="100%" border="0" cellpadding="2" cellspacing="0">
<tr>
<td width="100%" height="30" class="titre_cellule_tres_sombre">Gestion des URL</td>
</tr>
<?php if (isset($message)) { ?>
<tr class="cellule_sombre">
<th height="30"><?php echo $message ?></th>
</tr>
<?php } ?>
<tr class="cellule_claire">
<td>
<form action="module.php" method="post">
<input type="hidden" name="nom" value="rewriting" />
<input type="hidden" name="action" value="configurer" />
<input type="checkbox" name="rewriting_afficher_urls_base" value="1" onclick="this.form.submit();" <?php if (Variable::lire(Rewriting::NOM_VARIABLE_CONFIG) != 0) echo 'checked="checked"'; ?>/> Afficher les URLs produit, contenu, rubrique et dossier.
</form>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<thead>
<tr class="cellule_sombre" style="font-weight:bolder">
<th height="30" >ID</th>
<th height="30" >URL</th>
<th height="30" >Fond</th>
<th height="30" >Param</th>
<th height="30" >Langue</th>
<th height="30" >Statut</th>
<th height="30" >Valider</th>
<th height="30" >Supprimer</th>
</tr>
</thead>
<tbody>
<tr class="cellule_claire">
<th colspan="8" height="10"></th>
</tr>
<?php
foreach($rewrites as $k=>$v):
?>
<form action="module.php" method="post">
<tr class="cellule_claire">
<td>
<input type="hidden" name="nom" value="rewriting" />
<input type="hidden" name="id" value="<?php echo $k; ?>" />
<input type="hidden" name="action" value="modifier" /><?php echo $k; ?>
</td>
<td><input type="text" name="url" value="<?php echo $v['url']; ?>" style="width: 250px;" /></td>
<td><input type="text" name="fond" value="<?php echo $v['fond']; ?>" style="width: 170px;" /></td>
<td><input type="text" name="param" value="<?php echo $v['param']; ?>" style="width: 250px;" /></td>
<td>
<select name="lang">
<?php foreach($langs as $i=>$l): ?>
<option value="<?php echo $i; ?>" <?php if($v['lang'] == $i) echo 'selected="selected"'; ?>><?php echo $l; ?></option>
<?php endforeach; ?>
</select>
</td>
<td>
<select name="actif">
<option value="0" <?php if($v['actif'] == '0') echo 'selected="selected"'; ?>>0</option>
<option value="1" <?php if($v['actif'] == '1') echo 'selected="selected"'; ?>>1</option>
</select>
</td>
<td><input type="submit" value="Valider"/></td>
<td><a style="display:block; width:16px; height:16px;" href="module.php?nom=rewriting&action=supprimer&id=<?php echo $k; ?>"><img src="../client/plugins/rewriting/img/delete.png" style="margin-left:30px;" /></a></td>
</tr>
</form>
<?php endforeach; ?>
<tr class="cellule_claire">
<th colspan="8" height="10">
</tr>
</tbody>
</table>
<br />
<form action="module.php" method="get">
<input type="hidden" name="nom" value="rewriting" />
<input type="hidden" name="action" value="modifier" />
<input type="submit" value="Ajouter une réécriture d'URL"/>
</form>
</div>