grzejan 2007-05-23 09:54
skopiowałem całą zawartoś tego pliku: <?php if( !function_exists( 'listProducts' ) ){ /** * List products and return content * @return string * @param string $sFile * @param string $sOption * @param mixed $mValue * @param int $iList */ function listProducts( $sFile = 'products_list.tpl', $sOption = 'list', $mValue = null, $iList = null ){ if( !isset( $GLOBALS['iPage'] ) || !is_numeric( $GLOBALS['iPage'] ) || $GLOBALS['iPage'] < 1 ) $GLOBALS['iPage'] = 1; $iStatus = throwStatus( ); if( !isset( $iList ) ){ if( $iStatus == 1 ) $iList = PRODUCTS_LIST; else $iList = ADMIN_LIST; } if( $sOption == 'category' ){ $aData = dbListProductsCategory( $iStatus, $mValue, $iList ); $sPage = $GLOBALS['p'].'&iCategory='.$GLOBALS['iCategory']; } elseif( $sOption == 'search' ){ $aData = dbListProductsSearch( $iStatus, trim( $mValue ), $iList ); $sPage = $GLOBALS['p'].'&sWord='.$GLOBALS['sWord']; } else{ $aData = dbListProducts( $iStatus, $iList ); $sPage = $GLOBALS['p']; } if( isset( $aData ) && is_array( $aData ) ) $content = throwProductsData( $sFile, $aData, $sPage, $iList ); else $content = $GLOBALS['tpl']->tbHtml( $sFile, 'NOT_FOUND' ); return $content; } // end function listProducts } if( !function_exists( 'throwProductsData' ) ){ /** * Create products list from array * @return string * @param string $sFile * @param array $aData * @param string $sPage * @param int $iList */ function throwProductsData( $sFile, $aData, $sPage, $iList ){ global $tpl, $aList, $oFF, $sOldPrice; $aPhoto = throwFirstPhoto( 1 ); $iCount = count( $aData ); $content = null; $aCategories = throwProductsCategories( ); for( $i = 0; $i < $iCount; $i++ ){ list( $aList['iProduct'], $aList['sName'], $aList['fPrice'], $aList['sDescriptionShort'], $aList['iStatus'], $aList['iPosition'], $aList['iPromoProduct'], $aList['iNewProduct'], $aList['iVat'], $aList['iShowOld'], $aList['fOldPrice'] ) = $aData[$i]; if( isset( $aPhoto[$aList['iProduct']] ) && is_file( DIR_PRODUCTS_FILES.$aPhoto[$aList['iProduct']]['sPhoto'] ) ){ $aName = $oFF->throwNameExtOfFile( $aPhoto[$aList['iProduct']]['sPhoto'] ); $aList['sFile'] = $aPhoto[$aList['iProduct']]['sPhoto']; $aList['sPhotoSmall'] = DIR_PRODUCTS_FILES.$aName[0].'_m.'.$aName[1]; $aList['sPhotoBig'] = DIR_PRODUCTS_FILES.$aPhoto[$aList['iProduct']]['sPhoto']; $aList['sPhoto'] = $tpl->tbHtml( $sFile, 'PHOTO' ); } else{ $aList['sPhoto'] = ' '; } if( $i % 2 ) $aList['iStyle'] = 0; else $aList['iStyle'] = 1; if( empty( $aList['sDescriptionShort'] ) ) $aList['sDescriptionShort'] = ' '; else $aList['sDescriptionShort'] = ereg_replace( '\|n\|', '', $aList['sDescriptionShort'] ); $aList['sCategories'] = throwTreeForProduct( $aCategories[$aList['iProduct']], $sFile ); if ($aList['iShowOld'] == 1) $sOldPrice = sprintf("<strike><font color='red'>%.2f %s</font></strike>",$aList['fOldPrice'],$GLOBALS['config']['currency_symbol']); else $sOldPrice = ''; $content .= $tpl->tbHtml( $sFile, 'LIST_LIST' ); } // end for $aList['sPages'] = countPages( $aData[0]['iFindAll'], $iList, $GLOBALS['iPage'], $sPage ); return $tpl->tbHtml( $sFile, 'LIST_HEAD' ).$content.$tpl->tbHtml( $sFile, 'LIST_FOOTER' ); } // end function throwProductsData } if( !function_exists( 'throwProduct' ) ){ /** * Return product data * @return array * @param int $iProduct */ function throwProduct( $iProduct ){ global $oFF; $iStatus = throwStatus( ); $aData = dbThrowProduct( $iProduct, $iStatus ); $aCategories = throwProductCategories( $iProduct ); if( isset( $aData ) && ( $iStatus === 0 || ( isset( $aCategories ) && is_array( $aCategories ) ) ) ){ $aList = dbThrowProductExt( $iProduct ); $aList['sDescriptionFull'] = $aList[1]; list( $aList['iProduct'], $aList['sName'], $aList['fPrice'], $aList['sDescriptionShort'], $aList['iStatus'], $aList['iPosition'], $aList['iPromoProduct'], $aList['iNewProduct'], $aList['iVat'], $aList['iShowOld'], $aList['fOldPrice'] ) = $aData; $aList[promoproduct] = ($aList['iPromoProduct'] == '1') ? 'checked="checked"' : ''; $aList[newproduct] = ($aList['iNewProduct'] == '1') ? 'checked="checked"' : ''; $aList[showold] = ($aList['iShowOld'] == '1') ? 'checked="checked"' : ''; $aList['aCategories'] = $aCategories; return $aList; } else return null; } // end function throwProduct } if( !function_exists( 'throwProducts' ) ){ /** * Returns products in array * index - iProduct * value - sName * @return array */ function throwProducts( ){ return dbThrowProducts( ); } // end function throwProducts } if( !function_exists( 'throwProductCategories' ) ){ /** * Returns categories defined to product * @return array * @param int $iProduct */ function throwProductCategories( $iProduct ){ $aData = dbThrowProductCategories( ); if( isset( $aData[$iProduct] ) ) return $aData[$iProduct]; } // end function throwProductCategories } if( !function_exists( 'throwProductsCategories' ) ){ /** * Returns categories defined to products * @return array */ function throwProductsCategories( ){ } // end function throwProductsCategories } function throwProducts( ){ return dbThrowProducts( ); } // end function throwProducts if( !function_exists( 'listProductsPromoNew' ) ) { function listProductsPromoNew() { global $tpl, $aList, $oFF, $sPromoProduct_Name, $sPromoProduct_Img, $iPromoProduct_Idx, $sNewProduct_Name, $sNewProduct_Img, $iNewProduct_Idx; $aFile = file( DB_PRODUCTS ); $iCount = count( $aFile ); sort( $aFile ); for( $i = 0; $i < $iCount; $i++ ) { $aExp = explode( '$', $aFile[$i] ); $aData[] = $aExp; } $aPhoto = throwFirstPhoto( 1 ); $iCount = count( $aData ); $iPromoProduct = 0; $iNewProduct = 0; $aPromoTemp_Name = array(); $aPromoTemp_Img = array(); $aPromoTemp_Idx = array(); $aNewTemp_Name = array(); $aNewTemp_Img = array(); $aNewTemp_Idx = array(); for( $i = 0; $i < $iCount; $i++ ) { list( $aList['iProduct'], $aList['sName'], $aList['fPrice'], $aList['sDescriptionShort'], $aList['iStatus'], $aList['iPosition'], $aList['iPromoProduct'], $aList['iNewProduct'], $aList['iVat'], $aList['iShowOld'], $aList['fOldPrice'] ) = $aData[$i]; if( isset( $aPhoto[$aList['iProduct']] ) && is_file( DIR_PRODUCTS_FILES.$aPhoto[$aList['iProduct']]['sPhoto'] ) ) { $aName = $oFF->throwNameExtOfFile( $aPhoto[$aList['iProduct']]['sPhoto'] ); $aList['sPhotoSmall'] = DIR_PRODUCTS_FILES.$aName[0].'_m.'.$aName[1]; if ( $aList['iPromoProduct'] == '1' ) { array_push( $aPromoTemp_Name, $aList['sName'] ); array_push( $aPromoTemp_Img , $aList['sPhotoSmall'] ); array_push( $aPromoTemp_Idx , $aList['iProduct'] ); $iPromoProduct++; } if ( $aList['iNewProduct'] == '1' ) { array_push( $aNewTemp_Name, $aList['sName'] ); array_push( $aNewTemp_Img , $aList['sPhotoSmall'] ); array_push( $aNewTemp_Idx , $aList['iProduct'] ); $iNewProduct++; } } } mt_srand( (double)microtime( ) * 1000000 ); $iPromoTemp_RandValue = mt_rand( 0, sizeof( $aPromoTemp_Name ) - 1 ); $iNewTemp_RandValue = mt_rand( 0, sizeof( $aNewTemp_Name ) - 1 ); $sPromoProduct_Name = $aPromoTemp_Name[$iPromoTemp_RandValue]; $sPromoProduct_Img = $aPromoTemp_Img[$iPromoTemp_RandValue]; $iPromoProduct_Idx = $aPromoTemp_Idx[$iPromoTemp_RandValue]; $sNewProduct_Name = $aNewTemp_Name[$iNewTemp_RandValue]; $sNewProduct_Img = $aNewTemp_Img[$iNewTemp_RandValue]; $iNewProduct_Idx = $aNewTemp_Idx[$iNewTemp_RandValue]; $sEmptyLayout = ''; if ($iPromoProduct > 0) { $sPromoLayout_1 = $tpl->tbHtml( 'categories_menu.tpl', 'PROMO_PRODUCT' ); if ($iNewProduct == 0) $sPromoLayout_2 = $tpl->tbHtml( 'categories_menu.tpl', 'FINISH_CATEGORIES_MENU' ); $sPromoLayout = sprintf("%s%s",$sPromoLayout_1,$sPromoLayout_2); } else { $sEmptyLayout = $tpl->tbHtml( 'categories_menu.tpl', 'FINISH_CATEGORIES_MENU' ); } if ($iNewProduct > 0) { $sNewLayout_1 = $tpl->tbHtml( 'categories_menu.tpl', 'NEW_PRODUCT' ); $sNewLayout_2 = $tpl->tbHtml( 'categories_menu.tpl', 'FINISH_CATEGORIES_MENU' ); $sNewLayout = sprintf("%s%s",$sNewLayout_1,$sNewLayout_2); } else { $sEmptyLayout = $tpl->tbHtml( 'categories_menu.tpl', 'FINISH_CATEGORIES_MENU' ); } if (($iPromoProduct > 0) && ($iNewProduct > 0)) { $sLayout = sprintf("%s%s",$sPromoLayout,$sNewLayout); } if (($iPromoProduct > 0) && ($iNewProduct == 0)) { $sLayout = $sPromoLayout; } if (($iPromoProduct == 0) && ($iNewProduct > 0)) { $sLayout = $sNewLayout; } if (($iPromoProduct == 0) && ($iNewProduct == 0)) { $sLayout = $sEmptyLayout; } return $sLayout; } // end function listProductsPomoNew } ?>
merci 2007-05-23 10:56
grzejan - powodem tego, ze skrypt moze dzialac na jednym serwerze, a na innym pojawiaja sie te ostrzezenia jest to, ze serwery te moga miec inaczej ustawione raportowanie bledow. Są to ostrzezenia, a nie bledy, dlatego skrypt mimo to moze dzialac prawidlowo,jednak nalezy poprawic ten skrypt. Z tego co widze, plik, który Pan wkleil jest mocno zmodyfikowany i bledy doycza wlasnie fragmentu nie pisanego przez nas, dlatego prosze skontaktowac sie z osoba, ktora wykonala dla Pana ta modyfikacje i poprosic o poprawienie tego.