/* 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. */ if (__FILE__==$_SERVER['SCRIPT_FILENAME']) { header("Location: index.php?act=logout"); exit; } // If user have profile if ($sess->get('log_status') === null) { header ("Location: not_enabled.php"); exit; } // number of my links saved... $db->get_mylinks_count(); $my_links_count = $db->result->cnt; // number of items in trash $db->get_trash_count(); $tr_n = $db->result->cnt; // number of favorites $db->get_favorites_count(); $favorites_count = $db->result->cnt; // get preferences for saving $pref_id=$_GET['set_pref']; $pref_value=$_GET['v']; // save preferences ONLY. Setting language in session is done in headers, here we only save that preferences. if ($_GET['set_pref']) { // Language selection if ($pref_id === "2") { //Rewrite array for late reuse $language_change = $language_support; // Here the $pref_value is actually $lng_sw $pref_value = $_GET['lng_sw']; while(array_keys($language_change)) { $lang_key = key($language_change); if (in_array($pref_value,$language_change[$lang_key])) { debug(DEBUG,"Saving language preferences into database..."); if ($db->set_jorge_pref($pref_id,$pref_value) === false) { $html->alert_message($oper_fail[$lang],"message"); debug(DEBUG,"Preferences not saved due to error"); } else{ $html->status_message($con_saved[$lang]); debug(DEBUG,"Preferences saved successfuly"); } break 1; } array_shift($language_change); } } // default view type if ($pref_id ==="1") { debug(DEBUG,"Saving view selection into database"); if($pref_value === "1" OR $pref_value === "2") { if ($db->set_jorge_pref($pref_id,$pref_value) === false) { $html->alert_message($oper_fail[$lang],"message"); debug(DEBUG,"Preferences not saved due to error"); } else{ // Display status message only if setting via control panel if ($_GET['ref'] === "settings") { $html->status_message($con_saved[$lang]); debug(DEBUG,"Preferences saved successfuly"); } } $sess->set('view_type',$pref_value); } } } // get preferences, if not set, fallback to standard view. $view_type=$sess->get('view_type'); if ($view_type=="1") { $view_type="main.php"; } elseif($view_type=="2") { $view_type="calendar_view.php"; } // this is menu. not nice but works ;) if (preg_match("/search_v2.php/i",$location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; $search_loc=1; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/main.php/i",$location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/my_links.php/i",$location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.') '; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/help.php/i",$location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/contacts.php/i", $location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/stats.php/i", $location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/logger.php/i", $location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/trash.php/i", $location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/calendar_view.php/i", $location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/chat_map.php/i", $location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/settings.php/i", $location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } elseif(preg_match("/favorites.php/i", $location)) { $menu_main=''.$menu_item_browser[$lang].''; $menu_map=''.$menu_item_map[$lang].''; $menu_search=''.$menu_item_search[$lang].''; $menu_mylinks=''.$menu_item_links[$lang].' ('.$my_links_count.')'; $menu_favorites=''.$menu_item_fav[$lang].'('.$favorites_count.')'; $menu_contacts=''.$menu_item_contacts[$lang].''; $menu_logger=''.$menu_item_logs[$lang].''; $menu_trash=''.$menu_item_trash[$lang].'('.$tr_n.')'; if (TOKEN==ADMIN_NAME) { $menu_stats=' | Stats'; } } // check if archivization is currently enabled... if ($sess->get('log_status') === false) { $html->system_message($status_msg1[$lang]); } if ($start) { $cur_loc="&start=$start"; } // Show special contact? $db->get_jorge_pref("3"); $show_spec = $db->result->pref_value; // Display special contacts? if ($show_spec === "2") { $db->spec_ignore(true); } else { $db->spec_ignore(false); } //Generate quick jump $db->get_last_day(); $ql_date = $db->result->at; $quick_link = $enc->crypt_url("tslice=$ql_date"); $html->menu('
⇐
'.TOKEN.'@'.XMPP_HOST.' |
'.$menu_item_panel[$lang].' |
'.$sel_client[$lang].' |
'.$help_but[$lang].' | '.$log_out_b[$lang].' |
||||||||||
'); if ($mac_user === true) { $html->menu(' | '); } $html->menu(' | |||||||||
'.$menu_main.' | ' .$menu_map.' | ' .$menu_favorites.' | ' .$menu_mylinks.' | ' .$menu_search.' | ' .$menu_contacts.' | ' .$menu_logger.$menu_stats.' | ' .$menu_trash. ' | '.$refresh[$lang].' |
'.$alert.'
'); // Get user roster. $rpc_roster = $ejabberd_rpc->get_roster(); // creater roster object and rewrite it to portable multidimentional array $ejabberd_roster = new roster(); foreach ($rpc_roster as $roster_record) { if ($roster_record[group]=="") { $roster_record[group] = $con_no_g[$lang]; } // avoid contacts without nick if ($roster_record[nick]!="") { $ejabberd_roster->add_item($roster_record[jid],$roster_record[nick],$roster_record[group]); } } ?>