SMF Development > Fixed or Bogus Bugs
[4734] Editing date on calendar item splits it from post
Farjo:
If someone posts an event to a forum where they do not have editing rights, then change the date on the calendar item, the post gets split from the item which no longer shows at the beginning of the post.
The best fix for this would be a new feature to allow admin to choose which boards calendar items can be posted into :)
H:
Moved to bug reports :)
Farjo:
Hi, just wondering what happened with this? It is still happening in RC5 and I cannot find it on the bug tracker (by searching 'calendar'). Was it not able to be reproduced or something else?
emanuele:
Here it is a possible fix (the other one I can imagine requires more changes).
Most likely there is a better solution.
In Calendar.php:
--- Code: (find) --- // ... or just update it?
else
{
$eventOptions = array(
'title' => substr($_REQUEST['evtitle'], 0, 60),
'span' => empty($modSettings['cal_allowspan']) || empty($_POST['span']) || $_POST['span'] == 1 || empty($modSettings['cal_maxspan']) || $_POST['span'] > $modSettings['cal_maxspan'] ? 0 : min((int) $modSettings['cal_maxspan'], (int) $_POST['span'] - 1),
'start_date' => strftime('%Y-%m-%d', mktime(0, 0, 0, (int) $_REQUEST['month'], (int) $_REQUEST['day'], (int) $_REQUEST['year'])),
);
modifyEvent($_REQUEST['eventid'], $eventOptions);
}
--- End code ---
--- Code: (replace with) --- // ... or just update it?
else
{
// There could be already a topic you are not allowed to modify
if(!allowedTo('post_new')){
$request = $smcFunc['db_query']('', '
SELECT id_board, id_topic
FROM {db_prefix}calendar
WHERE id_event = {int:id_event}
LIMIT 1
',
array(
'id_event' => $_REQUEST['eventid'],
));
list($id_board, $id_topic) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
}
$eventOptions = array(
'title' => substr($_REQUEST['evtitle'], 0, 60),
'span' => empty($modSettings['cal_allowspan']) || empty($_POST['span']) || $_POST['span'] == 1 || empty($modSettings['cal_maxspan']) || $_POST['span'] > $modSettings['cal_maxspan'] ? 0 : min((int) $modSettings['cal_maxspan'], (int) $_POST['span'] - 1),
'start_date' => strftime('%Y-%m-%d', mktime(0, 0, 0, (int) $_REQUEST['month'], (int) $_REQUEST['day'], (int) $_REQUEST['year'])),
'board' => isset($id_board) ? (int) $id_board : 0,
'topic' => isset($id_topic) ? (int) $id_topic : 0,
);
modifyEvent($_REQUEST['eventid'], $eventOptions);
}
--- End code ---
Farjo:
Thank you emanuele. Yes that fixes it :)
I have a few other things on my plate now however when I have time I will give this a better test.
Navigation
[0] Message Index
[#] Next page
Go to full version