Advertisement:

Author Topic: [4734] Editing date on calendar item splits it from post  (Read 10037 times)

Offline Farjo

  • Jr. Member
  • **
  • Posts: 237
[4734] Editing date on calendar item splits it from post
« on: November 23, 2009, 02:21:47 AM »
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 :)
« Last Edit: May 29, 2011, 06:04:36 PM by emanuele »

Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,660
  • Gender: Male
Re: Editing date on calendar item splits it from post
« Reply #1 on: December 06, 2009, 04:37:59 PM »
Moved to bug reports :)
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline Farjo

  • Jr. Member
  • **
  • Posts: 237
Re: Editing date on calendar item splits it from post
« Reply #2 on: March 28, 2011, 10:13:27 AM »
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?

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Editing date on calendar item splits it from post
« Reply #3 on: May 08, 2011, 03:47:01 PM »
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) [Select]
// ... 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);
}

Code: (replace with) [Select]
// ... 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);
}


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Farjo

  • Jr. Member
  • **
  • Posts: 237
Re: Editing date on calendar item splits it from post
« Reply #4 on: May 11, 2011, 08:22:39 AM »
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.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Editing date on calendar item splits it from post
« Reply #5 on: May 11, 2011, 03:51:02 PM »
Don't tell anyone, but I don't like this solution! :P
It's just the one with less edits I could imagine.


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Editing date on calendar item splits it from post
« Reply #6 on: May 29, 2011, 05:07:54 PM »
BTW, I was checking this again and in the post event page only boards where the member is allowed to post are listed.

The problem, in fact arise if the permissions are changed before editing the event.
So the sequence is:
* post an event,
* change the board permissions for the user removing post new topic
* edit the event
that's the only case I was able to find where the event is split from the topic.


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Farjo

  • Jr. Member
  • **
  • Posts: 237
Re: Editing date on calendar item splits it from post
« Reply #7 on: May 29, 2011, 05:28:34 PM »
Hi Emanuele, the problem arises if the event is posted to a board where they have the right to post but not to edit i.e. where 'Modify their own post' is off in Admin -> Members -> Permissions -> Edit Profiles :)

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Editing date on calendar item splits it from post
« Reply #8 on: May 29, 2011, 05:48:59 PM »
Right, right, right, I forgot the edit!


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Farjo

  • Jr. Member
  • **
  • Posts: 237
Re: Editing date on calendar item splits it from post
« Reply #9 on: May 29, 2011, 05:50:26 PM »
 :laugh:

Offline Joshua Dickerson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,775
  • Gender: Male
    • joshuaadickerson on GitHub
    • joshuaadickerson on LinkedIn
Re: [4734] Editing date on calendar item splits it from post
« Reply #10 on: May 31, 2011, 03:41:14 PM »
emanuele, does that fix the entire problem?
Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: [4734] Editing date on calendar item splits it from post
« Reply #11 on: June 01, 2011, 07:35:34 AM »
It should, but honestly I'm not sure about side effects... ;)


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.