summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/pages/logview.php')
-rw-r--r--frontend/pages/logview.php87
1 files changed, 0 insertions, 87 deletions
diff --git a/frontend/pages/logview.php b/frontend/pages/logview.php
deleted file mode 100644
index ac41c5d..0000000
--- a/frontend/pages/logview.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-function init_logview() {
- global $S, $request;
- $S['title']='Log Viewer';
- if (!isset($S['user'])) return 'login';
- if (isset($request['build']) && strlen($request['build']) == 6 && ctype_alnum($request['build'])) {
- $r=$S['pdo']->query('SELECT * FROM `builds` WHERE `id`="'.$request['build'].'"');
- if ($r->rowCount()) {
- $S['logview']['build']=new sql_build($r->fetch(PDO::FETCH_ASSOC));
- if (!owner_or_admin($S['logview']['build']->owner)) return '404'; // TODO permission denied
- } else
- return '404';
- if (isset($request['task']) && is_numeric($request['task'])) {
- $r=$S['pdo']->query('SELECT * FROM `tasks` WHERE `build`="'.$request['build'].'" AND `order`='.$request['task']);
- if ($r->rowCount()) {
- $S['logview']['task']=new sql_task($r->fetch(PDO::FETCH_ASSOC));
- } // else return '404'; // Just goes to the build if task is missing
- }
- }
-}
-function body_logview() {
- global $S, $request, $conf;
- if (isset($S['logview']['task'])) {
- $task=&$S['logview']['task'];
- echo '<div style="font-size: 130%">'.$task->display().'</div>';
- echo '<a href="'.url('logs/'.$task->build).'">Back</a><br/>';
- $page=isset($request['page']) && is_numeric($request['page'])?$request['page']:1;
- $count=$S['pdo']->query('SELECT COUNT(*) FROM `buildlogs` WHERE `build`=\''.$task->build.'\' AND `task`='.$task->order)->fetch(PDO::FETCH_COLUMN);
- $pager='';
- if ($count > $conf['logview_max']) {
- $pager='<form action="'.url('logs/'.$task->build.'/'.$task->order).'" method="post" onsubmit="window.location.href=\''.url('logs/'.$task->build.'/'.$task->order).'/\'+this.page.value; return false">Page: ';
- if ($page > 1) {
- $pager.='<input type="button" value="&lt;&lt;" onclick="this.form.page.value='.($page-1).'; this.form.onsubmit()" /> '."\n";
- }
- $pager.='<select name="page">';
- for ($i=1; ($i-1)*$conf['logview_max']<$count; $i++) {
- $pager.="<option value=\"$i\"".($i==$page?'selected="selected"':'').">$i</option>\n";
- }
- $pager.='</select> <input type="submit" value="Go" />';
- if ($page*$conf['logview_max']<$count) {
- $pager.=' <input type="button" value="&gt;&gt;" onclick="this.form.page.value='.($page+1).'; this.form.onsubmit()" />'."\n";
- }
- $pager.='</form>';
- echo $pager;
- }
- $r=$S['pdo']->query('SELECT * FROM `buildlogs` WHERE `build`=\''.$task->build.'\' AND `task`='.$task->order.' ORDER BY `order` ASC LIMIT '.$conf['logview_max'].' OFFSET '.($page-1)*$conf['logview_max']);
- if ($r->rowCount()) {
- echo '<div style="font-family: monospace">';
- $ansi=new ansi_to_html();
- while ($entry=$r->fetch(PDO::FETCH_ASSOC)) {
- $entry=new sql_buildlog_entry($entry);
- echo '<'.($t=($entry->stream=='stderr'?'b':'span')).' title="'.strtoupper($entry->stream).', entry #'.$entry->order.' '.date('D j M Y @ H:i:s T', $entry->timestamp).'">'.$ansi->process($entry->text)."</$t>";
- }
- echo $ansi->reset(); // Clear any leftover <span>s
- echo '</div>';
- echo $pager;
- echo '<a href="'.url('logs/'.$task->build).'">Back</a><br/>';
- } else {
- if ($count) {
- echo print_error("There aren't $page pages. Try an <a href=\"".url('logs/'.$task->build.'/'.$task->order)."\">earlier page</a>.");
- } else {
- echo print_warning('No output');
- }
- }
- } elseif (isset($S['logview']['build'])) {
- $build=&$S['logview']['build'];
- echo $build->display();
- $r=$S['pdo']->query('SELECT * FROM `tasks` WHERE `build`="'.$request['build'].'" ORDER BY `order` ASC');
- if ($r->rowCount() == 0) {
- echo '<b>No tasks found.</b>';
- }
- while ($task=$r->fetch(PDO::FETCH_ASSOC)) {
- $task=new sql_task($task);
- echo $task->display();
- }
- } else {
- $r=$S['pdo']->query('SELECT * FROM `builds` WHERE `owner`='.$S['user']->id.' ORDER BY `ctime` IS NULL ASC, `ctime` ASC, `status` DESC');
- if ($r->rowCount() == 0) {
- echo print_warning('No builds found.');
- }
- while ($build=$r->fetch(PDO::FETCH_ASSOC)) {
- $build=new sql_build($build);
- echo $build->display();
- }
- }
-}
-?>