source: branches/rsr.v5.1/web/app/mods/e_set_editos.php @ 1

Last change on this file since 1 was 1, checked in by dj3c1t, 12 years ago

import initial

File size: 2.9 KB
Line 
1<?php
2
3  function e_set_editos($env)
4  { if($env->data->is_admin($env->pun_user["id"]))
5    { $env->a = $_GET[$env->param("action")] ? $_GET[$env->param("action")] : "editos";
6      $function = "a_".$env->a;
7      if(function_exists($function)) $function($env);
8    }
9    else $env->erreur = "Vous devez &ecirc;tre administrateur pour acc&eacute;der &agrave; cette page.";
10  }
11
12  # ------------------------------------------------------------------------------
13  #                                                                        actions
14  #
15
16  function a_editos($env)
17  { if(($env->out["editos"] = $env->data->editos($env->start)) !== false)
18    {
19    }
20    else $env->erreur = "Impossible de lire les &eacute;ditos";
21  }
22
23  function a_add_edito($env)
24  { if($_POST)
25    { if($_POST["preview"])
26      { $env->out["preview"] = array
27        ( "titre" => $_POST["titre"],
28          "contenu" =>  $_POST["edito"],
29          "auteur" => $env->pun_user["username"],
30          "date_publication" => $_POST["date_publication"],
31          "public" => $_POST["public"] ? 1 : 0
32        );
33      }
34      else
35      { if
36        ( $env->data->add_edito
37          ( $_POST["titre"],
38            $_POST["edito"],
39            $env->pun_user["id"],
40            $_POST["date_publication"],
41            $_POST["public"] ? 1 : 0
42          )
43        )
44        { _redirect
45          ( $env,
46            $env->url(array("e" => "set_editos")),
47            "L'&eacute;dito a &eacute;t&eacute; ajout&eacute;"
48          );
49        }
50        else $env->erreur = "Impossible d'ajouter l'&eacute;dito.";
51      }
52    }
53  }
54
55  function a_set_edito($env)
56  { if($_POST)
57    { if($_POST["preview"])
58      { $env->out["preview"] = array
59        ( "titre" => $_POST["titre"],
60          "contenu" =>  $_POST["edito"],
61          "auteur" => $env->pun_user["username"],
62          "date_publication" => $_POST["date_publication"],
63          "public" => $_POST["public"] ? 1 : 0
64        );
65      }
66      else
67      { if
68        ( $env->data->set_edito
69          ( $_GET[$env->param("edito")],
70            $_POST["titre"],
71            $_POST["edito"],
72            $env->pun_user["id"],
73            $_POST["date_publication"],
74            $_POST["public"] ? 1 : 0
75          )
76        )
77        { _redirect
78          ( $env,
79            $env->url(array("e" => "set_editos")),
80            "L'&eacute;dito a &eacute;t&eacute; modifi&eacute;"
81          );
82        }
83        else $env->erreur = "Impossible de modifier l'&eacute;dito.";
84      }
85    }
86    else
87    { if(($env->out["edito"] = $env->data->edito($_GET[$env->param("edito")])) === false)
88      { $env->erreur = "Impossible de lire l'&eacute;dito.";
89      }
90    }
91  }
92
93  function a_del_edito($env)
94  { if($env->data->del_edito($_GET[$env->param("edito")]) !== false)
95    { _redirect
96      ( $env,
97        $env->url(array("e" => "set_editos")),
98        "L'&eacute;dito a &eacute;t&eacute; supprim&eacute;"
99      );
100    }
101    else $env->erreur = "Impossible de supprimer l'&eacute;dito.";
102  }
103
104?>
Note: See TracBrowser for help on using the repository browser.