+// Calculates percentage
+function calculatePercentageRate ($current, $total) {
+ // Default is zero
+ $rate = '0.0';
+
+ // Is sent larger zero? (Prevents division-by-zero)
+ if ($total > 0) {
+ // Calculate it (it should be "translated" alter on)
+ $rate = ($current / $total * 100);
+ } // END - if
+
+ // The should be a .0 at the end?
+ if (strpos($rate, '.') === FALSE) {
+ // No, then add it
+ $rate .= '.0';
+ } // END - if
+
+ // Return it
+ return $rate;
+}
+
+// Checks whether an array is filled with entries
+function isFilledArray ($array) {
+ // Determine it
+ return ((is_array($array)) && (count($array) > 0));
+}
+
+// Checks whether this script runs on a developer system (called with localhost/127.0.0.1 SERVER_NAME)
+function isDeveloperSystem () {
+ // Determine it
+ return in_array(detectServerName(), array('localhost', 'daedalus', '127.0.0.1'));
+}
+
+// Checks whether given subject line has '_ref' suffix
+function ifSubjectHasReferralSuffix ($subject) {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__][$subject])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__][$subject] = (substr($subject, -4, 4) == '_ref');
+ } // END - if
+
+ // Return cache
+ 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;
+}
+
+// Getter for full (generic) hash file name
+function getGenericHashFileName () {
+ // Return result
+ return sprintf('%s%s.%s%s', getPath(), getCachePath(), getFileHash(), getCacheExtension());
+}
+
+// "Compiles" the given value and sets it in given key
+function setSessionCompiled ($key, $value) {
+ // Debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key[]=' . gettype($key) . ',value[]=' . gettype($value));
+
+ // Is the value not an array?
+ if (!is_array($value)) {
+ // "Compile" the value
+ $value = doFinalCompilation(compileRawCode($value));
+ } // END - if
+
+ // And set it
+ return setSession($key, $value);
+}
+
+// Does normal bootstrap
+function doNormalBootstrap () {
+ // Load configuration file(s) here
+ loadIncludeOnce('inc/load_config.php');
+
+ // Load database layer here
+ loadIncludeOnce('inc/db/lib.php');
+
+ // Init message system
+ initMessages();
+
+ // CSS array
+ initExtensionCssFiles();
+
+ // Initialize SQL link
+ initSqlLink();
+}
+