CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#11822] cms_stylesheet name attribute uses LIKE in query (with solution)

avatar
Created By: Victor Avgust (Vavgust)
Date Submitted: Thu May 17 16:08:46 -0400 2018

Assigned To: Mathieu Muths (airelibre) (airelibre)
Version: 2.2.7
CMSMS Version: 2.2.7
Severity: Major
Resolution: None
State: Open
Summary:
cms_stylesheet name attribute uses LIKE in query (with solution)
Detailed Description:
It's about {cms_stylesheet}: when I use name attribute {cms_stylesheet
name="editor"} it returns not one stylesheet "editor" but all with similar names
"editor*".  Though only "editor" CSS is expected. Such behavior breaks tinyMCE
style functionality and is not predictable.

Fix:

In /lib/classes/class.CmsLayoutStylesheetQuery.php line #94 is:
    $where[] = 'name LIKE '.$db->qstr($val.'%');
should be:
    $where[] = 'name = '.$db->qstr($val);
or even
    $where[] = "name = '$val'";


History

Updates

Updated: 2018-06-14 12:17
summary: cms_stylesheet name attribute uses LIKE in query => cms_stylesheet name attribute uses LIKE in query (with solution)
assigned_to_id: 100 => 13536

Updated: 2018-06-14 09:50
assigned_to_id: 9859 => 100

Updated: 2018-06-13 18:54
description: It's about {cms_stylesheet}: when I use name attribute {cms_stylesheet name="editor"} it returns not one stylesheet link to "editor" but 2: to "editor" and to "EditorCSS". 2 links are returned because different media_query are set for different CSSs. If => It's about {cms_stylesheet}: when I use name attribute {cms_stylesheet name="editor"} it returns not one stylesheet "editor" but all with similar names "editor*". Though only "editor" CSS is expected. Such behavior breaks tinyMCE style functionality and
assigned_to_id: 12532 => 9859

Updated: 2018-05-17 18:35
assigned_to_id: 102 => 12532

Updated: 2018-05-17 18:35
description: It's about {cms_stylesheet}: when I use name attribute {cms_stylesheet name="editor"} it returns not one stylesheet link to "editor" but 2: to "editor" and to "EditorCSS". 2 links are returned because different media_query are set for different CSSs. If => It's about {cms_stylesheet}: when I use name attribute {cms_stylesheet name="editor"} it returns not one stylesheet link to "editor" but 2: to "editor" and to "EditorCSS". 2 links are returned because different media_query are set for different CSSs. If
resolution_id: => 5