From: Roland Häder Date: Sun, 4 Jul 2010 12:55:21 +0000 (+0000) Subject: Fixes for missing arguments and some improvements: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3eaa681e2aa94f18fbbdfba8903814e16eae665c;p=mailer.git Fixes for missing arguments and some improvements: - Fixes for missing arguments of debug_report_bug() in various placed - readFromFile() does already check if the file is readable, so no other function need to call debug_report_bug() if it is not readable - TODOs.txt updated --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index d62a9233a4..1c18c1bde2 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -40,7 +40,7 @@ ./inc/extensions/ext-yoomedia.php:56:// @TODO Only deprecated when 'ext-network' is ready! setExtensionDeprecated('Y'); ./inc/extensions-functions.php:143: // @TODO Do we still need this? setExtensionUpdateNotes(''); ./inc/extensions-functions.php:424:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) ) -./inc/extensions-functions.php:540: // @TODO Extension is loaded, what next? +./inc/extensions-functions.php:548: // @TODO Extension is loaded, what next? ./inc/functions.php:115: // @TODO Extension 'msg' does not exist ./inc/functions.php:1482: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? ./inc/functions.php:1505: // @TODO Rewrite this old lost code to a template diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index db650b47e2..2cd8a035af 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -481,7 +481,7 @@ function isExtensionInstalled ($ext_name) { // We don't like empty extension names here if (empty($ext_name)) { // Please fix them all - debug_report_bug(__FUNCTION__.': ext_name is empty.'); + debug_report_bug(__FUNCTION__, __LINE__, 'ext_name is empty.'); } // END - if // By default non is installed @@ -522,8 +522,16 @@ function isExtensionInstalled ($ext_name) { // Check if given extension is active function isExtensionActive ($ext_name) { - // Extensions are all inactive during installation - if ((isInstallationPhase()) || (empty($ext_name))) return false; + if (isInstallationPhase()) { + // Extensions are all inactive during installation + return false; + } elseif (empty($ext_name)) { + // Empty extension names must befixed + debug_report_bug(__FUNCTION__, __LINE__, 'Empty extension name provided.'); + } elseif (!isExtensionInstalled($ext_name)) { + // Not installed extensions are always inactive + return false; + } // Not active is the default $data['ext_active'] = 'N'; diff --git a/inc/functions.php b/inc/functions.php index 69d696e544..69bdcc37d4 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -498,7 +498,7 @@ function countSelection ($array) { // Integrity check if (!is_array($array)) { // Not an array! - debug_report_bug(__FUNCTION__.': No array provided.'); + debug_report_bug(__FUNCTION__, __LINE__, 'No array provided.'); } // END - if // Init count @@ -1179,7 +1179,7 @@ function generateHash ($plainText, $salt = '', $hash = true) { // Sanity check on salt if (strlen($salt) != getSaltLength()) { // Not the same! - debug_report_bug(__FUNCTION__.': salt length mismatch! ('.strlen($salt).'/'.getSaltLength().')'); + debug_report_bug(__FUNCTION__, __LINE__, 'salt length mismatch! ('.strlen($salt).'/'.getSaltLength().')'); } // END - if } diff --git a/inc/install-functions.php b/inc/install-functions.php index 9cabd5ce8a..4d7059a11f 100644 --- a/inc/install-functions.php +++ b/inc/install-functions.php @@ -104,12 +104,6 @@ function addToInstallContent ($out) { // Read a given SQL dump function readSqlDump ($FQFN) { - // Sanity-check if file is there (should be there, but just to make it sure) - if (!isFileReadable($FQFN)) { - // This should not happen - debug_report_bug(__FUNCTION__.': File ' . basename($FQFN) . ' is not readable!'); - } // END - if - // Load the file $content = readFromFile($FQFN); diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 6af2c038bd..7b33fb59f9 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -47,7 +47,7 @@ function readFromFile ($FQFN) { // Sanity-check if file is there (should be there, but just to make it sure) if (!isFileReadable($FQFN)) { // This should not happen - debug_report_bug(__FUNCTION__.': File ' . basename($FQFN) . ' is not readable!'); + debug_report_bug(__FUNCTION__, __LINE__, 'File ' . basename($FQFN) . ' is not readable!'); } // END - if // Is it cached? @@ -119,7 +119,7 @@ function clearOutputBuffer () { // Trigger an error on failure if ((ob_get_length() > 0) && (!ob_end_clean())) { // Failed! - debug_report_bug(__FUNCTION__.': Failed to clean output buffer.'); + debug_report_bug(__FUNCTION__, __LINE__, 'Failed to clean output buffer.'); } // END - if } @@ -804,7 +804,7 @@ function setAdminHash ($adminId, $hash) { // Init user data array function initUserData () { // User id should not be zero - if (getCurrentUserId() < 1) debug_report_bug(__FUNCTION__.': User id is zero.'); + if (getCurrentUserId() < 1) debug_report_bug(__FUNCTION__, __LINE__, 'User id is zero.'); // Init the user $GLOBALS['user_data'][getCurrentUserId()] = array(); @@ -813,7 +813,7 @@ function initUserData () { // Getter for user data function getUserData ($column) { // User id should not be zero - if (getCurrentUserId() < 1) debug_report_bug(__FUNCTION__.': User id is zero.'); + if (getCurrentUserId() < 1) debug_report_bug(__FUNCTION__, __LINE__, 'User id is zero.'); // Return the value return $GLOBALS['user_data'][getCurrentUserId()][$column]; @@ -825,7 +825,7 @@ function getUserDataArray () { $uid = getCurrentUserId(); // User id should not be zero - if ($uid < 1) debug_report_bug(__FUNCTION__.': User id is zero.'); + if ($uid < 1) debug_report_bug(__FUNCTION__, __LINE__, 'User id is zero.'); // Get the whole array if found if (isset($GLOBALS['user_data'][$uid])) {