Fixed logfile writing in installation phase, .revision is now ignored
[mailer.git] / inc / libs / refback_functions.php
index 6f45e9307e30ab8ed00e912a907af81d85c5dfc9..2f85181857eb50affc0089a129dce69f0a84f467 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Funktionen fuer Refback-Erweiterung              *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision:: 856                                                    $ *
+ * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009)              $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author:: stelzi                                                   $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
@@ -47,16 +52,17 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
        $return = $points;
 
        // Get all ref levels
-       $result_refs = SQL_QUERY("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level > 0 ORDER BY level ASC", __FUNCTION__, __LINE__);
+       $result_refs = SQL_QUERY("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level > 0 ORDER BY level ASC",
+               __FUNCTION__, __LINE__);
 
        // "Walk" through all level
-       while (list($level, $perc) = SQL_FETCHROW($result_refs)) {
+       while ($content = SQL_FETCHARRAY($result_refs)) {
                // Reset ref depths
                unset($GLOBALS['ref_level']);
 
                // "Walk" through all refids
-               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},level={$level},points={$points}<br />\n";
-               foreach (GET_REFBACK_USERID_ARRAY($uid, $level) as $refid) {
+               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},level={$content['level']},points={$points}<br />\n";
+               foreach (GET_REFBACK_USERID_ARRAY($uid, $content['level']) as $refid) {
                        // Skip level zero or if both are the same
                        if ($uid == $refid) continue;
 
@@ -66,9 +72,9 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
 
                        // Some percents given?
                        if ($percents > 0) {
-                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):points={$points},perc={$perc},percents={$percents},level={$level}<br />\n";
+                               //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):points={$points},perc={$content['percents']},percents={$percents},level={$content['level']}<br />\n";
                                // Calculate points for refback
-                               $refback = $points * ($perc / 100) * ($percents / 100);
+                               $refback = $points * ($content['percents'] / 100) * ($percents / 100);
 
                                // Update refback table ("refid" and "uid" must be exchanged!)
                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_refs` SET points=points+%s WHERE userid=%s AND refid=%s LIMIT 1",
@@ -82,7 +88,7 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
                                // Reduce points if refid is found
                                if ($refid == $ref) {
                                        // Reduce points here!
-                                       $return = $points * ($perc / 100) - $refback;
+                                       $return = $points * ($content['percents'] / 100) - $refback;
                                        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):points={$return} - REDUCED<br />\n";
                                } // END - if
                        } // END - if
@@ -151,9 +157,9 @@ ORDER BY userid ASC",
        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):numRows=".SQL_NUMROWS($result)."<br />\n";
        if (SQL_NUMROWS($result) > 0) {
                // Add all
-               while (list($userid) = SQL_FETCHROW($result)) {
-                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):rid={$rid},level={$level},userid={$userid}<br />\n";
-                       $userIds[] = $userid;
+               while ($content = SQL_FETCHARRAY($result)) {
+                       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):rid={$rid},level={$level},userid={$content['userid']}<br />\n";
+                       $userIds[] = $content['userid'];
                } // END - while
        } // END - if
 
@@ -167,7 +173,7 @@ ORDER BY userid ASC",
 }
 
 // Update "refback table"
-function UPDATE_REFBACK_TABLE($uid) {
+function UPDATE_REFBACK_TABLE ($uid) {
        //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
        // Make it sure referal level zero (member him-/herself) is at least selected
        if (empty($GLOBALS['cache_array']['back_level'])) $GLOBALS['cache_array']['back_level'] = 1;