Surfbar extended (dummy), user list now displays total points, locked points, click...
authorRoland Häder <roland@mxchange.org>
Thu, 18 Sep 2008 19:47:38 +0000 (19:47 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 18 Sep 2008 19:47:38 +0000 (19:47 +0000)
inc/databases.php
inc/extensions/ext-birthday.php
inc/language/de.php
inc/language/surfbar_de.php
inc/libs/surfbar_functions.php
inc/modules/admin/what-list_user.php
inc/modules/member/what-surfbar_list.php
templates/de/html/admin/admin_list_user_row.tpl

index 51488df..5d16141 100644 (file)
@@ -113,7 +113,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "356");
+define('CURR_SVN_REVISION', "357");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 9cf08d6..0c4d8d8 100644 (file)
@@ -178,7 +178,7 @@ PRIMARY KEY(id)
                $UPDATE_NOTES = "Hash-Erstellung von <STRONG>md5()</STRONG> auf bessere Funktion <STRONG>generateHash()</STRONG> umgestellt.";
                break;
 
-       case "0.3.9": // SQL queries for v0.3.8
+       case "0.3.9": // SQL queries for v0.3.9
                $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` CHANGE `birth_day` `birth_day` SMALLINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT '01',
 CHANGE `birth_month` `birth_month` SMALLINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT '01',
 CHANGE `birth_year` `birth_year` SMALLINT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT '1970'";
index 444acba..9a8bb2d 100644 (file)
@@ -1119,6 +1119,7 @@ define('ADMIN_CONFIG_PROXY_USERNAME', "Benuztername (falls vorhanden):");
 define('ADMIN_CONFIG_PROXY_PASSWORD', "Passwort (falls vorhanden):");
 define('EDIT_ENTRIES', "Eintr&auml;ge &auml;ndern");
 define('_CATEGORY_NONE', "Keine Kategorie");
+define('__UNUSED', "Im Aufbau");
 
 define('ADMIN_SEND_RESET_LINK_TITLE', "1/4: Administratorkennwort zur&uuml;cksetzen");
 define('ADMIN_VALIDATE_HASH_TITLE', "2/4: Validierung Iher Logindaten");
index 87c0608..9ec11ed 100644 (file)
@@ -89,6 +89,7 @@ define('MEMBER_SURFBAR_URL_ADDED', "URL hinzugef&uuml;gt und wartet auf Freischa
 define('MEMBER_SURFBAR_URL_NOT_ADDED', "URL konnte nicht hinzugef&uuml;gt werden, da ein Fehler vorliegt.");
 define('MEMBER_SURFBAR_ADD_URL', "URL in Surfbar buchen");
 define('MEMBER_SURFBAR_NO_MORE_ALLOWED', "Sie k&ouml;nnen leider nicht mehr URLs in der Surfbar buchen, da Sie das Maximum erreicht haben.");
+define('MEMBER_SURFBAR_NO_URLS_FOUND', "Sie haben noch keine URLs f&uuml;r die Surfbar gebucht.");
 
 // Subject lines for admins
 define('ADMIN_SURFBAR_NOTIFY_URL_UNLOCK_SUBJECT', "URL in Surfbar gebucht");
index a7471a6..e235ce1 100644 (file)
@@ -903,6 +903,33 @@ GROUP BY sbu.id", __FILE__, __LINE__);
        // Return value
        return $maxRand;
 }
+// Load all URLs of the current user and return it as an array
+function SURFBAR_GET_USER_URLS () {
+       // Init array
+       $URLs = array();
+
+       // Begin the query
+       $result = SQL_QUERY_ESC("SELECT u.id, u.url, u.views_total, u.status, UNIX_TIMESTAMP(u.registered) AS registered, UNIX_TIMESTAMP(u.last_locked) AS last_locked, u.lock_reason AS lock_reason
+FROM "._MYSQL_PREFIX."_surfbar_urls AS u
+WHERE u.userid=%s
+ORDER BY u.id ASC",
+               array($GLOBALS['userid']), __FILE__, __LINE__);
+
+       // Are there entries?
+       if (SQL_NUMROWS($result) > 0) {
+               // Load all rows
+               while ($row = SQL_FETCHARRAY($result)) {
+                       // Add the row
+                       $URLs[$row['id']] = $row;
+               } // END - while
+       } // END - if
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return the array
+       return $URLs;
+}
 // Determine next id for surfbar or get data for given id, always call this before you call other
 // getters below this function!!!
 function SURFBAR_DETERMINE_NEXT_ID ($id = 0) {
index 95845f4..5a2cd5e 100644 (file)
@@ -50,7 +50,7 @@ if (!empty($_GET['mode'])) {
        // Set title according to the "mode"
        $eval = sprintf("\$listHeader = ADMIN_LIST_%s_ACCOUNTS;", strtoupper(SQL_ESCAPE($_GET['mode'])));
        eval($eval);
-}
+} // END - if
 
 // Remember it
 define('__TITLE', $listHeader);
@@ -63,20 +63,18 @@ if (empty($_GET['sortby'])) { $_GET['sortby'] = "userid"; }
 if (empty($_GET['page']))   { $_GET['page']   = "1";      }
 
 // Set base URL
-$BASE = "<A href=\"".URL."/modules.php?module=admin";
+$BASE = "[<A href=\"".URL."/modules.php?module=admin";
 
-if (!empty($_GET['u_id']))
-{
+if (!empty($_GET['u_id'])) {
        // Secure the user ID
        $uid = bigintval($_GET['u_id']);
 
-       // Does the account exists?       0      1        2         3      4     5      6       7         8          9          10           11           12         13     14         15           16          17            18           19           20           21        22        23             24              25         26
+       // Does the account exists?        0      1        2         3       4     5      6       7         8          9          10           11           12         13     14         15           16          17            18           19           20           21        22        23             24              25         26
        $result = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, zip, city, country, email, birth_day, birth_month, birth_year, max_mails, receive_mails, refid, status, REMOTE_ADDR, last_online, last_module, ref_clicks, total_logins, used_points, emails_sent, joined, last_update, last_profile_sent, notified, ref_payout".$MORE."
 FROM "._MYSQL_PREFIX."_user_data
 WHERE userid=%s LIMIT 1",
         array($uid), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 1)
-       {
+       if (SQL_NUMROWS($result) == 1) {
                // Account found!
                $DATA  = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
@@ -85,11 +83,11 @@ WHERE userid=%s LIMIT 1",
                $CATS  = GET_TOTAL_DATA($uid, "user_cats", "id", "userid", true);
                $LINKS = GET_TOTAL_DATA($uid, "user_links", "id", "userid", true);
 
-               if ($LINKS > 0) $LINKS = $BASE."&amp;what=list_links&amp;u_id=".$uid."\">".$LINKS."</A>";
-               if ($DATA[13] > 0) $DATA[13] = str_replace(("u_id=".$uid), ("u_id=".$DATA[13]), $BASE."&amp;what=list_user\">".$DATA[13]."</A>");
+               if ($LINKS > 0) $LINKS = $BASE."&amp;what=list_links&amp;u_id=".$uid."\">".$LINKS."</A>]";
+               if ($DATA[13] > 0) $DATA[13] = str_replace(("u_id=".$uid), ("u_id=".$DATA[13]), $BASE."&amp;what=list_user\">".$DATA[13]."</A>]");
                if (empty($DATA[17])) $DATA[17] = "---";
-               if ($REFS > 0)  $REFS = $BASE."&amp;what=list_refs&amp;u_id=".$uid."\">".$REFS."</A></STRONG>";
-               if ($CATS > 0) $CATS = $BASE."&amp;what=list_cats&amp;u_id=".$uid."\">".$CATS."</A>";
+               if ($REFS > 0) $REFS = $BASE."&amp;what=list_refs&amp;u_id=".$uid."\">".$REFS."</A>]";
+               if ($CATS > 0) $CATS = $BASE."&amp;what=list_cats&amp;u_id=".$uid."\">".$CATS."</A>]";
 
                // Prepare data for template
                define('_BIRTHDAY', MAKE_DATETIME(mktime(0, 0, 0, $DATA[9], $DATA[8], $DATA[10]), "3"));
@@ -102,7 +100,7 @@ WHERE userid=%s LIMIT 1",
                $DATA[14]     = TRANSLATE_STATUS($DATA[14]);
                $DATA[16]     = MAKE_DATETIME($DATA[16], "0");
                $DATA[20]     = TRANSLATE_COMMA($DATA[20]);
-               if ($DATA[21] > 0) $DATA[21] = $BASE."&amp;what=email_details&amp;u_id=".$uid."\">".$DATA[21]."</A>";
+               if ($DATA[21] > 0) $DATA[21] = $BASE."&amp;what=email_details&amp;u_id=".$uid."\">".TRANSLATE_COMMA($DATA[21])."</A>]";
                $DATA[22]     = MAKE_DATETIME($DATA[22], "0");
                $DATA[23]     = MAKE_DATETIME($DATA[23], "0");
                $DATA[24]     = MAKE_DATETIME($DATA[24], "0");
@@ -118,21 +116,16 @@ WHERE userid=%s LIMIT 1",
 
                // Template laden
                LOAD_TEMPLATE("admin_user_details", false, $uid);
-       }
-        else
-       {
+       } else {
                // Account does not exists!
                LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_404_1.$uid.ADMIN_MEMBER_404_2);
        }
-}
- else
-{
+} else {
        $whereStatement = "";
-       if (($_GET['letter'] != _ALL2) && ($_GET['letter'] != _OTHERS) && (!empty($_GET['letter'])))
-       {
+       if (($_GET['letter'] != _ALL2) && ($_GET['letter'] != _OTHERS) && (!empty($_GET['letter']))) {
                // List only persons w
                $whereStatement = " WHERE family LIKE '".$_GET['letter']."%'";
-       }
+       } // END - if
        if ($_GET['sortby'] == "family_name") $_GET['sortby'] = "family";
 
        // Parse the mode parameter
@@ -145,16 +138,16 @@ WHERE userid=%s LIMIT 1",
                        // Start a new one
                        $whereStatement = sprintf(" WHERE status='%s'", SQL_ESCAPE(strip_tags(strtoupper($_GET['mode']))));
                }
-       }
+       } // END - if
 
-       $SQL = "SELECT userid, gender, surname, family, email, REMOTE_ADDR, refid, status".$MORE." FROM "._MYSQL_PREFIX."_user_data".$whereStatement." ORDER BY ".$_GET['sortby'];
+       $SQL = "SELECT userid, gender, surname, family, email, REMOTE_ADDR, refid, status, emails_sent, mails_confirmed, emails_received".$MORE." FROM "._MYSQL_PREFIX."_user_data".$whereStatement." ORDER BY ".$_GET['sortby'];
        $result_master = SQL_QUERY($SQL, __FILE__, __LINE__);
 
        // Calculate page count (0.5 fixes a bug with page count)
        if ($_CONFIG['user_limit'] == 0) {
                $_CONFIG['user_limit'] = 100;
                LOAD_TEMPLATE("admin_settings_saved", false, EXTENSION_WARNING_USER_LIMIT);
-       }
+       } // END - if
 
        // Activate the extension please!
        $PAGES = round(SQL_NUMROWS($result_master) / $_CONFIG['user_limit'] + 0.5);
@@ -170,8 +163,7 @@ WHERE userid=%s LIMIT 1",
        $user_count = SQL_NUMROWS($result_user);
        SQL_FREERESULT($result_user);
 
-       if (SQL_NUMROWS($result_master) > 0)
-       {
+       if (SQL_NUMROWS($result_master) > 0) {
                // Free memory
                SQL_FREERESULT($result_master);
 
@@ -208,15 +200,25 @@ WHERE userid=%s LIMIT 1",
                }
 
                $SW = 2; $OUT = "";
-               while (list($uid, $gender, $sname, $fname, $email, $IP, $ref, $status, $nick) = SQL_FETCHROW($result))
-               {
+               while (list($uid, $gender, $sname, $fname, $email, $IP, $ref, $status, $emails_sent, $mails_confirmed, $emails_received, $nick) = SQL_FETCHROW($result)) {
                        if ($ref > 0) $ref = ADMIN_USER_PROFILE_LINK($ref);
-                       $LINKS = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_links", "id", "userid", true));
-                       if ($LINKS > 0) $LINKS = $BASE."&amp;what=list_links&amp;u_id=".$uid."\">".$LINKS."</A>";
+                       $LINKS = GET_TOTAL_DATA($uid, "user_links", "id", "userid", true);
+                       $SENT = $emails_sent;
+                       if ($emails_sent > 0) $SENT = $BASE."&amp;what=email_details&amp;u_id=".$uid."\">".TRANSLATE_COMMA($emails_sent)."</A>]";
+                       if ($LINKS > 0) $LINKS = $BASE."&amp;what=list_links&amp;u_id=".$uid."\">".TRANSLATE_COMMA($LINKS)."</A>]";
 
                        // Add nickname
                        if (empty($nick) || $nick == $uid) $nick = "---";
 
+                       // Calculate total points
+                       $pointsTotal = GET_TOTAL_DATA($uid, "user_points", "points")  - GET_TOTAL_DATA($uid, "user_data", "used_points");
+
+                       // Clickrate
+                       $clickRate = 0;
+                       if ($emails_received > 0) {
+                               $clickRate = $mails_confirmed / $emails_received * 100;
+                       } // END - if
+
                        // Transfer data to array
                        $content = array(
                                'sw'     => $SW,
@@ -224,19 +226,23 @@ WHERE userid=%s LIMIT 1",
                                'gender' => TRANSLATE_GENDER($gender),
                                'sname'  => $sname,
                                'fname'  => $fname,
-                               'email'  => "<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</A>",
+                               'email'  => "<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</A>]",
                                'addr'   => $IP,
                                'ref'    => $ref,
                                'status' => TRANSLATE_STATUS($status),
                                'links'  => $LINKS,
                                'nick'   => $nick,
-                               'alinks' => MEMBER_ACTION_LINKS($uid, $status)
+                               'alinks' => MEMBER_ACTION_LINKS($uid, $status),
+                               'points' => TRANSLATE_COMMA($pointsTotal),
+                               'sent'   => $SENT,
+                               'rate'   => TRANSLATE_COMMA($clickRate),
+                               'locked' => TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "locked_points"))
                        );
 
                        // Load row template and switch colors
                        $OUT .= LOAD_TEMPLATE("admin_list_user_row", true, $content);
                        $SW = 3 - $SW;
-               }
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
@@ -248,9 +254,7 @@ WHERE userid=%s LIMIT 1",
 
                // Free some memory
                SQL_FREERESULT($result_master);
-       }
-        else
-       {
+       } else {
                // No one as registered so far! :-(
                LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_NONE_REGISTERED);
        }
index aa07ac6..0ebf9f9 100644 (file)
@@ -42,5 +42,30 @@ if (!defined('__SECURITY')) {
 // Add description as navigation point
 ADD_DESCR("member", basename(__FILE__));
 
+// Load user URLs
+$URLs = SURFBAR_GET_USER_URLS();
+
+// Are there entries?
+if (count($URLs) > 0) {
+       // List all URLs
+       $OUT = ""; $SW = 2;
+       foreach ($URLs as $id => $content) {
+               // "Translate"/insert data
+               $content['sw'] = $SW;
+
+               // Load row template
+               $OUT .= LOAD_TEMPLATE("member_surfbar_list_row", true, $content);
+
+               // Switch color
+               $SW = 3 - $SW;
+       } // END - if
+
+       // Load main template
+       LOAD_TEMPLATE("member_surfbar_list", false, $OUT);
+} else {
+       // No URLs booked so far
+       LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_SURFBAR_NO_URLS_FOUND);
+}
+
 //
 ?>
index 2dd71cf..377c383 100644 (file)
@@ -1,13 +1,9 @@
 <TR>
        <TD width="5" class="switch_sw$content[sw] top2 seperator">&nbsp;</TD>
-       <TD width="20%" align="center"
-               class="right2 top2 switch_sw$content[sw]"><STRONG>{--_UID--}:</STRONG></TD>
-       <TD width="20%" align="center"
-               class="right2 top2 switch_sw$content[sw]"><STRONG>{--GENDER--}:</STRONG></TD>
-       <TD width="20%" align="center"
-               class="right2 top2 switch_sw$content[sw]"><STRONG>{--SURNAME--}:</STRONG></TD>
-       <TD width="20%" align="center"
-               class="right2 top2 switch_sw$content[sw]"><STRONG>{--FAMILY_NAME--}:</STRONG></TD>
+       <TD width="20%" align="center" class="right2 top2 switch_sw$content[sw]"><STRONG>{--_UID--}:</STRONG></TD>
+       <TD width="20%" align="center" class="right2 top2 switch_sw$content[sw]"><STRONG>{--GENDER--}:</STRONG></TD>
+       <TD width="20%" align="center" class="right2 top2 switch_sw$content[sw]"><STRONG>{--SURNAME--}:</STRONG></TD>
+       <TD width="20%" align="center" class="right2 top2 switch_sw$content[sw]"><STRONG>{--FAMILY_NAME--}:</STRONG></TD>
        <TD width="20%" align="center" class="switch_sw$content[sw] top2"><STRONG>{--USER_NICKNAME--}:</STRONG></TD>
 </TR>
 <TR>
        <TD align="center" class="switch_sw$content[sw] bottom2">$content[links]</TD>
 </TR>
 <TR>
+       <TD width="5" class="switch_sw$content[sw] seperator">&nbsp;</TD>
+       <TD align="center" class="right2 switch_sw$content[sw]"><STRONG>{--TOTAL_POINTS--}:</STRONG></TD>
+       <TD align="center" class="right2 switch_sw$content[sw]"><STRONG>{--MAILS_SENT--}:</STRONG></TD>
+       <TD align="center" class="right2 switch_sw$content[sw]"><STRONG>{--CLICK_RATE--}:</STRONG></TD>
+       <TD align="center" class="right2 switch_sw$content[sw]"><STRONG>{--POINTS_LOCKED--}:</STRONG></TD>
+       <TD align="center" class="switch_sw$content[sw]"><STRONG>{--__UNUSED--}:</STRONG></TD>
+</TR>
+<TR>
+       <TD class="switch_sw$content[sw] seperator bottom2" width="5">&nbsp;</TD>
+       <TD align="center" class="right2 switch_sw$content[sw] bottom2">$content[points] {!POINTS!}</TD>
+       <TD align="center" class="right2 switch_sw$content[sw] bottom2">$content[sent]</TD>
+       <TD align="center" class="right2 switch_sw$content[sw] bottom2">$content[rate]%</TD>
+       <TD align="center" class="right2 switch_sw$content[sw] bottom2">$content[locked] {!POINTS!}</TD>
+       <TD align="center" class="switch_sw$content[sw] bottom2">---</TD>
+</TR>
+<TR>
        <TD height="22" colspan="6" class="admin_title">$content[alinks]</TD>
 </TR>