]> git.mxchange.org Git - mailer.git/blobdiff - inc/wrapper-functions.php
Renamed function so it might be more understandable
[mailer.git] / inc / wrapper-functions.php
index 7480bb4cf9aaf48f43df58e007bb23f72690243a..4c3e4a8c0e835c630b338c1dc3677e731c6ae04a 100644 (file)
@@ -14,8 +14,6 @@
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
@@ -807,7 +805,7 @@ function initUserData () {
        // User id should not be zero
        if (!isValidUserId(getCurrentUserId())) {
                // Should be always valid
-               debug_report_bug(__FUNCTION__, __LINE__, 'User id is zero.');
+               debug_report_bug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . getCurrentUserId());
        } // END - if
 
        // Init the user
@@ -819,7 +817,7 @@ function getUserData ($column) {
        // User id should not be zero
        if (!isValidUserId(getCurrentUserId())) {
                // Should be always valid
-               debug_report_bug(__FUNCTION__, __LINE__, 'User id is zero.');
+               debug_report_bug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . getCurrentUserId());
        } // END - if
 
        // Return the value
@@ -834,7 +832,7 @@ function getUserDataArray () {
        // Is the current userid valid?
        if (!isValidUserId($userid)) {
                // Should be always valid
-               debug_report_bug(__FUNCTION__, __LINE__, 'User id is invalid.');
+               debug_report_bug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . $userid);
        } // END - if
 
        // Get the whole array if found
@@ -947,6 +945,13 @@ function setHttpStatus ($status) {
 
 // Getter for HTTP status
 function getHttpStatus () {
+       // Is the status set?
+       if (!isset($GLOBALS['http_status'])) {
+               // Abort here
+               debug_report_bug(__FUNCTION__, __LINE__, 'No HTTP status set!');
+       } // END - if
+
+       // Return it
        return $GLOBALS['http_status'];
 }
 
@@ -1105,8 +1110,11 @@ function getYear ($timestamp = null) {
 function getMonth ($timestamp = null) {
        // Is it cached?
        if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
-               // null is time()
-               if (is_null($timestamp)) $timestamp = time();
+               // If null is set, use time()
+               if (is_null($timestamp)) {
+                       // Use time() which is current timestamp
+                       $timestamp = time();
+               } // END - if
 
                // Then create it
                $GLOBALS[__FUNCTION__][$timestamp] = date('m', $timestamp);
@@ -1319,7 +1327,7 @@ function isRandomReferalIdEnabled () {
        // Do we have cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Determine it
-               $GLOBALS[__FUNCTION__] = (getConfig('select_user_zero_refid') == 'Y');
+               $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('user', '0.3.4')) && (getConfig('select_user_zero_refid') == 'Y'));
        } // END - if
 
        // Return cache
@@ -1338,6 +1346,18 @@ function getDefaultLanguage () {
        return $GLOBALS[__FUNCTION__];
 }
 
+// "Getter" for default referal id
+function getDefRefid () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('def_refid');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // "Getter" for path
 function getPath () {
        // Do we have cache?
@@ -1495,11 +1515,11 @@ function getTitle () {
 }
 
 // "Getter" for curr_svn_revision
-function getCurrSvnRevision () {
+function getCurrentRepositoryRevision () {
        // Do we have cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Determine it
-               $GLOBALS[__FUNCTION__] = getConfig('CURR_SVN_REVISION');
+               $GLOBALS[__FUNCTION__] = getConfig('CURRENT_REPOSITORY_REVISION');
        } // END - if
 
        // Return cache
@@ -1842,6 +1862,90 @@ function getOneDay () {
        return $GLOBALS[__FUNCTION__];
 }
 
+// "Getter" for activate_xchange
+function getActivateXchange () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('activate_xchange');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for img_type
+function getImgType () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('img_type');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for code_length
+function getCodeLength () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('code_length');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for least_cats
+function getLeastCats () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('least_cats');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for pass_len
+function getPassLen () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('pass_len');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for admin_menu
+function getAdminMenu () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('admin_menu');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for last_month
+function getLastMonth () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('last_month');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // Checks wether proxy configuration is used
 function isProxyUsed () {
        // Do we have cache?
@@ -1950,5 +2054,25 @@ function generateWrappedUserEmailLink ($email) {
        return generateEmailLink($email, 'user_data');
 }
 
+// Wrapper to check if user points are locked
+function ifUserPointsLocked ($userid) {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__][$userid])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__][$userid] = ((getFetchedUserData('userid', $userid, 'ref_payout') > 0) && (!isDirectPaymentEnabled()));
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__][$userid];
+}
+
+// Appends a line to an existing file or creates it instantly with given content.
+// This function does always add a new-line character to every line.
+function appendLineToFile ($file, $line) {
+       $fp = fopen($file, 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write to file ' . basename($file) . '!');
+       fwrite($fp, $line . "\n");
+       fclose($fp);
+}
+
 // [EOF]
 ?>