Exemplo n.º 1
0
     $predefined = "{$jid}";
     $predefined = encode_url($predefined, $token, $url_key);
     $predefined_s = "from:{$jid}";
     $predefined_s = encode_url($predefined_s, $token, $url_key);
     if (in_array($jid, $do_notlog_list) == TRUE) {
         $selected = "selected";
     } else {
         $selected = "";
     }
     if ($selected != "") {
         $col = "b7b7b7";
     }
     print '<tr bgcolor="' . $col . '" onMouseOver="this.bgColor=\'c3d9ff\';" onMouseOut="this.bgColor=\'#' . $col . '\';">' . "\n";
     print '<td title="' . $con_title[$lang] . '" style="padding-left:7px" onclick="window.location=\'chat_map.php?chat_map=' . $predefined . '\';"><b>' . cut_nick(htmlspecialchars($nick)) . '</b></td>' . "\n";
     print '<td>(<i>' . htmlspecialchars($jid) . '</i>)</td>' . "\n";
     print '<td style="text-align: center;">' . cut_nick(htmlspecialchars($grp)) . '</td>' . "\n";
     print '<td style="text-align: center;"><a href="chat_map.php?chat_map=' . $predefined . '"><u>' . $show_chat_as_map[$lang] . '</u></a>|<a href="search_v2.php?b=' . $predefined_s . '"><u>' . $show_chat_stream[$lang] . '</u></a></td>';
     print '<td style="text-align: center;">' . "\n";
     // temporary solution we should put integers here instead of full jids
     $prepared_jid = str_replace("+", "kezyt2s0", base64_encode($jid));
     print '<select class="cc2" name="' . $prepared_jid . '">' . "\n";
     print '<option value="y">' . $con_tab_act_y[$lang] . '</option>' . "\n";
     print '<option value="n" ' . $selected . ' >' . $con_tab_act_n[$lang] . '</option>' . "\n";
     print '</select>' . "\n";
     print '</td>' . "\n";
     print '</tr>' . "\n";
 }
 print '<tr class="spacer"><td colspan="5"></td></tr>' . "\n";
 print '</tbody>' . "\n";
 print '<tr class="foot"><td colspan="5" style="text-align: center;">' . "\n";
 print '<input class="submit" type="submit" value="' . $con_tab_submit[$lang] . '"></td></tr>' . "\n";
Exemplo n.º 2
0
        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('<tr><td colspan="2" class="message"><a href="' . $back_link . '">' . $back_link_message . '</a></td><td></td></tr>');
    }
    if ($resource_id) {
        $db->get_resource_name($resource_id);
        $res_display = $db->result->resource_name;
        $html->set_body('<tr><td colspan="4"><div style="background-color: #fad163; text-align: center; font-weight: bold;">' . $resource_warn[$lang] . cut_nick(htmlspecialchars($res_display)) . '. ');
        $html->set_body($resource_discard[$lang] . '<a class="export" href="?a=' . $e_string . '">' . $resource_discard2[$lang] . '</a></div></td></tr>');
    }
    $action_link = $enc->crypt_url("tslice={$tslice}&peer_name_id={$talker}&peer_server_id={$server}&lnk={$e_string}&action=delete");
    $html->set_body('<tr style="background-image: url(img/bar_bg.png); background-repeat:repeat-x;">
			<td><b> ' . $time_t[$lang] . ' </b></td><td><b> ' . $user_t[$lang] . ' </b></td><td><b> ' . $thread[$lang] . '</b></td>
			<td align="right" style="padding-right: 5px; font-weight: normal;">
			');
    // check favorite
    $db->check_favorite($talker, $server, $tslice);
    if ($db->result->cnt < 1) {
        $html->set_body('
					<form style="margin-bottom: 0;" action="favorites.php" method="post">
					<input type="hidden" name="a" value="' . $_GET[a] . '">
					<input type="hidden" name="init" value="1">
					<input class="fav_main" type="submit" value="' . $fav_add[$lang] . '">
Exemplo n.º 3
0
            $body_talk = wordwrap(str_replace("\n", "<br>", htmlspecialchars(base64_decode($dat["body"]))), 107, "<br>", true);
            // advise user if chat is deleted. Extension=1 stands for "Chat temporary deleted" or "Chat awaiting deletion"
            if ($dat[ext] == 1) {
                $html->set_body('<tr bgcolor="b5b5b5"><td colspan="4" style="text-align: center; font-weight: bold;">' . $marked_as_d[$lang] . '</td></tr>');
            }
            // opening line
            if ($dat[ext] != 1) {
                $html->set_body('<tr id="pretty" title="' . $jid . '@' . htmlspecialchars($sname) . '" 
						style="cursor: pointer;" bgcolor="' . $col . '" onclick="window.location=\'' . $view_type . '?a=' . $to_base . '\'" 
						onMouseOver="this.bgColor=\'c3d9ff\';" onMouseOut="this.bgColor=\'#' . $col . '\';">');
            } else {
                $html->set_body('<tr id="pretty" title="' . $jid . '@' . htmlspecialchars($sname) . '" style="cursor: pointer;" bgcolor="b5b5b5" onclick="window.location=\'trash.php\'">');
            }
            // content
            $html->set_body('<td width="120" style="text-align: center;">' . $dat["ts"] . '</td>
					<td style="text-align: left;">' . $fr . '&nbsp;&nbsp;' . cut_nick($talk) . '&nbsp;&nbsp;</td>
					<td width="700">' . $body_talk . '</td>
					<td style="text-align: center;">' . round($dat[score], 2) . '</td>
					</tr>');
        }
        $html->set_body('<tr class="spacer" height="1px"><td colspan="5"></td></tr><tr class="foot" height="15px"><td colspan="5"></td></tr>');
    }
    if ($a == $b) {
        $html->set_body('<tr><td colspan="4" style="text-align: center;"><b>' . $no_result[$lang] . '</b></td></tr>');
    }
    $html->set_body('</table>');
} else {
    // if user input is empty:
    $html->set_body('<br><br><center><b>' . $search1[$lang] . '</b></center><br><br><br><br>');
}
require_once "footer.php";
Exemplo n.º 4
0
 print '<td class="time_chat" style="padding-left: 10px; padding-right: 10px;";>' . $ts . '</td>' . "\n";
 if ($entry["direction"] == "from") {
     $out = $nickname;
     $tt = $tt + 1;
     $aa = 0;
 } else {
     $out = $token;
     $aa = $aa + 1;
     $tt = 0;
 }
 if ($aa < 2 and $tt < 2) {
     print '<td style="padding-left: 5px; padding-right: 10px; nowrap="nowrap">' . cut_nick(htmlspecialchars($out));
     print '<a name="' . $licz . '"></a>';
     if ($out != $token) {
         print '<br><div style="text-align: left; padding-left: 5px;"><a class="export" id="pretty" title="' . $resource_only[$lang] . '" href="?a=' . $e_string . '&b=' . $entry[peer_resource_id] . '">';
         print '<small><i>' . cut_nick(htmlspecialchars($resource)) . '</i></small></a></div>';
     }
     print '</td>' . "\n";
     $here = "1";
 } else {
     print '<td style="text-align: right; padding-right: 5px">-</td>' . "\n";
     $here = "0";
 }
 $new_s = htmlspecialchars($entry["body"]);
 $to_r = array("\n");
 $t_ro = array("<br>");
 $new_s = str_replace($to_r, $t_ro, $new_s);
 $new_s = wordwrap($new_s, 107, "<br>", true);
 $new_s = new_parse_url($new_s);
 print '<td width="800" colspan="3">' . $new_s . '</td>' . "\n";
 $lnk = encode_url("{$tslice}@{$entry['peer_name_id']}@{$entry['peer_server_id']}@", $ee, $url_key);
Exemplo n.º 5
0
				<tr class="spacer" height="1px"><td colspan="4"></td></tr>
				<tbody id="searchfield">
			');
    $db->get_mylink();
    $result = $db->result;
    foreach ($result as $entry) {
        $db->get_user_name($entry[peer_name_id]);
        $peer_name = $db->result->username;
        $db->get_server_name($entry[peer_server_id]);
        $peer_server = $db->result->server_name;
        $nickname = query_nick_name($ejabberd_roster, $peer_name, $peer_server);
        $desc = htmlspecialchars($entry[description]);
        $jid = $peer_name . '@' . $peer_server;
        if (!$nickname) {
            $nickname = $not_in_r[$lang];
            $jid = $peer_server;
        }
        $html->set_body('
					<tr style="cursor: pointer;" bgcolor="#e8eef7" onMouseOver="this.bgColor=\'c3d9ff\';" onMouseOut="this.bgColor=\'#e8eef7\';">
					<td onclick="window.location=\'' . $view_type . '?loc=4&a=' . $entry['link'] . '\';" style="padding-left: 10px; padding-right: 10px">' . verbose_date($entry['datat'], $months_names) . '</td>
					<td onclick="window.location=\'' . $view_type . '?loc=4&a=' . $entry['link'] . '\';">&nbsp;<b>' . cut_nick(htmlspecialchars($nickname)) . '</b> (' . htmlspecialchars($jid) . ')&nbsp;</td>
					<td onclick="window.location=\'' . $view_type . '?loc=4&a=' . $entry['link'] . '\';">&nbsp;' . $desc . '</td>
					<td><a href="my_links.php?del=t&link_id=' . $entry[id_link] . '" onClick="if (!confirm(\'' . $del_conf_my_link[$lang] . '\')) return false;" >&nbsp;' . $del_my_link[$lang] . '&nbsp;</a></td>
					</tr>
				');
    }
    $html->set_body('
				</tbody><tr class="spacer"><td colspan="4"></td></tr><tr class="foot"><td colspan="4" height="15"></td></tr></table></center>
			');
}
require_once "footer.php";
Exemplo n.º 6
0
function message_processor($tslice, $server_name, $start, $nickname, $result_messages, $db, $html, $enc, $token, $split_line, $lang_pack, $lang, $spec_mark, $e_string, $to_base_prev, $to_base_next)
{
    /* 
    	This function perform message processing for message archives
    	tslice - date of chat
    	server_name - name of server
    	start - from what point of time of day should chat be displayed
    	nickname - peer nickname
    	result_messages - array of messages to be parsed
    	db - database object
    	html - html object
    	enc - encryption object
    	token - owner name
    	split_line - config option
    	lang_pack - array of translations
    	lang - language pack
    	spec_mark - marker used to distinguish what we are doing
    	e_string - url 
    */
    // Check if user have set up OwnName
    $db->get_own_name();
    if ($db->result->own_name) {
        $own_name = $db->result->own_name;
    } else {
        $own_name = false;
    }
    // Main loop
    foreach ($result_messages as $entry) {
        // always get resource_id if message is type of groupchat
        if ($entry[type] !== "groupchat") {
            if ($resource_last !== $entry[peer_resource_id]) {
                if ($db->get_resource_name($entry[peer_resource_id]) === false) {
                    return false;
                }
                $resource = $db->result->resource_name;
            }
        } else {
            if ($db->get_resource_name($entry[peer_resource_id]) === false) {
                return false;
            }
            $resource = $db->result->resource_name;
        }
        $resource_last = $entry[peer_resource_id];
        $licz++;
        // marking messages
        if ($entry["type"] === "chat" or $entry["type"] == "") {
            if ($entry["direction"] === "to") {
                $col = "main_row_a";
            } else {
                $col = "main_row_b";
            }
        } elseif ($entry["type"] === "error") {
            $col = "main_row_error";
        } elseif ($entry["type"] === "normal") {
            $col = "main_row_message";
        } elseif ($entry["type"] === "headline") {
            $col = "main_row_headline";
        }
        $ts = strstr($entry["ts"], ' ');
        // time calc
        $pass_to_next = $entry["ts"];
        $new_d = $entry["ts"];
        $time_diff = abs(strtotime("{$old_d}") - strtotime(date("{$new_d}")));
        $old_d = $pass_to_next;
        // end time calc
        if ($time_diff > $split_line and $licz > 1) {
            $in_minutes = round($time_diff / 60, 0);
            $html->set_body('<tr class="splitl">
							<td colspan="7" style="font-size: 10px;"><i>' . verbose_split_line($in_minutes, $lang_pack[7], $lang_pack[8]) . '</i>
							<hr size="1" noshade="noshade" style="color: #cccccc;"></td></tr>
						');
        }
        // check if chat is continuation from previous day (work only for calendar view)
        if ($to_base_prev !== NULL) {
            if ($ts_mark != "1" and substr($ts, 0, strpos($ts, ":")) == 00) {
                if (check_thread($db, $talker, $server, $tslice, $xmpp_host, 2) === true) {
                    $html->set_body('<tr><td colspan="6" style="text-align: left; padding-left: 5px;" class="message"><a href="calendar_view.php?a=' . $to_base_prev . '">' . $lang_pack[0] . '</a></td></tr>');
                }
                // check only first line
                $ts_mark = "1";
            }
        }
        // run code only if type is not groupchat
        if ($entry["type"] !== "groupchat") {
            // setting subject
            if ($col === "main_row_message" or $col === "main_row_headline") {
                if ($entry["subject"]) {
                    $subject = ": " . $entry["subject"];
                } else {
                    unset($subject);
                }
            }
            // add line in case of special message
            if ($col === "main_row_message") {
                $html->set_body('<tr class="main_row_message"><td colspan="7" class="main_row_special">' . $lang_pack[1] . ' ' . htmlspecialchars($subject) . '</td></tr>');
            }
            if ($col === "main_row_error") {
                $html->set_body('<tr class="main_row_error"><td colspan="7" class="main_row_special">' . $lang_pack[2] . '</td></tr>');
            }
            if ($col === "main_row_headline") {
                $html->set_body('<tr class="main_row_headline"><td colspan="7" class="main_row_special">' . $lang_pack[3] . ' ' . htmlspecialchars($subject) . '</td></tr>');
            }
        }
        // calculate chat direction, whether to display nick...
        if ($entry["direction"] == "from") {
            $out = $nickname;
            $tt = $tt + 1;
            $aa = 0;
        } else {
            $out = $token;
            $aa = $aa + 1;
            $tt = 0;
        }
        // timestamp, beginning of the chatline
        if ($entry["type"] !== "groupchat") {
            $html->set_body('<tr class="' . $col . '"><td class="time_chat" style="padding-left: 10px; padding-right: 10px;";>' . $ts . '</td>');
        } else {
            if ($out !== $token) {
                // colorize
                if ($resource_group === $resource or !$resource_group) {
                    if (!$col) {
                        $col = "main_row_group_to";
                    }
                    $col = $col;
                } else {
                    if ($col === "main_row_group_from") {
                        $col = "main_row_group_to";
                    } else {
                        $col = "main_row_group_from";
                    }
                }
                $html->set_body('<tr class="' . $col . '"><td class="time_chat" style="padding-left: 10px; padding-right: 10px;";>' . $ts . '</td>');
            }
        }
        // different bahaviour for groupchat and other messages
        if ($entry["type"] !== "groupchat") {
            if ($aa < 2 and $tt < 2) {
                $html->set_body('<td style="padding-left: 5px; padding-right: 10px; nowrap="nowrap">');
                if ($out === TOKEN) {
                    // display of Own Name
                    if ($own_name !== false) {
                        $html->set_body(cut_nick(htmlspecialchars($own_name)));
                    } else {
                        $html->set_body(cut_nick(htmlspecialchars($out)));
                    }
                } else {
                    $html->set_body(cut_nick(htmlspecialchars($out)));
                }
                $html->set_body('<a name="' . $licz . '"></a>');
                if ($out !== $token) {
                    if ($spec_mark === false) {
                        $html->set_body('
											<br><div style="text-align: left; padding-left: 5px;">
											<a class="export" id="pretty" title="' . $lang_pack[4] . '" href="?a=' . $e_string . '&amp;b=' . $entry[peer_resource_id] . '">
                                							<small><i>' . cut_nick(htmlspecialchars($resource)) . '</i></small></a></div>
											');
                    } else {
                        $html->set_body('<br><div style="text-align: left; padding-left: 5px;">
											<small><i>' . cut_nick(htmlspecialchars($server_name)) . '</i></small></div>
											');
                    }
                }
                $html->set_body('</td>');
                $here = "1";
            } else {
                $html->set_body('<td style="text-align: right; padding-right: 5px">-</td>');
                $here = "0";
            }
        } else {
            // do not display own chats sent to MUC. Here resource is actualy nickname as MUC standard specify
            if ($out !== $token) {
                if ($resource_group !== $resource) {
                    // if message is sent without resource, that must be channel message, advise user.
                    if ($resource === "") {
                        $resource = $lang_pack[5];
                    }
                    $html->set_body('<td style="padding-left: 5px; padding-right: 10px; nowrap="nowrap"><small>MUC: <i>' . cut_nick($out) . '</i></small><a name="' . $licz . '"></a>
                                					<br><div style="text-align: left; padding-left: 5px;">' . cut_nick(htmlspecialchars($resource)) . '</div></td>
									');
                    $here = "1";
                    $resource_group = $resource;
                } else {
                    $html->set_body('<td style="text-align: right; padding-right: 5px">-</td>');
                    $here = "0";
                }
            } else {
                $here = "0";
            }
        }
        // process body part, do not show chat if message is type of groupchat
        // this is sadly funny i write this 'if' and i dont know what exacly it do :/
        if ($out !== $token or $entry["type"] !== "groupchat") {
            // prepare body
            $new_s = htmlspecialchars($entry["body"]);
            $to_r = array("\n");
            $t_ro = array("<br>");
            $new_s = str_replace($to_r, $t_ro, $new_s);
            $new_s = wordwrap($new_s, 107, "<br>", true);
            $new_s = new_parse_url($new_s);
            $html->set_body('<td width="800" colspan="3">' . $new_s . '</td>');
            // generate mylink only on selected lines
            if ($here === "1") {
                $lnk = $enc->crypt_url("tslice={$tslice}&peer_name_id={$entry['peer_name_id']}&peer_server_id={$entry['peer_server_id']}");
                $to_base2 = $enc->crypt_url("tslice={$tslice}&peer_name_id={$entry['peer_name_id']}&peer_server_id={$entry['peer_server_id']}&ismylink=1&linktag={$licz}&lnk={$lnk}&strt={$start}");
                $html->set_body('<td colspan="2" style="padding-left: 2px; font-size: 9px;"><a style="color: #1466bc" href="my_links.php?a=' . $to_base2 . '">' . $lang_pack[6] . '</a></td>');
            } else {
                $html->set_body('<td></td>');
            }
            if ($t = 2) {
                $c = 1;
                $t = 0;
            }
            // WTF!?
            $html->set_body('</tr>');
        }
    }
    $html->set_body('</tbody>');
    // Check thread. Work only for calendar view.
    if ($to_base_next !== NULL) {
        if (substr($ts, 0, strpos($ts, ":")) == 23 and date("Y-n-j") !== $tslice) {
            if (check_thread($db, $talker, $server, $tslice, $xmpp_host, 1) === true) {
                $html->set_body('<tr><td colspan="6" style="text-align: right; padding-right: 5px;" class="message"><a href="calendar_view.php?a=' . $to_base_next . '">' . $lang_pack[9] . '</a></td></tr>');
            }
        }
    }
    return true;
}
Exemplo n.º 7
0
        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('<tr><td colspan="2" class="message"><a href="' . $back_link . '">' . $back_link_message . '</a></td><td></td></tr>');
    }
    if ($resource_id) {
        $db->get_resource_name($resource_id);
        $res_display = $db->result->resource_name;
        $html->set_body('<tr><td colspan="4"><div style="background-color: #fad163; text-align: center; font-weight: bold;">' . $resource_warn[$lang] . cut_nick(htmlspecialchars($res_display)) . '. ' . $resource_discard[$lang] . '<a class="export" href="?a=' . $e_string . '">' . $resource_discard2[$lang] . '</a></div></td></tr>');
    }
    $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('
        		<tr class="header">
        		<td><b> ' . $time_t[$lang] . ' </b></td><td><b> ' . $user_t[$lang] . ' </b></td><td><b> ' . $thread[$lang] . '</b></td>
        		<td align="right" style="padding-right: 5px; font-weight: normal;">
			');
    // check favorite
    $db->check_favorite($talker, $server, $tslice);
    if ($db->result->cnt < 1) {
        $html->set_body('
					<form style="margin-bottom: 0;" action="favorites.php" method="post">
					<input type="hidden" name="a" value="' . $_GET[a] . '">
Exemplo n.º 8
0
        $nickname = query_nick_name($ejabberd_roster, $user_name, $server_name);
        $to_base = $enc->crypt_url("tslice={$row['tslice']}&peer_name_id={$row['peer_name_id']}&peer_server_id={$row['peer_server_id']}");
        if (!$row[comment] or $row[comment] == $my_links_optional[$lang]) {
            $comment = $fav_nocomm[$lang];
        } else {
            $comment = htmlspecialchars($row[comment]);
            $comment = str_replace("\n", "<br>", $comment);
            $comment = wordwrap($comment, 30, "<br>", true);
        }
        if (!$nickname) {
            $nickname = $not_in_r[$lang];
            unset($malpa);
        } else {
            $malpa = "@";
        }
        $html->set_body('
				<tr style="cursor: pointer;" bgcolor="#e8eef7" onMouseOver="this.bgColor=\'c3d9ff\';" onMouseOut="this.bgColor=\'#e8eef7\';">
				<td onclick="window.location=\'' . $view_type . '?a=' . $to_base . '&loc=3\';" style="padding-left: 10px; padding-right: 10px">' . verbose_date($row[tslice], $months_names, $weekdays) . '</td>
				<td onclick="window.location=\'' . $view_type . '?a=' . $to_base . '&loc=3\';" style="padding-left: 10px; padding-right: 10px">
					<b>' . htmlspecialchars(cut_nick($nickname)) . '</b> (<i>' . htmlspecialchars($user_name) . $malpa . htmlspecialchars($server_name) . '</i>)
				</td>
				<td onclick="window.location=\'' . $view_type . '?a=' . $to_base . '&loc=3\';" style="padding-left: 10px; padding-right: 10px;">' . $comment . '</td>
				<td style="text-align: center;"><a href="favorites.php?del=t&link_id=' . $row[link_id] . '" onClick="if (!confirm(\'' . $del_conf_my_link[$lang] . '\')) return false;">&nbsp;' . $fav_remove[$lang] . '&nbsp;</td>
				</tr>
			');
    }
    $html->set_body('</tbody><tr class="spacer"><td colspan="4"></td></tr><tr class="foot"><td colspan="4" height="15"></td></tr></table></center>');
} else {
    $html->status_message('<center><div class="message" style="width: 450px;">' . $fav_empty[$lang] . '</div></center>');
}
require_once "footer.php";