- // delete the item
- Item::deleteById($item['id']);
-
- goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
- //NOTREACHED
- } else {
- notice(L10n::t('Permission denied.') . EOL);
- goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
- //NOTREACHED
- }
-}
-
-/* arrange the list in years */
-function list_post_dates($uid, $wall) {
- $dnow = DateTimeFormat::localNow('Y-m-d');
-
- $dthen = Item::firstPostDate($uid, $wall);
- if (!$dthen) {
- return [];
- }
-
- // Set the start and end date to the beginning of the month
- $dnow = substr($dnow, 0, 8) . '01';
- $dthen = substr($dthen, 0, 8) . '01';
-
- $ret = [];
-
- /*
- * Starting with the current month, get the first and last days of every
- * month down to and including the month of the first post
- */
- while (substr($dnow, 0, 7) >= substr($dthen, 0, 7)) {
- $dyear = intval(substr($dnow, 0, 4));
- $dstart = substr($dnow, 0, 8) . '01';
- $dend = substr($dnow, 0, 8) . Temporal::getDaysInMonth(intval($dnow), intval(substr($dnow, 5)));
- $start_month = DateTimeFormat::utc($dstart, 'Y-m-d');
- $end_month = DateTimeFormat::utc($dend, 'Y-m-d');
- $str = day_translate(DateTimeFormat::utc($dnow, 'F'));
- if (!$ret[$dyear]) {
- $ret[$dyear] = [];