/*
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");
$tigger = $_POST['trigger'];
$desc = $_POST['desc'];
$del = $_GET['del'];
$link_id = $_GET['link_id'];
if ($_GET[a]) {
if ($enc->decrypt_url($_GET[a]) === true) {
$variables[tslice] = $enc->tslice;
$variables[peer_name_id] = $enc->peer_name_id;
$variables[peer_server_id] = $enc->peer_server_id;
$variables[lnk] = $enc->lnk;
$variables[linktag] = $enc->linktag;
$variables[strt] = $enc->strt;
$variables[ismylink] = $enc->ismylink;
}
else {
unset($variables);
}
}
if ($del === "t") {
if ($db->del_mylink($link_id) === true) {
$html->status_message($my_links_removed[$lang]);
// recount number of links
$db->get_mylinks_count();
$my_links_count = $db->result->cnt;
}
else {
$html->alert_message($oper_fail[$lang]);
}
}
if ($tigger === $my_links_commit[$lang]) {
if ($enc->decrypt_url($_POST[hidden_field]) === true) {
$peer_name_id = $enc->peer_name_id;
$peer_server_id = $enc->peer_server_id;
$datat = $enc->tslice;
$lnk = $enc->lnk;
$strt = $enc->strt;
$linktag = $enc->linktag;
$link = $lnk."&start=$strt#$linktag";
if ($desc === $my_links_optional[$lang]) {
$desc = $my_links_none[$lang];
}
$desc = substr($desc,0,120);
if($db->add_mylink($peer_name_id,$peer_server_id,$datat,$link,$desc) === true) {
$html->status_message($my_links_added[$lang].'
'.$my_links_back[$lang].'');
// recount number of links
$db->get_mylinks_count();
$my_links_count = $db->result->cnt;
}
else{
$html->alert_message($oper_fail[$lang]);
}
}
}
if ($variables[ismylink] === "1") {
$db->get_server_name($enc->peer_server_id);
$sname = $db->result->server_name;
$db->get_user_name($enc->peer_name_id);
$uname = $db->result->username;
$nickname=query_nick_name($ejabberd_roster,$uname,$sname);
$jid=''.$uname.'@'.$sname.'';
$hidden_fields = $enc->crypt_url("tslice=$enc->tslice&peer_name_id=$variables[peer_name_id]&peer_server_id=$variables[peer_server_id]&lnk=$variables[lnk]&strt=$variables[strt]&linktag=$variables[linktag]");
if (!$nickname) {
$nickname = $not_in_r[$lang];
$jid = $sname;
}
$html->set_body('
'.$my_links_link[$lang].' | '.$my_links_chat[$lang].' | '.$my_links_desc[$lang].' | |
'.verbose_date($entry['datat'],$months_names).' | '.cut_nick(htmlspecialchars($nickname)).' ('.htmlspecialchars($jid).') | '.$desc.' | '.$del_my_link[$lang].' |