PDF rausgenommen
This commit is contained in:
199
msd2/myoos/admin/includes/functions/function_block.php
Normal file
199
msd2/myoos/admin/includes/functions/function_block.php
Normal file
@ -0,0 +1,199 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
|
||||
/**
|
||||
* Return Block Side (left right)
|
||||
*
|
||||
* @param $block_id
|
||||
* @param $language
|
||||
* @return string
|
||||
*/
|
||||
function oos_block_select_option($select_array, $key_value) {
|
||||
for ($i = 0, $n = count($select_array); $i < $n; $i++) {
|
||||
$name = 'block_side';
|
||||
$string .= '<br /><input type="radio" name="' . $name . '" value="' . $select_array[$i] . '"';
|
||||
if ($key_value == $select_array[$i]) $string .= ' checked="checked"';
|
||||
$string .= '> ' . $select_array[$i];
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Block Name
|
||||
*
|
||||
* @param $block_id
|
||||
* @param $language
|
||||
* @return string
|
||||
*/
|
||||
function oos_get_block_name($block_id, $language_id = '') {
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$block_infotable = $oostable['block_info'];
|
||||
$query = "SELECT block_name
|
||||
FROM " . $block_infotable . "
|
||||
WHERE block_id = '" . intval($block_id) . "'
|
||||
AND block_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$block_name = $result->fields['block_name'];
|
||||
|
||||
return $block_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Block To Page
|
||||
*
|
||||
* @param $block_id
|
||||
* @param $language
|
||||
* @return string
|
||||
*/
|
||||
function oos_show_block_to_page($block_id = '', $language_id = '') {
|
||||
|
||||
$select_page_type = '';
|
||||
if (oos_is_not_null($block_id)) {
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
$type_array = array();
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$page_typetable = $oostable['page_type'];
|
||||
$query = "SELECT page_type_id, page_type_name
|
||||
FROM " . $page_typetable . "
|
||||
WHERE page_type_languages_id = '" . intval($language_id) . "'";
|
||||
$type_result = $dbconn->Execute($query);
|
||||
|
||||
while ($type = $type_result->fields) {
|
||||
$type_array[] = array('id' => $type['page_type_id'],
|
||||
'text' => $type['page_type_name']);
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$type_result->MoveNext();
|
||||
}
|
||||
|
||||
$block_to_page_array = array();
|
||||
|
||||
$block_to_page_typetable = $oostable['block_to_page_type'];
|
||||
$query = "SELECT block_id, page_type_id
|
||||
FROM " . $block_to_page_typetable . "
|
||||
WHERE block_id = '" . intval($block_id) . "'";
|
||||
$block_to_page_result = $dbconn->Execute($query);
|
||||
|
||||
while ($block_to_page = $block_to_page_result->fields) {
|
||||
$block_to_page_array[] = $block_to_page['page_type_id'];
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$block_to_page_result->MoveNext();
|
||||
}
|
||||
|
||||
for ($i = 0, $n = count($type_array); $i < $n; $i++) {
|
||||
$page = $type_array[$i]['id'];
|
||||
|
||||
if (in_array ($page, $block_to_page_array)) {
|
||||
$select_page_type .= oos_draw_checkbox_field('page_type[]', $page, TRUE) . $type_array[$i]['text'] . '<br />';
|
||||
} else {
|
||||
$select_page_type .= oos_draw_checkbox_field('page_type[]', $page) . $type_array[$i]['text'] . '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return $select_page_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Select Block To Page
|
||||
*
|
||||
* @param $block_id
|
||||
* @param $language
|
||||
* @return string
|
||||
*/
|
||||
function oos_select_block_to_page($language_id = '') {
|
||||
|
||||
$select_page_type = '';
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$page_typetable = $oostable['page_type'];
|
||||
$query = "SELECT page_type_id, page_type_name
|
||||
FROM " . $page_typetable . "
|
||||
WHERE page_type_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
while ($type = $result->fields) {
|
||||
$select_page_type .= oos_draw_checkbox_field('page_type[]', $type['page_type_id']) . $type['page_type_name'] . '<br />';
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$result->MoveNext();
|
||||
}
|
||||
|
||||
return $select_page_type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return Info Block To Page
|
||||
*
|
||||
* @param $block_id
|
||||
* @param $language
|
||||
* @return string
|
||||
*/
|
||||
function oos_info_block_to_page($block_id = '', $language_id = '') {
|
||||
|
||||
$info = '';
|
||||
if (oos_is_not_null($block_id)) {
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
$type_array = array();
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$block_to_page_typetable = $oostable['block_to_page_type'];
|
||||
$page_typetable = $oostable['page_type'];
|
||||
$query = "SELECT b2p.block_id, b2p.page_type_id, p.page_type_name
|
||||
FROM " . $block_to_page_typetable . " b2p,
|
||||
" . $page_typetable . " p
|
||||
WHERE b2p.block_id = '" . intval($block_id) . "'
|
||||
AND p.page_type_id = b2p.page_type_id
|
||||
AND p.page_type_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
while ($block_info = $result->fields) {
|
||||
$info .= $block_info['page_type_name']. '<br />';
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$result->MoveNext();
|
||||
}
|
||||
}
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
777
msd2/myoos/admin/includes/functions/function_categories.php
Normal file
777
msd2/myoos/admin/includes/functions/function_categories.php
Normal file
@ -0,0 +1,777 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: general.php,v 1.151 2003/02/07 21:46:49 dgw_
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
function oos_get_path($current_category_id = '') {
|
||||
GLOBAL $cPath_array;
|
||||
|
||||
if (!is_array($cPath_array)) $cPath_array = array();
|
||||
|
||||
if ($current_category_id == '') {
|
||||
$cPath_new = implode('_', $cPath_array);
|
||||
} else {
|
||||
if (count($cPath_array) == 0) {
|
||||
$cPath_new = $current_category_id;
|
||||
} else {
|
||||
$cPath_new = '';
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$categoriestable = $oostable['categories'];
|
||||
$query = "SELECT parent_id
|
||||
FROM $categoriestable
|
||||
WHERE categories_id = '" . intval($cPath_array[(count($cPath_array)-1)]) . "'";
|
||||
$last_category_result = $dbconn->Execute($query);
|
||||
$last_category = $last_category_result->fields;
|
||||
|
||||
$categoriestable = $oostable['categories'];
|
||||
$query = "SELECT parent_id
|
||||
FROM $categoriestable
|
||||
WHERE categories_id = '" . intval($current_category_id) . "'";
|
||||
$current_category_result = $dbconn->Execute($query);
|
||||
|
||||
$current_category = $current_category_result->fields;
|
||||
if ($last_category['parent_id'] == $current_category['parent_id']) {
|
||||
for ($i = 0, $n = count($cPath_array) - 1; $i < $n; $i++) {
|
||||
$cPath_new .= '_' . $cPath_array[$i];
|
||||
}
|
||||
} else {
|
||||
for ($i = 0, $n = count($cPath_array); $i < $n; $i++) {
|
||||
$cPath_new .= '_' . $cPath_array[$i];
|
||||
}
|
||||
}
|
||||
$cPath_new .= '_' . $current_category_id;
|
||||
if (substr($cPath_new, 0, 1) == '_') {
|
||||
$cPath_new = substr($cPath_new, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 'cPath=' . $cPath_new;
|
||||
}
|
||||
|
||||
|
||||
function oos_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $aCategoryTree = '', $include_itself = FALSE) {
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
if (!is_array($aCategoryTree)) $aCategoryTree = array();
|
||||
if ( (count($aCategoryTree) < 1) && ($exclude != '0') ) $aCategoryTree[] = array('id' => '0', 'text' => TEXT_TOP);
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if ($include_itself) {
|
||||
|
||||
$categories_descriptiontable = $oostable['categories_description'];
|
||||
$query = "SELECT cd.categories_name
|
||||
FROM $categories_descriptiontable cd
|
||||
WHERE cd.categories_languages_id = '" . intval($language_id) . "'
|
||||
AND cd.categories_id = '" . intval($parent_id) . "'";
|
||||
$category_result = $dbconn->Execute($query);
|
||||
|
||||
$category = $category_result->fields;
|
||||
$aCategoryTree[] = array('id' => $parent_id, 'text' => $category['categories_name']);
|
||||
}
|
||||
|
||||
$categoriestable = $oostable['categories'];
|
||||
$categories_descriptiontable = $oostable['categories_description'];
|
||||
$query = "SELECT c.categories_id, cd.categories_name, c.parent_id, c.sort_order
|
||||
FROM $categoriestable c,
|
||||
$categories_descriptiontable cd
|
||||
WHERE c.categories_status != 0
|
||||
AND c.parent_id = '" . intval($parent_id) . "'
|
||||
AND c.categories_id = cd.categories_id
|
||||
AND cd.categories_languages_id = '" . intval($language_id) . "'
|
||||
ORDER BY c.sort_order, cd.categories_name";
|
||||
$categories_result = $dbconn->Execute($query);
|
||||
|
||||
while ($categories = $categories_result->fields) {
|
||||
if ($exclude != $categories['categories_id']) $aCategoryTree[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']);
|
||||
|
||||
$aCategoryTree = oos_get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $aCategoryTree);
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$categories_result->MoveNext();
|
||||
}
|
||||
|
||||
return $aCategoryTree;
|
||||
}
|
||||
|
||||
|
||||
function oos_get_category_name($category_id, $language_id = '') {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$categories_descriptiontable = $oostable['categories_description'];
|
||||
$query = "SELECT categories_name
|
||||
FROM $categories_descriptiontable
|
||||
WHERE categories_id = '" . intval($category_id) . "'
|
||||
AND categories_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$categories_name = $result->fields['categories_name'];
|
||||
|
||||
|
||||
return $categories_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function oos_get_categories_page_title($category_id, $language_id = '') {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$categories_descriptiontable = $oostable['categories_description'];
|
||||
$query = "SELECT categories_page_title
|
||||
FROM $categories_descriptiontable
|
||||
WHERE categories_id = '" . intval($category_id) . "'
|
||||
AND categories_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$categories_page_title = $result->fields['categories_page_title'];
|
||||
|
||||
|
||||
return $categories_page_title;
|
||||
}
|
||||
|
||||
|
||||
function oos_get_products_description($product_id, $language_id = '') {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$products_descriptiontable = $oostable['products_description'];
|
||||
$query = "SELECT products_description
|
||||
FROM $products_descriptiontable
|
||||
WHERE products_id = '" . intval($product_id) . "'
|
||||
AND products_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$products_description = $result->fields['products_description'];
|
||||
|
||||
return $products_description;
|
||||
}
|
||||
|
||||
|
||||
function oos_get_products_short_description($product_id, $language_id = '') {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$products_descriptiontable = $oostable['products_description'];
|
||||
$query = "SELECT products_short_description
|
||||
FROM $products_descriptiontable
|
||||
WHERE products_id = '" . intval($product_id) . "'
|
||||
AND products_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$products_short_description = $result->fields['products_short_description'];
|
||||
|
||||
return $products_short_description;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function oos_get_products_essential_characteristicsn($product_id, $language_id = '') {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$products_descriptiontable = $oostable['products_description'];
|
||||
$query = "SELECT products_essential_characteristics
|
||||
FROM $products_descriptiontable
|
||||
WHERE products_id = '" . intval($product_id) . "'
|
||||
AND products_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$products_essential_characteristics = $result->fields['products_essential_characteristics'];
|
||||
|
||||
return $products_essential_characteristics;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function oos_get_products_description_meta($product_id, $language_id = '') {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$products_descriptiontable = $oostable['products_description'];
|
||||
$query = "SELECT products_description_meta
|
||||
FROM $products_descriptiontable
|
||||
WHERE products_id = '" . intval($product_id) . "'
|
||||
AND products_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$products_description_meta = $result->fields['products_description_meta'];
|
||||
|
||||
return $products_description_meta;
|
||||
}
|
||||
|
||||
|
||||
function oos_get_products_url($product_id, $language_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$products_descriptiontable = $oostable['products_description'];
|
||||
$query = "SELECT products_url
|
||||
FROM $products_descriptiontable
|
||||
WHERE products_id = '" . intval($product_id) . "'
|
||||
AND products_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$products_url = $result->fields['products_url'];
|
||||
|
||||
return $products_url;
|
||||
}
|
||||
|
||||
|
||||
function oos_products_in_category_count($categories_id, $include_deactivated = FALSE) {
|
||||
|
||||
$products_count = 0;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$productstable = $oostable['products'];
|
||||
$products_to_categoriestable = $oostable['products_to_categories'];
|
||||
if ($include_deactivated) {
|
||||
$products_query = "SELECT COUNT(*) AS total
|
||||
FROM $productstable p,
|
||||
$products_to_categoriestable p2c
|
||||
WHERE p.products_id = p2c.products_id
|
||||
AND p2c.categories_id = '" . intval($categories_id) . "'";
|
||||
$products_result = $dbconn->Execute($products_query);
|
||||
|
||||
} else {
|
||||
$products_query = "SELECT COUNT(*) AS total
|
||||
FROM $productstable p,
|
||||
$products_to_categoriestable p2c
|
||||
WHERE p.products_id = p2c.products_id
|
||||
AND p.products_status >= '1'
|
||||
AND p2c.categories_id = '" . intval($categories_id) . "'";
|
||||
$products_result = $dbconn->Execute($products_query);
|
||||
}
|
||||
|
||||
$products = $products_result->fields;
|
||||
|
||||
$products_count += $products['total'];
|
||||
|
||||
$categoriestable = $oostable['categories'];
|
||||
$childs_query = "SELECT categories_id
|
||||
FROM $categoriestable
|
||||
WHERE parent_id = '" . intval($categories_id) . "'";
|
||||
$childs_result = $dbconn->Execute($childs_query);
|
||||
|
||||
if ($childs_result->RecordCount()) {
|
||||
while ($childs = $childs_result->fields) {
|
||||
$products_count += oos_products_in_category_count($childs['categories_id'], $include_deactivated);
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$childs_result->MoveNext();
|
||||
}
|
||||
}
|
||||
|
||||
return $products_count;
|
||||
}
|
||||
|
||||
|
||||
function oos_childs_in_category_count($categories_id) {
|
||||
|
||||
$categories_count = 0;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$categoriestable = $oostable['categories'];
|
||||
$query = "SELECT categories_id
|
||||
FROM $categoriestable
|
||||
WHERE parent_id = '" . intval($categories_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
while ($categories = $result->fields) {
|
||||
$categories_count++;
|
||||
$categories_count += oos_childs_in_category_count($categories['categories_id']);
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$result->MoveNext();
|
||||
}
|
||||
|
||||
return $categories_count;
|
||||
}
|
||||
|
||||
|
||||
function oos_set_categories_status($categories_id, $status) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$categoriestable = $oostable['categories'];
|
||||
if ($status == '1') {
|
||||
$query = "UPDATE $categoriestable
|
||||
SET categories_status = '1',
|
||||
last_modified = now()
|
||||
WHERE categories_id = '" . intval($categories_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$categories_query = "SELECT categories_id
|
||||
FROM $categoriestable
|
||||
WHERE parent_id = '" . intval($categories_id) . "'";
|
||||
$categories_result = $dbconn->Execute($categories_query);
|
||||
|
||||
while ($categories = $categories_result->fields) {
|
||||
oos_set_categories_status($categories['categories_id'], 1);
|
||||
// Move that ADOdb pointer!
|
||||
$categories_result->MoveNext();
|
||||
}
|
||||
return;
|
||||
} elseif ($status == '2') {
|
||||
$query = "UPDATE $categoriestable
|
||||
SET categories_status = '2',
|
||||
last_modified = now()
|
||||
WHERE categories_id = '" . intval($categories_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
return;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function oos_set_product_status($products_id, $status) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$productstable = $oostable['products'];
|
||||
$query = "UPDATE $productstable
|
||||
SET products_setting = '" . intval($status) . "',
|
||||
products_last_modified = now()
|
||||
WHERE products_id = '" . intval($products_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function product_move_to_trash($products_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$productstable = $oostable['products'];
|
||||
$query = "UPDATE $productstable
|
||||
SET products_setting = '0',
|
||||
products_last_modified = now()
|
||||
WHERE products_id = '" . intval($products_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function category_move_to_trash($categories_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$categoriestable = $oostable['categories'];
|
||||
$query = "UPDATE $categoriestable
|
||||
SET categories_status = '0',
|
||||
last_modified = now()
|
||||
WHERE categories_id = '" . intval($categories_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function oos_generate_category_path($id, $from = 'category', $categories_array = '', $index = 0) {
|
||||
|
||||
if (!is_array($categories_array)) $categories_array = array();
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$products_to_categoriestable = $oostable['products_to_categories'];
|
||||
$categoriestable = $oostable['categories'];
|
||||
$categories_descriptiontable = $oostable['categories_description'];
|
||||
|
||||
if ($from == 'product') {
|
||||
$categories_query = "SELECT categories_id
|
||||
FROM $products_to_categoriestable
|
||||
WHERE products_id = '" . intval($id) . "'";
|
||||
$categories_result = $dbconn->Execute($categories_query);
|
||||
|
||||
while ($categories = $categories_result->fields) {
|
||||
if ($categories['categories_id'] == '0') {
|
||||
$categories_array[$index][] = array('id' => '0', 'text' => TEXT_TOP);
|
||||
} else {
|
||||
$category_query = "SELECT cd.categories_name, c.parent_id
|
||||
FROM $categoriestable c,
|
||||
$categories_descriptiontable cd
|
||||
WHERE c.categories_id = '" . intval($categories['categories_id']) . "'
|
||||
AND c.categories_id = cd.categories_id
|
||||
AND cd.categories_languages_id = '" . intval($_SESSION['language_id']) . "'";
|
||||
$category_result = $dbconn->Execute($category_query);
|
||||
|
||||
$category = $category_result->fields;
|
||||
|
||||
$categories_array[$index][] = array('id' => $categories['categories_id'], 'text' => $category['categories_name']);
|
||||
if ( (oos_is_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = oos_generate_category_path($category['parent_id'], 'category', $categories_array, $index);
|
||||
$categories_array[$index] = array_reverse($categories_array[$index]);
|
||||
}
|
||||
$index++;
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$categories_result->MoveNext();
|
||||
}
|
||||
|
||||
} elseif ($from == 'category') {
|
||||
|
||||
$category_query = "SELECT cd.categories_name, c.parent_id
|
||||
FROM $categoriestable c,
|
||||
$categories_descriptiontable cd
|
||||
WHERE c.categories_id = '" . intval($id) . "'
|
||||
AND c.categories_id = cd.categories_id
|
||||
AND cd.categories_languages_id = '" . intval($_SESSION['language_id']) . "'";
|
||||
$category_result = $dbconn->Execute($category_query);
|
||||
|
||||
$category = $category_result->fields;
|
||||
|
||||
$categories_array[$index][] = array('id' => $id, 'text' => $category['categories_name']);
|
||||
if ( (oos_is_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = oos_generate_category_path($category['parent_id'], 'category', $categories_array, $index);
|
||||
}
|
||||
|
||||
return $categories_array;
|
||||
}
|
||||
|
||||
|
||||
function oos_output_generated_category_path($id, $from = 'category') {
|
||||
$calculated_category_path_string = '';
|
||||
$calculated_category_path = oos_generate_category_path($id, $from);
|
||||
for ($i = 0, $n = count($calculated_category_path); $i < $n; $i++) {
|
||||
for ($j = 0, $k = count($calculated_category_path[$i]); $j < $k; $j++) {
|
||||
$calculated_category_path_string .= $calculated_category_path[$i][$j]['text'] . ' > ';
|
||||
}
|
||||
$calculated_category_path_string = substr($calculated_category_path_string, 0, -16) . '<br />';
|
||||
}
|
||||
$calculated_category_path_string = substr($calculated_category_path_string, 0, -6);
|
||||
|
||||
if (strlen($calculated_category_path_string) < 1) $calculated_category_path_string = TEXT_TOP;
|
||||
|
||||
return $calculated_category_path_string;
|
||||
}
|
||||
|
||||
function oos_remove_category_image($image) {
|
||||
$sImage = oos_var_prep_for_os($image);
|
||||
|
||||
if (file_exists(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'category/originals/' .$sImage)) {
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'category/large/' .$sImage);
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'category/medium/' .$sImage);
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'category/small/' .$sImage);
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'category/originals/' .$sImage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function oos_remove_category_banner($image) {
|
||||
$sImage = oos_var_prep_for_os($image);
|
||||
|
||||
if (file_exists(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'banners/originals/' .$sImage)) {
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'banners/large/' .$sImage);
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'banners/medium/' .$sImage);
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'banners/originals/' .$sImage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function oos_remove_category($category_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$categoriestable = $oostable['categories'];
|
||||
$category_image_query = "SELECT categories_image
|
||||
FROM $categoriestable
|
||||
WHERE categories_id = '" . intval($category_id) . "'";
|
||||
$category_image_result = $dbconn->Execute($category_image_query);
|
||||
$category_image = $category_image_result->fields;
|
||||
|
||||
$duplicate_image_query = "SELECT COUNT(*) AS total
|
||||
FROM $categoriestable
|
||||
WHERE categories_image = '" . oos_db_input($category_image['categories_image']) . "'";
|
||||
$duplicate_image_result = $dbconn->Execute($duplicate_image_query);
|
||||
$duplicate_image = $duplicate_image_result->fields;
|
||||
|
||||
if ($duplicate_image['total'] < 2) {
|
||||
oos_remove_category_image($category_image['categories_image']);
|
||||
}
|
||||
|
||||
$categories_imagestable = $oostable['categories_images'];
|
||||
$category_image_query = "SELECT categories_image
|
||||
FROM $categories_imagestable
|
||||
WHERE categories_id = '" . intval($category_id) . "'";
|
||||
$category_image_result = $dbconn->Execute($category_image_query);
|
||||
while ($category_image = $category_image_result->fields) {
|
||||
|
||||
$duplicate_image = "SELECT COUNT(*) AS total
|
||||
FROM $categories_imagestable
|
||||
WHERE categories_image = '" . oos_db_input($category_image['categories_image']) . "'";
|
||||
$duplicate_image_result = $dbconn->Execute($duplicate_image);
|
||||
$duplicate_image = $duplicate_image_result->fields;
|
||||
|
||||
if ($duplicate_image['total'] < 2) {
|
||||
oos_remove_category_image($category_image['categories_image']);
|
||||
}
|
||||
// Move that ADOdb pointer!
|
||||
$category_image_result->MoveNext();
|
||||
}
|
||||
|
||||
$dbconn->Execute("DELETE FROM " . $oostable['categories'] . " WHERE categories_id = '" . intval($category_id) . "'");
|
||||
$dbconn->Execute("DELETE FROM " . $oostable['categories_description'] . " WHERE categories_id = '" . intval($category_id) . "'");
|
||||
$dbconn->Execute("DELETE FROM " . $oostable['categories_images'] . " WHERE categories_id = '" . intval($category_id) . "'");
|
||||
$dbconn->Execute("DELETE FROM " . $oostable['products_to_categories'] . " WHERE categories_id = '" . intval($category_id) . "'");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Code: categories_description
|
||||
* Author: Brian Lowe <blowe@wpcusrgrp.org>
|
||||
* Date: June 2002
|
||||
*/
|
||||
function oos_get_category_heading_title($category_id, $language_id = '') {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$categories_descriptiontable = $oostable['categories_description'];
|
||||
$query = "SELECT categories_heading_title
|
||||
FROM $categories_descriptiontable
|
||||
WHERE categories_id = '" . intval($category_id) . "'
|
||||
AND categories_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$categories_heading_title = $result->fields['categories_heading_title'];
|
||||
|
||||
return $categories_heading_title;
|
||||
}
|
||||
|
||||
function oos_get_category_description($category_id, $language_id = '') {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$categories_descriptiontable = $oostable['categories_description'];
|
||||
$query = "SELECT categories_description
|
||||
FROM $categories_descriptiontable
|
||||
WHERE categories_id = '" . intval($category_id) . "'
|
||||
AND categories_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$categories_description = $result->fields['categories_description'];
|
||||
|
||||
return $categories_description;
|
||||
}
|
||||
|
||||
|
||||
function oos_get_category_description_meta($category_id, $language_id = '') {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$categories_descriptiontable = $oostable['categories_description'];
|
||||
$query = "SELECT categories_description_meta
|
||||
FROM $categories_descriptiontable
|
||||
WHERE categories_id = '" . intval($category_id) . "'
|
||||
AND categories_languages_id = '" . intval($language_id). "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$categories_description_meta = $result->fields['categories_description_meta'];
|
||||
|
||||
return $categories_description_meta;
|
||||
}
|
||||
|
||||
|
||||
function oos_duplicate_product_image_check($image) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$productstable = $oostable['products'];
|
||||
$query = "SELECT COUNT(*) AS total
|
||||
FROM $productstable
|
||||
WHERE products_image = '" . oos_db_input($image) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
if ($result->fields['total'] == 1) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function oos_remove_product_image($image) {
|
||||
$sImage = oos_var_prep_for_os($image);
|
||||
|
||||
if (file_exists(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'product/originals/' .$sImage)) {
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'product/large/' .$sImage);
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'product/medium_large/' .$sImage);
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'product/medium/' .$sImage);
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'product/small/' .$sImage);
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'product/min/' .$sImage);
|
||||
@unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'product/originals/' .$sImage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a product's manufacturer
|
||||
*
|
||||
* @param $products_id
|
||||
* @return string
|
||||
*/
|
||||
function oos_get_manufacturers_name($product_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$manufacturerstable = $oostable['manufacturers'];
|
||||
$manufacturers_infotable = $oostable['manufacturers_info'];
|
||||
$productstable = $oostable['products'];
|
||||
$query = "SELECT m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url
|
||||
FROM $manufacturerstable m,
|
||||
$manufacturers_infotable mi,
|
||||
$productstable p
|
||||
WHERE p.products_id = '" . intval($product_id) . "'
|
||||
AND p.manufacturers_id = m.manufacturers_id
|
||||
AND mi.manufacturers_id = m.manufacturers_id";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$manufacturers_name = $result->fields['manufacturers_name'];
|
||||
|
||||
|
||||
return $manufacturers_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return Products Special Price
|
||||
*
|
||||
* @param $nProductID
|
||||
* @return string
|
||||
*/
|
||||
function oos_get_products_special_price($nProductID) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$specialstable = $oostable['specials'];
|
||||
$query = "SELECT specials_new_products_price
|
||||
FROM $specialstable
|
||||
WHERE products_id = '" . intval($nProductID) . "'
|
||||
AND status";
|
||||
$specials_new_products_price = $dbconn->GetOne($query);
|
||||
|
||||
return $specials_new_products_price;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find a Categories Name
|
||||
*
|
||||
* @param $who_am_i
|
||||
* @return string
|
||||
*/
|
||||
function oos_get_categories_name($who_am_i) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$categories_descriptiontable = $oostable['categories_description'];
|
||||
$query = "SELECT categories_name
|
||||
FROM $categories_descriptiontable
|
||||
WHERE categories_id = '" . intval($who_am_i) . "'
|
||||
AND categories_languages_id = '" . intval($_SESSION['language_id']) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$categories_name = $result->fields['categories_name'];
|
||||
|
||||
return $categories_name;
|
||||
}
|
||||
|
152
msd2/myoos/admin/includes/functions/function_coupon.php
Normal file
152
msd2/myoos/admin/includes/functions/function_coupon.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: add_ccgvdc_application_top.php
|
||||
gv_sent.php,v 1.1 2003/02/18 00:18:50 wilt
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2002 - 2003 osCommerce
|
||||
|
||||
Credit Class GV/Discount Coupon v5.03
|
||||
Copyright (c) 2001 - 2003 Ian C Wilson
|
||||
http://www.phesis.org
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
|
||||
/**
|
||||
* Create a Coupon Code. length may be between 1 and 16 Characters
|
||||
*
|
||||
* @param $salt
|
||||
* @param $length
|
||||
* @return string
|
||||
*/
|
||||
function oos_create_coupon_code($salt="secret", $length=SECURITY_CODE_LENGTH) {
|
||||
|
||||
$ccid = md5(uniqid("","salt"));
|
||||
$ccid .= md5(uniqid("","salt"));
|
||||
$ccid .= md5(uniqid("","salt"));
|
||||
$ccid .= md5(uniqid("","salt"));
|
||||
|
||||
srand((double)microtime()*1000000); // seed the random number generator
|
||||
$random_start = @rand(0, (128-$length));
|
||||
$good_result = 0;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
while ($good_result == 0) {
|
||||
$coupon_code = substr($ccid, $random_start,$length);
|
||||
$query = "SELECT coupon_code
|
||||
FROM " . $oostable['coupons'] . "
|
||||
WHERE coupon_code = '" . $coupon_code . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
if ($result->RecordCount() == 0) $good_result = 1;
|
||||
}
|
||||
|
||||
|
||||
return $coupon_code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the Customers GV account
|
||||
*
|
||||
* @param $customer_id
|
||||
* @param $gv_id
|
||||
*/
|
||||
function oos_gv_account_update($customer_id, $gv_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$coupon_gv_query = "SELECT coupon_amount
|
||||
FROM " . $oostable['coupons'] . "
|
||||
WHERE coupon_id = '" . $gv_id . "'";
|
||||
$coupon_gv_result = $dbconn->Execute($coupon_gv_query);
|
||||
$coupon_gv = $coupon_gv_result->fields;
|
||||
|
||||
if ($customer_gv_result->RecordCount() > 0) {
|
||||
$customer_gv_query = "SELECT amount
|
||||
FROM " . $oostable['coupon_gv_customer'] . "
|
||||
WHERE customer_id = '" . $customer_id . "'";
|
||||
$customer_gv_result = $dbconn->Execute($customer_gv_query);
|
||||
|
||||
$customer_gv = $customer_gv_result->fields;
|
||||
$new_gv_amount = $customer_gv['amount'] + $coupon_gv['coupon_amount'];
|
||||
|
||||
$gv_query = "UPDATE " . $oostable['coupon_gv_customer'] . "
|
||||
SET amount = '" . $new_gv_amount . "'";
|
||||
$result = $dbconn->Execute($gv_query);
|
||||
} else {
|
||||
$gv_query = "INSERT INTO " . $oostable['coupon_gv_customer'] . "
|
||||
(customer_id, amount) VALUES ('" . $customer_id . "', '" . $coupon_gv['coupon_amount'] . "'";
|
||||
$result = $dbconn->Execute($gv_query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a day/month/year dropdown selector
|
||||
*
|
||||
* @param $prefix
|
||||
* @param $date
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_date_selector($prefix, $date='') {
|
||||
$month_array = array();
|
||||
$month_array[1] =_JANUARY;
|
||||
$month_array[2] =_FEBRUARY;
|
||||
$month_array[3] =_MARCH;
|
||||
$month_array[4] =_APRIL;
|
||||
$month_array[5] =_MAY;
|
||||
$month_array[6] =_JUNE;
|
||||
$month_array[7] =_JULY;
|
||||
$month_array[8] =_AUGUST;
|
||||
$month_array[9] =_SEPTEMBER;
|
||||
$month_array[10] =_OCTOBER;
|
||||
$month_array[11] =_NOVEMBER;
|
||||
$month_array[12] =_DECEMBER;
|
||||
$usedate = getdate($date);
|
||||
$day = $usedate['mday'];
|
||||
$month = $usedate['mon'];
|
||||
$year = $usedate['year'];
|
||||
$date_selector = '<select name="'. $prefix .'_day">';
|
||||
for ($i=1;$i<32;$i++){
|
||||
$date_selector .= '<option value="' . $i . '"';
|
||||
if ($i==$day) $date_selector .= 'selected';
|
||||
$date_selector .= '>' . $i . '</option>';
|
||||
}
|
||||
$date_selector .= '</select>';
|
||||
$date_selector .= '<select name="'. $prefix .'_month">';
|
||||
for ($i=1;$i<13;$i++){
|
||||
$date_selector .= '<option value="' . $i . '"';
|
||||
if ($i==$month) $date_selector .= 'selected';
|
||||
$date_selector .= '>' . $month_array[$i] . '</option>';
|
||||
}
|
||||
$date_selector .= '</select>';
|
||||
$date_selector .= '<select name="'. $prefix .'_year">';
|
||||
for ($i=2018;$i<2029;$i++){
|
||||
$date_selector .= '<option value="' . $i . '"';
|
||||
if ($i==$year) $date_selector .= 'selected';
|
||||
$date_selector .= '>' . $i . '</option>';
|
||||
}
|
||||
$date_selector .= '</select>';
|
||||
|
||||
return $date_selector;
|
||||
}
|
220
msd2/myoos/admin/includes/functions/function_customer.php
Normal file
220
msd2/myoos/admin/includes/functions/function_customer.php
Normal file
@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: general_elari_cs.php,v 1.1 2003/01/08 10:53:01 elarifr
|
||||
----------------------------------------------------------------------
|
||||
For customers_status_v3.x / Admin
|
||||
|
||||
Contribution based on:
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2002 - 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
/**
|
||||
* Customer Status Name
|
||||
*
|
||||
* @param $customers_status_id
|
||||
* @param $language
|
||||
* @return string
|
||||
*/
|
||||
function oos_get_customer_status_name($customers_status_id, $language_id = '') {
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT customers_status_name
|
||||
FROM " . $oostable['customers_status'] . "
|
||||
WHERE customers_status_id = '" . intval($customers_status_id) . "'
|
||||
AND customers_status_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$customers_status_name = $result->fields['customers_status_name'];
|
||||
|
||||
return $customers_status_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all customers statuses for a specified language_id and return an array(array())
|
||||
* Use it to make pull_down_menu, checkbox
|
||||
*
|
||||
* @author elari - Added in CS V1.1
|
||||
* @changed by $Author: r23 $
|
||||
* @param $customers_status_id
|
||||
* @param $language
|
||||
* @return array(array())
|
||||
*/
|
||||
function oos_get_customers_statuses() {
|
||||
|
||||
$customers_statuses_array = array();
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT customers_status_id, customers_status_name, customers_status_ot_discount_flag,
|
||||
customers_status_ot_discount, customers_status_payment
|
||||
FROM " . $oostable['customers_status'] . "
|
||||
WHERE customers_status_languages_id = '" . intval($_SESSION['language_id']) . "'
|
||||
ORDER BY customers_status_id";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
while ($customers_statuses = $result->fields) {
|
||||
$i = $customers_statuses['customers_status_id'];
|
||||
$customers_statuses_array[$i] = array('id' => $customers_statuses['customers_status_id'],
|
||||
'text' => $customers_statuses['customers_status_name'],
|
||||
'cs_public' => $customers_statuses['customers_status_public'],
|
||||
'cs_ot_discount_flag' => $customers_statuses['customers_status_ot_discount_flag'],
|
||||
'cs_ot_discount' => $customers_statuses['customers_status_ot_discount'],
|
||||
'cs_staffelpreis' => $customers_statuses['customers_status_qty_discounts'],
|
||||
'cs_payment_unallowed' => $customers_statuses['customers_status_payment']);
|
||||
// Move that ADOdb pointer!
|
||||
$result->MoveNext();
|
||||
}
|
||||
|
||||
return $customers_statuses_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all status info values for a customer_id in admin . no need to check session !
|
||||
* Use it to make pull_down_menu, checkbox
|
||||
*
|
||||
* @author elari - Added in CS V1.1
|
||||
* @changed by $Author: r23 $
|
||||
* @param $customers_id
|
||||
* @return array(array())
|
||||
*/
|
||||
function oos_get_customers_status($customer_id) {
|
||||
|
||||
$customer_status_array = array();
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT customers_status, customers_status_name, customers_status_public,
|
||||
customers_status_ot_discount_flag, customers_status_ot_discount,
|
||||
customers_status_qty_discounts, customers_status_payment
|
||||
FROM " . $oostable['customers'] . " LEFT JOIN
|
||||
" . $oostable['customers_status'] . " ON
|
||||
customers_status = customers_status_id
|
||||
WHERE customers_id= '" . intval($customer_id) . "'
|
||||
AND customers_status_languages_id = '" . intval($_SESSION['language_id']) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
$customer_status_array = $result->fields;
|
||||
|
||||
return $customer_status_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Login Status
|
||||
*
|
||||
* @param $customer_id
|
||||
* @param $status
|
||||
*/
|
||||
function oos_set_customer_login($customer_id, $status) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if ($status == '1') {
|
||||
$query = "UPDATE " . $oostable['customers'] . "
|
||||
SET customers_login = '1'
|
||||
WHERE customers_id = '" . intval($customer_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
return;
|
||||
} elseif ($status == '0') {
|
||||
$query = "UPDATE " . $oostable['customers'] . "
|
||||
SET customers_login = '0'
|
||||
WHERE customers_id = '" . intval($customer_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
return;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Installed Payment
|
||||
*
|
||||
* @author r23 <info@r23.de>
|
||||
* @copyright 2003 r23
|
||||
* @param $customers_payment
|
||||
* @return string
|
||||
*/
|
||||
function oos_installed_payment($customers_payment = '') {
|
||||
GLOBAL $aLang;
|
||||
|
||||
$install_payment = '';
|
||||
$installed_payment = explode(';', MODULE_PAYMENT_INSTALLED);
|
||||
$select_payment = explode(';', $customers_payment);
|
||||
for ($i = 0, $n = count($installed_payment); $i < $n; $i++) {
|
||||
$file = $installed_payment[$i];
|
||||
|
||||
include OOS_ABSOLUTE_PATH . 'includes/languages/' . $_SESSION['language'] . '/modules/payment/' . $file;
|
||||
include OOS_ABSOLUTE_PATH . 'includes/modules/payment/' . $file;
|
||||
|
||||
$class = substr($file, 0, strrpos($file, '.'));
|
||||
if (oos_class_exits($class)) {
|
||||
$module = new $class;
|
||||
|
||||
if (in_array ($file, $select_payment)) {
|
||||
$install_payment .= oos_draw_checkbox_field('payment[]', $file, true) . $module->title . '<br />';
|
||||
} else {
|
||||
$install_payment .= oos_draw_checkbox_field('payment[]', $file) . $module->title . '<br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $install_payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customers Payment
|
||||
*
|
||||
* @author r23 <info@r23.de>
|
||||
* @copyright 2003 r23
|
||||
* @param $customers_payment
|
||||
* @return string
|
||||
*/
|
||||
function oos_customers_payment($customers_payment = '') {
|
||||
GLOBAL $aLang;
|
||||
|
||||
$payment_title = '';
|
||||
if (oos_is_not_null($customers_payment)) {
|
||||
$select_payment = explode(';', $customers_payment);
|
||||
for ($i = 0, $n = count($select_payment); $i < $n; $i++) {
|
||||
$file = $select_payment[$i];
|
||||
|
||||
include OOS_ABSOLUTE_PATH . 'includes/languages/' . $_SESSION['language'] . '/modules/payment/' . $file;
|
||||
include OOS_ABSOLUTE_PATH . 'includes/modules/payment/' . $file;
|
||||
|
||||
$class = substr($file, 0, strrpos($file, '.'));
|
||||
if (oos_class_exits($class)) {
|
||||
$module = new $class;
|
||||
$payment_title .= $module->title . '<br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $payment_title;
|
||||
}
|
||||
|
144
msd2/myoos/admin/includes/functions/function_edit_orders.php
Normal file
144
msd2/myoos/admin/includes/functions/function_edit_orders.php
Normal file
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: edit_orders.php,v 1.2 2003/08/08 13:50:00 jwh
|
||||
----------------------------------------------------------------------
|
||||
Order Editor
|
||||
|
||||
Written by Jonathan Hilgeman of SiteCreative.com (osc@sitecreative.com)
|
||||
Contribution based on:
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
/**
|
||||
* Return the country_id based on the country's name
|
||||
*
|
||||
* @param $country_name string
|
||||
* @return integer
|
||||
*/
|
||||
function oos_get_country_id($country_name) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
$query = "SELECT countries_id
|
||||
FROM " . $oostable['countries'] . "
|
||||
WHERE countries_name = '" . oos_db_input($country_name) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
if (!$result->RecordCount()) {
|
||||
$country_id = 0;
|
||||
} else {
|
||||
$country_id = $result->fields['countries_id'];
|
||||
}
|
||||
|
||||
return $country_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the country_iso_code_2 based on the country's id
|
||||
*
|
||||
* @param $country_id integer
|
||||
* @return string
|
||||
*/
|
||||
function oos_get_country_isocode2($country_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
$query = "SELECT countries_iso_code_2
|
||||
FROM " . $oostable['countries'] . "
|
||||
WHERE countries_id = '" . intval($country_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
if (!$result->RecordCount()) {
|
||||
$country_iso = 0;
|
||||
} else {
|
||||
$country_iso = $result->fields['countries_iso_code_2'];
|
||||
}
|
||||
|
||||
return $country_iso;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the zone_id based on the zone's name
|
||||
*
|
||||
* @param $country_id integer
|
||||
* @param $zone_name string
|
||||
* @return integer
|
||||
*/
|
||||
function oos_get_zone_id($country_id, $zone_name) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
$query = "SELECT zone_id
|
||||
FROM " . $oostable['zones'] . "
|
||||
WHERE zone_country_id = '" . intval($country_id) . "'
|
||||
AND zone_name = '" . oos_db_input($zone_name) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
if (!$result->RecordCount()) {
|
||||
$zone_id = 0;
|
||||
} else {
|
||||
$zone_id = $result->fields['zone_id'];
|
||||
}
|
||||
|
||||
return $zone_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return result of check the existence of a database field
|
||||
*
|
||||
* @param $table string
|
||||
* @param $field string
|
||||
* @return boolean
|
||||
*/
|
||||
function oos_field_exists($table, $field) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$describe_result = $dbconn->Execute("describe $table");
|
||||
while($d_row = $describe_result->fields) {
|
||||
if ($d_row["Field"] == "$field") return TRUE;
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$describe_result->MoveNext();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string with changed quotes to HTML equivalents for form inputs.
|
||||
*
|
||||
* @param $string string
|
||||
* @return string
|
||||
*/
|
||||
function oos_html_quotes($string) {
|
||||
return str_replace("'", "'", $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string with changed HTML equivalents back to quotes
|
||||
*
|
||||
* @param $string string
|
||||
* @return string
|
||||
*/
|
||||
function oos_html_unquote($string) {
|
||||
return str_replace("'", "'", $string);
|
||||
}
|
||||
|
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
|
||||
function oos_get_informations_name($informations_id, $language_id = '') {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
$information_descriptiontable = $oostable['information_description'];
|
||||
$query = "SELECT information_name
|
||||
FROM " . $information_descriptiontable . "
|
||||
WHERE information_id = '" . intval($informations_id) . "'
|
||||
AND information_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$information_name = $result->fields['information_name'];
|
||||
|
||||
|
||||
return $information_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function oos_get_informations_description($informations_id, $language_id = '') {
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$information_descriptiontable = $oostable['information_description'];
|
||||
$query = "SELECT information_description
|
||||
FROM " . $information_descriptiontable . "
|
||||
WHERE information_id = '" . intval($informations_id) . "'
|
||||
AND information_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$information_description = $result->fields['information_description'];
|
||||
|
||||
return $information_description;
|
||||
}
|
||||
|
||||
|
||||
function oos_get_informations_heading_title($informations_id, $language_id = '') {
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$information_descriptiontable = $oostable['information_description'];
|
||||
$query = "SELECT information_heading_title
|
||||
FROM " . $information_descriptiontable . "
|
||||
WHERE information_id = '" . intval($informations_id) . "'
|
||||
AND information_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$information_heading_title = $result->fields['information_heading_title'];
|
||||
|
||||
return $information_heading_title;
|
||||
}
|
||||
|
1098
msd2/myoos/admin/includes/functions/function_kernel.php
Normal file
1098
msd2/myoos/admin/includes/functions/function_kernel.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: localization.php,v 1.12 2003/06/25 20:36:48 hpdl
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
|
||||
$page = file('http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code . '&format=CSV&dest=Get+Table&sel_list=' . $base);
|
||||
|
||||
$match = array();
|
||||
|
||||
preg_match('/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i', implode('', $page), $match);
|
||||
|
||||
if (count($match) > 0) {
|
||||
return $match[3];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
|
||||
$page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
|
||||
|
||||
$match = array();
|
||||
|
||||
preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', implode('', $page), $match);
|
||||
|
||||
if (count($match) > 0) {
|
||||
return $match[1];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
300
msd2/myoos/admin/includes/functions/function_modules.php
Normal file
300
msd2/myoos/admin/includes/functions/function_modules.php
Normal file
@ -0,0 +1,300 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: general.php,v 1.151 2003/02/07 21:46:49 dgw_
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
|
||||
/**
|
||||
* Returns Zone Class Name
|
||||
*
|
||||
* @param $zone_class_id
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_get_zone_class_title($zone_class_id) {
|
||||
|
||||
if ($zone_class_id == '0') {
|
||||
return TEXT_NONE;
|
||||
} else {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT geo_zone_name
|
||||
FROM " . $oostable['geo_zones'] . "
|
||||
WHERE geo_zone_id = '" . intval($zone_class_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
return $result->fields['geo_zone_name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns Order Status Name
|
||||
*
|
||||
* @param $order_status_id
|
||||
* @param $language
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_get_order_status_name($order_status_id, $language_id = '') {
|
||||
|
||||
if ($order_status_id < 1) return TEXT_DEFAULT;
|
||||
|
||||
if (empty($language_id) || !is_numeric($language_id)) $language_id = intval($_SESSION['language_id']);
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT orders_status_name
|
||||
FROM " . $oostable['orders_status'] . "
|
||||
WHERE orders_status_id = '" . intval($order_status_id) . "'
|
||||
AND orders_languages_id = '" . intval($language_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
return $result->fields['orders_status_name'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns Tax Class Name
|
||||
*
|
||||
* @param $tax_class_id
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_get_tax_class_title($tax_class_id) {
|
||||
|
||||
if ($tax_class_id == '0') {
|
||||
return TEXT_NONE;
|
||||
} else {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT tax_class_title
|
||||
FROM " . $oostable['tax_class'] . "
|
||||
WHERE tax_class_id = '" . intval($tax_class_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
return $result->fields['tax_class_title'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns Zone Name
|
||||
*
|
||||
* @param $zone_id
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_get_zone_name($zone_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT zone_name
|
||||
FROM " . $oostable['zones'] . "
|
||||
WHERE zone_id = '" . intval($zone_id) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
if (!$result->RecordCount()) {
|
||||
return $zone_id;
|
||||
} else {
|
||||
return $result->fields['zone_name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to read in text area in admin
|
||||
*
|
||||
* @param $text
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_textarea($text) {
|
||||
return oos_draw_textarea_field('configuration_value', FALSE, 35, 5, $text);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a selection field
|
||||
*
|
||||
* @param $select_array
|
||||
* @key_value
|
||||
* @key
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_select_option($select_array, $key_value, $key = '') {
|
||||
$string = '';
|
||||
|
||||
for ($i = 0, $n = count($select_array); $i < $n; $i++) {
|
||||
$name = ((oos_is_not_null($key)) ? 'configuration[' . $key . ']' : 'configuration_value');
|
||||
|
||||
$string .= '<br /><input type="radio" name="' . $name . '" value="' . $select_array[$i] . '"';
|
||||
|
||||
if ($key_value == $select_array[$i]) $string .= ' checked="checked"';
|
||||
|
||||
$string .= ' /> ' . $select_array[$i];
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Alias function to oos_get_country_name, which also returns the country name
|
||||
*
|
||||
* @param $country_id
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_get_country_name($country_id) {
|
||||
return oos_get_country_name($country_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Alias function for Store configuration values in the Administration Tool
|
||||
*
|
||||
* @param $country_id
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_pull_down_country_list($country_id) {
|
||||
return oos_draw_pull_down_menu('configuration_value', oos_get_countries(), $country_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Alias function for Store configuration values in the Administration Tool
|
||||
*
|
||||
* @param $zone_id
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_pull_down_zone_list($zone_id) {
|
||||
return oos_draw_pull_down_menu('configuration_value', oos_get_country_zones(STORE_COUNTRY), $zone_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form pull down menu
|
||||
*
|
||||
* @param $zone_class_id
|
||||
* @param $key
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_pull_down_zone_classes($zone_class_id, $key = '') {
|
||||
|
||||
$name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value');
|
||||
|
||||
$zone_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT geo_zone_id, geo_zone_name
|
||||
FROM " . $oostable['geo_zones'] . "
|
||||
ORDER BY geo_zone_name";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
while ($zone_class = $result->fields) {
|
||||
$zone_class_array[] = array('id' => $zone_class['geo_zone_id'],
|
||||
'text' => $zone_class['geo_zone_name']);
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$result->MoveNext();
|
||||
}
|
||||
|
||||
return oos_draw_pull_down_menu($name, $zone_class_array, $zone_class_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form pull down menu
|
||||
*
|
||||
* @param $order_status_id
|
||||
* @param $key
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_pull_down_order_statuses($order_status_id, $key = '') {
|
||||
|
||||
$name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value');
|
||||
|
||||
$statuses_array = array(array('id' => '0', 'text' => TEXT_DEFAULT));
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT orders_status_id, orders_status_name
|
||||
FROM " . $oostable['orders_status'] . "
|
||||
WHERE orders_languages_id = '" . intval($_SESSION['language_id']) . "'
|
||||
ORDER BY orders_status_name";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
while ($statuses = $result->fields) {
|
||||
$statuses_array[] = array('id' => $statuses['orders_status_id'],
|
||||
'text' => $statuses['orders_status_name']);
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$result->MoveNext();
|
||||
}
|
||||
|
||||
return oos_draw_pull_down_menu($name, $statuses_array, $order_status_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form pull down menu
|
||||
*
|
||||
* @param $tax_class_id
|
||||
* @param $key
|
||||
* @return string
|
||||
*/
|
||||
function oos_cfg_pull_down_tax_classes($tax_class_id, $key = '') {
|
||||
|
||||
$name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value');
|
||||
|
||||
$tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT tax_class_id, tax_class_title
|
||||
FROM " . $oostable['tax_class'] . "
|
||||
ORDER BY tax_class_title";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
while ($tax_class = $result->fields) {
|
||||
$tax_class_array[] = array('id' => $tax_class['tax_class_id'],
|
||||
'text' => $tax_class['tax_class_title']);
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$result->MoveNext();
|
||||
}
|
||||
|
||||
return oos_draw_pull_down_menu($name, $tax_class_array, $tax_class_id);
|
||||
}
|
||||
|
597
msd2/myoos/admin/includes/functions/function_output.php
Normal file
597
msd2/myoos/admin/includes/functions/function_output.php
Normal file
@ -0,0 +1,597 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: html_output.php,v 1.26 2002/08/06 14:48:54 hpdl
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
|
||||
/**
|
||||
* The HTML href link wrapper function
|
||||
*
|
||||
* @param $page
|
||||
* @param $parameters
|
||||
* @param $connection
|
||||
* @return string
|
||||
*/
|
||||
function oos_href_link_admin($page = '', $parameters = '', $connection = 'SSL', $add_session_id = true) {
|
||||
|
||||
$page = oos_output_string($page);
|
||||
|
||||
if ($page == '') {
|
||||
die('<div class="alert alert-danger" role="alert"><strong>Error!</strong> Unable to determine the page link!<br /><br />Function used:<br /><br />oos_href_link_admin(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</div>');
|
||||
}
|
||||
$link = OOS_HTTPS_SERVER . OOS_SHOP . OOS_ADMIN;
|
||||
|
||||
if (oos_is_not_null($parameters)) {
|
||||
$link = $link . $page . '?' . oos_output_string($parameters) . '&' . SID;
|
||||
} else {
|
||||
$link = $link . $page . '?' . SID;
|
||||
}
|
||||
|
||||
|
||||
while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The HTML catalog href link wrapper function
|
||||
*
|
||||
* @param $modul
|
||||
* @param $page
|
||||
* @param $parameters
|
||||
* @param $connection
|
||||
* @return string
|
||||
*/
|
||||
function oos_catalog_link($page = '', $parameters = '') {
|
||||
|
||||
$page = oos_output_string($page);
|
||||
|
||||
if ($page == '') {
|
||||
die('<div class="alert alert-danger" role="alert"><strong>Error!</strong> Unable to determine the page link!<br /><br />Function used:<br /><br />oos_href_link_admin(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</div>');
|
||||
}
|
||||
|
||||
$link = OOS_HTTPS_SERVER . OOS_SHOP;
|
||||
|
||||
if ($parameters == '') {
|
||||
$link .= 'index.php?content=' . $page;
|
||||
} else {
|
||||
$link .= 'index.php?content=' . $page . '&' . oos_output_string($parameters);
|
||||
}
|
||||
|
||||
|
||||
while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The HTML catalog href link wrapper function
|
||||
*
|
||||
* @param $src
|
||||
* @param $alt
|
||||
* @param $width
|
||||
* @param $height
|
||||
* @param $params
|
||||
* @return string
|
||||
*/
|
||||
function oos_image($src, $alt = '', $width = '', $height = '', $params = '') {
|
||||
$image = '<img src="' . oos_output_string($src) . '" border="0" alt="' . oos_output_string($alt) . '"';
|
||||
|
||||
if (oos_is_not_null($alt)) {
|
||||
$image .= ' title="' . oos_output_string($alt) . '"';
|
||||
}
|
||||
|
||||
if (oos_is_not_null($width) && oos_is_not_null($height)) {
|
||||
$image .= ' width="' . oos_output_string($width) . '" height="' . oos_output_string($height) . '"';
|
||||
}
|
||||
|
||||
if (oos_is_not_null($params)) $image .= ' ' . $params;
|
||||
|
||||
$image .= '>';
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function product_info_image($image, $alt, $width = '', $height = '') {
|
||||
if ( ($image) && (file_exists(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'product/medium/' . $image)) ) {
|
||||
$image = oos_image(OOS_SHOP_IMAGES . 'product/medium/' . $image, $alt, $width, $height);
|
||||
} else {
|
||||
$image = TEXT_IMAGE_NONEXISTENT;
|
||||
}
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
|
||||
function oos_info_image($image, $alt, $width = '', $height = '') {
|
||||
if ( ($image) && (file_exists(OOS_ABSOLUTE_PATH . OOS_IMAGES . $image)) ) {
|
||||
$image = oos_image(OOS_SHOP_IMAGES . $image, $alt, $width, $height);
|
||||
} else {
|
||||
$image = TEXT_IMAGE_NONEXISTENT;
|
||||
}
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw a 1 pixel black line
|
||||
*/
|
||||
function oos_black_line() {
|
||||
return oos_image(OOS_IMAGES . 'pixel_black.gif', '', '100%', '1');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a function button in the selected language
|
||||
*
|
||||
* @param $title
|
||||
* @return string
|
||||
*/
|
||||
function oos_button($title = '') {
|
||||
return '<button class="btn btn-sm btn-primary mb-20"><strong>' . $title . '</strong></button>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a submit button
|
||||
*
|
||||
* @param $title
|
||||
* @return string
|
||||
*/
|
||||
function oos_submit_button($title = '') {
|
||||
return '<button class="btn btn-sm btn-primary mb-20" type="submit"><strong><i class="fa fa-check-circle"></i> ' . $title . '</strong></button>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a reset button
|
||||
*
|
||||
* @param $title
|
||||
* @return string
|
||||
*/
|
||||
function oos_reset_button($title = '') {
|
||||
return '<button class="btn btn-sm btn-primary mb-20" type="reset"><strong><i class="fa fa-plus-circle"></i> ' . $title . '</strong></button>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a back button
|
||||
*
|
||||
* @param $title
|
||||
* @return string
|
||||
*/
|
||||
function oos_back_button($title = '') {
|
||||
return '<button class="btn btn-sm btn-primary mb-20"><strong><i class="fa fa-chevron-left"></i> ' . $title . '</strong></button>';
|
||||
}
|
||||
|
||||
/**
|
||||
* javascript to dynamically update the states/provinces list when the country is changed
|
||||
*
|
||||
* @param $country
|
||||
* @param $form
|
||||
* @param $field
|
||||
* @return string
|
||||
*/
|
||||
function oos_is_zone_list($country, $form, $field) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$countries_query = "SELECT distinct zone_country_id
|
||||
FROM " . $oostable['zones'] . "
|
||||
ORDER BY zone_country_id";
|
||||
$countries_result = $dbconn->Execute($countries_query);
|
||||
$num_country = 1;
|
||||
$output_string = '';
|
||||
while ($countries = $countries_result->fields) {
|
||||
if ($num_country == 1) {
|
||||
$output_string .= ' if (' . $country . ' == "' . $countries['zone_country_id'] . '") {' . "\n";
|
||||
} else {
|
||||
$output_string .= ' } else if (' . $country . ' == "' . $countries['zone_country_id'] . '") {' . "\n";
|
||||
}
|
||||
|
||||
$states_query = "SELECT zone_name, zone_id
|
||||
FROM " . $oostable['zones'] . "
|
||||
WHERE zone_country_id = '" . $countries['zone_country_id'] . "'
|
||||
ORDER BY zone_name";
|
||||
$states_result = $dbconn->Execute($states_query);
|
||||
|
||||
$num_state = 1;
|
||||
while ($states = $states_result->fields) {
|
||||
if ($num_state == '1') $output_string .= ' ' . $form . '.' . $field . '.options[0] = new Option("' . PLEASE_SELECT . '", "");' . "\n";
|
||||
$output_string .= ' ' . $form . '.' . $field . '.options[' . $num_state . '] = new Option("' . $states['zone_name'] . '", "' . $states['zone_id'] . '");' . "\n";
|
||||
$num_state++;
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$states_result->MoveNext();
|
||||
}
|
||||
$num_country++;
|
||||
|
||||
// Close result set
|
||||
$states_result->Close();
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$countries_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$countries_result->Close();
|
||||
|
||||
$output_string .= ' } else {' . "\n" .
|
||||
' ' . $form . '.' . $field . '.options[0] = new Option("' . TYPE_BELOW . '", "");' . "\n" .
|
||||
' }' . "\n";
|
||||
|
||||
return $output_string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form
|
||||
*
|
||||
* @param $name
|
||||
* @param $action
|
||||
* @param $parameters
|
||||
* @param $method
|
||||
* @param $params
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_form($id, $name, $action, $parameters = '', $method = 'post', $parsley_validate = TRUE, $params = '') {
|
||||
$form = '<form name="' . oos_output_string($name) . '" action="';
|
||||
if (oos_is_not_null($parameters)) {
|
||||
$form .= oos_href_link_admin($action, $parameters);
|
||||
} else {
|
||||
$form .= oos_href_link_admin($action);
|
||||
}
|
||||
$form .= '" method="' . oos_output_string($method) . '"';
|
||||
|
||||
if ($parsley_validate == TRUE) {
|
||||
$form .= ' data-parsley-validate ';
|
||||
}
|
||||
|
||||
if (oos_is_not_null($params)) {
|
||||
$form .= ' ' . $params;
|
||||
}
|
||||
$form .= '>';
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form input field
|
||||
*
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param $parameters
|
||||
* @param $required
|
||||
* @param $type
|
||||
* @param $reinsert_value
|
||||
* @param $placeholder
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_input_field($name, $value = '', $parameters = '', $required = FALSE, $type = 'text', $reinsert_value = TRUE, $disabled = FALSE, $placeholder = '') {
|
||||
$field = '<input class="form-control" type="' . $type . '" name="' . $name . '"';
|
||||
|
||||
if ( ($reinsert_value == TRUE) && ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) ) {
|
||||
if (isset($_GET[$name]) && is_string($_GET[$name])) {
|
||||
$value = stripslashes($_GET[$name]);
|
||||
} elseif (isset($_POST[$name]) && is_string($_POST[$name])) {
|
||||
$value = stripslashes($_POST[$name]);
|
||||
}
|
||||
}
|
||||
$field .= ' value="' . oos_output_string($value) . '"';
|
||||
|
||||
if (oos_is_not_null($parameters)) $field .= ' ' . $parameters;
|
||||
|
||||
if ($disabled == TRUE) $field .= ' disabled="disabled"';
|
||||
|
||||
if (oos_is_not_null($placeholder)) $field .= ' placeholder="' . oos_output_string($placeholder) . '"';
|
||||
|
||||
if ($required) $field .= ' required';
|
||||
|
||||
$field .= ' />';
|
||||
|
||||
// if ($required) $field .= TEXT_FIELD_REQUIRED;
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form password field
|
||||
*
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param $required
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_password_field($name, $value = '', $parameters = 'maxlength="40"', $required = FALSE) {
|
||||
$field = oos_draw_input_field($name, $value, $parameters, $required, 'password', FALSE);
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form filefield
|
||||
*
|
||||
* @param $name
|
||||
* @param $required
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_file_field($name, $required = FALSE) {
|
||||
$field = '<div class="fileinput fileinput-new" data-provides="fileinput">' . "\n" .
|
||||
'<div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;"></div>' . "\n" .
|
||||
'<div>' . "\n" .
|
||||
|
||||
'<span class="btn btn-warning btn-file"><span class="fileinput-new"><em class="fa fa-plus-circle fa-fw"></em>' . BUTTON_SELECT_IMAGE . '</span><span class="fileinput-exists">' . BUTTON_CHANGE . '</span>' . "\n" .
|
||||
'<input type="file" size="40" name="' . $name . '"></span>' . "\n" .
|
||||
'<a href="#" class="btn btn-danger fileinput-exists" data-dismiss="fileinput"><em class="fa fa-times-circle fa-fw"></em>' . BUTTON_DELETE . '</a>' . "\n" .
|
||||
'</div>' . "\n" .
|
||||
'</div>';
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a selection field - alias function for oos_draw_checkbox_field() and oos_draw_radio_field()
|
||||
*
|
||||
* @param $name
|
||||
* @param $type
|
||||
* @param $value
|
||||
* @param $checked
|
||||
* @param $compare
|
||||
* @param $parameter
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_selection_field($name, $type, $value = '', $checked = FALSE, $compare = '', $parameter = '') {
|
||||
$selection = '<input type="' . $type . '" name="' . $name . '"';
|
||||
if ($value != '') {
|
||||
$selection .= ' value="' . $value . '"';
|
||||
}
|
||||
if ( ($checked == TRUE) || (isset($_GET[$name]) && is_string($_GET[$name]) && (($_GET[$name] == 'on') || (stripslashes($_GET[$name]) == $value))) || (isset($_POST[$name]) && is_string($_POST[$name]) && (($_POST[$name] == 'on') || (stripslashes($_POST[$name]) == $value))) || (oos_is_not_null($compare) && ($value == $compare)) ) {
|
||||
|
||||
$selection .= ' checked="checked"';
|
||||
}
|
||||
if ($parameter != '') {
|
||||
$selection .= ' ' . $parameter;
|
||||
}
|
||||
$selection .= '>';
|
||||
|
||||
return $selection;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form checkbox field
|
||||
*
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param $checked
|
||||
* @param $compare
|
||||
* @param $parameter
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_checkbox_field($name, $value = '', $checked = FALSE, $compare = '', $parameter = '') {
|
||||
return oos_draw_selection_field($name, 'checkbox', $value, $checked, $compare, $parameter);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form radio field
|
||||
*
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param $checked
|
||||
* @param $compare
|
||||
* @param $parameter
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_radio_field($name, $value = '', $checked = FALSE, $compare = '', $parameter = '') {
|
||||
return oos_draw_selection_field($name, 'radio', $value, $checked, $compare, $parameter);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form textarea field
|
||||
*
|
||||
* @param $name
|
||||
* @param $wrap
|
||||
* @param $width
|
||||
* @param $height
|
||||
* @param $text
|
||||
* @param $params
|
||||
* @param $reinsert_value
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_textarea_field($name, $wrap, $width, $height, $text = '', $params = '', $reinsert_value = TRUE) {
|
||||
|
||||
$field = '<textarea class="form-control" name="' . $name . '" wrap="' . $wrap . '" cols="' . $width . '" rows="' . $height . '"';
|
||||
|
||||
if (oos_is_not_null($params)) $field .= ' ' . $params;
|
||||
|
||||
$field .= '>';
|
||||
|
||||
if ( ($reinsert_value == TRUE) && ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) ) {
|
||||
if (isset($_GET[$name]) && is_string($_GET[$name])) {
|
||||
$text = stripslashes($_GET[$name]);
|
||||
} elseif (isset($_POST[$name]) && is_string($_POST[$name])) {
|
||||
$text = stripslashes($_POST[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
if (oos_is_not_null($text)) {
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$purifier = new HTMLPurifier($config);
|
||||
$clean_html = $purifier->purify($text);
|
||||
$field .= $clean_html;
|
||||
}
|
||||
|
||||
$field .= '</textarea>';
|
||||
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a form textarea field
|
||||
*
|
||||
* @param $name
|
||||
* @param $wrap
|
||||
* @param $width
|
||||
* @param $height
|
||||
* @param $text
|
||||
* @param $params
|
||||
* @param $reinsert_value
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_editor_field($name, $wrap, $width, $height, $text = '', $params = '', $reinsert_value = TRUE) {
|
||||
|
||||
$field = '<textarea name="' . $name . '" wrap="' . $wrap . '" cols="' . $width . '" rows="' . $height . '"';
|
||||
if (oos_is_not_null($params)) $field .= ' ' . $params;
|
||||
|
||||
$field .= '>';
|
||||
|
||||
if ( ($reinsert_value == TRUE) && ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) ) {
|
||||
|
||||
if (isset($_GET[$name]) && is_string($_GET[$name])) {
|
||||
$field .= htmlspecialchars(stripslashes($_GET[$name]));
|
||||
} elseif (isset($_POST[$name]) && is_string($_POST[$name])) {
|
||||
$field .= htmlspecialchars(stripslashes($_POST[$name]));
|
||||
}
|
||||
} elseif (oos_is_not_null($text)) {
|
||||
$field .= htmlspecialchars($text);
|
||||
}
|
||||
$field .= '</textarea>';
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a form hidden field
|
||||
*
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_hidden_field($name, $value = '') {
|
||||
$field = '<input type="hidden" name="' . $name . '"';
|
||||
|
||||
if (oos_is_not_null($value)) {
|
||||
$field .= ' value="' . oos_output_string($value) . '"';
|
||||
} elseif ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) {
|
||||
if ( (isset($_GET[$name]) && is_string($_GET[$name])) ) {
|
||||
$field .= ' value="' . oos_output_string(stripslashes($_GET[$name])) . '"';
|
||||
} elseif ( (isset($_POST[$name]) && is_string($_POST[$name])) ) {
|
||||
$field .= ' value="' . oos_output_string(stripslashes($_POST[$name])) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
$field .= '>';
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide form elements
|
||||
*/
|
||||
function oos_hide_session_id() {
|
||||
if (defined('SID') && oos_is_not_null(SID)) return oos_draw_hidden_field(oos_session_name(), oos_session_id());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a login form
|
||||
*
|
||||
* @param $name
|
||||
* @param $modul
|
||||
* @param $page
|
||||
* @param $parameters
|
||||
* @param $method
|
||||
* @param $params
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_login_form($name, $page, $parameters = '', $method = 'post', $params = '') {
|
||||
$loginform = '<form name="' . oos_output_string($name) . '" action="';
|
||||
if (oos_is_not_null($parameters)) {
|
||||
$loginform .= oos_catalog_link($page, $parameters);
|
||||
} else {
|
||||
$loginform .= oos_catalog_link($page);
|
||||
}
|
||||
$loginform .= '" method="' . oos_output_string($method) . '"';
|
||||
|
||||
if (oos_is_not_null($params)) {
|
||||
$loginform .= ' ' . $params;
|
||||
}
|
||||
$loginform .= '>';
|
||||
|
||||
return $loginform;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a form pull down menu
|
||||
*
|
||||
* @param $name
|
||||
* @param $values
|
||||
* @param $default
|
||||
* @param $params
|
||||
* @param $required
|
||||
* @return string
|
||||
*/
|
||||
function oos_draw_pull_down_menu($name, $values, $default = '', $params = '', $required = FALSE) {
|
||||
$field = '<select class="form-control" name="' . $name . '"';
|
||||
if ($params) $field .= ' ' . $params;
|
||||
$field .= '>';
|
||||
for ($i=0; $i < count($values); $i++) {
|
||||
$field .= '<option value="' . $values[$i]['id'] . '"';
|
||||
if ( ((strlen($values[$i]['id']) > 0) && ($_GET[$name] == $values[$i]['id'])) || ($default == $values[$i]['id']) ) {
|
||||
$field .= ' selected="selected"';
|
||||
}
|
||||
$field .= '>' . $values[$i]['text'] . '</option>';
|
||||
}
|
||||
$field .= '</select>';
|
||||
|
||||
if ($required) $field .= TEXT_FIELD_REQUIRED;
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a flag-icon
|
||||
*
|
||||
* @param $name
|
||||
* @param $iso_3166_1
|
||||
*/
|
||||
function oos_flag_icon($aLanguages) {
|
||||
if ( empty( $aLanguages['name'] ) ) {
|
||||
return;
|
||||
}
|
||||
if ( empty( $aLanguages['iso_3166_1'] ) ) {
|
||||
return oos_output_string($name);
|
||||
}
|
||||
return '<div title="' . oos_output_string($aLanguages['name']) . '" class="flag flag-icon flag-icon-' . oos_output_string($aLanguages['iso_3166_1']) . ' width-full"></div> ' . oos_output_string($aLanguages['name']) . ' ';
|
||||
}
|
||||
|
45
msd2/myoos/admin/includes/functions/function_products.php
Normal file
45
msd2/myoos/admin/includes/functions/function_products.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
/**
|
||||
* Return a product's catagory
|
||||
*
|
||||
* @param $products_id
|
||||
* @return string boolean
|
||||
*/
|
||||
function oos_get_product_path($products_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$products_to_categoriestable = $oostable['products_to_categories'];
|
||||
$sql = "SELECT categories_id
|
||||
FROM $products_to_categoriestable
|
||||
WHERE products_id = '" . intval($products_id) . "'";
|
||||
$cat_id_data = $dbconn->SelectLimit($sql, 1);
|
||||
if ($cat_id_data->RecordCount()) {
|
||||
return $cat_id_data->fields['categories_id'];
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
/**
|
||||
* Return options name
|
||||
*
|
||||
* @param $options_id
|
||||
* @return string
|
||||
*/
|
||||
function oos_options_name($options_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$products_optionstable = $oostable['products_options'];
|
||||
$query = "SELECT products_options_name
|
||||
FROM $products_optionstable
|
||||
WHERE products_options_id = '" . intval($options_id) . "'
|
||||
AND products_options_languages_id = '" . intval($_SESSION['language_id']) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$products_options_name = $result->fields['products_options_name'];
|
||||
|
||||
return $products_options_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return values name
|
||||
*
|
||||
* @param $values_id
|
||||
* @return string
|
||||
*/
|
||||
function oos_values_name($values_id) {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$products_options_valuestable = $oostable['products_options_values'];
|
||||
$query = "SELECT products_options_values_name
|
||||
FROM $products_options_valuestable
|
||||
WHERE products_options_values_id = '" . intval($values_id) . "'
|
||||
AND products_options_values_languages_id = '" . intval($_SESSION['language_id']) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
$products_options_values_name = $result->fields['products_options_values_name'];
|
||||
|
||||
return $products_options_values_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw a pulldown for Option Types
|
||||
*
|
||||
* @param $name
|
||||
* @param $default
|
||||
*/
|
||||
function oos_draw_option_type_pull_down_menu($name, $default = '') {
|
||||
GLOBAL $products_options_types_list;
|
||||
|
||||
$values = array();
|
||||
foreach ($products_options_types_list as $id => $text) {
|
||||
$values[] = array('id' => $id, 'text' => $text);
|
||||
}
|
||||
return oos_draw_pull_down_menu($name, $values, $default);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return options type name
|
||||
*
|
||||
* @param $opt_type
|
||||
*/
|
||||
function oos_options_type_name($opt_type) {
|
||||
GLOBAL $products_options_types_list;
|
||||
|
||||
return isset($products_options_types_list[$opt_type]) ? $products_options_types_list[$opt_type] : 'Error ' . $opt_type;
|
||||
}
|
||||
|
||||
|
64
msd2/myoos/admin/includes/functions/function_validations.php
Normal file
64
msd2/myoos/admin/includes/functions/function_validations.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: validations.php,v 1.11 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
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
/**
|
||||
* Valid e-Mail - Addresses
|
||||
*
|
||||
* This function is converted from a JavaScript written by
|
||||
* Sandeep V. Tamhankar (stamhankar@hotmail.com). The original JavaScript
|
||||
* is available at http://javascript.internet.com
|
||||
*
|
||||
* @param $sEmail
|
||||
* @return boolean
|
||||
*/
|
||||
function oos_validate_is_email($value) {
|
||||
|
||||
if (!is_string($value)) return FALSE;
|
||||
|
||||
// in case value is several addresses separated by newlines
|
||||
$_addresses = preg_split('![\n\r]+!', $value);
|
||||
|
||||
foreach($_addresses as $_address) {
|
||||
$_is_valid = !(preg_match('!@.*@|\.\.|\,|\;!', $_address) ||
|
||||
!preg_match('!^.+\@(\[?)[a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$!', $_address));
|
||||
|
||||
if(!$_is_valid)
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* test if a value is a valid URL
|
||||
*
|
||||
* @param string $sUrl the value being tested
|
||||
*/
|
||||
function oos_validate_is_url($sUrl) {
|
||||
if (strlen($sUrl) == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return preg_match('!^http(s)?://[\w-]+\.[\w-]+(\S+)?$!i', $sUrl);
|
||||
}
|
||||
|
Reference in New Issue
Block a user