本文整理汇总了PHP中setFlash函数的典型用法代码示例。如果您正苦于以下问题:PHP setFlash函数的具体用法?PHP setFlash怎么用?PHP setFlash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setFlash函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: isAllowed
function isAllowed()
{
if (!isLogged()) {
setFlash("Veuillez vous connecter pour pouvoir effectuer cette action.", "danger");
redirect('index.php');
}
}
开发者ID:Reval63,项目名称:projet_photo,代码行数:7,代码来源:tests.php
示例2: initialize_page
function initialize_page()
{
$category_id = requestIdParam();
$category = Categories::FindById($category_id);
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if (isset($_POST['delete'])) {
$category->delete(true);
setFlash("<h3>Category Deleted</h3>");
redirect("/admin/list_categories/");
} else {
if ($post_action == "Edit Category" || $post_action == "Edit and Return to List") {
$category->display_name = getPostValue('display_name');
$category->name = slug(getPostValue('display_name'));
$category->content = getPostValue('category_content');
$category->save();
setFlash("<h3>Category Edited</h3>");
if ($post_action == "Edit and Return to List") {
redirect("admin/list_categories/");
}
}
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:25,代码来源:edit_category.php
示例3: initialize_page
function initialize_page()
{
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Add Document" || $post_action == "Add and Return to List") {
$name = $_POST['name'];
$file_type = getFileExtension($_FILES['file']['name']);
$filename = slug(getFileName($_FILES['file']['name']));
$filename_string = $filename . "." . $file_type;
// Check to make sure there isn't already a file with that name
$possibledoc = Documents::FindByFilename($filename_string);
if (is_object($possibledoc)) {
setFlash("<h3>Failure: Document filename already exists!</h3>");
redirect("admin/add_document");
}
$target_path = SERVER_DOCUMENTS_ROOT . $filename_string;
if (move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
$new_doc = MyActiveRecord::Create('Documents', array('name' => $name, 'filename' => $filename_string, 'file_type' => $file_type));
$new_doc->save();
if (!chmod($target_path, 0644)) {
setFlash("<h3>Warning: Document Permissions not set; this file may not display properly</h3>");
}
setFlash("<h3>Document uploaded</h3>");
} else {
setFlash("<h3>Failure: Document could not be uploaded</h3>");
}
if ($post_action == "Add and Return to List") {
redirect("admin/list_documents");
}
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:33,代码来源:add_document.php
示例4: uploadImage
function uploadImage($name, $alt, $bdd, $sizeMax)
{
$fileSize = '';
if ($_FILES['img']['error'] == 2) {
$fileSize = "<br/>Taille maximale: " . $sizeMax . " octets; Taille du fichier (probablement plus)";
setFlash("Problème dans l'upload " . $fileSize, "error");
}
$type = ['image/png', 'image/gif', 'image/jpg', 'image/jpeg'];
if (in_array($_FILES['img']['type'], $type)) {
$src = 'http://cd84-tennis-de-table.fr/images/gallerie/' . $name;
$src_min = $src;
$alt = $_POST['alt'];
$insert_q = $bdd->prepare("INSERT INTO image(id, src, src_min, alt, valid) VALUES ('', :src, :src_min, :alt, '1')");
$insert_q->execute(array('src' => $src, 'src_min' => $src_min, 'alt' => $alt));
$uploaddir = 'images/gallerie/';
$uploadfile = $uploaddir . basename($name);
if (move_uploaded_file($_FILES['img']['tmp_name'], $uploadfile)) {
setFlash("Le fichier est valide, et a été upload avec succès.");
} else {
setFlash("Problème dans l'upload " . $fileSize, "error");
}
} else {
if ($_FILES['img']['error'] == 0) {
setFlash('Le fichier n\'est pas une image: ' . $_FILES['img']['type'], 'error');
}
}
}
开发者ID:Vivien-,项目名称:cd84,代码行数:27,代码来源:idents.php
示例5: view
public function view($user)
{
if (empty($user)) {
$this->Session - setFlash('Invalid user.');
$this->redirect('/');
}
}
开发者ID:rawroland,项目名称:Cars-Test,代码行数:7,代码来源:UsersController.php
示例6: initialize_page
function initialize_page()
{
$type_id = requestIdParam();
$type = EventTypes::FindById($type_id);
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Save Type" || $post_action == "Edit and Return to List") {
if (isset($_POST['delete'])) {
$type->updateEventTypes();
$type->delete(true);
setFlash("<h3>Event type deleted</h3>");
redirect("/admin/list_event_types");
} else {
$type->name = $_POST['name'];
$type->color = $_POST['color'];
$type->text_color = EventTypes::$color_array[$type->color];
$type->save();
setFlash("<h3>Event type changes saved</h3>");
if ($post_action == "Edit and Return to List") {
redirect("admin/list_event_types");
}
}
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:26,代码来源:edit_type.php
示例7: checkGetCsrf
function checkGetCsrf()
{
if (!isset($_SESSION['OLD_CSRF']) || !isset($_GET['CSRF']) || $_SESSION['OLD_CSRF'] != $_GET['CSRF']) {
setFlash('error', "Vous n'etes pas autorisé à effectuer cette action.");
redirect(401, url('home'));
exit(1);
}
}
开发者ID:fzed51,项目名称:core,代码行数:8,代码来源:session.php
示例8: initialize_page
function initialize_page()
{
$page_id = requestIdParam();
$page = Pages::FindById($page_id);
// get all the areas
$areas = Areas::FindPublicAreas();
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Save Page" || $post_action == "Save and Return to List") {
if (isset($_POST['delete'])) {
$page->delete(true);
setFlash("<h3>Page deleted</h3>");
redirect("/admin/list_pages");
} else {
$page->display_name = $_POST['display_name'];
$oldname = $page->name;
if (ALLOW_SHORT_PAGE_NAMES) {
if ($_POST['name'] == "") {
$page->name = slug($_POST['display_name']);
} else {
$page->name = slug($_POST['name']);
}
} else {
$page->name = slug($_POST['display_name']);
}
$page->content = $_POST['page_content'];
$page->template = $_POST['template'];
$page->public = checkboxValue($_POST, 'public');
// Pages can either be directly assigned to areas, or assigned as a sub-page.
// It's an either-or thing. For now, default to areas if they're selected (ie, if both selected, ignore the sub-page)
// synchronize the users area selections
$selected_areas = array();
if (isset($_POST['selected_areas'])) {
$selected_areas = $_POST['selected_areas'];
}
if (count($selected_areas) > 0) {
$page->parent_page_id = null;
$page->updateSelectedAreas($selected_areas);
} else {
if ($_POST['parent_page'] != "") {
$page->parent_page_id = $_POST['parent_page'];
} else {
$page->parent_page_id = null;
}
}
$page->save();
$page->checkAlias($selected_areas, $oldname);
setFlash("<h3>Success. Database Updated</h3>");
if ($post_action == "Save and Return to List") {
redirect("admin/list_pages");
}
}
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:56,代码来源:edit_page.php
示例9: UpdateUserInfo
private function UpdateUserInfo($id)
{
$user = new model\User($_POST['username'], '', $id);
if (isset($_POST['permission']) && is_array($_POST['permission'])) {
foreach ($_POST['permission'] as $permission) {
$user->AddPermission($permission);
}
}
$this->model->Update($user);
setFlash("You've edited " . htmlspecialchars($user->GetUsername()), 'success');
$this->Redirect('/admin/user');
}
开发者ID:ehamrin,项目名称:cmsPlugin,代码行数:12,代码来源:AdminController.php
示例10: view
public function view($id = null)
{
if (!$id) {
$this->Session - setFlash('Tarea inválida');
$this->redirect(array('action' => 'index', 'pendiente'), null, true);
}
$this->Tarea->id = $id;
if (!$this->Tarea->exists()) {
throw new NotFoundException('Tarea inválido');
}
$this->set('tarea', $this->Tarea->findAllById($id));
}
开发者ID:Betlev,项目名称:proyectodaw2015,代码行数:12,代码来源:TareasController.php
示例11: initialize_page
function initialize_page()
{
$section_id = requestIdParam();
$section = Sections::FindById($section_id);
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Edit Section" || $post_action == "Edit and Return to List") {
if (isset($_POST['delete'])) {
$items = $section->findItems();
$selected_sections = array('1');
foreach ($items as $item) {
$item->updateSelectedSections($selected_sections);
}
$section->delete(true);
setFlash("<h3>Section deleted</h3>");
//$main_portlink = ( DISPLAY_ITEMS_AS_LIST ) ? "admin/portfolio_list/alphabetical" : "admin/portfolio_list";
//redirect( $main_portlink );
redirect("admin/portfolio_list");
} else {
if (ALLOW_SHORT_PAGE_NAMES) {
if ($_POST['name'] == "") {
$section->name = slug($_POST['display_name']);
} else {
$section->name = slug($_POST['name']);
}
} else {
$section->name = slug($_POST['display_name']);
}
$section->display_name = $_POST['display_name'];
$section->template = $_POST['template'];
$section->content = $_POST['section_content'];
$section->public = isset($_POST['public']) ? 1 : 0;
$selected_areas = array();
if (isset($_POST['selected_areas'])) {
$selected_areas = $_POST['selected_areas'];
} else {
$selected_areas = array('2');
}
$section->updateSelectedAreas($selected_areas);
$section->save();
setFlash("<h3>Section changes saved</h3>");
if ($post_action == "Edit and Return to List") {
//$main_portlink = ( DISPLAY_ITEMS_AS_LIST ) ? "admin/portfolio_list/alphabetical" : "admin/portfolio_list";
//redirect( $main_portlink );
redirect("admin/portfolio_list");
}
}
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:51,代码来源:portfolio_edit_section.php
示例12: initialize_page
function initialize_page()
{
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Delete Selected") {
foreach ($_POST['delete'] as $blast_id) {
$blast = MailBlast::FindById($blast_id);
$blast->delete();
}
setFlash("<h3>Mail Blasts Updated</h3>");
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:14,代码来源:view_old.php
示例13: initialize_page
function initialize_page()
{
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
if ($post_action == "Submit All Options and Preview") {
$blast_config = $_SESSION['blaster'];
if (!is_array($blast_config['lists'])) {
setFlash('<h3>You must Select a list to send to.</h3>');
redirect(BASEHREF . "admin/mail_blast");
}
}
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:14,代码来源:mail_blast.php
示例14: showForm
private static function showForm($action)
{
// Postando?
if (count($_POST) > 0) {
/* @var $inscricao Inscricao */
$inscricao = Inscricoes::getInstance()->getById(get_query_var('avaliacao') / 13);
/* @var $evento Evento */
$questionario = $inscricao->evento()->getQuestionarioAvaliacao();
$perguntas = $questionario->getPerguntas();
$jaRespondeu = $inscricao->hasAvaliacaoResposta(1);
$mensagem = null;
foreach ($perguntas as $pergunta) {
$resp = trim($_POST['input_' . $pergunta->id]);
// var_dump($resp);
if ($pergunta->obrigatoria && $resp == '') {
setFlashError("Por favor, responda as perguntas obrigatórias (marcadas com *)");
break;
}
if ($resp != '') {
$resposta = Respostas::getInstance()->createResposta($pergunta, $inscricao, $resp);
$mensagem .= $pergunta->titulo . ': ' . $resp . '<br>';
}
}
if (!hasFlashError()) {
setFlash("sucesso");
// Enviar email com respostas
// $mensagem="Respostas:<br><br>".$mensagem;
// $inscricao->evento()->organizador()->enviarEmail(
// $inscricao->evento()->organizador()->email,
// "Resposta - ".$questionario->titulo." - ".$inscricao->evento()->titulo." - ". $inscricao->pessoa()->nome,
// $mensagem
// );
// Creditar o gamification
if (TGO_EVENTO_GAMIFICATION === true && !$jaRespondeu) {
Gamification::getInstance()->broadcast('event_feedback', $inscricao->id_pessoa, $inscricao);
}
}
} else {
// Obter inscrição
$inscricao = Inscricoes::getInstance()->getById(get_query_var('avaliacao') / 13);
if ($inscricao == null) {
die("Inscrição não localizada");
}
// Validar inscrição
if ($inscricao->confirmado != '1') {
die("Inscrição não confirmada");
}
}
return 'avaliacao.php';
}
开发者ID:TiagoGouvea,项目名称:event-manager-plugin-wordpress,代码行数:50,代码来源:Questionarios.class.php
示例15: initialize_page
function initialize_page()
{
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Add Gallery") {
$gallery = MyActiveRecord::Create('Galleries');
$gallery->name = $_POST['name'];
$gallery->slug = slug($_POST['name']);
$gallery->save();
setFlash("<h3>Gallery Added</h3>");
redirect("/admin/edit_gallery/" . $gallery->id);
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:15,代码来源:add_gallery.php
示例16: initialize_page
function initialize_page()
{
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Add") {
$blog = MyActiveRecord::Create('Blogs');
$blog->name = $_POST['name'];
$blog->slug = slug($_POST['name']);
$blog->user_id = $_POST['user_id'];
$blog->save();
setFlash("<h3>Blog Added</h3>");
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:15,代码来源:add_blog.php
示例17: initialize_page
function initialize_page()
{
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Manage This Email") {
redirect("users/manage/" . $_POST["email"]);
}
if ($post_action == "Save Subscription Settings") {
$currentemail = $_POST["email"];
$oldemail = $_POST["oldemail"];
if ($currentemail != $oldemail) {
$thisemail = NLEmails::FindByEmail($oldemail);
} else {
$thisemail = NLEmails::FindByEmail($currentemail);
}
$lists = NLLists::FindAll();
// Remove all links first...
$query = "DELETE FROM nlemails_nllists WHERE nlemails_id = {$thisemail->id}";
mysql_query($query, MyActiveRecord::Connection());
if (isset($_POST['delete'])) {
$thisemail->delete(true);
redirect("/mail/subscribe/deleted");
}
// Then add the ones selected back in...
foreach ($lists as $list) {
if (array_key_exists($list->name, $_POST)) {
$list->attach($thisemail);
}
}
// Set the optional info fields and allow them to change the email they subscribed with...
$thisemail->email = $_POST["email"];
$thisemail->first_name = $_POST["first_name"];
$thisemail->last_name = $_POST["last_name"];
$thisemail->address1 = $_POST["address1"];
$thisemail->address2 = $_POST["address2"];
$thisemail->city = $_POST["city"];
$thisemail->state = $_POST["state"];
$thisemail->zip = $_POST["zip"];
$thisemail->phone = $_POST["phone"];
$thisemail->save();
setFlash("<h3>Subscription Settings Saved</h3>");
// If they changed their email, redirect them to that page
redirect("users/manage/" . $thisemail->email);
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:47,代码来源:user_subscriptions.php
示例18: initialize_page
function initialize_page()
{
LoginRequired("/admin/login/", array("admin"));
$accnt_id = requestIdParam();
$account = Paypal_Config::FindById($accnt_id);
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Save") {
$account->email = $_POST['email'];
$account->success_url = $_POST['success_url'];
$account->cancel_url = $_POST['cancel_url'];
$account->save();
setFlash("<h3>Paypal account changes saved</h3>");
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:17,代码来源:edit_paypal.php
示例19: initialize_page
function initialize_page()
{
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Add Alias" || $post_action == "Add and Return to List") {
$alias = MyActiveRecord::Create('Alias');
$alias->alias = $_POST['alias'];
$alias->path = $_POST['path'];
$alias->save();
setFlash("<h3>Alias created</h3>");
if ($post_action == "Add and Return to List") {
redirect("/admin/alias_list");
}
}
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:17,代码来源:alias_add.php
示例20: put_Edit
public function put_Edit($id)
{
$this->AuthorizeOrGoToAdmin("manage-slider");
$slide = $this->repository->find($id) ?? $this->Reload();
/* @var $slide Slide */
if ($this->hasFile()) {
$slide->uploadFile();
}
$slide->setName($_POST["name"]);
$slide->setAlignment($_POST["alignment"]);
if ($this->repository->save($slide)) {
setFlash('Slider saved!', 'success');
$this->Redirect('/admin/slider');
}
setFlash('There was an error!', 'error');
return $this->View("admin.slider_edit", compact('slide'));
}
开发者ID:ehamrin,项目名称:cmsPlugin,代码行数:17,代码来源:AdminController.php
注:本文中的setFlash函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论