]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Fixes + asserts
[mailer.git] / inc / functions.php
index b9c3f1f699efe2dc8825a78f367cb7d057d63b55..561bbdadf576f00aeef9b519712d8f8a951f48d3 100644 (file)
@@ -95,7 +95,7 @@ function generatePassword ($length = '0', $exclude = array()) {
        $localAbc = array_diff($GLOBALS['_abc'], $exclude);
 
        // $localAbc must have at least 10 entries
-       assert(count($localAbc) >= 10);
+       assert(count($localAbc) >= 10, 'localAbc()=' . count($localAbc) . ' is to small.');
 
        // Start creating password
        $password = '';
@@ -1412,7 +1412,7 @@ function doHandleExtraValues ($filterFunctions, $extraValues, $key, $entries, $u
                } // END - if
 
                // Make sure entries is not bool, then something went wrong
-               assert(!is_bool($entries));
+               assert(!is_bool($entries), 'entries[]=bool which is not expected.');
        } elseif (!empty($filterFunctions[$search])) {
                // Debug mode enabled?
                if (isDebugModeEnabled()) {
@@ -1430,7 +1430,7 @@ function doHandleExtraValues ($filterFunctions, $extraValues, $key, $entries, $u
                } // END - if
 
                // Make sure entries is not bool, then something went wrong
-               assert(!is_bool($entries));
+               assert(!is_bool($entries), 'entries[]=bool which is not expected.');
        }
 
        // Return value
@@ -1530,7 +1530,7 @@ function rebuildCache ($cache, $inc = '', $force = FALSE) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("cache=%s, inc=%s, force=%s", $cache, $inc, intval($force)));
 
        // Shall I remove the cache file?
-       if ((isExtensionInstalled('cache')) && (isCacheInstanceValid()) && (isHtmlOutputMode())) {
+       if ((isExtensionInstalled('cache')) && (isValidCacheInstance()) && (isHtmlOutputMode())) {
                // Rebuild cache only in HTML output-mode
                // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
                if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
@@ -1541,7 +1541,7 @@ function rebuildCache ($cache, $inc = '', $force = FALSE) {
                // Include file given?
                if (!empty($inc)) {
                        // Construct FQFN
-                       $inc = sprintf("inc/loader/load-%s.php", $inc);
+                       $inc = sprintf('inc/loader/load-%s.php', $inc);
 
                        // Is the include there?
                        if (isIncludeReadable($inc)) {
@@ -2042,7 +2042,7 @@ function encodeUrl ($url, $outputMode = '0') {
        } // END - if
 
        // Is there a valid session?
-       if ((!isSessionValid()) && (!isSpider())) {
+       if ((!isValidSession()) && (!isSpider())) {
                // Determine right separator
                $separator = '&';
                if (!isInString('?', $url)) {
@@ -2526,7 +2526,7 @@ function memberEditEntriesConfirm ($tableName, $columns = array(), $filterFuncti
 // Delete rows by given id numbers
 function memberDeleteEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $deleteNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid'), $cacheFiles = array(), $content = array()) {
        // Do this only for members
-       assert(isMember());
+       assert(isMember(), 'isMember()=false which is not expected.');
 
        // $tableName must be an array
        if ((!is_array($tableName)) || (count($tableName) != 1)) {
@@ -2569,7 +2569,7 @@ function memberDeleteEntriesConfirm ($tableName, $columns = array(), $filterFunc
 // @TODO cacheFiles is not yet supported
 function memberListBuilder ($listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId = array('userid'), $content = array()) {
        // Do this only for logged in member
-       assert(isMember());
+       assert(isMember(), 'isMember()=false which is not expected.');
 
        // Call inner (general) function
        doGenericListBuilder('member', $listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId, $content);
@@ -2647,7 +2647,7 @@ function caluculateTimeUnitValue ($seconds, $timeUnit) {
 // "Getter" for an array from given one but only one index of it
 function getArrayFromArrayIndex ($array, $key) {
        // Some simple validation
-       assert(isset($array[0][$key]));
+       assert(isset($array[0][$key]), 'array[0][' . $key . '] is not set.');
 
        // Init new array
        $newArray = array();