67 lines
1.8 KiB
PHP
67 lines
1.8 KiB
PHP
<?php
|
|
/*=======================================================================
|
|
*
|
|
* import.php
|
|
*
|
|
* Autor: Marc Vollmann
|
|
*
|
|
=======================================================================*/
|
|
|
|
include_once ("../include/mcglobal.inc.php");
|
|
include_once ("../include/auth.inc.php");
|
|
if (!isset($doNotIncludeGeocode)) :
|
|
include_once ("../geo/geocode.inc.php");
|
|
endif;
|
|
|
|
|
|
// *************************
|
|
// * INITIALISIERUNGSDATEN *
|
|
// *************************
|
|
|
|
$pathSeparator = "/";
|
|
$importType = "";
|
|
$importPath = "../import/upload/";
|
|
$tempPath = "../temp/upload/";
|
|
|
|
$logFile = "../import/import.log";
|
|
|
|
$delimiter = "|";
|
|
|
|
$write2logfile = "1";
|
|
|
|
|
|
|
|
$currentTime = getDateTime("0");
|
|
|
|
|
|
include_once ("../include/inc_file.inc.php");
|
|
|
|
|
|
// Converts STR to DATE
|
|
function cStr2Date ($str, $mode = "") {
|
|
if ($mode == "1") :
|
|
// Default: "d.m.Y" => "Y-m-d"
|
|
$str = substr($str,6,4) . "-" . substr($str,3,2) . "-" . substr($str,0,2);
|
|
elseif ($mode == "2") :
|
|
// "d.m.Y H:i" => "Y-m-d H:i:s" 09.08.2011 06:30
|
|
$str = substr($str,6,4) . "-" . substr($str,3,2) . "-" . substr($str,0,2) . " " . substr($str,11,2) . ":" . substr($str,14,2) . ":" . "00";
|
|
else :
|
|
// Default: "dmY" => "Y-m-d"
|
|
$str = substr($str,4,4) . "-" . substr($str,2,2) . "-" . substr($str,0,2);
|
|
endif;
|
|
return $str;
|
|
}
|
|
|
|
// Converts STR to FLOAT (with ".") [e.g.: 000011122 => 111.22 with 2 decimals]
|
|
function cStr2Float ($str, $decimals = "2") {
|
|
if (is_numeric($str)) :
|
|
$numberPrefix = substr($str, 0, strlen($str) - $decimals);
|
|
$numberSuffix = substr($str, strlen($str) - $decimals, $decimals);
|
|
while (substr($numberPrefix,0,1) == "0" && strlen($numberPrefix) > 0) {
|
|
$numberPrefix = substr($numberPrefix,1);
|
|
}
|
|
$str = $numberPrefix . "." . $numberSuffix;
|
|
endif;
|
|
return $str;
|
|
}
|
|
?>
|