fix #7121 - crm fixes to email
[Pman.Core] / DataObjects / Core_holiday.php
index 45ac129..52a13c5 100644 (file)
@@ -43,7 +43,14 @@ class Pman_Core_DataObjects_Core_holiday extends DB_DataObject
         
         
         
-        $data = file_get_contents("http://www.1823.gov.hk/common/ical/gc/en.ics");
+        $data = file_get_contents("https://www.1823.gov.hk/common/ical/gc/en.ics", false,
+            stream_context_create(array(
+                "ssl"=>array(
+                    "verify_peer"=>false,
+                    "verify_peer_name"=>false,
+                ),
+            ))
+        );
         
         $vevents = explode('BEGIN:VEVENT', $data);
         
@@ -89,5 +96,12 @@ class Pman_Core_DataObjects_Core_holiday extends DB_DataObject
         }
 
     }
+    function isHoliday($country, $date)
+    {
+        $d = DB_DataObject::Factory('core_holiday');
+        $d->country = $country;
+        $d->holiday_date = $date;
+        return $d->count();
+    }
     
 }