Unlock of booked URLs in surfbar added, fix for URL-encoded links in loader module
authorRoland Häder <roland@mxchange.org>
Tue, 9 Sep 2008 00:36:48 +0000 (00:36 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 9 Sep 2008 00:36:48 +0000 (00:36 +0000)
17 files changed:
.gitattributes
inc/databases.php
inc/functions.php
inc/language/surfbar_de.php
inc/libs/surfbar_functions.php
inc/modules/admin/what-list_surfbar_urls.php
inc/modules/admin/what-unlock_surfbar_urls.php
inc/modules/frametester.php
inc/modules/loader.php
inc/mysql-manager.php
surfbar.php
templates/de/emails/admin/admin_surfbar_url_confirmed.tpl [new file with mode: 0644]
templates/de/emails/member/member_surfbar_url_confirmed.tpl [new file with mode: 0644]
templates/de/html/admin/admin_list_surfbar_urls.tpl
templates/de/html/admin/admin_list_surfbar_urls_row.tpl
templates/de/html/admin/admin_unlock_surfbar_urls.tpl [new file with mode: 0644]
templates/de/html/admin/admin_unlock_surfbar_urls_row.tpl [new file with mode: 0644]

index 858b7a8899c379804fb736d4c443a0cf48482d5e..09f59dacc6c87502584d11069b2d7e8437882a0d 100644 (file)
@@ -600,6 +600,7 @@ templates/de/emails/admin/admin_support-order.tpl -text
 templates/de/emails/admin/admin_support-ordr.tpl -text
 templates/de/emails/admin/admin_support-reflink.tpl -text
 templates/de/emails/admin/admin_support-unconfirmed.tpl -text
 templates/de/emails/admin/admin_support-ordr.tpl -text
 templates/de/emails/admin/admin_support-reflink.tpl -text
 templates/de/emails/admin/admin_support-unconfirmed.tpl -text
+templates/de/emails/admin/admin_surfbar_url_confirmed.tpl -text
 templates/de/emails/admin/admin_surfbar_url_reg.tpl -text
 templates/de/emails/admin/admin_surfbar_url_unlock.tpl -text
 templates/de/emails/admin/admin_transfer_ap.tpl -text
 templates/de/emails/admin/admin_surfbar_url_reg.tpl -text
 templates/de/emails/admin/admin_surfbar_url_unlock.tpl -text
 templates/de/emails/admin/admin_transfer_ap.tpl -text
@@ -665,6 +666,7 @@ templates/de/emails/member/member_support-order.tpl -text
 templates/de/emails/member/member_support-ordr.tpl -text
 templates/de/emails/member/member_support-reflink.tpl -text
 templates/de/emails/member/member_support-unconfirmed.tpl -text
 templates/de/emails/member/member_support-ordr.tpl -text
 templates/de/emails/member/member_support-reflink.tpl -text
 templates/de/emails/member/member_support-unconfirmed.tpl -text
+templates/de/emails/member/member_surfbar_url_confirmed.tpl -text
 templates/de/emails/member/member_surfbar_url_reg.tpl -text
 templates/de/emails/member/member_surfbar_url_unlock.tpl -text
 templates/de/emails/member/member_transfer_recipient.tpl -text
 templates/de/emails/member/member_surfbar_url_reg.tpl -text
 templates/de/emails/member/member_surfbar_url_unlock.tpl -text
 templates/de/emails/member/member_transfer_recipient.tpl -text
@@ -1029,6 +1031,8 @@ templates/de/html/admin/admin_unlock_emails_redir_row.tpl -text
 templates/de/html/admin/admin_unlock_emails_row.tpl -text
 templates/de/html/admin/admin_unlock_sponsor.tpl -text
 templates/de/html/admin/admin_unlock_sponsor_row.tpl -text
 templates/de/html/admin/admin_unlock_emails_row.tpl -text
 templates/de/html/admin/admin_unlock_sponsor.tpl -text
 templates/de/html/admin/admin_unlock_sponsor_row.tpl -text
+templates/de/html/admin/admin_unlock_surfbar_urls.tpl -text
+templates/de/html/admin/admin_unlock_surfbar_urls_row.tpl -text
 templates/de/html/admin/admin_update_download.tpl -text
 templates/de/html/admin/admin_user_details.tpl -text
 templates/de/html/admin/admin_validate_reset_hash_form.tpl -text
 templates/de/html/admin/admin_update_download.tpl -text
 templates/de/html/admin/admin_user_details.tpl -text
 templates/de/html/admin/admin_validate_reset_hash_form.tpl -text
index ba57bc56facc512fbc3913c54e79498ebc520b7e..2057f1310a87ff5ca64b9b94d7e2f29100efe658 100644 (file)
@@ -93,13 +93,10 @@ define('START_YDAY', MAKE_TIME(0, 0, 0, time() - ONE_DAY));
 define('START_TDAY', MAKE_TIME(0, 0, 0, time()));
 
 $COOKIES = substr(URL, strpos(substr(URL, 8), "/") + 8);
 define('START_TDAY', MAKE_TIME(0, 0, 0, time()));
 
 $COOKIES = substr(URL, strpos(substr(URL, 8), "/") + 8);
-if ((strpos($COOKIES, "/") == "0") && (strpos(substr(URL, 8), "/") > 0))
-{
+if ((strpos($COOKIES, "/") == "0") && (strpos(substr(URL, 8), "/") > 0)) {
        // Script was installed into a sub directory
        if (substr($COOKIES, -1) != "/") $COOKIES .= "/";
        // Script was installed into a sub directory
        if (substr($COOKIES, -1) != "/") $COOKIES .= "/";
-}
- else
-{
+} else {
        // No more sub directories added to URL
        $COOKIES = "/";
 }
        // No more sub directories added to URL
        $COOKIES = "/";
 }
index 8875dc134d41276bbe3eadd43b56c92eea7db455..0f4f995d6d2124d2ba368fc2164604d3d6b702fd 100644 (file)
@@ -198,6 +198,9 @@ function LOAD_TEMPLATE($template, $return=false, $content="") {
        // Add more variables which you want to use in your template files
        global $DATA, $_CONFIG, $username;
 
        // Add more variables which you want to use in your template files
        global $DATA, $_CONFIG, $username;
 
+       // Make all template names lowercase
+       $template = strtolower($template);
+
        // Count the template load
        if (!isset($_CONFIG['num_templates'])) $_CONFIG['num_templates'] = 0;
        $_CONFIG['num_templates']++;
        // Count the template load
        if (!isset($_CONFIG['num_templates'])) $_CONFIG['num_templates'] = 0;
        $_CONFIG['num_templates']++;
@@ -550,7 +553,7 @@ function TRANSLATE_COMMA ($dotted, $cut=true) {
 
 //
 function DEREFERER ($URL) {
 
 //
 function DEREFERER ($URL) {
-       $URL = URL."/modules.php?module=loader&amp;url=".urlencode(base64_encode(gzcompress(COMPILE_CODE($URL))));
+       $URL = URL."/modules.php?module=loader&amp;url=".urlencode(base64_encode(gzcompress($URL)));
        return $URL;
 }
 
        return $URL;
 }
 
@@ -667,6 +670,9 @@ function SET_LANGUAGE($lang) {
 function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0") {
        global $DATA, $_CONFIG, $REPLACER;
 
 function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0") {
        global $DATA, $_CONFIG, $REPLACER;
 
+       // Make sure all template names are lowercase!
+       $template = strtolower($template);
+
        // Keept for backward-compatiblity (please replace these variables against our new {--CONST--} syntax!)
        $MAIN_TITLE = MAIN_TITLE; $URL = URL; $WEBMASTER = WEBMASTER;
        $surname = ""; $family = ""; $nick = ""; $sex = "N";
        // Keept for backward-compatiblity (please replace these variables against our new {--CONST--} syntax!)
        $MAIN_TITLE = MAIN_TITLE; $URL = URL; $WEBMASTER = WEBMASTER;
        $surname = ""; $family = ""; $nick = ""; $sex = "N";
index 54a81ee1f73f0d067239363f1547e3659b8e40c5..19d9446dfb7fa641761bb85f583abb2903c3db75 100644 (file)
@@ -37,7 +37,7 @@ if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
        require($INC);
 }
 
        require($INC);
 }
 
-// General admin text
+// Configuration strings in admin area
 define('ADMIN_CONFIG_SURFBAR_TITLE', "Konfiguration der Surfbar");
 define('ADMIN_CONFIG_SURFBAR_STATIC_REWARD', "Statische Verg&uuml;tung:");
 define('ADMIN_CONFIG_SURFBAR_STATIC_COSTS', "Statische Kosten:");
 define('ADMIN_CONFIG_SURFBAR_TITLE', "Konfiguration der Surfbar");
 define('ADMIN_CONFIG_SURFBAR_STATIC_REWARD', "Statische Verg&uuml;tung:");
 define('ADMIN_CONFIG_SURFBAR_STATIC_COSTS', "Statische Kosten:");
@@ -52,12 +52,17 @@ define('ADMIN_CONFIG_SURFBAR_MAX_ORDER', "Maximal durch Mitglied in Surfbar buch
 define('ADMIN_CONFIG_SURFBAR_RESTART_TIME', "Ruhezeit der Surfbar, wenn alle URLs in Reload-Lock sind:");
 define('ADMIN_CONFIG_SURFBAR_AUTOSTART', "Surfbar soll nach Ruhezeit automatisch starten?");
 define('ADMIN_CONFIG_SURFBAR_STATS_RELOAD', "Reload-Zeit der Statistik unterhalb der beworbenen Seite:");
 define('ADMIN_CONFIG_SURFBAR_RESTART_TIME', "Ruhezeit der Surfbar, wenn alle URLs in Reload-Lock sind:");
 define('ADMIN_CONFIG_SURFBAR_AUTOSTART', "Surfbar soll nach Ruhezeit automatisch starten?");
 define('ADMIN_CONFIG_SURFBAR_STATS_RELOAD', "Reload-Zeit der Statistik unterhalb der beworbenen Seite:");
+define('ADMIN_CONFIG_SURFBAR_NOTE', "(*): Es sind auch die &Uuml;bertragungen der URLs aus der Mailbuchung einbezogen. Es wird empfohlen, die Ruhezeit etwas l&auml;nger als die Reload-Sperre einzustellen.");
+
+// General admin text
 define('ADMIN_SURFBAR_NOTIFY_UNLOCK_YES', "Ja, Admin(s) informieren.");
 define('ADMIN_SURFBAR_NOTIFY_UNLOCK_NO', "Nein, nicht informieren.");
 define('ADMIN_SURFBAR_NO_REF_LEVELS_FOUND', "Zur Zeit sind keine Referal-Ebenen f&uuml;r die Surfbar eingestellt.<br />\nBitte installieren Sie die Erweiterung <strong>surfbar</strong> neu.");
 define('ADMIN_SURFBAR_ADD_NEW_REFDEPTH', "Neue Referal-Ebene zur Surfbar hinzuf&uuml;gen");
 define('ADMIN_SURFBAR_NO_URLS_FOUND', "Es konnten keine URLs in der Surfbar gefunden werden.");
 define('ADMIN_SURFBAR_REWARD', "Verg&uuml;tung");
 define('ADMIN_SURFBAR_NOTIFY_UNLOCK_YES', "Ja, Admin(s) informieren.");
 define('ADMIN_SURFBAR_NOTIFY_UNLOCK_NO', "Nein, nicht informieren.");
 define('ADMIN_SURFBAR_NO_REF_LEVELS_FOUND', "Zur Zeit sind keine Referal-Ebenen f&uuml;r die Surfbar eingestellt.<br />\nBitte installieren Sie die Erweiterung <strong>surfbar</strong> neu.");
 define('ADMIN_SURFBAR_ADD_NEW_REFDEPTH', "Neue Referal-Ebene zur Surfbar hinzuf&uuml;gen");
 define('ADMIN_SURFBAR_NO_URLS_FOUND', "Es konnten keine URLs in der Surfbar gefunden werden.");
 define('ADMIN_SURFBAR_REWARD', "Verg&uuml;tung");
+define('ADMIN_SURFBAR_COSTS', "Kosten");
+define('ADMIN_SURFBAR_PAYMENT', "Payment");
 define('ADMIN_SURFBAR_VIEWS_TOTAL', "Gesamtaufrufe");
 define('ADMIN_SURFBAR_STATUS', "URL-Status");
 define('ADMIN_SURFBAR_REGISTERED', "URL aufgenommen");
 define('ADMIN_SURFBAR_VIEWS_TOTAL', "Gesamtaufrufe");
 define('ADMIN_SURFBAR_STATUS', "URL-Status");
 define('ADMIN_SURFBAR_REGISTERED', "URL aufgenommen");
@@ -66,7 +71,9 @@ define('ADMIN_SURFBAR_LOCK_REASON', "Sperrgrund");
 define('ADMIN_SURFBAR_EDIT_URL', "URL &auml;ndern");
 define('ADMIN_SURFBAR_DEL_URL', "URL l&ouml;schen");
 define('ADMIN_SURFBAR_UNLOCK_URL', "URL ent-/sperren");
 define('ADMIN_SURFBAR_EDIT_URL', "URL &auml;ndern");
 define('ADMIN_SURFBAR_DEL_URL', "URL l&ouml;schen");
 define('ADMIN_SURFBAR_UNLOCK_URL', "URL ent-/sperren");
-define('ADMIN_CONFIG_SURFBAR_NOTE', "(*): Es sind auch die &Uuml;bertragungen der URLs aus der Mailbuchung einbezogen. Es wird empfohlen, die Ruhezeit etwas l&auml;nger als die Reload-Sperre einzustellen.");
+define('ADMIN_SURFBAR_CONFIRM_URL', "URL(s) freigeben");
+define('ADMIN_SURFBAR_UNLOCK_DONE', "Freischaltung ausgew&auml;hlter URL(s) vollst&auml;ndig. :-)");
+define('ADMIN_SURFBAR_UNLOCK_FAILED', "Freischaltung fehlgeschlagen. Bitte nachschauen, welche URLs nicht freigegeben wurden.");
 
 // General member text
 define('MEMBER_SURFBAR_URL_ADDED', "URL hinzugef&uuml;gt und wartet auf Freischaltung.");
 
 // General member text
 define('MEMBER_SURFBAR_URL_ADDED', "URL hinzugef&uuml;gt und wartet auf Freischaltung.");
@@ -77,10 +84,12 @@ define('MEMBER_SURFBAR_NO_MORE_ALLOWED', "Sie k&ouml;nnen leider nicht mehr URLs
 // Subject lines for admins
 define('ADMIN_SURFBAR_NOTIFY_URL_UNLOCK_SUBJECT', "URL in Surfbar gebucht");
 define('ADMIN_SURFBAR_NOTIFY_URL_REG_SUBJECT', "Mitglied hat URL in Surfbar gebucht");
 // Subject lines for admins
 define('ADMIN_SURFBAR_NOTIFY_URL_UNLOCK_SUBJECT', "URL in Surfbar gebucht");
 define('ADMIN_SURFBAR_NOTIFY_URL_REG_SUBJECT', "Mitglied hat URL in Surfbar gebucht");
+define('ADMIN_SURFBAR_NOTIFY_URL_CONFIRMED_SUBJECT', "URL in Surfbar freigegeben");
 
 // Subhect lines for members
 define('MEMBER_SURFBAR_NOTIFY_URL_UNLOCK_SUBJECT', "Ihre URL wurde in die Surfbar aufgenommen");
 define('MEMBER_SURFBAR_NOTIFY_URL_REG_SUBJECT', "Ihre URL in der Surfbar wartet auf Freischaltung");
 
 // Subhect lines for members
 define('MEMBER_SURFBAR_NOTIFY_URL_UNLOCK_SUBJECT', "Ihre URL wurde in die Surfbar aufgenommen");
 define('MEMBER_SURFBAR_NOTIFY_URL_REG_SUBJECT', "Ihre URL in der Surfbar wartet auf Freischaltung");
+define('MEMBER_SURFBAR_NOTIFY_URL_CONFIRMED_SUBJECT', "Ihre URL wurde f&uuml;r die Surfbar freigegeben");
 
 // URL status
 define('SURFBAR_URL_STATUS_CONFIRMED', "Freigegeben");
 
 // URL status
 define('SURFBAR_URL_STATUS_CONFIRMED', "Freigegeben");
index 560c4897c2272e7fd41ef67a15c55f1445b352db..3e0a103c8a9bffa072fafe0182089cc56ed8ef06 100644 (file)
@@ -37,7 +37,11 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
        require($INC);
 }
 
        require($INC);
 }
 
-// Admin has added an URL with given user id
+// -----------------------------------------------------------------------------
+//                               Admin functions
+// -----------------------------------------------------------------------------
+
+// Admin has added an URL with given user id and so on
 function SURFBAR_ADMIN_ADD_URL ($url, $uid, $reward, $costs, $paymentId) {
        // Do some pre-checks
        if (!IS_ADMIN()) {
 function SURFBAR_ADMIN_ADD_URL ($url, $uid, $reward, $costs, $paymentId) {
        // Do some pre-checks
        if (!IS_ADMIN()) {
@@ -57,6 +61,37 @@ function SURFBAR_ADMIN_ADD_URL ($url, $uid, $reward, $costs, $paymentId) {
        // Register the new URL
        return SURFBAR_REGISTER_URL($url, $uid, $reward, $costs, $paymentId, "CONFIRMED", "unlock");
 }
        // Register the new URL
        return SURFBAR_REGISTER_URL($url, $uid, $reward, $costs, $paymentId, "CONFIRMED", "unlock");
 }
+// Admin function for unlocking URLs
+function SURFBAR_ADMIN_UNLOCK_URL_IDS ($IDs) {
+       // Is this an admin or invalid array?
+       if (!IS_ADMIN()) {
+               // Not admin or invalid IDs array
+               return false;
+       } elseif (!is_array($IDs)) {
+               // No array
+               return false;
+       } elseif (count($IDs) == 0) {
+               // Empty array
+               return false;
+       }
+
+       // Set to true to make AND expression valid if first URL got unlocked
+       $done = true;
+
+       // Update the status for all ids
+       foreach ($IDs as $id => $dummy) {
+               // Test all ids through (ignores failed)
+               $done = (($done) && (SURFBAR_CHANGE_STATUS($id, "PENDING", "CONFIRMED")));
+       } // END - if
+
+       // Return total status
+       return $done;
+}
+
+// -----------------------------------------------------------------------------
+//                               Member functions
+// -----------------------------------------------------------------------------
+
 // Member has added an URL
 function SURFBAR_MEMBER_ADD_URL ($url) {
        global $_CONFIG;
 // Member has added an URL
 function SURFBAR_MEMBER_ADD_URL ($url) {
        global $_CONFIG;
@@ -83,6 +118,10 @@ function SURFBAR_MEMBER_ADD_URL ($url) {
        // Register the new URL
        return SURFBAR_REGISTER_URL($url, $GLOBALS['userid'], $reward, $costs);
 }
        // Register the new URL
        return SURFBAR_REGISTER_URL($url, $GLOBALS['userid'], $reward, $costs);
 }
+// -----------------------------------------------------------------------------
+//                               Generic functions
+// -----------------------------------------------------------------------------
+
 // Looks up by an URL
 function SURFBAR_LOOKUP_BY_URL ($url) {
        // Now lookup that given URL by itself
 // Looks up by an URL
 function SURFBAR_LOOKUP_BY_URL ($url) {
        // Now lookup that given URL by itself
@@ -104,12 +143,19 @@ function SURFBAR_GET_URL_DATA ($searchTerm, $column="id", $order="id", $sort="AS
                $searchTerm = bigintval($searchTerm);
        } // END - if
 
                $searchTerm = bigintval($searchTerm);
        } // END - if
 
+       // If the column is "id" there can be only one entry
+       $limit = "";
+       if ($column == "id") {
+               $limit = "LIMIT 1";
+       } // END - if
+
        // Look up the record
        $result = SQL_QUERY_ESC("SELECT id, userid, url, reward, costs, views_total, status, registered, last_locked, lock_reason
 FROM "._MYSQL_PREFIX."_surfbar_urls
 WHERE %s='%s'
        // Look up the record
        $result = SQL_QUERY_ESC("SELECT id, userid, url, reward, costs, views_total, status, registered, last_locked, lock_reason
 FROM "._MYSQL_PREFIX."_surfbar_urls
 WHERE %s='%s'
-ORDER BY %s %s",
-               array($column, $searchTerm, $order, $sort), __FILE__, __LINE__);
+ORDER BY %s %s
+%s",
+               array($column, $searchTerm, $order, $sort, $limit), __FILE__, __LINE__);
 
        // Is there at least one record?
        if (SQL_NUMROWS($result) > 0) {
 
        // Is there at least one record?
        if (SQL_NUMROWS($result) > 0) {
@@ -600,9 +646,48 @@ function SURFBAR_DETERMINE_TOTAL_ONLINE () {
        // Return result
        return $cnt;
 }
        // Return result
        return $cnt;
 }
-// Determine next id for surfbar view, always call this before you call other
+// Changes the status of an URL from given to other
+function SURFBAR_CHANGE_STATUS ($id, $prevStatus, $newStatus) {
+       // Get URL data for status comparison
+       $data = SURFBAR_GET_URL_DATA($id);
+
+       // Is the status like prevStatus is saying?
+       if ($data[$id]['status'] != $prevStatus) {
+               // No, then abort here
+               return false;
+       } // END - if
+
+       // Update the status now
+       SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_surfbar_urls SET status='%s' WHERE id=%s LIMIT 1",
+               array($newStatus, bigintval($id)), __FILE__, __LINE__);
+
+       // Was that fine?
+       if (SQL_AFFECTEDROWS() != 1) {
+               // No, something went wrong
+               return false;
+       } // END - if
+
+       // Prepare content for notification routines
+       $data[$id]['uid']         = $data[$id]['userid'];
+       $data[$id]['frametester'] = FRAMETESTER($data[$id]['url']);
+       $data[$id]['reward']      = TRANSLATE_COMMA($data[$id]['reward']);
+       $data[$id]['costs']       = TRANSLATE_COMMA($data[$id]['costs']);
+       $data[$id]['status']      = SURFBAR_TRANSLATE_STATUS($newStatus);
+       $data[$id]['registered']  = MAKE_DATETIME($data[$id]['registered'], "2");
+       $newStatus = strtolower($newStatus);
+
+       // Send admin notification
+       SURFBAR_NOTIFY_ADMIN("url_{$newStatus}", $data[$id]);
+
+       // Send user notification
+       SURFBAR_NOTIFY_USER("url_{$newStatus}", $data[$id]);
+
+       // All done!
+       return true;
+}
+// Determine next id for surfbar or get data for given id, always call this before you call other
 // getters below this function!!!
 // getters below this function!!!
-function SURFBAR_GET_NEXT_ID ($id = 0) {
+function SURFBAR_DETERMINE_NEXT_ID ($id = 0) {
        global $SURFBAR_CACHE, $_CONFIG;
 
        // Default is no id!
        global $SURFBAR_CACHE, $_CONFIG;
 
        // Default is no id!
@@ -771,10 +856,10 @@ LIMIT 1",
        //DEBUG_LOG(__FUNCTION__.":nextId={$nextId}");
        return $nextId;
 }
        //DEBUG_LOG(__FUNCTION__.":nextId={$nextId}");
        return $nextId;
 }
-// ----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE ELSE THEY "WRAP" THE
 // $SURFBAR_CACHE ARRAY!
 // PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE ELSE THEY "WRAP" THE
 // $SURFBAR_CACHE ARRAY!
-// ----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // Private getter for data elements
 function SURFBAR_GET_DATA ($element) {
        global $SURFBAR_CACHE;
 // Private getter for data elements
 function SURFBAR_GET_DATA ($element) {
        global $SURFBAR_CACHE;
index 02c0b65f19beda0b743f08d7a3ea323e30487755..3753e8f6afae21bf75fb7c9f904125e7fd3bcf6f 100644 (file)
@@ -41,7 +41,7 @@ if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
 ADD_DESCR("admin", basename(__FILE__));
 
 // List all URLs
 ADD_DESCR("admin", basename(__FILE__));
 
 // List all URLs
-$result = SQL_QUERY("SELECT id, userid, url, reward, views_total, status, UNIX_TIMESTAMP(registered) AS registered, UNIX_TIMESTAMP(last_locked) AS last_locked, lock_reason
+$result = SQL_QUERY("SELECT id, userid, url, reward, costs, views_total, status, UNIX_TIMESTAMP(registered) AS registered, UNIX_TIMESTAMP(last_locked) AS last_locked, lock_reason
 FROM "._MYSQL_PREFIX."_surfbar_urls
 ORDER BY id ASC", __FILE__, __LINE__);
 
 FROM "._MYSQL_PREFIX."_surfbar_urls
 ORDER BY id ASC", __FILE__, __LINE__);
 
@@ -55,6 +55,7 @@ if (SQL_NUMROWS($result) > 0) {
                $content['userid']      = ADMIN_USER_PROFILE_LINK($content['userid']);
                $content['url']         = FRAMETESTER($content['url']);
                $content['reward']      = TRANSLATE_COMMA($content['reward']);
                $content['userid']      = ADMIN_USER_PROFILE_LINK($content['userid']);
                $content['url']         = FRAMETESTER($content['url']);
                $content['reward']      = TRANSLATE_COMMA($content['reward']);
+               $content['costs']       = TRANSLATE_COMMA($content['costs']);
                $content['views_total'] = TRANSLATE_COMMA($content['views_total']);
                $content['status']      = SURFBAR_TRANSLATE_STATUS($content['status']);
                $content['registered']  = MAKE_DATETIME($content['registered'], 2);
                $content['views_total'] = TRANSLATE_COMMA($content['views_total']);
                $content['status']      = SURFBAR_TRANSLATE_STATUS($content['status']);
                $content['registered']  = MAKE_DATETIME($content['registered'], 2);
index c1d2d52c98fd0935bf1a747cc36bb450f846445e..96fcf6a8a18093b6adf33750f01497ad77463101 100644 (file)
 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
-}
+} // END - if
 
 // Add description as navigation point
 ADD_DESCR("admin", basename(__FILE__));
 
 
 // Add description as navigation point
 ADD_DESCR("admin", basename(__FILE__));
 
+// Is the form sent?
+if ((isset($_POST['unlock'])) && (is_array($_POST['id'])) && (count($_POST['id']) > 0)) {
+       // Unlock selected URLs
+       if (SURFBAR_ADMIN_UNLOCK_URL_IDS($_POST['id'])) {
+               // Unlock done! :-)
+               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_UNLOCK_DONE);
+       } else {
+               // Unlock failed!
+               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_UNLOCK_FAILED);
+       }
+} // END - if
+
+// List all URLs
+$result = SQL_QUERY("SELECT id, userid, url, reward, costs, UNIX_TIMESTAMP(registered) AS registered
+FROM "._MYSQL_PREFIX."_surfbar_urls
+WHERE status='PENDING'
+ORDER BY id ASC", __FILE__, __LINE__);
+
+// Do we have some URLs left?
+if (SQL_NUMROWS($result) > 0) {
+       // List all URLs
+       $OUT = ""; $SW = 2;
+       while ($content = SQL_FETCHARRAY($result)) {
+               // "Translate"/add content
+               $content['sw']         = $SW;
+               $content['userid']     = ADMIN_USER_PROFILE_LINK($content['userid']);
+               $content['url']        = FRAMETESTER($content['url']);
+               $content['costs']      = TRANSLATE_COMMA($content['costs']);
+               $content['reward']     = TRANSLATE_COMMA($content['reward']);
+               $content['registered'] = MAKE_DATETIME($content['registered'], 2);
+
+               // Load row template
+               $OUT .= LOAD_TEMPLATE("admin_unlock_surfbar_urls_row", true, $content);
+
+               // Switch color
+               $SW = 3 - $SW;
+       } // END - while
+
+       // Load main template
+       LOAD_TEMPLATE("admin_unlock_surfbar_urls", false, $OUT);
+} else {
+       // No URLs in surfbar
+       LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_NO_URLS_FOUND);
+}
+
+// Free result
+SQL_FREERESULT($result);
+
 //
 ?>
 //
 ?>
index 78ab97dacca4553aac2e4ef3a3f370113aa5e669..49b06b359e17ef12edd66f6b8d131012cad1f3bb 100644 (file)
@@ -71,12 +71,15 @@ if (!empty($_GET['order'])) {
 }
 
 if ((!empty($_POST['url'])) || (!empty($_GET['url'])) || (!empty($_GET['frame']))) {
 }
 
 if ((!empty($_POST['url'])) || (!empty($_GET['url'])) || (!empty($_GET['frame']))) {
+       // Default URL is ours
        $url = URL;
        $url = URL;
-       if (!empty($_POST['url'])) $url = $_POST['url'];
 
 
-       // Decode URL if set
+       // Decode URL if set in GET parameters
        if (!empty($_GET['url']))  $url = COMPILE_CODE(gzuncompress(base64_decode(urldecode($_GET['url']))));
 
        if (!empty($_GET['url']))  $url = COMPILE_CODE(gzuncompress(base64_decode(urldecode($_GET['url']))));
 
+       // Use URL from POST data if set
+       if (!empty($_POST['url'])) $url = $_POST['url'];
+
        // Add missing element
        $frame = "";
        if (!empty($_GET['frame'])) $frame = SQL_ESCAPE($_GET['frame']);
        // Add missing element
        $frame = "";
        if (!empty($_GET['frame'])) $frame = SQL_ESCAPE($_GET['frame']);
index c8c62dd35373784fad8d46b2215ef99ca93951ba..368b613789f948c1eb449b9f51378bd63c1184a3 100644 (file)
@@ -39,7 +39,7 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
 
 if (!empty($_GET['url'])) {
        // Decode URL
 
 if (!empty($_GET['url'])) {
        // Decode URL
-       $url = COMPILE_CODE(@gzuncompress(base64_decode(urldecode($_GET['url']))));
+       $url = COMPILE_CODE(@gzuncompress(base64_decode(str_replace(" ", "+", urldecode($_GET['url'])))));
 
        // Validate the URL
        if (VALIDATE_URL($url)) {
 
        // Validate the URL
        if (VALIDATE_URL($url)) {
index a519c798b1ead0b181699020132891d3508c3d29..abed7ff9496e8c2ddca3484b56d64a5361e02e51 100644 (file)
@@ -1235,37 +1235,37 @@ WHERE sid='%s' LIMIT 1",
         array($_CONFIG['online_timeout']), __FILE__, __LINE__);
 }
 // OBSULETE: Sends out mail to all administrators
         array($_CONFIG['online_timeout']), __FILE__, __LINE__);
 }
 // OBSULETE: Sends out mail to all administrators
-function SEND_ADMIN_EMAILS($subj, $msg)
-{
-       $result = SQL_QUERY("SELECT email FROM "._MYSQL_PREFIX."_admins ORDER BY id", __FILE__, __LINE__);
-       while (list($email) = SQL_FETCHROW($result))
-       {
+function SEND_ADMIN_EMAILS($subj, $msg) {
+       // Load all admin email addresses
+       $result = SQL_QUERY("SELECT email FROM "._MYSQL_PREFIX."_admins ORDER BY id ASC", __FILE__, __LINE__);
+       while (list($email) = SQL_FETCHROW($result)) {
+               // Send the email out
                SEND_EMAIL($email, $subj, $msg);
                SEND_EMAIL($email, $subj, $msg);
-       }
-       // Really simple... ;-)
+       } // END - if
+
+       // Free result
        SQL_FREERESULT($result);
        SQL_FREERESULT($result);
+
+       // Really simple... ;-)
 }
 // Get ID number from administrator's login name
 }
 // Get ID number from administrator's login name
-function GET_ADMIN_ID($login)
-{
+function GET_ADMIN_ID($login) {
        global $cacheArray;
        $ret = "-1";
        global $cacheArray;
        $ret = "-1";
-       if (!empty($cacheArray['admins']['aid'][$login]))
-       {
+       if (!empty($cacheArray['admins']['aid'][$login])) {
                // Check cache
                $ret = $cacheArray['admins']['aid'][$login];
                if (empty($ret)) $ret = "-1";
                // Check cache
                $ret = $cacheArray['admins']['aid'][$login];
                if (empty($ret)) $ret = "-1";
-       }
-        else
-       {
+       } else {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
                 array($login), __FILE__, __LINE__);
                // Load from database
                $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
                 array($login), __FILE__, __LINE__);
-               if (SQL_NUMROWS($result) == 1)
-               {
+               if (SQL_NUMROWS($result) == 1) {
                        list($ret) = SQL_FETCHROW($result);
                        list($ret) = SQL_FETCHROW($result);
-                       SQL_FREERESULT($result);
-               }
+               } // END - if
+
+               // Free result
+               SQL_FREERESULT($result);
        }
        return $ret;
 }
        }
        return $ret;
 }
index 976cd7be95bd9994b30f8e64cec5ee4ed447f3bc..43da016f1360ceaf0484d38b26e7c39c45ae0be1 100644 (file)
@@ -117,7 +117,7 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
                }
        } elseif ((isset($_GET['check'])) && (isset($_GET['id'])) && (isset($_GET['salt']))) {
                // Dummy next id get
                }
        } elseif ((isset($_GET['check'])) && (isset($_GET['id'])) && (isset($_GET['salt']))) {
                // Dummy next id get
-               SURFBAR_GET_NEXT_ID($_GET['id']);
+               SURFBAR_DETERMINE_NEXT_ID($_GET['id']);
 
                // Check reload lock and validation code
                if ((!SURFBAR_CHECK_RELOAD_LOCK($_GET['id'])) && (SURFBAR_CHECK_VALIDATION_CODE($_GET['id'], $_GET['check'], $_GET['salt']))) {
 
                // Check reload lock and validation code
                if ((!SURFBAR_CHECK_RELOAD_LOCK($_GET['id'])) && (SURFBAR_CHECK_VALIDATION_CODE($_GET['id'], $_GET['check'], $_GET['salt']))) {
@@ -149,7 +149,7 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
                // Frame "top" set?
                if ((isset($_GET['frame'])) && ($_GET['frame'] == "top")) {
                        // Determine next id
                // Frame "top" set?
                if ((isset($_GET['frame'])) && ($_GET['frame'] == "top")) {
                        // Determine next id
-                       $nextId = SURFBAR_GET_NEXT_ID();
+                       $nextId = SURFBAR_DETERMINE_NEXT_ID();
 
                        // Is there a valid id?
                        if ($nextId > 0) {
 
                        // Is there a valid id?
                        if ($nextId > 0) {
diff --git a/templates/de/emails/admin/admin_surfbar_url_confirmed.tpl b/templates/de/emails/admin/admin_surfbar_url_confirmed.tpl
new file mode 100644 (file)
index 0000000..0051031
--- /dev/null
@@ -0,0 +1,28 @@
+{--HELLO_ADMIN--},
+
+Ein Administrator hat soeben folgende URL in der Surfbar freigegeben.
+
+Hier sind alle Daten von der URL:
+------------------------------------------
+Gebuchte URL: $content[url]
+------------------------------------------
+Framekiller-Test:
+$content[frametester]
+------------------------------------------
+User-ID: $content[uid]
+------------------------------------------
+Angemeldet: $content[registered]
+------------------------------------------
+Kosten/Aufruf: $content[costs] {!POINTS!}
+------------------------------------------
+Verg&uuml;tung/Aufruf: $content[reward] {!POINTS!}
+------------------------------------------
+Status: $content[status]
+------------------------------------------
+ID in der Surfbar: $content[id]
+------------------------------------------
+
+{--ADMIN_THANX--}
+  {--YOUR--} {!MAIN_TITLE!} {--SCRIPT--}
+
+{!URL!}/admin.php
diff --git a/templates/de/emails/member/member_surfbar_url_confirmed.tpl b/templates/de/emails/member/member_surfbar_url_confirmed.tpl
new file mode 100644 (file)
index 0000000..368912a
--- /dev/null
@@ -0,0 +1,19 @@
+{--HELLO--} Mitglied,
+
+Ihre gebuchte URL wurde soeben in unserer Surfbar freigegeben.
+
+Hier sind alle Daten:
+------------------------------------------
+Gebuchte URL: $content[url]
+------------------------------------------
+Ihre User-ID: $content[uid]
+------------------------------------------
+Status: $content[status]
+------------------------------------------
+ID in der Surfbar: $content[id]
+------------------------------------------
+
+Mit freundlichem Gruss,
+  Ihr {!MAIN_TITLE!} Team
+
+{!URL!} ({!WEBMASTER!})
index 725f8bd8b7b5cf5d72a9a668eae943996a4787f7..23a813ff4ac3d7562519e9bc158d771c15670b74 100644 (file)
@@ -1,7 +1,7 @@
 <FORM action="{!URL!}/modules.php?module=admin&amp;what=list_surfbar_urls" method="POST">
 <TABLE border="0" cellspacing="0" cellpadding="0" class="admin_table dashed">
 <TR>
 <FORM action="{!URL!}/modules.php?module=admin&amp;what=list_surfbar_urls" method="POST">
 <TABLE border="0" cellspacing="0" cellpadding="0" class="admin_table dashed">
 <TR>
-       <TD align="center" colspan="9" class="admin_title" height="30">
+       <TD align="center" colspan="10" class="admin_title" height="30">
                <STRONG>{--EDIT_DEL_REFDEPTH--}</STRONG>
        </TD>
 </TR>
                <STRONG>{--EDIT_DEL_REFDEPTH--}</STRONG>
        </TD>
 </TR>
@@ -10,6 +10,7 @@
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--_UID--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_TEST_URL--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_REWARD--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--_UID--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_TEST_URL--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_REWARD--}</STRONG></TD>
+       <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_COSTS--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_VIEWS_TOTAL--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_STATUS--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_REGISTERED--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_VIEWS_TOTAL--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_STATUS--}</STRONG></TD>
        <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_REGISTERED--}</STRONG></TD>
@@ -18,7 +19,7 @@
 </TR>
 $content
 <TR>
 </TR>
 $content
 <TR>
-       <TD class="admin_footer" align="center" colspan="9">
+       <TD class="admin_footer" align="center" colspan="10">
                <INPUT type="reset" class="admin_reset" value="{--UNDO_SELECTIONS--}">&nbsp;*
                <INPUT type="submit" name="edit" class="admin_submit" value="{--ADMIN_SURFBAR_EDIT_URL--}">&nbsp;*
                <INPUT type="submit" name="lock" class="admin_submit" value="{--ADMIN_SURFBAR_UNLOCK_URL--}">&nbsp;*
                <INPUT type="reset" class="admin_reset" value="{--UNDO_SELECTIONS--}">&nbsp;*
                <INPUT type="submit" name="edit" class="admin_submit" value="{--ADMIN_SURFBAR_EDIT_URL--}">&nbsp;*
                <INPUT type="submit" name="lock" class="admin_submit" value="{--ADMIN_SURFBAR_UNLOCK_URL--}">&nbsp;*
index e1bfc67e05e75fe7d4be1802f37a6c5057fcf564..105442ddbcdafeb401c2fb9912aa9f85b715df14 100644 (file)
@@ -11,6 +11,9 @@
        <TD align="center" class="bottom2 right2 switch_sw$content[sw]">
                $content[reward] {!POINTS!}
        </TD>
        <TD align="center" class="bottom2 right2 switch_sw$content[sw]">
                $content[reward] {!POINTS!}
        </TD>
+       <TD align="center" class="bottom2 right2 switch_sw$content[sw]">
+               $content[costs] {!POINTS!}
+       </TD>
        <TD align="center" class="bottom2 right2 switch_sw$content[sw]">
                $content[views_total]
        </TD>
        <TD align="center" class="bottom2 right2 switch_sw$content[sw]">
                $content[views_total]
        </TD>
diff --git a/templates/de/html/admin/admin_unlock_surfbar_urls.tpl b/templates/de/html/admin/admin_unlock_surfbar_urls.tpl
new file mode 100644 (file)
index 0000000..b0b3920
--- /dev/null
@@ -0,0 +1,24 @@
+<FORM action="{!URL!}/modules.php?module=admin&amp;what=unlock_surfbar_urls" method="POST">
+<TABLE border="0" cellspacing="0" cellpadding="0" class="admin_table dashed">
+<TR>
+       <TD align="center" colspan="6" class="admin_title" height="30">
+               <STRONG>{--EDIT_DEL_REFDEPTH--}</STRONG>
+       </TD>
+</TR>
+<TR>
+       <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ID_SELECT--}</STRONG></TD>
+       <TD class="admin_title bottom2 right2" align="center"><STRONG>{--_UID--}</STRONG></TD>
+       <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_TEST_URL--}</STRONG></TD>
+       <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_REWARD--}</STRONG></TD>
+       <TD class="admin_title bottom2 right2" align="center"><STRONG>{--ADMIN_SURFBAR_COSTS--}</STRONG></TD>
+       <TD class="admin_title bottom2" align="center"><STRONG>{--ADMIN_SURFBAR_REGISTERED--}</STRONG></TD>
+</TR>
+$content
+<TR>
+       <TD class="admin_footer" align="center" colspan="6">
+               <INPUT type="reset" class="admin_reset" value="{--UNDO_SELECTIONS--}">&nbsp;*
+               <INPUT type="submit" name="unlock" class="admin_submit" value="{--ADMIN_SURFBAR_CONFIRM_URL--}">
+       </TD>
+</TR>
+</TABLE>
+</FORM>
diff --git a/templates/de/html/admin/admin_unlock_surfbar_urls_row.tpl b/templates/de/html/admin/admin_unlock_surfbar_urls_row.tpl
new file mode 100644 (file)
index 0000000..40fbae4
--- /dev/null
@@ -0,0 +1,20 @@
+<TR>
+       <TD align="center" class="bottom2 right2 switch_sw$content[sw]">
+               <INPUT type="checkbox" name="id[$content[id]]" value="1" class="admin_normal" />
+       </TD>
+       <TD align="center" class="bottom2 right2 switch_sw$content[sw]">
+               $content[userid]
+       </TD>
+       <TD align="center" class="bottom2 right2 switch_sw$content[sw]">
+               <a href="$content[url]" target="_blank" title="{--ADMIN_TEST_URL--}">{--ADMIN_TEST_URL--}</a>
+       </TD>
+       <TD align="center" class="bottom2 right2 switch_sw$content[sw]">
+               $content[reward] {!POINTS!}
+       </TD>
+       <TD align="center" class="bottom2 right2 switch_sw$content[sw]">
+               $content[costs] {!POINTS!}
+       </TD>
+       <TD align="center" class="bottom2 switch_sw$content[sw]">
+               $content[registered]
+       </TD>
+</TR>