本文整理汇总了PHP中Navigation::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::redirect方法的具体用法?PHP Navigation::redirect怎么用?PHP Navigation::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Navigation
的用法示例。
在下文中一共展示了Navigation::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
// echo "ta aqui.".UserClient::getTypeId();exit();
if (!UserClient::isAlive() || UserClient::getTypeId() != Config::ADMIN_USER_TYPE_ID && UserClient::getTypeId() != Config::DEVELOPER_USER_TYPE_ID) {
$urlTo = Navigation::getURI(Config::$URL_ROOT_APPLICATION);
Navigation::redirect("backend/login/to/" . implode("/", $urlTo));
}
}
示例2: getZipedFiles
/**
* envie por post uma array de ids de files, só os ids
* file/get_ziped_files
*/
public function getZipedFiles()
{
if (!UserClient::getId() > 0) {
//nao tem permissao
Navigation::redirect("405");
exit;
}
$array_file_ids = DataHandler::getValueByArrayIndex($_POST, "file_id");
//Debug::print_r($_REQUEST);
$array_file_vo = array();
if (is_array($array_file_ids)) {
foreach ($array_file_ids as $id) {
$FileVO = new FileVO();
$Result = $FileVO->setId($id, TRUE);
if ($Result->success == TRUE) {
$array_file_vo[] = $FileVO;
}
}
} else {
//erro, não é uma array, verifica se pelo menos é 1 único id
$id = DataHandler::forceInt($array_file_ids);
if ($id > 0) {
//é um id único
$FileVO = new FileVO();
$Result = $FileVO->setId($id, TRUE);
if ($Result->success == TRUE) {
$array_file_vo[] = $FileVO;
}
} else {
//erro mesmo, esse dado é zoado, estoura excessão
throw new Exception("No ids sended", 404);
exit;
}
}
//a pasta zip precisa existir
DataHandler::createFolderIfNotExist("upload/zip/");
//verifica o nome do arquivo baseado nos ids enviados conforme regra inventada agora
$zip_name = "upload/zip/" . md5(implode("|", $array_file_ids));
DataHandler::createFolderIfNotExist($zip_name);
$zip_name = $zip_name . "/teto.zip";
if (!file_exists($zip_name)) {
//echo Debug::li($zip_name);exit();
$Zip = new ZipArchive();
$Zip->open($zip_name, ZipArchive::CREATE);
foreach ($array_file_vo as $FileVO) {
$url = $FileVO->getUrl();
$array = explode("/", $url);
$file = $array[count($array) - 1];
$Zip->addFile($url, $file);
}
$Zip->close();
}
header("Location: " . Config::getRootPath($zip_name));
exit;
}
示例3: __construct
public function __construct($arrayRestFolder = NULL)
{
//verifica se o sujeito está logado e se é admin
if (!UserClient::isAlive()) {
Navigation::redirect("admin/login");
} else {
if (UserClient::getTypeId() != Config::ADMIN_USER_TYPE_ID && UserClient::getTypeId() != Config::DEVELOPER_USER_TYPE_ID) {
//o sujeito ou não está logado ou ele não é admin
Navigation::redirect("admin/login");
}
}
if ($arrayRestFolder != NULL) {
$this->arrayVariable = Navigation::getVariableArraySlug($arrayRestFolder);
$this->arrayRestFolder = $arrayRestFolder;
}
}
示例4: __construct
public function __construct($arrayRestFolder = NULL)
{
if (!UserClient::isAlive()) {
Navigation::redirect("client/login");
exit;
}
$id_user = UserClient::getId();
$PartnerDAO = PartnerDAO::getInstance();
$ReturnPartnerDAO = $PartnerDAO->selectById($id_user);
if ($ReturnPartnerDAO->success && count($ReturnPartnerDAO->result) > 0) {
$_SESSION["is_partner"] = 1;
}
if ($arrayRestFolder != NULL) {
$this->arrayRestFolder = $arrayRestFolder;
$this->arrayVariable = Navigation::getVariableArraySlug($this->arrayRestFolder);
}
$this->DAO = PurchaseOrderDAO::getInstance();
}
示例5: go
function go($url = false)
{
Navigation::redirect($url);
}
示例6: delete
public function delete()
{
$ReturnResult = parent::delete();
Navigation::redirect("backend/client/show/");
}
示例7: getZip
/**
* baixar o zip do mal
* ?products={product_id:N,gallery:true,dimensions:true,files:[]}|{product_id:N,gallery:true,dimensions:true,files:[]}
*/
public function getZip()
{
if (!UserClient::getId() > 0) {
//nao tem permissao
Navigation::redirect("405");
exit;
}
set_time_limit(0);
//tratando variaveis enviadas
$files_id = DataHandler::getValueByArrayIndex($_POST, "file_id");
$imagens = DataHandler::getValueByArrayIndex($_POST, "imagens");
$pdf = DataHandler::getValueByArrayIndex($_POST, "pdf");
//precisa saber quais sao os produtos envolvidos
$array_products_id = array();
$array_files = array();
if ($files_id) {
foreach ($files_id as $file_id) {
$temp_array = explode("_", $file_id);
$product_id = $temp_array[0];
if (!in_array($product_id, $array_products_id)) {
$array_products_id[] = $product_id;
$array_files[] = $product_id;
}
}
}
if ($imagens) {
foreach ($imagens as $product_id) {
if (!in_array($product_id, $array_products_id)) {
$array_products_id[] = $product_id;
}
}
}
if ($pdf) {
foreach ($pdf as $product_id) {
if (!in_array($product_id, $array_products_id)) {
$array_products_id[] = $product_id;
}
}
}
$ReturnResultVO = new ReturnResultVO();
$ProductVO = new ContentSiteVO();
$FileVO = new FileVO();
//se tiver produtos para tratar
if (count($array_products_id) > 0) {
//a pasta zip precisa existir
$zip_path = "upload/zip/";
DataHandler::createFolderIfNotExist($zip_path);
$array_products_to_zip = array();
$unique_str = "";
//nome final do zip que vai baixar, adiciona alguns parametros indicadores
$zip_name = "teto";
if (count($array_products_id) > 0) {
//sao varios produtos
$zip_name = $zip_name . "_produtos";
}
//cada indice dessa array, tem que ser array, terá um json com as info:
foreach ($array_products_id as $product_id) {
$resultProduto = $ProductVO->setId($product_id, TRUE);
if ($resultProduto->success) {
$stdProduct = $ProductVO->toStdClass();
$array_products_to_zip[] = $stdProduct;
$array_images = array();
if ($imagens) {
if (in_array($product_id, $imagens)) {
$array_gallery = $ProductVO->getImages(NULL, "gallery", true);
foreach ($array_gallery as $imageVO) {
$array_images[] = $imageVO->getURL();
$unique_str .= "|" . $imageVO->getId();
//add a imagem na pasta
}
//
$array_dimensions = $ProductVO->getImages(NULL, "dimensions", true);
foreach ($array_dimensions as $imageVO) {
$array_images[] = $imageVO->getURL();
//add a imagem na pasta
$unique_str .= "|" . $imageVO->getId();
}
}
}
$stdProduct->images = $array_images;
$array_file_vo = array();
//cria a pasta do produto no zip
$product_folder_name = DataHandler::strToURL($stdProduct->title);
if (count($array_files) > 0) {
if (in_array($product_id, $array_files)) {
//esse produto pediu algum file
$temp_array_files = $ProductVO->getFiles();
foreach ($temp_array_files as $FileVO) {
if (in_array($FileVO->id, $files_id)) {
$array_file_vo[] = $FileVO;
$unique_str .= "|f." . $file_id;
//add a url do arquivo no zip na pasta
}
}
}
}
//.........这里部分代码省略.........
示例8: delete
public function delete()
{
parent::delete();
Navigation::redirect("admin/contact");
exit;
}
示例9: login
private static function login()
{
global $Conf, $Now, $email_class, $password_class;
$external_login = $Conf->external_login();
// In all cases, we need to look up the account information
// to determine if the user is registered
if (!isset($_REQUEST["email"]) || ($_REQUEST["email"] = trim($_REQUEST["email"])) == "") {
$email_class = " error";
if ($Conf->opt("ldapLogin")) {
return Conf::msg_error("Enter your LDAP username.");
} else {
return Conf::msg_error("Enter your email address.");
}
}
// Check for the cookie
if (isset($_SESSION["testsession"])) {
/* Session cookie set */
} else {
if (!isset($_REQUEST["testsession"])) {
// set a cookie to test that their browser supports cookies
$_SESSION["testsession"] = true;
$url = "testsession=1";
foreach (array("email", "password", "action", "go", "signin") as $a) {
if (isset($_REQUEST[$a])) {
$url .= "&{$a}=" . urlencode($_REQUEST[$a]);
}
}
Navigation::redirect("?" . $url);
} else {
return Conf::msg_error("You appear to have disabled cookies in your browser, but this site needs to set cookies to function. Google has <a href='http://www.google.com/cookies.html'>an informative article on how to enable them</a>.");
}
}
// do LDAP login before validation, since we might create an account
if ($Conf->opt("ldapLogin")) {
$_REQUEST["action"] = "login";
if (!self::ldap_login()) {
return null;
}
}
// look up user in our database
if (strpos($_REQUEST["email"], "@") === false) {
self::unquote_double_quoted_request();
}
$user = $Conf->user_by_whatever($_REQUEST["email"]);
// look up or create user in contact database
$cdb_user = null;
if (opt("contactdb_dsn")) {
if ($user) {
$cdb_user = $user->contactdb_user();
} else {
$cdb_user = Contact::contactdb_find_by_email($_REQUEST["email"]);
}
}
// create account if requested
if ($_REQUEST["action"] == "new") {
if (!($user = self::create_account($user, $cdb_user))) {
return null;
}
$_REQUEST["password"] = $user->password_plaintext;
}
// auto-create account if external login
if (!$user && $external_login) {
$reg = Contact::safe_registration($_REQUEST);
$reg->no_validate_email = true;
if (!($user = Contact::create($Conf, $reg))) {
return Conf::msg_error($Conf->db_error_html(true, "while adding your account"));
}
if ($Conf->setting("setupPhase", false)) {
return self::first_user($user, $msg);
}
}
// if no user found, then fail
if (!$user && (!$cdb_user || !$cdb_user->allow_contactdb_password())) {
$email_class = " error";
return Conf::msg_error("No account for " . htmlspecialchars($_REQUEST["email"]) . ". Did you enter the correct email address?");
}
// if user disabled, then fail
if ($user && $user->disabled) {
return Conf::msg_error("Your account is disabled. Contact the site administrator for more information.");
}
// maybe reset password
$xuser = $user ?: $cdb_user;
if ($_REQUEST["action"] == "forgot") {
$worked = $xuser->sendAccountInfo("forgot", true);
if ($worked == "@resetpassword") {
$Conf->confirmMsg("A password reset link has been emailed to " . htmlspecialchars($_REQUEST["email"]) . ". When you receive that email, follow its instructions to create a new password.");
} else {
if ($worked) {
$Conf->confirmMsg("Your password has been emailed to " . htmlspecialchars($_REQUEST["email"]) . ". When you receive that email, return here to sign in.");
$Conf->log("Sent password", $xuser);
}
}
return null;
}
// check password
if (!$external_login) {
if (($password = trim(req_s("password"))) === "") {
$password_class = " error";
return Conf::msg_error("Enter your password. If you’ve forgotten it, enter your email address and use the “I forgot my password” option.");
}
//.........这里部分代码省略.........
示例10: logout
public function logout()
{
UserClient::kill();
Navigation::redirect("");
}
示例11: delete
public function delete()
{
parent::delete();
Navigation::redirect($this->my_redirect);
exit;
}
示例12: updateAddress
public function updateAddress()
{
$returnResult = new HttpResult();
$retornoDaPaginaHTML = new HttpAdminGenericResult();
$ReturnResultVO = new ReturnResultVO();
$retornoDaPaginaHTML->return_result_vo = $ReturnResultVO;
if (DataHandler::getValueByArrayIndex($this->arrayVariable, "address_id") != NULL && DataHandler::getValueByArrayIndex($this->arrayVariable, "user_id") != NULL) {
$user_id = DataHandler::getValueByArrayIndex($this->arrayVariable, "user_id");
$address_id = DataHandler::getValueByArrayIndex($this->arrayVariable, "address_id");
$AddressVO = new AddressVO($_POST);
$UserDetailVO = new UserDetailVO();
// print_r($AddressVO);exit();
if ($_POST) {
$AddressVO->setId($address_id);
$ReturnResultVO = $AddressVO->commit(TRUE);
if ($ReturnResultVO->success) {
// Debug::print_r($ReturnResultVO);
if (DataHandler::getValueByArrayIndex($_POST, "principal") == '1') {
$UserDetailVO->setId($user_id, TRUE);
$UserDetailVO->setAddressId($address_id);
// Debug::print_r($UserDetailVO);
$ReturnResultVO = $UserDetailVO->commit();
// Debug::print_r($ReturnResultVO);
}
}
if ($ReturnResultVO->success) {
Navigation::redirect("admin/user/update/id." . $user_id);
exit;
}
} else {
$AddressVO->setId($address_id, TRUE);
$UserDetailVO->setId($user_id, TRUE);
}
$retornoDaPaginaHTML->return_result_vo = $ReturnResultVO;
$retornoDaPaginaHTML->user_id = $user_id;
$retornoDaPaginaHTML->user_address_vo = $AddressVO;
$retornoDaPaginaHTML->user_detail_vo = $UserDetailVO;
} else {
Navigation::redirect("admin/user");
exit;
}
//iniciando o retorno padrao em http result
$returnResult->setHttpContentResult($retornoDaPaginaHTML);
return $returnResult;
}
示例13: update
public function update()
{
$ReturnResultVO = new ReturnResultVO();
$retornoDaPaginaHTML = new HttpAdminGenericResult();
//iniciando o retorno padrao
$returnResult = new HttpResult();
$id = 0;
if (DataHandler::getValueByArrayIndex($this->arrayVariable, "id")) {
$id = DataHandler::getValueByArrayIndex($this->arrayVariable, "id");
}
$VO = $this->DAO->getVO();
$VO->setId($id, TRUE);
if ($_POST) {
$VO->setFetchArray($_POST);
$VO->setId($id);
$ReturnResultVO = $VO->commit(TRUE);
// Debug::print_r($ReturnResultVO);exit();
if ($ReturnResultVO->success) {
Navigation::redirect("admin/attribute/module." . $this->module);
exit;
}
}
$retornoDaPaginaHTML->return_result_vo = $ReturnResultVO;
$retornoDaPaginaHTML->attribute_vo = $VO;
$retornoDaPaginaHTML->module = $this->module;
//iniciando o retorno padrao em http result
$returnResult->setHttpContentResult($retornoDaPaginaHTML);
return $returnResult;
}
示例14: delete
public function delete()
{
$DAO = CategoryDAO::getInstance();
if (FALSE) {
$DAO = new CategoryDAO();
}
$DAO->delete(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
Navigation::redirect("admin/category/select");
}
示例15: init
/**
* para detalhe de um produto
*/
public function init()
{
//Debug::print_r($this->arrayVariable);
//filtro vindo por parametro é o addres que ele tem que enviar de volta como busca
//rel ids de produtos relacionados
//exit();
//echo 12;
$id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
if ($id > 0) {
$ContentSiteVO = new ContentSiteVO();
$ReturnResult_vo = $ContentSiteVO->setId($id, TRUE);
if ($ReturnResult_vo->success) {
$stdProduct = $ContentSiteVO->toStdClass();
$stdProduct->array_gallery = $ContentSiteVO->getImages(NULL, "gallery", true);
$stdProduct->array_dimensions = $ContentSiteVO->getImages(NULL, "dimensions", true);
$stdProduct->array_video = $ContentSiteVO->getImages(NULL, "video", true);
$stdProduct->array_360 = $ContentSiteVO->getImages(NULL, "360", true);
$stdProduct->array_tagged = $ContentSiteVO->getImages(NULL, "tagged", true);
$LinkDAO = LinkDAO::getInstance();
//passo 1, descobrir a qual família esse protudo pertence
//passo 2, pegar todos os produtos pertencente a mesma família
//passo 3, tirar o próprio produto da listagem de produtos da mesma família
$array_links = array();
$resultLinks = $LinkDAO->select(DbInterface::RETURN_STD_OBJECT, "content", $table_id = null, $linked_table = 'content', $linked_table_id = $id, $active = 1, $quant_started = NULL, $quant_limit = NULL, $order_by = "order", $order_type = " ASC ");
if ($resultLinks->success && $resultLinks->count_total > 0) {
foreach ($resultLinks->result as $familia) {
$link = $familia;
//$resultLinks->result[0];
$ContentFamiliaVO = new ContentSiteVO();
$ContentFamiliaVO->setId($link->table_id, TRUE);
Debug::print_r($ContentFamiliaVO);
exit;
if ($ContentFamiliaVO->active > 0) {
$arrayResult_links = $ContentFamiliaVO->getLinks("content");
foreach ($arrayResult_links as $link) {
if ($link->linked_table_id != $id) {
$ResultTempLink = $link->getLinkedVO();
if ($ResultTempLink->success) {
$produtoVO = $ResultTempLink->result;
if ($produtoVO->active > 0) {
$stdProduto = $produtoVO->toStdClass();
$stdProduto->array_tagged = $produtoVO->getImages(NULL, "tagged", NULL);
$array_links[] = $stdProduto;
}
//Debug::print_r($stdProduto);exit();
}
}
//end if
}
//end foerach
}
}
}
//verifica a qual familia esse produto pertence
$stdProduct->array_produtos_vinculados = $array_links;
//Debug::print_r($array_links);
//exit();
//pegando array de vinculados enviados como id
$str_ids_send = DataHandler::getValueByArrayIndex($this->arrayVariable, "rel");
$array_ids_send = explode("|", $str_ids_send);
$array_filtro = array();
foreach ($array_ids_send as $id) {
$ContentSiteVO = new ContentSiteVO();
$tempResult = $ContentSiteVO->setId($id, TRUE);
if ($tempResult->success) {
$stdProduto = $ContentSiteVO->toStdClass();
$stdProduto->array_tagged = $ContentSiteVO->getImages(NULL, "tagged", NULL);
$array_filtro[] = $stdProduto;
}
}
$stdProduct->array_filtro = $array_filtro;
//Debug::print_r($array_links);
$returnResult = new HttpResult();
//exit();
//iniciando o resultado para o html
$retornoDaPaginaHTML = new HttpRoot();
$retornoDaPaginaHTML->vo = $stdProduct;
$retornoDaPaginaHTML->addressToReturn = str_replace("|", "/", DataHandler::getValueByArrayIndex($this->arrayVariable, "filtro"));
$strToResend = implode("/", $this->arrayRestFolder);
$strToResend = explode("/:/", $strToResend);
if (is_array($strToResend) && count($strToResend) > 1) {
$strToResend = $strToResend[1];
} else {
$strToResend = "";
}
$retornoDaPaginaHTML->addressToResend = $strToResend;
$returnResult->setHttpContentResult($retornoDaPaginaHTML);
return $returnResult;
} else {
Navigation::redirect("");
}
} else {
//não mandou o id, vai pra listagem
Navigation::redirect("produtos");
}
}