Update of /cvsroot/multishop/nuke_7.8/html/includes/oscommerce
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27094
Modified Files:
general.php
Log Message:
update to oscommerce-20051113
Index: general.php
===================================================================
RCS file: /cvsroot/multishop/nuke_7.8/html/includes/oscommerce/general.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** general.php 21 Nov 2005 13:47:38 -0000 1.1.1.1
--- general.php 4 Dec 2005 11:26:17 -0000 1.2
***************
*** 1636,1657 ****
////
// Return a product ID with attributes
! function tep_get_uprid($prid, $params) {
$uprid = $prid;
! if ( (is_array($params)) && (!strstr($prid, '{')) ) {
while (list($option, $value) = each($params)) {
! $uprid = $uprid . '{' . $option . '}' . $value;
}
}
! return $uprid;
}
////
// Return a product ID from a product ID with attributes
! function tep_get_prid($uprid) {
! $pieces = split('[{]', $uprid, 2);
return $pieces[0];
}
////
--- 1636,1706 ----
////
// Return a product ID with attributes
! function tep_get_uprid($prid, $params) {
! if (is_numeric($prid)) {
$uprid = $prid;
!
! if (is_array($params) && (sizeof($params) > 0)) {
! $attributes_check = true;
! $attributes_ids = '';
!
! reset($params);
while (list($option, $value) = each($params)) {
! if (is_numeric($option) && is_numeric($value)) {
! $attributes_ids .= '{' . (int)$option . '}' . (int)$value;
! } else {
! $attributes_check = false;
! break;
! }
! }
!
! if ($attributes_check == true) {
! $uprid .= $attributes_ids;
}
}
+ } else {
+ $uprid = tep_get_prid($prid);
! if (is_numeric($uprid)) {
! if (strpos($prid, '{') !== false) {
! $attributes_check = true;
! $attributes_ids = '';
!
! // strpos()+1 to remove up to and including the first { which would create an empty array element in explode()
! $attributes = explode('{', substr($prid, strpos($prid, '{')+1));
!
! for ($i=0, $n=sizeof($attributes); $i<$n; $i++) {
! $pair = explode('}', $attributes[$i]);
!
! if (is_numeric($pair[0]) && is_numeric($pair[1])) {
! $attributes_ids .= '{' . (int)$pair[0] . '}' . (int)$pair[1];
! } else {
! $attributes_check = false;
! break;
! }
! }
!
! if ($attributes_check == true) {
! $uprid .= $attributes_ids;
! }
! }
! } else {
! return false;
! }
}
+ return $uprid;
+ }
+
////
// Return a product ID from a product ID with attributes
! function tep_get_prid($uprid) {
! $pieces = explode('{', $uprid);
+ if (is_numeric($pieces[0])) {
return $pieces[0];
+ } else {
+ return false;
}
+ }
////
|