Exemple #1
0
 function autoMail()
 {
     global $database;
     //$itemsArr = array();
     $today = date("Y-m-d");
     $this->query = "select * from  items where BidEndOn ='{$today}' AND highest_bid!=0";
     $result = mysql_query($this->query);
     while ($row = mysql_fetch_array($result)) {
         $item = new Item();
         $item->setItemId($row["ItemID"]);
         $item->setTitle($row["Title"]);
         $item->setMinPrice($row["min_price"]);
         $item->setCategory($row["Category"]);
         $item->setOwnerId($row["OwnerID"]);
         $ad = date("Y-m-d H:i:s", strtotime($row['addedOn']));
         $item->setHighestBid($row["highest_bid"]);
         $item->setAddedOn($ad);
         $item->setBiddingEndOn($row["BidEndOn"]);
         $item->setDesc($row["Description"]);
         $item->setStatus($row["Status"]);
         $this->query = "SELECT PicDate,PicPath FROM itempics WHERE OwnId = " . $item->ownerId . " AND PicDate = '" . $ad . "'";
         $res = mysql_query($this->query);
         $r = mysql_fetch_array($res);
         $item->setPicPath($r['PicPath']);
         $this->query = "select email from user where UserID={$item->ownerId}";
         $res = mysql_query($this->query);
         $r = mysql_fetch_row($res);
         $OwnerEmail = $r[0];
         $this->query = "select bids.BidderID from items INNER JOIN bids ON items.highest_bid=bids.amount where items.ItemID ={$item->itemId}";
         $res = mysql_query($this->query);
         $r = mysql_fetch_row($res);
         $bidderId = $r[0];
         $this->query = "select email from user where UserID={$bidderId}";
         $res = mysql_query($this->query);
         $r = mysql_fetch_row($res);
         $WinnerEmail = $r[0];
         echo "\nOwner email:" . $OwnerEmail . "\n";
         echo "\nWinner email:" . $WinnerEmail . "\n";
         $this->query = "update account set balance=balance+{$item->highestBid} where UserID={$item->ownerId}";
         mysql_query($this->query);
         $this->query = "delete from bids where ItemID={$item->itemId}";
         mysql_query($this->query);
         $this->query = "update items set OwnerId ={$bidderId}, status='sold' where ItemID={$item->itemId}";
         mysql_query($this->query);
         $this->query = "insert into WonItems (winnerId,ownerId) values ({$bidderId}, {$item->ownerId} )";
         mailForOwner($OwnerEmail, $item);
         mailForWinner($WinnerEmail, $item);
     }
 }
Exemple #2
0
 private static function arrayToMenuItem($pages, $depth, $curDepth, $order)
 {
     $items = array();
     foreach ($pages as $pageRow) {
         $page = new \Ip\Page($pageRow['id']);
         $item = new Item();
         $subSelected = false;
         if ($curDepth < $depth) {
             $children = ipDb()->selectAll('page', '*', array('parentId' => $page->getId(), 'isVisible' => 1, 'isSecured' => 0, 'isDeleted' => 0), "ORDER BY {$order}");
             if ($children) {
                 $childrenItems = self::arrayToMenuItem($children, $depth, $curDepth + 1, $order);
                 $item->setChildren($childrenItems);
             }
         }
         if ($page->isCurrent() || $page->getRedirectUrl() && $page->getLink() == \Ip\Internal\UrlHelper::getCurrentUrl()) {
             $item->markAsCurrent(true);
         } elseif ($page->isInCurrentBreadcrumb() || $subSelected || $page->getRedirectUrl() && self::existInBreadcrumb($page->getLink())) {
             $item->markAsInCurrentBreadcrumb(true);
         }
         if ($page->isDisabled()) {
             $item->setUrl('');
         } elseif ($page->getRedirectUrl()) {
             $url = $page->getRedirectUrl();
             if (!preg_match('/^((http|https):\\/\\/)/i', $url)) {
                 $url = 'http://' . $url;
             }
             $item->setUrl($url);
         } else {
             $item->setUrl($page->getLink());
         }
         $metaTitle = $page->getMetaTitle();
         $item->setBlank($page->isBlank());
         $item->setTitle($page->getTitle());
         $item->setDepth($curDepth);
         $item->setDisabled($page->isDisabled());
         $item->setId($page->getId());
         $item->setAlias($page->getAlias());
         $item->setPageTitle(empty($metaTitle) ? $page->getTitle() : $metaTitle);
         $items[] = $item;
     }
     return $items;
 }
Exemple #3
0
 function getItem($id)
 {
     global $database;
     $item = new Item();
     $this->query = "select * from items where ItemID='{$id}'";
     $result = mysql_query($this->query);
     if (mysql_num_rows($result) > 0) {
         $row = mysql_fetch_row($result);
         $item->setItemId($row[0]);
         $item->setTitle($row[1]);
         $item->setMinPrice($row[2]);
         $item->setHighestBid($row[3]);
         $item->setCategory($row[4]);
         $item->setOwnerId($row[5]);
         $item->setAddedOn($row[6]);
         $item->setBiddingEndOn($row[7]);
         $item->setDesc($row[8]);
         $item->setStatus($row[9]);
     }
     return $item;
 }
function scrapeHtml()
{
    $url = "http://nivent.nicovideo.jp/";
    $items = array();
    $html = file_get_html($url);
    foreach ($html->find('div[id=list] div[class=box clearfix]') as $key => $html_item) {
        //データの元
        //var_dump($html_item);
        $title = $html_item->find('div[class=infoUpper] strong a');
        $link = $html_item->find('div[class=infoUpper] strong a');
        $description = $html_item->find('div[class=infoLower] p[class=body]');
        $thumbnail = $html->find('div[class=thumb] img');
        //var_dump($link);
        //アイテムを格納
        $item = new Item();
        $item->setTitle($title[0]->innertext);
        $item->setLink("http://nivent.nicovideo.jp" . $link[0]->href);
        $item->setDescription(createImgTag($thumbnail[$key]->src) . $description[0]->innertext);
        $items[] = $item;
    }
    return $items;
}
Exemple #5
0
    function autoMail()
    {
        global $database;
        //$itemsArr = array();
        $today = date("Y-m-d");
        $this->query = "select * from  items where BidEndOn ='{$today}' AND highest_bid!=0 AND status != 'sold'";
        $result = mysql_query($this->query);
        while ($row = mysql_fetch_array($result)) {
            $item = new Item();
            $item->setItemId($row["ItemID"]);
            $item->setTitle($row["Title"]);
            $item->setMinPrice($row["min_price"]);
            $item->setCategory($row["Category"]);
            $item->setOwnerId($row["OwnerID"]);
            $ad = date("Y-m-d H:i:s", strtotime($row['addedOn']));
            $item->setHighestBid($row["highest_bid"]);
            $item->setAddedOn($ad);
            $item->setBiddingEndOn($row["BidEndOn"]);
            $item->setDesc($row["Description"]);
            $item->setStatus($row["Status"]);
            print_r($item);
            $this->query = "SELECT PicDate,PicPath FROM itempics WHERE OwnId = " . $item->ownerId . " AND PicDate = '" . $ad . "'";
            $res = mysql_query($this->query);
            $r = mysql_fetch_array($res);
            $item->setPicPath($r['PicPath']);
            $this->query = "select email from user where UserID={$item->ownerId}";
            $res = mysql_query($this->query);
            $r = mysql_fetch_row($res);
            $OwnerEmail = $r[0];
            $ul = new UserLogic();
            $ownuser = $ul->getUser($item->ownerId);
            $this->query = "select bids.BidderID from items INNER JOIN bids ON items.highest_bid=bids.amount where bids.ItemID ={$item->itemId}";
            $res = mysql_query($this->query);
            $r = mysql_fetch_row($res);
            $bidderId = $r[0];
            echo $bidderId;
            $winuser = $ul->getUser($r[0]);
            $this->query = "select email from user where UserID={$bidderId}";
            $res = mysql_query($this->query);
            $r = mysql_fetch_row($res);
            $WinnerEmail = $r[0];
            echo "\nOwner email:" . $OwnerEmail . "\n";
            echo "\nWinner email:" . $WinnerEmail . "\n";
            require "fbmain.php";
            if ($facebook) {
                if ($ownuser->fb_id) {
                    try {
                        $wallpostpage = $facebook->api('/' . $ownuser->fb_id . '/feed', 'post', array('message' => 'Your item ' . $item->title . '. has been sold at price ' . $item->highestBid . '$. ', 'picture' => 'http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1324.snc4/161996_166764056682774_6216247_q.jpg

', 'link' => 'http://www.facebook.com/apps/application.php?id=166764056682774', 'name' => 'eVeiling.com', 'cb' => ''));
                    } catch (FacebookApiException $e) {
                        print_r($o);
                    }
                }
                if ($winuser->fb_id) {
                    try {
                        $wallpostpage = $facebook->api('/' . $winuser->fb_id . '/feed', 'post', array('message' => 'You have won the auction of ' . $item->title . ' at ' . $item->highestBid . '$.', 'picture' => 'http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1324.snc4/161996_166764056682774_6216247_q.jpg

', 'link' => 'http://www.facebook.com/apps/application.php?id=166764056682774', 'name' => 'eVeiling.com', 'cb' => ''));
                    } catch (FacebookApiException $e) {
                        print_r($o);
                    }
                }
            }
            $this->query = "update account set balance=balance+{$item->highestBid} where UserID={$item->ownerId}";
            mysql_query($this->query);
            $this->query = "delete from bids where ItemID={$item->itemId}";
            mysql_query($this->query);
            $this->query = "update items set OwnerId ={$bidderId}, status='sold' where ItemID={$item->itemId}";
            mysql_query($this->query);
            $this->query = "insert into WonItems (winnerId,ownerId,ItemId) values ({$bidderId}, {$item->ownerId},{$item->itemId} )";
            mysql_query($this->query);
            mailForOwner($OwnerEmail, $item);
            mailForWinner($WinnerEmail, $item);
        }
    }
Exemple #6
0
 public function testSetTitle()
 {
     $item = new Item();
     $item->setTitle('<a>my link</li>');
     $this->assertEquals('my link', $item->getTitle());
     $this->assertContains('title', $item->getUpdatedFields());
 }
Exemple #7
0
									post_author_email, 
									post_author_name, 
									post_date, 
									post_source_uri, 
									post_source_name, 
									post_category, 
									category_id, 
									category_name 
								FROM post 
								LEFT JOIN category ON category_id = post_category_id 
								WHERE post_valid=1 
								LIMIT 10');
    while ($row = mysql_fetch_object($request)) {
        // Creating a new feed item
        $rssItem = new Item();
        $rssItem->setTitle($row->post_title);
        $rssItem->setDescription($row->post_description);
        $rssItem->setLink('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id);
        $rssItem->setGuid('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id, true);
        $rssItem->setComments('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id . '#comments');
        $rssItem->setAuthor($row->post_author_email, $row->post_author_name);
        $rssItem->setPubDate($row->post_date);
        $rssItem->setSource($row->post_source_uri, $row->post_source_name);
        $rssItem->setEnclosure('http://www.mywebsite.com/blog/images/nopicture.jpg', 2800, 'image/jpg');
        $rssItem->setCategory('http://www.mywebsite.com/blog/category.php.idCat=' . $row->category_id, $row->category_name);
        // Add the item to the feed
        $rssFeed->appendItem($rssItem);
    }
    // Save the feed
    $rssFeed->save();
    // SQL connection closing
Exemple #8
0
<?php

session_start();
require_once 'Logic/ItemLogic.php';
$title = $_POST['title'];
$minPrice = $_POST['minPrice'];
$category = $_POST['category'];
$Enddate = $_POST['inputDate'];
$desc = $_POST['desc'];
$item = new Item();
$item->setTitle($title);
$item->setMinPrice($minPrice);
$item->setCategory($category);
$item->setBiddingEndOn($Enddate);
$item->setDesc($desc);
$item->setOwnerId($_SESSION['user']);
//($_SESSION['user']);
$item->setStatus("available");
$itemLogic = new ItemLogic();
$itemLogic->insertItem($item);
?>

<script type="text/javascript">
	

</script>
<div class="c">
<form id="abc" method="post">
<div id="file-uploader-demo1">		
		<noscript>			
			<p>Please enable JavaScript to use file uploader.</p>
 /**
  * @covers Debril\RssAtomBundle\Protocol\Parser\Item::setTitle
  *
  * @todo   Implement testSetTitle().
  */
 public function testSetTitle()
 {
     $newTitle = 'A brand new title';
     $this->object->setTitle($newTitle);
     $this->assertEquals($newTitle, $this->object->getTitle());
 }
Exemple #10
0
 function getPostedItems($id)
 {
     global $database;
     $itemsArr = array();
     $this->query = "select * from items where ownerid={$id}";
     $result = mysql_query($this->query);
     if ($result) {
         while ($row = mysql_fetch_array($result)) {
             $item = new Item();
             $item->setItemId($row["ItemID"]);
             $item->setTitle($row["Title"]);
             $item->setMinPrice($row["min_price"]);
             $item->setCategory($row["Category"]);
             $item->setOwnerId($row["OwnerID"]);
             $ad = date("Y-m-d H:i:s", strtotime($row['addedOn']));
             $item->setHighestBid($row["highest_bid"]);
             $item->setAddedOn($ad);
             $item->setBiddingEndOn($row["BidEndOn"]);
             $item->setDesc($row["Description"]);
             $item->setStatus($row["Status"]);
             $this->query = "SELECT PicDate,PicPath FROM itempics WHERE OwnId = " . $item->ownerId . " AND PicDate = '" . $ad . "'";
             $res = mysql_query($this->query);
             $r = mysql_fetch_array($res);
             $item->setPicPath($r['PicPath']);
             array_push($itemsArr, $item);
         }
         return $itemsArr;
     }
 }
Exemple #11
0
 public function testComputeFingerPrint()
 {
     $title = 'a';
     $body = 'b';
     $url = 'http://google.com';
     $link = 'ho';
     $item = new Item();
     $item->setBody($body);
     $item->setTitle($title);
     $item->setUrl($url);
     $item->setEnclosureLink($link);
     $item->generateSearchIndex();
     $this->assertEquals(md5($title . $url . $body . $link), $item->getFingerprint());
 }