diff options
author | Christoph Brill <egore911@gmail.com> | 2017-02-05 19:31:10 +0100 |
---|---|---|
committer | Christoph Brill <egore911@gmail.com> | 2017-02-05 19:31:10 +0100 |
commit | 7bedf5a91cde87a8fbba8cb5e98b08873a21d0f4 (patch) | |
tree | 40dccddace6fcb7c85c63059eecdb33fa3405035 | |
parent | 164205b4395fa93a904ce3d349fb4d5b6c45ebd1 (diff) |
Move details view to its own file
-rw-r--r-- | details.php | 79 | ||||
-rwxr-xr-x | index.php | 78 |
2 files changed, 80 insertions, 77 deletions
diff --git a/details.php b/details.php new file mode 100644 index 0000000..dbe1052 --- /dev/null +++ b/details.php @@ -0,0 +1,79 @@ +<?php + +echo ' <h1>'.$title.'</h1> + <hr/> + <form id="datepick" name="setup" action="" method="get"> + <div style="right: 5px; top: 5px; visibility: hidden" id="setupdiv" onmousedown="dragstart(this)">'.PHP_EOL; +$even = false; +foreach ($channels as $c) { + echo ' <label><input name="channel" value="'.$c.'"'.($c == $channel ? ' checked="checked"' : '').' type="radio"/>'.$c.'</label>'.($even ? '<br/>' : '').PHP_EOL; + $even = !$even; +} +echo ' <hr/> + <input name="show_joins" value="true" type="checkbox"'.($show_joins ? ' checked="checked"' : '').'/>Show Joins/Disconnects<br/> + <input name="show_irssi" value="true" type="checkbox"'.($show_irssi ? ' checked="checked"' : '').'/>Show IRSSI<br/> + <input name="show_html" value="true"'.($show_html ? ' checked="checked"' : '').' type="checkbox"/>Linkify HTML<br/> + <label for="highlight_names">Highlight names:</label><input id="highlight_names" name="highlight_names" type="text" value="'.$highlight_names.'"/> + <input value="Update" type="submit"/> + <div id="usernames">'.PHP_EOL; +foreach ($users as $user) { + echo '<span class="user_'.$user.'" id="user_'.$user.'" style="display: block;"><a style="color: inherit;" href="javascript:addUser(\''.$user.'\');">'.$user.'</a></span>'.PHP_EOL; +} +echo ' </div> + </div> + <label for="date">Enter date of the log to open:</label>'.PHP_EOL; +if (file_exists(LOG_DIR.'dri-devel-' . $prevday . '.log')) { + echo '<a href="#" title="Previous day" onclick="prevDay(); return false;"><img src="images/play_blue_rev.png" alt="Previous day" title="Previous day" /></a>'; +} else { + echo '<img src="images/play_gray_rev.png" alt="Previous day" title="Previous day" />'; +} +echo '<input id="date" size="10" maxlength="10" name="date" value="'.$date.'" onkeyup="javascript:makeValid(\'date\')" onblur="javascript:makeValidFinal(this, \'date\', \'date_chooser\', 1950, 2049, Date.patterns.ISO8601ShortPattern, false)" type="text"/><img src="images/calendar.png" alt="Choose date" onclick="showChooser(this, \'date\', \'date_chooser\', 1950, 2049, Date.patterns.ISO8601ShortPattern, false);"/><div id="date_chooser" class="dateChooser select-free" style="display: none; visibility: hidden; width: 160px;"></div>'; +if (file_exists(LOG_DIR.'dri-devel-' . $nextday . '.log')) { + echo '<a href="#" title="Next day" onclick="nextDay(); return false;" ><img src="images/play_blue.png" alt="Next day" title="Next day" /></a>'.PHP_EOL; +} else { + echo '<img src="images/play_gray.png" alt="Next day" title="Next day" />'.PHP_EOL; +} +echo ' <input value="OK" type="submit"/> + <a href="#" onclick="showHideMenu(); return false;" title="Show menu" id="showhidebutton"><img id="showhidebuttonimage" src="images/application_form.png" alt="Show menu" title="Show menu" /></a>'.PHP_EOL; +echo ' </form> + <hr/>'.PHP_EOL; +$filename = 'dri-devel-'.$date.'.log'; + +$pattern = '#(^|[^\"=]{1})(http://|ftp://|https://|mailto:|news:)([^\s<>]+)([\s\n<>]|$)#sm'; + +$timehashes = array(); +$lines = file(LOG_DIR.$filename); +foreach ($lines as $line_num => $line) { + if (is_from_selected_channel($line, $channel)) { + if (!filter_join($line)) { + $user = get_user($line); + $user_clean = substr($user, 2, -1); + if (in_array($user_clean, $ignore)) { + continue; + } + $user = htmlentities($user, ENT_QUOTES); + $time = get_time($line); + if (isset($last_visit) && $last_visit < $time) { + echo '<hr/>'; + unset($last_visit); + } + echo '<span class="user_'.$user_clean.'">'; + $line = htmlentities($line, ENT_QUOTES); + if ($show_html == 'true') { + $line = preg_replace($pattern, "\\1<a href=\"\\2\\3\">\\2\\3</a>\\4", $line); + } + $user_link = '<a style="color: inherit;" href="javascript:addUser(\''.$user_clean.'\');"'; + if (isset($realname[$user_clean])) { + $user_link .= ' title="'.$realname[$user_clean].'"'; + } + $user_link .= '>'.str_replace('<', '<', str_replace('>', '>', $user)).'</a>'; + if (!in_array($time, $timehashes)) { + $time_link = '<a name="t-'.str_replace(':', '', $time).'">'.$time.'</a>'; + $line = str_replace($time, $time_link, $line); + array_push($timehashes, $time); + } + echo str_replace($user, $user_link, $line),'<br/>'; + echo '</span>'; + } + } +} @@ -126,83 +126,7 @@ function get_color($user) { if (!isset($date)) { require_once('overview.php'); } else { - echo ' <h1>'.$title.'</h1> - <hr/> - <form id="datepick" name="setup" action="" method="get"> - <div style="right: 5px; top: 5px; visibility: hidden" id="setupdiv" onmousedown="dragstart(this)">'.PHP_EOL; - $even = false; - foreach ($channels as $c) { - echo ' <label><input name="channel" value="'.$c.'"'.($c == $channel ? ' checked="checked"' : '').' type="radio"/>'.$c.'</label>'.($even ? '<br/>' : '').PHP_EOL; - $even = !$even; - } - echo ' <hr/> - <input name="show_joins" value="true" type="checkbox"'.($show_joins ? ' checked="checked"' : '').'/>Show Joins/Disconnects<br/> - <input name="show_irssi" value="true" type="checkbox"'.($show_irssi ? ' checked="checked"' : '').'/>Show IRSSI<br/> - <input name="show_html" value="true"'.($show_html ? ' checked="checked"' : '').' type="checkbox"/>Linkify HTML<br/> - <label for="highlight_names">Highlight names:</label><input id="highlight_names" name="highlight_names" type="text" value="'.$highlight_names.'"/> - <input value="Update" type="submit"/> - <div id="usernames">'.PHP_EOL; - foreach ($users as $user) { - echo '<span class="user_'.$user.'" id="user_'.$user.'" style="display: block;"><a style="color: inherit;" href="javascript:addUser(\''.$user.'\');">'.$user.'</a></span>'.PHP_EOL; - } - echo ' </div> - </div> - <label for="date">Enter date of the log to open:</label>'.PHP_EOL; - if (file_exists(LOG_DIR.'dri-devel-' . $prevday . '.log')) { - echo '<a href="#" title="Previous day" onclick="prevDay(); return false;"><img src="images/play_blue_rev.png" alt="Previous day" title="Previous day" /></a>'; - } else { - echo '<img src="images/play_gray_rev.png" alt="Previous day" title="Previous day" />'; - } - echo '<input id="date" size="10" maxlength="10" name="date" value="'.$date.'" onkeyup="javascript:makeValid(\'date\')" onblur="javascript:makeValidFinal(this, \'date\', \'date_chooser\', 1950, 2049, Date.patterns.ISO8601ShortPattern, false)" type="text"/><img src="images/calendar.png" alt="Choose date" onclick="showChooser(this, \'date\', \'date_chooser\', 1950, 2049, Date.patterns.ISO8601ShortPattern, false);"/><div id="date_chooser" class="dateChooser select-free" style="display: none; visibility: hidden; width: 160px;"></div>'; - if (file_exists(LOG_DIR.'dri-devel-' . $nextday . '.log')) { - echo '<a href="#" title="Next day" onclick="nextDay(); return false;" ><img src="images/play_blue.png" alt="Next day" title="Next day" /></a>'.PHP_EOL; - } else { - echo '<img src="images/play_gray.png" alt="Next day" title="Next day" />'.PHP_EOL; - } - echo ' <input value="OK" type="submit"/> - <a href="#" onclick="showHideMenu(); return false;" title="Show menu" id="showhidebutton"><img id="showhidebuttonimage" src="images/application_form.png" alt="Show menu" title="Show menu" /></a>'.PHP_EOL; - echo ' </form> - <hr/>'.PHP_EOL; - $filename = 'dri-devel-'.$date.'.log'; - - $pattern = '#(^|[^\"=]{1})(http://|ftp://|https://|mailto:|news:)([^\s<>]+)([\s\n<>]|$)#sm'; - - $timehashes = array(); - $lines = file(LOG_DIR.$filename); - foreach ($lines as $line_num => $line) { - if (is_from_selected_channel($line, $channel)) { - if (!filter_join($line)) { - $user = get_user($line); - $user_clean = substr($user, 2, -1); - if (in_array($user_clean, $ignore)) { - continue; - } - $user = htmlentities($user, ENT_QUOTES); - $time = get_time($line); - if (isset($last_visit) && $last_visit < $time) { - echo '<hr/>'; - unset($last_visit); - } - echo '<span class="user_'.$user_clean.'">'; - $line = htmlentities($line, ENT_QUOTES); - if ($show_html == 'true') { - $line = preg_replace($pattern, "\\1<a href=\"\\2\\3\">\\2\\3</a>\\4", $line); - } - $user_link = '<a style="color: inherit;" href="javascript:addUser(\''.$user_clean.'\');"'; - if (isset($realname[$user_clean])) { - $user_link .= ' title="'.$realname[$user_clean].'"'; - } - $user_link .= '>'.str_replace('<', '<', str_replace('>', '>', $user)).'</a>'; - if (!in_array($time, $timehashes)) { - $time_link = '<a name="t-'.str_replace(':', '', $time).'">'.$time.'</a>'; - $line = str_replace($time, $time_link, $line); - array_push($timehashes, $time); - } - echo str_replace($user, $user_link, $line),'<br/>'; - echo '</span>'; - } - } - } + require_once('details.php'); } /* |