PageSourceSearch

https://www.fquadrat-systemberatung.de/valhalla-js-3.6/converter.js

js fquadrat-systemberatung.de collected 2026-10-07 04:58:56 UTC 7,745 bytes, 230 lines download raw bytes

1//# sourceURL=converter.js
2//# COPYRIGHT Kraneburg Productions
3
4
5isTypeLikeString = function ( type ) {
6	return ( type == 'string' || type == 'char' || type == 'varchar'  || type == 'text' || type == 'html' || type == 'textarea' );
7}
8
9convertValue = function(inputValue, inputType, outputType, outputFormat, inputFormat)
10{
11	/*
12	console.log('js type: '+ typeof inputValue);
13	console.log('inputValue: ' + inputValue);
14	console.log('inputType: ' + inputType);
15	console.log('outputType: ' + outputType);	
16	
17	if (inputValue == '<p>Dies ist der Text</p>' || inputValue == '<b>Ti</b>t') {
18		alert(inputType + ' - ' + outputType + ' - ' + inputValue);
19	if (window.DEBUG == 1 ) alert(inputType + ' - ' + outputType + ' - ' + inputValue);
20	}
21	*/
22	
23	
24	if (isset(inputType) == false) return inputValue;
25	if (isset(outputType) == false) return inputValue;
26
27	
28	if (outputType == 'varchar') outputType = 'string';
29	if (outputType == 'char') outputType = 'string';
30	if (outputType == 'bigint') outputType = 'int';
31	if (outputType == 'integer') outputType = 'int';
32	if (outputType == 'textarea') outputType = 'string';
33	if (outputType == 'bool') outputType = 'boolean';
34//	if (outputType == 'boolean') outputType = 'int';
35
36	//if (outputType == 'html') outputType = 'string';
37        if (outputType == 'currency') outputType = 'decimal';
38	if (inputType == 'currency') {
39            inputType = 'decimal';
40            if ( typeof outputFormat === 'undefined' ) outputFormat = 'currency'; 
41        }
42
43	
44	if (inputType == 'varchar') inputType = 'string';
45	if (inputType == 'char') inputType = 'string';
46	if (inputType == 'bigint') inputType = 'int';
47	if (inputType == 'integer') inputType = 'int';
48	if (inputType == 'bool') inputType = 'boolean';
49//	if (inputType == 'boolean') inputType = 'int';
50	//if (inputType == 'textarea') inputType = 'string';
51
52//	if (inputType == 'html') inputType = 'string';
53
54/*	
55	if (inputValue == '<p>Dies ist der Text</p>' || inputValue == '<b>Ti</b>t') {
56		alert(inputType + ' - ' + outputType + ' - ' + inputValue);
57	if (window.DEBUG == 1 ) alert(inputType + ' - ' + outputType + ' - ' + inputValue);
58	}
59*/	
60	
61
62	if (inputType == 'string' && typeof inputValue === 'undefined') return '';	
63	if ( (outputType == 'string' || outputType == 'html') && ( typeof inputValue === 'undefined' || inputValue == null) ) return '';
64	
65	
66        if (inputType == outputType) return inputValue;
67
68
69	if (isset(outputFormat) == false) outputFormat = '';
70	if (isset(inputFormat) == false) inputFormat = '';
71		
72	 /*
73	console.log('js type: '+ typeof inputValue);
74	console.log('inputValue: ' + inputValue);
75	console.log('inputType: ' + inputType);
76	console.log('outputType: ' + outputType);	 
77	 */
78	
79
80	
81	
82	/*
83	if (outputType == 'boolean') {
84		if (inputValue == '0' || inputValue == 0 || inputValue == 'false') return false;
85		if (inputValue == 'true' || inputValue == 'True' || inputValue == '1') return true;
86		return inputValue == true;
87	}
88	
89	if (inputType == 'boolean' && outputType == 'int') {
90		if (inputValue == true) return 1;
91		else return 0;
92	}
93*/
94	if (outputType == 'boolean') {
95				
96		if (inputValue == undefined) return 0;		
97		if (inputValue == '0' || inputValue == 0 || inputValue == 'false') return 0;
98		else return 1;
99	}
100        
101        
102
103//        if (outputType == 'object' && (inputType == 'string' || inputType == 'html')) {
104//            alert('OB');
105//            return JSON.parse( atob( inputValue ) );
106//        }
107//	
108        if (inputType == 'object' && (outputType == 'string' || outputType == 'html')) {
109//            alert('OB');
110            return JSON.stringify( inputValue );
111        }
112	
113        if (outputType == "binary") { 
114            if (typeof inputValue === 'undefined' || inputValue == null || inputValue == '') return undefined;
115            return ('00000000000000000000000000000000' + inputValue.toString()).substr(-32,32);      
116        }
117	if (inputType == 'string' || inputType == 'html')
118	{
119                if (outputType == 'date' && inputFormat == 'plain')  inputFormat = 'YYYY-MM-DD';
120                if (outputType == 'datetime' && inputFormat == 'plain')  inputFormat = 'YYYY-MM-DD HH:mm:ss';
121                
122                
123		if (outputType == 'datetime' || outputType == 'date')
124		{
125			//console.log('toDATE');
126			//console.log(inputFormat);
127			//console.log(inputValue);
128			// Split timestamp into [ Y, M, D, h, m, s ]
129			//if (isset(inputValue) == false || inputValue == '') 
130			//alert('undefined');
131			
132                        if (isset(inputValue) == false || inputValue == '') return undefined;
133                        
134                        if (inputValue == 'CURRENT_TIMESTAMP' || inputValue == 'NOW') return new Date();
135                        
136			if (isset(inputFormat))
137			{
138                           return moment(inputValue, inputFormat).toDate();                          
139			}
140			
141			//console.log(new Date(inputValue));
142			//console.log(inputValue);
143			
144			return new Date(inputValue);
145			//var t = inputValue.split(/[- :]/);
146			//console.log(new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]).toISOString());
147			//return new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);
148		}
149		if (outputType == 'int') {
150                    var returnValue =  parseInt(inputValue);
151                    if (isNaN( returnValue )) return;
152                        else return returnValue;
153                };
154		if (outputType == 'decimal') {
155                    var returnValue =  parseFloat(inputValue);
156                    if (isNaN( returnValue )) return;
157                        else return returnValue;
158                };
159
160		if (outputType == 'string') {
161			// REMOVE HTML-TAGS
162			return  inputValue.replace(/(<([^>]+)>)/ig,"");
163		}
164		
165		if (outputType == "html")
166		{ // includes inputType = textarea
167//			alert(nl2br(htmlEntities(inputValue)));
168			return nl2br(htmlEntities(inputValue));
169		}
170			
171		return inputValue;
172	}
173        
174
175	
176	if (outputType == 'string' || outputType == 'html')
177	{ 
178		
179//                if ( inputValue == null ) alert('xx');
180	        if ( inputValue == null ) return '';
181		
182		if (isset(inputValue) == false) return '';
183		
184		if (inputType == 'time')
185		{
186			return  inputValue.split(':', 2).join(':');
187		}
188
189        	if (inputType == 'date')
190		{
191                        if (outputFormat == 'plain') outputFormat = 'YYYY-MM-DD';
192			if (outputFormat == '') outputFormat = 'L';			
193                        return moment(inputValue).format(outputFormat);					
194		}
195                
196		if (inputType == 'datetime')
197		{
198			//console.log('fromDATE');
199			//return inputValue.toISOString().slice(0, 19).replace('T', ' ');
200			//if (outputFormat == '') return moment(inputValue).formatPHP('Y-m-d H:i:s');
201			//if (isset(inputValue) == false) return '';                        
202			if (outputFormat == 'plain') outputFormat = 'YYYY-MM-DD HH:mm:ss';
203			if (outputFormat == '') outputFormat = 'L LT';			
204                        return moment(inputValue).format(outputFormat);					
205		}
206
207		if (inputType == 'int' || inputType == 'decimal')
208		{
209//                    if (outputFormat != '') alert(outputFormat);
210			if (outputFormat == 'currency') outputFormat = '0,0.00';
211			//console.log('FORMAT: ');
212			//console.log(outputFormat); 
213			if (outputFormat == '') return inputValue.toString();
214			if ( isNaN( inputValue ) ) return '';
215			
216			return numeral(inputValue).format(outputFormat);
217			//return inputValue.toFixed(3);
218		}
219		
220		
221		if (outputType == "html")
222		{ // includes inputType = textarea
223			return nl2br(htmlEntities(inputValue));
224		}
225	}	
226	
227	
228	return inputValue;
229	
230}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.