Load More button returns “Invalid template” on Linux servers
-
Description:
The Load More button on the Post Grid widget returns
{"success":false,"data":"Invalid template"}on Linux servers due to two bugs inAjax_Handler.php:Bug 1 — Missing
dirsegment in template pathIn
ajax_load_more(), the file path is built as:Template/{name}/{file_name}But
template_infocontains adirvalue (lite,pro, ortheme) that is never included in the path. It should be:Template/{name}/{dir}/{file_name}Bug 2 — Case mismatch from
sanitize_file_nameeael_sanitize_template_param()runssanitize_file_name()ontemplate_info, which lowercases thenamevalue fromPost-Gridtopost-grid. On Linux,realpath()then fails because the actual folder is namedPost-Grid(capital P, capital G). Either the folder should be lowercase, orsanitize_file_nameshould not be applied to thenamekey.Fix:
In
ajax_load_more(), change the path sprintf from:php
'%s/Template/%s/%s' $dir_path, $template_info['name'], $template_info['file_name']To:
php
'%s/Template/%s/%s/%s' $dir_path, $template_info['name'], $template_info['dir'], $template_info['file_name']And either rename the
Post-Gridfolder topost-grid, or exclude thenamekey fromsanitize_file_nameineael_sanitize_template_param().
You must be logged in to reply to this topic.