TeraWurflAdmin
[ class tree: TeraWurflAdmin ] [ index: TeraWurflAdmin ] [ all elements ]

Source for file index.php

Documentation is available at index.php

  1. <?php
  2. /**
  3.  * Tera_WURFL - PHP MySQL driven WURFL
  4.  * 
  5.  * Tera-WURFL was written by Steve Kamerman, and is based on the
  6.  * Java WURFL Evolution package by Luca Passani and WURFL PHP Tools by Andrea Trassati.
  7.  * This version uses a MySQL database to store the entire WURFL file, multiple patch
  8.  * files, and a persistent caching mechanism to provide extreme performance increases.
  9.  * 
  10.  * @package TeraWurflAdmin
  11.  * @author Steve Kamerman <stevekamerman AT gmail.com>
  12.  * @version Stable 2.1.3 $Date: 2010/09/18 15:43:21
  13.  * @license http://www.mozilla.org/MPL/ MPL Vesion 1.1
  14.  */
  15. require_once realpath(dirname(__FILE__).'/../TeraWurfl.php');
  16.  
  17. try {
  18.     $tw new TeraWurfl();
  19. }catch(Exception $e){
  20.     
  21. }
  22.  
  23. $db $tw->db;
  24. $wurflfile $tw->rootdir.TeraWurflConfig::$DATADIR.TeraWurflConfig::$WURFL_FILE;
  25.  
  26. $missing_tables false;
  27. if($db->connected === true){
  28.     $required_tables array(TeraWurflConfig::$TABLE_PREFIX.'Cache',TeraWurflConfig::$TABLE_PREFIX.'Index',TeraWurflConfig::$TABLE_PREFIX.'Merge');
  29.     $tables $db->getTableList();
  30. // See what tables are in the DB
  31. //die(var_export($tables,true));
  32.     foreach($required_tables as $req_table){
  33.         if(!in_array($req_table,$tables)){
  34.             $missing_tables true;
  35.         }
  36.     }
  37. }else{
  38.     header("Location: install.php");
  39.     exit;
  40. }
  41. ?>
  42. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  43. <html xmlns="http://www.w3.org/1999/xhtml">
  44. <head>
  45. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  46. <title>Tera-WURFL Administration</title>
  47. <link href="style.css" rel="stylesheet" type="text/css" /></head>
  48.  
  49. <body>
  50. <table width="800">
  51.     <tr><td>
  52. <div align="center" class="titlediv">
  53.     <p>        Tera-WURFL <?php echo $tw->release_version?> Administration<br />
  54.         <span class="version">Loaded WURFL: <?php echo $tw->getSetting(TeraWurfl::$SETTING_WURFL_VERSION)?></span></p>
  55. </div>
  56. <?php
  57. if(isset($_GET['msg']&& $_GET['severity']){
  58.     $severity ($_GET['severity']=='notice')'noticediv''errordiv';
  59. ?>
  60. <div align="center" class="<?php echo $severity?>"><?php echo $_GET['msg']?></div>
  61. <?php
  62. }
  63. ?>
  64. </td></tr><tr><td>
  65.     <p>&nbsp;        </p>
  66.     <table width="800" border="0" cellspacing="0" cellpadding="0">
  67.         <tr>
  68.             <th colspan="2" scope="col">Administration</th>
  69.         </tr>
  70.         <tr>
  71.             <td width="16" class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  72.             <td width="744" class="lightrow"><a href="updatedb.php?source=local">Update database from local file<br />
  73.             </a><strong>Location</strong>: <?php echo $wurflfile?><br />
  74.             Updates your WURFL database from a local file. The location of this file is defined in <strong>TeraWurflConfig.php</strong>.</td>
  75.         </tr>
  76.         <tr>
  77.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  78.             <td class="darkrow"><a href="updatedb.php?source=remote">Update database from wurfl.sourceforge.net</a><br />
  79.             <strong>Location</strong>: <?php echo TeraWurflConfig::$WURFL_DL_URL?><br />            Updates your WURFL database with the <strong>current stable release</strong> from the <a href="http://sourceforge.net/projects/wurfl/files/WURFL/">official WURFL download site</a>.<br />
  80.             <span class="error"><strong>WARNING: </strong>This will replace your existing wurfl.xml</span><br/></td>
  81.         </tr>
  82.         <!-- <tr>
  83.             <td class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  84.             <td class="lightrow"><a href="updatedb.php?source=remote_cvs">Update database from wurfl.sourceforge.net CVS</a><br />
  85.             <strong>Location</strong>: <?php echo urldecode(htmlspecialchars(TeraWurflConfig::$WURFL_CVS_URL))?><br />
  86.             Updates your WURFL database with the <strong>current development release (CVS) </strong> from the <a href="http://wurfl.sourceforge.net">official WURFL website</a>.<br />
  87.             <span class="error"><strong>WARNING: </strong>This will replace your existing wurfl.xml</span>                </td>
  88.         </tr> -->
  89.         <tr>
  90.             <td class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  91.             <td class="lightrow"><a href="updatedb.php?action=rebuildCache">Rebuild the device cache</a><br/>Rebuilds the cache table by running through all the devices in the existing cache table and redetecting them using the current WURFL data and re-caching them. This is automatically done when you update the WURFL, but you can manually rebuild it with this link.</td>
  92.         </tr>
  93.         <tr>
  94.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  95.             <td class="darkrow"><a href="updatedb.php?action=clearCache">Clear the device cache</a><br/>Clears (truncates) the device cache.<br/><span class="error"><strong>WARNING:</strong> This will DELETE the device cache, so all devices will need to be redetected.</span></td>
  96.         </tr>
  97.         <tr>
  98.             <td class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  99.             <td class="lightrow"><a href="generatePatch.php">Generate Patch File</a><br/>Allows you to add non-mobile user agents to the the custom patch file from the web interface.  Once you save the changes you can return to this page and reload the WURFL database to apply your changes.  All the user agents you add will be given a fallback id of <strong>generic_web_browser</strong> so as to be detected as a non-mobile device.</td>
  100.         </tr>
  101.     </table>
  102.     <br/>
  103.     <br/>
  104.     <table width="800" border="0" cellspacing="0" cellpadding="0">
  105.         <tr>
  106.             <th colspan="2" scope="col">Diagnostics</th>
  107.         </tr>
  108.         <tr>
  109.             <td width="16" class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  110.             <td width="744" class="darkrow"><a href="../check_wurfl.php">Tera-WURFL test script</a><br />
  111.                 This is    
  112.             very similar to the <strong>check_wurfl.php</strong> script included with the <a href="http://wurfl.sourceforge.net/php/">PHP Tools</a> package. This is a good way to test your installation of Tera-WURFL and see how the class handles different user agents.</td>
  113.         </tr>
  114.         <tr>
  115.             <td width="16" class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  116.             <td width="744" class="lightrow"><a href="cache_browser/browse_classic.php">Browse the device cache</a><br />
  117.             Displays the contents of your cache and allows you to see the entire capabilities listing for each device as it appears in the cache.</td>
  118.         </tr>
  119.         <tr>
  120.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  121.             <td class="darkrow"><a href="stats.php">Statistics, Settings, Log File </a><br />
  122.                 See statistics about your database tables with detailed descriptions,your current settings and the last errors in your log file.</td>
  123.         </tr>
  124.     </table>
  125.     <br/><br/><img style="display:none" src="http://www.tera-wurfl.com/twnews.php?a=<?php echo urlencode(serialize(array($_SERVER['SERVER_SOFTWARE'],$_SERVER['SERVER_NAME'],$_SERVER['SERVER_ADDR'],$tw->release_branch,$tw->release_version)));?>" width="1" height="1"/>
  126.     <table width="800" border="0" cellspacing="0" cellpadding="0">
  127.         <tr>
  128.             <th colspan="2" scope="col">Support</th>
  129.         </tr>
  130.         <tr>
  131.             <td class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  132.             <td class="lightrow"><form action="http://www.tera-wurfl.com/ua_submission/" method="get" target="_blank"><p>Having a problem with a particular user agent? Make sure you're using the latest WURFL by updating the database above. If it still isn't being detected properly, you may submit it to the Tera-WURFL development team here:</p>
  133.               <p>Paste the User Agent here:<br />
  134.                 <input type="hidden" name="version" id="version" value="<?php echo $tw->release_version?>" />
  135.                 <input type="text" name="ua" id="ua" style="width:95%" />
  136.               </p>
  137.               <p>
  138.                 <input type="submit" name="submit" id="submit" value="Submit User Agent" />
  139.               </p>
  140.             </form></td>
  141.         </tr>
  142.         <tr>
  143.             <td width="16" class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  144.             <td width="744" class="darkrow"><a href="http://www.tera-wurfl.com/explore/">Tera-WURFL Explorer: explore the WURFL!</a></td>
  145.         </tr>
  146.         <tr>
  147.             <td class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  148.             <td class="lightrow"><a href="http://www.tera-wurfl.com/wiki/index.php/Installation">Online Documentation</a></td>
  149.         </tr>
  150.         <tr>
  151.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  152.             <td class="darkrow"><a href="http://groups.yahoo.com/group/wmlprogramming/">WML Programming Mailing List</a></td>
  153.         </tr>
  154.         <tr>
  155.             <td class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  156.             <td class="lightrow"><a href="http://www.tera-wurfl.com">www.Tera-Wurfl.com</a></td>
  157.         </tr>
  158.         <tr>
  159.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  160.             <td class="darkrow"><a href="http://www.stevekamerman.com">Steve Kamerman's Blog</a> (the author :D) </td>
  161.         </tr>
  162.         
  163.     </table>
  164.     <br /><br />
  165.     </td>
  166. </tr>
  167. </table>
  168. </body>
  169. </html>

Documentation generated on Sun, 19 Sep 2010 00:15:50 +0000 by phpDocumentor 1.4.3