X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fextensions-functions.php;h=c73a57fe4c3bc0d2adbbc45b50623c868a5f61d3;hp=3ea8b87b0b143634d8fc1703c6ce4e8fc7a8e04a;hb=0cbe2bfe902d26f0e99be6005140a9d8c350f017;hpb=735545e765720a954a345bc068239e2fffa0dbe1 diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index 3ea8b87b0b..c73a57fe4c 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -1,7 +1,7 @@ %s has empty version!", $ext_name)); } // END - if // Return result - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ": ret={$ext_ver}"); - return $ext_ver; + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ": ret={$data['ext_version']}"); + return $data['ext_version']; } // Updates a given extension with current extension version to latest version @@ -730,12 +733,12 @@ function addExtensionVerboseSqlTable ($title = '', $dashed = '', $switch = false // Get extension name from id function getExtensionName ($ext_id) { // Init extension name - $ret = ''; + $data['ext_name'] = ''; // Is cache there? if (isset($GLOBALS['cache_array']['extension']['ext_name'][$ext_id])) { // Load from cache - $ret = $GLOBALS['cache_array']['extension']['ext_name'][$ext_id]; + $data['ext_name'] = $GLOBALS['cache_array']['extension']['ext_name'][$ext_id]; // Count cache hits incrementStatsEntry('cache_hits'); @@ -747,7 +750,7 @@ function getExtensionName ($ext_id) { // Is the entry there? if (SQL_NUMROWS($result) == 1) { // Get the extension's name from database - list($ret) = SQL_FETCHROW($result); + $data = SQL_FETCHARRAY($result); } // END - if // Free result @@ -755,47 +758,47 @@ function getExtensionName ($ext_id) { } // Did we find some extension? - if (empty($ret)) { + if (empty($data['ext_name'])) { // We should fix these all! debug_report_bug(__FUNCTION__ . ': ext_name is empty. ext_id=' . $ext_id); } // END - if // Return the extension name - return $ret; + return $data['ext_name']; } // Get extension id from name function getExtensionId ($ext_name) { // Init id number - $ret = '0'; + $data['ext_id'] = '0'; // Do we have cache? if (isset($GLOBALS['cache_array']['extension']['ext_id'][$ext_name])) { // Load from cache - $ret = $GLOBALS['cache_array']['extension']['ext_id'][$ext_name]; + $data['ext_id'] = $GLOBALS['cache_array']['extension']['ext_id'][$ext_name]; // Count cache hits incrementStatsEntry('cache_hits'); } else { // Load from database - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` AS ext_id FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); // Is the entry there? if (SQL_NUMROWS($result) == 1) { // Get the extension's id from database - list($ret) = SQL_FETCHROW($result); + $data = SQL_FETCHARRAY($result); } // END - if // Free result SQL_FREERESULT($result); // Cache it - $GLOBALS['cache_array']['extension']['ext_id'][$ext_name] = $ret; + $GLOBALS['cache_array']['extension']['ext_id'][$ext_name] = $data['ext_id']; } // Return value - return $ret; + return $data['ext_id']; } // Determines wether the given extension name is valid @@ -906,7 +909,7 @@ function createNewExtensionTask ($adminId, $subject, $ext) { // Not installed and do we have created a task for the admin? if ((determineTaskIdBySubject($subject) == '0') && (!isExtensionInstalled($ext))) { // Set default message if ext-foo is missing - $message = sprintf(getMessage('ADMIN_EXT_TEXT_FILE_MISSING'), $ext); + $message = getMaskedMessage('ADMIN_EXT_TEXT_FILE_MISSING', $ext); // Template file $tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl", @@ -946,7 +949,7 @@ function ifModuleHasMenu ($mod, $forceDb = false) { // All is false by default $ret = false; - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "mod={$mod},cache=".getExtensionVersion('cache')); + // Extension installed and newer than or has version 0.1.2? if (isExtensionInstalledAndNewer('cache', '0.1.2')) { // Cache version is okay, so let's check the cache! if (isset($GLOBALS['cache_array']['modules']['has_menu'][$mod])) { @@ -969,13 +972,13 @@ function ifModuleHasMenu ($mod, $forceDb = false) { // Entry found? if (SQL_NUMROWS($result) == 1) { // Load "has_menu" column - list($has_menu) = SQL_FETCHROW($result); + $data = SQL_FETCHARRAY($result); // Fake cache... ;-) - $GLOBALS['cache_array']['extension']['ext_menu'][$mod] = $has_menu; + $GLOBALS['cache_array']['extension']['ext_menu'][$mod] = $data['has_menu']; // Does it have a menu? - $ret = ($has_menu == 'Y'); + $ret = ($data['has_menu'] == 'Y'); } // END - if // Free memory @@ -986,52 +989,51 @@ function ifModuleHasMenu ($mod, $forceDb = false) { } // Return status - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName().intval($ret)); return $ret; } // Determines the task id for given extension function determineExtensionTaskId ($ext_name) { // Default is not found - $task_id = '0'; + $data['task_id'] = '0'; // Search for extension task's id - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `task_type`='EXTENSION' AND `subject`='[%s:]' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` AS task_id FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `task_type`='EXTENSION' AND `subject`='[%s:]' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); // Entry found? if (SQL_NUMROWS($result) == 1) { // Task found so load task's id and register extension... - list($task_id) = SQL_FETCHROW($result); + $data = SQL_FETCHARRAY($result); } // END - if // Free result SQL_FREERESULT($result); // Return it - return $task_id; + return $data['task_id']; } // Determines the task id for given subject function determineTaskIdBySubject ($subject) { // Default is not found - $task_id = '0'; + $data['task_id'] = '0'; // Search for task id - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` AS task_id FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1", array($subject), __FUNCTION__, __LINE__); // Entry found? if (SQL_NUMROWS($result) == 1) { // Task found so load task's id and register extension... - list($task_id) = SQL_FETCHROW($result); + $data = SQL_FETCHARRAY($result); } // END - if // Free result SQL_FREERESULT($result); // Return it - return $task_id; + return $data['task_id']; } // Add updates notes for given version @@ -1141,7 +1143,7 @@ function addExtensionUpdateDependency ($updateDepends) { // Is the update depency empty? (NEED TO BE FIXED!) if (empty($updateDepends)) { // Please report this bug! - debug_report_bug("updateDepends is left empty!"); + debug_report_bug('updateDepends is left empty!'); } // END - if // Is it not yet added? @@ -1451,7 +1453,7 @@ function removeExtensionFromArray () { $ext_name = getCurrentExtensionName(); // Now loop through the whole cache - foreach ($GLOBALS['cache_array']['extension'] as $cacheName=>$cacheArray) { + foreach ($GLOBALS['cache_array']['extension'] as $cacheName => $cacheArray) { // Is it an element? if (isset($cacheArray[$ext_name])) { // Array element @@ -1553,7 +1555,7 @@ function isExtensionIncludeReadable ($ext_name = '') { } // END - if // Return result - //* DEBUG: */ print __FUNCTION__.': '.$ext_name.'='.intval($GLOBALS['ext_inc_readable'][$ext_name]).'
'; + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',realable='.intval($GLOBALS['ext_inc_readable'][$ext_name])); return $GLOBALS['ext_inc_readable'][$ext_name]; }