[Owp-cvs] owp/inc/startup environment.inc,NONE,1.1
Status: Inactive
Brought to you by:
scader
From: <owp...@li...> - 2006-04-14 00:50:36
|
Update of /cvsroot/owp/owp/inc/startup In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16883/inc/startup Added Files: environment.inc Log Message: environment building code added --- NEW FILE: environment.inc --- <?php /* Copyright (c) 2006, 2realities Group All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the 2realities Group nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /**Building environment, like requested url or paths * @author Artem Sidorenko <sc...@us...> * @version $Id: environment.inc,v 1.1 2006/04/14 00:50:28 scader Exp $ * @package owp * @copyright (c) 2004-2006 2realities Group (www.2realities.com) */ #statical data //building hostname $hostname = $_SERVER['HTTP_HOST']; if($_SERVER['SERVER_PORT']!=80) $hostname.":".$_SERVER['SERVER_PORT']; //path to the root, related of server docroot dir $path_to_the_root = dirname($_SERVER['SCRIPT_NAME']); //building url to the root $root_url = "http://".$hostname.$path_to_the_root; //root path translated, realpath $root_path = dirname($_SERVER['PATH_TRANSLATED']); /**hostname*/ @ define('urls_hostname',$hostname); /**root url*/ @ define('urls_root',$root_url); /**root path, realpath*/ @ define('dirs_root',$root_path); /**path to the root, related of server docroot*/ @ define('dirs_root_server_related',$path_to_the_root); //cleaning unset($hostname,$root_url,$root_path,$path_to_the_root); #dynamical data //url to the currect page without GET params $end_pos = strpos($_SERVER['REQUEST_URI'],'?'); if($end_pos!==false)//GET data? $t_string = substr($_SERVER['REQUEST_URI'],0,$end_pos); else $t_string = $_SERVER['REQUEST_URI']; $current_url = "http://".urls_hostname.$t_string; //path related to the server docroot $current_path_server_related = $_SERVER['REDIRECT_URL']; //path related to the framework root $current_path_framework_related = str_replace(dirs_root_server_related,'',$current_path_server_related); //url to the current page with params $current_url_with_params = "http://".urls_hostname.$_SERVER['REQUEST_URI']; //remote ip of user $remote_ip = $_SERVER['REMOTE_ADDR']; /**current url wihtout params*/ define('urls_current',$current_url); /**current url with params*/ define('urls_current_with_params',$current_url_with_params); /**remote IP of user*/ define('urls_remote_ip',$remote_ip); /**path to the current document, related to the docroot of server*/ define('dirs_current_path_server_related',$current_path_server_related); /**path related to the framework root location*/ define('dirs_current_path_framework_related',$current_path_framework_related); //cleaning unset($current_url,$current_url_with_params,$remote_ip,$t_string,$end_pos,$current_path_server_related,$current_path_framework_related); ?> |