[TEP-COMMIT] CVS: catalog/catalog/install/includes/functions general.php,1.4,1.5 database.php,1.3,NONE html_output.php,1.2,NONE

cvs-OfajU3CKLf1/[email protected] Mon, 16 Feb 2004 08:10:07 +0100
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
Update of /pack/cvsroots/oscommerce/catalog/catalog/install/includes/functions
In directory sunsite.dk:/tmp/cvs-serv4284/includes/functions

Modified Files:
	general.php 
Removed Files:
	database.php html_output.php 
Log Message:
make the installation and upgrade procedure multilingual

separate the sample database data from the database structure - installing
the sample data is now an option during the installation procedure


Index: general.php
===================================================================
RCS file: /pack/cvsroots/oscommerce/catalog/catalog/install/includes/functions/general.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- general.php	2003/07/09 01:11:05	1.4
+++ general.php	2004/02/16 06:59:35	1.5
@@ -5,46 +5,50 @@
   osCommerce, Open Source E-Commerce Solutions
   http://www.oscommerce.com
 
-  Copyright (c) 2003 osCommerce
+  Copyright (c) 2004 osCommerce
 
   Released under the GNU General Public License
 */
 
-  function osc_in_array($value, $array) {
-    if (!$array) $array = array();
+  function tep_get_languages() {
+    global $osC_Database;
 
-    if (function_exists('in_array')) {
-      if (is_array($value)) {
-        for ($i=0; $i<sizeof($value); $i++) {
-          if (in_array($value[$i], $array)) return true;
+    $Qlanguages = $osC_Database->query('select languages_id, name, code, image, directory from languages order by sort_order');
+    while ($Qlanguages->next()) {
+      $languages_array[] = array('id' => $Qlanguages->valueInt('languages_id'),
+                                 'name' => $Qlanguages->value('name'),
+                                 'code' => $Qlanguages->value('code'),
+                                 'image' => $Qlanguages->value('image'),
+                                 'directory' => $Qlanguages->value('directory'));
+    }
+
+    $Qlanguages->freeResult();
+
+    return $languages_array;
+  }
+
+  function tep_currency_format($number, $calculate_currency_value = true, $currency_code = 'USD', $value = '') {
+    $Qcurrencies = $osC_Database->query('select symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from currencies where code = :code');
+    $Qcurrencies->bindValue(':code', $currency_code);
+    $Qcurrencies->execute();
+
+    if ($calculate_currency_value == true) {
+      if (strlen($currency_code) == 3) {
+        if ($value) {
+          $rate = $value;
+        } else {
+          $rate = $Qcurrencies->value('value');
         }
-        return false;
       } else {
-        return in_array($value, $array);
+        $rate = 1;
       }
+      $number2currency = $Qcurrencies->value('symbol_left') . number_format(($number * $rate), $Qcurrencies->value('decimal_places'), $Qcurrencies->value('decimal_point'), $Qcurrencies->value('thousands_point')) . $Qcurrencies->value('symbol_right');
     } else {
-      reset($array);
-      while (list(,$key_value) = each($array)) {
-        if (is_array($value)) {
-          for ($i=0; $i<sizeof($value); $i++) {
-            if ($key_value == $value[$i]) return true;
-          }
-          return false;
-        } else {
-          if ($key_value == $value) return true;
-        }
-      }
+      $number2currency = $Qcurrencies->value('symbol_left') . number_format($number, $Qcurrencies->value('decimal_places'), $Qcurrencies->value('decimal_point'), $Qcurrencies->value('thousands_point')) . $Qcurrencies->value('symbol_right');
     }
 
-    return false;
-  }
+    $Qcurrencies->freeResult();
 
-////
-// Sets timeout for the current script.
-// Cant be used in safe mode.
-  function osc_set_time_limit($limit) {
-    if (!get_cfg_var('safe_mode')) {
-      set_time_limit($limit);
-    }
+    return $number2currency;
   }
 ?>

--- database.php DELETED ---

--- html_output.php DELETED ---



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click