示例#1
0
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
0
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
0
 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
0
function main()
{
    // Login Form
    if (isset($_POST['login'])) {
        // handle login
        $email = $_POST['email'];
        $password = sha1($_POST['password']);
        $sql = "SELECT * FROM `customers` WHERE `customer_email`='{$email}' AND `customer_password`='{$password}';";
        $result = dbQuery($sql);
        if (mysql_num_rows($result) != 1) {
            $url = BASE_URL . '/signup';
            //@todo create error message
            addMessage('نام کاربری یا رمز عبور اشتباه وارد شده است.', FAILURE);
        } else {
            $user = mysql_fetch_assoc($result);
            //@todo save user id in session
            //@todo create welcome message
            $url = BASE_URL . '/customer';
            $spKey = getSpKey();
            $_SESSION[$spKey]['customer'] = $user['id'];
            $userName = $user['customer_name'];
            addMessage($userName . ' عزیز خوش آمدید.', SUCSESS);
        }
        mysql_free_result($result);
        return array('redirect' => $url);
    }
    // SignUp Form
    if (isset($_POST['signup'])) {
        $firstName = safeQuery($_POST['firstName']);
        $lastName = safeQuery($_POST['lastName']);
        $mobile = safeQuery($_POST['mobile']);
        $email = safeQuery($_POST['email']);
        $password = sha1($_POST['password']);
        $gender = $_POST['gender'];
        if (isPhone($mobile) && isEmail($email) && !empty(trim($firstName)) && !empty(trim($lastName)) && !empty(trim($mobile)) && !empty(trim($email)) && !empty(trim($password))) {
            $sql = "SELECT * FROM `customers` WHERE  `customer_email`='{$email}'";
            $result = dbQuery($sql);
            if (mysql_num_rows($result) == 0) {
                $sql = "INSERT INTO `customers`(`customer_name`,`customer_family`,`customer_email`,`customer_password`,`customer_gender`,`customer_mobile`)\n                                        VALUES('{$firstName}','{$lastName}','{$email}','{$password}','{$gender}','{$mobile}')";
                $result = dbQuery($sql);
                addMessage('ثبت نام شما با موفقیت انجام شد. با آدرس ایمیل و رمز عور انتخابی وارد شوید', SUCSESS);
                $url = BASE_URL . '/customer';
            } else {
                $url = BASE_URL . '/signup';
                //@todo create error message
                addMessage('آدرس ایمیل واد شده تکراری میباشد، برای بازیابی رمز عبور کلیک کنید.', FAILURE);
            }
            mysql_free_result($result);
        } else {
            $url = BASE_URL . '/signup';
            //@todo create error message
            addMessage('اطلاعات فرم ثبت نام به درستی وارد نشده است.', FAILURE);
        }
        return array('redirect' => $url);
    }
}
示例#5
0
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;
}
 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;
 }
示例#7
0
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);
}
示例#8
0
 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');
     }
 }
示例#9
0
<?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.");
}
        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;
}
示例#11
0
<?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';
示例#12
0
/**
 * 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);
    }
}
示例#13
0
<?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';
示例#14
0
<?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';
<?php
if(issetSessionVariable('user_level')){
	if(getSessionVariable('user_level') >= RES_USERLEVEL_ADMIN){
	
		
	
	}
	else{
		echo "Error: You don't have permissions to access this page!";
		die("");
		
	}
	
}
else{
	echo "Error: You don't have permissions to access this page!";
	die("");
}
if($pageid == "messages"){
	$messages = getAllMessages();
	
	$select = "<select name=\"messageid\">";
	
	while($row = mysql_fetch_assoc($messages)){
	
		$select = $select . "<option value=\"".$row['message_id']."\">".$row['start_date']." to ".$row['end_date']." - Priority ".$row['priority']."</option>";
	
	}
	
	$select = $select . "</select>";
示例#16
0
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);
?>

示例#17
0
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);
    }
}
示例#18
0
文件: fun.inc.php 项目: Vagor/seu
function addScore($uid, $semester, $type_name, $class_chinese_name, $score)
{
    //$type = getClassTypeByTypeName($type_name);
    $type = $type_name;
    $table = getTableName($semester, $type);
    $class_type = getClassEnglishName($class_chinese_name);
    //需先判断是否存在该uid记录
    $sql = "SELECT id FROM {$table} WHERE uid = {$uid}";
    $res = mysql_query($sql);
    if (@mysql_fetch_assoc($res)["id"]) {
        $sql = "UPDATE {$table} SET {$class_type} = {$score} WHERE uid = {$uid}";
    } else {
        $sql = "INSERT INTO {$table}(uid,{$class_type}) VALUES({$uid},{$score})";
    }
    if (mysql_query($sql)) {
        addMessage($uid, 1, 1);
        addAverage($uid, $semester, $type_name);
        group($uid, $semester);
        return 1;
    } else {
        return 0;
    }
}
示例#19
0
<?php

if (!$user or privileges($mysql_link, !$user['role_id'], array('ADD_MESS'))) {
    $_SESSION['msg']['message'] = setMessage('Ошибка доступа, у вас нет прав для посещения данный страницы. Пожалуйста, <a href="/?action=login">войдите под своей учётной записью</a> или <a href="/?action=registration">загеристрируйтесь</a>', 'error');
    $content = '';
} else {
    if ($_SERVER['REQUEST_METHOD'] == 'POST' and isset($_POST['add_message'])) {
        $message = addMessage($mysql_link, $_POST, $user);
        if ($message === TRUE) {
            $_SESSION['msg']['message'] = setMessage('Ваше объявление успешно добавлено, оно появится после модерации', 'success');
            header('Location: ' . $_SERVER['PHP_SELF']);
            exit;
        } else {
            $_SESSION['msg']['message'] = $message;
            header('Location: ' . $_SERVER['REQUEST_URI']);
            exit;
        }
    }
    $content = template('add_message.tpl.php', array('categories' => $categories, 'types' => $types));
}
示例#20
0
function addInfo($date, $text)
{
    addMessage('info', $date, $text);
}
示例#21
0
 } else {
     if ($ac == 'detail') {
         $qid = intval($_GET['id']);
         $qestion = getOneQuestion($qid);
         include 'tpl/detail.php';
     } else {
         if ($ac == 'doAnswer') {
             $qid = intval($_POST['qid']);
             $answer = trim($_POST['answer']);
             $qestion = addAnswer($qid, $answer);
             header("location:index.php?ac=detail&id=" . $qid);
         } else {
             if ($ac == 'doMessage') {
                 $messageAuthor = intval($_POST['messageAuthor']);
                 $content = trim($_POST['content']);
                 $message = addMessage($messageAuthor, $content);
                 header("location:index.php?ac=userinfo");
             } else {
                 if ($ac == 'search') {
                     $type = !empty($_GET['type']) ? intval($_GET['key']) : 1;
                     if ($type == 1) {
                         $key = !empty($_GET['key']) ? trim($_GET['key']) : null;
                         $memberid = !empty($_GET['memberid']) ? intval($_GET['memberid']) : null;
                         $title = $memberid ? '我的问题' : '';
                         $questions = getQuestionList($memberid, $key);
                         include 'tpl/main.php';
                     } else {
                         $key = !empty($_GET['key']) ? trim($_GET['key']) : null;
                         $users = getUserList($key);
                         include 'tpl/userlist.php';
                     }
 function onMessage($mynumber, $from, $id, $type, $time, $name, $body)
 {
     echo $from;
     echo $id;
     echo $type;
     addMessage($from, GenieConstants::$GENIE, $body);
     PubSub::publish('message_received', $mynumber, $from, $id, $type, $time, $name, $body);
 }
示例#23
0
require __DIR__ . '/../vendor/autoload.php';
require '../config.php';
require_once '../helpers/session.php';
require '../helpers/boot.php';
require '../helpers/functions.php';
require_once '../helpers/User.php';
require_once '../helpers/OnlineUser.php';
require_once '../helpers/Chat.php';
$data = file_get_contents("php://input");
$data = json_decode($data, TRUE);
$out = [];
if (isset($data['post'])) {
    $type = $data['post'];
    switch ($type) {
        case 'addMessage':
            $out = addMessage($data);
            break;
            break;
        case 'online_users':
            $out = online_users(session::USER_REGULAR);
            break;
        default:
            setStatus($out, 'fail', 'invalid type.');
            break;
    }
} else {
    //get request
    if (isset($_GET['query'])) {
        $type = $_GET['query'];
        switch ($type) {
            case 'online':
示例#24
0
							addMessage('Your message has been saved');
							redirect(PAGE_COMMUNICATION);
							
						} else {
							if($_POST['send'] == 'now'){
								//sendNewsletter($queueID);	
								$field['email_queue_release_date'] = time();//set the time to now! other wise, if it's set to go on specific date we add the time as 1:00am on that day!
							}
							dbPerform('email_queue', $field, 'insert');
							$queueID = dbInsertID();
							
							if($_POST['email_display_home']) {
								$rows['email_queue_id'] = $queueID;
								dbPerform('newsletters', $rows, 'insert');
							}
							addMessage('Your message has been added to the queue, you can view the queue at anytime by clicking on the Queue tab');
							redirect(PAGE_COMMUNICATION);
						}
						
						
						
	break;
	}
}
if(!$_GET['section']) {
	if(user_has_permission(18)){
		$default = 'templates';	
	}
	if(user_has_permission(17)){
		$default = 'compose_email';	
	}
示例#25
0
<?php

require 'sqlhelper.php';
$con = $_POST['con'];
//file_put_contents("C:/Users/bij0520/Documents/chatlog.log",$con."/r/n",FILE_APPEND);
function addMessage($con)
{
    if (isset($_SESSION['email'])) {
        $sql = "insert into chat (sender,getter, content,sendTime) values('Admin','Guest','{$con}',now())";
        file_put_contents("C:/Users/bij0520/Documents/chatlog.log", $_SESSION['email'] . "/r/n", FILE_APPEND);
    } else {
        $sql = "insert into chat (sender,getter, content,sendTime) values('Guest','Admin','{$con}',now())";
        file_put_contents("C:/Users/bij0520/Documents/chatlog.log", $sql . "/r/n", FILE_APPEND);
    }
    $sqlhelper = new SQLHelper();
    $sqlhelper->execute_dml($sql);
    $sqlhelper->close_connect();
}
if (addMessage($con) == 1) {
    echo "success";
} else {
    echo "error";
}
示例#26
0
                     echo $hideLogJs;
                 } catch (Exception $e) {
                     echo $hideLogJs;
                     throw $e;
                 }
                 if (!empty($_POST['doTest'])) {
                     $DB->rollBack();
                 } else {
                     $DB->commit();
                     $_POST['item']['id'] = $id;
                 }
             }
         }
     } catch (Exception $e) {
         $DB->rollBack();
         addMessage($e->getMessage());
     }
 } else {
     $_POST['item'] = array();
     if ($id) {
         $_POST['item'] = fetchItem($id);
     } else {
         if (@$_GET['clone']) {
             $_POST['item'] = fetchItem($_GET['clone']);
             unset($_POST['item']['id']);
             // very important!
         } else {
             $_POST['item']['sql'] = "SELECT COUNT(*)\nFROM some_table\nWHERE created BETWEEN \$FROM AND \$TO\n";
         }
     }
 }
示例#27
0
文件: store.php 项目: sherdog/cvsi
	$row['semen_shipping_price_2'] = $_POST['semen_shipping_price_2'];
	$row['semen_shipping_desc'] = $_POST['semen_shipping_desc'];
	$row['semen_shipping_image'] =  $_POST['semen_shipping_image'];
	
	
	if($_FILES['semen_shipping_image']['name'] != '') {//upload image yo!
		$filename = time().fixFilename($_FILES['semen_shipping_image']['name']);
		uploadFile($_FILES['semen_shipping_image'], $filename);
		makeThumbnail($filename, UPLOAD_DIR, 480, '', 'medium');
		
		$row['semen_shipping_image'] = $filename;
	}
	
	dbPerform('store_shipping', $row, 'update', 'shipping_id = 1');
	
	addMessage("Updated shipping information successfully");
	redirect(PAGE_STORE."?section=shipping&action=editshipping");
	
	
	
}

switch($_GET['section']){ 
case 'manage':
$trail->add("Categories");
break;
case 'orders':
default:
$trail->add("Orders");
	if(isset($_GET['id'])) {
	$oresults =dbQuery('SELECT orders_time FROM store_orders WHERE orders_id = ' . $_GET['id']);
示例#28
0
function declineInvitationExe()
{
    if (!is_numeric($_SESSION['userId'])) {
        print "Wrong way";
        exit;
    }
    if (!isset($_REQUEST['invitationId'])) {
        print "Wrong Invitation";
        exit;
    }
    $d = new Delegate();
    $loggedUser = $d->userGetById($_SESSION['userId']);
    $invitation = $d->invitationGetById($_REQUEST['invitationId']);
    if ($invitation->email == $loggedUser->email) {
        //a match made in stars...how lovely :)
        $d->invitationDelete($invitation->id);
        addMessage("Invitation declined.");
    }
    redirect('../myDiagrams.php');
}
示例#29
0
<?php

include_once "conn.php";
include_once "messageDB.php";
$action = $_REQUEST["action"];
$action = strtolower($action);
$res;
switch ($action) {
    case "get":
        $res = get($_REQUEST);
        break;
    case "addmessage":
    case "add":
        $res = addMessage($_REQUEST);
        break;
    case "delete":
    case "deletemessage":
        $res = deleteMessage($_REQUEST['id']);
        break;
    case "edit":
    case "editmessage":
        $res = editMessage($_REQUEST);
    case "read":
        $res = read($_REQUEST['id']);
        break;
    default:
        throw new Exception("unknown action:" . $action);
}
echo json_encode($res);
示例#30
0
/**
 * Print Review Changes Block
 *
 * Prints a block allowing the user review all changes pending approval
 */
function review_changes_block($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $ctype, $QUERY_STRING, $factarray, $PGV_IMAGE_DIR, $PGV_IMAGES;
    global $pgv_changes, $TEXT_DIRECTION, $SHOW_SOURCES, $PGV_BLOCKS;
    global $PHPGEDVIEW_EMAIL;
    if (empty($config)) {
        $config = $PGV_BLOCKS["review_changes_block"]["config"];
    }
    if ($pgv_changes) {
        //-- if the time difference from the last email is greater than 24 hours then send out another email
        $LAST_CHANGE_EMAIL = get_site_setting('LAST_CHANGE_EMAIL');
        if (time() - $LAST_CHANGE_EMAIL > 60 * 60 * 24 * $config["days"]) {
            $LAST_CHANGE_EMAIL = time();
            set_site_setting('LAST_CHANGE_EMAIL', $LAST_CHANGE_EMAIL);
            write_changes();
            if ($config["sendmail"] == "yes") {
                // Which users have pending changes?
                $users_with_changes = array();
                foreach (get_all_users() as $user_id => $user_name) {
                    foreach (get_all_gedcoms() as $ged_id => $ged_name) {
                        if (exists_pending_change($user_id, $ged_id)) {
                            $users_with_changes[$user_id] = $user_name;
                            break;
                        }
                    }
                }
                foreach ($users_with_changes as $user_id => $user_name) {
                    //-- send message
                    $message = array();
                    $message["to"] = $user_name;
                    $message["from"] = $PHPGEDVIEW_EMAIL;
                    $message["subject"] = $pgv_lang["review_changes_subject"];
                    $message["body"] = $pgv_lang["review_changes_body"];
                    $message["method"] = get_user_setting($user_id, 'contactmethod');
                    $message["url"] = PGV_SCRIPT_NAME . "?" . html_entity_decode($QUERY_STRING);
                    $message["no_from"] = true;
                    addMessage($message);
                }
            }
        }
        if (PGV_USER_CAN_EDIT) {
            $id = "review_changes_block";
            $title = print_help_link("review_changes_help", "qm", "", false, true);
            if ($PGV_BLOCKS["review_changes_block"]["canconfig"]) {
                if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) {
                    if ($ctype == "gedcom") {
                        $name = PGV_GEDCOM;
                    } else {
                        $name = PGV_USER_NAME;
                    }
                    $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
                    $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES["admin"]["small"] . "\" width=\"15\" height=\"15\" border=\"0\" alt=\"" . $pgv_lang["config_block"] . "\" /></a>";
                }
            }
            $title .= $pgv_lang["review_changes"];
            $content = "";
            if (PGV_USER_CAN_ACCEPT) {
                $content .= "<a href=\"javascript:;\" onclick=\"window.open('edit_changes.php','_blank','width=600,height=500,resizable=1,scrollbars=1'); return false;\">" . $pgv_lang["accept_changes"] . "</a><br />";
            }
            if ($config["sendmail"] == "yes") {
                $content .= $pgv_lang["last_email_sent"] . format_timestamp($LAST_CHANGE_EMAIL) . "<br />";
                $content .= $pgv_lang["next_email_sent"] . format_timestamp($LAST_CHANGE_EMAIL + 60 * 60 * 24 * $config["days"]) . "<br /><br />";
            }
            foreach ($pgv_changes as $cid => $changes) {
                $change = $changes[count($changes) - 1];
                if ($change["gedcom"] == PGV_GEDCOM) {
                    $record = GedcomRecord::getInstance($change['gid']);
                    if ($record->getType() != 'SOUR' || $SHOW_SOURCES >= PGV_USER_ACCESS_LEVEL) {
                        $content .= '<b>' . PrintReady($record->getFullName()) . '</b> ' . getLRM() . '(' . $record->getXref() . ')' . getLRM();
                        switch ($record->getType()) {
                            case 'INDI':
                            case 'FAM':
                            case 'SOUR':
                            case 'OBJE':
                                $content .= $block ? '<br />' : ' ';
                                $content .= '<a href="' . encode_url($record->getLinkUrl() . '&show_changes=yes') . '">' . $pgv_lang['view_change_diff'] . '</a>';
                                break;
                        }
                        $content .= '<br />';
                    }
                }
            }
            global $THEME_DIR;
            if ($block) {
                require $THEME_DIR . 'templates/block_small_temp.php';
            } else {
                require $THEME_DIR . 'templates/block_main_temp.php';
            }
        }
    }
}