2002-09-16 17:19:24 +08:00
|
|
|
<?php
|
2002-09-24 06:08:50 +08:00
|
|
|
//
|
2002-12-10 21:23:22 +08:00
|
|
|
// ZoneMinder main web interface file, $Date$, $Revision$
|
2006-01-17 19:32:47 +08:00
|
|
|
// Copyright (C) 2003, 2004, 2005, 2006 Philip Coombes
|
2002-09-24 06:08:50 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
|
|
|
|
2006-01-18 05:11:49 +08:00
|
|
|
error_reporting(E_ALL ^ E_NOTICE);
|
2005-05-18 05:42:13 +08:00
|
|
|
import_request_variables( "CGP" );
|
2004-01-08 18:09:35 +08:00
|
|
|
|
2004-10-13 17:38:54 +08:00
|
|
|
$debug = false;
|
|
|
|
if ( $debug )
|
|
|
|
{
|
|
|
|
// Use these for debugging, though not both at once!
|
|
|
|
phpinfo( INFO_VARIABLES );
|
|
|
|
//error_reporting( E_ALL );
|
|
|
|
}
|
|
|
|
|
2005-01-17 00:08:35 +08:00
|
|
|
// Use new style autoglobals where possible
|
|
|
|
if ( version_compare( phpversion(), "4.1.0", "<") )
|
|
|
|
{
|
|
|
|
$_SESSION = &$HTTP_SESSION_VARS;
|
2005-02-24 07:46:35 +08:00
|
|
|
$_SERVER = &$HTTP_SERVER_VARS;
|
2005-01-17 00:08:35 +08:00
|
|
|
}
|
|
|
|
|
2004-12-29 02:20:11 +08:00
|
|
|
// Useful debugging lines for mobile devices
|
|
|
|
//ob_start();
|
|
|
|
//phpinfo( INFO_VARIABLES );
|
|
|
|
//$fp = fopen( "/tmp/env.html", "w" );
|
|
|
|
//fwrite( $fp, ob_get_contents() );
|
|
|
|
//fclose( $fp );
|
|
|
|
//ob_end_clean();
|
|
|
|
|
2002-10-11 17:44:41 +08:00
|
|
|
if ( !isset($PHP_SELF) )
|
2002-09-23 23:56:46 +08:00
|
|
|
{
|
2005-01-17 00:08:35 +08:00
|
|
|
$PHP_SELF = $_SERVER['PHP_SELF'];
|
2002-09-23 23:56:46 +08:00
|
|
|
}
|
|
|
|
|
2005-11-07 05:21:35 +08:00
|
|
|
if ( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' )
|
|
|
|
{
|
|
|
|
$protocol = 'https';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$protocol = 'http';
|
|
|
|
}
|
2006-01-18 05:11:49 +08:00
|
|
|
define( "ZM_BASE_URL", $protocol.'://'.$_SERVER['HTTP_HOST'] );
|
2005-11-07 05:21:35 +08:00
|
|
|
|
2006-11-09 19:48:24 +08:00
|
|
|
if ( $_GET['format'] )
|
|
|
|
{
|
|
|
|
$format = $_GET['format'];
|
|
|
|
$cookies = true;
|
|
|
|
}
|
|
|
|
if ( $_GET['cookies'] )
|
|
|
|
{
|
|
|
|
$cookies = $_GET['cookies'];
|
|
|
|
}
|
|
|
|
if ( $_GET['devwidth'] )
|
|
|
|
{
|
|
|
|
$device['width'] = $_GET['devwidth'];
|
|
|
|
}
|
|
|
|
if ( $_GET['devheight'] )
|
|
|
|
{
|
|
|
|
$device['height'] = $_GET['devheight'];
|
|
|
|
}
|
|
|
|
|
2004-12-29 02:20:11 +08:00
|
|
|
if ( empty($format) )
|
|
|
|
{
|
2004-12-29 03:49:07 +08:00
|
|
|
$wurfl_file = "./wurfl_class.php";
|
2004-12-29 02:20:11 +08:00
|
|
|
if ( file_exists( $wurfl_file ) )
|
|
|
|
{
|
|
|
|
require_once( $wurfl_file );
|
|
|
|
$wurfl = new wurfl_class( $wurfl, $wurfl_agents );
|
|
|
|
// Set the user agent
|
2005-01-17 00:08:35 +08:00
|
|
|
$wurfl->GetDeviceCapabilitiesFromAgent($_SERVER['HTTP_USER_AGENT']);
|
2004-12-29 02:20:11 +08:00
|
|
|
|
|
|
|
//print_r( $wurfl->wurfl_agent );
|
|
|
|
if ( $wurfl->wurfl_agent )
|
|
|
|
{
|
|
|
|
if ( $wurfl->getDeviceCapability( 'html_wi_oma_xhtmlmp_1_0' ) )
|
|
|
|
{
|
|
|
|
$format = "xhtml";
|
|
|
|
$cookies = false;
|
|
|
|
$device['width'] = $wurfl->getDeviceCapability( 'resolution_width' );
|
|
|
|
$device['height'] = $wurfl->getDeviceCapability( 'resolution_height' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$format = "html";
|
|
|
|
$cookies = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// This is an example of using fixed device strings to just match your phone etc
|
|
|
|
$devices = array(
|
|
|
|
array( 'name'=>"Motorola V600", 'ua_match'=>"MOT-V600", 'format'=>"xhtml", 'cookies'=>false, 'width'=>176, 'height'=>220 ),
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach ( $devices as $device )
|
|
|
|
{
|
2005-01-17 00:08:35 +08:00
|
|
|
if ( preg_match( '/'.$device['ua_match'].'/', $_SERVER['HTTP_USER_AGENT'] ) )
|
2004-12-29 02:20:11 +08:00
|
|
|
{
|
|
|
|
$format = $device['format'];
|
|
|
|
$cookies = $device['cookies'];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( empty($format) )
|
|
|
|
{
|
2005-02-22 05:53:59 +08:00
|
|
|
unset( $device );
|
2005-01-17 00:08:35 +08:00
|
|
|
$accepts_html = preg_match( '/text\/html/i', $_SERVER['HTTP_ACCEPT'] );
|
2004-12-29 02:20:11 +08:00
|
|
|
|
2007-08-30 01:37:23 +08:00
|
|
|
$format = "html";
|
|
|
|
$cookies = true;
|
2004-12-29 02:20:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-09-23 23:56:46 +08:00
|
|
|
|
2004-12-29 02:20:11 +08:00
|
|
|
ini_set( "session.name", "ZMSESSID" );
|
|
|
|
if ( $cookies )
|
2002-09-23 23:56:46 +08:00
|
|
|
{
|
2004-12-29 02:20:11 +08:00
|
|
|
ini_set( "session.use_cookies", "1" );
|
|
|
|
ini_set( "session.use_trans_sid", "0" );
|
|
|
|
ini_set( "url_rewriter.tags", "" );
|
2002-09-24 00:37:41 +08:00
|
|
|
}
|
2002-10-17 06:11:06 +08:00
|
|
|
else
|
2002-09-20 23:29:41 +08:00
|
|
|
{
|
2004-12-29 02:20:11 +08:00
|
|
|
//ini_set( "session.auto_start", "1" );
|
|
|
|
ini_set( "session.use_cookies", "0" );
|
|
|
|
ini_set( "session.use_trans_sid", "1" );
|
|
|
|
|
|
|
|
if ( $format == "xhtml" )
|
|
|
|
{
|
|
|
|
ini_set( "arg_separator.output", "&" );
|
|
|
|
ini_set( "url_rewriter.tags", "a=href,area=href,frame=src,input=src,fieldset=" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-30 02:03:13 +08:00
|
|
|
session_start();
|
|
|
|
|
2006-11-09 19:48:24 +08:00
|
|
|
if ( !$_SESSION['format'] || $_GET['format'] )
|
2004-12-29 02:20:11 +08:00
|
|
|
{
|
2005-01-17 00:08:35 +08:00
|
|
|
$_SESSION['format'] = $format;
|
|
|
|
$_SESSION['cookies'] = $cookies;
|
|
|
|
$_SESSION['device'] = $device;
|
2005-02-22 05:53:59 +08:00
|
|
|
if ( $cookies )
|
|
|
|
{
|
|
|
|
setcookie( "format", $format );
|
2005-10-20 19:46:42 +08:00
|
|
|
setcookie( "cookies", $cookies );
|
2005-02-22 05:53:59 +08:00
|
|
|
}
|
2002-09-20 23:29:41 +08:00
|
|
|
}
|
2004-12-29 02:20:11 +08:00
|
|
|
|
|
|
|
require_once( "zm_$format.php" );
|
|
|
|
|
2002-09-20 23:29:41 +08:00
|
|
|
?>
|