Move always.php into the webroot for easier setup.

Also add some 'search for the AWL includes' code into it for
even more easier setup.
This commit is contained in:
Andrew McMillan 2010-03-23 21:52:00 +13:00
parent f3f846e47e
commit f0964f7583
12 changed files with 60 additions and 20 deletions

View File

@ -10,15 +10,15 @@ built-docs: docs/api/phpdoc.ini htdocs/*.php inc/*.php
phpdoc -c docs/api/phpdoc.ini || echo "NOTICE: Failed to build optional API docs"
touch built-docs
built-po: inc/always.php scripts/po/rebuild-translations.sh scripts/po/extract.pl po/*.po
built-po: htdocs/always.php scripts/po/rebuild-translations.sh scripts/po/extract.pl po/*.po
scripts/po/rebuild-translations.sh
touch built-po
#
# Insert the current version number into always.php
#
inc/always.php: scripts/build-always.sh VERSION dba/davical.sql inc/always.php.in
scripts/build-always.sh <inc/always.php.in >inc/always.php
htdocs/always.php: scripts/build-always.sh VERSION dba/davical.sql inc/always.php.in
scripts/build-always.sh <inc/always.php.in >htdocs/always.php
#
# Build a release .tar.gz file in the directory above us

View File

@ -1,5 +1,5 @@
<?php
require_once('../inc/always.php');
require_once('./always.php');
require_once('classEditor.php');
require_once('classBrowser.php');
include("DAViCalSession.php");

View File

@ -6,6 +6,8 @@
* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
*/
if ( preg_match('{/always.php$}', $_SERVER['SCRIPT_NAME'] ) ) header('Location: index.php');
// Ensure the configuration starts out as an empty object.
$c = (object) array();
@ -57,16 +59,34 @@ $c->template_usr = array( 'active' => true,
$c->hide_TODO = true; // VTODO only visible to collection owner
$c->readonly_webdav_collections = true; // WebDAV access is readonly
// Ensure that ../inc is in our included paths as early as possible
set_include_path( '../inc'. PATH_SEPARATOR. get_include_path());
// Kind of private configuration values
$c->total_query_time = 0;
$c->dbg = array();
// Utilities
require_once('AWLUtilities.php');
if ( ! @include_once('AWLUtilities.php') ) {
$try_paths = array(
'../../awl/inc'
, '/usr/share/awl/inc'
, '/usr/local/share/awl/inc'
);
foreach( $try_paths AS $awl_include_path ) {
if ( @file_exists($awl_include_path.'/AWLUtilities.php') ) {
set_include_path( $awl_include_path. PATH_SEPARATOR. get_include_path());
break;
}
}
if ( ! @include_once('AWLUtilities.php') ) {
echo "Could not find the AWL libraries. Are they installed? Check your include_path in php.ini!\n";
exit;
}
}
// Ensure that ../inc is in our included paths as early as possible
set_include_path( '../inc'. PATH_SEPARATOR. get_include_path());
/** We actually discovered this and worked around it earlier, but we can't log it until the utilties are loaded */
if ( !isset($_SERVER['SERVER_NAME']) ) {

View File

@ -19,7 +19,7 @@ if ( isset($_SERVER['PATH_INFO']) && preg_match( '{^(/favicon.ico|davical.css|(i
}
exit(0);
}
require_once('../inc/always.php');
require_once('./always.php');
// dbg_error_log( 'caldav', ' User agent: %s', ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'Unfortunately Mulberry does not send a "User-agent" header with its requests :-(')) );
// dbg_log_array( 'headers', '_SERVER', $_SERVER, true );
require_once('HTTPAuthSession.php');

View File

@ -1,5 +1,5 @@
<?php
require_once("../inc/always.php");
require_once("./always.php");
dbg_error_log( "freebusy", " User agent: %s", ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Unfortunately Mulberry and Chandler don't send a 'User-agent' header with their requests :-(")) );
dbg_log_array( "headers", '_SERVER', $_SERVER, true );
if ( isset($c->public_freebusy_url) && $c->public_freebusy_url ) {

View File

@ -1,5 +1,5 @@
<?php
include("../inc/always.php");
include("./always.php");
include("DAViCalSession.php");
$session->LoginRequired();

View File

@ -7,7 +7,7 @@ if ( $_SERVER['REQUEST_METHOD'] != "GET" && $_SERVER['REQUEST_METHOD'] != "POST"
exit; // Not that it should return from that!
}
include("../inc/always.php");
include("./always.php");
include("DAViCalSession.php");
$session->LoginRequired();

View File

@ -8,7 +8,7 @@
* @copyright Catalyst .Net Ltd
* @license http://gnu.org/copyleft/gpl.html GNU GPL v2
*/
require("../inc/always.php");
require("./always.php");
dbg_error_log( "caldav", " User agent: %s", ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Unfortunately Mulberry does not send a 'User-agent' header with its requests :-(")) );
dbg_log_array( "headers", '_SERVER', $_SERVER, true );
require("PublicSession.php");

View File

@ -1,6 +1,6 @@
<?php
include("../inc/always.php");
include("./always.php");
include("DAViCalSession.php");
ob_start( );

View File

@ -9,7 +9,7 @@
* @license http://gnu.org/copyleft/gpl.html GNU GPL v2
*/
require_once("../inc/always.php");
require_once("./always.php");
require_once("DAViCalSession.php");
$session->LoginRequired();

View File

@ -1,6 +1,6 @@
<?php
include("../inc/always.php");
include("./always.php");
include("DAViCalSession.php");
$session->LoginRequired('Admin');

View File

@ -6,6 +6,8 @@
* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
*/
if ( preg_match('{/always.php$}', $_SERVER['SCRIPT_NAME'] ) ) header('Location: index.php');
// Ensure the configuration starts out as an empty object.
$c = (object) array();
@ -57,16 +59,34 @@ $c->template_usr = array( 'active' => true,
$c->hide_TODO = true; // VTODO only visible to collection owner
$c->readonly_webdav_collections = true; // WebDAV access is readonly
// Ensure that ../inc is in our included paths as early as possible
set_include_path( '../inc'. PATH_SEPARATOR. get_include_path());
// Kind of private configuration values
$c->total_query_time = 0;
$c->dbg = array();
// Utilities
require_once('AWLUtilities.php');
if ( ! @include_once('AWLUtilities.php') ) {
$try_paths = array(
'../../awl/inc'
, '/usr/share/awl/inc'
, '/usr/local/share/awl/inc'
);
foreach( $try_paths AS $awl_include_path ) {
if ( @file_exists($awl_include_path.'/AWLUtilities.php') ) {
set_include_path( $awl_include_path. PATH_SEPARATOR. get_include_path());
break;
}
}
if ( ! @include_once('AWLUtilities.php') ) {
echo "Could not find the AWL libraries. Are they installed? Check your include_path in php.ini!\n";
exit;
}
}
// Ensure that ../inc is in our included paths as early as possible
set_include_path( '../inc'. PATH_SEPARATOR. get_include_path());
/** We actually discovered this and worked around it earlier, but we can't log it until the utilties are loaded */
if ( !isset($_SERVER['SERVER_NAME']) ) {