/**
  * Return Page Type
  *
  * @return array
  */
  function oosGetPageType() {

    $page_type_array = array();

    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();

    $page_type_sql = "SELECT page_type_id, page_type_name
                      FROM " . $oostable['page_type'] . "
                      WHERE page_type_languages_id = '" . intval($_SESSION['language_id']) . "'
                      ORDER BY page_type_id";
    $page_type_result = $dbconn->Execute($page_type_sql);
    while ($page_type = $page_type_result->fields) {
      $page_type_array[] = array('id' => $page_type['page_type_id'],
                                 'text' => $page_type['page_type_name']
                                    );
      // Move that ADOdb pointer!
      $page_type_result->MoveNext();
    }

    // Close result set
    $page_type_result->Close();

    return $page_type_array;
  }
 function create_plugin_instance()
 {
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     if (isset($_SESSION['customer_id'])) {
         $wo_customer_id = $_SESSION['customer_id'];
         $wo_full_name = addslashes($_SESSION['customer_first_name'] . ' ' . $_SESSION['customer_lastname']);
     } else {
         $wo_customer_id = '';
         $wo_full_name = 'Guest';
     }
     $wo_session_id = oos_session_id();
     $wo_ip_address = $_SESSION['session_ip_address'];
     $wo_last_page_url = addslashes(oos_server_get_var('REQUEST_URI'));
     $current_time = time();
     $xx_mins_ago = $current_time - 900;
     // remove entries that have expired
     $whos_onlinetable = $oostable['whos_online'];
     $dbconn->Execute("DELETE FROM {$whos_onlinetable}\n                        WHERE time_last_click < '" . oos_db_input($xx_mins_ago) . "'");
     $whos_onlinetable = $oostable['whos_online'];
     $query = "SELECT COUNT(*) AS total\n                FROM {$whos_onlinetable}\n                WHERE session_id = '" . oos_db_input($wo_session_id) . "'";
     $stored_customer = $dbconn->Execute($query);
     if ($stored_customer->fields['total'] > 0) {
         $whos_onlinetable = $oostable['whos_online'];
         $query = "UPDATE {$whos_onlinetable}" . " SET customer_id = ?, full_name = ?, ip_address = ?, time_last_click = ?, last_page_url = ?" . " WHERE session_id = ?";
         $result =& $dbconn->Execute($query, array((string) $wo_customer_id, (string) $wo_full_name, (string) $wo_ip_address, (string) $current_time, (string) $wo_last_page_url, (string) $wo_session_id));
     } else {
         $whos_onlinetable = $oostable['whos_online'];
         $dbconn->Execute("INSERT INTO " . $whos_onlinetable . "\n                     (customer_id,\n                      full_name,\n                      session_id,\n                      ip_address,\n                      time_entry,\n                      time_last_click,\n                      last_page_url) VALUES ('" . oos_db_input($wo_customer_id) . "',\n                                             '" . oos_db_input($wo_full_name) . "',\n                                             '" . oos_db_input($wo_session_id) . "',\n                                             '" . oos_db_input($wo_ip_address) . "',\n                                             '" . oos_db_input($current_time) . "',\n                                             '" . oos_db_input($current_time) . "',\n                                             '" . oos_db_input($wo_last_page_url) . "')");
     }
     return true;
 }
Пример #3
0
 /**
  * Output a form pull down menu with geo zones
  *
  * @param $parameters
  * @param $selected
  * @return string
  */
  function oosGeoZonesPullDown($parameters, $selected = '') {

    $select_string = '<select ' . $parameters . '>';

    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();

    $geo_zonestable = $oostable['geo_zones'];
    $zones_sql = "SELECT geo_zone_id, geo_zone_name
                  FROM $geo_zonestable
                  ORDER BY geo_zone_name";
    $result = $dbconn->Execute($zones_sql);
    while ($zones = $result->fields) {
      $select_string .= '<option value="' . $zones['geo_zone_id'] . '"';
      if ($selected == $zones['geo_zone_id']) $select_string .= ' selected="selected"';
      $select_string .= '>' . $zones['geo_zone_name'] . '</option>';

      // Move that ADOdb pointer!
      $result->MoveNext();
    }

    // Close result set
    $result->Close();

    $select_string .= '</select>';

    return $select_string;
  }
Пример #4
0
 /**
  * Retreive server information
  *
  * @return array
  */
  function oosGetSystemInformation() {

    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();

    $db_host = $dbconn->host;
    $db_database = $dbconn->database;
    $phpv = phpversion();


    $db_result = $dbconn->ServerInfo($oostable['countries']);

    list($system, $host, $kernel) = preg_split('/[\s,]+/', @exec('uname -a'), 5);

    return array('date' => oos_datetime_short(date('Y-m-d H:i:s')),
                 'system' => $_ENV["OS"],
                 'kernel' => $kernel,
                 'host' => $host,
                 'ip' => gethostbyname($host),
                 'uptime' => @exec('uptime'),
                 'HTTP_SERVER' => $_SERVER['SERVER_SOFTWARE'],
                 'php' => $phpv,
                 'zend' => (function_exists('zend_version') ? zend_version() : ''),
                 'db_server' => $db_host,
                 'db_ip' => gethostbyname(OOS_DB_SERVER),
                 'db_version' => OOS_DB_TYPE . $db_result['description'],
                 'db_database' => $db_database);
  }
 /**
  * This will return a list of customers with sessions. Handles
  * either the mysql or file ase
  *
  * Returns an empty array if the check sessions flag is not true
  * (empty array means same SQL statement can be used) !!!!!
  *
  *
  * @return string
  */
  function _GetCustomerSessions() {

    $cust_ses_ids = 0;

    if (RCS_CHECK_SESSIONS == '1') {
      $dbconn =& oosDBGetConn();
      $oostable =& oosDBGetTables();

      // remove entries that have expired
      $xx_mins_ago = (time() - 900);
      $whos_onlinetable = $oostable['whos_online'];
      $dbconn->Execute("DELETE FROM $whos_onlinetable WHERE time_last_click < '" . $xx_mins_ago . "'");

      $whos_onlinetable = $oostable['whos_online'];
      $sql = "SELECT customer_id FROM $whos_onlinetable";
      $whos_online_result = $dbconn->Execute($sql);
      while ($whos_online = $whos_online_result->fields) {
        $cust_ses_ids .= ', ' . $whos_online['customer_id'];

         // Move that ADOdb pointer!
        $whos_online_result->MoveNext();
      }

     # $cust_ses_ids = substr($cust_ses_ids, 2);
    }

    return $cust_ses_ids;
  }
Пример #6
0
 /**
  * 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);
    }
  }
/**
 * Auto expire products on special
 */
function oos_expire_spezials()
{

    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();

    $specialstable = $oostable['specials'];
    $query = "SELECT specials_id
              FROM $specialstable
              WHERE status = '1'
                AND now() >= expires_date
                AND expires_date > 0";
    if (USE_DB_CACHE == '1') {
        $result =& $dbconn->CacheExecute(3600, $query);
    } else {
        $result =& $dbconn->Execute($query);
    }
    if (!$result) {return;}

    if ($result->RecordCount() > 0) {
        while ($specials = $result->fields)
        {
            oos_set_specials_status($specials['specials_id'], '0');

            // Move that ADOdb pointer!
            $result->MoveNext();
        }
    }
}
Пример #8
0
 function set($sLang = '')
 {
     if (!empty($sLang) && $this->exists($sLang) === true) {
         $this->language = $this->get($sLang);
     } else {
         $this->language = $this->get(DEFAULT_LANGUAGE);
     }
     /*
             if (!isset($_COOKIE['language']) || (isset($_COOKIE['language']) && ($_COOKIE['language'] != $this->language['iso_639_2']))) {
               oos_setcookie('language', $this->language['iso_639_2'], time()+60*60*24*90);
             }
     */
     $_SESSION['language'] = $this->language['iso_639_2'];
     $_SESSION['language_id'] = $this->language['id'];
     $_SESSION['iso_639_1'] = $this->language['iso_639_1'];
     $_SESSION['languages_name'] = $this->language['name'];
     if (isset($_SESSION['customer_id'])) {
         $dbconn =& oosDBGetConn();
         $oostable =& oosDBGetTables();
         $sLanguage = oos_var_prep_for_os($this->language['iso_639_2']);
         $customerstable = $oostable['customers'];
         $query = "UPDATE {$customerstable} SET customers_language =? WHERE customers_id =?";
         $result =& $dbconn->Execute($query, array($sLanguage, (int) $_SESSION['customer_id']));
     }
 }
Пример #9
0
    public function __construct()
    {

        $this->currencies = array();

        // Get database information
        $dbconn =& oosDBGetConn();
        $oostable =& oosDBGetTables();

        $query = "SELECT code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value
                  FROM " . $oostable['currencies'];
        $result =& $dbconn->Execute($query);

        while ($currencies = $result->fields) {
            $this->currencies[$currencies['code']] = array('title' => $currencies['title'],
                                                           'symbol_left' => $currencies['symbol_left'],
                                                           'symbol_right' => $currencies['symbol_right'],
                                                           'decimal_point' => $currencies['decimal_point'],
                                                           'thousands_point' => $currencies['thousands_point'],
                                                           'decimal_places' => $currencies['decimal_places'],
                                                           'value' => $currencies['value']);
           // Move that ADOdb pointer!
           $result->MoveNext();
        }
    }
/**
 * Smarty {oos_address_label} function plugin
 *
 * Type:     function
 * Name:     oos_address_label
 * Version:  1.0
 * -------------------------------------------------------------
 */

function smarty_function_oos_address_label($params, &$smarty)
{

    $customers_id = '';
    $address_id = 1;
    $html = true;
    $boln = '';
    $eoln = '<br>';

    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
    MyOOS_CoreApi::requireOnce('lib/smarty-plugins/myoos/function.oos_address_format.php');

    foreach($params as $_key => $_val) {
      $$_key = smarty_function_escape_special_chars($_val);
    }

    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();

    $address_result = $dbconn->Execute("SELECT entry_firstname AS firstname, entry_lastname AS lastname, entry_company AS company, entry_street_address AS street_address, entry_suburb AS suburb, entry_city AS city, entry_postcode AS postcode, entry_state AS state, entry_zone_id AS zone_id, entry_country_id AS country_id FROM " . $oostable['address_book'] . " WHERE customers_id = '" . (int)$customers_id . "' AND address_book_id = '" . (int)$address_id . "'");
    $address = $address_result->fields;

    $format_id = oos_get_address_format_id($address['country_id']);


    return smarty_function_oos_address_format(array('address_format_id' => $format_id,
                                                    'address'   => $address,
                                                    'html'      => $html),
                                                  $smarty);


}
Пример #11
0
/**
 * Return the number of products in a category
 *
 * @param $category_id
 * @param $include_inactive
 * @return string
 */
function oos_count_products_in_category($category_id, $include_inactive = false)
{
    $products_count = 0;
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    $productstable = $oostable['products'];
    $products_to_categoriestable = $oostable['products_to_categories'];
    if ($include_inactive == true) {
        $products = $dbconn->Execute("SELECT COUNT(*) AS total FROM {$productstable} p, {$products_to_categoriestable} p2c WHERE p.products_id = p2c.products_id AND p2c.categories_id = '" . intval($category_id) . "'");
    } else {
        $products = $dbconn->Execute("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($category_id) . "'");
    }
    $products_count += $products->fields['total'];
    $nGroupID = intval($_SESSION['member']->group['id']);
    $categoriestable = $oostable['categories'];
    $child_categories_result = $dbconn->Execute("SELECT categories_id FROM {$categoriestable} WHERE ( access = '0' OR access = '" . intval($nGroupID) . "' ) AND parent_id = '" . intval($category_id) . "'");
    if ($child_categories_result->RecordCount()) {
        while ($child_categories = $child_categories_result->fields) {
            $products_count += oos_count_products_in_category($child_categories['categories_id'], $include_inactive);
            // Move that ADOdb pointer!
            $child_categories_result->MoveNext();
        }
    }
    return $products_count;
}
Пример #12
0
/**
 * Auto expire featured products
 */
function oos_expire_featured()
{
    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    $featuredtable = $oostable['featured'];
    $sql = "SELECT featured_id\n            FROM {$featuredtable}\n            WHERE status = '1'\n              AND now() >= expires_date\n              AND expires_date > 0";
    if (USE_DB_CACHE == '1') {
        $featured_result = $dbconn->CacheExecute(15, $sql);
    } else {
        $featured_result = $dbconn->Execute($sql);
    }
    if (!$featured_result) {
        return;
    }
    if ($featured_result->RecordCount() > 0) {
        while ($featured = $featured_result->fields) {
            oos_set_featured_status($featured['featured_id'], '0');
            // Move that ADOdb pointer!
            $featured_result->MoveNext();
        }
        // Close result set
        $featured_result->Close();
    }
}
Пример #13
0
function walk($item1)
{
    $item1 = str_replace('	', '|', $item1);
    $item1 = str_replace('"', '', $item1);
    $item1 = str_replace("\n", '', $item1);
    $item1 = str_replace("\r", '', $item1);
    //$item1 = str_replace("",'',$item1);
    $item1 = str_replace('"', '\\"', $item1);
    $item1 = str_replace("'", '\\"', $item1);
    // echo $item1."<br>";
    $item1 = chop($item1);
    echo $item1 . "<br>";
    $items = explode("|", $item1);
    $products_id = $items[0];
    $products_model = $items[1];
    $products_name = $items[2];
    $products_tax_class_id = $items[3];
    $products_status = $items[4];
    $products_price = $items[5];
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    $tax_ratestable = $oostable['tax_rates'];
    $query = "SELECT tax_rate FROM {$tax_ratestable} WHERE tax_class_id = '" . intval($products_tax_class_id) . "'";
    $tax = $dbconn->GetOne($query);
    $price = $products_price / ($tax + 100) * 100;
    $productstable = $oostable['products'];
    $dbconn->Execute("UPDATE {$productstable} set products_price = '" . $price . "', products_status = '" . intval($products_status) . "' where products_id = '" . intval($products_id) . "'");
}
 function remove()
 {
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $configurationtable = $oostable['configuration'];
     $dbconn->Execute("DELETE FROM {$configurationtable} WHERE configuration_key in ('" . implode("', '", $this->config_item()) . "')");
     return true;
 }
Пример #15
0
 function remove()
 {
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $configurationtable = $oostable['configuration'];
     $dbconn->Execute("DELETE FROM {$configurationtable} WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
 }
 function idxsql($idxname, $table, $idxflds)
 {
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $dict = NewDataDictionary($dbconn);
     $sqlarray = $dict->CreateIndexSQL($idxname, $table, $idxflds);
     $dict->ExecuteSQLArray($sqlarray);
 }
 function remove()
 {
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $blocktable = $oostable['block'];
     $dbconn->Execute("UPDATE {$blocktable} SET block_status = 0 WHERE block_file = 'wishlist'");
     $configurationtable = $oostable['configuration'];
     $dbconn->Execute("DELETE FROM {$configurationtable} WHERE configuration_key in ('" . implode("', '", $this->config_item()) . "')");
     return true;
 }
Пример #18
0
function oos_get_manufacturer_url($manufacturer_id, $lang_id = '')
{
    if (!$lang_id) {
        $lang_id = $_SESSION['language_id'];
    }
    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    $manufacturers_infotable = $oostable['manufacturers_info'];
    $manufacturer = $dbconn->Execute("SELECT manufacturers_url FROM {$manufacturers_infotable} WHERE manufacturers_id = '" . $manufacturer_id . "' AND manufacturers_languages_id = '" . intval($lang_id) . "'");
    return $manufacturer->fields['manufacturers_url'];
}
 function create_plugin_instance()
 {
     $aFilename = oos_get_filename();
     $aModules = oos_get_modules();
     if ($_GET['file'] != $aFilename['login'] && !isset($_SESSION['customer_id'])) {
         $cookie_url_array = parse_url((ENABLE_SSL == true ? OOS_HTTPS_SERVER : OOS_HTTP_SERVER) . substr(OOS_SHOP, 0, -1));
         $cookie_path = $cookie_url_array['path'];
         if (isset($_COOKIE['email_address']) && isset($_COOKIE['password'])) {
             // Get database information
             $dbconn =& oosDBGetConn();
             $oostable =& oosDBGetTables();
             $customerstable = $oostable['customers'];
             $sql = "SELECT customers_id, customers_gender, customers_firstname, customers_lastname,\n                         customers_password, customers_wishlist_link_id, customers_language,\n                         customers_vat_id_status, customers_email_address, customers_default_address_id,\n                         customers_max_order\n                  FROM {$customerstable}\n                  WHERE customers_login = '******'\n                  AND customers_email_address = '" . oos_db_input($_COOKIE['email_address']) . "'";
             $check_customer_result = $dbconn->Execute($sql);
             if ($check_customer_result->RecordCount()) {
                 $check_customer = $check_customer_result->fields;
                 if (oos_validate_password($_COOKIE['password'], $check_customer['customers_password'])) {
                     $address_booktable = $oostable['address_book'];
                     $sql = "SELECT entry_country_id, entry_zone_id\n                      FROM {$address_booktable}\n                      WHERE customers_id = '" . $check_customer['customers_id'] . "'\n                        AND address_book_id = '1'";
                     $check_country = $dbconn->GetRow($sql);
                     if ($check_customer['customers_language'] == '') {
                         $sLanguage = oos_var_prep_for_os($_SESSION['language']);
                         $customerstable = $oostable['customers'];
                         $dbconn->Execute("UPDATE {$customerstable}\n                                  SET customers_language = '" . oos_db_input($sLanguage) . "'\n                                  WHERE customers_id = '" . intval($check_customer['customers_id']) . "'");
                     }
                     $_SESSION['customer_wishlist_link_id'] = $check_customer['customers_wishlist_link_id'];
                     $_SESSION['customer_id'] = $check_customer['customers_id'];
                     $_SESSION['customer_default_address_id'] = $check_customer['customers_default_address_id'];
                     if (ACCOUNT_GENDER == '1') {
                         $_SESSION['customer_gender'] = $check_customer['customers_gender'];
                     }
                     $_SESSION['customer_first_name'] = $check_customer['customers_firstname'];
                     $_SESSION['customer_lastname'] = $check_customer['customers_lastname'];
                     $_SESSION['customer_max_order'] = $check_customer['customers_max_order'];
                     $_SESSION['customer_country_id'] = $check_country['entry_country_id'];
                     $_SESSION['customer_zone_id'] = $check_country['entry_zone_id'];
                     if (ACCOUNT_VAT_ID == '1') {
                         $_SESSION['customers_vat_id_status'] = $check_customer['customers_vat_id_status'];
                     }
                     $_SESSION['member']->restore_group();
                     setcookie('email_address', $email_address, time() + 365 * 24 * 3600, $cookie_path, '', getenv('HTTPS') == 'on' ? 1 : 0);
                     setcookie('password', $check_customer['customers_password'], time() + 365 * 24 * 3600, $cookie_path, '', getenv('HTTPS') == 'on' ? 1 : 0);
                     $customers_infotable = $oostable['customers_info'];
                     $dbconn->Execute("UPDATE {$customers_infotable}\n                                SET customers_info_date_of_last_logon = '" . date("Y-m-d H:i:s", time()) . "',\n                                    customers_info_number_of_logons = customers_info_number_of_logons+1\n                                WHERE customers_info_id = '" . intval($_SESSION['customer_id']) . "'");
                     $_SESSION['cart']->restore_contents();
                     // restore cart contents
                 }
             }
         }
     }
     return true;
 }
/**
 *
 */
function oos_get_tax_title_class_id($tax_class_title)
{
    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    $query = "SELECT tax_class_id\n              FROM " . $oostable['tax_class'] . "\n              WHERE tax_class_title = '" . $tax_class_title . "'";
    $result =& $dbconn->Execute($query);
    $tax_class_array = $result->fields;
    $tax_class_id = $tax_class_array['tax_class_id'];
    // Close result set
    $result->Close();
    return $tax_class_id;
}
/**
 * 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\n              FROM {$products_options_valuestable}\n              WHERE products_options_values_id = '" . $values_id . "'\n                AND products_options_values_languages_id = '" . intval($_SESSION['language_id']) . "'";
    $result =& $dbconn->Execute($query);
    $products_options_values_name = $result->fields['products_options_values_name'];
    // Close result set
    $result->Close();
    return $products_options_values_name;
}
Пример #22
0
function oos_set_login_status($man_info_id, $status)
{
    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable = oosDBGetTables();
    if ($status == '1') {
        return $dbconn->Execute("UPDATE " . $oostable['manual_info'] . " SET status = '1', expires_date = NULL, manual_last_modified = now(), date_status_change =now() WHERE man_info_id = '" . $man_info_id . "'");
    } elseif ($status == '0') {
        return $dbconn->Execute("UPDATE " . $oostable['manual_info'] . " SET status = '0', man_key = '', man_key2 = '', manual_last_modified = now() WHERE man_info_id = '" . $man_info_id . "'");
    } else {
        return -1;
    }
}
Пример #23
0
/**
 * 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\n            FROM {$products_to_categoriestable}\n            WHERE products_id = '" . $products_id . "'";
    $cat_id_data = $dbconn->SelectLimit($sql, 1);
    if ($cat_id_data->RecordCount()) {
        return $cat_id_data->fields['categories_id'];
    }
    return false;
}
Пример #24
0
function oos_get_languages_id($iso_639_2)
{
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    $languagestable = $oostable['languages'];
    $languages_result = $dbconn->Execute("SELECT languages_id, iso_639_2 FROM {$languagestable} WHERE iso_639_2 = '" . oos_db_input($iso_639_2) . "'");
    if (!$languages_result->RecordCount()) {
        $LangID = $_SESSION['language_id'];
    } else {
        $LangID = $languages_result->fields['languages_id'];
    }
    return $LangID;
}
Пример #25
0
function oos_get_manufacturers($aManufacturers = '')
{
    if (!is_array($aManufacturers)) {
        $aManufacturers = array();
    }
    $dbconn =& oosDBGetConn();
    $oostable = oosDBGetTables();
    $manufacturers_result = $dbconn->Execute("SELECT manufacturers_id, manufacturers_name FROM " . $oostable['manufacturers'] . " ORDER BY manufacturers_name");
    while ($manufacturers = $manufacturers_result->fields) {
        $aManufacturers[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']);
        $manufacturers_result->MoveNext();
    }
    return $aManufacturers;
}
Пример #26
0
 function currencies()
 {
     $this->currencies = array();
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $currenciestable = $oostable['currencies'];
     $sql = "SELECT code, title, symbol_left, symbol_right, decimal_point,\n                       thousands_point, decimal_places, value\n                FROM " . $currenciestable;
     if (USE_DB_CACHE == '1') {
         $this->currencies = $dbconn->CacheGetAssoc(3600 * 24, $sql);
     } else {
         $this->currencies = $dbconn->GetAssoc($sql);
     }
 }
Пример #27
0
function oos_set_featured_status($featured_id, $status)
{
    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    if ($status == '1') {
        $featuredtable = $oostable['featured'];
        return $dbconn->Execute("UPDATE {$featuredtable} SET status = '1', expires_date = NULL, date_status_change = '" . date("Y-m-d H:i:s", time()) . "' WHERE featured_id = '" . (int) $featured_id . "'");
    } elseif ($status == '0') {
        $featuredtable = $oostable['featured'];
        return $dbconn->Execute("UPDATE {$featuredtable} SET status = '0', date_status_change = '" . date("Y-m-d H:i:s", time()) . "' WHERE featured_id = '" . (int) $featured_id . "'");
    } else {
        return -1;
    }
}
 function paymentModuleInfo($pmInfo_array)
 {
     $this->payment_code = $pmInfo_array['payment_code'];
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     for ($i = 0, $n = count($pmInfo_array) - 1; $i < $n; $i++) {
         $query = "SELECT configuration_value \n                  FROM " . $oostable['configuration'] . " \n                  WHERE configuration_key = '" . $pmInfo_array[$i] . "'";
         $result =& $dbconn->Execute($query);
         $key_value = $result->fields;
         $this->keys[$pmInfo_array[$i]]['title'] = constant(strtoupper($pmInfo_array[$i] . '_TITLE'));
         $this->keys[$pmInfo_array[$i]]['value'] = $key_value['configuration_value'];
         $this->keys[$pmInfo_array[$i]]['description'] = constant(strtoupper($pmInfo_array[$i] . '_DESC'));
     }
 }
Пример #29
0
/**
 * Sets the status of a special
 *
 * @param $specials_id
 * @param $status
 * @return boolan
 */
function oos_set_specials_status($specials_id, $status)
{
    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    if ($status == '1') {
        $specialstable = $oostable['specials'];
        return $dbconn->Execute("UPDATE {$specialstable} SET status = '1', expires_date = NULL, date_status_change = NULL WHERE specials_id = '" . $specials_id . "'");
    } elseif ($status == '0') {
        $specialstable = $oostable['specials'];
        return $dbconn->Execute("UPDATE {$specialstable} SET status = '0', date_status_change = now() WHERE specials_id = '" . $specials_id . "'");
    } else {
        return -1;
    }
}
Пример #30
0
/**
 * Return Orders Status
 *
 * @param $products_units_id
 * @param $language
 * @return array
 */
function oos_get_products_units()
{
    $products_units_array = array();
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    $products_unitstable = $oostable['products_units'];
    $products_units_sql = "SELECT products_units_id, products_unit_name\n                          FROM {$products_unitstable}\n                          WHERE languages_id = '" . intval($_SESSION['language_id']) . "'\n                          ORDER BY products_units_id";
    $products_units_result = $dbconn->Execute($products_units_sql);
    while ($products_units = $products_units_result->fields) {
        $products_units_array[] = array('id' => $products_units['products_units_id'], 'text' => $products_units['products_unit_name']);
        // Move that ADOdb pointer!
        $products_units_result->MoveNext();
    }
    return $products_units_array;
}