View Single Post
  #441  
Old 06-02-2007, 12:59 PM
dartho dartho is offline
 
Join Date: Sep 2005
Location: Australia
Posts: 2,303
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When a new bid is placed on an item, this modification to the vbay.php file will send a PM to the old highest bidder from the new highest bidder
in vbay.php search for:

search for:
Code:
  require_once('./includes/class_bbcode.php');
add the following immediatelt below
Code:
  require_once('./includes/functions_vbay.php');
Search for:
Code:
	if ($_REQUEST['do'] == 'bid') {
	    $check = $db->query("select * from " . TABLE_PREFIX . "vbay_items where id='{$_REQUEST['dobid']}'");
      	$item = $db->fetch_array($check);
		if ($item['owner'] == $vbulletin->userinfo['userid']){
			eval(standard_error(fetch_error('vbay_auction_own')));
		}
		if ($item['completetime'] < time()) {
			eval(standard_error(fetch_error('vbay_auction_ended')));
      	} else {
      		if ($item['price'] + $item['inc'] > $_POST['bid']) {
      			eval(standard_error(fetch_error('vbay_bid_higher')));
      		}
and add the following immediately below:
Code:
// send a PM to old high bidder
if ($item['bids'] > 0) {
	$pmhigh_bidder = $vbulletin->db->query("select * from " . TABLE_PREFIX . "user where userid='{$item['highbidder']}'");
	$pmbidder = $vbulletin->db->fetch_array($pmhigh_bidder);  
	$title = "You have been outbid: {$item['name']}";
	$message = "Hello, I have just outbid you on this auction!  This is an automated system message.";
	send_pm($vbulletin->userinfo['username'],$vbulletin->userinfo['userid'],$pmbidder['username'],$title,$message);
	}

Another modification I've made is that if a bid is placed in the last 10 minutes of teh auction, teh auction end time is automatically extended to 10 minutes. I do this to stop sniping, and to also make it somewhat more like a 'real' auction as opposed to ebay.

To do this, edit vbay.php and find:
Code:
$db->query("update " . TABLE_PREFIX . "vbay_items set highbidder = " . $vbulletin->userinfo['userid'] . " where id='{$_REQUEST['dobid']}'");
and add the following ABOVE it:
Code:
// Increase end auction time by ten miniutes if bid in last 10 minutes - stops sniping!
			$timeremaining = $item['completetime']-time();
			if ($timeremaining < 600){
				$endstamp = 600 + time(); 
				$db->query("update " . TABLE_PREFIX . "vbay_items set completetime = '{$endstamp}' where id='{$_REQUEST['dobid']}'");


I've also added logging of bids to a simple text file - this is just in my forum root as I don't feel the need to hide it. To add it, edit vbay.php search for
Code:
$vbulletin->url = "vbay.php?do=item&viewitem=" . $_REQUEST['dobid'] . $vbulletin->session->vars['sessionurl'] ."";
and add the following immediately ABOVE it

Code:
$logentry = date('Ymd') . ' ' . strftime('%T') . ' Auction: ' . $_REQUEST['dobid'] . ', Amount: ' . $bid . ', User: ' . $vbulletin->userinfo['username'];
$vbaylog = fopen('./vbaylog.txt','a') or die("can't open vbaylog: $php_errormsg");
fwrite($vbaylog, $logentry . "\r\n");
fflush($vbaylog);
fclose($vbaylog) or die ($php_errormsg);
To view the log, just open vbalog.txt in your browser (http://yourforum.com/forums/vbaylog.txt) I guess you could create it in the admincp dir if you wanted to hide it - there are no doubt better ways to do most of the above, but it works for me.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01306 seconds
  • Memory Usage 1,783KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete