// Is the file writeable?
if ((isFileReadable($FQFN)) && (!is_writeable($FQFN)) && (!changeMode($FQFN, 0644))) {
// Not writeable!
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("File %s not writeable or cannot change CHMOD to 0644.", basename($FQFN)));
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf('File %s not writeable or cannot change CHMOD to 0644.', basename($FQFN)));
// Failed! :(
return FALSE;
reportBug(__FUNCTION__, __LINE__, 'No arrays provided!');
} elseif (!is_array($array1)) {
// Left one is not an array
- reportBug(__FUNCTION__, __LINE__, sprintf("array1 is not an array. array != %s", gettype($array1)));
+ reportBug(__FUNCTION__, __LINE__, sprintf('array1 is not an array. array != %s', gettype($array1)));
} elseif (!is_array($array2)) {
// Right one is not an array
- reportBug(__FUNCTION__, __LINE__, sprintf("array2 is not an array. array != %s", gettype($array2)));
+ reportBug(__FUNCTION__, __LINE__, sprintf('array2 is not an array. array != %s', gettype($array2)));
}
// Maintain index of array2?
}
// Checks whether the cache instance is valid
-function isCacheInstanceValid () {
+function isValidCacheInstance () {
// Is there cache?
if (!isset($GLOBALS[__FUNCTION__])) {
// Determine it
// Checks if the user data is valid, this may indicate that the user has logged
// in, but you should use isMember() if you want to find that out.
-function isUserDataValid () {
+function isValidUserData () {
// User id should not be zero so abort here
if (!isCurrentUserIdSet()) {
// Debug message, may be noisy
// Wrapper for str_pad() with left padding zeros
function padLeftZero ($str, $amount = 2) {
// Is str_pad() there?
- if (function_exists('str_pad')) {
+ if (!function_exists('str_pad')) {
// Use prependZeros()
return prependZeros($str, $amount);
} else {
return $GLOBALS[__FUNCTION__][$subject];
}
+// Converts an API response to an associative array
+function convertApiResponseToArray ($responseString, $keyDelimiter, $valueDelimiter) {
+ // Explode for key delimiter
+ $keys = explode($keyDelimiter, $responseString);
+
+ // Init returned array and "walk" through all entries
+ $returned = array();
+ foreach ($keys as $keyValue) {
+ // Explode it
+ $parts = explode($valueDelimiter, $keyValue);
+
+ // Count must be 2
+ assert(count($parts) == 2);
+
+ // Then add both: 0=key, 1=value
+ $returned[sqlEscapeString($parts[0])] = sqlEscapeString($parts[1]);
+ } // END - if
+
+ // Return finished array
+ return $returned;
+}
+
// [EOF]
?>