* -------------------------------------------------------------------- *
* Kurzbeschreibung : Wrapper-Funktionen *
* -------------------------------------------------------------------- *
- * $Revision:: $ *
- * $Date:: $ *
- * $Tag:: 0.2.1-FINAL $ *
- * $Author:: $ *
- * -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2013 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
return (getenv('SERVER_NAME'));
}
+// Detects server protocol (http/s)
+function detectServerProtocol () {
+ // Is cache there?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Default is HTTP
+ $GLOBALS[__FUNCTION__] = 'http';
+
+ // Are some specific fields set?
+ if (((isset($_SERVER['HTTPS'])) && (strtolower($_SERVER['HTTPS']) == 'on')) || ((isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) && (strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https'))) {
+ // Switch to HTTPS
+ $GLOBALS[__FUNCTION__] = 'https';
+ } // END - if
+ } // END - if
+
+ // Return cached value
+ return $GLOBALS[__FUNCTION__];
+}
+
// Removes any existing www. from SERVER_NAME. This is very silly but enough
// for our purpose here.
function detectDomainName () {
// Set session
$status = setSession('admin_md5', $adminMd5);
+ // Remove cache to get correct results
+ unset($GLOBALS['isAdmin']);
+
// Return status
return $status;
}
* @access private
*/
function sendRawRedirect ($url) {
+ //* DEBUG-DIE */ die(__METHOD__ . ':url=' . $url);
+
// Clear output buffer
clearOutputBuffer();
// Revert entity &
$url = str_replace('&', '&', $url);
+ //* DEBUG-DIE */ die(__METHOD__ . ':url=' . $url);
// check if running on IIS < 6 with CGI-PHP
if ((isset($_SERVER['SERVER_SOFTWARE'])) && (isset($_SERVER['GATEWAY_INTERFACE'])) &&
return $str;
}
-// "Getter" for date from patch_ctime
-function getDateFromRepository () {
- // Is it cached?
- if (!isset($GLOBALS[__FUNCTION__])) {
- // Then set it
- $GLOBALS[__FUNCTION__] = generateDateTime(getConfig('CURRENT_REPOSITORY_DATE'), '5');
- } // END - if
-
- // Return cache
- return $GLOBALS[__FUNCTION__];
-}
-
-// "Getter" for date/time from patch_ctime
-function getDateTimeFromRepository () {
- // Is it cached?
- if (!isset($GLOBALS[__FUNCTION__])) {
- // Then set it
- $GLOBALS[__FUNCTION__] = generateDateTime(getConfig('CURRENT_REPOSITORY_DATE'), '2');
- } // END - if
-
- // Return cache
- return $GLOBALS[__FUNCTION__];
-}
-
// Getter for current year (default)
function getYear ($timestamp = NULL) {
// Is it cached?
return $GLOBALS[__FUNCTION__];
}
+// "Getter" for cache_extension
+function getCacheExtension () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('CACHE_EXTENSION');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
// "Getter" for WRITE_FOOTER
function getWriteFooter () {
// Is there cache?
return $GLOBALS[__FUNCTION__];
}
+// "Getter" for db_type
+function getDbType () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('_DB_TYPE');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
// "Getter" for salt_length
function getSaltLength () {
// Is there cache?
return $GLOBALS[__FUNCTION__];
}
-// "Getter" for curr_svn_revision
-function getCurrentRepositoryRevision () {
- // Is there cache?
- if (!isset($GLOBALS[__FUNCTION__])) {
- // Determine it
- $GLOBALS[__FUNCTION__] = getConfig('CURRENT_REPOSITORY_REVISION');
- } // END - if
-
- // Return cache
- return $GLOBALS[__FUNCTION__];
-}
-
// "Getter" for server_url
function getServerUrl () {
// Is there cache?
// 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', '127.0.0.1'));
+ return in_array(detectServerName(), array('localhost', 'daedalus', '127.0.0.1'));
}
// Checks whether given subject line has '_ref' suffix
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);
+}
+
// [EOF]
?>