CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#12474] Taking the default page down by accident through the content type

avatar
Created By: Michael Smith (rage_all)
Date Submitted: Thu Sep 09 03:47:16 -0400 2021

Assigned To:
Version: 2.1.5
CMSMS Version: 2.1.5
Severity: Minor
Resolution: Accepted
State: Open
Summary:
Taking the default page down by accident through the content type
Detailed Description:
How to:
Edit the default page ('home' as example).
The list-box for content type is fully accessible - even though it's the default
page.
Change the content type to 'section header'.
No warning appears.
Save.

Now your site is only accessible by a sub-URL — the main URL (example.com/ or
example.com/index.php) will be answered 404.
Enabling debug mode doesn't help finding the error and also there is no error
report like if there was a syntax error.

More info at https://forum.cmsmadesimple.org/viewtopic.php?f=8&t=82981

I can't decide how severe this is. Probably severe but very rare?
Thanks!


History

Comments
avatar
Date: 2021-10-18 13:58
Posted By: Rolf (rolf1)

Reproduced in CMSMS 2.2.15:
Set default homepage to section header and save
Error 404 on opening root url
      
avatar
Date: 2022-04-21 05:03
Posted By: tom (tomphantoo)

Suggestion - js to block inappropriate type-change:  
$('#content_type')
   .data('lastValue', $('#content_type').val())
   .on('change', function(ev) {
     if ($('#defaultcontent').val()) {
       var ts = $(this),
        v = ts.val();
if
(['errorpage','sectionheader','separator','pagelink','link'].indexOf(v) !==
false) {
         //invalid type
         v = ts.data('lastValue'); // revert value
         ts.val(v);
         cms_notify('error', $msg2);
         ev.stopImmediatePropagation();
         ev.preventDefault();
         return false;
       }
     }
   });

$msg2 (to be translated)
'The content type selected is invalid'
and related popup help message
'The content-type determines the overall function of a page. Some types are used
for displayable pages, other types are for links or other navigation functions.
The default page must be a displayable type.'
      
Updates

Updated: 2021-10-18 13:58
resolution_id: => 6
severity_id: 12 => 3