<?php // no direct access
defined('_JEXEC') or die('Restricted access');
?>
<?php
$config =& JComponentHelper::getParams( 'com_jfeedback' );
$showauthor = $config->get( 'showauthor' );
$showdate = $config->get( 'showdate' );
$permission = $config->get( 'permission' );
$the = $config->get( 'the' );
$tmex = $config->get( 'tmex' );
$hc = $config->get( 'hc' );
$tauthor = $config->get( 'tauthor' );
$tdate = $config->get( 'tdate' );
$tfeedback = $config->get( 'tfeedback' );
$has_said = $config->get( 'has_said' );
$numfeed = $config->get( 'numfeed' );
$name = $config->get( 'name' );
$intro = $config->get( 'intro' );
$namey = $config->get( 'namey' );
$introy = $config->get( 'introy' );
$commy = $config->get( 'commy' );
$feed_ok = $config->get( 'feed_ok' );
$invia = $config->get( 'invia' );
if ( $namey == '1' ) { echo '
<div class="componentheading" id="jfheading">';echo $name;echo '</div>';}
if ( $introy == '1' ) { echo '
<p class="jfeedbackintro" style="opacity:.75;;">';echo $intro;echo '</p>
';
}
if ( $_POST['insfeedback'] != '' && $_POST['insauthor'] != '' )
{ echo '<h2 style="color:red">'.$feed_ok.'</h2>
';}
?>
<?
// Load ID
$dboid =& JFactory::getDBO();
$queryid = "SELECT id FROM #__jfeedback ORDER BY id DESC";
$dboid->setQuery( $queryid );
$id =& $dboid->loadResultArray();
// Get right number of entries
$outputid = array_slice($id, 0, $numfeed);
// Recursive Write
if ( $commy == '1' ) {
echo "<h3 class='com2'>".$hc."</h3>"; }
echo"<div class='quadro'>";
while (list($key,$v_id) = each($outputid)){
$dbo =& JFactory::getDBO();
$queryauthorv_id = "SELECT author FROM #__jfeedback WHERE id =".$v_id.';';
$querydatev_id = "SELECT data FROM #__jfeedback WHERE id =".$v_id.';';
$queryfeedbackv_id = "SELECT feedback FROM #__jfeedback WHERE id =".$v_id.';';
$dbo->setQuery( $queryauthorv_id );
$author =& $dbo->loadResultArray();
$dbo->setQuery( $querydatev_id );
$date =& $dbo->loadResultArray();
$dbo->setQuery( $queryfeedbackv_id );
$feedback =& $dbo->loadResultArray();
// if session
if ( $showauthor == 1 && $showdate == 1 ){
echo "<div class='jfeedback' id='jf".$v_id."'>";
echo "<div class='jfeedbacktitle' id='jftitle".$v_id."'>";
echo ''.$author[0].'';
echo ', '.$the.' ';
echo ''.$date[0].'';
echo ' '.$has_said.':
';
echo '</div>';
echo $feedback[0];
echo '</div>
';
echo "<hr style='width:100%' size='2' />
";
}
if ( $showauthor == 1 && $showdate == 0 ){
echo "<div class='jfeedback' id='jf".$v_id."'>";
echo "<div class='jfeedbacktitle' id='jftitle".$v_id."'>";
echo ''.$author[0].'';
echo ' '.$has_said.':
';
echo '</div>';
echo $feedback[0];
echo '</div>';
echo "<hr style='width:100%' size='2' />";
}
if ( $showauthor == 0 && $showdate == 1 ){
echo "<div class='jfeedback' id='jf".$v_id."'>";
echo "<div class='jfeedbacktitle' id='jftitle".$v_id."'>";
echo ''.$date[0].'';
echo ':
';
echo '</div>';
echo $feedback[0];
echo '</div>
';
echo "<hr style='width:100%' size='2' />
";
}
if ( $showauthor == 0 && $showdate == 0 ){
echo "<div class='jfeedback' id='jf".$v_id."'>";
echo $feedback[0];
echo '</div>
';
echo "<hr style='width:100%' size='2' />
";
}
}
echo "</div>";
?>
<?php
if ( $permission == 1 ) { echo '
<a name="commenti" id="commenti">
<h3 class="com">'.$tmex.'</h3>[/url]
<form action="" method="post" name="Form" id="Form">
'.$tauthor.':
<input class="text_area" type="text" name="insauthor" id="insauthor" size="32" maxlength="250" value="" />
'.$tfeedback.':
<textarea class="text_area" type="text" name="insfeedback" id="insfeedback" rows="5" cols="70" value="" ></textarea>
<input type="submit" name="Submit" id="Submit" size="32" value="'.$invia.'" />
<input type="reset" name="Reset" id="Reset" size="32" value="Reset" />
</form>';}
?>
<?php
if ( $_POST['insfeedback'] != '' && $_POST['insauthor'] != '' )
{
$database =& JFactory::getDBO();
$user = new stdClass;
$user->id = NULL;
$user->feedback = $_POST['insfeedback'];
$user->author = $_POST['insauthor'];
if (!$database->insertObject( '#__jfeedback', $user, 'id' )) {
echo $database->stderr();
};
}
?>