本文整理汇总了PHP中Redirect::failure方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::failure方法的具体用法?PHP Redirect::failure怎么用?PHP Redirect::failure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::failure方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invia_commento
function invia_commento()
{
try {
$nome = Params::get("nome");
$subject = Params::get("subject");
$email = Params::get("email");
$testo = Params::get("testo");
//$codice_hidden = Params::get("codice_hidden");
//$codice = Params::get("codice");
//if ($codice_hidden!=$codice)
// throw new InvalidParameterException("Il codice non e' impostato correttamente!!");
if ($nome != null && $subject != null && $email != null && $testo != null && isset(Config::instance()->EMAIL_COMMENT_RECEIVED)) {
$e = new EMail("no_reply@" . Host::current_no_www(), Config::instance()->EMAIL_COMMENT_RECEIVED, "[Nuova commento da : " . $nome . "] - " . Host::current(), EMail::HTML_FORMAT);
$e->render_and_send("include/messages/mail/alert/" . Lang::current() . "/nuovo_commento.php.inc", array("nome" => $nome, "email" => $email, "subject" => $subject, "testo" => $testo));
return Redirect::success();
} else {
if (!isset(Config::instance()->EMAIL_COMMENT_RECEIVED)) {
throw new InvalidDataException("Il parametri di configurazione EMAIL_COMMENT_RECEIVED non e' impostato correttamente!!");
} else {
throw new InvalidDataException("I dati immessi nella form non sono validi!!");
}
}
} catch (Exception $ex) {
Flash::error($ex->getMessage());
return Redirect::failure();
}
}
示例2: add
function add()
{
if (Upload::isUploadSuccessful("my_file")) {
$peer = new ImmaginiPeer();
$do = $peer->new_do();
$peer->setupByParams($do);
$d = new Dir("/immagini/user/" . Session::get("/session/username") . Params::get("folder"));
if (!$d->exists()) {
$d->touch();
}
$do->save_folder = $d->getPath();
$do->real_name = Upload::getRealFilename("my_file");
$do->folder = Params::get("folder");
$tokens = explode(".", Upload::getRealFilename("my_file"));
$extension = $tokens[count($tokens) - 1];
$do->hash_name = md5(uniqid()) . "." . strtolower($extension);
Upload::saveTo("my_file", $do->save_folder, $do->hash_name);
$peer->save($do);
if (is_html()) {
Flash::ok("Immagine aggiunta con successo.");
return Redirect::success();
} else {
return ActiveRecordUtils::toArray($do);
}
} else {
Flash::error(Upload::getUploadError("my_file"));
return Redirect::failure();
}
}
示例3: add
function add()
{
ini_set('upload_max_filesize', 8388608 * 4);
if (Upload::isUploadSuccessful("my_file")) {
$peer = new DocumentiPeer();
$do = $peer->new_do();
$peer->setupByParams($do);
$d = new Dir("/documenti/user/" . Session::get("/session/username") . "/contenuti/");
if (!$d->exists()) {
$d->touch();
}
$do->save_folder = $d->getPath();
$do->real_name = Upload::getRealFilename("my_file");
$do->folder = Params::get("folder");
$tokens = explode(".", Upload::getRealFilename("my_file"));
$extension = $tokens[count($tokens) - 1];
$do->hash_name = md5(uniqid()) . "." . strtolower($extension);
Upload::saveTo("my_file", $do->save_folder, $do->hash_name);
$peer->save($do);
Flash::ok("Documento aggiunto con successo.");
return Redirect::success();
} else {
return Redirect::failure(Upload::getUploadError("my_file"));
}
}
示例4: modify_image
function modify_image()
{
$peer = new GalleryImagePeer();
$do = $peer->updateByParams();
$peer->save($do);
if (is_html()) {
return Redirect::success();
} else {
return Redirect::failure();
}
}
示例5: login
function login()
{
if (Params::get("username") == Config::instance()->ADMIN_USERNAME && Params::get("password") == Config::instance()->ADMIN_PASSWORD) {
Session::set("/session/type", "admin");
Session::set("/session/username", Params::get("username"));
Session::set("/session/ip", Request::getRemoteIp());
Session::set("/session/timestamp_inizio_sessione", time());
return Redirect::success();
} else {
return Redirect::failure();
}
}
示例6: add_rotator_image
function add_rotator_image()
{
$rotator_name = Params::get("rotator_name");
$d = new Dir(self::ROTATOR_GALLERIES_ROOT_PATH . $rotator_name);
if ($d->exists()) {
Upload::saveTo("my_file", self::ROTATOR_GALLERIES_ROOT_PATH . $rotator_name . DS);
} else {
Flash::error("Errore durante il caricamento dell'immagine!! Contattare l'assistenza : info@mbcraft.it");
return Redirect::failure();
}
Flash::ok("Immagine caricata con successo!!");
return Redirect::success();
}
示例7: formatOutputData
function formatOutputData($result)
{
if (Result::is_result($result)) {
if (Result::is_ok($result)) {
$result = Redirect::success();
} else {
$result = Redirect::failure();
}
}
if ($result instanceof IActionCommand) {
return $result->execute();
}
echo render_result($result);
}
示例8: delete
function delete()
{
$nome_categoria = Params::get("nome_categoria");
$nome_modulo = Params::get("nome_modulo");
if ($nome_categoria !== ModuleUtils::FRAMEWORK_CATEGORY_NAME && $nome_modulo !== ModuleUtils::FRAMEWORK_MODULE_NAME) {
$path = AvailableModules::get_available_module_path($nome_categoria, $nome_modulo);
$d = new Dir($path);
$d->delete(true);
Flash::ok("Modulo " . $nome_categoria . "/" . $nome_modulo . " eliminato con successo!!");
return Redirect::success();
} else {
Flash::error("Impossibile eliminare il modulo " . $nome_categoria . "/" . $nome_modulo);
return Redirect::failure();
}
}
示例9: add_image
function add_image()
{
if (Upload::isUploadSuccessful("file")) {
$gallery_dir = new Dir($this->get_current_folder());
$uploaded_img = Upload::saveTo("file", $gallery_dir);
if (isset(Config::instance()->GALLERY_RESIZE_BY_WIDTH)) {
image_w($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_WIDTH);
} else {
if (isset(Config::instance()->GALLERY_RESIZE_BY_HEIGHT)) {
image_h($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_HEIGHT);
}
}
$peer = new GalleryImagePeer();
return Redirect::success();
} else {
Flash::error(Upload::getUploadError("file"));
return Redirect::failure();
}
}
示例10: __defaultReturn
function __defaultReturn($success_message, $error_messages)
{
if (is_html()) {
if (!$error_messages) {
Flash::ok($success_message);
return Redirect::success();
} else {
foreach ($error_messages as $error_msg) {
Flash::error($error_msg);
}
return Redirect::failure();
}
} else {
if (!$error_messages) {
return Result::ok();
} else {
return Result::error($error_messages);
}
}
}
示例11: aggiungi_immagine
function aggiungi_immagine()
{
$id_prodotto_servizio = Params::get("id_prodotto_servizio");
if (Params::is_set("file_field_name")) {
$file_field_name = Params::get("file_field_name");
} else {
$file_field_name = "file";
}
if (Upload::isUploadSuccessful($file_field_name)) {
$product_dir = new Dir(self::PRODUCT_IMAGE_DIR . "/" . $id_prodotto_servizio);
$product_dir->touch();
$uploaded_img = Upload::saveTo($file_field_name, $product_dir);
if (isset(Config::instance()->PRODUCT_IMAGE_RESIZE_BY_WIDTH)) {
image_w($uploaded_img->getPath(), Config::instance()->PRODUCT_IMAGE_RESIZE_BY_WIDTH);
} else {
if (isset(Config::instance()->PRODUCT_IMAGE_RESIZE_BY_HEIGHT)) {
image_h($uploaded_img->getPath(), Config::instance()->PRODUCT_IMAGE_RESIZE_BY_HEIGHT);
}
}
//creo una riga associata all'immagine
$immagine_prodotto_servizio_peer = new ImmagineProdottoServizioPeer();
$do = $immagine_prodotto_servizio_peer->new_do();
$do->id_prodotto_servizio = Params::get("id_prodotto_servizio");
$do->nome_immagine = $uploaded_img->getFilename();
$immagine_prodotto_servizio_peer->save($do);
return Redirect::success();
} else {
Flash::error(Upload::getUploadError($file_field_name));
return Redirect::failure();
}
}