Browse Source

[svn r12273] 7th step in removing all $_SERVER['PHP_SELF']

Julian Prud'homme 18 years ago
parent
commit
a3de6f0333

+ 2 - 2
main/admin/configure_homepage.php

@@ -1,4 +1,4 @@
-<?php // $Id: configure_homepage.php 12272 2007-05-03 14:40:45Z elixir_julian $
+<?php // $Id: configure_homepage.php 12273 2007-05-03 14:49:21Z elixir_julian $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -871,7 +871,7 @@ else
 			$edit_link='<a href="'.api_get_self().'?action=edit_link&amp;link_index='.$key.'"><img src="../img/edit.gif" border="0" style="margin-top: 2px;" title="'.htmlentities(get_lang('Modify')).'"/></a>';
 			$delete_link='<a href="'.api_get_self().'?action=delete_link&amp;link_index='.$key.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang('ConfirmYourChoice'))).'\')) return false;"><img src="../img/delete.gif" border="0" style="margin-top: 2px;" title="'.htmlentities(get_lang('Delete')).'"/></a>';
 
-			echo str_replace(array('href="'.$_configuration['root_web'].'index.php?include=','</li>'),array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($_SERVER['PHP_SELF']).'?action=open_link&link=','<br />'.$edit_link.' '.$delete_link.'</li>'),$enreg);
+			echo str_replace(array('href="'.$_configuration['root_web'].'index.php?include=','</li>'),array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=','<br />'.$edit_link.' '.$delete_link.'</li>'),$enreg);
 		}
 	}
 ?>

+ 2 - 2
main/course_home/activity.php

@@ -388,8 +388,8 @@ if(api_is_platform_admin())
 			<div id="toolhide">
 			<?php echo get_lang("DelLk")?>
 			<br />&nbsp;&nbsp;&nbsp;
-			<a href="<?php echo $_SERVER['PHP_SELF']?>"><?php echo get_lang("No")?></a>&nbsp;|&nbsp;
-			<a href="<?php echo $_SERVER['PHP_SELF']?>?delete=yes&id=<?php echo $_GET["id"]?>"><?php echo get_lang("Yes")?></a>
+			<a href="<?php echo api_get_self()?>"><?php echo get_lang("No")?></a>&nbsp;|&nbsp;
+			<a href="<?php echo api_get_self()?>?delete=yes&id=<?php echo $_GET["id"]?>"><?php echo get_lang("Yes")?></a>
 			</div>
 		<?php
 	}

+ 2 - 2
main/document/document.inc.php

@@ -1,4 +1,4 @@
-<?php // $Id: document.inc.php 12272 2007-05-03 14:40:45Z elixir_julian $
+<?php // $Id: document.inc.php 12273 2007-05-03 14:49:21Z elixir_julian $
 
 /*
 ==============================================================================
@@ -45,7 +45,7 @@ function build_directory_selector($folders,$curdirpath,$group_dir='',$changeRend
 	}
 	
 	require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
-	$form = new FormValidator('selector','POST',$_SERVER['PHP_SELF']);
+	$form = new FormValidator('selector','POST',api_get_self());
 	
 	$parent_select = $form->addElement('select', 'curdirpath', get_lang('CurrentDirectory'),'','onchange="javascript:document.selector.submit()"');
 	

+ 2 - 2
main/document/upload.php

@@ -1,4 +1,4 @@
-<?php // $Id: upload.php 12269 2007-05-03 14:17:37Z elixir_julian $
+<?php // $Id: upload.php 12273 2007-05-03 14:49:21Z elixir_julian $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -318,7 +318,7 @@ echo(build_directory_selector($folders,$path,$group_properties['directory']));
 
 require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
 
-$form = new FormValidator('upload','POST',$_SERVER['PHP_SELF'],'','enctype="multipart/form-data"');
+$form = new FormValidator('upload','POST',api_get_self(),'','enctype="multipart/form-data"');
 
 $form->addElement('hidden','curdirpath',$path);
 

+ 1 - 1
main/inc/banner.inc.php

@@ -367,7 +367,7 @@ else
 	"call for chat" module section
 -----------------------------------------------------------------------------
 */
-$chat = strpos($_SERVER['PHP_SELF'], 'chat_banner.php');
+$chat = strpos(api_get_self(), 'chat_banner.php');
 if (!$chat)
 {
 	include_once (api_get_path(LIBRARY_PATH)."online.inc.php");

+ 5 - 5
main/inc/lib/pear/Pager/Common.php

@@ -33,7 +33,7 @@
  * @author     Richard Heyes <richard@phpguru.org>
  * @copyright  2003-2006 Lorenzo Alberton, Richard Heyes
  * @license    http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
- * @version    CVS: $Id: Common.php 9608 2006-10-20 11:43:03Z bmol $
+ * @version    CVS: $Id: Common.php 12273 2007-05-03 14:49:21Z elixir_julian $
  * @link       http://pear.php.net/package/Pager
  */
 
@@ -41,12 +41,12 @@
  * Two constants used to guess the path- and file-name of the page
  * when the user doesn't set any other value
  */
-if (substr($_SERVER['PHP_SELF'], -1) == '/') {
+if (substr(api_get_self(), -1) == '/') {
     define('CURRENT_FILENAME', '');
-    define('CURRENT_PATHNAME', 'http://'.$_SERVER['HTTP_HOST'].str_replace('\\', '/', $_SERVER['PHP_SELF']));
+    define('CURRENT_PATHNAME', 'http://'.$_SERVER['HTTP_HOST'].str_replace('\\', '/', api_get_self()));
 } else {
-    define('CURRENT_FILENAME', preg_replace('/(.*)\?.*/', '\\1', basename($_SERVER['PHP_SELF'])));
-    define('CURRENT_PATHNAME', str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])));
+    define('CURRENT_FILENAME', preg_replace('/(.*)\?.*/', '\\1', basename(api_get_self())));
+    define('CURRENT_PATHNAME', str_replace('\\', '/', dirname(api_get_self())));
 }
 /**
  * Error codes

+ 1 - 1
main/inc/lib/xajax/xajax.inc.php

@@ -906,7 +906,7 @@ class xajax
 			if (!empty($_SERVER['PATH_INFO'])) {
 				$sPath = parse_url($_SERVER['PATH_INFO']);
 			} else {
-				$sPath = parse_url($_SERVER['PHP_SELF']);
+				$sPath = parse_url(api_get_self());
 			}
 			$aURL['path'] = $sPath['path'];
 			unset($sPath);

+ 2 - 2
main/inc/tool_navigation_menu.inc.php

@@ -1,5 +1,5 @@
 <?php
-// $Id: tool_navigation_menu.inc.php 11651 2007-03-21 22:34:55Z yannoo $
+// $Id: tool_navigation_menu.inc.php 12273 2007-05-03 14:49:21Z elixir_julian $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -235,7 +235,7 @@ function show_navigation_tool_shortcuts($orientation = SHORTCUTS_HORIZONTAL)
 	foreach ($navigation_items as $key => $navigation_item)
 	{
 		echo '<a href="'.$navigation_item['link'].'"';
-		if (strpos($_SERVER['PHP_SELF'], $navigation_item['link']) !== false)
+		if (strpos(api_get_self(), $navigation_item['link']) !== false)
 		{
 			echo ' id="here"';
 		}

+ 1 - 1
main/install/index.php

@@ -173,7 +173,7 @@ if(!isset($_GET['running']))
 	$dbUserForm='dokeos_user';
 
 	// extract the path to append to the url if Dokeos is not installed on the web root directory
-	$urlAppendPath=str_replace('/main/install/index.php','',$_SERVER['PHP_SELF']);
+	$urlAppendPath=str_replace('/main/install/index.php','',api_get_self());
   	$urlForm='http://'.$_SERVER['HTTP_HOST'].$urlAppendPath.'/';
 	$pathForm=str_replace('\\','/',realpath('../..')).'/';
 

+ 1 - 1
main/install/update_courses.php

@@ -102,7 +102,7 @@ if($_POST['step2'])
 		}
 		else
 		{
-			$urlAppendPath=str_replace('/main/install/update_courses.php','',$_SERVER['PHP_SELF']);
+			$urlAppendPath=str_replace('/main/install/update_courses.php','',api_get_self());
 		  	$urlForm='http://'.$_SERVER['HTTP_HOST'].$urlAppendPath.'/';
 
 			$singleDbForm=get_config_param('singleDbEnabled');

+ 1 - 1
main/metadata/importmanifest.php

@@ -611,7 +611,7 @@ else
 function showSelectForm($label, $specifics)
 {
     echo    '<tr><td align="right" class="alternativeBgDark">', "\n",
-        	'<form action="', $_SERVER['PHP_SELF'], '" method="post">', "\n",
+        	'<form action="', api_get_self(), '" method="post">', "\n",
             	get_lang($label), ' :', "\n", $specifics, "\n",
                 '<input type="submit" value="', get_lang('Ok'), '" />', "\n",
             '</form></td></tr>', "\n";

+ 1 - 1
main/metadata/phpdig/config.php

@@ -72,7 +72,7 @@ if ((isset($_SERVER['SCRIPT_NAME'])) && (eregi("config.php",$_SERVER['SCRIPT_NAM
 if ((isset($_SERVER['PATH_TRANSLATED'])) && (eregi("config.php",$_SERVER['PATH_TRANSLATED']))) {
   exit();
 }
-if ((isset($_SERVER['PHP_SELF'])) && (eregi("config.php",$_SERVER['PHP_SELF']))) {
+if ((isset(api_get_self())) && (eregi("config.php",api_get_self()))) {
   exit();
 }
 

+ 1 - 1
main/metadata/phpdig/search.php

@@ -242,7 +242,7 @@ if ($ckwcdt{0} != '?')  // there is a file with extra criteria
 
 <input type="text" id="kwds_string" class="kwl" onKeyUp="takeTypeIn(this, 150, -100, '60%'); checkEnter(event); return true;"/>
 
-<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
+<form action="<?php echo api_get_self()?>" method="post">
 <table>
 <tr>
     <td><?php echo $tdhtm, '&nbsp;'; ?>

+ 1 - 1
main/metadata/playscormmdset.inc.php

@@ -66,7 +66,7 @@ require($drs . 'main/metadata/md_' . strtolower(EID_TYPE) . '.php');
 $mdObj = new mdobject($_course, EID_ID);
 
 define('DR', $_SERVER['DOCUMENT_ROOT']);
-define('SELF', $_SERVER['PHP_SELF']);
+define('SELF', api_get_self());
 define('DIRECTORY', DR . $self = substr(SELF, 0, strrpos(SELF, '/')));
 if (!file_exists(DIRECTORY)) give_up('No such directory: ' . DIRECTORY);
 

+ 1 - 1
main/metadata/search.php

@@ -55,7 +55,7 @@ $xhtDoc = define_htt(HTT . '.htt', $urlp, $_course['path']);
 $xhtDoc->xht_param['type'] = TYPE;
 
 $xhtDoc->xht_param['index'] = 
-    str_replace('/search.php', '/index.php', $_SERVER['PHP_SELF']);
+    str_replace('/search.php', '/index.php', api_get_self());
 
 
 // XML and DB STUFF ----------------------------------------------------------->

+ 1 - 1
main/newscorm/aicc_api.php

@@ -291,7 +291,7 @@ function savedata(origin) { //origin can be 'commit', 'finish' or 'terminate'
     param = 'id='+lms_item_id+'&origin='+origin+'&score='+score+'&max='+max+'&min='+min+'&lesson_status='+lesson_status+'&time='+session_time+'&suspend_data='+suspend_data;
 	
     url="http://<?php
-    $self=$_SERVER['PHP_SELF'];
+    $self=api_get_self();
     $url=$_SERVER['HTTP_HOST'].$self;
     $url=substr($url,0,-14);//14 is the length of this file's name (/scorm_api.php)
     echo $url;

+ 1 - 1
main/newscorm/scorm_api.php

@@ -445,7 +445,7 @@ function savedata(origin) { //origin can be 'commit', 'finish' or 'terminate'
     /*param = 'id='+lms_item_id+'&origin='+origin+'&score='+score+'&max='+max+'&min='+min+'&lesson_status='+lesson_status+'&time='+session_time+'&suspend_data='+suspend_data;
 	
     url="http://<?php
-    $self=$_SERVER['PHP_SELF'];
+    $self=api_get_self();
     $url=$_SERVER['HTTP_HOST'].$self;
     $url=substr($url,0,-14);//14 is the length of this file's name (/scorm_api.php)
     echo $url;

+ 4 - 4
main/permissions/permissions_functions.inc.php

@@ -263,7 +263,7 @@ function display_image_matrix($permission_array, $tool, $permission,$inherited_p
 			{
 				if($editable)
 				{
-					$url=$_SERVER['PHP_SELF'];
+					$url=api_get_self();
 					foreach($_GET as $key=>$value)
 					{
 						$parameter[$key]=$value;
@@ -289,7 +289,7 @@ function display_image_matrix($permission_array, $tool, $permission,$inherited_p
 			{
 				if($editable)
 				{
-					$url=$_SERVER['PHP_SELF'];
+					$url=api_get_self();
 					foreach($_GET as $key=>$value)
 					{
 						$parameter[$key]=$value;
@@ -346,7 +346,7 @@ function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $per
 			{
 				if($editable)
 				{
-					$url=$_SERVER['PHP_SELF'];
+					$url=api_get_self();
 					foreach($_GET as $key=>$value)
 					{
 						$parameter[$key]=$value;
@@ -374,7 +374,7 @@ function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $per
 			{
 				if($editable)
 				{
-					$url=$_SERVER['PHP_SELF'];
+					$url=api_get_self();
 					foreach($_GET as $key=>$value)
 					{
 						$parameter[$key]=$value;