$_page["title"] = isset($_POST["title"]) ? $_POST["title"] : ($page["title"] ? $page["title"] : null);
$_page["content"] = isset($_POST["content"]) ? $_POST["content"] : ($page["content"] ? $page["content"] : null);
$_page["user"] = $user["id"];
- $_page["enabled"] = isset($_POST["enabled"]) ? $_POST["enabled"] : ($page["enabled"] ? $page["enabled"] : 1);
- $_page["position"] = isset($_POST["position"]) ? $_POST["position"] : ($page["position"] ? $page["position"] : 0);
+ $_page["enabled"] = isset($_POST["enabled"]) ? $_POST["enabled"] : (isset($page["enabled"]) ? $page["enabled"] : 1);
+ $_page["position"] = isset($_POST["position"]) ? $_POST["position"] : (isset($page["position"]) ? $page["position"] : 0);
}
}
else $env->message("impossible de lire les informations de l'utilisateur");
function add(&$env){
$data = $env->data();
+ $_SESSION["upload_dir"] = $env->path("web").($env->path("web") ? "" : "/").$env->path("content")."uploads";
if(($arbo = $data->pages_arbo()) !== false){
$env->set_out("arbo", $arbo);
- $page = array();
+ $page = array(
+ "title" => "",
+ "content" => ""
+ );
if($_POST){
$page = $this->validate_POST_page($env);
if(!$env->messages()){
function edit(&$env){
$data = $env->data();
+ $_SESSION["upload_dir"] = $env->path("web").($env->path("web") ? "" : "/").$env->path("content")."uploads";
if($page = $data->page($_GET[$env->param("id")])){
if(($arbo = $data->pages_arbo()) !== false){
$env->set_out("arbo", $arbo);
function page(&$env){
$data = $env->data();
- if(($arbo = $data->pages_arbo(array("enabled" => 1))) !== false){
+ if(($arbo = $data->pages_arbo(array("enabled" => 1, "order_by" => "position", "order" => "ASC"))) !== false){
$env->set_out("arbo", $arbo);
if(($page = $data->page($_GET[$env->param("id")])) && $page["enabled"]){
$env->set_out("page", $page);
class mw_pages extends mw_plugin{
- function title($env){
+ function title(){
return "Pages";
}
- function description($env){
+ function description(){
return "Pour ajouter des pages, avec un éditeur dans l'administration du site";
}
--- /dev/null
+@import url("../../../../../../out/default/css/actions/admin.css");
</div>
<?php endif; ?>
- <div id="center"<?= $this->out_config("colonne") ? "" : " class=\"no_colonne\"" ?>>
+ <div id="center"<?php echo $this->out_config("colonne") ? "" : " class=\"no_colonne\""; ?>>
<?php require $this->out_file("views/messages.php"); ?>
<?php
<h2>Nouvelle page</h2>
<ul class="admin">
- <li><a href="<?= $this->url("pages/admin") ?>">Retour à la liste des pages</a></li>
+ <li><a href="<?php echo $this->url("pages/admin"); ?>">Retour à la liste des pages</a></li>
</ul>
-<form name="page_form" action="<?= $this->url("pages/admin/add") ?>" method="post">
+<form name="page_form" action="<?php echo $this->url("pages/admin/add"); ?>" method="post">
<ul class="form">
<li>
<p>
Titre :
- <input type="text" size="50" name="title" id="title" value="<?= $this->out["page"]["title"] ?>" />
+ <input type="text" size="50" name="title" id="title" value="<?php echo $this->out["page"]["title"]; ?>" />
</p>
</li>
<li>
</p>
</li>
<li>
- <textarea class="tinymce" cols="60" rows="10" name="content" id="content"><?= htmlspecialchars($this->out["page"]["content"]) ?></textarea>
+ <textarea class="tinymce" cols="60" rows="10" name="content" id="content"><?php echo htmlspecialchars($this->out["page"]["content"]); ?></textarea>
</li>
<li class="buttons">
<input type="submit" value="Ajouter" />
<h2>Modifier une page</h2>
<ul class="admin">
- <li><a href="<?= $this->url("pages/admin") ?>">Retour à la liste des pages</a></li>
+ <li><a href="<?php echo $this->url("pages/admin"); ?>">Retour à la liste des pages</a></li>
</ul>
-<form name="page_form" action="<?= $this->url("pages/admin/edit", array("id" => $this->out["page"]["id"])) ?>" method="post">
+<form name="page_form" action="<?php echo $this->url("pages/admin/edit", array("id" => $this->out["page"]["id"])); ?>" method="post">
<ul class="form">
<li>
<p>
Titre :
- <input type="text" size="50" name="title" id="title" value="<?= $this->out["page"]["title"] ?>" />
+ <input type="text" size="50" name="title" id="title" value="<?php echo $this->out["page"]["title"]; ?>" />
</p>
</li>
<li>
</p>
</li>
<li>
- <textarea class="tinymce" cols="60" rows="10" name="content" id="content"><?= htmlspecialchars($this->out["page"]["content"]) ?></textarea>
+ <textarea class="tinymce" cols="60" rows="10" name="content" id="content"><?php echo htmlspecialchars($this->out["page"]["content"]); ?></textarea>
</li>
<li class="buttons">
<input type="submit" value="Enregistrer" />
<h2>Pages</h2>
<ul class="admin">
- <li><a class="add" href="<?= $this->url("pages/admin/add") ?>">Nouvelle page</a></li>
+ <li><a class="add" href="<?php echo $this->url("pages/admin/add"); ?>">Nouvelle page</a></li>
</ul>
-<form name="accueil_form" action="<?= $this->url("pages/admin/set_accueil") ?>" method="post">
+<form name="accueil_form" action="<?php echo $this->url("pages/admin/set_accueil"); ?>" method="post">
<ul class="admin">
<li>Page d'accueil du site</li>
<li>
<select name="id">
- <option value=""<?= $this->config("start_action") ? "" : " selected=\"selected\"" ?>>Page par défaut du site</option>
+ <option value=""<?php echo $this->config("start_action") ? "" : " selected=\"selected\""; ?>>Page par défaut du site</option>
<?php echo pages_arbo_start_select_options($this, $this->out["arbo"], $this->config("start_action"), $this->config("start_action_params"), " "); ?>
</select>
</li>
<li>Page parente</li>
<li>
<select onchange="document.location=this.options[this.selectedIndex].value;">
- <option value="<?= $this->url("pages/admin") ?>"<?= isset($_GET[$this->param("parent")]) ? "" : " selected=\"selected\"" ?>>Afficher toutes les pages</option>
+ <option value="<?php echo $this->url("pages/admin"); ?>"<?php echo isset($_GET[$this->param("parent")]) ? "" : " selected=\"selected\""; ?>>Afficher toutes les pages</option>
<?php echo pages_arbo_list_select_options($this, "pages/admin", $this->out["arbo"], $_GET[$this->param("parent")], " "); ?>
</select>
</li>
<?php if($this->out["pages"]["total"]) : ?>
-<?php if($this->out["pages"]["total"] > $this->config("max_list")) : ?>
-
<?php $items = "pages"; $legend = "pages"; require $this->out_file("views/navig.php"); ?>
-<?php endif; ?>
-
-<form name="pages_form" action="<?= $this->url("pages/admin/edit_pages") ?>" method="post">
+<form name="pages_form" action="<?php echo $this->url("pages/admin/edit_pages"); ?>" method="post">
<table class="admin">
<tr>
<th>titre</th>
</tr>
<?php foreach($this->out["pages"]["list"] as $id_page => $page) : ?>
<tr class="hl">
- <td><?= $page["title"] ?></td>
- <td><?= date("j M Y : G\hi", datetime2timestamp($page["date_creation"])) ?></td>
- <td class="action"><input type="text" size="3" name="position_<?= $id_page ?>" value="<?= $page["position"] ?>" /></td>
- <td class="action"><input type="checkbox" name="enabled_<?= $id_page ?>" <?= $page["enabled"] ? "checked=\"checked\"" : "" ?> /></td>
+ <td><?php echo $page["title"]; ?></td>
+ <td><?php echo date("j M Y : G\hi", datetime2timestamp($page["date_creation"])); ?></td>
+ <td class="action"><input type="text" size="3" name="position_<?php echo $id_page; ?>" value="<?php echo $page["position"]; ?>" /></td>
+ <td class="action"><input type="checkbox" name="enabled_<?php echo $id_page; ?>" <?php echo $page["enabled"] ? "checked=\"checked\"" : ""; ?> /></td>
<td class="action">
- <a href="<?= $this->url("pages/admin/edit", array("id" => $id_page)) ?>"
+ <a href="<?php echo $this->url("pages/admin/edit", array("id" => $id_page)); ?>"
class="admin_link"
- title="modifier cette page"><img src="<?= $this->out_file("icons/edit.gif") ?>" /></a>
+ title="modifier cette page"><img src="<?php echo $this->out_url("icons/edit.gif"); ?>" /></a>
</td>
<td class="action">
- <a href="<?= $this->url("pages/admin/del", array("id" => $id_page)) ?>"
+ <a href="<?php echo $this->url("pages/admin/del", array("id" => $id_page)); ?>"
class="admin_link"
- title="supprimer cette page"><img src="<?= $this->out_file("icons/del.gif") ?>"
+ title="supprimer cette page"><img src="<?php echo $this->out_url("icons/del.gif"); ?>"
onclick="return confirm('Supprimer cette page ?')"/></a>
</td>
</tr>
<?php if($k > 0) : ?>
»
<?php endif; ?>
- <a href="<?= $this->url("pages/view/page", array("id" => $page["id"])) ?>"><?= $page["title"] ?></a>
+ <a href="<?php echo $this->url("pages/view/page", array("id" => $page["id"])); ?>"><?php echo $page["title"]; ?></a>
<?php $k++; endif; endforeach; ?>
<?php if($k > 0) : ?>
»
<?php endif; ?>
- <?= $this->out["page"]["title"] ?>
+ <?php echo $this->out["page"]["title"]; ?>
</h2>
<?php if($this->out["pages"]["list"]) : ?>
<ul class="pages_menu">
<?php foreach($this->out["pages"]["list"] as $page) : ?>
- <li><a href="<?= $this->url("pages/view/page", array("id" => $page["id"])) ?>"><?= $page["title"] ?></a></li>
+ <li><a href="<?php echo $this->url("pages/view/page", array("id" => $page["id"])); ?>"><?php echo $page["title"]; ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div>
- <?= $this->out["page"]["content"] ?>
+ <?php echo $this->out["page"]["content"]; ?>
</div>
+++ /dev/null
-@import url("../../../../../../out/dist/css/actions/admin.css");