Changeset 65 for trunk/Modules/Meet/Meet.php
- Timestamp:
- Apr 19, 2022, 10:25:41 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Meet/Meet.php
r64 r65 13 13 include_once(dirname(__FILE__).'/Import/Ella.php'); 14 14 include_once(dirname(__FILE__).'/Import/MgDance.php'); 15 include_once(dirname(__FILE__).'/Import/LaTropical.php'); 15 16 16 17 abstract class Gender … … 38 39 $DateTime = str_replace('. ', '.', $DateTime); 39 40 $Parts = explode(' ', $DateTime); 40 $DateParts = explode('.', $Parts[0]); 41 if (count($Parts) > 1) { 41 if (count($Parts) > 0) 42 { 43 $DateParts = explode('.', $Parts[0]); 44 } 45 if (count($Parts) > 1) 46 { 42 47 $TimeParts = explode(':', $Parts[1]); 43 48 if (count($TimeParts) == 1) $TimeParts[1] = '0'; … … 260 265 } 261 266 return $Result; 267 } 268 269 function GetNameFromText(string $Text): string 270 { 271 return ''; 262 272 } 263 273 … … 334 344 class MeetSources 335 345 { 336 public $Database;346 public Database $Database; 337 347 338 348 function Parse(?int $Id = null): string 339 349 { 340 350 $Output = ''; 341 $Where = ' (Enabled=1)';351 $Where = '1'; 342 352 if (($Id != null) and is_numeric($Id)) $Where .= ' AND (Id='.$Id.')'; 343 353 $DbResult = $this->Database->select('MeetSource', '*', $Where); 344 354 while ($DbRow = $DbResult->fetch_assoc()) 345 355 { 346 $Method = $DbRow['Method']; 347 if ($Method == 'hes') $Source = new MeetSourceTanecniSkola(); 348 else if ($Method == 'vavruska') $Source = new MeetSourceVavruska(); 349 else if ($Method == 'salsadance') $Source = new MeetSourceSalsaDance(); 350 else if ($Method == 'astra') $Source = new MeetSourceAstraPraha(); 351 else if ($Method == 'seznamka') $Source = new MeetSourceSeznamka(); 352 else if ($Method == 'amblar') $Source = new MeetSourceAmblar(); 353 else if ($Method == 'majkluvsvet') $Source = new MeetSourceMajkluvSvet(); 354 else if ($Method == 'csts') $Source = new MeetSourceCsts(); 355 else if ($Method == 'facebook') $Source = new MeetSourceFacebook(); 356 else if ($Method == 'eso') $Source = new MeetSourceEso(); 357 else if ($Method == 'ella') $Source = new MeetSourceElla(); 358 else if ($Method == 'mgdance') $Source = new MeetSourceMgDance(); 359 else { 360 $Output .= 'Unsupported parse method: '.$Method.'<br/>'; 361 continue; 362 } 363 $Source->Database = $this->Database; 364 $Source->Id = $DbRow['Id']; 365 $Source->URL = $DbRow['URL']; 366 $Source->Method = $Method; 367 $Source->Name = $DbRow['Name']; 368 $this->Items[] = $Source; 369 $Output .= $Source->DoImport(); 356 if ($DbRow['Enabled'] == 1) 357 { 358 $Method = $DbRow['Method']; 359 if ($Method == 'hes') $Source = new MeetSourceTanecniSkola(); 360 else if ($Method == 'vavruska') $Source = new MeetSourceVavruska(); 361 else if ($Method == 'salsadance') $Source = new MeetSourceSalsaDance(); 362 else if ($Method == 'astra') $Source = new MeetSourceAstraPraha(); 363 else if ($Method == 'seznamka') $Source = new MeetSourceSeznamka(); 364 else if ($Method == 'amblar') $Source = new MeetSourceAmblar(); 365 else if ($Method == 'majkluvsvet') $Source = new MeetSourceMajkluvSvet(); 366 else if ($Method == 'csts') $Source = new MeetSourceCsts(); 367 else if ($Method == 'facebook') $Source = new MeetSourceFacebook(); 368 else if ($Method == 'eso') $Source = new MeetSourceEso(); 369 else if ($Method == 'ella') $Source = new MeetSourceElla(); 370 else if ($Method == 'mgdance') $Source = new MeetSourceMgDance(); 371 else if ($Method == 'latropical') $Source = new MeetSourceLaTropical(); 372 else { 373 $Output .= 'Unsupported parse method: '.$Method.'<br/>'; 374 continue; 375 } 376 $Source->Database = $this->Database; 377 $Source->Id = $DbRow['Id']; 378 $Source->URL = $DbRow['URL']; 379 $Source->Method = $Method; 380 $Source->Name = $DbRow['Name']; 381 $this->Items[] = $Source; 382 $Output .= $Source->DoImport(); 383 } else $Output .= 'Parser '.$DbRow['Name'].' (#'.$DbRow['Id'].') disabled.<br/>'."\n"; 370 384 } 371 385 return $Output; … … 375 389 class MeetSource 376 390 { 377 public $Name;378 public $URL;379 public $Method;380 public $Id;381 public $Database;382 public $MeetItems;383 public $AddCompareTime;384 public $AddCompareRemoteId;385 public $AddTimeInterval;386 public $AddedCount;391 public string $Name; 392 public string $URL; 393 public string $Method; 394 public string $Id; 395 public Database $Database; 396 public array $MeetItems; 397 public bool $AddCompareTime; 398 public bool $AddCompareRemoteId; 399 public int $AddTimeInterval; 400 public int $AddedCount; 387 401 388 402 function __construct() … … 420 434 class MeetItem 421 435 { 422 var$Database;423 var$Name = '';424 var$Message = '';425 var $Time = '';426 var$Gender = Gender::Undefined;427 var$Phone = '';428 var$Email = '';429 var$Age = '';430 var$Height = '';431 var$Source = 0;432 var$Weight = '';433 var$Location = '';434 var$Image = '';435 var$Link = '';436 var$Title = '';437 var$Level = '';438 var$RemoteId = '';436 public Database $Database; 437 public string $Name = ''; 438 public string $Message = ''; 439 public ?int $Time = 0; 440 public int $Gender = Gender::Undefined; 441 public string $Phone = ''; 442 public string $Email = ''; 443 public string $Age = ''; 444 public string $Height = ''; 445 public int $Source = 0; 446 public string $Weight = ''; 447 public string $Location = ''; 448 public string $Image = ''; 449 public string $Link = ''; 450 public string $Title = ''; 451 public string $Level = ''; 452 public string $RemoteId = ''; 439 453 440 454 function AddIfNotExist(int $TimeInterval = 0, bool $CompareTime = true, bool $CompareRemoteId = false): int … … 485 499 if (strpos($this->Message, $Keyword) !== false) 486 500 { 487 return false;501 return true; 488 502 } 489 503 } 490 return true;491 } 492 } 504 return false; 505 } 506 }
Note:
See TracChangeset
for help on using the changeset viewer.