dunque
vorrei modificare uno script di joomla che invia le modifiche apportate ad un articolo al database
mi interessa, che prima di eseguire la modifica, invii una email che contenga i precedenti dati contenuti nella tabella
lo script è questo:
Codice PHP:
<?php // no direct access
defined('_JEXEC') or die('Restricted access');
$config =& JFactory::getConfig();
$publish_up =& JFactory::getDate($this->article->publish_up);
$publish_up->setOffset($config->getValue('config.offset'));
$publish_up = $publish_up->toFormat();
if (! isset($this->article->publish_down) || $this->article->publish_down == 'Never') {
$publish_down = JText::_('Never');
} else {
$publish_down =& JFactory::getDate($this->article->publish_down);
$publish_down->setOffset($config->getValue('config.offset'));
$publish_down = $publish_down->toFormat();
}
?>
<script language="javascript" type="text/javascript"> //script che controlla i dati per evitare di far ricaricare la pagina segnalando errori </script>
<?php if ($this->params->get('show_page_title', 1)) : ?>
<div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>"><?php echo $this->escape($this->params->get('page_title')); ?></div>
<?php endif; ?>
<form action="<?php echo $this->action ?>" method="post" name="adminForm" onSubmit="setgood();">
<fieldset>
<legend><?php echo JText::_('Editor'); ?></legend>
<table class="adminform" width="100%">
<tr>
<td>
<div style="float: left;">
<label for="title">
<?php echo JText::_( 'Title' ); ?>:
</label>
<input class="inputbox" type="text" id="title" name="title" size="50" maxlength="100" value="<?php echo $this->escape($this->article->title); ?>" />
<input class="inputbox" type="hidden" id="alias" name="alias" value="<?php echo $this->escape($this->article->alias); ?>" />
</div>
<div style="float: right;">
<button type="button" onclick="submitbutton('save')">
<?php echo JText::_('Save') ?>
</button>
<button type="button" onclick="submitbutton('cancel')">
<?php echo JText::_('Cancel') ?>
</button>
</div>
</td>
</tr>
</table>
<?php
echo $this->editor->display('text', $this->article->text, '100%', '400', '70', '15');
?>
</fieldset>
<fieldset>
<legend><?php echo JText::_('Publishing'); ?></legend>
<table class="adminform">
<tr>
<td class="key">
<label for="sectionid">
<?php echo JText::_( 'Section' ); ?>:
</label>
</td>
<td>
<?php echo $this->lists['sectionid']; ?>
</td>
</tr>
<tr>
<td class="key">
<label for="catid">
<?php echo JText::_( 'Category' ); ?>:
</label>
</td>
<td>
<?php echo $this->lists['catid']; ?>
</td>
</tr>
<?php if ($this->user->authorize('com_content', 'publish', 'content', 'all')) : ?>
<tr>
<td class="key">
<label for="state">
<?php echo JText::_( 'Published' ); ?>:
</label>
</td>
<td>
<?php echo $this->lists['state']; ?>
</td>
</tr>
<?php endif; ?>
<tr>
<td width="120" class="key">
<label for="frontpage">
<?php echo JText::_( 'Show on Front Page' ); ?>:
</label>
</td>
<td>
<?php echo $this->lists['frontpage']; ?>
</td>
</tr>
<tr>
<td class="key">
<label for="created_by_alias">
<?php echo JText::_( 'Author Alias' ); ?>:
</label>
</td>
<td>
<input type="text" id="created_by_alias" name="created_by_alias" size="50" maxlength="100" value="<?php echo $this->article->created_by_alias; ?>" class="inputbox" />
</td>
</tr>
<tr>
<td class="key">
<label for="publish_up">
<?php echo JText::_( 'Start Publishing' ); ?>:
</label>
</td>
<td>
<?php echo JHTML::_('calendar', $publish_up, 'publish_up', 'publish_up', '%Y-%m-%d %H:%M:%S', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?>
</td>
</tr>
<tr>
<td class="key">
<label for="publish_down">
<?php echo JText::_( 'Finish Publishing' ); ?>:
</label>
</td>
<td>
<?php echo JHTML::_('calendar', $publish_down, 'publish_down', 'publish_down', '%Y-%m-%d %H:%M:%S', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?>
</td>
</tr>
<tr>
<td valign="top" class="key">
<label for="access">
<?php echo JText::_( 'Access Level' ); ?>:
</label>
</td>
<td>
<?php echo $this->lists['access']; ?>
</td>
</tr>
<tr>
<td class="key">
<label for="ordering">
<?php echo JText::_( 'Ordering' ); ?>:
</label>
</td>
<td>
<?php echo $this->lists['ordering']; ?>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend><?php echo JText::_('Metadata'); ?></legend>
<table class="adminform">
<tr>
<td valign="top" class="key">
<label for="metadesc">
<?php echo JText::_( 'Description' ); ?>:
</label>
</td>
<td>
<textarea rows="5" cols="50" style="width:500px; height:120px" class="inputbox" id="metadesc" name="metadesc"><?php echo str_replace('&','&',$this->article->metadesc); ?></textarea>
</td>
</tr>
<tr>
<td valign="top" class="key">
<label for="metakey">
<?php echo JText::_( 'Keywords' ); ?>:
</label>
</td>
<td>
<textarea rows="5" cols="50" style="width:500px; height:50px" class="inputbox" id="metakey" name="metakey"><?php echo str_replace('&','&',$this->article->metakey); ?></textarea>
</td>
</tr>
</table>
</fieldset>
<input type="hidden" name="option" value="com_content" />
<input type="hidden" name="id" value="<?php echo $this->article->id; ?>" />
<input type="hidden" name="version" value="<?php echo $this->article->version; ?>" />
<input type="hidden" name="created_by" value="<?php echo $this->article->created_by; ?>" />
<input type="hidden" name="referer" value="<?php echo @$_SERVER['HTTP_REFERER']; ?>" />
<?php echo JHTML::_( 'form.token' ); ?>
<input type="hidden" name="task" value="" />
</form>
<?php echo JHTML::_('behavior.keepalive'); ?>
è possibile? non so perche in questa pagina non ho neanche capito dove siano i dati di comunicazione con il database
comunque, la stessa tabella su cui scrive questo script, prima di scrivere mi interessa che invii la email con i precedenti dati
che contenga:
<?php echo @$_SERVER['HTTP_REFERER']; ?>
E stato modificato: <?php echo $this->escape($this->article->title); ?>
<?php echo $this->article->introtext; ?>
<?php echo $this->article->fulltext; ?>
Autore:
<?php echo $this->article->modified_by; ?><?php echo $this->article->modified; ?>
Sezione:
<?php echo $this->lists['sectionid']; ?>
Categoria:
<?php echo $this->lists['catid']; ?>