apps/files_sharing/api/local.php 1 location
|
@@ 574-586 (lines=13) @@
|
| 571 |
|
* @throws \Exception |
| 572 |
|
* @return \DateTime |
| 573 |
|
*/ |
| 574 |
|
private static function parseDate($expireDate) { |
| 575 |
|
if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $expireDate) === 0) { |
| 576 |
|
throw new \Exception('Invalid date. Format must be YYYY-MM-DD'); |
| 577 |
|
} |
| 578 |
|
|
| 579 |
|
$date = new \DateTime($expireDate); |
| 580 |
|
|
| 581 |
|
if ($date === false) { |
| 582 |
|
throw new \Exception('Invalid date. Format must be YYYY-MM-DD'); |
| 583 |
|
} |
| 584 |
|
|
| 585 |
|
return $date; |
| 586 |
|
} |
| 587 |
|
|
| 588 |
|
/** |
| 589 |
|
* get file ID from a given path |
apps/files_sharing/api/share20ocs.php 1 location
|
@@ 714-728 (lines=15) @@
|
| 711 |
|
* @throws \Exception |
| 712 |
|
* @return \DateTime |
| 713 |
|
*/ |
| 714 |
|
private function parseDate($expireDate) { |
| 715 |
|
try { |
| 716 |
|
$date = new \DateTime($expireDate); |
| 717 |
|
} catch (\Exception $e) { |
| 718 |
|
throw new \Exception('Invalid date. Format must be YYYY-MM-DD'); |
| 719 |
|
} |
| 720 |
|
|
| 721 |
|
if ($date === false) { |
| 722 |
|
throw new \Exception('Invalid date. Format must be YYYY-MM-DD'); |
| 723 |
|
} |
| 724 |
|
|
| 725 |
|
$date->setTime(0,0,0); |
| 726 |
|
|
| 727 |
|
return $date; |
| 728 |
|
} |
| 729 |
|
} |
| 730 |
|
|