[TEP-COMMIT] [CVS catalog] call $_SERVER['PHP_SELF'] instead

anonymous-OfajU3CKLf1/[email protected] 13 Apr 2004 07:56:01 -0000
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
Commit in catalog/catalog/includes/classes on MAIN

navigation_history.php +17 -7 1.8 -> 1.9

payment.php +7 -3 1.39 -> 1.40

shipping.php +7 -3 1.24 -> 1.25

split_page_results.php +10 -6 1.16 -> 1.17

+41 -19

4 modified files

call $_SERVER['PHP_SELF'] instead

----------

catalog /catalog /includes /classes

navigation_history.php 1.8 -> 1.9

diff -u -r1.8 -r1.9
--- navigation_history.php 2003/12/04 12:48:04 1.8
+++ navigation_history.php 2004/04/13 07:55:58 1.9
@@ -25,7 +25,11 @@

}

function add_current_page() {

- global $PHP_SELF, $request_type, $cPath;

+ if (PHP_VERSION < 4.1) {
+ global $_SERVER;
+ }
+
+ global $request_type, $cPath;

if ($this->set_global) {
global $_GET, $_POST;

@@ -33,7 +37,7 @@

$set = 'true';
for ($i=0, $n=sizeof($this->path); $i<$n; $i++) {

- if ($this->path[$i]['page'] == basename($PHP_SELF)) {

+ if ($this->path[$i]['page'] == basename($_SERVER['PHP_SELF'])) {

if (isset($cPath)) {
if (!isset($this->path[$i]['get']['cPath'])) {
continue;

@@ -64,7 +68,7 @@

}

if ($set == 'true') {

- $this->path[] = array('page' => basename($PHP_SELF),

+ $this->path[] = array('page' => basename($_SERVER['PHP_SELF']),

'mode' => $request_type,
'get' => $_GET,
'post' => $_POST);

@@ -72,16 +76,22 @@

}

function remove_current_page() {

- global $PHP_SELF;

+ if (PHP_VERSION < 4.1) {
+ global $_SERVER;
+ }

$last_entry_position = sizeof($this->path) - 1;

- if ($this->path[$last_entry_position]['page'] == basename($PHP_SELF)) {

+ if ($this->path[$last_entry_position]['page'] == basename($_SERVER['PHP_SELF'])) {

unset($this->path[$last_entry_position]);
}
}

function set_snapshot($page = '') {

- global $PHP_SELF, $request_type;

+ if (PHP_VERSION < 4.1) {
+ global $_SERVER;
+ }
+
+ global $request_type;

if ($this->set_global) {
global $_GET, $_POST;

@@ -93,7 +103,7 @@

'get' => $page['get'],
'post' => $page['post']);
} else {

- $this->snapshot = array('page' => basename($PHP_SELF),

+ $this->snapshot = array('page' => basename($_SERVER['PHP_SELF']),

'mode' => $request_type,
'get' => $_GET,
'post' => $_POST);

----------

catalog /catalog /includes /classes

payment.php 1.39 -> 1.40

diff -u -r1.39 -r1.40
--- payment.php 2003/12/04 14:29:40 1.39
+++ payment.php 2004/04/13 07:55:58 1.40
@@ -15,14 +15,18 @@

// class constructor
function payment($module = '') {

- global $osC_Session, $PHP_SELF;

+ if (PHP_VERSION < 4.1) {
+ global $_SERVER;
+ }
+
+ global $osC_Session;

if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
$this->modules = explode(';', MODULE_PAYMENT_INSTALLED);

$include_modules = array();

- if ( (tep_not_null($module)) && (in_array($module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) {

+ if ( (tep_not_null($module)) && (in_array($module . '.' . substr($_SERVER['PHP_SELF'], (strrpos($_SERVER['PHP_SELF'], '.')+1)), $this->modules)) ) {

$this->selected_module = $module;

$include_modules[] = array('class' => $module, 'file' => $module . '.php');

@@ -62,7 +66,7 @@

The following method is a work-around to implementing the method in all
payment modules available which would break the modules in the contributions
section. This should be looked into again post 2.2.

-*/

+*/

function update_status() {
if (is_array($this->modules)) {
if (isset($GLOBALS[$this->selected_module]) && is_object($GLOBALS[$this->selected_module])) {

----------

catalog /catalog /includes /classes

shipping.php 1.24 -> 1.25

diff -u -r1.24 -r1.25
--- shipping.php 2003/11/17 19:35:04 1.24
+++ shipping.php 2004/04/13 07:55:58 1.25
@@ -15,15 +15,19 @@

// class constructor
function shipping($module = '') {

- global $osC_Session, $PHP_SELF;

+ if (PHP_VERSION < 4.1) {
+ global $_SERVER;
+ }

+ global $osC_Session;
+

if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {
$this->modules = explode(';', MODULE_SHIPPING_INSTALLED);

$include_modules = array();

- if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) {
- $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)));

+ if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($_SERVER['PHP_SELF'], (strrpos($_SERVER['PHP_SELF'], '.')+1)), $this->modules)) ) {
+ $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($_SERVER['PHP_SELF'], (strrpos($_SERVER['PHP_SELF'], '.')+1)));

} else {
reset($this->modules);
while (list(, $value) = each($this->modules)) {

----------

catalog /catalog /includes /classes

split_page_results.php 1.16 -> 1.17

diff -u -r1.16 -r1.17
--- split_page_results.php 2003/11/17 19:43:52 1.16
+++ split_page_results.php 2004/04/13 07:55:58 1.17
@@ -73,7 +73,11 @@

// display split-page-number-links
function display_links($max_page_links, $parameters = '') {

- global $PHP_SELF, $request_type;

+ if (PHP_VERSION < 4.1) {
+ global $_SERVER;
+ }
+
+ global $request_type;

$display_links_string = '';

@@ -82,7 +86,7 @@

if (tep_not_null($parameters) && (substr($parameters, -1) != '&')) $parameters .= '&';

// previous button - not displayed on first page

- if ($this->current_page_number > 1) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . ($this->current_page_number - 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' "><u>' . PREVNEXT_BUTTON_PREV . '</u></a>&nbsp;&nbsp;';

+ if ($this->current_page_number > 1) $display_links_string .= '<a href="' . tep_href_link(basename($_SERVER['PHP_SELF']), $parameters . $this->page_name . '=' . ($this->current_page_number - 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' "><u>' . PREVNEXT_BUTTON_PREV . '</u></a>&nbsp;&nbsp;';

// check if number_of_pages > $max_page_links
$cur_window_num = intval($this->current_page_number / $max_page_links);

@@ -92,22 +96,22 @@

if ($this->number_of_pages % $max_page_links) $max_window_num++;

// previous window of pages

- if ($cur_window_num > 1) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . (($cur_window_num - 1) * $max_page_links), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>';

+ if ($cur_window_num > 1) $display_links_string .= '<a href="' . tep_href_link(basename($_SERVER['PHP_SELF']), $parameters . $this->page_name . '=' . (($cur_window_num - 1) * $max_page_links), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>';

// page nn button
for ($jump_to_page = 1 + (($cur_window_num - 1) * $max_page_links); ($jump_to_page <= ($cur_window_num * $max_page_links)) && ($jump_to_page <= $this->number_of_pages); $jump_to_page++) {
if ($jump_to_page == $this->current_page_number) {
$display_links_string .= '&nbsp;<b>' . $jump_to_page . '</b>&nbsp;';
} else {

- $display_links_string .= '&nbsp;<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . $jump_to_page, $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' "><u>' . $jump_to_page . '</u></a>&nbsp;';

+ $display_links_string .= '&nbsp;<a href="' . tep_href_link(basename($_SERVER['PHP_SELF']), $parameters . $this->page_name . '=' . $jump_to_page, $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' "><u>' . $jump_to_page . '</u></a>&nbsp;';

}
}

// next window of pages

- if ($cur_window_num < $max_window_num) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . (($cur_window_num) * $max_page_links + 1), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>&nbsp;';

+ if ($cur_window_num < $max_window_num) $display_links_string .= '<a href="' . tep_href_link(basename($_SERVER['PHP_SELF']), $parameters . $this->page_name . '=' . (($cur_window_num) * $max_page_links + 1), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>&nbsp;';

// next button

- if (($this->current_page_number < $this->number_of_pages) && ($this->number_of_pages != 1)) $display_links_string .= '&nbsp;<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . ($this->current_page_number + 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' "><u>' . PREVNEXT_BUTTON_NEXT . '</u></a>&nbsp;';

+ if (($this->current_page_number < $this->number_of_pages) && ($this->number_of_pages != 1)) $display_links_string .= '&nbsp;<a href="' . tep_href_link(basename($_SERVER['PHP_SELF']), $parameters . 'page=' . ($this->current_page_number + 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' "><u>' . PREVNEXT_BUTTON_NEXT . '</u></a>&nbsp;';

return $display_links_string;
}

CVSspam 0.2.8

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click