Nic trudnego edytuj plik marketplace.php i dodaj to co na czerwono
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright Š 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Created for php-fusion 6
| by Peter Bruggink
|
| marketplace_panel v1.00
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";
function mailok($email) {
if ($email == "" || !preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) {
return false;
}
return true;
}
if (isset($mplace_id) && !isNum($mplace_id)) fallback(FUSION_SELF);
if (!isset($action)) $action = "";
if ($action == "delete") {
if (iADMIN) {
$result = dbquery("DELETE FROM ".$db_prefix."marketplace WHERE mplace_id='$mplace_id'");
$result = dbquery("DELETE FROM ".$db_prefix."marketplace_biddings WHERE mplace_id='$mplace_id'");
redirect(FUSION_SELF);
}
}
if (isset($_POST['mplace_submit'])) {
$mplace_article = stripinput($_POST['mplace_article']);
$mplace_price = stripinput($_POST['mplace_price']);
$place_message = $_POST['mplace_message'];
if ($action == "edit") {
$result = dbquery("UPDATE ".$db_prefix."marketplace SET mplace_article='$mplace_article', mplace_price='$mplace_price', mplace_message='$mplace_message' WHERE mplace_id='$mplace_id'");
} else {
$mplace_owner = $userdata['user_id'];
$mplace_datestamp = time();
$result = dbquery("INSERT INTO ".$db_prefix."marketplace (mplace_owner, mplace_article, mplace_message, mplace_price, mplace_datestamp) VALUES('$mplace_owner', '$mplace_article', '$mplace_message', '$mplace_price', '$mplace_datestamp')");
}
redirect(FUSION_SELF);
}
if (isset($_POST['bidding_submit'])) {
$mplace_id = stripinput($_POST['mplace_id']);
$bidding_price = stripinput($_POST['bidding_price']);
$bidding_owner = $userdata['user_id'];
$bidding_date = time();
$result = dbquery("SELECT * FROM ".$db_prefix."marketplace_biddings WHERE bidding_owner='".$bidding_owner."' AND mplace_id='".$mplace_id."'");
$rows = dbrows($result);
if ($rows == 0) {
$result = dbquery("INSERT INTO ".$db_prefix."marketplace_biddings (mplace_id, bidding_owner, bidding_price, bidding_date) VALUES('$mplace_id', '$bidding_owner', '$bidding_price', '$bidding_date')");
} else {
$result = dbquery("UPDATE ".$db_prefix."marketplace_biddings SET bidding_price='$bidding_price', bidding_date='$bidding_date' WHERE bidding_owner='".$bidding_owner."' AND mplace_id='".$mplace_id."'");
}
redirect(FUSION_SELF);
}
if ($action == "close") {
$result = dbquery("SELECT * FROM ".$db_prefix."marketplace WHERE mplace_id='$mplace_id'");
$data = dbarray($result);
if ($userdata['user_id'] == $data['mplace_owner']) {
$mailfrom = $userdata['user_email'];
$u_result = dbarray(dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id='".$mplace_sold."'"));
if (mailok($u_result['user_email'])) {
$mailto = $u_result['user_email'];
$mailtype = "plain";
$mailsubject = "[".$data['mplace_article']."]";
$mailmessage = $locale['MPL700'].$data['mplace_article'].$locale['MPL701'].$bidding_price.$locale['MPL203']."\n";
$mailmessage .= $locale['MPL702']."\n\n";
require_once INCLUDES."sendmail_include.php";
sendemail($u_result['user_name'],$mailto,$userdata['user_name'],$mailfrom,$mailsubject,$mailmessage,$mailtype);
$result = dbquery("UPDATE ".$db_prefix."marketplace SET mplace_sold='$mplace_sold' WHERE mplace_id='$mplace_id'");
}
}
redirect(FUSION_SELF);
}
if ($action == "edit") {
$result = dbquery("SELECT * FROM ".$db_prefix."marketplace WHERE mplace_id='$mplace_id'");
$data = dbarray($result);
if (dbrows($result) && (iADMIN || $userdata['user_id'] == $data['mplace_owner'])) {
$mplace_article = $data['mplace_article'];
$mplace_price = $data['mplace_price'];
$mplace_message = $data['mplace_message'];
$formaction = FUSION_SELF."?action=edit&mplace_id=$mplace_id";
} else {
$action = "";
$formaction = FUSION_SELF;
}
} else {
$mplace_article = "";
$mplace_price = "";
$mplace_message = $locale['MPL303'];
$formaction = FUSION_SELF;
}
if ($action == "new" || $action == "edit") {
opentable($locale['MPL300']);
echo "<form name='marketplace' method='post' action=$formaction>
<center><table border='0' cellpadding='0' cellspacing='0' summary=''>
<tr><td align='right' class='tbl'>".$locale['MPL301']."</td>
<td class='tbl'><input type='text' name='mplace_article' value='$mplace_article' class='textbox' size='25' maxlength='25'></td>
<td align='right' class='tbl'>".$locale['MPL302']."</td>
<td class='tbl'><input type='text' name='mplace_price' value='$mplace_price' class='textbox' size='6' maxlength='6'></td>
<td align='left' class='tbl'>".$locale['MPL203']."</td>
</tr>
<tr><td class='tbl' colspan='5'><textarea name='mplace_message' cols='43' rows='5' wrap='off'>$mplace_message</textarea><br><br></td>
</tr>
<tr><td class='tbl' colspan='5'><input type='submit' name='mplace_submit' value='".$locale['MPL304']."' class='button'></td>
</tr>
</table></center>
</form>\n";
closetable();
tablebreak();
}
if ($action == "make") {
$result = dbarray(dbquery("SELECT * FROM ".$db_prefix."marketplace WHERE mplace_id='$mplace_id'"));
$mplace_article = $result['mplace_article'];
$formaction = FUSION_SELF;
opentable($locale['MPL600']." [ ".$mplace_article." ]");
echo "<form name='biddingplace' method='post' action=$formaction>
<center><table border='0' cellpadding='0' cellspacing='0' summary=''>
<tr>
<td><input type='hidden' name='mplace_id' value='$mplace_id'></td>
<td align='right' class='tbl'>".$locale['MPL601']."</td>
<td class='tbl'><input type='text' name='bidding_price' value='$bidding_price' class='textbox' size='6' maxlength='6'></td>
<td align='left' class='tbl'>".$locale['MPL203']."</td>
</tr>
</tr>
<tr><td class='tbl' colspan='3'><input type='submit' name='bidding_submit' value='".$locale['MPL602']."' class='button'></td>
</tr>
</table></center>
</form>\n";
closetable();
tablebreak();
}
opentable($locale['MPL200']);
$result = dbquery("SELECT * FROM ".$db_prefix."marketplace");
$rows = dbrows($result);
if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
if ($rows != 0) {
[b][color=red]if (iMEMBER) {[/color][/b]
echo "<center>[ <a href='".FUSION_SELF."?action=new'>".$locale['MPL201']."</a> ]</center>\n";
[color=red][b]}[/b][/color]
tablebreak();
$i = 1;
$result = dbquery("SELECT * FROM ".$db_prefix."marketplace ORDER BY mplace_datestamp DESC LIMIT $rowstart,10");
$numrows = dbrows($result);
while ($data = dbarray($result)) {
$u_result = dbarray(dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id='".$data['mplace_owner']."'"));
echo "<table align='center' cellpadding='0' cellspacing='1' width='80%' class='tbl-border'>
<tr>
<td class='tbl2'>
<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td class='small'><b>[ ".$data['mplace_article']." ]</b></td>
<td align='right' class='small'>".$locale['MPL202'].$data['mplace_price'].$locale['MPL203']."</td></tr>
</table>
</td>
</tr>
<tr>
<td class='tbl1'>".nl2br($data['mplace_message'])."</td>
</tr>
<tr><td class='tbl1'>\n";
$b_result = dbquery("SELECT * FROM ".$db_prefix."marketplace_biddings WHERE mplace_id='".$data['mplace_id']."'");
$b_rows = dbrows($b_result);
if ($b_rows != 0) {
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n";
$b_result = dbquery("SELECT * FROM ".$db_prefix."marketplace_biddings LEFT JOIN ".$db_prefix."users
ON ".$db_prefix."marketplace_biddings.bidding_owner=".$db_prefix."users.user_id
WHERE mplace_id='".$data['mplace_id']."' ORDER BY bidding_price");
while ($b_data = dbarray($b_result)) {
echo "<tr><td><img src='".THEME."images/bullet.gif' alt=''> ".$b_data['bidding_price'].$locale['MPL203'].$locale['MPL501'].$b_data['user_name'];
if ($data['mplace_sold'] == $b_data['user_id']) {
echo $locale['MPL504']."</td>\n";
} else {
echo $locale['MPL502'].showdate("longdate", $b_data['bidding_date'])."</td>\n";
}
if (($userdata['user_id'] == $u_result['user_id']) && ($data['mplace_sold'] == 0)) {
echo "<td width='50' class='small' align='center'><a href='".FUSION_SELF."?action=close&mplace_id=".$data['mplace_id']."&mplace_sold=".$b_data['user_id']."&bidding_price=".$b_data['bidding_price']."'>".$locale['MPL503']."</a></td>\n";
} else {
echo "<td></td>\n";
}
echo "</tr>\n";
}
echo "</table></td>\n";
} else {
echo "<br><center>".$locale['MPL500']."</td>\n";
}
echo "</tr>
<tr>
<td class='tbl2'>
<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td class='small'>".$locale['MPL204']."<b><a href='".BASEDIR."profile.php?lookup=".$u_result['user_id']."'>".$u_result['user_name']."</a></b>".$locale['MPL205']
.showdate("longdate", $data['mplace_datestamp'])."</td>
<td align='right' class='small'>\n";
if (iADMIN) {
echo "<a href='".FUSION_SELF."?action=delete&mplace_id=".$data['mplace_id']."'>".$locale['MPL206']."</a>";
}
if ($data['mplace_sold'] == 0) {
echo " | ";
if ($userdata['user_id'] == $u_result['user_id']) {
echo "<a href='".FUSION_SELF."?action=edit&mplace_id=".$data['mplace_id']."'>".$locale['MPL207']."</a> | ";
}
[b][color=red]if (iMEMBER) {[/color][/b]
echo "<a href='".FUSION_SELF."?action=make&mplace_id=".$data['mplace_id']."'>".$locale['MPL208']."</a></td></tr>\n";
[b][color=red]}[/color][/b]
}
echo "</table>
</td>
</tr>
</table>\n";
if ($i != $numrows) echo "<br>\n";
$i++;
}
} else {
echo "<center><br>\n".$locale['MPL209']."<br><br>\n[ <a href='".FUSION_SELF."?action=new'>".$locale['MPL201']."</a> ]<br><br>\n</center>\n";
}
closetable();
if ($rows != 0) echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,10,$rows,3,FUSION_SELF."?")."\n</div>\n";
require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>
Edytowane przez Pieka dnia 16.06.2008 17:39:44
|