| @@ -50,12 +50,12 @@ | ||
| 50 | 50 | * @param string $template Template path supplied by a shortcode. |
| 51 | 51 | * @param array $legacy_filenames Exact legacy filenames allowed automatically in the content root or active theme roots. |
| 52 | 52 | * @param string $shortcode Shortcode name for administrator notices. |
| 53 | 53 | * @param int $post_id Post/Page ID where the template was detected, when available. |
| 54 | - * @param bool $enforce When true, return only approved templates. During the transition period this defaults to false. | |
| 54 | + * @param bool $enforce When true, return only approved templates. Defaults to enforcement. | |
| 55 | 55 | * @return string Canonical template path, or an empty string if invalid or blocked. |
| 56 | 56 | */ |
| 57 | - public static function shortcode_template ($template = FALSE, $legacy_filenames = array(), $shortcode = '', $post_id = 0, $enforce = FALSE) | |
| 57 | + public static function shortcode_template ($template = FALSE, $legacy_filenames = array(), $shortcode = '', $post_id = 0, $enforce = TRUE) | |
| 58 | 58 | { |
| 59 | 59 | $template = c_ws_plugin__s2member_utils_dirs::n_dir_seps (trim (str_replace (chr (0), '', (string)$template))); |
| 60 | 60 | if (!$template) |
| 61 | 61 | return ''; |
| @@ -170,9 +170,9 @@ | ||
| 170 | 170 | // Notify Pro about an unapproved template so it can be included in the admin warning. |
| 171 | 171 | if ($_relative_path && $shortcode) |
| 172 | 172 | do_action ('ws_plugin__s2member_shortcode_template_unapproved', $_relative_path, $shortcode, (int)$post_id); |
| 173 | 173 | |
| 174 | - // During the transition period unapproved templates still work; enforcement can later be enabled centrally. | |
| 174 | + //260915.0134 Block unapproved custom templates; callers retain their existing standard-template fallback. | |
| 175 | 175 | return ($enforce) ? '' : $candidate; |
| 176 | 176 | } |
| 177 | 177 | /** |
| 178 | 178 | * Strips a trailing `/app_data/` sub-directory. |
| @@ -261,10 +261,16 @@ | ||
| 261 | 261 | array_unshift ($to, $_jctn_dir); |
| 262 | 262 | } |
| 263 | 263 | else // Else, we should trigger an error in this case. It's NOT possible to generate this. |
| 264 | 264 | { |
| 265 | - trigger_error ("Unable to generate a relative path across different Windows drives." . | |
| 266 | - " Please create a Directory Junction here: " . $_from_drive_jctn . ", pointing to: " . $_to_drive . ":/", E_USER_ERROR); | |
| 265 | + $error = "Unable to generate a relative path across different Windows drives." . | |
| 266 | + " Please create a Directory Junction here: " . $_from_drive_jctn . ", pointing to: " . $_to_drive . ":/"; | |
| 267 | + | |
| 268 | + //260816 PHP 8.4 deprecates trigger_error(..., E_USER_ERROR); preserve the previous fatal-style path on older PHP. | |
| 269 | + if(PHP_VERSION_ID >= 80400) | |
| 270 | + throw new \RuntimeException($error); | |
| 271 | + else | |
| 272 | + trigger_error($error, E_USER_ERROR); | |
| 267 | 273 | } |
| 268 | 274 | } |
| 269 | 275 | |
| 270 | 276 | unset($_real_from, $_real_to, $_from_drive, $_to_drive, $_from_drive_jctn, $_sys_temp_dir_jctn, $_jctn, $_from_drive_jctn_exists, $_jctn_dir, $_m); |