From: Roland Häder Date: Thu, 18 Sep 2008 19:47:38 +0000 (+0000) Subject: Surfbar extended (dummy), user list now displays total points, locked points, click... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=78dc19b40041f126eede57575484c684d5fd0ddb;p=mailer.git Surfbar extended (dummy), user list now displays total points, locked points, click rate (%) and mails sent per user --- diff --git a/inc/databases.php b/inc/databases.php index 51488df931..5d161415fa 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -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); diff --git a/inc/extensions/ext-birthday.php b/inc/extensions/ext-birthday.php index 9cf08d661e..0c4d8d80d1 100644 --- a/inc/extensions/ext-birthday.php +++ b/inc/extensions/ext-birthday.php @@ -178,7 +178,7 @@ PRIMARY KEY(id) $UPDATE_NOTES = "Hash-Erstellung von md5() auf bessere Funktion generateHash() 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'"; diff --git a/inc/language/de.php b/inc/language/de.php index 444acba336..9a8bb2df22 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1119,6 +1119,7 @@ define('ADMIN_CONFIG_PROXY_USERNAME', "Benuztername (falls vorhanden):"); define('ADMIN_CONFIG_PROXY_PASSWORD', "Passwort (falls vorhanden):"); define('EDIT_ENTRIES', "Einträge ändern"); define('_CATEGORY_NONE', "Keine Kategorie"); +define('__UNUSED', "Im Aufbau"); define('ADMIN_SEND_RESET_LINK_TITLE', "1/4: Administratorkennwort zurücksetzen"); define('ADMIN_VALIDATE_HASH_TITLE', "2/4: Validierung Iher Logindaten"); diff --git a/inc/language/surfbar_de.php b/inc/language/surfbar_de.php index 87c06086f3..9ec11edd8c 100644 --- a/inc/language/surfbar_de.php +++ b/inc/language/surfbar_de.php @@ -89,6 +89,7 @@ define('MEMBER_SURFBAR_URL_ADDED', "URL hinzugefügt und wartet auf Freischa define('MEMBER_SURFBAR_URL_NOT_ADDED', "URL konnte nicht hinzugefügt werden, da ein Fehler vorliegt."); define('MEMBER_SURFBAR_ADD_URL', "URL in Surfbar buchen"); define('MEMBER_SURFBAR_NO_MORE_ALLOWED', "Sie kö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ür die Surfbar gebucht."); // Subject lines for admins define('ADMIN_SURFBAR_NOTIFY_URL_UNLOCK_SUBJECT', "URL in Surfbar gebucht"); diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index a7471a6a53..e235ce19cb 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -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) { diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index 95845f42ab..5a2cd5ebaa 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -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 = " 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS.""; - if ($DATA[13] > 0) $DATA[13] = str_replace(("u_id=".$uid), ("u_id=".$DATA[13]), $BASE."&what=list_user\">".$DATA[13].""); + if ($LINKS > 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS."]"; + if ($DATA[13] > 0) $DATA[13] = str_replace(("u_id=".$uid), ("u_id=".$DATA[13]), $BASE."&what=list_user\">".$DATA[13]."]"); if (empty($DATA[17])) $DATA[17] = "---"; - if ($REFS > 0) $REFS = $BASE."&what=list_refs&u_id=".$uid."\">".$REFS.""; - if ($CATS > 0) $CATS = $BASE."&what=list_cats&u_id=".$uid."\">".$CATS.""; + if ($REFS > 0) $REFS = $BASE."&what=list_refs&u_id=".$uid."\">".$REFS."]"; + if ($CATS > 0) $CATS = $BASE."&what=list_cats&u_id=".$uid."\">".$CATS."]"; // 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."&what=email_details&u_id=".$uid."\">".$DATA[21].""; + if ($DATA[21] > 0) $DATA[21] = $BASE."&what=email_details&u_id=".$uid."\">".TRANSLATE_COMMA($DATA[21])."]"; $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."&what=list_links&u_id=".$uid."\">".$LINKS.""; + $LINKS = GET_TOTAL_DATA($uid, "user_links", "id", "userid", true); + $SENT = $emails_sent; + if ($emails_sent > 0) $SENT = $BASE."&what=email_details&u_id=".$uid."\">".TRANSLATE_COMMA($emails_sent)."]"; + if ($LINKS > 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".TRANSLATE_COMMA($LINKS)."]"; // 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' => "".$email."", + 'email' => "".$email."]", '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); } diff --git a/inc/modules/member/what-surfbar_list.php b/inc/modules/member/what-surfbar_list.php index aa07ac6400..0ebf9f903f 100644 --- a/inc/modules/member/what-surfbar_list.php +++ b/inc/modules/member/what-surfbar_list.php @@ -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); +} + // ?> diff --git a/templates/de/html/admin/admin_list_user_row.tpl b/templates/de/html/admin/admin_list_user_row.tpl index 2dd71cfe8d..377c383c30 100644 --- a/templates/de/html/admin/admin_list_user_row.tpl +++ b/templates/de/html/admin/admin_list_user_row.tpl @@ -1,13 +1,9 @@   - {--_UID--}: - {--GENDER--}: - {--SURNAME--}: - {--FAMILY_NAME--}: + {--_UID--}: + {--GENDER--}: + {--SURNAME--}: + {--FAMILY_NAME--}: {--USER_NICKNAME--}: @@ -34,6 +30,22 @@ $content[status] $content[links] + +   + {--TOTAL_POINTS--}: + {--MAILS_SENT--}: + {--CLICK_RATE--}: + {--POINTS_LOCKED--}: + {--__UNUSED--}: + + +   + $content[points] {!POINTS!} + $content[sent] + $content[rate]% + $content[locked] {!POINTS!} + --- + $content[alinks]