Ver Mensaje Individual
Antiguo 05/10/2010, 03:47   #26
Wao
Usuario Activo
 
Fecha de ingreso: 02/oct/2010
Mensajes: 73
Wao es algo digno de contemplarWao es algo digno de contemplarWao es algo digno de contemplarWao es algo digno de contemplarWao es algo digno de contemplarWao es algo digno de contemplar
- POSTEADO POR WAO -


Voy a resumirlo todo lo que debo de poner en un solo mensaje para no liarme, si me he equivocado en algo, dimelo porfavor.

form.php (script comentarios):

Código PHP:
<?php
if ($config['spam_protect'])
{    
    
$equation = new comments();
    echo 
$equation->display_security_input();
}

//$downId = mysql_escape_string($_GET['downloadid']);
?>
<li>
    <input type="hidden" name="downloadid" value="<?php echo $downId?>" />
    <input type="hidden" name="parentid" id="parentid" value="0" />
    <input type="submit" value="Comment" name="comment-submit" id="comment-submit" />
</li>
index.php (script comentarios):
Código PHP:
<?php
/* Insert this for the admin header (optional) */
include_once "canny/admin_header.php";

/* Includes required configuration settings and functions */
require "canny/config.php";
require 
"canny/comments.class.php";

$downId $_GET['downloadid'];

/* Displays comments */
$comments = new comments();
echo 
$comments->gather_comments(false$downId);

/* Displays the comment form */
include_once "canny/form.php";
?>
index.php (script wcddl1):
Cita:
<a href="/comentarios/?downloadid=<?php echo $dl[id];?>&TB_iframe=true&height=390&width=773" rel="sexylightbox" class="tooltip" title="COMENTARIOS!"><img src="comentarios.png" border="0"></a>
index.php (script wcddl1):
Código PHP:
<?php
foreach($downloads as $dl) {
    
//---------------------------
    
$num_mens $mensajes->gather_comments(false$dl[id], true);
    
//---------------------------
?> 

<?php
$fetch_downloads 
true;
$fetch_order "id DESC";
include 
"funcs.php";

//-----------------------------------------------------
require "comments.class.php";

$mensajes = new comments();

//-----------------------------------------------------
[B]?>[/B]

comment.class.php (script comentarios):

[PHP]public function gather_comments($admin, $downId, $bol = false) //añadido $downId y $bol
{
global $config;

$comment = '';
$order = $config['sort'];

// check if we're displaying for the admin domain
if ($admin) {
$fetch = mysql_query("SELECT * FROM comments WHERE approval = 'P' ORDER BY IF(parentid = 0, id, parentid), id ASC");

if (mysql_num_rows($fetch) > 0) {
$comment .= '<li><h4>These comments are awaiting your approval:</h4></li>';
}
else {
$comment .= '<li><h4>There are no pending comments.</h4></li>';
}
}
else {
//-------------------------------------
$fetch = mysql_query("SELECT * FROM comments WHERE approval = 'Y' AND downloadid=".$downId." ORDER BY IF(parentid = 0, id, parentid) $order, id ASC");

if($bol) return mysql_num_rows($fetch);
//-------------------------------------

if (mysql_num_rows($fetch) > 0) {
while ($row = mysql_fetch_assoc($fetch)) {
$comment .= $this->construct_html_comment($row, $admin);
}
}
else {
$comment .= '<li><h3>No comments</h3></li>';
}
}
return '
<div id="comments-container">
<ul>
'.$comment.'
</ul>
</div>
';
} [/PHP]
[B]submit.php (script comentarios):[/B]
[PHP]mysql_query("INSERT INTO comments(name,email,website,body,parentid,approval,hash,downloadid)
VALUES (
'".$input['name']."',
'".$input['email']."',
'".$input['website']."',
'".$input['body']."',
'".$input['parentid']."',
'$approval',
'".mysql_escape_string($hash)."',
'".$input['downloadid']."'
)"); [/PHP]
[B]phpMyAdmin:[/B]
ALTER TABLE comments ADD downloadid int(10) NOT NULL DEFAULT 0

[B]comments.class.php (script comentarios):[/B]
[PHP]<div style="color:000000;font-size:11px;font-family:verdana;position:relative;top:17px;left:90px;"><h5>Posteado por '.$begin_a.$row['name'].$end_a.' el '.$timestamp.' (GMT +2)</div>


/*
/ Relative Date / Time Strings
/ Credits: Zach Johnson - www.zachstronaut.com
/ Creditos: Coke
/ Here we convert a the unix timestamp of when the comment was posted
/ to a relative time since that original date/time. (ei. xx hours ago)
*/
public function time_elapsed_string($ptime) {
$diaE = array('Mon'=>'Lunes',
'Tue'=>'Martes',
'Wed'=>'Mi&eacute;rcoles',
'Thu'=>'Jueves',
'Fri'=>'Viernes',
'Sat'=>'S&aacute;bado',
'Sun'=>'Domingo');

$mesE = array('Jan'=>'Enero',
'Feb'=>'Febrero',
'Mar'=>'Marzo',
'Apr'=>'Abril',
'May'=>'Mayo',
'Jun'=>'Junio',
'Jul'=>'Julio',
'Aug'=>'Agosto',
'Sep'=>'Septiembre',
'Oct'=>'Octubre',
'Nov'=>'Noviembre',
'Dec'=>'Diciembre');

$dia = date("D, j M Y @ G:i", $ptime);

$d = date('D', $ptime);
$m = date('M', $ptime);

$fecha = str_replace(array($d, $m), array($diaE[$d], $mesE[$m]), $dia);

return $fecha;
}
} [/PHP]
Wao está desconectado
Respuesta rápida a este mensaje
Responder Citando Subir