');
// calendar div
if ($talker) {
$float="left;";
}
else {
$float="none;";
}
// select list
$db->get_user_stats_drop_down();
$ch_mo = $db->result;
// check if user have some chats
if (count($ch_mo)!=0) {
$html->set_body('
');
// now generate calendar
$db->get_user_stats_calendar($mo);
$result_for_days = $db->result;
$i=0;
// days
foreach($result_for_days as $result) {
$i++;
$days[$i] = str_replace("-","",$result[days]);
}
list($y,$m) = split("-", $mo);
$html->set_body(calendar($db,$user_id,$xmpp_host,$y,$m,$days,TOKEN,$url_key,$left,$right,$selected,$lang,$view_type,1,$null_a=0,$null_b=0,$cal_days,$enc,$months_names,$weekdays));
unset($days);
}
else {
$html->status_message($no_archives[$lang]);
}
// if we got day, lets display chats from that day but only if there are some
if ($tslice) {
$db->get_user_chats($tslice);
$result = $db->result;
if (count($result)>0) {
$display_conversations = true;
}
else{
$display_conversations = false;
}
}
if ($display_conversations === true) {
// we need to sort list by nickname so we need to combine 2 results: roster and mod_logdb chatlist:
foreach($result as $sort_me) {
$roster_name = query_nick_name($ejabberd_roster,$sort_me[username],$sort_me[server_name]);
$arr_key++;
if (!$roster_name) {
// split contact into 2 arrays: one with full jids, second without names - transports, agents..
$sorted_spec[$arr_key] = array(
"roster_name"=>$roster_name,
"username"=>$sort_me[username],
"server_name"=>$sort_me[server_name],
"todaytalk"=>$sort_me[todaytalk],
"server"=>$sort_me[server],
"lcount"=>$sort_me[lcount]
);
}
else {
$sorted_list[$arr_key] = array(
"roster_name"=>$roster_name,
"username"=>$sort_me[username],
"server_name"=>$sort_me[server_name],
"todaytalk"=>$sort_me[todaytalk],
"server"=>$sort_me[server],
"lcount"=>$sort_me[lcount]
);
}
}
// sort and split two lists: normal contacts and special contacts.
asort($sorted_list);
if (!$show_spec) {
$show_spec="1";
}
if ($sorted_spec AND $show_spec === "1") {
if ($sorted_list) {
$sorted_list = array_merge($sorted_list,$sorted_spec);
}
else{
$sorted_list = $sorted_spec;
}
}
$html->set_body('
|
|
|
|
'.$chat_list_l[$lang].' |
|
');
// select chatters
foreach ($sorted_list as $entry) {
$user_name = $entry[username];
$server_name = $entry[server_name];
if ($talker==$entry["todaytalk"] AND $server==$entry[server]) {
$bold_b=" ";
$bold_e="";
$mrk=1;
}
else {
$bold_b="";
$bold_e="";
$mrk=0;
}
$nickname = $entry[roster_name];
if (!$nickname) {
$calday_class="caldays4";
$nickname = $not_in_r[$lang];
$spec_con = ' ('.htmlspecialchars($server_name).')';
unset($malpa);
}
else {
$calday_class="caldays3";
unset($spec_con);
$malpa = "@";
}
if ($mrk==1) {
$db->get_next_prev_day($entry[todaytalk],$entry[server],$tslice,"p");
$previous_t = $db->result->at;
$to_base_prev = $enc->crypt_url("tslice=$previous_t&peer_name_id=$entry[todaytalk]&peer_server_id=$entry[server]");
$db->get_next_prev_day($entry[todaytalk],$entry[server],$tslice,"n");
$next_t = $db->result->at;
$to_base_next = $enc->crypt_url("tslice=$next_t&peer_name_id=$entry[todaytalk]&peer_server_id=$entry[server]");
}
$to_base2 = $enc->crypt_url("tslice=$tslice&peer_name_id=$entry[todaytalk]&peer_server_id=$entry[server]");
if ($mrk==1 AND $previous_t != NULL) {
$html->set_body(' <<< ');
}
$html->set_body(' '.$bold_b.cut_nick($nickname).$bold_e.'');
if ($mrk==1 AND $next_t != NULL) {
$html->set_body(' >>>');
}
if ($spec_con) {
$html->set_body($bold_b.$spec_con.$bold_e);
}
$html->set_body(' ');
}
$html->set_body('
|
|
|
|
|
|
');
}
$html->set_body('');
// Chat thread:
if ($talker) {
$html->set_body(' ');
if (!$start) {
$start="0";
}
$db->get_num_lines($tslice,$talker,$server);
$nume = $db->result->cnt;
if ($start>$nume) {
$start=$nume-$num_lines_bro;
}
$db->get_user_name($talker);
$talker_name = $db->result->username;
$db->get_server_name($server);
$server_name = $db->result->server_name;
$nickname = query_nick_name($ejabberd_roster,$talker_name,$server_name);
if ($nickname === "") {
$nickname=$not_in_r[$lang];
$spec_mark = true;
}
else {
$spec_mark = false;
}
$predefined = $enc->crypt_url("jid=$talker_name@$server_name");
$html->set_body('
|
');
if ($_GET['loc']) {
$loc_id=$_GET['loc'];
if ($loc_id=="2") {
$back_link_message=$chat_map_back[$lang];
$back_link="chat_map.php?chat_map=$predefined";
}
elseif($loc_id=="3") {
$back_link_message=$fav_back[$lang];
$back_link="favorites.php";
}
elseif($loc_id=="4") {
$back_link_message=$myl_back[$lang];
$back_link="my_links.php";
}
$html->set_body(''.$back_link_message.' | | ');
}
if ($resource_id) {
$db->get_resource_name($resource_id);
$res_display = $db->result->resource_name;
$html->set_body(' | ');
}
$action_link = $enc->crypt_url("tslice=$tslice&peer_name_id=$talker&peer_server_id=$server&lnk=$e_string&action=delete");
$sess->set('export_nickname',$nickname); // pass to export
$html->set_body('
|
');
if($db->get_user_chat($tslice,$talker,$server,$resource_id,$start,$num_lines_bro) === false) {
$html->alert_message($oper_fail[$lang]);
}
// processing messages. this should be handled as separate message_processor, so that tree view and calendar view can share the same code withoud redundancy. To be done in 2.0
$result = $db->result;
// some strings to pass to message_processor
$lang_pack = array(
$cont_chat_p[$lang],
$message_type_message[$lang],
$message_type_error[$lang],
$message_type_headline[$lang],
$resource_only[$lang],
$muc_message[$lang],
$my_links_save[$lang],
$verb_h[$lang],
$in_min[$lang],
$cont_chat[$lang]
);
// Sent all data to parsing function (message processor)
if (message_processor($tslice,$server_name,$start,$nickname,$result,$db,$html,$enc,TOKEN,$split_line,$lang_pack,$lang,$spec_mark,$e_string,$to_base_prev,$to_base_next) !== true) {
$html->alert_message($oper_fail[$lang]);
$html->destroy_content();
}
// limiting code
$html->set_body(' | ');
// limiting code - end
if (($nume-$start)>40) {
$html->set_body(''.$back_t[$lang].' | ');
}
$html->set_body('
| ');
}
$html->set_body(' ');
require_once("footer.php");
?>
|