示例#1
0
/**
 * This function set a meta for a user;
 * @param $user_id:int
 * @param $meta_key:string
 * @param $meta_value:string
 * @return bool|int
 */
function portal_add_user_meta($user_id, $meta_key, $meta_value)
{
    if ($user = get_user_with_id($user_id)) {
        $connection = MySQLConnection::get_connection();
        $query = "INSERT INTO wp_usermeta(user_id,meta_key,meta_value) VALUES(?,?,?)";
        if ($prepare = $connection->prepare($query)) {
            $prepare->bind_param("iss", $userId, $metaKey, $metaValue);
            $userId = $user_id;
            $metaKey = $meta_key;
            $metaValue = $meta_value;
            if ($prepare->execute()) {
                return true;
            }
            return false;
        }
        return -1;
    }
    // TODO replace below return with raising an exception
    return -2;
}
示例#2
0
}
// If viewer is not an user member;
$public_viewer = false;
// If viewer is an admin member;
$admin_viewer = false;
if (!$user) {
    $public_viewer = true;
} elseif (get_user_level($user->ID) == 10) {
    $admin_viewer = true;
}
//If profile id is not a valid id for a user, redirect to Not found page;
if ($user->ID !== $page_id && !($real_user = get_user_with_id($page_id))) {
    header("Location: " . NOT_FOUND_URL);
    exit;
}
$real_user = get_user_with_id($page_id);
if ($user->ID !== $page_id && !$real_user) {
    header("Location: " . NOT_FOUND_URL);
    exit;
} elseif ($user->ID == $page_id) {
    $real_user = $user;
}
// check first name
if (!($first_name = portal_get_user_meta($page_id, "first_name"))) {
    $first_name = "";
}
// check last name
if (!($last_name = portal_get_user_meta($page_id, "last_name"))) {
    $last_name = "";
}
if (!($phone_number = portal_get_user_meta($page_id, "phone_number"))) {
示例#3
0
<?php

defined("COMMONC") || define("COMMONC", true);
require_once "../common/users_common.php";
defined("USERGETTER") || define("USERGETTER", true);
require_once "../common/get_user.php";
defined("FAKE") || define("FAKE", true);
require_once "../common/fake_handler.php";
// TODO merge uploader with icon-upload file;
if (!($viewer = get_user_from_cookie())) {
    header("Location: " . NOT_FOUND_URL);
    exit;
}
if (!isset($_POST["user"]) || !($user = get_user_with_id(get_id($_POST["user"])))) {
    header("Location: " . NOT_FOUND_URL);
    exit;
}
if ($_SERVER["REQUEST_METHOD"] != "POST") {
    header("Location: " . NOT_FOUND_URL);
    exit;
}
if ($meta = portal_get_user_meta($user->ID, "ticket-upload")) {
    $meta_array = explode("|", $meta);
    $date_obj = date_create($meta_array[count($meta_array) - 2]);
    $date = date_format($date_obj, "Y/m/d H:i:s");
    if ($date < date("Y/m/d H:i:s", strtotime("-1 day"))) {
        $meta_array = array();
        portal_update_user_meta($user->ID, "ticket-upload", "");
    }
    // In one day each user can upload files less than 11 times;
    if ($meta_length = count($meta_array) >= 110) {
示例#4
0
defined("USERGETTER") || define("USERGETTER", true);
require_once "../common/get_user.php";
defined("COMMONC") || define("COMMONC", true);
require_once "../common/users_common.php";
defined("FAKE") || define("FAKE", true);
require_once "../common/fake_handler.php";
defined("FUNCTIONSOFUSERS") || define("FUNCTIONSOFUSERS", true);
require_once "user_funcs.php";
defined("DVALIDATIOR") || define("DVALIDATIOR", true);
require_once "../management/validator.php";
if ($_SERVER["REQUEST_METHOD"] !== "GET") {
    header("Location: " . NOT_FOUND_URL);
    exit;
}
if (isset($_GET["ipi"])) {
    $user = get_user_with_id($_GET["ipi"]);
} elseif (isset($_GET["user"])) {
    $user = get_user_with_username($_GET["user"]);
} elseif (!($user = get_user_from_cookie())) {
    header("Location: " . NOT_FOUND_URL);
    exit;
}
// If viewer is not an user member;
$public_viewer = false;
// If viewer is an admin member;
$admin_viewer = false;
// If viewer is owner
$owner = false;
if (!($viewer = get_user_from_cookie())) {
    $public_viewer = true;
} elseif ($viewer->ID == $user->ID) {
示例#5
0
<?php

defined("DVALIDATIOR") || define("DVALIDATIOR", true);
require_once "../common/data_validators.php";
defined("MYSQLCLASS") || define("MYSQLCLASS", true);
require_once "../__Classes/class.MySQL.php";
defined("COMMONC") || define("COMMONC", true);
require_once "../common/users_common.php";
defined("FAKE") || define("FAKE", true);
require_once "../common/fake_handler.php";
require_once "../management/validator.php";
defined("USERGETTER") || define("USERGETTER", true);
require_once "../common/get_user.php";
if (!($user = get_user_with_id(get_id($_POST["user"]))) && !($user = get_user_from_cookie())) {
    exit;
}
if (!($changer = get_user_from_cookie()) && (get_user_level($changer->ID) != 10 || $changer->ID != $user->ID)) {
    exit;
}
// TODO alert and deny inputs with bad chars;
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["requestType"])) {
    switch ($_POST["requestType"]) {
        case "userChangePro":
            if (!isset($_POST["user"])) {
                $user_id = $user->ID;
            } else {
                $user_id = get_id($_POST["user"]);
                var_dump($user_id);
            }
            if (isset($_POST["firstName"])) {
                $first_name = string_corrector($_POST["firstName"]);
示例#6
0
文件: order.php 项目: alihoseiny/Shek
defined("USERGETTER") || define("USERGETTER", true);
require_once "../common/get_user.php";
defined("PVALID") || define("PVALID", true);
require_once "../payment/validator.php";
defined("ORDERCLASS") || define("ORDERCLASS", true);
require_once "../__Classes/class.order.php";
defined("TICKETCLASS") || define("TICKETCLASS", true);
require_once "../__Classes/class.Ticket.php";
defined("DISFUNCS") || define("DISFUNCS", true);
require_once "../management/discounts_funcs.php";
if (!($user = get_user_from_cookie()) || $_SERVER["REQUEST_METHOD"] != "POST") {
    header("Location: " . NOT_FOUND_URL);
    exit;
} elseif ($request_type = $_POST['requestType']) {
    if ($request_type == "addOrder") {
        $owner = get_user_with_id(get_id($_POST['userName']));
        if (!$owner) {
            echo "-2";
            exit;
        }
        $creator_array = array("owner_id" => $owner->ID, "status" => 1, "price" => $_POST['price'], "installments" => $_POST['installs'], "discount" => $_POST['discount'], "expire_date" => $_POST['expire_date'], "title" => $_POST['title'], "description" => $_POST['description'], "conditions" => $_POST["steps"]);
        $order = new Order($creator_array);
        if ($create_result = $order->create() === true) {
            echo "1";
            exit;
        } elseif ($create_result === false) {
            echo "0";
            exit;
        }
        echo $create_result = $order->create();
        exit;