[Pushed] Issue - hardcoded smilieinsert stuff in php files
#1
Edit: PR created https://github.com/mybb/mybb/pull/1077 ( i hope that i got it right, if not remove it)

After revamping new thread template i have noticed that w3 validator is returning error reports on few areas. I have double checked my templates i have noticed that smilieinsert_smilie has a tr tag wrapped around it (for 3 smilies in each row), since all hardcoded HTML was pushed into templates i started to digg around and found out that that area still has hardcoded HTML:

Edits:

functions.php

Line 3057 - 3060


if($counter == 0)
					{
						$smilies .=  "<tr>\n";
					} 

should be


if($counter == 0)
					{
$smilies .= $templates->get("smilieinsert_wrapper_start");
$smilies .= "\n";
				
					}


and


Line 3070 - 3074

if($counter == $mybb->settings['smilieinsertercols'])
					{
						$counter = 0;
						$smilies .= "</tr>\n";
					}

should be



					if($counter == $mybb->settings['smilieinsertercols'])
					{
						$counter = 0;
						$smilies .= $templates->get("smilieinsert_wrapper_end");
$smilies .= "\n";
					
					}
					}




Line 3080 - 3084
			if($counter != 0)
			{
				$colspan = $mybb->settings['smilieinsertercols'] - $counter;
				$smilies .= "<td colspan=\"{$colspan}\">&nbsp;</td>\n</tr>\n";
			}

Should be

			if($counter != 0)
			{
				$colspan = $mybb->settings['smilieinsertercols'] - $counter;
				$smilies .= $templates->get("smilieinsert_empty");
$smilies .= "\n";
				
			}


$templatelist updates:

calendar.php

Line 16

Replace

$templatelist .= ",calendar_event_editbutton,calendar_event_modoptions,calendar_dayview_event,calendar_dayview,codebuttons,smilieinsert,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty";

With

$templatelist .= ",calendar_event_editbutton,calendar_event_modoptions,calendar_dayview_event,calendar_dayview,codebuttons,smilieinsert,smilieinsert_empty,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert_wrapper_end,smilieinsert_wrapper_start";

editpost.php

Line 14

Replace

$templatelist = "editpost,previewpost,changeuserbox,codebuttons,smilieinsert,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,post_attachments_attachment_postinsert,post_attachments_attachment_mod_unapprove";

with

$templatelist = "editpost,previewpost,changeuserbox,codebuttons,smilieinsert,smilieinsert_empty,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert_wrapper_end,smilieinsert_wrapper_start,post_attachments_attachment_postinsert,post_attachments_attachment_mod_unapprove";


modcp.php line 22

replace

$templatelist .= ",modcp_warninglogs,modcp_modlogs_result,modcp_editprofile_signature,forumjump_advanced,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,modcp_announcements_forum_nomod,modcp_announcements_announcement";

with

$templatelist .= ",modcp_warninglogs,modcp_modlogs_result,modcp_editprofile_signature,forumjump_advanced,smilieinsert_empty,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert_wrapper_end,smilieinsert_wrapper_start,modcp_announcements_forum_nomod,modcp_announcements_announcement";

Newreply line 15

Replace

$templatelist .= ",smilieinsert,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,codebuttons,post_attachments_new,post_attachments,post_savedraftbutton,newreply_modoptions,newreply_threadreview_more,newreply_disablesmilies,postbit_online";

with

$templatelist .= ",smilieinsert,smilieinsert_empty,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert_wrapper_end,smilieinsert_wrapper_start,codebuttons,post_attachments_new,post_attachments,post_savedraftbutton,newreply_modoptions,newreply_threadreview_more,newreply_disablesmilies,postbit_online";


Newthread.php line 20

Replace

$templatelist .= ",postbit_attachments_thumbnails,postbit_attachments_images,postbit_attachments,postbit_gotopost,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,attachment_icon,postbit_reputation_formatted_link,global_moderation_notice";

with


$templatelist .= ",postbit_attachments_thumbnails,postbit_attachments_images,postbit_attachments,postbit_gotopost,smilieinsert_empty,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert_wrapper_end,smilieinsert_wrapper_start,attachment_icon,postbit_reputation_formatted_link,global_moderation_notice";

private.php line 18

replace

$templatelist .= ",private_messagebit,codebuttons,smilieinsert,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,posticons,private_send_autocomplete,private_messagebit_denyreceipt,private_read_to,postbit_online";

with

$templatelist .= ",private_messagebit,codebuttons,smilieinsert,smilieinsert_empty,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert_wrapper_end,smilieinsert_wrapper_start,posticons,private_send_autocomplete,private_messagebit_denyreceipt,private_read_to,postbit_online";

Usercp.php line 23

replace

$templatelist .= ",codebuttons,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert,usercp_nav_messenger_compose,usercp_options_language_option,usercp_editlists";

with

$templatelist .= ",codebuttons,smilieinsert,smilieinsert_empty,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert_wrapper_end,smilieinsert_wrapper_start,usercp_nav_messenger_compose,usercp_options_language_option,usercp_editlists";

warnings.php line 15

replace

$templatelist .= ",warnings_view_post,warnings_view_user,warnings_view_revoke,warnings_view_revoked,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert,warnings_warn_type_result";

with

$templatelist .= ",warnings_view_post,warnings_view_user,warnings_view_revoke,warnings_view_revoked,smilieinsert,smilieinsert_empty,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert_wrapper_end,smilieinsert_wrapper_start,warnings_warn_type_result";



New templates


smilieinsert_wraper_start
<tr>

smilieinsert_wraper_end
</tr>


smilieinsert_empty
<td colspan="{$colspan}">&nbsp;</td></tr>

New content in mybb-theme:xml (mybb 1.8 beta 3)

after line 10432

add

<template name="smilieinsert_empty" version="1800"><![CDATA[<td colspan="{$colspan}">&nbsp;</td></tr>]]></template>

after line 10436

	<template name="smilieinsert_wrapper_end" version="1800"><![CDATA[</tr>]]></template>

	<template name="smilieinsert_wrapper_start" version="1800"><![CDATA[<tr>]]></template>
Reply
#2
There are also some other leftovers, for example in global.php: https://github.com/mybb/mybb/issues/756#...t-48864946 So I think we should recheck all files and then create an issue. If anyone knows any other hardcoded HTML, please post below.
Reply
#3
Part 2.

misc.php line 17

replace

$templatelist .= ",misc_smilies,misc_smilies_smilie,misc_help_section_bit,misc_help_section,misc_help,forumdisplay_password_wrongpass,forumdisplay_password,misc_helpresults,misc_helpresults_bit,misc_helpresults_noresults,multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start";


with

$templatelist .= ",misc_smilies,misc_smilies_smilie,misc_smilies_wrapper_end,misc_smilies_wrapper_start,misc_help_section_bit,misc_help_section,misc_help,forumdisplay_password_wrongpass,forumdisplay_password,misc_helpresults,misc_helpresults_bit,misc_helpresults_noresults,multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start";

Line 700

replace
$smilies = "<tr>";

with

$smilies .= $templates->get("misc_smilies_wrapper_start");

Line 722

$smilies .= "</tr><tr>";


with

$smilies .= $templates->get("misc_smilies_wrapper_end");


New templates:

misc_smilies_wrapper_end
</tr>

misc_smilies_wrapper_start
<tr>

mybb-theme.xml edit (1.8 - beta 3)


After line 6248 add

<template name="misc_smilies_wrapper_end" version="1800"><![CDATA[</tr><tr]]></template>


	<template name="misc_smilies_wrapper_start" version="1800"><![CDATA[<tr>]]></template>
Reply
#4
This user has been denied support. This user has been denied support.
A template that consists of </tr><tr> would confuse the hell out of me.

Why not a template that is "<tr>{$thing}</tr>" instead.

That way at least you know there is a final </tr> somewhere, I'm not clear how this is achieved with one template "<tr>" and another "</tr><tr>".
Reply
#5
it's awkward for me to (i know that a html tag consist of opening and closing tag, if it's a tag like img or input they are self closed />). I have just pasted what was located in those lines. I have corrected them.
Reply
#6
If someone is willing to include this i have included all mentioned changes to current 1.8 files (downloaded from github before 40 minutes, last edit [as shown on github] was on usercp.php before 8 hours ago) in a zip file. Nothing apart from mentioned lines below was touched / edited:

inc/functions.php lines 3070, 3071, 3088, 3089, 3097, 3098
calendar.php line 16
editpost.php line 14
misc.php lines 17, 708, 725
newreply.php line 15
newthread.php line 20
private.php line 18
usercp.php line 23
warnings.php line 15
mybb_theme.xml - new content on lines 11437, 11438, 6046 and 6047


Attached Files
.zip   1.8 changes.zip (Size: 229.63 KB / Downloads: 75)
Reply
#7
Can anybody check this? For me it looks good at first look, but I am new in MyBB Smile
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
Reply
#8
I'd take care of this myself but there's already a lot of selectors I'm trying to take care of first. If you'd like to try yourself Johnny, I've found this really helpful:

http://stackoverflow.com/a/14869954

I follow it until step 7, then make my changes. After that it's pretty simple through the Github interface to push the changes. Smile

Edit: Nevermind, just saw that you did this on Github already in your OP edit.
Reply
#9
There is no problem to push this... but it has to be confirmed and mainly checked by someone from mybb team Smile
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
Reply
#10
Yes my mistake. Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)