/* 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"); $tgle = $_POST['toggle']; $vspec = $_POST['v_spec']; // Check post data. Compare them to session info. if ($_POST['del_all'] OR $_POST['erase_confirm']) { debug(DEBUG,"Processing archive removal:"); if ($sess->get('validate_number') !== $_POST['validate_form']) { debug(DEBUG," - Invalid control number, destroying POST data. Control should be: ".$sess->get('validate_number')); unset($_POST); $html->alert_message($oper_fail[$lang]); } else{ debug(DEBUG," - POST data seems to be ok."); } } // Generate new control data for forms $set_control = md5(rand(10000,10000000)); $sess->set("validate_number",$set_control); debug(DEBUG,"Setting new control data: $set_control"); // toggle message saving if ($tgle) { debug(DEBUG,"Trying to change archiving option"); if ($tgle === $arch_on[$lang]) { if($db->set_log(true) === true) { $sess->set('log_status',true); $db->set_logger("7","1"); $html->status_message($status_msg2[$lang]); } else{ $html->alert_message($oper_fail[$lang]); } } elseif($tgle === $arch_off[$lang]) { if($db->set_log(false) === true) { $sess->set('log_status',false); $db->set_logger("6","1"); $html->status_message($status_msg3[$lang]); $html->system_message($status_msg1[$lang]); } else{ $html->alert_message($oper_fail[$lang]); } } } // Control diplaying of special contacs if ($vspec) { if ($db->set_jorge_pref("3",$vspec) === true) { $html->status_message($con_saved[$lang]); } else{ $html->alert_message($oper_fail[$lang]); } } // delete entire archive if ($_POST['erase_confirm'] === "true") { if ($_POST['del_all'] === $settings_del[$lang]) { debug(DEBUG," - Trying to erase all message archives"); if ($db->erase_all() === true) { $html->status_message($deleted_all[$lang]); $db->set_logger("9","2"); debug(DEBUG," - DONE"); } else{ $html->alert_message($delete_error[$lang]); debug(DEBUG," - FAILED"); } } } // set own name if ($_POST['own_name_value']) { // Validation is done by class, so we pass values there... if ($db->set_own_name($_POST['own_name_value']) === true) { $html->status_message($con_saved[$lang]); }else{ $html->alert_message($oper_fail[$lang]); } } $html->set_overview('
'.$stats_personal[$lang].' '.$total_messages.'
'.$stats_personal_top[$lang].''.$stats_personal_count[$lang].' | '.$stats_peer[$lang].' | '.$stats_when[$lang].' |
'.$result[count].' | '.$nickname.' ('.htmlspecialchars($user_name).'@'.htmlspecialchars($server_name).') | '.$result[at].' |