/* 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"); $search_phase = $_POST['query']; $next_link = $_GET['a']; // for pagination $predefined = $_GET['b']; // for predefined if ($predefined) { if($enc->decrypt_url($predefined) === true) { $search_phase = "from:".$enc->jid; } else { unset($search_phase); unset($predefined); } } if ($next_link) { if($enc->decrypt_url($next_link) === true) { $tslice_next = $enc->tslice; $search_phase = $enc->search_phase; $offset_arch = $enc->offset_arch; $offset_day = $enc->offset_day; $tag_count = $enc->tag_count; } else { unset ($next_link); unset ($search_phase); } } if ($tag_count=="t") { $start_from = $offset_day; } else{ $start_from = null; } $plain_phase = $search_phase; // fix me require_once("upper.php"); //need to initialize counter here $r=0; // 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; } // we need to rewrite this part internaly... if ($search_phase!="") { // check if we are using parametrized search or not $qquery = is_query_from($search_phase); // parametric search if ($qquery[from] == "t") { $user_chat_search = "1"; // temp hack unset($search_phase); list($user_name, $server) = split("@", $qquery[talker]); $db->get_user_id($user_name); $user_name = $db->result->user_id; $db->get_server_id($server); $server = $db->result->server_id; $search_phase=$qquery[query]; } if ($search_phase) { if ($db->create_search_results_table() === false) { $html->alert_message($oper_fail[$lang]); } else { $score="score"; } } //main table if ($time2_start AND $time2_end) { $html->status_message($search_warn[$lang].': '.$time2_start.' - '.$time2_end); } else { $time2_start = null; $time2_end = null; } $html->set_overview('
'.$time_t[$lang].' | '.$talks[$lang].' | '.$thread[$lang].' | '.$score.' | |
'.verbose_split_line($in_minutes,$verb_h[$lang],$in_min[$lang]).' | ||||
'.$results["ts"].' | '); // username from user roster $talk = query_nick_name($ejabberd_roster,$talk,$sname); // if there is no user in roster - advise that if ($talk=="f") { $talk=$not_in_r[$lang]; } // threaded view if ($results["direction"] == "from") { $out=$talk; $tt=$tt+1; $aa=0; } else { $out = TOKEN; $aa=$aa+1; $tt=0; } if ($aa<2 AND $tt<2) { $html->set_body(''); if ($out === TOKEN) { 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(' | '); } else { $html->set_body('- | '); } // end threaded view // message body $body_message=wordwrap(str_replace("\n","'.$body_message.' | '); // run pagination code only if search contains from: clausule /* The pagination code havent been changed after upgrade to search_engine_v2 - it work well so if one want to improve it f.e. by adding "back" button be my guest...current code is nightmare :/ */ $r=$r+1; debug(DEBUG,"all: $r, num_r: $num_rows, internal: $internal"); if ($r==$num_search_results) { if ($num_rows>$internal) { debug(DEBUG,"-->more results in this day...$entry[at] offset: $internal"); $tag_count="t"; } $next_r=$external+$offset_arch; debug(DEBUG,"before cutdown: $next_r"); // back to one day and continue with offset if ($tag_count=="t") { $next_r=$next_r-1; } debug(DEBUG,"after cutdown: $next_r"); debug(DEBUG,"Internal: $internal, offset: $offset_day, is_tag: $s_variables[tag_count]"); // if the same day - we increase offset if ($internal==$offset_day AND $s_variables[tag_count] == "t") { $internal=$internal+$offset_day; debug(DEBUG,"Increasing offset..."); } // hack if ($qquery[from] == "t") { $plain_phase=str_replace("@","//",$plain_phase); } $trange = $enc->crypt_url("time_start=$time2_start&time_end=$time2_end"); $lnk_n = $enc->crypt_url("tslice=$entry[at]&offset_arch=$next_r&offset_day=$internal&search_phase=$plain_phase&tag_count=$tag_count"); $html->set_body('|
'.$search_next[$lang].' | ||||
'.$no_more[$lang].' | ||||
'.$nx_dy[$lang].' | ||||
'.$search_tip[$lang].' '.$num_results.''.$search_why[$lang].' | ||||
'.$marked_as_d[$lang].' | ||||
'.$dat["ts"].' | '.$fr.' '.cut_nick($talk).' | '.$body_talk.' | '.round($dat[score],2).' | |
'.$no_result[$lang].' |