本文整理汇总了PHP中Site::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::redirect方法的具体用法?PHP Site::redirect怎么用?PHP Site::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAuthentication
/**
* Check if an authentication request exists and
* attempt authentication if it does
* @return bool $success
*/
public function checkAuthentication()
{
if (isset($this->_authenticatedPerson)) {
return true;
}
// resolve AuthRequest from PostContainer
if (static::$requestContainer) {
if (isset($_REQUEST[static::$requestContainer])) {
$requestData =& $_REQUEST[static::$requestContainer];
} else {
$requestData = array();
}
} else {
$requestData =& $_POST;
}
// check for authentication request
if (isset($requestData['username']) && isset($requestData['password'])) {
$this->_authenticatedPerson = $this->attemptAuthentication($requestData['username'], $requestData['password']);
if ($this->_authenticatedPerson) {
// redirect if original request was GET
if ($requestData['returnMethod'] != 'POST' && $_SERVER['REQUEST_METHOD'] != 'GET') {
Site::redirect($_SERVER['REQUEST_URI']);
}
return true;
} else {
$this->respondLoginPrompt(new PasswordAuthenticationFailedException(_('The username or password you entered was incorrect.')));
return false;
}
}
return false;
}
示例2: action_delete
public function action_delete()
{
$cm = new ClientManager(DB::get_instance());
$clt = $cm->get($this->req->id);
$this->site->ajouter_message("ok");
$cm->delete($clt);
$this->site->ajouter_message($clt->getMail() . " supprimé!");
Site::redirect("admClient");
}
示例3: Logout
public static function Logout()
{
if (self::$me != null) {
setcookie(MODLOGIN_LOGIN, '', 0, '/');
setcookie(MODLOGIN_PASSWORD, '', 0, '/');
Site::redirect(WEBDIR);
exit;
}
}
示例4: getRecordByHandle
public static function getRecordByHandle($handle)
{
$Record = parent::getRecordByHandle($handle);
// redirect to correct handler
if ($Record && !is_a($Record, static::$recordClass)) {
$url = $Record->getURL();
if ($rest = static::getPath()) {
$url .= '/' . implode('/', $rest);
}
\Site::redirect($url);
}
return $Record;
}
示例5: action_validcom
public function action_validcom()
{
$com['idClient'] = $this->session->session_ouverte()->getIdClient();
$modm = new ModeleManager(DB::get_instance());
$mod = $modm->getByName($this->req->name);
$com['idModele'] = $mod->getIdModele();
$com['contenu'] = $this->req->com;
$com['note'] = $this->req->note - 1;
$com['dateCom'] = date('Y-m-d', time() + 7200);
$commentaire = new Commentaire($com);
$comm = new CommentaireManager(DB::get_instance());
$comm->add($commentaire);
Site::redirect("car", "index&name=" . $this->req->name);
}
示例6: action_index
public function action_index()
{
if ($this->session->ouverte()) {
$user = $this->session->session_ouverte();
//echo var_dump($user);
$f = new Form("?module=clientmanage&action=valide", "form");
//Creation du formulaire
$f->add_text("Email", "Email", "Email")->set_value($user->getMail());
$f->add_text("Mdp", "Mdp", "Mot de passe")->set_value($user->getMdp());
$f->add_text("rue", "rue", "Rue")->set_value($user->getRue());
$f->add_text("cp", "cp", "Code Postal")->set_value($user->getCodePostal());
$f->add_text("ville", "ville", "Ville")->set_value($user->getVille());
$f->add_submit("Valider", "Valider")->set_value("Valider");
$this->tpl->assign("form", $f);
} else {
$this->site->ajouter_message("Vous n'êtes pas connecté(e)");
Site::redirect("index");
}
}
示例7: redirectViewRecord
public static function redirectViewRecord(ActiveRecord $Record, $path = array(), $permanent = false)
{
if (is_array($path)) {
$path = implode('/', $path);
}
if (!($url = $Record->getURL())) {
if (!($classPath = static::getClassPath($Record))) {
return RequestHandler::throwError('No route to record viewer');
}
$url = '/' . $classPath . '/' . $Record->getHandle();
}
if ($path) {
$url .= '/' . ltrim($path, '/');
}
if ($permanent) {
Site::redirectPermanent($url);
} else {
Site::redirect($url);
}
}
示例8: action_validelogadm
public function action_validelogadm()
{
if ($this->req->log and $this->req->mdp) {
if ($this->req->log != 'admin') {
$f = $this->session->formlogadm;
$f->populate();
$this->session->formlogadm = $f;
$this->site->ajouter_message("Login ou mot de passe incorrect");
Site::redirect('login', 'logadmin');
} else {
$am = new AdminManager(DB::get_instance());
$adm = $am->connexion($this->req->mdp);
if ($adm) {
$this->session->ouvrir('admin');
$this->site->ajouter_message("Bienvenue Admin");
unset($this->session->formlogadm);
Site::redirect('admSpace');
} else {
$f = $this->session->formlogadm;
$f->populate();
$this->session->formlogadm = $f;
$this->site->ajouter_message("Login ou mot de passe incorrect");
Site::redirect('login', 'logadmin');
}
}
} else {
$this->site->ajouter_message("Login ou mot de passe non renseigné");
Site::redirect("login", "logadm");
}
}
示例9: handleViewRequest
public static function handleViewRequest()
{
$GLOBALS['Session']->requireAuthentication();
return Site::redirect($GLOBALS['Session']->Person->getURL());
}
示例10: action_validePhoto
public function action_validePhoto()
{
$extensions = array("png", "jpg", "jpeg", "bmp", "PNG", "JPG", "JPEG", "BMP");
$taille_max = 100000;
$dossier = "images/";
$fichier = uniqid();
$extension = explode('.', $_FILES['photo']['name']);
$extension = strtolower($extension[count($extension) - 1]);
if (!in_array($extension, $extensions)) {
$error[] = "mauvaise extension";
}
/*$taille = getimagesize($_FILES['photo']['tmp_name']);
$larg=300;
$reduc=($larg*100)/$taille[0];
$haut=($taille[1]*$reduc)/100;
if($extension!="jpg")
$function=imagecreatefrom.$extension;
else $function=imagecreatefrom.jpeg;
$image=imagecreatetruecolor($larg,$haut);
imagecopyresampled($image, $function($_FILES['photo']['tmp_name']), 0, 0, 0, 0, $larg, $haut, $taille[0],$taille[1]);
imagepng($image,$dossier.$fichier.".png",9);*/
move_uploaded_file($_FILES['photo']['tmp_name'], $dossier . $fichier . ".jpg");
if (isset($error[0])) {
$f = $this->session->formPh;
$f->populate();
$this->tpl->assign("f_addph", $f);
foreach ($error as $err) {
$this->site->ajouter_message("-" . $err);
}
} else {
$img['idImage'] = $fichier;
$img['idModele'] = $this->req->id;
$image = new Image($img);
$imgM = new ImageManager(DB::get_instance());
$imgM->add($image);
$this->site->ajouter_message("upload réussi");
//il faudra penser à redimensionner la photo
Site::redirect("admMarque");
}
}
示例11: redirect
public static function redirect($path, $get = false, $hash = false)
{
Site::redirect($path, $get, $hash);
}
示例12: action_ajax
public function action_ajax()
{
// Pour afficher les voitures quand on clique sur un modèle
if ($this->req->id) {
$vm = new VoitureManager(DB::get_instance());
$liste = $vm->listing($this->req->id);
$i = 0;
$tab = array();
foreach ($liste as $car) {
$tab[$i]['idVoiture'] = $car->getIdVoiture();
$tab[$i]['annee'] = $car->getAnnee();
$tab[$i]['km'] = $car->getKm();
$tab[$i]['description'] = $car->getDescription();
$i = $i + 1;
}
echo json_encode($tab);
exit;
} else {
Site::redirect('index');
}
}
示例13: redirect
/**
* {@inheritdoc}
*/
public function redirect($url, $data = array())
{
Site::redirect($url, $data);
}
示例14: function
<?php
Site::$debug = true;
// set to true for extended query logging
Site::$production = true;
// set to true for heavy file caching
#Site::$autoPull = false;
Site::$permittedOrigins = '*';
Site::$skipSessionPaths[] = 'api.php';
Site::$skipSessionPaths[] = 'test-api/cachable.php';
Site::$skipSessionPaths[] = 'test-api/status.php';
if (Gatekeeper\Gatekeeper::$apiHostname && !empty($_SERVER['HTTP_HOST']) && (is_string(Gatekeeper\Gatekeeper::$apiHostname) && $_SERVER['HTTP_HOST'] == Gatekeeper\Gatekeeper::$apiHostname || is_array(Gatekeeper\Gatekeeper::$apiHostname) && in_array($_SERVER['HTTP_HOST'], Gatekeeper\Gatekeeper::$apiHostname))) {
Site::$onInitialized = function () {
if (empty(Site::$pathStack[0]) && Gatekeeper\Gatekeeper::$portalHostname) {
Site::redirect('http://' . Gatekeeper\Gatekeeper::$portalHostname);
}
array_unshift(Site::$pathStack, 'api');
array_unshift(Site::$requestPath, 'api');
};
}
示例15: action_index
public function action_index()
{
Site::redirect("loc");
// La page d'accueil est la page de location
}