Co muszę usunąć z tego kodu żeby link “Edytuj” ( [‘MPL207’] ) nie wyświetlał się niezalogowanym?? Ale żeby pozostał widoczny dla zalogowanych
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: marketplace.php
| CVS Version: 1.00
| Author: Peter Bruggink
| Email: p.bruggink@zonnet.nl
+--------------------------------------------------------+
| v7 By Diemux
| www.phpfusion-mods.net
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
// If register_globals is turned off, extract super globals (php 4.2.0+)
if (ini_get('register_globals') != 1) {
if ((isset($_POST) == true) && (is_array($_POST) == true)) extract($_POST, EXTR_OVERWRITE);
if ((isset($_GET) == true) && (is_array($_GET) == true)) extract($_GET, EXTR_OVERWRITE);
}
require_once "../../maincore.php";
require_once THEMES."templates/header.php";
include_once INCLUDES."bbcode_include.php";
include INFUSIONS."marketplace_panel/infusion_db.php";
if (file_exists(INFUSIONS."marketplace_panel/locale/".$settings['locale'].".php")) {
include INFUSIONS."marketplace_panel/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."marketplace_panel/locale/English.php";
}
error_reporting(E_ALL ^ E_NOTICE);
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)) redirect(FUSION_SELF);
if (!isset($action)) $action = "";
if ($action == "delete") {
if (iADMIN) {
$result = dbquery("DELETE FROM ".DB_MARKETPLACE." WHERE mplace_id='$mplace_id'");
$result = dbquery("DELETE FROM ".DB_MARKETPLACE_BIDDING." 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_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_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_MARKETPLACE_BIDDING." WHERE bidding_owner='".$bidding_owner."' AND mplace_id='".$mplace_id."'");
$rows = dbrows($result);
if ($rows == 0) {
$result = dbquery("INSERT INTO ".DB_MARKETPLACE_BIDDING." (mplace_id, bidding_owner, bidding_price, bidding_date) VALUES('$mplace_id', '$bidding_owner', '$bidding_price', '$bidding_date')");
} else {
$result = dbquery("UPDATE ".DB_MARKETPLACE_BIDDING." 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_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_MARKETPLACE." SET mplace_sold='$mplace_sold' WHERE mplace_id='$mplace_id'");
}
}
redirect(FUSION_SELF);
}
//new
if ($action == "decline") {
$result = dbquery("SELECT * FROM ".DB_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['MPL704'].$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("DELETE FROM ".DB_MARKETPLACE_BIDDING." WHERE mplace_id='$mplace_id'");
}
}
redirect(FUSION_SELF);
}
if ($action == "edit") {
$result = dbquery("SELECT * FROM ".DB_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 "
".$locale['MPL301']." | ".$locale['MPL302']." | ".$locale['MPL203']." | ||
$mplace_message | ||||
";
echo “ ”.display_bbcodes(“99%”, “mplace_message”, “marketplace”)." \n";
echo" |
".$locale['MPL601']." | ".$locale['MPL203']." | ||
tablebreak();
$i = 1;
$result = dbquery(“SELECT * FROM “.DB_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 "
| ||||
".nl2br(parseubb(parsesmileys($data['mplace_message'])))." | ||||
\n";
$b_result = dbquery(“SELECT * FROM “.DB_MARKETPLACE_BIDDING.” WHERE mplace_id=’”.$data[‘mplace_id’]."’"); $b_rows = dbrows($b_result); if ($b_rows != 0) {
|
".$locale['MPL503']." | ".$locale['MPL505']." |
}
echo "
".$locale['MPL204']."".$u_result['user_name']."".$locale['MPL205']
.showdate(“longdate”, $data[‘mplace_datestamp’])." |
\n";
if (iADMIN) { echo “”.$locale[‘MPL207’]." | "; echo “”.$locale[‘MPL206’].""; } if ($data[‘mplace_sold’] == 0) { echo " | "; if ($userdata[‘user_id’] == $u_result[‘user_id’]) { echo “”.$locale[‘MPL207’]." | "; } echo “”.$locale[‘MPL208’]." |
\n";
if ($i != $numrows) echo "
\n";
$i++;
}
} else {
echo "
\n".$locale[‘MPL209’]."
\n\n";
}
closetable();
if ($rows != 0) echo “
require_once THEMES.“templates/footer.php”;
?[/code]