MyBB Community Forums

Full Version: [F] Announcement month in Admin CP not saved
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

It is actually reported before.
Tested will it in MyBB 1.4.0 beta 2 it seems that still there.

I have attached an patch file to correctly this issues if this is not
fixed on repository. Smile

It should be fixed the issue. But it may be break coding convention.


EDITED: Just found and fixed the same issue on MCP.
(But that still can not fix enddate minutes issue)

Thanks,
Blueray,
$startmonth = (int)gmdate("m", $announcement['startdate']);

and

$endmonth = (int)gmdate("m", $announcement['enddate']);


Those should be

$startmonth = gmdate("n", $announcement['startdate']);

We don't need those changes. The other two however are fine. I've also applied the fixes to the Mod CP.
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.
(2008-07-08, 04:38 PM)Tikitiki Wrote: [ -> ]$startmonth = (int)gmdate("m", $announcement['startdate']);

and

$endmonth = (int)gmdate("m", $announcement['enddate']);


Those should be

$startmonth = gmdate("n", $announcement['startdate']);

We don't need those changes. The other two however are fine. I've also applied the fixes to the Mod CP.

Hi, I just have change the underline item in which to convert string to int.


There are also an issue related to modcp.php
Please take a look of this.

@@ -939,8 +939,8 @@
 	}
 
 	$startmonthsel = $endmonthsel = array();
-	$startmonthsel[$startmonth] = "selected=\"selected\"";
-	$endmonthsel[$endmonth] = "selected=\"selected\"";
+	$startmonthsel[(int)$startmonth] = "selected=\"selected\"";
+	$endmonthsel[(int)$endmonth] = "selected=\"selected\"";
 
 	$startdatemonth .= "<option value=\"01\" {$startmonthsel['1']}>{$lang->january}</option>\n";
 	$enddatemonth .= "<option value=\"01\" {$endmonthsel['1']}>{$lang->january}</option>\n";

It needs to convert the startmonth index key to int to make
it work.

Finally, there are still an issue is that the enddate's time minute
was incorrectly displayed. ( the time minute add more 8 min to the time )
For example, if the time was 08:00 am, then, it will displayed as 08:08 am
Those aren't needed if you just follow my change. {$startmonthsel['1']} is calling a string so it doesn't need to be an integer.
But if I'am not forgotten.
The $startmonth should be a string '01'.
It seems that not a valid index key for {$startmonthsel['1']}.

if as follow, it will produce an error.

$startmonth = '01';
echo $startmonthsel[$startmonth];

and because 1 = '1'

So, I think this should be need to convert to int.

Please let me know if I'am wrong.
um no. Look up what $startmonth = gmdate("n", $announcement['startdate']); outputs, with $announcement['startdate'] being a timestamp.
I see !

It is a change from m to n internally.
So, it is need not to change now.


Thanks,
Blueray


for me ref:
[attachment=9763]