I've not tested it, but if you replace the contents of plus2desc.php with the following then it should work only for the admin user with no trace of the information on the public area.
PHP Code:
<?php
/**
* Extension to add 2 extra description fields to each listing.
*
* - Data is stored in the table plus2desc
* - The template variables {$plus2desc1} and {$plus2desc2} need to be placed on t!wddetail.html
*
* Copyright (c) 2008 - 2010 TOLRA Micro Systems Limited. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
define('PLUS2DESCLENGTH', 4096);
class plus2desc {
var $fields = array();
/**
* Create the extra fields for the new listing.
*
* @param array $data Event data
*/
function listing_added($data) {
global $g_queryCount;
$g_queryCount++;
mysql_query("INSERT INTO " . $data['dirclient']->prefix . "plus2desc (id) VALUES('" . $data['id'] . "')", $data['dirclient']->dbLink);
}
/**
* Delete the extra fields for the deleted listing.
*
* @param array $data Event data
*/
function listing_deleted($data) {
global $g_queryCount;
$g_queryCount++;
mysql_query("DELETE FROM " . $data['dirclient']->prefix . "plus2desc WHERE id='" . $data['id'] . "'", $data['dirclient']->dbLink);
}
/**
* Load the extra fields from the database into the object
*
* @param array $data Event data
*/
function fields_load($data) {
global $g_queryCount;
$g_queryCount++;
$result = mysql_query("SELECT desc1,desc2 FROM " . $data['dirclient']->prefix . "plus2desc WHERE id='" . $data['id'] . "'", $data['dirclient']->dbLink);
$this->fields = mysql_fetch_assoc($result);
mysql_free_result($result);
}
/**
* Draw the extra input fields.
*
* @param array $data Event data
*/
function fields_draw($data) {
// If 1st call initialise data
if(is_null($data['fields'])) {
$this->fields['desc1'] = $this->fields['desc2'] = '';
// If editing load data from db
if($data['id'])
$this->fields_load($data);
}
// Save data submitted
else if($data['mode'] == 'admin') {
if(isset($data['fields']['ExtraDescription1'])) $this->fields['desc1'] = bbcodeXHTML::BtoX(preg_replace("/(\r\n)|\n|\s{2,}/", ' ', trim($data['fields']['ExtraDescription1'])));
if(isset($data['fields']['ExtraDescription2'])) $this->fields['desc2'] = bbcodeXHTML::BtoX(preg_replace("/(\r\n)|\n|\s{2,}/", ' ', trim($data['fields']['ExtraDescription2'])));
}
if($data['mode'] == 'admin') {
?>
<tr>
<td><label for="Extra_Description_1__txt_max<?php echo PLUS2DESCLENGTH; ?>">Extra Description 1:</label></td>
<td><textarea name="Extra_Description_1__txt_max<?php echo PLUS2DESCLENGTH; ?>" id="Extra_Description_1__txt_max<?php echo PLUS2DESCLENGTH; ?>" rows="8" cols="50" tabindex="<?php echo $data['tabindex']++; ?>"><?php echo afHTMLChars(bbcodeXHTML::XtoB($this->fields['desc1'])); ?></textarea></td>
</tr>
<tr>
<td><label for="Extra_Description_2__txt_max<?php echo PLUS2DESCLENGTH; ?>">Extra Description 2:</label></td>
<td><textarea name="Extra_Description_2__txt_max<?php echo PLUS2DESCLENGTH; ?>" id="Extra_Description_2__txt_max<?php echo PLUS2DESCLENGTH; ?>" rows="8" cols="50" tabindex="<?php echo $data['tabindex']++; ?>"><?php echo afHTMLChars(bbcodeXHTML::XtoB($this->fields['desc2'])); ?></textarea></td>
</tr>
<?php
}
}
/**
* Store the current fields into the database.
*
* @param array $data Event data
*/
function fields_store($data) {
global $g_queryCount;
$g_queryCount++;
mysql_query("UPDATE " . $data['dirclient']->prefix . "plus2desc SET desc1='" .
mysql_real_escape_string($this->fields['desc1'], $data['dirclient']->dbLink) .
"',desc2='" . mysql_real_escape_string($this->fields['desc2'], $data['dirclient']->dbLink) . "' WHERE id='" . $data['id'] . "'", $data['dirclient']->dbLink);
}
/**
* Build the validation for the input
*
* @param array $data Event data
*/
function fields_validate($data) {
if($data['mode'] == 'admin') {
$data['field_validation'] = array_merge($data['field_validation'], array(
'Extra_Description_1__txt_max' . PLUS2DESCLENGTH,
'Extra_Description_2__txt_max' . PLUS2DESCLENGTH
));
}
}
/**
* Serialise the field data to storage.
*
* @param array $data Event data
*/
function fields_serialize($data) {
$data['store'][get_class($this)] = serialize($this->fields);
}
/**
* Unserialise the field data from storage.
*
* @param array $data Event data
*/
function fields_unserialize($data) {
$this->fields = unserialize($data['store'][get_class($this)]);
}
/**
* Optimise the database table.
*
* @param array $data Event data
*/
function fields_optimizedb($data) {
global $g_queryCount;
$g_queryCount++;
mysql_query('OPTIMIZE TABLE ' . $data['dirclient']->prefix . 'plus2desc', $data['dirclient']->dbLink);
}
/**
* Draw the detail.
*
* @param array $data Event data
*/
function draw_detail($data) {
}
}
?>