function CacheChatLines() { global $realpath, $handler, $start, $maxlines; $result = @count_mysql_query("SELECT line, posttime FROM uo_chat_log WHERE chat='{$realpath}' ORDER BY posttime DESC LIMIT {$maxlines}", $handler, "helpers.php: CacheChatLines() 1/2"); $oldest = null; $lines = array(); while ($line = @mysql_fetch_assoc($result)) { $lines[] = $line['line']; $oldest = $line['posttime']; } for ($i = 0; $i < count($lines); $i++) { $lines[$i] = str_replace("\\'", "'", $lines[$i]); } @mysql_free_result($result); @count_mysql_query("DELETE FROM uo_chat_log WHERE chat='{$realpath}' AND posttime < '{$oldest}'", $handler, "helpers.php: CacheChatLines() 2/2"); echo "\n<!-- {$realpath}.lines -->\n"; MMC_Lock("{$realpath}.lines"); $fcac = ''; // @fopen("../common/cache/$realpath.cache", "wb"); for ($cc = 0; $cc < count($lines); $cc++) { $fcac .= str_replace("`", "'", $lines[$cc]) . "\n"; } MMC_Set("{$realpath}.cache", $fcac, 60); $fcac = ''; // @fopen("../common/cache/$realpath.rache", "wb"); for ($cc = count($lines) - 1; $cc >= 0; $cc--) { $fcac .= str_replace("`", "'", $lines[$cc]) . "\n"; } MMC_Set("{$realpath}.rache", $fcac, 60); if ($exit == 0) { echo "<!-- Debug: " . round(getmicrotime() - $start, 5) . " secs / {$cqs} queries -->"; echo "<!-- {$creas} -->"; } MMC_Unlock("{$realpath}.lines"); }
$ccall += $cview; $clist[$numvis][7] = $cview; $numvis++; } MMC_Set('portal.stamp', time(), 900); MMC_Set('portal.clist', $clist, 900); MMC_Set('portal.popular', $lines, 900); } $numvis = count($clist); $ccall = 0; $ccv = 0; foreach ($clist as $c) { $ccall += $c[2]; $ccv += $c[3]; } MMC_Unlock('portal.lock'); if ($_REQUEST['sort'] == 'chat') { usort($clist, 'SortListChat'); } else { if ($_REQUEST['sort'] == 'active') { usort($clist, 'SortListActive'); } else { if ($_REQUEST['sort'] == 'view') { usort($clist, 'SortListView'); } else { if ($_REQUEST['sort'] == 'title') { usort($clist, 'SortList'); } else { $_REQUEST['sort'] = 'active'; usort($clist, 'SortListActive'); }
for ($i = 0; $i < $numfetched; $i++) { $row = $GLOBALS['sql']->fetchAssoc($rez, $i); $row['message'] = log_SanitizeLine($row['message']); $output .= "<div>"; $output .= "<span title='Get Context'>[<a href='dblog.php?a=1&from={$row['contextstamp']}'>{$row['shortstamp']}</a>]</span> "; $output .= "<span title='Line ID {$row['message_id']}; Author " . htmlspecialchars($row['user_name'], ENT_QUOTES) . " (UID {$row['user_id']})'>{$row['message']}</span>"; $output .= "</div>\n"; } $output .= $pages; } else { $output .= "<b>No rows matching that query...</b>"; } $GLOBALS['sql']->freeResult($rez); } $GLOBALS['sql']->commit(); MMC_Unlock('chats.global.log.lock'); } } } ?> <div>Keywords are inclusive, so the more keywords you put in, the less lines you'll find. <br>You can specifically ask for a keyword to not exist by prefixing it with !. <br>For example, searching for "mouse !cheese milk" would find lines that contain both mouse and milk but not cheese.</div> <p><form method="get" accept-charset="UTF-8"> <table border="0" cellspacing="0" cellpadding="3" align="center"> <tr valign="top"> <td>Keywords:</td> <td colspan="3"><input type="text" name="keywords" style="width: 100%;"></td> </tr>