]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions.php
CSS variable set in all root scripts
[mailer.git] / inc / extensions.php
index c299557333522e4501d84249867f5bc6c7af3ff1..608cb3234fa92c51de596fb65019fec9637a045e 100644 (file)
@@ -55,10 +55,13 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run
        } // END - if
 
        // Construct FQFN for extension file
-       $extInclude = sprintf("inc/extensions/ext-%s.php", $ext_name);
+       $FQFN = sprintf("%sinc/extensions/ext-%s.php",
+               constant('PATH'),
+               $ext_name
+       );
 
        // Is the extension file NOT there?
-       if (!FILE_READABLE($extInclude)) {
+       if (!FILE_READABLE($FQFN)) {
                // Debug message
                DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s not found.", $ext_name));
 
@@ -102,7 +105,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run
 
        // Include the extension file
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Extension loaded.");
-       LOAD_INC($extInclude);
+       require($FQFN);
 
        // Is this extension deprecated?
        if ($EXT_DEPRECATED == "Y") {
@@ -243,7 +246,7 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = tr
                }
        } elseif (($task_id > 0) && (!empty($ext_name))) {
                // Remove task from system when id and extension's name is valid
-               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND status='NEW' LIMIT 1",
+               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND `status`='NEW' LIMIT 1",
                        array(bigintval($task_id)), __FILE__, __LINE__);
        }
 
@@ -476,7 +479,7 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
 
                if (!$dry_run) {
                        // Create task
-                       CREATE_EXTENSION_UPDATE_TASK(GET_CURRENT_ADMIN_ID(), $ext_name, $cacheArray['update_ver'][$ext_name], addslashes($NOTES));
+                       CREATE_EXTENSION_UPDATE_TASK(GET_CURRENT_ADMIN_ID(), $ext_name, $cacheArray['update_ver'][$ext_name], SQL_ESCAPE($NOTES));
 
                        // Update extension's version
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_version='%s' WHERE ext_name='%s' LIMIT 1",
@@ -496,9 +499,15 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
 }
 
 // Output verbose SQL table for extension
-function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $width = "100%") {
+function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = "", $dashed = "", $switch = false, $width = "100%") {
        global $SQLs;
 
+       // Empty title?
+       if (empty($title)) {
+               // Then fix it to default
+               $title = getMessage('ADMIN_SQLS_EXECUTED_ON_REMOVAL');
+       } // END - if
+
        // Are there some queries in $queries?
        if (count($queries) > 0) {
                // Then use them instead!
@@ -628,7 +637,11 @@ function DEACTIVATE_EXTENSION($ext_name) {
                CREATE_EXTENSION_DEACTIVATION_TASK($ext_name);
 
                // Notify the admin
-               SEND_ADMIN_NOTIFICATION(ADMIN_SUBJECT_EXTENSION_DEACTIVATED, "admin_ext_deactivated", array('ext_name' => $ext_name));
+               SEND_ADMIN_NOTIFICATION(
+                       getMessage('ADMIN_SUBJECT_EXTENSION_DEACTIVATED'),
+                       "admin_ext_deactivated",
+                       array('ext_name' => $ext_name)
+               );
        } // END - if
 }
 
@@ -648,7 +661,7 @@ function EXT_VERSION_IS_OLDER ($ext_name, $ext_ver) {
 // Creates a new task for updated extension
 function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $ext_name, $ext_ver, $notes) {
        // Create subject line
-       $subject = "[UPDATE-".$ext_name."-".$ext_ver.":] {!ADMIN_UPDATE_EXT_SUBJ!}";
+       $subject = "[UPDATE-".$ext_name."-".$ext_ver.":] {--ADMIN_UPDATE_EXT_SUBJ--}";
 
        // Is the extension there?
        if (GET_EXT_VERSION($ext_name) != "") {
@@ -687,7 +700,7 @@ VALUES (%s,0,'NEW','EXTENSION','%s','%s',UNIX_TIMESTAMP())",
                        array(
                                $admin_id,
                                $subject,
-                               addslashes($msg),
+                               SQL_ESCAPE($msg),
                        ),  __FILE__, __LINE__, true, false
                );
        } // END - if
@@ -696,7 +709,7 @@ VALUES (%s,0,'NEW','EXTENSION','%s','%s',UNIX_TIMESTAMP())",
 // Creates a task for automatically deactivated (deprecated) extension
 function CREATE_EXTENSION_DEACTIVATION_TASK ($ext) {
        // Create subject line
-       $subject = sprintf("[%s:] %s", $ext, TASK_SUBJ_EXTENSION_DEACTIVATED);
+       $subject = sprintf("[%s:] %s", $ext, getMessage('TASK_SUBJ_EXTENSION_DEACTIVATED'));
 
        // Not installed and do we have created a task for the admin?
        if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) != "")) {
@@ -705,7 +718,7 @@ function CREATE_EXTENSION_DEACTIVATION_TASK ($ext) {
 VALUES (0,0,'NEW','EXTENSION_DEACTIVATION','%s','%s',UNIX_TIMESTAMP())",
                        array(
                                $subject,
-                               addslashes(LOAD_TEMPLATE("task_ext_deactivated", true, $ext)),
+                               SQL_ESCAPE(LOAD_TEMPLATE("task_ext_deactivated", true, $ext)),
                        ),  __FILE__, __LINE__, true, false
                );
        } // END - if
@@ -825,13 +838,13 @@ function ADD_EXTENSION_NOTES ($ver, &$UPDATE_NOTES) {
                        // Initial release
                        $content = array(
                                'ver'   => $ver,
-                               'notes' => INITIAL_RELEASE
+                               'notes' => getMessage('INITIAL_RELEASE')
                        );
                } else {
                        // No update notes found!
                        $content = array(
                                'ver'   => $ver,
-                               'notes' => NO_UPDATE_NOTES
+                               'notes' => getMessage('NO_UPDATE_NOTES')
                        );
                }