PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -0,0 +1,36 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {assign} function plugin
*
* Type: function<br>
* Name: assign<br>
* Purpose: assign a value to a template variable
* @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign}
* (Smarty online manual)
* @param array Format: array('var' => variable name, 'value' => value to assign)
* @param Smarty
*/
function smarty_function_assign($params, &$smarty)
{
extract($params);
if (empty($var)) {
throw new SmartyException("assign: missing 'var' parameter");
return;
}
if (!in_array('value', array_keys($params))) {
throw new SmartyException("assign: missing 'value' parameter");
return;
}
$smarty->assign($var, $value);
}
/* vim: set expandtab: */

View File

@ -0,0 +1,29 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: assign_array
*
*
* Examples: {assign_array var="foo" values="bar1,bar2"}
* {assign_array var="foo" values="bar1;bar2;bar3" delimiter=";"}
* -------------------------------------------------------------
*/
function smarty_function_assign_array($params, &$smarty)
{
extract($params);
if (empty($var)) {
throw new SmartyException("assign_array: missing 'var' parameter");
return;
}
if (!in_array('values', array_keys($params))) {
throw new SmartyException("assign_array: missing 'values' parameter");
return;
}
return $values[$var];
}

View File

@ -0,0 +1,46 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {categories_link} function plugin
*
* Type: function<br>
* Name: categories_link<br>
* Date: Oct 27, 2008<br>
* Purpose: URL for the categorie info<br>
* Input:<br>
* - cPath
*
* Examples: {categories_link category=17}
* Output: http:// ... index.php?content=shop&amp;category=17
* @author r23 <info@r23.de>
* @version 1.0
* @param array
* @param Smarty
* @return string
* @uses smarty_function_html_href_link()
*/
function smarty_function_categories_link($params, &$smarty)
{
require_once(MYOOS_INCLUDE_PATH . '/includes/lib/smarty-plugins/function.html_href_link.php');
$aContents = oos_get_content();
$result = array();
$link_params = array();
$link_params = array('content' => $aContents['shop']);
if (is_array($params)) {
$result = array_merge($link_params, $params);
} else {
throw new SmartyException("categories_link: extra attribute '$params' must an array", E_USER_NOTICE);
}
return smarty_function_html_href_link($result, $smarty);
}

View File

@ -0,0 +1,83 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {large_category_image} function plugin
*
* Type: function<br>
* Name: large_category_image<br>
* Date: Aug 24, 2004<br>
* Purpose: format HTML tags for the image<br>
* Input:<br>
* - image =image width (optional, default actual width)
* - border = border width (optional, default 0)
* - height = image height (optional, default actual height)
*
* Examples: {large_category_image file="images/masthead.gif"}
* Output: <img src="images/masthead.gif" border=0 width=100 height=80>
* @author r23 <info@r23.de>
* @version 1.0
* @param array
* @param Smarty
* @return string
* @uses smarty_function_escape_special_chars()
*/
function smarty_function_category_image($params, &$smarty)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$basedir = OOS_IMAGES . 'category/';
$dir = 'large';
$border = 0;
$alt = '';
$image = '';
$extra = '';
foreach($params as $_key => $_val) {
switch($_key) {
case 'image':
case 'basedir':
case 'dir':
case 'alt':
case 'class':
if (!is_array($_val)) {
$$_key = smarty_function_escape_special_chars($_val);
} else {
throw new SmartyException("large_category_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
default:
if (!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
} else {
throw new SmartyException("large_category_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if (empty($image)) {
return FALSE;
}
$image = $basedir . $dir . '/' . $image;
if (isset($template->smarty->security_policy)) {
// local file
if (!$template->smarty->security_policy->isTrustedResourceDir($image)) {
return;
}
}
return '<img class="img-fluid ' . $class . '" src="' . $image . '" alt="' . strip_tags($alt) . '" ' . $extra . ' />';
}

View File

@ -0,0 +1,57 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.display_price.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: display_price
* Version: 1.0
* Date:
* Purpose:
*
*
* Install: Drop into the plugin directory
* Author:
* -------------------------------------------------------------
*/
function smarty_function_display_price($params, &$smarty)
{
global $oCurrencies;
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$price = NULL;
$tax_class_id = 1;
$quantity = 1;
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
$tax = oos_get_tax_rate($tax_class_id);
return $oCurrencies->display_price($price, $tax, $quantity);
}

View File

@ -0,0 +1,25 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {html_get_link} function plugin
*
* Type: function
* Name: html_get_link
* @Version: $Revision: 1.1 $ - changed by $Author: r23 $ on $Date: 2007/06/08 13:34:16 $
* -------------------------------------------------------------
*/
function smarty_function_html_get_link($params, &$smarty)
{
$link = OOS_HTTPS_SERVER . OOS_SHOP . 'index.php';
return $link;
}

View File

@ -0,0 +1,151 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.html_href_link.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: html_output.php,v 1.49 2003/02/11 01:31:02 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {html_href_link} function plugin
*
* Type: function
* Name: html_href_link
* @Version: $Revision: 1.1 $ - changed by $Author: r23 $ on $Date: 2007/06/08 13:34:16 $
* -------------------------------------------------------------
*/
function smarty_function_html_href_link($params, &$smarty)
{
global $session, $oEvent, $spider_kill_sid, $debug;
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$content = '';
$parameters = '';
$add_session_id = TRUE;
$search_engine_safe = 'true';
foreach($params as $_key => $_val) {
switch($_key) {
case 'content':
if(!is_array($_val)) {
$$_key = smarty_function_escape_special_chars($_val);
} else {
throw new SmartyException("html_href_link: Unable to determine the page link!", E_USER_NOTICE);
}
break;
case 'oos_get':
case 'addentry_id':
case 'add_session_id':
case 'search_engine_safe':
$$_key = (string)$_val;
break;
case 'anchor':
$anchor = smarty_function_escape_special_chars($_val);
break;
default:
if(!is_array($_val)) {
$parameters .= $_key.'='.smarty_function_escape_special_chars($_val).'&amp;';
} else {
throw new SmartyException("html_href_link: parameters '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if (empty($content) && ($debug == 1) ) {
throw new SmartyException("html_href_link: Unable to determine the page link!", E_USER_NOTICE);
}
if (isset($addentry_id)) {
$addentry_id = $addentry_id + 2;
$parameters .= 'entry_id='.$addentry_id.'&amp;';
}
if (isset($oos_get)) {
$parameters .= $oos_get;
}
$content = trim($content);
$link = OOS_HTTPS_SERVER . OOS_SHOP;
if (isset($parameters)) {
$link .= 'index.php?content=' . $content . '&amp;' . oos_output_string($parameters);
} else {
$link .= 'index.php?content=' . $content;
}
$separator = '&amp;';
while ( (substr($link, -5) == '&amp;') || (substr($link, -1) == '?') ) {
if (substr($link, -1) == '?') {
$link = substr($link, 0, -1);
} else {
$link = substr($link, 0, -5);
}
}
if (isset($anchor)) {
$link .= '#' . $anchor;
}
// Add the session ID when moving from HTTP and HTTPS servers or when SID is defined
if (isset($_SESSION)) {
// Add the session ID when moving from HTTP and HTTPS servers or when SID is defined
if ($add_session_id == TRUE){
$_sid = $session->getName() . '=' . $session->getId();
}
if ( $spider_kill_sid == 'true') $_sid = NULL;
}
if ( ($search_engine_safe == 'true') && $oEvent->installed_plugin('sefu') ) {
$link = str_replace(array('?', '&amp;', '='), '/', $link);
$separator = '?';
$pos = strpos ($link, 'action');
if ($pos === FALSE) {
$url_rewrite = new url_rewrite;
$link = $url_rewrite->transform_uri($link);
}
}
if (isset($_sid)) {
$link .= $separator . oos_output_string($_sid);
}
return $link;
}

View File

@ -0,0 +1,85 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {html_oos_image} function plugin
*
* Type: function<br>
* Name: html_oos_image<br>
* Date: Feb 24, 2003<br>
* Purpose: format HTML tags for the image<br>
* Input:<br>
* - file = file (and path) of image (required)
* - image =image width (optional, default actual width)
* - basedir = base directory for absolute paths, default
* is environment variable DOCUMENT_ROOT
*
* Examples: {html_oos_image file="images/masthead.gif"}
* Output: <img class="img-fluid"src="images/masthead.gif" alt=" " />
* @link http://smarty.php.net/manual/en/language.function.html.image.php {html_oos_image}
* (Smarty online manual)
* @author Monte Ohrt <monte@ispi.net>
* @author credits to Duda <duda@big.hu> - wrote first image function
* in repository, helped with lots of functionality
* @version 2.0
* @param array
* @param Smarty
* @return string
* @uses smarty_function_escape_special_chars()
*/
function smarty_function_html_oos_image($params, &$smarty)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$alt = '';
$image = '';
$extra = '';
$basedir = isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : '';
foreach($params as $_key => $_val) {
switch($_key) {
case 'image':
case 'basedir':
$$_key = $_val;
break;
case 'alt':
if(!is_array($_val)) {
$$_key = smarty_function_escape_special_chars($_val);
} else {
throw new SmartyException("html_oos_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
default:
if(!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
} else {
throw new SmartyException("html_oos_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
$image = $basedir . $image;
if (empty($image) || ($image == OOS_IMAGES)) {
return FALSE;
}
if (isset($template->smarty->security_policy)) {
// local file
if (!$template->smarty->security_policy->isTrustedResourceDir($image)) {
return;
}
}
return '<img class="img-fluid" src="'.$image.'" alt="'.$alt.'"'.$extra.' />';
}

View File

@ -0,0 +1,56 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {small_category_image} function plugin
*
* Type: function<br>
* Name: small_category_image<br>
* Date: Aug 24, 2004<br>
* Purpose: format HTML tags for the image<br>
* Input:<br>
* - image =image width (optional, default actual width)
* - border = border width (optional, default 0)
* - height = image height (optional, default actual height)
*
* Examples: {small_category_image file="images/masthead.gif"}
* Output: <img src="images/masthead.gif" border=0 width=100 height=80>
* @author r23 <info@r23.de>
* @version 1.0
* @param array
* @param Smarty
* @return string
* @uses smarty_function_escape_special_chars()
*/
function smarty_function_logo($params, &$smarty)
{
if (empty(STORE_LOGO)) return '';
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$basedir = OOS_IMAGES . 'logo/';
foreach($params as $_key => $_val) {
switch($_key) {
case 'dir':
if (!is_array($_val)) {
$$_key = smarty_function_escape_special_chars($_val);
} else {
throw new SmartyException("small_category_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
$image = $basedir . $dir . '/' . STORE_LOGO;
return '<img id="logo-header" class="img-fluid" src="' . $image . '" alt="' . STORE_NAME. '" title="' . STORE_NAME . '">';
}

View File

@ -0,0 +1,54 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_add_tax.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: html_output.php,v 1.49 2003/02/11 01:31:02 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {oos_add_tax} function plugin
*
* Type: function
* Name: oos_get_zone_name
* Version: 1.0
* -------------------------------------------------------------
*/
function smarty_function_oos_add_tax($params, &$smarty)
{
global $oCurrencies, $aUser;
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
if ($aUser['price_with_tax'] == 1) {
return round($price, $oCurrencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + oos_calculate_tax($price, $tax);
} else {
return round($price, $oCurrencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
}
}

View File

@ -0,0 +1,111 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_address_format.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: oos_address_format
* Version: 1.0
* Date:
* Purpose:
*
*
* Install: Drop into the plugin directory
* Author:
* -------------------------------------------------------------
*/
function smarty_function_oos_address_format($params, &$smarty)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$address_format_id = '';
$address = '';
$html = '';
$boln = '';
$eoln = '<br />';
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$address_formattable = $oostable['address_format'];
$query = "SELECT address_format AS format
FROM $address_formattable
WHERE address_format_id = '" . intval($address_format_id) . "'";
$address_format = $dbconn->GetRow($query);
$company = addslashes($address['company']);
$firstname = addslashes($address['firstname']);
$lastname = addslashes($address['lastname']);
$street = addslashes($address['street_address']);
$city = addslashes($address['city']);
$state = addslashes($address['state']);
$country_id = $address['country_id'];
$zone_id = $address['zone_id'];
$postcode = addslashes($address['postcode']);
$zip = $postcode;
$country = oos_get_country_name($country_id);
$state = oos_get_zone_code($country_id, $zone_id, $state);
if ($html) {
// HTML Mode
$HR = '<hr>';
$hr = '<hr>';
if ( ($boln == '') && ($eoln == "\n") ) { // Values not specified, use rational defaults
$CR = '<br />';
$cr = '<br />';
$eoln = $cr;
} else { // Use values supplied
$CR = $eoln . $boln;
$cr = $CR;
}
} else {
// Text Mode
$CR = $eoln;
$cr = $CR;
$HR = '----------------------------------------';
$hr = '----------------------------------------';
}
$statecomma = '';
$streets = $street;
if ($firstname == '') $firstname = addslashes($address['name']);
if ($country == '') $country = addslashes($address['country']);
if ($state != '') $statecomma = $state . ', ';
$fmt = $address_format['format'];
eval("\$address = \"$fmt\";");
$address = stripslashes($address);
if ( (ACCOUNT_COMPANY == 'true') && (oos_is_not_null($company)) ) {
$address = $company . $cr . $address;
}
print $boln . $address . $eoln;
}

View File

@ -0,0 +1,69 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_address_label.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {oos_address_label} function plugin
*
* Type: function
* Name: oos_address_label
* Version: 1.0
* -------------------------------------------------------------
*/
function smarty_function_oos_address_label($params, &$smarty)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
require_once(MYOOS_INCLUDE_PATH . '/includes/lib/smarty-plugins/function.oos_address_format.php');
$customers_id = '';
$address_id = 1;
$html = TRUE;
$boln = '';
$eoln = '<br>';
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$address_result = $dbconn->Execute("SELECT entry_firstname AS firstname, entry_lastname AS lastname, entry_company AS company, entry_street_address AS street_address, entry_city AS city, entry_postcode AS postcode, entry_state AS state, entry_zone_id AS zone_id, entry_country_id AS country_id FROM " . $oostable['address_book'] . " WHERE customers_id = '" . (int)$customers_id . "' AND address_book_id = '" . (int)$address_id . "'");
$address = $address_result->fields;
$format_id = oos_get_address_format_id($address['country_id']);
return smarty_function_oos_address_format(array('address_format_id' => $format_id,
'address' => $address,
'html' => $html),
$smarty);
}

View File

@ -0,0 +1,59 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_check_stock.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {oos_check_stock} function plugin
*
* Type: function
* Name: oos_check_stock
* Version: 1.0
* -------------------------------------------------------------
*/
function smarty_function_oos_check_stock($params, &$smarty)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$products_id = '';
$products_quantity = '';
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
$stock_left = oos_get_products_stock($products_id) - $products_quantity;
$out_of_stock = '';
if ($stock_left < 0) {
$out_of_stock = '<span class="text-danger"><b>' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</b></span>';
}
return $out_of_stock;
}

View File

@ -0,0 +1,52 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_cost.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: oos_cost
* Version: 1.0
* Date:
* Purpose:
*
*
* Install: Drop into the plugin directory
* Author:
* -------------------------------------------------------------
*/
function smarty_function_oos_cost($params, &$smarty)
{
global $oCurrencies;
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$price = '';
$tax = '';
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
print $oCurrencies->format(oos_add_tax($price, $tax));
}

View File

@ -0,0 +1,57 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_display_price.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: oos_href_link
* Version: 1.0
* Date:
* Purpose:
*
*
* Install: Drop into the plugin directory
* Author:
* -------------------------------------------------------------
*/
function smarty_function_oos_display_price($params, &$smarty)
{
global $oCurrencies;
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$price = '';
$tax = '';
$qty = '';
$calculate_currency_value = TRUE;
$currency = '';
$currency_value = '';
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
print $oCurrencies->format(oos_add_tax($price, $tax) * $qty, $calculate_currency_value, $currency, $currency_value);
}

View File

@ -0,0 +1,78 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_display_tax_value.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: oos_display_price
* Version: 1.0
* Date:
* Purpose:
*
*
* Install: Drop into the plugin directory
* Author:
* -------------------------------------------------------------
*/
function smarty_function_oos_display_tax_value($params, &$smarty)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$value = '';
$padding = TAX_DECIMAL_PLACES;
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
if (strpos($value, '.')) {
$loop = TRUE;
while ($loop) {
if (substr($value, -1) == '0') {
$value = substr($value, 0, -1);
} else {
$loop = FALSE;
if (substr($value, -1) == '.') {
$value = substr($value, 0, -1);
}
}
}
}
if ($padding > 0) {
if ($decimal_pos = strpos($value, '.')) {
$decimals = strlen(substr($value, ($decimal_pos+1)));
for ($i=$decimals; $i<$padding; $i++) {
$value .= '0';
}
} else {
$value .= '.';
for ($i=0; $i<$padding; $i++) {
$value .= '0';
}
}
}
return $value;
}

View File

@ -0,0 +1,96 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_get_country_list.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: html_output.php,v 1.49 2003/02/11 01:31:02 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {oos_get_country_list} function plugin
*
* Type: function
* Name: oos_get_country_list
* Version: 1.0
* -------------------------------------------------------------
*/
function smarty_function_oos_get_country_list($params, &$smarty)
{
global $aLang;
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
require_once(SMARTY_PLUGINS_DIR . 'function.html_options.php');
/* Set the name of the <select> tag. */
$name = 'country';
/* <select size>'s of <select> tag.
If not set, uses default dropdown. */
$size = null;
/* Unparsed attributes common to *ALL* the <select>/<input> tags.
An example might be in the template: extra ='class ="foo"'. */
$extra = null;
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
$countries = array();
$countries_names = array();
$countries_values = array();
$countries = oos_get_countries();
$countries_values[] = '';
$countries_names[] = $aLang['pull_down_default'];
for ($i=0, $n=count($countries); $i<$n; $i++) {
$countries_values[] = $countries[$i]['countries_id'];
$countries_names[] = $countries[$i]['countries_name'];
}
$html_result .= '<select required name="' . $name . '"';
if (null !== $size){
$html_result .= ' size="' . $size . '"';
}
if (null !== $extra){
$html_result .= ' ' . $extra;
}
$html_result .= ' class="form-control pointer">'."\n";
$html_result .= smarty_function_html_options(array('output' => $countries_names,
'values' => $countries_values,
'selected' => $selected,
'print_result' => false),
$smarty);
$html_result .= '</select>';
print $html_result;
}

View File

@ -0,0 +1,59 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_get_zone_name.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {oos_get_zone_name} function plugin
*
* Type: function
* Name: oos_get_zone_name
* Version: 1.0
* -------------------------------------------------------------
*/
function smarty_function_oos_get_zone_name($params, &$smarty)
{
$country_id = '';
$zone_id = '';
$default_zone = '';
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zone = $dbconn->Execute("SELECT zone_name FROM " . $oostable['zones'] . " WHERE zone_country_id = '" . intval($country_id) . "' AND zone_id = '" . intval($zone_id) . "'");
if ($zone->RecordCount()) {
return $zone->fields['zone_name'];
} else {
return $default_zone;
}
}

View File

@ -0,0 +1,56 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_price.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
http://www.oos-shop.de/
Copyright (c) 2003 - 2014 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: oos_price
* Version: 1.0
* Date:
* Purpose:
*
*
* Install: Drop into the plugin directory
* Author:
* -------------------------------------------------------------
*/
function smarty_function_oos_price($params, &$smarty)
{
global $oCurrencies;
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$price = '';
$tax = '';
$qty = '';
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
print $oCurrencies->display_price($price, $tax, $qty);
}
?>

View File

@ -0,0 +1,161 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {oos_radios} function plugin
*
* File: function.oos_radios.php<br>
* Type: function<br>
* Name: oos_radios<br>
* Date: 24.Feb.2003<br>
* Purpose: Prints out a list of radio input types<br>
* Input:<br>
* - name (optional) - string default "radio"
* - values (required) - array
* - options (optional) - associative array
* - checked (optional) - array default not set
* - separator (optional) - ie <br> or &nbsp;
* - output (optional) - the output next to each radio button
* - assign (optional) - assign the output as an array to this variable
* Examples:
* <pre>
* {oos_radios values=$ids output=$names}
* {oos_radios values=$ids name='box' separator='<br>' output=$names}
* {oos_radios values=$ids checked=$checked separator='<br>' output=$names}
* </pre>
* @link http://smarty.php.net/manual/en/language.function.html.radios.php {oos_radios}
* (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param array
* @param Smarty
* @return string
* @uses smarty_function_escape_special_chars()
*/
function smarty_function_oos_radios($params, &$smarty)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$name = 'radio';
$values = null;
$options = null;
$selected = null;
$separator = '';
$labels = TRUE;
$label_ids = FALSE;
$output = null;
$extra = '';
foreach($params as $_key => $_val) {
switch($_key) {
case 'name':
case 'separator':
$$_key = (string)$_val;
break;
case 'checked':
case 'selected':
if(is_array($_val)) {
throw new SmartyException('oos_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
} else {
$selected = (string)$_val;
}
break;
case 'labels':
case 'label_ids':
$$_key = (bool)$_val;
break;
case 'options':
$$_key = (array)$_val;
break;
case 'values':
case 'output':
$$_key = array_values((array)$_val);
break;
case 'radios':
throw new SmartyException('oos_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING);
$options = (array)$_val;
break;
case 'assign':
break;
default:
if(!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
} else {
throw new SmartyException("oos_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if (!isset($options) && !isset($values))
return ''; /* raise error here? */
$_html_result = array();
if (isset($options)) {
foreach ($options as $_key=>$_val)
$_html_result[] = oos_function_oos_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
} else {
foreach ($values as $_i=>$_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result[] = oos_function_oos_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
}
}
if(!empty($params['assign'])) {
$smarty->assign($params['assign'], $_html_result);
} else {
return implode("\n",$_html_result);
}
}
function oos_function_oos_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) {
$_output = '<tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . smarty_function_escape_special_chars($value) . ' )">';
if ($labels) {
if($label_ids) {
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
$_output .= '<label for="' . $_id . '">';
} else {
$_output .= '<td width="23"></td><td class="main" valign="top">';
}
}
$_output .= '<strong>' . $output . '<strong>';
if ($labels) $_output .= '</td><td class="main" valign="top" align="right">';
$_output .= '<input type="radio" name="'
. smarty_function_escape_special_chars($name) . '" value="'
. smarty_function_escape_special_chars($value) . '"';
if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
if ((string)$value==$selected) {
$_output .= ' checked="checked"';
}
$_output .= $extra . ' /><td width="23"></td>';
if ($labels) $_output .= '';
$_output .= '</tr>';
return $_output;
}

View File

@ -0,0 +1,52 @@
<?php
/* ----------------------------------------------------------------------
$Id: function.oos_shipping_cost.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: oos_cost
* Version: 1.0
* Date:
* Purpose:
*
*
* Install: Drop into the plugin directory
* Author:
* -------------------------------------------------------------
*/
function smarty_function_oos_cost($params, &$smarty)
{
global $oCurrencies;
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$price = '';
$tax = '';
foreach($params as $_key => $_val) {
$$_key = smarty_function_escape_special_chars($_val);
}
print $oCurrencies->format(oos_add_tax($price, $tax));
}

View File

@ -0,0 +1,82 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {small_product_image} function plugin
*
* Type: function<br>
* Name: small_product_image<br>
* Date: Aug 24, 2004<br>
* Purpose: format HTML tags for the image<br>
* Input:<br>
* - image =image width (optional, default actual width)
* - border = border width (optional, default 0)
* - height = image height (optional, default actual height)
*
* Examples: {small_product_image file="images/masthead.gif"}
* Output: <img src="images/masthead.gif" border=0 width=100 height=80>
* @author r23 <info@r23.de>
* @version 1.0
* @param array
* @param Smarty
* @return string
* @uses smarty_function_escape_special_chars()
*/
function smarty_function_product_image($params, &$smarty)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$basedir = OOS_IMAGES . 'product/';
$dir = 'large';
$border = 0;
$alt = '';
$image = '';
$extra = '';
foreach($params as $_key => $_val) {
switch($_key) {
case 'image':
case 'basedir':
case 'dir':
case 'alt':
case 'class':
if (!is_array($_val)) {
$$_key = smarty_function_escape_special_chars($_val);
} else {
throw new SmartyException("small_product_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
default:
if (!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
} else {
throw new SmartyException("small_product_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if (empty($image)) {
return FALSE;
}
$image = $basedir . $dir . '/' . $image;
if (isset($template->smarty->security_policy)) {
// local file
if (!$template->smarty->security_policy->isTrustedResourceDir($image)) {
return;
}
}
return '<img class="img-fluid ' . $class . '" src="' . $image . '" alt="' . strip_tags($alt) . '" ' . $extra . ' />';
}

View File

@ -0,0 +1,74 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {product_image_link} function plugin
*
* Type: function<br>
* Name: product_image_link<br>
* Date: April 12, 2019<br>
* Purpose: format HTML tags for the image<br>
* Input:<br>
* - image = image
*
* Examples: {product_image_link image="images/masthead.gif"}
* Output: http://example.org/images/product/large/products.jpg
* @author r23 <info@r23.de>
* @version 1.0
* @param array
* @param Smarty
* @return string
* @uses smarty_function_escape_special_chars()
*/
function smarty_function_product_image_link($params, &$smarty)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$basedir = OOS_IMAGES . 'product/';
$dir = 'large';
foreach($params as $_key => $_val) {
switch($_key) {
case 'image':
case 'basedir':
case 'dir':
if (!is_array($_val)) {
$$_key = smarty_function_escape_special_chars($_val);
} else {
throw new SmartyException("small_product_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
default:
if (!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
} else {
throw new SmartyException("small_product_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if (empty($image)) {
return FALSE;
}
$image = $basedir . $dir . '/' . $image;
if (isset($template->smarty->security_policy)) {
// local file
if (!$template->smarty->security_policy->isTrustedResourceDir($image)) {
return;
}
}
return $image;
}

View File

@ -0,0 +1,46 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {product_link} function plugin
*
* Type: function<br>
* Name: product_info_link<br>
* Date: Aug 24, 2004<br>
* Purpose: URL for the products info<br>
* Input:<br>
* - products_id
*
* Examples: <{product_link products_id=17}>
* Output: http:// ... index.php?content=product_info&amp;products_id=17
* @author r23 <info@r23.de>
* @version 1.0
* @param array
* @param Smarty
* @return string
* @uses smarty_function_html_href_link()
*/
function smarty_function_product_link($params, &$smarty)
{
require_once(MYOOS_INCLUDE_PATH . '/includes/lib/smarty-plugins/function.html_href_link.php');
$aContents = oos_get_content();
$result = array();
$link_params = array();
$link_params = array('content' => $aContents['product_info']);
if (is_array($params)) {
$result = array_merge($link_params, $params);
} else {
throw new SmartyException("products_info_link: extra attribute '$params' must an array", E_USER_NOTICE);
}
return smarty_function_html_href_link($result, $smarty);
}

View File

@ -0,0 +1,79 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {small_category_image} function plugin
*
* Type: function<br>
* Name: small_category_image<br>
* Date: Aug 24, 2004<br>
* Purpose: format HTML tags for the image<br>
* Input:<br>
* - image =image width (optional, default actual width)
* - border = border width (optional, default 0)
* - height = image height (optional, default actual height)
*
* Examples: {small_category_image file="images/masthead.gif"}
* Output: <img src="images/masthead.gif" border=0 width=100 height=80>
* @author r23 <info@r23.de>
* @version 1.0
* @param array
* @param Smarty
* @return string
* @uses smarty_function_escape_special_chars()
*/
function smarty_function_small_manufacturers_image($params, &$smarty)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
$basedir = OOS_IMAGES . 'brands/small/';
$border = 0;
$alt = '';
$image = '';
$extra = '';
foreach($params as $_key => $_val) {
switch($_key) {
case 'image':
case 'basedir':
case 'alt':
case 'class':
if (!is_array($_val)) {
$$_key = smarty_function_escape_special_chars($_val);
} else {
throw new SmartyException("small_category_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
default:
if (!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
} else {
throw new SmartyException("small_category_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
$image = $basedir . $image;
if ((empty($image) || ($image == OOS_IMAGES))) {
return FALSE;
}
if (isset($template->smarty->security_policy)) {
// local file
if (!$template->smarty->security_policy->isTrustedResourceDir($image)) {
return;
}
}
return '<img class="img-fluid ' . $class . '" src="' . $image . '" alt="' . $alt . '" ' . $extra . ' />';
}

View File

@ -0,0 +1,47 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty clean_text modifier plugin
*
* Type: modifier<br>
* Name: clean_text<br>
* Purpose: Cleans text of all formating and scripting code
*
* @author r23 <info@r23.de>
* @version 1.0
* @param string
* @return string
*/
function smarty_modifier_clean_text($string, $with_links = TRUE)
{
/*
Based on:
File: mambo.php,v 1.186 2004/09/29 15:54:32 saka
Mambo_4.5.1
*/
$string = preg_replace( "'<script[^>]*>.*?</script>'si", '', $string );
if ($with_links) {
$string = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $string );
}
$string = preg_replace( '/<!--.+?-->/', '', $string );
$string = preg_replace( '/{.+?}/', '', $string );
$string = preg_replace( '/&nbsp;/', ' ', $string );
$string = preg_replace( '/&amp;/', ' ', $string );
$string = preg_replace( '/&quot;/', ' ', $string );
$string = strip_tags( $string );
#$string = htmlspecialchars( $string );
return $string;
}

View File

@ -0,0 +1,47 @@
<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty close all unclosed xhtml tags
*
* Type: modifier<br>
* Name: close_tags<br>
*
* @param string
* @return string
*/
function smarty_modifier_close_tags($string)
{
// match opened tags
if(preg_match_all('/<([a-z]+)[ >]/', $string, $start_tags)) {
$start_tags = $start_tags[1];
// match closed tags
if(preg_match_all('/<\/([a-z]+)>/', $string, $end_tags)) {
$complete_tags = array();
$end_tags = $end_tags[1];
foreach($start_tags as $key => $val) {
$posb = array_search($val, $end_tags);
if (is_integer($posb)) {
unset($end_tags[$posb]);
} else {
$complete_tags[] = $val;
}
}
} else {
$complete_tags = $start_tags;
}
$complete_tags = array_reverse($complete_tags);
for($i = 0; $i < count($complete_tags); $i++) {
$string .= '</' . $complete_tags[$i] . '>';
}
}
return $string;
}

View File

@ -0,0 +1,41 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: modifier
* Name: escape_wquotes
* Version: 1.0
* Date: 2004-05-11
* Author: Carlo Sacripante sacripante[NOSPAM]@libero.it
* Purpose: Escape chr(146) to chr(151) from MS Word text
* Notes: This modifier uses a simple PHP str_replace function to
* replace single and double quotes characters from a Microsoft Word
* "cut and paste like" string, with an HTML encoded string.
*
* Example smarty code:
*
* {$dirtyString|escape_wquotes}
*
*
* -------------------------------------------------------------
*/
function smarty_modifier_escape_wquotes ($text)
{
$badwordchars=array(
chr(145),
chr(146),
chr(147),
chr(148),
chr(151)
);
$fixedwordchars=array(
"&acute;",
"&acute;",
'&quot;',
'&quot;',
'&mdash;'
);
return str_replace($badwordchars,$fixedwordchars,$text);
}

View File

@ -0,0 +1,42 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty gravatar plugin
*
* Type: modifier<br>
* Name: gravatar<br>
* Author: Matt Schinckel<br>
* mailto:matt@schinckel.net<br>
* aim:mschinckel<br>
* http://schinckel.net<br>
* Purpose: convert email address to gravatar
* @param string
* @return string
*/
function smarty_modifier_gravatar($email, $default=false, $size=false, $rating=false, $border=false)
{
$gravurl = "<img src='http://www.gravatar.com/avatar.php?gravatar_id=".md5($email);
if ($default)
{
$gravurl .= "&amp;default=".urlencode($default);
}
if ($size)
{
$gravurl .= "&amp;size=".$size;
}
if ($rating)
{
$gravurl .= "&amp;rating=".$rating;
}
if ($border)
{
$gravurl .= "&amp;border=".$border;
}
return $gravurl. "' alt='Gravatar Image' />";
}

View File

@ -0,0 +1,53 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {highlight_char} modifier plugin
*
* Type: modifier<br>
* Name: highlight_char<br>
* Date: March 8, 2004<br>
* Purpose: highlight first character of the input string with css class<br>
* Input:
* - string = string whose first char should be wrapped in the given class
*
* Examples:<br>
* <pre>
* {$xxx|highlight_char:big_font}
* Output:
* <span class="bigfont">x</span>xx
*
* {$xxx|highlight_char:none:b} {* you cannot leave a param empty, so none is no class *}
* Output:
* <strong>x</strong>xx
*
* </pre>
* @author Mark Hewitt <mark at formfunction dot co dot za>
* @version 1.0
* @param string $string Text to modify
* @param string $css_class CSS classname to put in span tags, use 'none' to ignore
* @param string $tag_name (Optional) Tag to wrap first char in
* @param Smarty
* @return string|null
*/
function smarty_modifier_highlight_char($string,$css_class,$tag_name="span")
{
// strip whitespace off the front of the string, and make sure
// there are characters in the string, we only return valid characters...
if ( ($s = trim($string)) != '' )
{
$html = "<$tag_name";
if ( $css_class != 'none' ) $html .= ' class="'.$css_class.'"';
$html .= '>'.substr($s,0,1)."</$tag_name>".substr($s,1);
return $html;
}
else
{
return '';
}
}

View File

@ -0,0 +1,28 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/*
* Smarty plugin
*
* Type: modifier
* Name: number<br>
* Version: 0.1
* Date: November 03, 2004
* Install: Drop into the plugin directory
*
* Examples: {$discount|number:2}
* Author: r23 <info at r23 dot de>
*
* @param string
* @param string
* @return string
*/
function smarty_modifier_number($number, $decimal_places = 2)
{
return number_format($number, $decimal_places);
}

View File

@ -0,0 +1,23 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty number_format modifier plugin
*
* Type: modifier<br>
* Name: number_format<br>
* @param string
* @param string
* @return string
*/
function smarty_modifier_number_format($number)
{
if (($number < 10) && (substr($number, 0, 1) != '0')) $number = '0' . $number;
return $number;
}

View File

@ -0,0 +1,54 @@
<?php
/* ----------------------------------------------------------------------
$Id: modifier.oos_date_long.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty oos_date_long modifier plugin
*
* Type: modifier<br>
* Name: oos_date_long<br>
* Version: 0.1
* Date: September 12, 2003
* Install: Drop into the plugin directory
*
* Examples: {$raw_date|oos_date_long}
* Author: r23 <info at r23 dot de>
* -------------------------------------------------------------
*/
function smarty_modifier_oos_date_long($raw_date)
{
if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return FALSE;
$year = (int)substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);
$day = (int)substr($raw_date, 8, 2);
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);
return strftime(DATE_FORMAT_LONG, mktime($hour,$minute,$second,$month,$day,$year));
}

View File

@ -0,0 +1,58 @@
<?php
/* ----------------------------------------------------------------------
$Id: modifier.oos_date_short.php,v 1.1 2007/06/08 13:34:16 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: general.php,v 1.212 2003/02/17 07:55:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty oos_date_long modifier plugin
*
* Type: modifier<br>
* Name: oos_date_short<br>
* Version: 0.1
* Date: September 12, 2003
* Install: Drop into the plugin directory
*
* Examples: {$raw_date|oos_date_short}
* Author: r23 <info at r23 dot de>
* -------------------------------------------------------------
*/
function smarty_modifier_oos_date_short($raw_date)
{
if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return FALSE;
$year = substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);
$day = (int)substr($raw_date, 8, 2);
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);
if (@date('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) {
return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));
} else {
return preg_match('/2037' . '$/', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));
}
}

View File

@ -0,0 +1,49 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty paragraph modifier plugin
*
* Type: modifier<br>
* Name: paragraph<br>
* Purpose: convert \n and other newline chars to HTML paragraphs<br>
* Note: Uses code from WordPress by Matthew Mullenweg (http://www.photomatt.net; http://www.wordpress.org)
* Input:<br>
* - string: input block of text
* - br: change single \n to 'br' or not
* @param string
* @param string
* @return string|void
*/
function smarty_modifier_paragraph($string, $br=true) {
if($string != '') {
$string = $string . "\n"; // just to make things a little easier, pad the end
$string = preg_replace('|<br />\s*<br />|', "\n\n", $string);
$string = preg_replace('!(<(?:table|ul|ol|li|pre|form|blockquote|h[1-6])[^>]*>)!', "\n$1", $string); // Space things out a little
$string = preg_replace('!(</(?:table|ul|ol|li|pre|form|blockquote|h[1-6])>)!', "$1\n", $string); // Space things out a little
$string = preg_replace("/(\r\n|\r)/", "\n", $string); // cross-platform newlines
$string = preg_replace("/\n\n+/", "\n\n", $string); // take care of duplicates
$string = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t<p>$1</p>\n", $string); // make paragraphs, including one at the end
$string = preg_replace('|<p>\s*?</p>|', '', $string); // under certain strange conditions it could create a P of entirely whitespace
$string = preg_replace("|<p>(<li.+?)</p>|", "$1", $string); // problem with nested lists
$string = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $string);
$string = str_replace('</blockquote></p>', '</p></blockquote>', $string);
$string = preg_replace('!<p>\s*(</?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "$1", $string);
$string = preg_replace('!(</?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*</p>!', "$1", $string);
if ($br) $string = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $string); // optionally make line breaks
$string = preg_replace('!(</?(?:table|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*<br />!', "$1", $string);
$string = preg_replace('!<br />(\s*</?(?:p|li|div|th|pre|td|ul|ol)>)!', '$1', $string);
$string = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $string);
return $string;
} else {
return;
}
}
/* vim: set expandtab: */

View File

@ -0,0 +1,31 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/*
* Smarty plugin
*
* Type: modifier
* Name: quantity<br />
* Version: 0.1
* Date: August 01, 2006
* Install: Drop into the plugin directory
*
* Examples: {$discount|quantity:2}
* Author: r23 <info at r23 dot de>
*
* @param string
* @param string
* @return string
*/
function smarty_modifier_quantity($number, $decimal_places = 2)
{
$number = number_format($number);
return $number;
}

View File

@ -0,0 +1,21 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty repeat modifier plugin
*
* Type: modifier
* Name: repeat
* Date: Feb 19, 2005
* Example: {$level|repeat:"str"}
*/
function smarty_modifier_repeat($level, $replace = ' ')
{
return str_repeat($replace, $level);
}

View File

@ -0,0 +1,28 @@
<?php
/*
* Smarty plugin
*
* Type: modifier
* Name: str_pad
* Date: Jun 02, 2004
* Version: 1.0
* Author: Pablo Dias <pablo at grafia dot com dot br>
* Purpose: pad a string to a certain length with another string. like php/str_pad
*
* Example: {$text|str_pad:20:'.':'both'}
* will pad $string with dots, in both sides
* until $text length equal to 20 characteres
* (assuming that $text has less than 20 characteres)
*
* Input:
* string - the string to be padded
* length - desired string length
* pad_string - string used to pad
* pad_type - both, left or right
*/
function smarty_modifier_str_pad($string, $length, $pad_string=' ', $pad_type='left') {
$pads = array('left'=>0, 'right'=>1, 'both'=>2);
if(array_key_exists($pad_type, $pads))
return str_pad($string, $length ,$pad_string,$pads[$pad_type]);
}

View File

@ -0,0 +1,42 @@
<?php
/*
* Smarty plugin
*
* Type: modifier
* Name: str_pad_trim
* Date: May 04, 2005
* Version: 0.2
* Author: Terence Johnson <terry at scribendi dot com>
* Pablo Dias <pablo at grafia dot com dot br> (modifier.str_pad.php)
* Purpose: Pad a string to a certain length with another string,
* like php/str_pad, or shorten it if it's too long.
*
* Example: {$text|str_pad_trim:20:'.':'right'}
* If $text has less tha 20 characters, this modifier
* will pad $string with dots, on the right hand side,
* until $text is 20 characters. If $text has more
* than 20 characters, it will shorten the string from
* the right hand side.
*
* Input:
* string - the string to be padded or truncated
* length - desired string length
* pad_string - string used to pad
* pad_type - both, left or right.
*/
function smarty_modifier_str_pad_trim($string, $length, $pad_string=' ', $pad_type='right') {
$strlen = strlen($string);
if ($strlen == $length) return $string; // that was easy.
$pads = array('left'=>0, 'right'=>1, 'both'=>2);
if(!array_key_exists($pad_type, $pads)) $pad_type = 'right';
if ($strlen < $string) {
return str_pad($string, $length ,$pad_string,$pads[$pad_type]);
} elseif ($pad_type == 'left') {
return substr($string, -$length);
} elseif ($pad_type == 'right') {
return substr($string,0,$length);
} else {
return substr($string,intval(($strlen-$length)/2),$length);
}
}

View File

@ -0,0 +1,25 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty strip_tags modifier plugin
*
* Type: modifier<br>
* Name: stripslashes<br>
* Version: 0.1
* Date: September 08, 2003
* Install: Drop into the plugin directory
*
* Examples: {$product.description|stripslashes}
* Author: r23 <info at r23 dot de>
* -------------------------------------------------------------
*/
function smarty_modifier_stripslashes($string)
{
return stripslashes($string);
}