1<?php 2 3/* 4 Phoronix Test Suite 5 URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/ 6 Copyright (C) 2013 - 2015, Phoronix Media 7 Copyright (C) 2013 - 2015, Michael Larabel 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 3 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see <http://www.gnu.org/licenses/>. 21*/ 22 23$DEBUG_START_TIME = microtime(true); 24 25define('PTS_MODE', 'WEB_CLIENT'); 26define('PTS_AUTO_LOAD_OBJECTS', true); 27 28include('../pts-core.php'); 29pts_client::init(); 30 31interface pts_webui_interface 32{ 33 public static function preload($PATH); 34 public static function page_title(); 35 public static function page_header(); 36 public static function render_page_process($PATH); 37} 38 39$URI = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1); 40$PATH = explode('/', $URI); 41$PAGE_REQUEST = str_replace('.', '', array_shift($PATH)); 42 43if(is_file('web-interfaces/pts_webui_' . $PAGE_REQUEST . '.php')) 44{ 45 $webui_class = 'pts_webui_' . $PAGE_REQUEST; 46} 47else if(is_file('html/' . $PAGE_REQUEST . '.html')) 48{ 49 $webui_class = $PAGE_REQUEST; 50} 51else 52{ 53 // or pts_webui_intro on invalidated classes 54 $webui_class = 'pts_webui_loader'; 55} 56 57pts_webui::websocket_setup_defines(); 58$webui_class = pts_webui::load_web_interface($webui_class, $PATH, 'web-interfaces/', 'html/'); 59 60if($webui_class === false) 61{ 62 $webui_class = pts_webui::load_web_interface('pts_webui_main', $PATH, 'web-interfaces/', 'html/'); 63} 64 65?> 66<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 67<html style="height: 100%;"> 68<head> 69<link href="assets/pts-web-interface.css" rel="stylesheet" type="text/css" /> 70<?php if(stripos($_SERVER['HTTP_USER_AGENT'], 'iPod') || stripos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || stripos($_SERVER['HTTP_USER_AGENT'], 'Android')) { ?> 71<link href="assets/pts-mobile-interface.css" rel="stylesheet" type="text/css" /> 72<?php } ?> 73<script src="js/pts-web-interface.js" type="text/javascript"></script> 74<script src="js/pts-web-socket.js" type="text/javascript"></script> 75<script src="js/pts-web-functions.js" type="text/javascript"></script> 76<title><?php $page_title = class_exists($webui_class) ? $webui_class::page_title() : null; echo $page_title != null ? $page_title . ' - Phoronix Test Suite' : pts_core::program_title(true); ?></title> 77</head> 78<body> 79<script type="text/javascript"> 80 var window_size = { 81 width: window.innerWidth || document.body.clientWidth, 82 height: window.innerHeight || document.body.clientHeight 83 }; 84 var pts_web_socket = new pts_web_socket(); 85</script> 86<div id="pts_web_container"> 87<div id="pts_web_container_inside"> 88<table id="notification_area"></table> 89 <?php $page_header = class_exists($webui_class) ? $webui_class::page_header() : null; if($page_header !== -1) { ?> 90 <div id="pts_header"> 91 <div id="pts_header_left"><?php 92 $custom_header = true; 93 if($page_header == null) 94 { $custom_header = false; 95 $page_header = array('Main' => 'main', 'Tests' => 'tests', 'Results' => 'results', 'System' => 'system'); 96 } 97 else if(is_array($page_header) && !isset($page_header['Main'])) 98 { 99 $page_header = array('Main' => 'main') + $page_header; 100 } 101 102 if(is_array($page_header)) 103 { 104 $new_header = null; 105 foreach($page_header as $page => $url) 106 { 107 if($PAGE_REQUEST == $url || $URI == $url) 108 { 109 $new_header .= '<a href="?' . $url . '"><span class="dark_alt">' . $page . '</span></a> '; 110 } 111 else 112 { 113 if($custom_header && $page == 'Main') 114 { 115 $new_header .= '<a href="?' . $url . '"><span class="alt">' . $page . '</span></a> '; 116 } 117 else 118 { 119 $new_header .= '<a href="?' . $url . '">' . $page . '</a> '; 120 } 121 } 122 } 123 124 $page_header = rtrim($new_header); 125 } 126 127 echo $page_header; ?></div> 128 <div id="pts_logo_right"><a href="http://www.phoronix-test-suite.com/" target="_blank"><img src="/assets/pts-web-logo.png" /></a></div> 129 <div id="pts_benchmark_button_area"><script type="text/javascript"> update_benchmark_button(); </script></div> 130 </div> 131 <?php } // $page_header !== -1 ?> 132 <div id="pts_main_region"> 133<?php $page_ret = class_exists($webui_class) ? $webui_class::render_page_process($PATH) : -1; 134 135if($page_ret == -1 && is_file('html/' . $webui_class . '.html')) 136{ 137 include('html/' . $webui_class . '.html'); 138} 139 140?> 141 </div> 142 <div id="pts_copyright"><?php //$DEBUG_END_TIME = microtime(true); $DEBUG_TIME = $DEBUG_END_TIME - $DEBUG_START_TIME; echo '<strong>Page Rendering Took: ' . $DEBUG_TIME . ' secs.</strong> '; ?>Copyright © 2008 - <?php echo date('Y'); ?> by Phoronix Media. All trademarks used are properties of their respective owners. All rights reserved. <strong><?php echo pts_core::program_title(true); ?></strong></div> 143<script type="text/javascript"> 144 pts_web_socket.connect(); 145</script> 146</div> 147</div> 148</body> 149</html> 150