Rewritten extension handling, if no ext-foo.tpl is there, some cosmetics applied
[mailer.git] / inc / extensions.php
index d21e3b4d13d7f2e444790782dfec42774edcf3d3..eb6ba10c3f3880131f604f07380e121ae5c3cd9b 100644 (file)
@@ -434,6 +434,12 @@ function GET_EXT_VERSION ($ext_name) {
        // By default no extension is found
        $ext_ver = false;
 
+       // Empty extension name should be fixed!
+       if (empty($ext_name)) {
+               // Please report this bug!
+               debug_report_bug(__FUNCTION__.": ext_name is empty which is not allowed here.");
+       } // END - if
+
        // Extensions are all inactive during installation
        if ((!isInstalled()) || (isInstalling())) return "";
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": ext_name={$ext_name}");
@@ -734,13 +740,16 @@ function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) {
                        $ext
                );
 
-               // Load text for task
+               // Set default message if ext-foo is missing
+               $msg = sprintf(getMessage('ADMIN_EXT_TEXT_FILE_MISSING'), $ext);
+
+               // Load text for task if found
                if (FILE_READABLE($tpl)) {
                        // Load extension's own text template (HTML!)
                        $msg = LOAD_TEMPLATE("ext_".$ext, true);
                } else {
-                       // Load default message
-                       $msg = LOAD_TEMPLATE("admin_new_ext", "", 0);
+                       // Write this in debug.log as well
+                       DEBUG_LOG(__FUNCTION__, __LINE__, $msg);
                }
 
                // Task not created so it's a brand-new extension which we need to register and create a task for!