Changeset 37 for trunk/Modules/Meet
- Timestamp:
- May 5, 2019, 5:17:06 PM (6 years ago)
- Location:
- trunk/Modules
- Files:
-
- 2 added
- 10 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Meet/Import/Amblar.php
r32 r37 28 28 function Import() 29 29 { 30 parent::Import();30 $Output = parent::Import(); 31 31 $Content = file_get_contents($this->URL); 32 32 … … 37 37 if ($Content == '') 38 38 { 39 echo('Main block not isolated.</br>');40 return ;39 $Output .= 'Main block not isolated.</br>'; 40 return $Output; 41 41 } 42 42 … … 72 72 $MeetItem->Database = $this->Database; 73 73 $MeetItem->Source = $this->Id; 74 $ this->ImportItem($MeetItem);74 $Output .= $this->ImportItem($MeetItem); 75 75 $this->AddedCount += $MeetItem->AddIfNotExist(); 76 76 } 77 return $Output; 77 78 } 78 79 … … 81 82 global $HeightTags, $AgeTags, $LevelTags; 82 83 84 $Output = ''; 83 85 $Content = file_get_contents($MeetItem->Link); 84 86 … … 88 90 if ($Content == '') 89 91 { 90 echo('Main block not isolated.</br>');92 $Output .= 'Main block not isolated.</br>'; 91 93 return; 92 94 } … … 106 108 if ($Tag == 'Praha') $MeetItem->Location = 'Praha'; 107 109 } 110 return $Output; 108 111 } 109 112 } -
trunk/Modules/Meet/Import/AstraPraha.php
r32 r37 5 5 function Import() 6 6 { 7 parent::Import();7 $Output = parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 9 … … 13 13 if ($Content == '') 14 14 { 15 echo('Main block not isolated.</br>');16 return ;15 $Output .= 'Main block not isolated.</br>'; 16 return $Output; 17 17 } 18 18 … … 41 41 $this->AddedCount += $MeetItem->AddIfNotExist(); 42 42 } 43 return $Output; 43 44 } 44 45 } -
trunk/Modules/Meet/Import/Csts.php
r31 r37 5 5 function Import() 6 6 { 7 parent::Import();7 $Output = parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 9 … … 13 13 if ($Content == '') 14 14 { 15 echo('Main block not isolated.</br>');16 return ;15 $Output .= 'Main block not isolated.</br>'; 16 return $Output; 17 17 } 18 18 … … 47 47 $this->AddedCount += $MeetItem->AddIfNotExist(); 48 48 } 49 return $Output; 49 50 } 50 51 } -
trunk/Modules/Meet/Import/Eso.php
r32 r37 5 5 function Import() 6 6 { 7 parent::Import();7 $Output = parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 9 … … 13 13 if ($Content == '') 14 14 { 15 echo('Main block not isolated.</br>');16 return ;15 $Output .= 'Main block not isolated.</br>'; 16 return $Output; 17 17 } 18 18 … … 51 51 $this->AddedCount += $MeetItem->AddIfNotExist(); 52 52 } 53 return $Output; 53 54 } 54 55 } -
trunk/Modules/Meet/Import/Facebook.php
r31 r37 6 6 { 7 7 return; 8 parent::Import();8 $Output = parent::Import(); 9 9 $Content = file_get_contents($this->URL); 10 10 echo($Content); … … 15 15 if ($Content == '') 16 16 { 17 echo('Main block not isolated.</br>');18 return ;17 $Output .= 'Main block not isolated.</br>'; 18 return $Output; 19 19 } 20 20 … … 50 50 $this->AddedCount += $MeetItem->AddIfNotExist(); 51 51 } 52 return $Output; 52 53 } 53 54 } -
trunk/Modules/Meet/Import/MajkluvSvet.php
r31 r37 5 5 function Import() 6 6 { 7 parent::Import();7 $Output = parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 9 … … 13 13 if ($Content == '') 14 14 { 15 echo('Main block not isolated.</br>');16 return ;15 $Output .= 'Main block not isolated.</br>'; 16 return $Output; 17 17 } 18 18 … … 29 29 $MeetItem->Name = trim(GetTextBetween($Item, "<span class='seznamka_nadpis'><b>", '</b>')); 30 30 $MeetItem->Height = trim(GetTextBetween($Item, "výška:", 'cm')); 31 $MeetItem->Age = trim(GetTextBetween($Item, "věk:", 'let'));31 $MeetItem->Age = preg_replace("/[^0-9]/", "", trim(GetTextBetween($Item, "věk:", 'let'))); 32 32 $MeetItem->Message = trim(GetTextBetween($Item, "display:block;text-align:justify;'>", '</span>')); 33 33 $MeetItem->Weight = GetWeightFromText($MeetItem->Message); … … 50 50 $this->AddedCount += $MeetItem->AddIfNotExist(); 51 51 } 52 return $Output; 52 53 } 53 54 } -
trunk/Modules/Meet/Import/SalsaDance.php
r31 r37 5 5 function Import() 6 6 { 7 parent::Import();7 $Output = parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 9 $BlockStart = '<ul class="comments">'; … … 12 12 if ($Content == '') 13 13 { 14 echo('Main block not isolated.</br>');15 return ;14 $Output .= 'Main block not isolated.</br>'; 15 return $Output; 16 16 } 17 17 … … 42 42 $this->AddedCount += $MeetItem->AddIfNotExist(); 43 43 } 44 return $Output; 44 45 } 45 46 } -
trunk/Modules/Meet/Import/Seznamka.php
r32 r37 5 5 function Import() 6 6 { 7 parent::Import();7 $Output = parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 $BlockStart = ' Tanec ...</h1 class=\'nadpis\'>';10 $BlockEnd = '< !--';9 $BlockStart = '<h1>Tanec ... : Seznamka</h1>'; 10 $BlockEnd = '<h2>Doporučujeme</h2>'; 11 11 //echo($Content); 12 12 $Content = GetTextBetween($Content, $BlockStart, $BlockEnd); 13 13 if ($Content == '') 14 14 { 15 echo('Main block not isolated.</br>');16 return ;15 $Output .= 'Main block not isolated.</br>'; 16 return $Output; 17 17 } 18 18 19 $ItemStart = '<div class=\' inztop\'>';19 $ItemStart = '<div class=\'col-xs-12\'>'; 20 20 $ItemEnd = 'Odpovědět</a></div></div></div>'; 21 21 while (strpos($Content, $ItemStart) !== false) 22 22 { 23 23 $Item = GetTextBetween($Content, $ItemStart, $ItemEnd); 24 if ($Item == '') break; 24 25 $MeetItem = new MeetItem(); 25 26 //$MeetItem->Image = trim(GetTextBetween($Item, '<div', '</div>')); 26 if (strpos($Item, "return false\" class='") !== false) 27 { 28 $MeetItem->Gender = trim(GetTextBetween($Item, "return false\" class='", "'")); 29 } else 30 { 31 $MeetItem->Gender = trim(GetTextBetween($Item, '<span class="ipoh ', '"')); 32 } 27 $MeetItem->Gender = trim(GetTextBetween($Item, "<span class=\"ipoh ", "\"")); 33 28 if ($MeetItem->Gender == 'zena') $MeetItem->Gender = Gender::Female; 34 else if ($MeetItem->Gender == 'muz') $MeetItem->Gender = Gender::Male;35 else $MeetItem->Gender = Gender::Undefined;29 else if ($MeetItem->Gender == 'muz') $MeetItem->Gender = Gender::Male; 30 else $MeetItem->Gender = Gender::Undefined; 36 31 $MeetItem->Name = trim(GetTextBetween($Item, '>', '</span>')); 37 32 $MeetItem->Name = trim(strip_tags($MeetItem->Name)); 38 $Category = trim(GetTextBetween($Item, ' rel="nofollow">', '</a></span>'));39 $MeetItem->Age = trim(GetTextBetween($Item, ' rel="nofollow">', '</a></span>'));33 $Category = trim(GetTextBetween($Item, '" >', '</a>')); 34 $MeetItem->Age = trim(GetTextBetween($Item, '" >', '</a>')); 40 35 $MeetItem->Age = trim(str_replace('let', '', $MeetItem->Age)); 41 $MeetItem->Location = trim(GetTextBetween($Item, ' rel="nofollow">', '</a></span>')); 42 $MeetItem->Time = HumanDateToTime(trim(GetTextBetween($Item, '> </a>', '</span>'))); 43 $MeetItem->Message = trim(strip_tags(GetTextBetween($Item, 'margin-top:10px;\'>', '</div>'))); 36 $MeetItem->Location = trim(GetTextBetween($Item, '" >', '</a>')); 37 $MeetItem->Time = trim(GetTextBetween($Item, 'TOP</a> ', '</span>')); 38 if ($MeetItem->Time == 'Včera') $MeetItem->Time = HumanDate(time() - 60*60*24); 39 else if ($MeetItem->Time == 'Dnes') $MeetItem->Time = HumanDate(time()); 40 $MeetItem->Time = HumanDateToTime($MeetItem->Time); 41 $MeetItem->Message = trim(strip_tags(GetTextBetween($Item, '<p>', '</p>'))); 44 42 $MeetItem->Link = GetTextBetween($Item, "<a href='", "'"); 45 43 while (substr($MeetItem->Link, 0, 3) == '../') … … 54 52 $this->AddedCount += $MeetItem->AddIfNotExist(); 55 53 } 54 return $Output; 56 55 } 57 56 } -
trunk/Modules/Meet/Import/TanecniSkola.php
r32 r37 5 5 function Import() 6 6 { 7 $Output = ''; 7 8 $HeightRange = array( 8 9 '< 120 cm' => 120, … … 26 27 ); 27 28 28 parent::Import();29 $Output = parent::Import(); 29 30 $Content = file_get_contents($this->URL); 30 31 … … 34 35 if ($Content == '') 35 36 { 36 echo('Main block not isolated.</br>');37 return ;37 $Output .= 'Main block not isolated.</br>'; 38 return $Output; 38 39 } 39 40 … … 94 95 } 95 96 } 97 return $Output; 96 98 } 97 99 } -
trunk/Modules/Meet/Import/Vavruska.php
r31 r37 5 5 function Import() 6 6 { 7 parent::Import();7 $Output = parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 9 … … 13 13 if ($Content == '') 14 14 { 15 echo('Main block not isolated.</br>');16 return ;15 $Output .= 'Main block not isolated.</br>'; 16 return $Output; 17 17 } 18 18 … … 41 41 $this->AddedCount += $MeetItem->AddIfNotExist(); 42 42 } 43 return $Output; 43 44 } 44 45 } -
trunk/Modules/Meet/Meet.php
r36 r37 1 1 <?php 2 2 3 include_once( 'Import/Seznamka.php');4 include_once( 'Import/TanecniSkola.php');5 include_once( 'Import/AstraPraha.php');6 include_once( 'Import/Vavruska.php');7 include_once( 'Import/SalsaDance.php');8 include_once( 'Import/Amblar.php');9 include_once( 'Import/MajkluvSvet.php');10 include_once( 'Import/Csts.php');11 include_once( 'Import/Facebook.php');12 include_once( 'Import/Eso.php');3 include_once(dirname(__FILE__).'/Import/Seznamka.php'); 4 include_once(dirname(__FILE__).'/Import/TanecniSkola.php'); 5 include_once(dirname(__FILE__).'/Import/AstraPraha.php'); 6 include_once(dirname(__FILE__).'/Import/Vavruska.php'); 7 include_once(dirname(__FILE__).'/Import/SalsaDance.php'); 8 include_once(dirname(__FILE__).'/Import/Amblar.php'); 9 include_once(dirname(__FILE__).'/Import/MajkluvSvet.php'); 10 include_once(dirname(__FILE__).'/Import/Csts.php'); 11 include_once(dirname(__FILE__).'/Import/Facebook.php'); 12 include_once(dirname(__FILE__).'/Import/Eso.php'); 13 13 14 14 abstract class Gender … … 37 37 $Parts = explode(' ', $DateTime); 38 38 $DateParts = explode('.', $Parts[0]); 39 if (count($Parts) > 1) $TimeParts = explode(':', $Parts[1]); 40 else $TimeParts = array(0, 0, 0); 39 if (count($Parts) > 1) { 40 $TimeParts = explode(':', $Parts[1]); 41 if (count($TimeParts) == 1) $TimeParts[1] = '0'; 42 if (count($TimeParts) == 2) $TimeParts[2] = '0'; 43 } else $TimeParts = array(0, 0, 0); 41 44 $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[0], $DateParts[2]); 42 45 return($Result); … … 277 280 function Parse($Id = null) 278 281 { 282 $Output = ''; 279 283 if (($Id != null) and is_numeric($Id)) $Where = 'Id='.$Id; 280 284 else $Where = '1'; … … 294 298 else if ($Method == 'eso') $Source = new MeetSourceEso(); 295 299 else { 296 echo('Unsupported parse method: '.$Method.'<br/>');300 $Output .= 'Unsupported parse method: '.$Method.'<br/>'; 297 301 continue; 298 302 } … … 303 307 $Source->Name = $DbRow['Name']; 304 308 $this->Items[] = $Source; 305 $ Source->Import();309 $Output .= $Source->Import(); 306 310 } 311 return $Output; 307 312 } 308 313 } … … 319 324 { 320 325 $this->AddedCount = 0; 321 echo('Parsing '.$this->Name.' ('.$this->Id.')...</br>'); 326 $Output = 'Parsing '.$this->Name.' ('.$this->Id.')...</br>'; 327 return $Output; 322 328 } 323 329 } … … 347 353 '(`Message` = "'.$this->Database->real_escape_string($this->Message).'") AND '. 348 354 '(`Email` = "'.$this->Database->real_escape_string($this->Email).'") AND '. 349 '( DATE(`Time`) = "'.$this->Database->real_escape_string(TimeToMysqlDate($this->Time)).'")');355 '(`Time` = "'.$this->Database->real_escape_string(TimeToMysqlDateTime($this->Time)).'")'); 350 356 if ($DbResult->num_rows == 0) 351 357 {
Note:
See TracChangeset
for help on using the changeset viewer.