diff options
Diffstat (limited to 'frontend/pages/builds/task.php')
-rw-r--r-- | frontend/pages/builds/task.php | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/pages/builds/task.php b/frontend/pages/builds/task.php index ff3dd3f..0197372 100644 --- a/frontend/pages/builds/task.php +++ b/frontend/pages/builds/task.php @@ -1,39 +1,37 @@ <?php -function init_builds_task() { - global $S, $request; +function init_builds_task(&$S) { if (!isset($S['user'])) return 'login'; - if (!(isset($S['builds_log']) && isset($request['task']) && is_numeric($request['task']))) return 'builds/log'; - $r=$S['pdo']->query('SELECT * FROM `tasks` WHERE `build`="'.$S['builds_log']->id.'" AND `order`='.$request['task']); + if (!(isset($S['builds_log']) && isset($_REQUEST['task']) && is_numeric($_REQUEST['task']))) return 'builds/log'; + $r=query('SELECT * FROM `tasks` WHERE `build`="'.$S['builds_log']->id.'" AND `order`='.$_REQUEST['task']); if ($r->rowCount()) { $S['builds_task']=new sql_task($r->fetch(PDO::FETCH_ASSOC)); } else return '404'; } -function body_builds_task() { - global $S, $request, $conf; +function body_builds_task(&$S) { $task=&$S['builds_task']; echo '<div style="font-size: 130%">'.$task->display().'</div>'; echo '<a href="'.url("build/$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); + $page=isset($_REQUEST['page']) && is_numeric($_REQUEST['page'])?$_REQUEST['page']:1; + $count=query('SELECT COUNT(*) FROM `buildlogs` WHERE `build`=\''.$task->build.'\' AND `task`='.$task->order)->fetch(PDO::FETCH_COLUMN); $pager=''; - if ($count > $conf['logview_max']) { + if ($count > $S['conf']['logview_max']) { $pager='<form action="'.url("build/$task->build/$task->order").'" method="post" onsubmit="window.location.href=\''.url("build/$task->build/$task->order").'/\'+this.page.value; return false">Page: '; if ($page > 1) { $pager.='<input type="button" value="<<" 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++) { + for ($i=1; ($i-1)*$S['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) { + if ($page*$S['conf']['logview_max']<$count) { $pager.=' <input type="button" value=">>" 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']); + $r=query('SELECT * FROM `buildlogs` WHERE `build`=\''.$task->build.'\' AND `task`='.$task->order.' ORDER BY `order` ASC LIMIT '.$S['conf']['logview_max'].' OFFSET '.($page-1)*$S['conf']['logview_max']); if ($r->rowCount()) { echo '<div style="font-family: monospace">'; $ansi=new ansi_to_html(); |