Ejemplo n.º 1
0
function notify_init(&$a)
{
    if (!local_user()) {
        return;
    }
    if ($a->argc > 2 && $a->argv[1] === 'view' && intval($a->argv[2])) {
        $r = q("select * from notify where id = %d and uid = %d limit 1", intval($a->argv[2]), intval(local_user()));
        if (count($r)) {
            q("update notify set seen = 1 where ( link = '%s' or ( parent != 0 and parent = %d and otype = '%s' )) and uid = %d", dbesc($r[0]['link']), intval($r[0]['parent']), dbesc($r[0]['otype']), intval(local_user()));
            // The friendica client has problems with the GUID. this is some workaround
            if ($a->is_friendica_app()) {
                require_once "include/items.php";
                $urldata = parse_url($r[0]['link']);
                $guid = basename($urldata["path"]);
                $itemdata = get_item_id($guid, local_user());
                if ($itemdata["id"] != 0) {
                    $r[0]['link'] = $a->get_baseurl() . '/display/' . $itemdata["nick"] . '/' . $itemdata["id"];
                }
            }
            goaway($r[0]['link']);
        }
        goaway($a->get_baseurl(true));
    }
    if ($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all') {
        $r = q("update notify set seen = 1 where uid = %d", intval(local_user()));
        $j = json_encode(array('result' => $r ? 'success' : 'fail'));
        echo $j;
        killme();
    }
}
function item_html_won($results)
{
    ob_start();
    foreach ($results as $row) {
        $item = get_item_id($row['item_id']);
        ?>
<div class="item-thumbnail">
   <?php 
        if ($item['image']) {
            ?>
  <img src="img/image_view.php?item_id=<?php 
            echo $row['item_id'];
            ?>
" class="thumbnail">
    <?php 
        } else {
            ?>
  <img src="img/placeholder.png" class="thumbnail">
    <?php 
        }
        ?>
  <span>
    <a href="auction.php?auction_id=<?php 
        echo $row['id'];
        ?>
"> <?php 
        echo $item['name'];
        ?>
 </a>
    <br>
    <?php 
        if (!get_feedback($row["id"])) {
            ?>
    <a href="feedback.php?auction_id=<?php 
            echo $row['id'];
            ?>
">Write Feedback</a>
    <?php 
        }
        ?>
  </span>
</div>
<?php 
    }
    $ret_val = ob_get_contents();
    ob_end_clean();
    return $ret_val;
}
Ejemplo n.º 3
0
 public function save_corpus_ngrams()
 {
     $corpus_ngrams = [];
     foreach ($corpus_items as $key => $corpus_item) {
         $item_one_grams = get_item_one_grams($corpus_item);
         foreach ($item_one_grams as $one_gram) {
             if (!isset($corpus_ngrams[$one_gram])) {
                 $corpus_ngrams[$one_gram] = [];
             }
             if (!isset($corpus_ngrams[$one_gram][$sequence_member])) {
                 $corpus_ngrams[$one_gram][$sequence_member] = [];
             }
             // This is an array containing item IDs for every instance of the ngram.
             // Note that an item may have more than one instance of the same ngram.
             $corpus_ngrams[$one_gram][$sequence_member][] = get_item_id($corpus_item);
         }
     }
 }
Ejemplo n.º 4
0
function update($update_parameters)
{
    $vendor_id = substr($update_parameters, 0, 6);
    $update_parameters = substr($update_parameters, 7);
    $message = substr($update_parameters, strpos($update_parameters, "-") + 2);
    $update_parameters = substr($update_parameters, 0, strpos($update_parameters, "-") - 1);
    $has = substr($update_parameters, strrpos($update_parameters, " ") + 1);
    $item_name = substr($update_parameters, 0, strrpos($update_parameters, " "));
    $item_id = get_item_id($item_name);
    if ($has == "no") {
        $has = FALSE;
    } else {
        $has = TRUE;
    }
    $values = ["has" => $has, "message" => $message];
    $response = make_put_call("vendor_ID/" . $vendor_id . "/items/" . $item_id, $values);
    $outgoing = "Successfully updated stock of " . $item_name . ".";
    // send notification
    /*if($has == TRUE) {
    			$notify = send_notifications($vendor_id, $item_id);
    			delay(1000);
    		}*/
    return $outgoing;
}
Ejemplo n.º 5
0
 function get_ids()
 {
     # order matters!!!!
     if (is_null($this->alliance_id)) {
         $this->alliance_id = get_alliance_id($this->alliance);
     }
     if (is_null($this->corp_id)) {
         $this->corp_id = get_corp_id($this->corp, $this->alliance_id);
     }
     if (is_null($this->pilot_id)) {
         $this->pilot_id = get_pilot_id($this->pilot, $this->corp_id);
     }
     if (is_null($this->char_id)) {
         $this->char_id = get_pilot_charid($this->pilot_id);
     }
     if (is_null($this->ship_id)) {
         $this->ship_id = get_item_id($this->ship);
     }
     if (is_null($this->group_id)) {
         $this->group_id = get_item_group_id($this->ship_id);
     }
     if (is_null($this->weapon_id)) {
         $this->weapon_id = get_item_id($this->weapon);
     }
 }
Ejemplo n.º 6
0
function send_update_on_bought($auction)
{
    $item_id = $auction["item_id"];
    $item = get_item_id($item_id);
    $subject = "Receipt for your new item";
    $message = "<b>You have recently bought an item</b><br>";
    $message .= "<h1>" . $item["name"] . "</h1><br>";
    $highest = get_highest_bid($auction["id"]);
    $seller = find_email($highest["user_id"]);
    $to = $seller["email"];
    $message .= "<b>Item:" . $item["name"] . "</b><br>";
    $message .= "<b>Seller :" . $auction["seller_id"] . "</b><br>";
    $message .= "<b>Price :£" . $highest["price"] . "</b><br>";
    echo $message;
    $header = "From:no-reply-auctions@gmail.com \r\n";
    $header .= "MIME-Version: 1.0\r\n";
    $header .= "Content-type: text/html\r\n";
    $retval = mail($to, $subject, $message, $header);
    if ($retval == true) {
        echo "Message sent successfully...";
    } else {
        echo "Message could not be sent...";
    }
}
Ejemplo n.º 7
0
<?php

require_once "../../resources/modules/items.php";
$item = get_item_id($_REQUEST["item_id"]);
if (!$item) {
    header("location: index.php");
}
header('Content-type: ' . $item['image_type']);
echo $item['image'];
?>

Ejemplo n.º 8
0
if (!isset($_GET['auction_id'])) {
    header("location:index.php");
    die;
}
require_once "../resources/modules/auctions.php";
require_once "../resources/modules/items.php";
require_once "../resources/modules/bids.php";
require_once "../resources/modules/users.php";
$auction = get_auctions_id($_GET['auction_id']);
if (!$auction) {
    header("location:index.php");
    die;
}
update_auction_views($auction['id']);
$highest_bid = get_highest_bid($auction['id']);
$item = get_item_id($auction['item_id']);
$seller = find_user_id($auction['seller_id']);
$seller_rating = "No Seller Rating";
if ($seller['seller_rating']) {
    $seller_rating = $seller['seller_rating'];
}
$lowest_price = $auction['start_price'];
$highest_bid_username = "******";
$highest_bid_price = "No Bids Yet";
if ($highest_bid) {
    $lowest_price = $highest_bid['price'];
    $highest_bid_username = find_user_id($highest_bid['user_id'])["name"];
    $highest_bid_price = $lowest_price;
}
$lowest_price = $lowest_price + 1;
if (isset($_POST['watchlist'])) {