本文整理汇总了PHP中addMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP addMessage函数的具体用法?PHP addMessage怎么用?PHP addMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main()
{
if (hasPrivilege('customer')) {
// Check customer Loged in
$userId = $_SESSION[getSpKey()]['customer'];
$sql = "SELECT * FROM `customers` WHERE `id` = '{$userId}' ";
$result = dbQuery($sql);
while (($records = mysql_fetch_assoc($result)) !== false) {
$customerDetails = array('id' => $records['id'], 'customer_name' => $records['customer_name'], 'customer_family' => $records['customer_family'], 'customer_email' => $records['customer_email'], 'customer_gender' => $records['customer_gender'], 'customer_mobile' => $records['customer_mobile'], 'customer_city' => $records['customer_city'], 'customer_state' => $records['customer_state'], 'customer_zipcode' => $records['customer_zipcode'], 'customer_emergency_number' => $records['customer_emergency_number'], 'customer_address' => $records['customer_address']);
}
mysql_free_result($result);
// edit Customer Details
if (isset($_POST['btnEditSubmit'])) {
$txtDetails = array('customer_name' => isset($_POST['txtName']) ? $_POST['txtName'] : null, 'customer_family' => isset($_POST['txtFamily']) ? $_POST['txtFamily'] : null, 'customer_email' => isset($_POST['txtEmail']) ? $_POST['txtEmail'] : null, 'customer_mobile' => isset($_POST['txtMobile']) ? $_POST['txtMobile'] : null, 'customer_city' => isset($_POST['txtCity']) ? $_POST['txtCity'] : null, 'customer_state' => isset($_POST['txtState']) ? $_POST['txtState'] : null, 'customer_zipcode' => isset($_POST['txtZipCode']) ? $_POST['txtZipCode'] : null, 'customer_emergency_number' => isset($_POST['txtEmergencyNumber']) ? $_POST['txtEmergencyNumber'] : null, 'customer_address' => isset($_POST['txtAddress']) ? $_POST['txtAddress'] : null);
$dataIsCorrect = true;
foreach ($txtDetails as $pieceOfData) {
if (is_null($pieceOfData)) {
addMessage('اطلاعات محصول به درستی وارد نشده است', FAILURE);
$dataIsCorrect = false;
break;
}
}
}
} else {
$url = BASE_URL . 'signup';
return array('redirect' => $url);
}
$resp['data'] = array('customerDetails' => $customerDetails);
return $resp;
}
示例2: main
function main()
{
if (hasPrivilege('customer')) {
//@ToDo اگر سبد خالی بود به صفحه اصلی ارسال شود
$resp = array('data' => array(1));
$resp['data']['shopingCart'] = array();
$cartItems = array();
if (isset($_SESSION['cart']) && count($_SESSION['cart']) > 0) {
$productIds = array_keys($_SESSION['cart']);
$temp = implode(', ', $productIds);
$sql = "SELECT `id`, `product_name`,`product_picture_name`, `product_price` FROM `products` WHERE `id` IN ({$temp});";
$result = dbQuery($sql);
while (($row = mysql_fetch_assoc($result)) !== false) {
$resp['data']['cartItems'][] = array('id' => $row['id'], 'product_name' => $row['product_name'], 'product_price' => (int) $row['product_price'], 'product_picture_name' => $row['product_picture_name'], 'count' => $_SESSION['cart'][(int) $row['id']]);
}
mysql_free_result($result);
} else {
$url = BASE_URL;
return array('redirect' => $url);
}
return $resp;
} else {
addMessage('برای تسویه حساب وارد حساب کاربری خود شوید، چنانچه هنوز عضو نیستید ثبت نام کنید', NOTICE);
$url = BASE_URL . 'signup';
return array('redirect' => $url);
}
}
示例3: add
function add($church)
{
$this->setTitle("Észrevétel beküldése");
$this->church = $church;
$remark = new \Remark();
$remark->tid = $church->id;
$remark->text = \Request::TextRequired('leiras');
$remark->name = \Request::TextRequired('nev');
$remark->email = \Request::TextRequired('email');
if ($remark->email == '') {
unset($remark->email);
}
if (!$remark->save()) {
addMessage("Nem sikerült elmenteni az észrevételt. Sajánljuk.", "danger");
}
if (!$remark->emails()) {
addMessage("Nem sikerült elküldeni az értesítő emaileket.", "warning");
}
$content = "<h2>Köszönjük!</h2><strong>A megjegyzést elmentettük és igyekszünk mihamarabb feldolgozni!</strong></br></br>" . $remark->PreparedText4Email . "<br/><input type='button' value='Ablak bezárása' onclick='self.close()'>";
global $config;
if ($config['debug'] < 1) {
$content .= "<script language=Javascript>setTimeout(function(){self.close();},3000);</script>";
}
$this->content = $content;
$this->pageDescription = "Javítások, változások bejelentése a templom adataival, miserenddel, kapcsolódó információkkal (szentségimádás, rózsafűzér, hittan, stb.) kapcsolatban.";
$this->template = 'remark.twig';
}
示例4: main
function main()
{
$resp = array();
if (isset($_POST['submit'])) {
$productData = array('product_name' => isset($_POST['product_name']) ? $_POST['product_name'] : null, 'category_id' => isset($_POST['product_category']) ? (int) $_POST['product_category'] : null, 'product_is_saleable' => isset($_POST['product_is_saleable']) ? (int) $_POST['product_is_saleable'] : null, 'product_price' => isset($_POST['product_price']) ? (int) $_POST['product_price'] : null, 'product_stock' => isset($_POST['product_stock']) ? (int) $_POST['product_stock'] : null, 'product_brand' => isset($_POST['product_brand']) ? (int) $_POST['product_brand'] : null, 'product_gender' => isset($_POST['product_gender']) ? (int) $_POST['product_gender'] : null, 'product_color' => isset($_POST['product_color']) ? $_POST['product_color'] : null, 'product_cloth_type' => isset($_POST['product_cloth_type']) ? $_POST['product_cloth_type'] : null, 'product_made_in' => isset($_POST['product_made_in']) ? (int) $_POST['product_made_in'] : null, 'product_description' => isset($_POST['product_description']) ? $_POST['product_description'] : null);
//TODO implement dedicated validation checks for every piece of data rather than following simple test
$dataIsCorrect = true;
foreach ($productData as $pieceOfData) {
if (is_null($pieceOfData)) {
addMessage('اطلاعات محصول به درستی وارد نشده است', FAILURE);
$dataIsCorrect = false;
break;
}
}
// Handling product picture
$pictureHandlingResult = handleProductPictureUpload();
if (is_string($pictureHandlingResult)) {
$productData['product_picture_name'] = $pictureHandlingResult;
}
if ($dataIsCorrect && $pictureHandlingResult !== false && create('products', $productData)) {
addMessage(sprintf('"%s" با موفقیت ایجاد شد', htmlentities($productData['product_name'], ENT_QUOTES, 'UTF-8')), SUCSESS);
return array('redirect' => BASE_URL . 'admin/product/list.php');
} elseif ($dataIsCorrect) {
addMessage('خطا در ذخیره سازی محصول', FAILURE);
}
}
$tempCategories = listRecords('categories');
$categories = array();
foreach ($tempCategories as $category) {
$categories[$category['id']] = $category['category_name'];
}
//TODO consider a table or config file for country
$tempCountries = listRecords('countries');
$countries = array();
foreach ($tempCountries as $country) {
$countries[$country['id']] = $country['country_name'];
}
/*
* Load Brands
*/
$tempBrands = listRecords('brands');
$brands = array();
foreach ($tempBrands as $brand) {
$brands[$brand['id']] = $brand['brand_name'];
}
//TODO consider a table for OS
// $oses=array(
// 1=>'Windows',
// 2=>'Android',
// 3=>'IOS',
// 4=>'Linux'
// );
$resp['data'] = array('categories' => $categories, 'brands' => $brands, 'countries' => $countries, 'productData' => isset($productData) ? $productData : array());
return $resp;
}
示例5: __construct
public function __construct()
{
$this->setTitle("Módosítható templomok és miserendek");
$this->title = "Módosítható templomok és miserendek";
$this->template = "User/MaintainedChurches.twig";
global $user;
if (!is_array($user->responsible['church'])) {
addMessage("Nincs olyan templom, amit módosíthatnál.", 'info');
return false;
}
foreach ($user->responsible['church'] as $tid) {
try {
$this->churches[$tid] = new \Church($tid);
//TODO: objectify
$this->churches[$tid]->jelzes = getRemarkMark($tid);
} catch (\Exception $e) {
addMessage($e->getMessage(), "info");
}
}
$this->columns2 = true;
}
示例6: sendemail
function sendemail()
{
if (isset($_REQUEST['clear'])) {
$remark = new Remark($_REQUEST['rid']);
teendok($remark->tid);
}
$mail = new Mail();
$mail->to = $_REQUEST['email'];
$mail->content = nl2br($_REQUEST['text']);
$mail->type = "eszrevetel_" . $_REQUEST['type'];
if (!isset($_REQUEST['subject']) or $_REQUEST['subject'] == '') {
$_REQUEST['subject'] = "Miserend";
}
$mail->subject = $_REQUEST['subject'];
if (!$mail->send()) {
addMessage('Nem sikerült elküldeni az emailt. Bocsánat.', 'danger');
}
$remark = new Remark($_REQUEST['rid']);
$remark->addComment("email küldve: " . $mail->type);
teendok($remark->tid);
}
示例7: send
function send($to = false)
{
if ($to != false) {
$this->to = $to;
}
if ($this->debug == 1) {
$this->header .= 'Bcc: ' . $this->debugger . "\r\n";
} elseif ($this->debug == 2) {
$this->content .= ".<br/>\n<i>Originally to: " . print_r($this->to, 1) . "</i>";
$this->to = array($this->debugger);
}
if (isset($this->subject) and isset($this->content) and isset($this->to)) {
if (!is_array($this->to)) {
$this->to = array($this->to);
}
if ($this->debug == 3) {
print_r($this);
} else {
if ($this->debug == 5) {
// black hole
} else {
$query = "INSERT INTO emails (`type`,`to`,`header`,`subject`,`body`,`timestamp`) VALUES ('" . $this->type . "','" . implode(';', $this->to) . "','" . $this->header . "','" . $this->subject . "','" . mysql_real_escape_string($this->content) . "','" . date('Y-m-d H:i:s') . "');";
if (!mysql_query($query)) {
addMessage('Nem sikerült elmenteni az emailt.', 'warning');
}
if (!mail(implode(',', $this->to), $this->subject, $this->content, $this->header)) {
addMessage('Valami hiba történt az email elküldése közben.', 'danger');
} else {
return true;
}
}
}
} else {
addMessage('Nem tudtuk elküldeni az emailt. Kevés az adat.', 'danger');
}
}
示例8: addMessage
<?php
$transaction = $rpath[3];
if ($abe->isTransaction($transaction)) {
// Fetch
$tx = $abe->getTransaction($transaction);
$tx['confirmations'] = $abe->getNumBlocks() - $tx['height'];
// Prettify & Linkify
$viewdata['tx'] = Format::transaction($tx);
// Render
$pagedata['view'] = $m->render('blockchain/transaction', $viewdata);
} else {
addMessage("error", "The value you entered is either not a valid transaction hash or the transaction specified does not exist.");
}
示例9: miserend_deletetemplom
case 'deletetemplom':
$tartalom = miserend_deletetemplom();
break;
case 'delmise':
$tartalom = miserend_delmise();
break;
case 'deletemise':
$tartalom = miserend_deletemise();
break;
case 'events':
if (isset($_REQUEST['save'])) {
events_save($_REQUEST);
}
if (isset($_REQUEST['order']) and in_array($_REQUEST['order'], array('year, date', 'name'))) {
$order = $_REQUEST['order'];
}
$form = events_form($order);
$form['m_id'] = $m_id;
$form['template'] = 'admin_editevents';
$tartalom = $form;
break;
default:
$tartalom = miserend_modtemplom();
//$tartalom=miserend_index();
break;
}
} else {
$vars['title'] = 'Hiányzó jogosultság!';
addMessage('Hiányzó jogosultság!', 'danger');
$tartalom = $vars;
}
示例10: error_reporting
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
require_once '../../lib/config.php';
require_once 'DB/Adapter/Factory.php';
$dsn = parse_ini_file(dirname(__FILE__) . '/../../config/db-credentials.ini');
$DB = DB_Adapter_Factory::connect($dsn['postgresql']);
$DB->setIdentPrefix('db_adapter_example_');
prepareMessageTable($DB);
$messages = $DB->fetchAll("SELECT * FROM ?_guestbook_message ORDER BY created DESC");
if ($_POST) {
addMessage($DB, $_POST);
header('Location: ' . $_SERVER['REQUEST_URI']);
}
function prepareMessageTable($DB)
{
// $DB->query("DROP TABLE ?_guestbook_message");
@$DB->query("CREATE SEQUENCE example_guestbook_message_id_seq;");
@$DB->query("\n CREATE TABLE ?_guestbook_message (\n id int NOT NULL DEFAULT NEXTVAL('example_guestbook_message_id_seq'),\n author varchar(100) NOT NULL,\n text varchar(300) NOT NULL,\n created timestamp NOT NULL DEFAULT NOW()\n );\n ");
}
function addMessage($DB, $message)
{
if (!empty($message['text'])) {
$DB->query("INSERT INTO ?_guestbook_message (?#) VALUES (?a)", array_keys($message), array_values($message));
}
}
require_once '_template.php';
示例11: addNameChange
/**
* addNameChange()
*
* Add message to the main data file
*/
function addNameChange($from, $to)
{
global $A;
// Activity object
$A->changeName($from, $to);
if (LACE_SHOW_NAME_CHANGE) {
$message = array('action' => true, 'time' => time(), 'name' => 'Lace', 'text' => '<strong>' . $from . '</strong> is now <strong>' . $to . '</strong>');
addMessage($message);
}
}
示例12: microtime
<?php
$timeStart = microtime(true);
session_start();
ob_start();
if (empty($_SESSION)) {
exit(header("Location: ../../index.php"));
}
require_once $_SESSION['File_Root'] . '/Kernel/Include.php';
require_once $_SESSION['File_Root'] . '/HTML/Header.php';
require_once 'Functions/SQL.php';
redirectToLogin($accountID, $linkRoot);
redirectToBattle($verifyBattle, $linkRoot);
$Message = htmlspecialchars(addslashes($_POST['Message']));
addMessage($bdd, $characterID, $Message);
exit(header("Location: {$linkRoot}/Modules/Chat/index.php"));
require_once $_SESSION['File_Root'] . '/HTML/Footer.php';
示例13: addMessage
<?php
require_once Config::$path['model'] . 'Messagerie.class.php';
require_once Config::$path['model'] . 'writeMessage.php';
if (isset($_POST['creerMessage']) && isset($_POST['nom']) && isset($_POST['com'])) {
addMessage($_POST['nom'], $_POST['com']);
header('Location : index.php?page=messagerie');
}
$listeUsers = $Messagerie->recupAllUser();
require_once Config::$path['views'] . 'writeMessage.php';
示例14: switch
if (!isset($_POST['functionname'])) {
$aResult['error'] = 'No function name!';
}
if (!isset($_POST['arguments'])) {
$aResult['error'] = 'No function arguments!';
}
if (!isset($aResult['error'])) {
switch ($_POST['functionname']) {
case 'getMessage':
if (!is_array($_POST['arguments']) || count($_POST['arguments']) < 1) {
$aResult['error'] = 'Error in arguments!';
} else {
$aResult['result'] = getMessage(strval($_POST['arguments'][0]));
}
break;
case 'addMessage':
if (!is_array($_POST['arguments']) || count($_POST['arguments']) < 3) {
$aResult['error'] = 'Error in arguments!';
} else {
$aResult['result'] = addMessage(strval($_POST['arguments'][0]), $_POST['arguments'][1], $_POST['arguments'][2]);
}
break;
default:
$aResult['error'] = 'Not found function ' . $_POST['functionname'] . '!';
break;
}
}
echo json_encode($aResult);
?>
示例15: main
function main()
{
// اضافه کردن محصول به سبد با کتگوری و محصول
if (isset($_GET['p']) && isset($_GET['c'])) {
$productId = (int) $_GET['p'];
$categoryId = (int) $_GET['c'];
// بررسی وجود محصول
$sql = "SELECT * FROM `products` WHERE `id` = {$productId};";
$result = dbQuery($sql);
if (mysql_num_rows($result) !== 1) {
die('وجود ندارد');
}
$product = mysql_fetch_assoc($result);
mysql_free_result($result);
if (!isset($_SESSION['cart'])) {
$_SESSION['cart'] = array();
}
if (!isset($_SESSION['cart'][$productId])) {
$count = 1;
} else {
$count = $_SESSION['cart'][$productId] + 1;
}
/////
if ($count > (int) $product['product_stock']) {
// @TODo نمایش پیغام خطا
$_SESSION['cart'][$productId] = $count;
addMessage('تعداد درخواستی شما بیش از موجودی فروشگاه می باشد، از قسمت ارتباط با ما درخواست خود را ثبت نمایید.', FAILURE);
} else {
$_SESSION['cart'][$productId] = $count;
addMessage('محصول به درستی به سبد اضافه شد.', SUCSESS);
}
$url = categoryUrl($categoryId);
return array('redirect' => $url);
} elseif (isset($_GET['p'])) {
// اگر از صفحه محصول آمده باشد
//@ToDo المان کنترل تعداد اضافه به سبد کار نمیکند
$productId = $_GET['p'];
// بررسی وجود محصول
$sql = "SELECT * FROM `products` WHERE `id` = {$productId};";
$result = dbQuery($sql);
if (mysql_num_rows($result) !== 1) {
die('وجود ندارد');
}
$product = mysql_fetch_assoc($result);
mysql_free_result($result);
if (!isset($_SESSION['cart'])) {
$_SESSION['cart'] = array();
}
// بررسی موجود بودن در انبار
//@ToDo بازبینی شود
if ((int) $product['product_stock'] !== 0) {
// موجودی کافی در انبار هست به سبد خرید اضافه گردد
if (!isset($_SESSION['cart'][$productId])) {
$count = 1;
} else {
$count = $_SESSION['cart'][$productId] + 1;
}
if ($count > (int) $product['product_stock']) {
// @TODo نمایش پیغام خطا
$_SESSION['cart'][$productId] = $count;
addMessage('تعداد درخواستی شما بیش از موجودی فروشگاه می باشد، از قسمت ارتباط با ما درخواست خود را ثبت نمایید.', FAILURE);
} else {
$_SESSION['cart'][$productId] = $count;
// @ToDo ایجاد پیغام درست
$_SESSION['cart'][$productId] = $count;
addMessage('محصول به درستی به سبد اضافه شد.', SUCSESS);
}
} else {
addMessage('تعداد درخواستی شما بیش از موجودی فروشگاه می باشد، از قسمت ارتباط با ما درخواست خود را ثبت نمایید.', FAILURE);
}
$url = productUrl($productId);
return array('redirect' => $url);
}
}