Changeset 44


Ignore:
Timestamp:
Nov 9, 2019, 11:14:27 PM (5 years ago)
Author:
chronos
Message:
  • Added: Taneční škola Ella as meet source.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Meet/Meet.php

    r43 r44  
    1111include_once(dirname(__FILE__).'/Import/Facebook.php');
    1212include_once(dirname(__FILE__).'/Import/Eso.php');
     13include_once(dirname(__FILE__).'/Import/Ella.php');
    1314
    1415abstract class Gender
     
    287288}
    288289
     290function GetGenderFromName($Text)
     291{
     292  $Gender = Gender::Male;
     293  $Ending = substr($Text, -2);
     294  if (($Ending == 'na') or ($Ending == 'ta') or ($Ending == 'va') or
     295    ($Ending == 'ka') or ($Ending == 'ga') or ($Ending == 'ie') or
     296    ($Ending == 'la') or ($Ending == 'za') or ($Ending == 'še') or
     297    ($Ending == 'ra') or ($Ending == 'da') or ($Ending == 'sa') or
     298    ($Ending == 'ce') or ($Ending == 'id') or ($Ending == 'ša') or
     299    ($Ending == 'ma') or ($Ending == 'ja') or ($Ending == 'ia') or
     300    ($Ending == 'ha') or ($Ending == 'is'))
     301    return $Gender = Gender::Female;
     302  return $Gender;
     303}
     304
    289305class MeetSources
    290306{
     
    310326      else if ($Method == 'facebook') $Source = new MeetSourceFacebook();
    311327      else if ($Method == 'eso') $Source = new MeetSourceEso();
     328      else if ($Method == 'ella') $Source = new MeetSourceElla();
    312329      else {
    313330        $Output .= 'Unsupported parse method: '.$Method.'<br/>';
     
    360377  var $Title = '';
    361378  var $Level = '';
    362 
    363   function AddIfNotExist($TimeInterval = 0)
    364   {
    365     $DbResult = $this->Database->select('MeetItem', '*',
    366       '(`Message` = "'.$this->Database->real_escape_string($this->Message).'") AND '.
     379  var $RemoteId = '';
     380
     381  function AddIfNotExist($TimeInterval = 0, $CompareTime = true, $CompareRemoteId = false)
     382  {
     383    $Where = '(`Message` = "'.$this->Database->real_escape_string($this->Message).'") AND '.
    367384      '(`Email` = "'.$this->Database->real_escape_string($this->Email).'") AND '.
    368       '(`Time` >= "'.$this->Database->real_escape_string(TimeToMysqlDateTime($this->Time - $TimeInterval)).'") AND '.
    369       '(`Time` <= "'.$this->Database->real_escape_string(TimeToMysqlDateTime($this->Time + $TimeInterval)).'") AND '.
    370       '(`Source` = '.$this->Source.')');
     385      '(`Source` = '.$this->Source.')';
     386    if ($CompareTime)
     387      $Where .= ' AND (`Time` >= "'.$this->Database->real_escape_string(TimeToMysqlDateTime($this->Time - $TimeInterval)).'") AND '.
     388      '(`Time` <= "'.$this->Database->real_escape_string(TimeToMysqlDateTime($this->Time + $TimeInterval)).'")';
     389    if ($CompareRemoteId)
     390      $Where .= ' AND (`RemoteId` = "'.$this->Database->real_escape_string($this->RemoteId).'")';
     391    $DbResult = $this->Database->select('MeetItem', '*', $Where);
    371392    if ($DbResult->num_rows == 0)
    372393    {
     
    390411        'Source' => $this->Source,
    391412        'Link' => $this->Link,
     413        'RemoteId' => $this->RemoteId,
    392414        'TimeImport' => 'NOW()',
    393415      ));
  • trunk/SQL/Update.php

    r40 r44  
    4949ALTER TABLE `DanceFigure`
    5050  ADD CONSTRAINT `DanceFigure_ibfk_1` FOREIGN KEY (`Dance`) REFERENCES `Dance` (`Id`);
     51
     52ALTER TABLE `MeetItem`
     53  ADD COLUMN `RemoteId` VARCHAR(255) NULL DEFAULT NULL AFTER `TimeImport`;
Note: See TracChangeset for help on using the changeset viewer.