source: trunk/web/app/mods/e_set_spotlights.php @ 1

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

import initial

File size: 3.0 KB
Line 
1<?php
2
3  function e_set_spotlights($env)
4  { if($env->data->is_admin($env->pun_user["id"]))
5    { $env->a = $_GET[$env->param("action")] ? $_GET[$env->param("action")] : "spotlights";
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_spotlights($env)
17  { if(($env->out["spotlights"] = $env->data->spotlights($env->start)) !== false)
18    {
19    }
20    else $env->erreur = "Impossible de lire les spotlights";
21  }
22
23  function a_add_spotlight($env)
24  { if($_POST)
25    { if($_POST["preview"])
26      { $env->out["preview"] = array
27        ( "titre" => $_POST["titre"],
28          "contenu" =>  $_POST["spotlight"],
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_spotlight
37          ( $_POST["titre"],
38            $_POST["spotlight"],
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_spotlights")),
47            "Le spotlight a &eacute;t&eacute; ajout&eacute;"
48          );
49        }
50        else $env->erreur = "Impossible d'ajouter le spotlight.";
51      }
52    }
53  }
54
55  function a_set_spotlight($env)
56  { if($_POST)
57    { if($_POST["preview"])
58      { $env->out["preview"] = array
59        ( "titre" => $_POST["titre"],
60          "contenu" =>  $_POST["spotlight"],
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_spotlight
69          ( $_GET[$env->param("spotlight")],
70            $_POST["titre"],
71            $_POST["spotlight"],
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_spotlights")),
80            "Le spotlight a &eacute;t&eacute; modifi&eacute;"
81          );
82        }
83        else $env->erreur = "Impossible de modifier le spotlight.";
84      }
85    }
86    else
87    { if(($env->out["_spotlight"] = $env->data->spotlight($_GET[$env->param("spotlight")])) === false)
88      { $env->erreur = "Impossible de lire le spotlight.";
89      }
90    }
91  }
92
93  function a_del_spotlight($env)
94  { if($env->data->del_spotlight($_GET[$env->param("spotlight")]) !== false)
95    { _redirect
96      ( $env,
97        $env->url(array("e" => "set_spotlights")),
98        "Le spotlight a &eacute;t&eacute; supprim&eacute;"
99      );
100    }
101    else $env->erreur = "Impossible de supprimer le spotlight.";
102  }
103
104?>
Note: See TracBrowser for help on using the repository browser.