PageRenderTime 53ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/canoo/tests/testcases/level0/2.8.1/plug-ins/plugins/deliveryLimitations/Client/lib/phpSniff/index.php

https://github.com/orchestra-io/sample-openx
PHP | 341 lines | 299 code | 17 blank | 25 comment | 7 complexity | dd9aaaed58103320d619c6465f12d548 MD5 | raw file
  1. <?php
  2. error_reporting(E_ALL);
  3. /*******************************************************************************
  4. $Id: index.php 33995 2009-03-18 23:04:15Z chris.nutting $
  5. phpSniff: HTTP_USER_AGENT Client Sniffer for PHP
  6. Copyright (C) 2001 Roger Raymond ~ epsilon7@users.sourceforge.net
  7. This library is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2.1 of the License, or (at your option) any later version.
  11. This library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with this library; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *******************************************************************************/
  19. require_once('phpSniff.class.php');
  20. require_once('phpTimer.class.php');
  21. //echo '<pre>';
  22. //print_r($_COOKIE);
  23. //echo '</pre>';
  24. // initialize some vars
  25. $GET_VARS = isset($_GET) ? $_GET : $HTTP_GET_VARS;
  26. $POST_VARS = isset($_POST) ? $_GET : $HTTP_POST_VARS;
  27. if(!isset($GET_VARS['UA'])) $GET_VARS['UA'] = '';
  28. if(!isset($GET_VARS['cc'])) $GET_VARS['cc'] = '';
  29. if(!isset($GET_VARS['dl'])) $GET_VARS['dl'] = '';
  30. if(!isset($GET_VARS['am'])) $GET_VARS['am'] = '';
  31. $timer =& new phpTimer();
  32. $timer->start('main');
  33. $timer->start('client1');
  34. $sniffer_settings = array('check_cookies'=>$GET_VARS['cc'],
  35. 'default_language'=>$GET_VARS['dl'],
  36. 'allow_masquerading'=>$GET_VARS['am']);
  37. $client =& new phpSniff($GET_VARS['UA'],$sniffer_settings);
  38. $timer->stop('client1');
  39. $c1_bg = '#cccccc';
  40. $c2_bg = '#ffffff';
  41. $c3_bg = '#000000';
  42. function makeSelectOption ($link,$text)
  43. { global $client;
  44. $o = "<option value=\"$link\"";
  45. $o .= $client->property('ua') == strtolower($link) ? ' selected' : '';
  46. $o .= ">$text</option>";
  47. print $o;
  48. }
  49. function example ($search,$output)
  50. { global $c2_bg, $c1_bg, $client;
  51. ?>
  52. <tr>
  53. <td bgcolor="<?php print $c1_bg; ?>"><?php print $search; ?></td>
  54. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $output ? 'true' : 'false'; ?></td>
  55. </tr>
  56. <?php
  57. }
  58. function is ($search)
  59. { global $client;
  60. example($search,$client->is($search));
  61. }
  62. function language_is ($search)
  63. { global $client;
  64. example($search,$client->language_is($search));
  65. }
  66. function browser_is ($search)
  67. { global $client;
  68. example($search,$client->browser_is($search));
  69. }
  70. function has_feature ($feature)
  71. { global $client;
  72. example($feature,$client->has_feature($feature));
  73. }
  74. function has_quirk ($quirk)
  75. { global $client;
  76. example($quirk,$client->has_quirk($quirk));
  77. }
  78. ?>
  79. <html>
  80. <head>
  81. <title>phpSniff <?php print $client->_version; ?> on SourceForge</title>
  82. <style type="text/css">
  83. INPUT, SELECT {
  84. background-color: #c8c8c8;
  85. font-family: monospace;
  86. font-size: 10px;
  87. }
  88. BODY {
  89. background-color: #ffffff;
  90. font-family: sans-serif;
  91. font-size: 10px;
  92. }
  93. TD {
  94. font-family: sans-serif;
  95. font-size: 10px;
  96. }
  97. </style>
  98. </head>
  99. <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
  100. <?php
  101. // fix for cgi versions of php ~ 6/28/2001 ~ RR
  102. $script_path = getenv('PATH_INFO') ? getenv('PATH_INFO') : getenv('SCRIPT_NAME');
  103. ?>
  104. <form name="user_agent_string" method="get" action="<?php print $script_path; ?>">
  105. <p><a href="http://sourceforge.net/project/showfiles.php?group_id=26044">Download</a> |
  106. <a href="http://sourceforge.net/projects/phpsniff/">SourceForge Project Page</a> |
  107. <a href="index.phps">Index Source Code</a> |
  108. <a href="phpSniff.core.phps">phpSniff.core Source Code</a> |
  109. <a href="phpSniff.class.phps">phpSniff.class Source Code</a> |
  110. <a href="CHANGES">CHANGE LOG</a>
  111. </p>
  112. <table border="0" cellpadding="3" cellspacing="0" bgcolor="<?php print $c3_bg; ?>" width="100%">
  113. <tr>
  114. <td align="left" valign="top" width="100%">
  115. <font color="#ffffff"><b>CURRENT BROWSER INFORMATION</b></font><br>
  116. <font color="#ffffff" size="-1">
  117. <?php printf('phpSniff version : %s - php version : %s</font>',$client->_version, PHP_VERSION); ?>
  118. </font>
  119. </td>
  120. <td align="right" valign="top" width="100%">
  121. <font color="#ffffff">
  122. <select name="UA">
  123. <?php
  124. makeSelectOption('','Your current browser');
  125. include('user_agent.inc');
  126. while(list(,$v) = each($user_agent))
  127. { makeSelectOption($v,$v);
  128. }
  129. ?>
  130. </select><br>
  131. <input type="checkbox" name="cc" <?php if($client->_check_cookies) print 'checked'; ?> > Check For Cookies
  132. <input type="checkbox" name="am" <?php if($client->_allow_masquerading) print 'checked'; ?> > Allow Masquerading
  133. <input type="text" name="dl" size="7" value="<?php print $client->_default_language; ?>"> Default Language
  134. <input type="submit" name="submit" value="submit">
  135. </font>
  136. </td>
  137. </tr>
  138. </table>
  139. <table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="<?php print $c3_bg; ?>"><tr>
  140. <td align="right" valign="top">
  141. <table border="0" cellpadding="3" cellspacing="1" width="100%">
  142. <tr><td colspan="2" nowrap><font color="#ffcc00">Current Configuration</font></td></tr>
  143. <tr>
  144. <td colspan="2"bgcolor="<?php print $c1_bg; ?>"><b>regex used to search HTTP_USER_AGENT string</b><br>
  145. preg_match_all(&quot;<?php print $client->_browser_regex; ?>&quot;);</td>
  146. </tr>
  147. <tr>
  148. <td bgcolor="<?php print $c1_bg; ?>">$_check_cookies</td>
  149. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->_check_cookies ? 'true' : 'false'; ?></td>
  150. </tr>
  151. <tr>
  152. <td bgcolor="<?php print $c1_bg; ?>">$_default_language</td>
  153. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->_default_language; ?></td>
  154. </tr>
  155. <tr>
  156. <td bgcolor="<?php print $c1_bg; ?>">$_allow_masquerading</td>
  157. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->_allow_masquerading ? 'true' : 'false'; ?></td>
  158. </tr>
  159. <tr><td colspan="2" nowrap><font color="#ffcc00">$client-&gt;property(<i>property_name</i>);</font></td></tr>
  160. <tr>
  161. <td bgcolor="<?php print $c1_bg; ?>"><b>property_name</b></td>
  162. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><b>return value</b></td>
  163. </tr>
  164. <tr>
  165. <td bgcolor="<?php print $c1_bg; ?>">ua</td>
  166. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->get_property('ua');?></td>
  167. </tr>
  168. <tr>
  169. <td bgcolor="<?php print $c1_bg; ?>">browser</td>
  170. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('browser'); ?></td>
  171. </tr>
  172. <tr>
  173. <td bgcolor="<?php print $c1_bg; ?>">long_name</td>
  174. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('long_name');?></td>
  175. </tr>
  176. <tr>
  177. <td bgcolor="<?php print $c1_bg; ?>">version</td>
  178. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('version');?></td>
  179. </tr>
  180. <tr>
  181. <td bgcolor="<?php print $c1_bg; ?>">maj_ver</td>
  182. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('maj_ver');?></td>
  183. </tr>
  184. <tr>
  185. <td bgcolor="<?php print $c1_bg; ?>">min_ver</td>
  186. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('min_ver');?></td>
  187. </tr>
  188. <tr>
  189. <td bgcolor="<?php print $c1_bg; ?>">letter_ver</td>
  190. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('letter_ver');?></td>
  191. </tr>
  192. <tr>
  193. <td bgcolor="<?php print $c1_bg; ?>">javascript</td>
  194. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('javascript');?></td>
  195. </tr>
  196. <tr>
  197. <td bgcolor="<?php print $c1_bg; ?>">platform</td>
  198. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('platform');?></td>
  199. </tr>
  200. <tr>
  201. <td bgcolor="<?php print $c1_bg; ?>">os</td>
  202. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('os');?></td>
  203. </tr>
  204. <tr>
  205. <td bgcolor="<?php print $c1_bg; ?>">session cookies</td>
  206. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print ($ssc=$client->property('ss_cookies'))=='Unknown'?$ssc:($ssc?'true':'false');?></td>
  207. </tr>
  208. <tr>
  209. <td bgcolor="<?php print $c1_bg; ?>">stored cookies</td>
  210. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print ($stc=$client->property('st_cookies'))=='Unknown'?$stc:($stc?'true':'false');?></td>
  211. </tr>
  212. <tr>
  213. <td bgcolor="<?php print $c1_bg; ?>">ip</td>
  214. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('ip');?></td>
  215. </tr>
  216. <tr>
  217. <td bgcolor="<?php print $c1_bg; ?>">language</td>
  218. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('language');?></td>
  219. </tr>
  220. <tr>
  221. <td bgcolor="<?php print $c1_bg; ?>">gecko</td>
  222. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('gecko');?></td>
  223. </tr>
  224. <tr>
  225. <td bgcolor="<?php print $c1_bg; ?>">gecko_ver</td>
  226. <td width="100%" bgcolor="<?php print $c2_bg; ?>"><?php print $client->property('gecko_ver');?></td>
  227. </tr>
  228. </table>
  229. </td>
  230. <td align="left" valign="top">
  231. <table border="0" cellpadding="3" cellspacing="1" width="100%">
  232. <tr><td colspan="2" nowrap><font color="#ffcc00">&nbsp;</font></td></tr>
  233. <tr>
  234. <td bgcolor="<?php print $c1_bg; ?>" nowrap><b>search_phrase</b></td>
  235. <td width="100%" bgcolor="<?php print $c2_bg; ?>" nowrap><b>return boolean</b></td>
  236. </tr>
  237. <!-- feature search -->
  238. <tr>
  239. <td bgcolor="<?php print $c3_bg; ?>" colspan="2" nowrap><font color="#ffcc00">$client->has_feature(<i>feature</i>)</font></td>
  240. </tr>
  241. <?php
  242. has_feature('html');
  243. has_feature('images');
  244. has_feature('frames');
  245. has_feature('tables');
  246. has_feature('java');
  247. has_feature('plugins');
  248. has_feature('css2');
  249. has_feature('css1');
  250. has_feature('iframes');
  251. has_feature('xml');
  252. has_feature('dom');
  253. has_feature('hdml');
  254. has_feature('wml');
  255. ?>
  256. <!-- quirks -->
  257. <tr>
  258. <td bgcolor="<?php print $c3_bg; ?>" colspan="2" nowrap><font color="#ffcc00">$client->has_quirk(<i>quirk</i>)</font></td>
  259. </tr>
  260. <?php
  261. has_quirk('must_cache_forms');
  262. has_quirk('avoid_popup_windows');
  263. has_quirk('cache_ssl_downloads');
  264. has_quirk('break_disposition_header');
  265. has_quirk('empty_file_input_value');
  266. has_quirk('scrollbar_in_way');
  267. ?>
  268. <!-- browser_is search -->
  269. <tr>
  270. <td bgcolor="<?php print $c3_bg; ?>" colspan="2" nowrap><font color="#ffcc00">$client->browser_is(<i>browser</i>)</font></td>
  271. </tr>
  272. <?php
  273. browser_is('aol');
  274. browser_is('ie6+');
  275. browser_is('mz1.3+');
  276. browser_is('ns7+');
  277. browser_is('op6+');
  278. ?>
  279. <!-- language_is search -->
  280. <tr>
  281. <td bgcolor="<?php print $c3_bg; ?>" colspan="2" nowrap><font color="#ffcc00">$client->language_is(<i>language</i>)</font></td>
  282. </tr>
  283. <?php
  284. language_is('en');
  285. language_is('en-us');
  286. language_is('fr-ca');
  287. ?>
  288. <!-- old style search -->
  289. <tr>
  290. <td bgcolor="<?php print $c3_bg; ?>" colspan="2" nowrap><font color="#ffcc00">$client->is(<i>search</i>)</font></td>
  291. </tr>
  292. <?php
  293. is('b:ns7-');
  294. is('l:en-us');
  295. ?>
  296. </table>
  297. </td></tr></table>
  298. </form>
  299. <p>
  300. <?php
  301. $timer->stop('main');
  302. printf("<pre>\n".
  303. "client instantiation time : %s\n" .
  304. "page execution time : %s\n" .
  305. "</pre>" ,
  306. $timer->get_current('client1'),
  307. $timer->get_current('main'));
  308. ?>
  309. </p>
  310. <?php
  311. print ('<p align="left"><font size="-2">_______________________________<br>');
  312. print ('Copyleft 2001-2003 Simian Synapse, LLC.<br></font></p>');
  313. ?>
  314. <p align="center">
  315. <A href="http://sourceforge.net"><IMG
  316. src="http://sourceforge.net/sflogo.php?group_id=26044"
  317. width="88" height="31" border="0" alt="SourceForge Logo"></A>
  318. </p>
  319. </body>
  320. </html>