Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e1ae01cac | |||
| c3ab5c5716 |
@@ -147,18 +147,21 @@ function calculateNextRun($scheduleType, $scheduleDay, $scheduleTime) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'weekly':
|
case 'weekly':
|
||||||
$days = ['', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
$days = [1 => 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
||||||
$dayName = $days[$scheduleDay] ?? 'Monday';
|
$dayName = $days[(int)$scheduleDay] ?? 'Monday';
|
||||||
$next = new DateTime("next {$dayName} " . $time);
|
$next = new DateTime("next {$dayName} " . $time);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'monthly':
|
case 'monthly':
|
||||||
$day = max(1, min(28, (int)$scheduleDay));
|
$day = max(1, min(31, (int)$scheduleDay));
|
||||||
$next = new DateTime();
|
$next = new DateTime();
|
||||||
$next->modify('first day of next month');
|
$next->modify('first day of next month');
|
||||||
$next->setDate($next->format('Y'), $next->format('m'), $day);
|
// Clamp to last day of target month (handles Feb, 30-day months)
|
||||||
list($h, $m) = explode(':', $time);
|
$daysInMonth = (int)$next->format('t');
|
||||||
$next->setTime((int)$h, (int)$m, 0);
|
$day = min($day, $daysInMonth);
|
||||||
|
$next->setDate((int)$next->format('Y'), (int)$next->format('m'), $day);
|
||||||
|
$parts = explode(':', $time . ':00'); // ensure at least H:M
|
||||||
|
$next->setTime((int)$parts[0], (int)$parts[1], 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -35,7 +35,10 @@ class SynapseHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$matrixId = '@' . rawurlencode($username) . ':' . $domain;
|
// Build the Matrix user ID and percent-encode it once for the URL path.
|
||||||
|
// rawurlencode($username) here would double-encode any special chars when
|
||||||
|
// the full $matrixId string is encoded again below.
|
||||||
|
$matrixId = '@' . $username . ':' . $domain;
|
||||||
$url = rtrim($baseUrl, '/') . '/_synapse/admin/v2/users/' . rawurlencode($matrixId);
|
$url = rtrim($baseUrl, '/') . '/_synapse/admin/v2/users/' . rawurlencode($matrixId);
|
||||||
|
|
||||||
$ch = curl_init($url);
|
$ch = curl_init($url);
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ class RecurringTicketModel {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'weekly':
|
case 'weekly':
|
||||||
$dayName = ['', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'][$scheduleDay] ?? 'Monday';
|
$dayNames = [1 => 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
||||||
|
$dayName = $dayNames[(int)$scheduleDay] ?? 'Monday';
|
||||||
$next = new DateTime("next {$dayName} " . $scheduleTime);
|
$next = new DateTime("next {$dayName} " . $scheduleTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user