¿Alguien sabe como hacer para que se borre pa siempre?
jquery.module.php
Código PHP:
function comment_delete($comment_id) {
global $client, $config;
if (!$client['id']) die('please login first');
$res = sql_query("select * from ".tb()."comments where id='$comment_id'");
$comment = sql_fetch_array($res);
if (!$comment['id']) die('wrong sid');
if ($comment['uid'] == $client['id'] || in_array('3',$client['roles']) ) {
sql_query("update ".tb()."comments set hide=1 where id='{$comment['id']}'");
echo 'ok';
}
else {
echo 'access denied';
}
exit;
}
Código PHP:
$res = sql_query("select c.*,u.username,u.avatar, u.fullname from ".tb()."comments as c left join ".tb()."accounts as u on u.id=c.uid where c.stream_id='{$target_id}' and hide = 0 order by id asc");
Código PHP:
$("a[class=stream_delete]").click( function () {
var parentdd = $(this).parents(".user_post_1");
var sid = $(this).prev()[0].value;
$(this).after("<img src=\''.uhome().'/files/loading.gif\' /> hiding..");
$(this).hide();
$.get(''.uhome()./index.php?p=jquery/stream_delete/+sid, function(data) {
parentdd.hide("slow");
});
return false;
});
Código PHP:
function comment_display($row = array()) {
global $client;
$hidelink = ($row['uid'] == get_client('id') || in_array('3',get_client('roles')))?'<input type="hidden" name="commentid" value="'.$row["id"].'" /><a href="#" class="comment_delete">X</a>':'';
$res = sql_query("select * from ".tb()."accounts where username='{$row['username']}'");
$author = sql_fetch_array($res);
if (!$author['avatar'])
$row['avatar'] = 'undefined.jpg';
else
$row['avatar'] = $author['avatar'];
$row['fullname'] = $author['fullname'];
if ($author['disabled'] == 3)
return '';
if ($client['id'] && $row['username'] != $client['username']) {
$quick_reply = '<a href="#" uname="'.$row['username'].'" class="quick_reply">+'.t('Reply').'</a>';
}
return '
<div class="user_comment">
<table width="100%">
<tr>
<td class="user_post_left" width="40" valign="top">'.avatar($row,25).'</td>
<td class="user_post_right" valign="top">
<strong>'.url('u/'.$row['username'], $row['username']).'</strong>:
'.$row['message'].' '.$quick_reply.'
<div class="att_bottom">'.get_date($row['created']).' '.$row['pending_review'].' '.
url('report',t('report'),'',array('url'=>url('feed/view/'.$row['id']))).'
</div></td>
<td value="top" width="5px">'.$hidelink.'</td>
</tr>
</table>
</div>
';
}