Exemplo n.º 1
0
 /**
  * MODULE : Redirection
  */
 public function index()
 {
     $url = $this->getData($this->getUrl(0), 'url');
     if ($url) {
         helpers::redirect($url, false);
     }
 }
Exemplo n.º 2
0
 /**
  * MODULE : Suppression d'une news
  */
 public function delete()
 {
     if (!$this->getData($this->getUrl(1), $this->getUrl(3))) {
         return false;
     } else {
         $this->removeData($this->getUrl(1), $this->getUrl(3));
         $this->saveData();
         $this->setNotification('News supprimée avec succès !');
     }
     helpers::redirect('module/' . $this->getUrl(1));
 }
Exemplo n.º 3
0
 /**
  * MODULE : Formulaire de contact
  */
 public function index()
 {
     // Envoi du mail
     if ($this->getPost('submit')) {
         $mail = helpers::mail($this->getPost('subject', helpers::STRING), $this->getData($this->getUrl(0), 'mail'), $this->getPost('subject', helpers::STRING), $this->getPost('message', helpers::STRING));
         if ($mail) {
             $this->setNotification('Mail envoyé avec succès !');
         } else {
             $this->setNotification('Impossible d\'envoyer le mail !');
         }
         helpers::redirect($this->getUrl());
     }
     // Interface d'écriture de mail
     self::$content = template::openForm() . template::openRow() . template::text('mail', ['label' => 'Adresse mail', 'required' => true, 'col' => 6]) . template::newRow() . template::text('subject', ['label' => 'Sujet', 'required' => true, 'col' => 6]) . template::newRow() . template::textarea('message', ['label' => 'Sujet', 'required' => true, 'col' => 7]) . template::newRow() . template::submit('submit', ['col' => 2]) . template::closeRow() . template::closeForm();
 }
                if ($k == 'password') {
                    $c->password = md5(md5($v));
                } else {
                    $c->{$k} = $v;
                }
            }
            $c->save();
        } else {
            $message = 'O Registro ' . $id . ' não existe';
        }
    }
    helpers::send(!$c, $message, $c);
});
$app->delete('/private/delete/:cadastro/:id/:chave', function ($class, $id, $chave) use($app) {
    if (checkPass($chave)) {
        helpers::redirect('/needlogin');
        exit;
    }
    if (!getClass($class, $id)) {
        $c = false;
        $message = 'Ocorreu um erro ao excluir o registro';
    } else {
        $message = 'Registro apagado com sucesso!';
        $c = $class::find($id);
        if ($c) {
            $c->delete();
        } else {
            $message = 'O Registro ' . $id . ' não existe';
        }
    }
    helpers::send(!$c, $message, $c);
Exemplo n.º 5
0
 /**
  * MODULE : Déconnexion
  */
 public function logout()
 {
     $this->removeCookie();
     helpers::redirect('./', false);
 }