1 2/****************************************************************************** 3 * 4 * PROJECT: Flynax Classifieds Software 5 * VERSION: 4.9.3 6 * LICENSE: FL266ELOCM7Z - https://www.flynax.com/flynax-software-eula.html 7 * PRODUCT: Real Estate Classifieds 8 * DOMAIN: nachmieter.ch 9 * FILE: INDEX.PHP 10 * 11 * The software is a commercial product delivered under single, non-exclusive, 12 * non-transferable license for one domain or IP address. Therefore distribution, 13 * sale or transfer of the file in whole or in part without permission of Flynax 14 * respective owners is considered to be illegal and breach of Flynax License End 15 * User Agreement. 16 * 17 * You are not allowed to remove this information from the file without permission 18 * of Flynax respective owners. 19 * 20 * Flynax Classifieds Software 2025 | All copyrights reserved. 21 * 22 * https://www.flynax.com 23 ******************************************************************************/ 24 25var flUtilClass = function(){ 26 /** 27 * @since 4.9.1 28 * 29 * @type {flUtilClass} 30 */ 31 let self = this; 32 33 /** 34 * Last ajax request 35 * 36 * @type object 37 */ 38 this.ajaxRequest = null; 39 40 /** 41 * Last ajax request key 42 *
43 * @type String 44 */ 45 this.ajaxKey = null; 46 47 /** 48 * Media points data 49 * 50 * @type Array 51 */ 52 this.media_points = { 53 all_tablet_mobile: 'screen and (max-width: 991px)' 54 }; 55 56 /** 57 * Delay of slow internet 58 * @since 4.7.0 59 * @type {Number} 60 */ 61 this.loadingDelay = 300; 62 63 /** 64 * Array of function which can modify ajax data before ajax call 65 * 66 * @since 4.8.2 67 * @type Array 68 */ 69 this.modifyDataFunctions = []; 70 71 /** 72 * Initial class method 73 * 74 */ 75 this.init = function() { 76 $.ajaxSetup({ 77 crossDomain: true, 78 xhrFields: { 79 withCredentials: true 80 } 81 }); 82 83 self.markLoadedScripts(); 84 self.markLoadedStyles(); 85 }; 86 87 /** 88 * Mark all document loaded scripts to avoid it's repeat 89 * uploading by loadScript method 90 */ 91 this.markLoadedScripts = function() { 92 var scripts = document.getElementsByTagName('script'); 93 94 for (var i in scripts) { 95 if (!scripts[i].src || typeof scripts[i].onload == 'function') { 96 continue; 97 } 98 99 scripts[i].onload = (function(i){ 100 scripts[i].loaded = true; 101 })(i); 102 } 103 }; 104 105 /** 106 * Mark all document loaded styles to avoid it's repeat uploading by loadStyle method 107 * 108 * @since 4.9.0 109 */ 110 this.markLoadedStyles = function() { 111 var styles = document.querySelectorAll('link[rel="stylesheet"]'); 112 113 for (var i in styles) { 114 if (!styles[i].href || typeof styles[i].onload === 'function') { 115 continue; 116 } 117 118 styles[i].onload = (function(i){ 119 styles[i].loaded = true; 120 })(i); 121 } 122 }; 123 124 /** 125 * Do ajax call 126 * 127 * @param array - ajax request data 128 * @param function - callback function 129 * @param boolean - is get request 130 */ 131 this.ajax = function(data, callback, get) { 132 // Abort the previous query if it's still in progress 133 if (self.ajaxRequest 134 && data.ajaxKey 135 && data.ajaxKey == this.ajaxKey 136 ) { 137 self.ajaxRequest.abort(); 138 } 139 140 // Apply data modifiers 141 if (self.modifyDataFunctions.length) { 142 for (var i in self.modifyDataFunctions) { 143 if (typeof self.modifyDataFunctions[i] == 'function') { 144 self.modifyDataFunctions[i].call(this, data, callback, get) 145 } 146 } 147 } 148 149 if (!data.mode) { 150 console.log('flynax.ajax - no "mode" index in the data parameter found, "mode" is required'); 151 return; 152 } 153 154 if (typeof callback != 'function') { 155 console.log('flynax.ajax - the second parameter should be callback function'); 156 return; 157 } 158 159 /** 160 * Get content in current/selected language 161 * @since 4.8.0 162 */ 163 data.lang = data.lang ? data.lang : rlLang; 164 165 // request options 166 var options = { 167 type: get ? 'GET' : 'POST', 168 url: rlConfig['ajax_url'], 169 data: data, 170 dataType: 'json', 171 crossDomain: true, 172 xhrFields: { 173 withCredentials: true 174 } 175 } 176 177 // save move 178 self.ajaxKey = data.ajaxKey; 179 180 // process request 181 self.ajaxRequest = $.ajax(options) 182 .success(function(response, status){ 183 callback(response, status); 184 }) 185 .fail(function(object, status){ 186 if (status == 'abort') { 187 return; 188 } 189 190 callback(false, status); 191 }); 192 }; 193 194 /** 195 * Load script(s) once 196 * 197 * @param mixed - script src as string or strings array 198 * @param function - callback function 199 */ 200 this.loadScript = function(src, callback){ 201 var loaderClass = function(){ 202 let loaderClass = this; 203 204 this.completed = false;
205 this.urls = []; 206 this.done = []; 207 this.loaded = []; 208 this.callback = function(){}; 209 210 this.init = function(src, callback){ 211 if (!src) { 212 console.log('loadScript Error: no scrip to load specified'); 213 return; 214 } 215 216 this.urls = typeof src == 'string' ? [src] : src; 217 this.callback = typeof callback == 'function' 218 ? callback 219 : this.callback; 220 221 for (let i in this.urls) { 222 this.urls[i] = self.addRevisionToFileURL(this.urls[i]); 223 } 224 225 // Fix script url protocol 226 this.fixProtocol(); 227 228 // Check for already loaded script 229 this.checkLoaded(); 230 231 // Loads scripts 232 for (var i in this.urls) { 233 this.load(this.urls[i], i); 234 } 235 236 // Call callback 237 this.call(); 238 } 239 240 this.checkLoaded = function(){ 241 var loaded_scripts = document.getElementsByTagName('script'); 242 243 for (var i in loaded_scripts) { 244 if (typeof loaded_scripts[i] != 'object') { 245 continue; 246 } 247 248 var index = this.urls.indexOf(loaded_scripts[i]['src']); 249 250 if (index < 0) { 251 continue; 252 } 253 254 // Process loaded script 255 this.processLoaded(loaded_scripts[i], index); 256 } 257 } 258 259 this.processLoaded = function(script, index){ 260 if (script.loaded) { 261 this.loaded[index] = true; 262 this.done[index] = true; 263 } else { 264 var event = script.onload; 265 266 script.onload = function(){ 267 loaderClass.done[index] = true; 268 269 // Call original event 270 if (typeof event == 'function') { 271 event.call(); 272 } 273 274 // Call new event 275 loaderClass.call(); 276 }; 277 this.loaded[index] = true; 278 } 279 } 280 281 // Check state 282 this.isStateReady = function(readyState){ 283 return (!readyState || $.inArray(readyState, ['loaded', 'complete', 'uninitialized']) >= 0); 284 } 285 286 // Load script 287 this.load = function(url, i) { 288 // Skip loaded 289 if (this.loaded[i]) { 290 return; 291 } 292 293 // Create script 294 var script = document.createElement('script'); 295 script.src = url; 296 297 // Bind to load events 298 script.onload = function(){ 299 if (loaderClass.isStateReady(script.readyState)) { 300 loaderClass.done[i] = true; 301 302 // Run the callback 303 loaderClass.call(); 304 305 // Mark as loaded 306 script.loaded = true; 307 } 308 309 // Handle memory leak in IE 310 //script.onload = script.onreadystatechange = script.onerror = null; TODO TEST 311 }; 312 313 // On error callback 314 script.onerror = function(){ 315 loaderClass.callback.call(new Error('Unable to load the script: ' + url)); 316 }; 317 318 // Append script into the head 319 var head = document.getElementsByTagName('head')[0]; 320 head.appendChild(script); 321 322 // Mark as loaded 323 this.loaded[i] = true; 324 } 325 326 this.isReady = function(){ 327 var count = 0; 328 for (var i in this.done) { 329 if (this.done[i] === true) { 330 count++; 331 } 332 } 333 334 return count == this.urls.length; 335 } 336 337 this.call = function() { 338 if (this.isReady() && !this.completed) { 339 this.callback.call(this); 340 this.completed = true; 341 } 342 } 343 344 this.fixProtocol = function() { 345 if (!location.protocol) { 346 return; 347 } 348 349 for (var i in this.urls) { 350 if (0 === this.urls[i].indexOf('//')) { 351 this.urls[i] = location.protocol + this.urls[i]; 352 } 353 } 354 } 355 } 356 357 var loader = new loaderClass(); 358 loader.init(src, callback); 359 } 360 361 this.loadStyle = function(src) { 362 var loaderClass = function () { 363 let loaderClass = this; 364 365 this.completed = false;
366 this.urls = []; 367 this.done = []; 368 this.loaded = []; 369 370 this.init = function(src){ 371 if (!src) { 372 console.log('loadStyle Error: no style file to load specified'); 373 return; 374 } 375 376 this.urls = typeof src == 'string' ? [src] : src; 377 378 for (let i in this.urls) { 379 this.urls[i] = self.addRevisionToFileURL(this.urls[i]); 380 } 381 382 // Fix script url protocol 383 this.fixProtocol(); 384 385 // Check for already loaded style 386 this.checkLoaded(); 387 388 // Loads styles 389 for (var i in this.urls) { 390 this.load(this.urls[i], i); 391 } 392 } 393 394 this.checkLoaded = function() { 395 var styles = document.querySelectorAll('link[rel="stylesheet"]'); 396 397 for (var i in styles) { 398 if (typeof styles[i] !== 'object' || !styles[i].href || styles[i].loaded === true) { 399 continue; 400 } 401 402 var index = this.urls.indexOf(styles[i]['href']); 403 404 if (index < 0) { 405 continue; 406 } 407 408 // Process load the style 409 this.processLoaded(styles[i], index); 410 } 411 } 412 413 this.processLoaded = function(style, index) { 414 if (style.loaded) { 415 this.loaded[index] = true; 416 this.done[index] = true; 417 } else { 418 var event = style.onload; 419 420 style.onload = function() { 421 loaderClass.done[index] = true; 422 423 // Call original event 424 if (typeof event == 'function') { 425 event.call(); 426 } 427 }; 428 this.loaded[index] = true; 429 } 430 } 431 432 // Check state 433 this.isStateReady = function(readyState){ 434 return (!readyState || $.inArray(readyState, ['loaded', 'complete', 'uninitialized']) >= 0); 435 } 436 437 // Load style 438 this.load = function(url, i) { 439 // Skip loaded 440 if (this.loaded[i]) { 441 return; 442 } 443 444 // Create style 445 var $style = $('<link>').attr({'rel': 'stylesheet', 'type': 'text/css', 'href': url}); 446 447 // Bind to load events 448 $style.onload = function() { 449 if (loaderClass.isStateReady($style.readyState)) { 450 loaderClass.done[i] = true; 451 452 // Mark as loaded 453 $style.loaded = true; 454 } 455 }; 456 457 // On error callback 458 $style.onerror = function(){ 459 loaderClass.callback.call(new Error('Unable to load the script: ' + url)); 460 }; 461 462 // Append style into the head 463 $style.appendTo('head'); 464 465 // Mark as loaded 466 this.loaded[i] = true; 467 } 468 469 this.isReady = function() { 470 var count = 0; 471 for (var i in this.done) { 472 if (this.done[i] === true) { 473 count++; 474 } 475 } 476 477 return count === this.urls.length; 478 } 479 480 this.fixProtocol = function() { 481 if (!location.protocol) { 482 return; 483 } 484 485 for (var i in this.urls) { 486 if (0 === this.urls[i].indexOf('//')) { 487 this.urls[i] = location.protocol + this.urls[i]; 488 } 489 } 490 } 491 } 492 493 if (rlLangDir === 'rtl' 494 && src.indexOf(rlConfig.domain.replace(/^\./, '')) >= 0 495 && src.indexOf('-rtl') < 0 496 && src.indexOf('components/') > 0 497 ) { 498 src = src.replace(/(.*)\.css/, '$1-rtl.css'); 499 } 500 501 new loaderClass().init(src); 502 } 503 504 /** 505 * Checks if a string is an email 506 * 507 * @since 4.9.0 508 * 509 * @param email {string} 510 * @returns {boolean} 511 */ 512 this.isEmail = function (email) { 513 return /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(email).toLowerCase()); 514 } 515 516 /** 517 * @since 4.9.1 518 * @param url 519 * @return url 520 */ 521 this.addRevisionToFileURL = function (url) { 522 if (rlConfig.host && url.indexOf(rlConfig.host) >= 0) { 523 url += '?rev=' + rlConfig.static_files_revision; 524 } 525 526 return url; 527 } 528} 529 530var flUtil = new flUtilClass();
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.