示例#1
0
function olc_seo_url($url)
{
    //W. Kaiser - Search friendly URLs
    if (USE_SEO) {
        $slash_pos = strrpos($url, SLASH);
        if ($slash_pos !== false) {
            $slash_pos++;
        }
        $pos = strrpos($url, QUESTION);
        if ($pos !== false) {
            $url_b = substr($url, 0, $pos);
            $parameters = substr($url, $pos + 1);
        } else {
            $url_b = $url;
            $parameters = EMPTY_STRING;
        }
        $url_b = basename($url_b);
        global $seo_urls_to_convert, $seo_action_parameter;
        //URLs are built like:
        //http://www.server.de/olcommerce/seo-processor-par1-val1-par2-val2-...-parn-valn.htm
        //e.g.: http://www.server.de/olcommerce/seo-products_info-products_id-144.htm
        global $seo_array_1, $seo_array_2;
        if (DO_SEO_EXTENDED) {
            global $seo_search, $seo_replace;
            $add_parameters = EMPTY_STRING;
            $processor_type = EMPTY_STRING;
            if ($url_b == FILENAME_PRODUCT_INFO) {
                $rewritten = true;
                $products_id = get_parameter($parameters, 'products_id', $add_parameters);
                if ($products_id) {
                    if (strpos($add_parameters, 'add_product') == false) {
                        $processor_type = 'p';
                    } else {
                        $processor_type = 'a';
                        $add_parameters = EMPTY_STRING;
                    }
                    $url_par = preg_replace($seo_search, $seo_replace, olc_get_products_name($products_id)) . SEMI_COLON . $products_id;
                }
            } elseif ($url_b == FILENAME_DEFAULT) {
                global $seo_categories;
                $check_parameter = 'BUYproducts_id';
                $products_id = get_parameter($parameters, $check_parameter, $add_parameters);
                if ($products_id) {
                    $processor_type = 'b';
                    $url_par = strtolower(olc_get_products_name($products_id, SESSION_LANGUAGE_ID));
                    $url_par = preg_replace($seo_search, $seo_replace, $url_par) . SEMI_COLON . $products_id;
                    $add_parameters = str_replace('action=buy_now', EMPTY_STRING, $add_parameters);
                    if ($add_parameters[0] == AMP) {
                        $add_parameters = substr($add_parameters, 1);
                    }
                } else {
                    $category_id = get_parameter($parameters, 'cPath', $add_parameters);
                    if ($category_id) {
                        $processor_type = 'k';
                        $url_par = EMPTY_STRING;
                        $category_id = explode(UNDERSCORE, $category_id);
                        $categories = sizeof($category_id);
                        for ($i = 0; $i < $categories; $i++) {
                            if ($url_par) {
                                $url_par .= SEO_SEPARATOR;
                            }
                            $url_par .= preg_replace($seo_search, $seo_replace, $seo_categories[$category_id[$i]]);
                        }
                    } else {
                        $manufacturer_id = get_parameter($parameters, 'manufacturers_id', $add_parameters);
                        if ($manufacturer_id) {
                            $processor_type = 'm';
                            $manufacturers = olc_get_manufacturers();
                            foreach ($manufacturers as $manufacturer_id) {
                                if ($manufacturer_id['id'] == $manufacturer_id) {
                                    $maname = $manufacturer_id['text'];
                                    break;
                                }
                            }
                            $url .= shopstat_hrefManulink($maname, $manufacturer_id, $url);
                        } else {
                            $filter_id = get_parameter($parameters, 'filter_id', $add_parameters);
                            if ($filter_id) {
                            } else {
                                //return $url;
                            }
                        }
                    }
                }
            } elseif ($url_b == FILENAME_CONTENT) {
                $content_id = get_parameter($parameters, 'coID', $add_parameters);
                if ($content_id) {
                    $processor_type = 'c';
                    $url_par = 'content' . SEMI_COLON . $content_id;
                }
            } else {
                //return $url;
            }
            if (!$processor_type) {
                /*
                $url_par=explode(PHP,$url);
                $url_par=$url_par[0];
                $pos=strrpos($url_par,SLASH);
                if ($pos!==false)
                {
                	$url_par=substr($url_par,$pos+1);
                	$processor_type='g';
                	if ($parameters)
                	{
                		$add_parameters=$parameters;
                	}
                }
                else
                {
                	return $url;
                }
                */
                return $url;
            }
            if ($processor_type) {
                $processor_type .= SEO_SEPARATOR;
            }
        } else {
            $url = str_replace($seo_array_1, SEO_SEPARATOR, str_replace($seo_array_2, SEO_SEPARATOR, $url));
            $url_par = EMPTY_STRING;
        }
        $url = str_replace(PHP, EMPTY_STRING, $url);
        if ($slash_pos === false) {
            $url = EMPTY_STRING;
        } else {
            $url = substr($url, 0, $slash_pos);
        }
        $url .= SEO_PAGENAME_START . $processor_type;
        $url .= $url_par . SEO_TERMINATOR;
        if ($add_parameters) {
            $url .= QUESTION . $add_parameters;
        }
    }
    return $url;
}
            $products_name_query = olc_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $reviews['products_id'] . "' and language_id = '" . SESSION_LANGUAGE_ID . APOS);
            $products_name = olc_db_fetch_array($products_name_query);
            $reviews_average_query = olc_db_query("select (avg(reviews_rating) / 5 * 100) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . $reviews['products_id'] . APOS);
            $reviews_average = olc_db_fetch_array($reviews_average_query);
            $review_info = olc_array_merge($reviews_text, $reviews_average, $products_name);
            $rInfo_array = olc_array_merge($reviews, $review_info, $products_image);
            $rInfo = new objectInfo($rInfo_array);
        }
        if (is_object($rInfo) && $reviews['reviews_id'] == $rInfo->reviews_id) {
            echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id . '&action=preview') . '">' . NEW_LINE;
        } else {
            echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $reviews['reviews_id']) . '">' . NEW_LINE;
        }
        ?>
                <td class="dataTableContent"><?php 
        echo HTML_A_START . olc_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $reviews['reviews_id'] . '&action=preview') . '">' . olc_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>&nbsp;' . olc_get_products_name($reviews['products_id']);
        ?>
</td>
                <td class="dataTableContent" align="right"><?php 
        echo olc_image(DIR_WS_CATALOG_IMAGES . 'stars_' . $reviews['reviews_rating'] . '.gif');
        ?>
</td>
                <td class="dataTableContent" align="right"><?php 
        echo olc_date_short($reviews['date_added']);
        ?>
</td>
                <td class="dataTableContent" align="right"><?php 
        if (is_object($rInfo) && $reviews['reviews_id'] == $rInfo->reviews_id) {
            echo olc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif');
        } else {
            echo HTML_A_START . olc_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $reviews['reviews_id']) . '">' . olc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . HTML_A_END;
                if ($pos === false) {
                    $last_page_text = TEXT_START_PAGE;
                } else {
                    $pos1 = strpos($last_page_url, AMP, $pos + strlen($s));
                    //Find parameter terminator
                    if ($pos1 == false) {
                        $pos1 = strlen($last_page_url);
                    }
                    $products_id = substr($last_page_url, $pos, $pos1 - $pos);
                    if ($mapit) {
                        //Get id from name
                        $product_query = olc_db_query("select products_id from " . TABLE_PRODUCTS . " where products_model = '" . $product_id . APOS);
                        $product = olc_db_fetch_array($product_query);
                        $products_id = $product['products_id'];
                    }
                    $last_page_text = TEXT_PRODUCTS_PAGE . olc_get_products_name($products_id);
                }
                $last_page_url = HTML_A_START . olc_href_link(ADMIN_PATH_PREFIX . $last_page_url, 'pop_up=true') . '" target="_blank">' . $last_page_text . HTML_A_END;
            }
        }
        $full_name = $whos_online['full_name'];
        $customer_id = $whos_online['customer_id'];
        if ($customer_id == 0) {
            $customer_id = $full_name;
        }
        $whos_online_row .= $td_start . $rab . gmdate($date_format, $time_online) . $td_end . $td_start . $align_right . $whos_online['customer_id'] . $td_end . $td_start . $rab . $full_name . $td_end . $td_start . $align_right . $ip_address . $td_end . $td_start . $rab . date($date_format, $whos_online['time_entry']) . $td_end . $td_start . $align_right . date($date_format, $whos_online['time_last_click']) . $td_end . $td_start . $rab . $last_page_url . $td_end;
        $whos_online_row .= $col_end . '
              						</tr>
';
        $main_content .= $whos_online_row;
        if ($is_periodic) {
		    </table>
		  </td>
	  </tr>
	</table>
	<br /><br />
	<?php 
$products_id = $pInfo->products_id;
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
    $lang_id = $languages[$i]['id'];
    ?>
	 <table width="100%" border="0">
	  <tr>
	    <td valign="middle" class="menuBoxHeading">
	    <?php 
    $lang_image = olc_image(ADMIN_PATH_PREFIX . 'lang/' . $languages[$i]['directory'] . SLASH . $languages[$i]['image'], $languages[$i]['name'], EMPTY_STRING, EMPTY_STRING, 'align=middle') . HTML_NBSP;
    $products_name = $is_post && $products_name[$lang_id] ? stripslashes($products_name[$lang_id]) : olc_get_products_name($products_id, $lang_id);
    $products_name = str_replace('\\', EMPTY_STRING, $products_name);
    echo $lang_image . TEXT_PRODUCTS_NAME;
    ?>
&nbsp;<?php 
    echo olc_draw_input_field('products_name[' . $lang_id . ']', $products_name, 'size=60');
    ?>
</td>
	  </tr>
	  <tr>
	    <td class="main"><?php 
    echo TEXT_PRODUCTS_URL . '&nbsp;<small>' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . '</small>';
    ?>
	    <?php 
    echo olc_draw_input_field('products_url[' . $lang_id . ']', $is_post && $products_url[$lang_id] ? stripslashes($products_url[$lang_id]) : olc_get_products_url($products_id, $lang_id), 'size=60');
    ?>
    default:
        if ($rows > 0) {
            if (is_object($cInfo)) {
                // category info box contents
                $heading[] = array('text' => HTML_B_START . $cInfo->categories_name . HTML_B_END);
                $contents[] = array('align' => 'center', 'text' => HTML_A_START . olc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=edit_category') . '">' . olc_image_button('button_edit.gif', IMAGE_EDIT) . '</a>
		<a href="' . olc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=delete_category') . '">' . olc_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . olc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=move_category') . '">' . olc_image_button('button_move.gif', IMAGE_MOVE) . HTML_A_END);
                $contents[] = array('text' => HTML_BR . TEXT_DATE_ADDED . HTML_NBSP . olc_date_short($cInfo->date_added));
                if (olc_not_null($cInfo->last_modified)) {
                    $contents[] = array('text' => TEXT_LAST_MODIFIED . HTML_NBSP . olc_date_short($cInfo->last_modified));
                }
                $contents[] = array('text' => HTML_BR . olc_info_image_c($cInfo->categories_image, $cInfo->categories_name) . HTML_BR . $cInfo->categories_image);
                $contents[] = array('text' => HTML_BR . TEXT_SUBCATEGORIES . HTML_NBSP . $cInfo->childs_count . HTML_BR . TEXT_PRODUCTS . HTML_NBSP . $cInfo->products_count);
            } elseif (is_object($pInfo)) {
                // product info box contents
                $heading[] = array('text' => HTML_B_START . olc_get_products_name($pInfo->products_id, $_SESSION['languages_id']) . HTML_B_END);
                $contents[] = array('align' => 'center', 'text' => HTML_A_START . olc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=new_product') . '">' . olc_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . olc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=delete_product') . '">' . olc_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . olc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=move_product') . '">' . olc_image_button('button_move.gif', IMAGE_MOVE) . '</a> <a href="' . olc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=copy_to') . '">' . olc_image_button('button_copy_to.gif', IMAGE_COPY_TO) . HTML_A_END . olc_draw_form('edit_attributes', FILENAME_NEW_ATTRIBUTES, EMPTY_STRING, 'post') . '
		<input type="hidden" name="action" value="edit"><input type="hidden" name="current_product_id" value="' . $pInfo->products_id . '"><input type="hidden" name="cpath" value="' . $cPath . '">' . olc_image_submit('button_edit_attributes.gif', 'edit_attributes') . '</form>');
                $contents[] = array('text' => HTML_BR . TEXT_DATE_ADDED . HTML_NBSP . olc_date_short($pInfo->products_date_added));
                if (olc_not_null($pInfo->products_last_modified)) {
                    $contents[] = array('text' => TEXT_LAST_MODIFIED . HTML_NBSP . olc_date_short($pInfo->products_last_modified));
                }
                if (date('Y-m-d') < $pInfo->products_date_available) {
                    $contents[] = array('text' => sprintf(TEXT_DATE_AVAILABLE, olc_date_short($pInfo->products_date_available)));
                }
                $contents[] = array('text' => HTML_BR . olc_product_info_image($pInfo->products_image, $pInfo->products_name) . HTML_BR . $pInfo->products_image);
                // START IN-SOLUTION Berechung des Bruttopreises
                $price = $pInfo->products_price;
                $price = olc_round($price, PRICE_PRECISION);
                $price_string = TEXT_PRODUCTS_PRICE_INFO . HTML_NBSP . $currencies->format($price);
                if (PRICE_IS_BRUTTO == TRUE_STRING_S && ($_GET['read'] == 'only' || $action != 'new_product_preview')) {
 require_once DIR_FS_INC . 'olc_get_products_price_specials.inc.php';
 $products_id_par = 'products_id=';
 $params = olc_get_all_get_params(array('action')) . 'action=buy_now&BUY' . $products_id_par;
 $buy_now_link = HTML_A_START . olc_href_link(basename($PHP_SELF), $params . HASH) . '">' . olc_image_button('button_buy_now.gif', TEXT_BUY . ATSIGN . TEXT_NOW) . HTML_A_END;
 $product_link = olc_href_link(FILENAME_PRODUCT_INFO, $products_id_par . HASH);
 $cat_path = olc_href_link(FILENAME_DEFAULT, 'cPath=' . HASH);
 $img = olc_image(DIR_WS_THUMBNAIL_IMAGES . HASH, ATSIGN);
 $tracking_products_history = $_SESSION[TRACKING][PRODUCTS_HISTORY];
 $i = 0;
 $max = count($tracking_products_history);
 while ($i < $max) {
     $products_id = $tracking_products_history[$i];
     $product_history_query = olc_db_query(SELECT_ALL . TABLE_PRODUCTS . "\n\t\twhere\n\t\tproducts_status = 1 and\n\t\tproducts_id = " . $products_id);
     $history_product = olc_db_fetch_array($product_history_query);
     if ($history_product['products_status'] != 0) {
         $products_name = olc_get_products_name($products_id);
         $products_image = $history_product['image'];
         $products_price = olc_get_products_price_specials($products_id, $price_special = 1, $quantity = 1, $price_special_info, $products_price_real);
         if ($products_price_real < 0) {
             $products_price = olc_format_price(abs($products_price_real), true, true, true);
         }
         $buy_now = str_replace(HASH, $products_id, $buy_now_link);
         $buy_now = str_replace(ATSIGN, $products_name, $buy_now);
         $cpath = olc_get_product_path($products_id);
         $products_image = str_replace(HASH, $products_image, $img);
         $products_image = str_replace(ATSIGN, $products_name, $products_image);
         $products_history[] = array('PRODUCTS_NAME' => $products_name, 'PRODUCTS_IMAGE' => $products_image, 'PRODUCTS_PRICE' => $products_price, 'PRODUCTS_URL' => str_replace(HASH, $products_id, $product_link), 'PRODUCTS_CATEGORY_URL' => str_replace(HASH, $cpath, $cat_path), 'BUY_NOW_BUTTON' => $buy_now);
         $i++;
     }
 }
 $smarty->assign('products_history', $products_history);
                 		define('FORCE_PRODUCT_INFO_DISPLAY',true);
                 		olc_redirect($link);
                 	}
                 }
                 */
             }
             if (isset($_GET['gallery']) || olc_has_product_attributes($BUYproduct)) {
                 define('FORCE_PRODUCT_INFO_DISPLAY', true);
                 olc_redirect($link);
             } else {
                 $products_min_order_quantity = max(1, $permission['products_min_order_quantity']);
                 $_SESSION['cart']->add_cart($BUYproduct, $_SESSION['cart']->get_quantity($BUYproduct) + $products_min_order_quantity);
                 $_SESSION['cart_modified'] = true;
             }
         } else {
             $products_name = str_replace(HTML_AMP, AMP, olc_get_products_name($permission['products_id']));
             $error_message = sprintf(TEXT_SOLD_OUT, $products_name);
             if (strlen($products_date_available) > 0) {
                 require_once DIR_FS_INC . 'olc_date_short.inc.php';
                 $product_available = str_replace(HTML_B_START, EMPTY_STRING, sprintf(TEXT_DATE_AVAILABLE, olc_date_short($products_date_available)));
                 $error_message .= "\n\n" . str_replace(HTML_B_END, EMPTY_STRING, $product_available);
             }
         }
     } else {
         $error_message = sprintf(TEXT_NO_PRODUCT, $type, $BUYproduct);
     }
 } else {
     $error_message = sprintf(TEXT_NR_REQUIRED, $type);
 }
 if (strlen($error_message) > 0) {
     if (IS_AJAX_PROCESSING) {