/*
Jorge - frontend for mod_logdb - ejabberd server-side message archive module.
Copyright (C) 2009 Zbigniew Zolkiewski
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
require_once("headers.php");
require_once("upper.php");
$html->set_overview('
'.$trash_name[$lang].'
'.$trash_desc[$lang].'');
if ($enc->decrypt_url($_GET[a]) === true) {
$tslice = $enc->tslice;
$talker = $enc->peer_name_id;
$server = $enc->peer_server_id;
$action = $enc->action;
$lnk = $enc->lnk;
}
else {
$action = null;
}
if ($_GET['idx']) {
$idx = $_GET['idx'];
if ($enc->decrypt_url($idx) === true) {
if($db->set_ext_index($enc->single) !== true) {
unset($idx);
unset($action);
}
$idx = $enc->single;
}
else{
unset($idx);
unset($action);
}
}
if ($action=="undelete") {
if ($db->move_chat_from_trash($talker,$server,$tslice,$lnk,$idx) === true) {
$back_link = $enc->crypt_url("tslice=$tslice&peer_name_id=$talker&peer_server_id=$server");
$html->status_message($undo_info[$lang].'
'.$trash_vit[$lang].'');
// number of items in trash
$db->get_trash_count();
$tr_n = $db->result->cnt;
}
else
{
unset($talker);
$html->alert_message($oper_fail[$lang]);
}
}
if ($action==="delete") {
if ($db->remove_messages_from_trash($talker,$server,$tslice) === true) {
$html->status_message($del_info[$lang]);
// number of items in trash
$db->get_trash_count();
$tr_n = $db->result->cnt;
}
else {
$html->alert_message($oper_fail[$lang]);
}
}
if ($tr_n < 1) {
$html->set_body(''.$trash_empty[$lang].'
' );
}
else
{
$html->set_body('
|
');
$db->get_trashed_items();
$result = $db->result;
foreach ($result as $entry) {
$db->get_user_name($entry[peer_name_id]);
$talker = $db->result->username;
$db->get_server_name($entry[peer_server_id]);
$server_name = $db->result->server_name;
$tslice = $entry["date"];
$nickname = query_nick_name($ejabberd_roster,$talker,$server_name);
if (!$nickname) {
$nickname = $not_in_r[$lang];
unset($malpa);
}
else {
$malpa = "@";
}
$reconstruct_link = $enc->crypt_url("tslice=$tslice&peer_name_id=$entry[peer_name_id]&peer_server_id=$entry[peer_server_id]");
$undelete_link = $enc->crypt_url("tslice=$tslice&peer_name_id=$entry[peer_name_id]&peer_server_id=$entry[peer_server_id]&lnk=$reconstruct_link&action=undelete");
$delete_link = $enc->crypt_url("tslice=$tslice&peer_name_id=$entry[peer_name_id]&peer_server_id=$entry[peer_server_id]&lnk=$reconstruct_link&action=delete");
$idx = $enc->crypt_url("single=".$entry[idx]."");
$html->set_body('
'.$nickname.' ('.htmlspecialchars($talker).$malpa.htmlspecialchars($server_name).') |
'.$tslice.' |
'.$entry[timeframe].' |
'.$trash_undel[$lang].' |
'.$trash_del[$lang].' |
');
}
$html->set_body('
|
');
}
require_once("footer.php");
?>