]> git.mxchange.org Git - mailer.git/commitdiff
More fixes for points booking and surfbar
authorRoland Häder <roland@mxchange.org>
Tue, 9 Sep 2008 16:14:21 +0000 (16:14 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 9 Sep 2008 16:14:21 +0000 (16:14 +0000)
24 files changed:
.gitattributes
inc/autopurge.php
inc/databases.php
inc/extensions.php
inc/extensions/ext-surfbar.php
inc/functions.php
inc/language/surfbar_de.php
inc/libs/surfbar_functions.php
inc/load_extensions.php
inc/modules/admin/what-
inc/modules/admin/what-add_surfbar_url.php [new file with mode: 0644]
inc/modules/admin/what-config_surfbar.php
inc/modules/admin/what-list_surfbar_reflvl.php [deleted file]
inc/modules/admin/what-unlock_emails.php
inc/modules/member/what-surfbar_start.php
inc/mysql-manager.php
templates/de/emails/admin/admin_surfbar_url_unlock.tpl
templates/de/html/admin/admin_add_surfbar_reflvl.tpl [deleted file]
templates/de/html/admin/admin_add_surfbar_url.tpl [new file with mode: 0644]
templates/de/html/admin/admin_config_surfbar.tpl
templates/de/html/admin/admin_list_surfbar_reflvl.tpl [deleted file]
templates/de/html/admin/admin_list_surfbar_reflvl_row.tpl [deleted file]
templates/de/html/admin/admin_list_surfbar_urls.tpl
templates/de/html/surfbar/surfbar_frame_top.tpl

index e812e232236a7083c3226b2d8fdecc83877d472e..0eca02c90b77089ceac33ecb47cbab38128b6536 100644 (file)
@@ -252,6 +252,7 @@ inc/modules/admin/what-add_guestnl_cat.php -text
 inc/modules/admin/what-add_points.php -text
 inc/modules/admin/what-add_rallye.php -text
 inc/modules/admin/what-add_sponsor.php -text
+inc/modules/admin/what-add_surfbar_url.php -text
 inc/modules/admin/what-admin_add.php -text
 inc/modules/admin/what-adminedit.php -text
 inc/modules/admin/what-admins_add.php -text
@@ -335,7 +336,6 @@ inc/modules/admin/what-list_refs.php -text
 inc/modules/admin/what-list_sponsor.php -text
 inc/modules/admin/what-list_sponsor_pay.php -text
 inc/modules/admin/what-list_sponsor_pays.php -text
-inc/modules/admin/what-list_surfbar_reflvl.php -text
 inc/modules/admin/what-list_surfbar_urls.php -text
 inc/modules/admin/what-list_task.php -text
 inc/modules/admin/what-list_transfer.php -text
@@ -728,7 +728,7 @@ templates/de/html/admin/admin_add_reflvl.tpl -text
 templates/de/html/admin/admin_add_sponsor.tpl -text
 templates/de/html/admin/admin_add_sponsor_already.tpl -text
 templates/de/html/admin/admin_add_sponsor_paytype.tpl -text
-templates/de/html/admin/admin_add_surfbar_reflvl.tpl -text
+templates/de/html/admin/admin_add_surfbar_url.tpl -text
 templates/de/html/admin/admin_admin_add.tpl -text
 templates/de/html/admin/admin_admins_add.tpl -text
 templates/de/html/admin/admin_admins_add_acl.tpl -text
@@ -922,8 +922,6 @@ templates/de/html/admin/admin_list_sponsor_pay_edit.tpl -text
 templates/de/html/admin/admin_list_sponsor_pay_edit_row.tpl -text
 templates/de/html/admin/admin_list_sponsor_pay_row.tpl -text
 templates/de/html/admin/admin_list_sponsor_row.tpl -text
-templates/de/html/admin/admin_list_surfbar_reflvl.tpl -text
-templates/de/html/admin/admin_list_surfbar_reflvl_row.tpl -text
 templates/de/html/admin/admin_list_surfbar_urls.tpl -text
 templates/de/html/admin/admin_list_surfbar_urls_row.tpl -text
 templates/de/html/admin/admin_list_task_rows.tpl -text
index 0871b6ce80aa14ae21a16ebaa91ba513e28d7248..6873a1542ad1cb5345402087602c28d2bfbf5d44 100644 (file)
@@ -311,8 +311,7 @@ if ((GET_EXT_VERSION("task") > "0.0") && ($_CONFIG['ap_tasks'] == "Y"))
 }
 
 // Search for mails from deleted members?
-if ($_CONFIG['ap_del_mails'])
-{
+if ($_CONFIG['ap_del_mails']) {
        // Okay, let's check for them...
        $since = bigintval(time() - $_CONFIG['ap_dm_timeout']);
        $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_pool WHERE data_type='DELETED' AND timestamp <= %s ORDER BY sender",
@@ -322,15 +321,12 @@ if ($_CONFIG['ap_del_mails'])
        $DELETED = 0;
 
        // Do we have "purged" mails?
-       if (SQL_NUMROWS($result_mails) > 0)
-       {
+       if (SQL_NUMROWS($result_mails) > 0) {
                // Okay, check for their sender's
-               while(list($sender) = SQL_FETCHROW($result_mails))
-               {
+               while(list($sender) = SQL_FETCHROW($result_mails)) {
                        // Check now...
                        $fount = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array(bigintval($sender)), __FILE__, __LINE__));
-                       if ($found == 0)
-                       {
+                       if ($found == 0) {
                                // Okay we found some mails!
                                $result_remove = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE sender=%s",
                                 array(bigintval($sender)), __FILE__, __LINE__);
@@ -353,15 +349,12 @@ if ($_CONFIG['ap_del_mails'])
         array($since), __FILE__, __LINE__);
 
        // Do we have "purged" mails?
-       if (SQL_NUMROWS($result_mails) > 0)
-       {
+       if (SQL_NUMROWS($result_mails) > 0) {
                // Okay, check for their sender's
-               while(list($sender) = SQL_FETCHROW($result_mails))
-               {
+               while(list($sender) = SQL_FETCHROW($result_mails)) {
                        // Check now...
                        $found = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array(bigintval($sender)), __FILE__, __LINE__));
-                       if ($found == 0)
-                       {
+                       if ($found == 0) {
                                // Okay we found some mails!
                                $result_remove = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_stats WHERE sender=%s", array(bigintval($sender)), __FILE__, __LINE__);
                                $DELETED += SQL_AFFECTEDROWS();
@@ -378,25 +371,23 @@ if ($_CONFIG['ap_del_mails'])
        SQL_FREERESULT($result_mails);
 
        // Do we have deleted mails and the admin want's to receive a notification
-       if (($DELETED > 0) && ($_CONFIG['ap_dm_notify'] == "Y"))
-       {
+       if (($DELETED > 0) && ($_CONFIG['ap_dm_notify'] == "Y")) {
                // Send out email to admin
                SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT, "admin_autopurge_del_mails", $DELETED, "");
        }
 }
 
-if (EXT_IS_ACTIVE("rallye"))
-{
+if (EXT_IS_ACTIVE("rallye")) {
        // Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!)
        require_once(PATH."inc/libs/rallye_functions.php");
        RALLYE_DELETE_EXPIRED_RALLYES();
 }
-//
-if (EXT_IS_ACTIVE("bonus"))
-{
+
+if (EXT_IS_ACTIVE("bonus")) {
        // Check for expired turbo bonus lines
        require_once(PATH."inc/libs/bonus_functions.php");
        BONUS_PURGE_EXPIRED_TURBO_BONUS();
 }
+
 //
 ?>
index 518bc0e745aa9d94680cc70758ef8cbc9f531d42..b310ae1e07aed75b534fb9f8fe7a4fa57f65af22 100644 (file)
@@ -114,7 +114,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "281");
+define('CURR_SVN_REVISION', "282");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 5c15cdf857b98c597056170afe23759c6a26ac56..f566d1dfc898094ba60466c84369bc458d620ca5 100644 (file)
@@ -467,8 +467,7 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false)
                        // Create task
                        $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE subject='%s' LIMIT 1",
                         array($ext_subj), __FILE__, __LINE__);
-                       if (SQL_NUMROWS($result) == 0)
-                       {
+                       if (SQL_NUMROWS($result) == 0) {
                                // Task not created so it's a brand-new extension which we need to register and create a task for!
                                $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created) VALUES ('%s', '0', 'NEW', 'EXTENSION_UPDATE', '%s', '%s', UNIX_TIMESTAMP())",
                                 array(GET_ADMIN_ID(get_session('admin_login')), $ext_subj, addslashes($NOTES)), __FILE__, __LINE__);
@@ -482,18 +481,15 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false)
                         array($EXT_VERSION, $ext), __FILE__, __LINE__);
 
                        // Update cache
-                       if (EXT_IS_ACTIVE("cache"))
-                       {
+                       if (EXT_IS_ACTIVE("cache")) {
                                if ($cacheInstance->cache_file("extensions", true) == true) $cacheInstance->cache_destroy();
                                if ($cacheInstance->cache_file("config", true) == true)     $cacheInstance->cache_destroy();
                                if ($cacheInstance->cache_file("mod_reg", true) == true)    $cacheInstance->cache_destroy();
-                       }
+                       } // END - if
 
                        // Remove array
                        unset($SQLs);
-               }
-                else
-               {
+               } else {
                        // In "dry-run" mode return array with SQL commands
                        return $SQLs;
                }
index f77381e276d925ba8983c12dd6ec95a4626d0f29..9d823808fcd8318904fe560d683425cb2b134fe3 100644 (file)
@@ -92,15 +92,6 @@ INDEX (`userid`),
 INDEX (`url_id`)
 ) TYPE=MyISAM COMMENT='Surfbar last used salts'";
 
-       // Reload locks
-       $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_reflevels`";
-       $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_reflevels` (
-`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
-`level` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0',
-`percent` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT '0.00000',
-PRIMARY KEY(`id`)
-) TYPE=MyISAM COMMENT='Surfbar referal levels'";
-
        // Statistics
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_stats`";
        $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_stats` (
@@ -122,7 +113,6 @@ INDEX (`userid`,`url_id`)
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_costs` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000";
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_time` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60";
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_lock` SMALLINT(6) UNSIGNED NOT NULL DEFAULT ".(60*5)."";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_notify_admin_unlock` ENUM('N','Y') NOT NULL DEFAULT 'N'";
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_dynamic_percent` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT 10.00000";
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_max_order` INT(7) UNSIGNED NOT NULL DEFAULT 10";
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_restart_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(60*6)."";
@@ -142,9 +132,9 @@ INDEX (`userid`,`url_id`)
 
        // Admin menus
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','','Surfbar','URLs in der Surfbar verwalten, Einstellungen &auml;ndern und vieles mehr.',7)";
-       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','list_surfbar_urls','URLs verwalten','Verwalten Sie hier alle in der Surfbar befindlichen URLs mit nur wenigen Klicks.',1)";
-       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','unlock_surfbar_urls','Wartende URLs freigeben','Geben Sie hier nur direkt in der Surfbar gebuchte URLs frei.',2)";
-       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','list_surfbar_reflvl','Referal-Ebenen einstellen','Stellen Sie hier die prozentuale Verg&uuml;tung f&uuml;r Refs ein. Es wird nur die Basisverg&uuml;tung zur Rechengrundlage der Referalverg&uuml;tung verwendet.',3)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','add_surfbar_url','URL hinzuf&uuml;gen','F&uuml;gen Sie URLs z.B. von Werbenetzwerken hinzu, oder Ihre eigenen Projekte. <strong>Vorsicht!</strong> Ihnen muss es auch gestattet sein, URLs aus dem Werbenetzwerk in die Surfbar einzuf&uuml;gen.',1)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','list_surfbar_urls','URLs verwalten','Verwalten Sie hier alle in der Surfbar befindlichen URLs mit nur wenigen Klicks.',2)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','unlock_surfbar_urls','Wartende URLs freigeben','Geben Sie hier nur direkt in der Surfbar gebuchte URLs frei.',3)";
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','config_surfbar','Einstellungen','Einstellungen an der Surfbar &auml;ndern, wie Festverg&uuml;tung, prozentuale Ref-Verg&uuml;tung und vieles mehr.',4)";
 
        // Load CSS?
@@ -155,10 +145,9 @@ case "remove": // Do stuff when removing extension
        // SQL commands to run
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_urls`";
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_locks`";
-       $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_reflevels`";
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_salts`";
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_stats`";
-       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE `action`='surfbar' LIMIT 3";
+       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE `action`='surfbar' LIMIT 4";
        $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='surfbar' LIMIT 5";
        break;
 
index 29421f39225739df8e8d4c591273093cbe8535e8..f4fa1f7e6ae4d055188c7dc025d8476a9dc4a5d9 100644 (file)
@@ -341,7 +341,7 @@ function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML='N', $FROM="") {
        $SUBJECT = html_entity_decode($SUBJECT);
 
        // Set from header
-       if (!eregi("@", $TO)) {
+       if ((!eregi("@", $TO)) && ($TO > 0)) {
                // Value detected, load email from database
                if (EXT_IS_ACTIVE("msg")) {
                        ADD_MESSAGE_TO_BOX($TO, $SUBJECT, $MSG, $HTML);
@@ -351,6 +351,9 @@ function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML='N', $FROM="") {
                        list($TO) = SQL_FETCHROW($result_email);
                        SQL_FREERESULT($result_email);
                }
+       } elseif ($TO == 0) {
+               // Is the webmaster!
+               $TO = WEBMASTER;
        }
 
        // Not in PHPMailer-Mode
index bcdf6592eb3e005007da2d04299872530e05f240..f787136d95c90f2424da0659e2789f65cce8bc62 100644 (file)
@@ -46,7 +46,6 @@ define('ADMIN_CONFIG_SURFBAR_STATIC_LOCK', "Statische Reload-Sperre (oberes Fram
 define('ADMIN_CONFIG_SURFBAR_PAYMENT_MODEL', "Verg&uuml;tungsmodel ausw&auml;hlen:");
 define('ADMIN_CONFIG_SURFBAR_PAYMENT_MODEL_STATIC', "Statische Werte verwenden.");
 define('ADMIN_CONFIG_SURFBAR_PAYMENT_MODEL_DYNAMIC', "Dynamische Werte errechnen.");
-define('ADMIN_CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK', "Admin bei Freigabe von Mailbuchungen informieren, dass die URL in die Surfbar aufgenommen wurde?");
 define('ADMIN_CONFIG_SURFBAR_DYNAMIC_PERCENT', "Prozent auf dynamische Verg&uuml;tung:");
 define('ADMIN_CONFIG_SURFBAR_MAX_ORDER', "Maximal durch Mitglied in Surfbar buchbare URLs:(*)");
 define('ADMIN_CONFIG_SURFBAR_RESTART_TIME', "Ruhezeit der Surfbar, wenn alle URLs in Reload-Lock sind:");
@@ -55,8 +54,6 @@ define('ADMIN_CONFIG_SURFBAR_STATS_RELOAD', "Reload-Zeit der Statistik unterhalb
 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.");
@@ -75,8 +72,9 @@ 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.");
 define('ADMIN_SURFBAR_LIST_URLS_TITLE', "URLs in Surfbar aufisten");
-define('ADMIN_SURFBAR_SYNC_TITLE', "Surfbar URL-Tabelle mit Mailbuchungstabelle abgleichen");
-define('ADMIN_SURFBAR_SYNC_BUTTON', "Alle URLs aus Mailbuchungstabele synchronisieren");
+define('ADMIN_SURFBAR_URL_ADDED', "URL wurde der Surfbar hinzugef&uuml;gt.");
+define('ADMIN_SURFBAR_URL_NOT_ADDED', "URL wurde wegen Fehler nicht hinzugef&uuml;gt. Ist die URL bereits vorhanden?");
+define('ADMIN_SURFBAR_ADD_URL', "URL hinzuf&uuml;gen");
 
 // General member text
 define('MEMBER_SURFBAR_URL_ADDED', "URL hinzugef&uuml;gt und wartet auf Freischaltung.");
index 3e0a103c8a9bffa072fafe0182089cc56ed8ef06..2104068759b7e296545acb58cacf0577a82091ce 100644 (file)
@@ -42,7 +42,7 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
 // -----------------------------------------------------------------------------
 
 // Admin has added an URL with given user id and so on
-function SURFBAR_ADMIN_ADD_URL ($url, $uid, $reward, $costs, $paymentId) {
+function SURFBAR_ADMIN_ADD_URL ($url) {
        // Do some pre-checks
        if (!IS_ADMIN()) {
                // Not an admin
@@ -50,16 +50,20 @@ function SURFBAR_ADMIN_ADD_URL ($url, $uid, $reward, $costs, $paymentId) {
        } elseif (!VALIDATE_URL($url)) {
                // URL invalid
                return false;
-       } elseif (SURFBAR_LOOKUP_BY_URL($url, $uid)) {
+       } elseif (SURFBAR_LOOKUP_BY_URL($url, "0")) {
                // URL already found in surfbar!
                return false;
-       } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS($uid)) {
+       } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS("0")) {
                // No more allowed!
                return false;
        }
 
+       // Do we have fixed or dynamic payment model?
+       $reward = SURFBAR_DETERMINE_REWARD();
+       $costs  = SURFBAR_DETERMINE_COSTS();
+
        // Register the new URL
-       return SURFBAR_REGISTER_URL($url, $uid, $reward, $costs, $paymentId, "CONFIRMED", "unlock");
+       return SURFBAR_REGISTER_URL($url, "0", $reward, $costs, "0", "CONFIRMED", "unlock");
 }
 // Admin function for unlocking URLs
 function SURFBAR_ADMIN_UNLOCK_URL_IDS ($IDs) {
@@ -192,7 +196,6 @@ function SURFBAR_REGISTER_URL ($url, $uid, $reward, $costs, $paymentId=0, $statu
                'uid'         => $uid,
                'reward'      => $reward,
                'costs'       => $costs,
-               'payment_id'  => $paymentId,
                'status'      => $status
        );
 
@@ -218,14 +221,19 @@ function SURFBAR_REGISTER_URL ($url, $uid, $reward, $costs, $paymentId=0, $statu
 }
 // Inserts an url by given data array and return the insert id
 function SURFBAR_INSERT_URL_BY_ARRAY ($urlData) {
+       // Get userid
+       $uid = bigintval($urlData['uid']);
+
+       // Is the id set?
+       if (empty($uid)) $uid = "0";
+
        // Just run the insert query for now
-       SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_urls (userid, url, reward, costs, payment_id, status) VALUES(%s, '%s', %s, %s, %d, '%s')",
+       SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_urls (userid, url, reward, costs, status) VALUES('%s', '%s', %s, %s, '%s')",
                array(
-                       bigintval($urlData['uid']),
+                       $uid,
                        $urlData['url'],
                        (float)$urlData['reward'],
                        (float)$urlData['costs'],
-                       bigintval($urlData['payment_id']),
                        $urlData['status']
                ), __FILE__, __LINE__
        );
@@ -481,8 +489,8 @@ function SURFBAR_CHECK_VALIDATION_CODE ($id, $check, $salt) {
 }
 // Lockdown the userid/id combination (reload lock)
 function SURFBAR_LOCKDOWN_ID ($id) {
-       //* DEBUG: */ print "LOCK!");
-       ///* DEBUG: */ return;
+       //* //DEBUG: */ print "LOCK!");
+       ///* //DEBUG: */ return;
        // Just add it to the database
        SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_locks (userid, url_id) VALUES(%s, %s)",
                array($GLOBALS['userid'], bigintval($id)), __FILE__, __LINE__);
@@ -493,15 +501,11 @@ function SURFBAR_LOCKDOWN_ID ($id) {
 }
 // Pay points to the user and remove it from the sender
 function SURFBAR_PAY_POINTS ($id) {
-       global $SURFBAR_CACHE, $_CONFIG;
-
-       // Re-configure ref-system to surfbar levels
-       $_CONFIG['db_percents'] = "percent";
-       $_CONFIG['db_table']    = "surfbar_reflevels";
-
        // Remove it from the URL owner
        //DEBUG_LOG(__FUNCTION__.":uid=".SURFBAR_GET_USERID().",costs=".SURFBAR_GET_COSTS()."");
-       SUB_POINTS(SURFBAR_GET_USERID(), SURFBAR_GET_COSTS());
+       if (SURFBAR_GET_USERID() > 0) {
+               SUB_POINTS(SURFBAR_GET_USERID(), SURFBAR_GET_COSTS());
+       } // END - if
 
        // Book it to the user
        //DEBUG_LOG(__FUNCTION__.":uid=".$GLOBALS['userid'].",reward=".SURFBAR_GET_REWARD()."");
@@ -594,7 +598,7 @@ function SURFBAR_DETERMINE_DEPLETED_USERIDS() {
 
                // Get all userid except logged in one
                $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_surfbar_urls
-WHERE userid != %s AND status='CONFIRMED'
+WHERE userid NOT IN (%s,0) AND status='CONFIRMED'
 GROUP BY userid
 ORDER BY userid ASC",
                        array($GLOBALS['userid']), __FILE__, __LINE__);
@@ -634,11 +638,14 @@ function SURFBAR_DETERMINE_TOTAL_ONLINE () {
        global $_CONFIG;
 
        // Count all users in surfbar modue and return the value
-       $result = SQL_QUERY_ESC("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_surfbar_stats WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_online)) <= %s",
+       $result = SQL_QUERY_ESC("SELECT id
+FROM "._MYSQL_PREFIX."_surfbar_stats
+WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_online)) <= %s
+GROUP BY userid",
                array($_CONFIG['online_timeout']), __FILE__, __LINE__);
 
        // Fetch count
-       list($cnt) = SQL_FETCHROW($result);
+       $cnt = SQL_NUMROWS($result);
 
        // Free result
        SQL_FREERESULT($result);
@@ -646,6 +653,25 @@ function SURFBAR_DETERMINE_TOTAL_ONLINE () {
        // Return result
        return $cnt;
 }
+// Determine waiting time for one URL 
+function SURFBAR_DETERMINE_WAIT_TIME () {
+       global $_CONFIG;
+
+       // Init time
+       $time = 0;
+
+       // Which payment model do we have?
+       if ($_CONFIG['surfbar_pay_model'] == "STATIC") {
+               // Static model
+               $time = $_CONFIG['surfbar_static_time'];
+       } else {
+               // Dynamic
+               die("DYNAMIC payment model not yet finished!");
+       }
+
+       // Return value
+       return $time;
+}
 // Changes the status of an URL from given to other
 function SURFBAR_CHANGE_STATUS ($id, $prevStatus, $newStatus) {
        // Get URL data for status comparison
@@ -685,70 +711,65 @@ function SURFBAR_CHANGE_STATUS ($id, $prevStatus, $newStatus) {
        // 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!!!
-function SURFBAR_DETERMINE_NEXT_ID ($id = 0) {
-       global $SURFBAR_CACHE, $_CONFIG;
-
-       // Default is no id!
-       $nextId = 0; $randNum = 0;
-
-       // Is the ID set?
-       if ($id == 0) {
-               // Prepare some arrays
-               $IDs = array();
-               $USE = array();
-               $ignored = array();
+// "Getter" for lock ids array
+function SURFBAR_GET_LOCK_IDS () {
+       // Prepare some arrays
+       $IDs = array();
+       $USE = array();
+       $ignored = array();
 
-               // Get all id from locks within the timestamp
-               $result = SQL_QUERY_ESC("SELECT id, url_id, UNIX_TIMESTAMP(last_surfed)
+       // Get all id from locks within the timestamp
+       $result = SQL_QUERY_ESC("SELECT id, url_id, UNIX_TIMESTAMP(last_surfed) AS last
 FROM
        "._MYSQL_PREFIX."_surfbar_locks
 WHERE
        userid=%s
 ORDER BY
        id ASC", array($GLOBALS['userid']),
-                       __FILE__, __LINE__);
-
-               // Load all entries
-               while (list($id, $url, $last) = SQL_FETCHROW($result)) {
-                       //DEBUG_LOG(__FUNCTION__.":next - id={$id},url={$url},last={$last}");
-                       // Skip entries that are too old
-                       if (($last < (time() - SURFBAR_GET_DATA('surf_lock'))) && (!in_array($url, $ignored))) {
-                               //DEBUG_LOG(__FUNCTION__.":okay - id={$id},url={$url},last={$last}");
-                               // Add only if missing or bigger
-                               if ((!isset($IDs[$url])) || ($IDs[$url] <= $last)) {
-                                       // Add this ID
-                                       //DEBUG_LOG(__FUNCTION__.":ADD - id={$id},url={$url},last={$last}");
-                                       $IDs[$url] = $last;
-                                       $USE[$url] = $id;
-                               } // END - if
-                       } else {
-                               // Ignore these old entries!
-                               //DEBUG_LOG(__FUNCTION__.":ignore - id={$id},url={$url},last={$last}");
-                               $ignored[] = $url;
-                               unset($IDs[$url]);
-                               unset($USE[$url]);
-                       }
-               } // END - while
-
-               // Free result
-               SQL_FREERESULT($result);
+               __FILE__, __LINE__);
+
+       // Load all entries
+       while (list($lid, $url, $last) = SQL_FETCHROW($result)) {
+               // Debug message
+               //DEBUG_LOG(__FUNCTION__.":next - lid={$lid},url={$url},rest=".(time() - $last)."/".SURFBAR_GET_DATA('surf_lock')."");
+
+               // Skip entries that are too old
+               if (($last > (time() - SURFBAR_GET_DATA('surf_lock'))) && (!in_array($url, $ignored))) {
+                       // Debug message
+                       //DEBUG_LOG(__FUNCTION__.":okay - lid={$lid},url={$url},last={$last}");
+
+                       // Add only if missing or bigger
+                       if ((!isset($IDs[$url])) || ($IDs[$url] > $last)) {
+                               // Debug message
+                               //DEBUG_LOG(__FUNCTION__.":ADD - lid={$lid},url={$url},last={$last}");
+
+                               // Add this ID
+                               $IDs[$url] = $last;
+                               $USE[$url] = $lid;
+                       } // END - if
+               } else {
+                       // Debug message
+                       //DEBUG_LOG(__FUNCTION__.":ignore - lid={$lid},url={$url},last={$last}");
 
-               // Shall we add some ids?
-               $ADD = "";
-               if (count($USE) > 0) {
-                       $ADD = " AND l.id IN (".implode(",", $USE).")";
-               } // END - if
+                       // Ignore these old entries!
+                       $ignored[] = $url;
+                       unset($IDs[$url]);
+                       unset($USE[$url]);
+               }
+       } // END - while
 
-               // Determine depleted user account
-               $UIDs = SURFBAR_DETERMINE_DEPLETED_USERIDS();
+       // Free result
+       SQL_FREERESULT($result);
 
-               // Count max availabe entries
-               $result = SQL_QUERY("SELECT sbu.id AS cnt
+       // Return array
+       return $USE;
+}
+// "Getter" for maximum random number
+function SURFBAR_GET_MAX_RANDOM ($UIDs, $ADD) {
+       global $_CONFIG;
+       // Count max availabe entries
+       $result = SQL_QUERY("SELECT sbu.id AS cnt
 FROM "._MYSQL_PREFIX."_surfbar_urls AS sbu
-LEFT JOIN "._MYSQL_PREFIX."_payments AS p
-ON sbu.payment_id=p.id
 LEFT JOIN "._MYSQL_PREFIX."_surfbar_salts AS sbs
 ON sbu.id=sbs.url_id
 LEFT JOIN "._MYSQL_PREFIX."_surfbar_locks AS l
@@ -756,27 +777,62 @@ ON sbu.id=l.url_id
 WHERE sbu.userid NOT IN (".implode(",", $UIDs).") AND sbu.status='CONFIRMED'".$ADD."
 GROUP BY sbu.id", __FILE__, __LINE__);
 
-               // Log last query
-               //DEBUG_LOG(__FUNCTION__.":lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS($result)."");
+       // Log last query
+       //DEBUG_LOG(__FUNCTION__.":lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS($result)."");
 
-               // Fetch max rand
-               $maxRand = SQL_NUMROWS($result);
+       // Fetch max rand
+       $maxRand = SQL_NUMROWS($result);
 
-               // Free result
-               SQL_FREERESULT($result);
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return value
+       return $maxRand;
+}
+// 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) {
+       global $SURFBAR_CACHE, $_CONFIG;
+
+       // Default is no id and no random number
+       $nextId = 0;
+       $randNum = 0;
+
+       // Is the ID set?
+       if ($id == 0) {
+               // Get array with lock ids
+               $USE = SURFBAR_GET_LOCK_IDS();
+
+               // Shall we add some URL ids to ignore?
+               $ADD = "";
+               if (count($USE) > 0) {
+                       // Ignore some!
+                       $ADD = " AND sbu.id NOT IN (";
+                       foreach ($USE as $url_id => $lid) {
+                               // Add URL id
+                               $ADD .= $url_id.",";
+                       } // END - foreach
+
+                       // Add closing bracket
+                       $ADD = substr($ADD, 0, -1) . ")";
+               } // END - if
+
+               // Determine depleted user account
+               $UIDs = SURFBAR_DETERMINE_DEPLETED_USERIDS();
+
+               // Get maximum randomness factor
+               $maxRand = SURFBAR_GET_MAX_RANDOM($UIDs, $ADD);
 
                // If more than one URL can be called generate the random number!
                if ($maxRand > 1) {
                        // Generate random number
-                       $randNum = mt_rand(0, $maxRand);
+                       $randNum = mt_rand(0, ($maxRand - 1));
                } // END - if
 
                // And query the database
                //DEBUG_LOG(__FUNCTION__.":randNum={$randNum},maxRand={$maxRand},surfLock=".SURFBAR_GET_DATA('surf_lock')."");
-               $result = SQL_QUERY_ESC("SELECT sbu.id, sbu.userid, sbu.url, sbs.last_salt, sbu.reward, sbu.costs, sbu.views_total, p.time, UNIX_TIMESTAMP(l.last_surfed) AS last_surfed
+               $result = SQL_QUERY_ESC("SELECT sbu.id, sbu.userid, sbu.url, sbs.last_salt, sbu.reward, sbu.costs, sbu.views_total, UNIX_TIMESTAMP(l.last_surfed) AS last_surfed
 FROM "._MYSQL_PREFIX."_surfbar_urls AS sbu
-LEFT JOIN "._MYSQL_PREFIX."_payments AS p
-ON sbu.payment_id=p.id
 LEFT JOIN "._MYSQL_PREFIX."_surfbar_salts AS sbs
 ON sbu.id=sbs.url_id
 LEFT JOIN "._MYSQL_PREFIX."_surfbar_locks AS l
@@ -789,10 +845,8 @@ LIMIT %s,1",
                );
        } else {
                // Get data from specified id number
-               $result = SQL_QUERY_ESC("SELECT sbu.id, sbu.userid, sbu.url, sbs.last_salt, sbu.reward, sbu.costs, sbu.views_total, p.time, UNIX_TIMESTAMP(l.last_surfed) AS last_surfed
+               $result = SQL_QUERY_ESC("SELECT sbu.id, sbu.userid, sbu.url, sbs.last_salt, sbu.reward, sbu.costs, sbu.views_total, UNIX_TIMESTAMP(l.last_surfed) AS last_surfed
 FROM "._MYSQL_PREFIX."_surfbar_urls AS sbu
-LEFT JOIN "._MYSQL_PREFIX."_payments AS p
-ON sbu.payment_id=p.id
 LEFT JOIN "._MYSQL_PREFIX."_surfbar_salts AS sbs
 ON sbu.id=sbs.url_id
 LEFT JOIN "._MYSQL_PREFIX."_surfbar_locks AS l
@@ -811,12 +865,8 @@ LIMIT 1",
                $SURFBAR_CACHE = merge_array($SURFBAR_CACHE, SQL_FETCHARRAY($result));
                //DEBUG_LOG(__FUNCTION__.":count(".count($SURFBAR_CACHE).") - AFTER");
 
-               // Is the time there?
-               if (is_null($SURFBAR_CACHE['time'])) {
-                       // Then repair it wit the static!
-                       //DEBUG_LOG(__FUNCTION__.":time - STATIC!");
-                       $SURFBAR_CACHE['time'] = $_CONFIG['surfbar_static_time'];
-               } // END - if
+               // Determine waiting time
+               $SURFBAR_CACHE['time'] = SURFBAR_DETERMINE_WAIT_TIME();
 
                // Is the last salt there?
                if (is_null($SURFBAR_CACHE['last_salt'])) {
index c66ba0da31534461f36e7de146efc1b740089439..88e4a469f22e6b7f85a59edfb104f3f5955b9cfb 100644 (file)
@@ -196,7 +196,6 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode ==
 
                // Special functions file
                $file3 = sprintf("%sinc/libs/%s_functions.php", PATH, $name);
-               echo $file3."<br />\n";
 
                // Does the extension file exists?
                if (file_exists($file1) && is_readable($file1)) {
@@ -226,7 +225,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode ==
                        }
 
                        // Load extension
-                       if ($name != "sql_patches")     {
+                       if ($name != "sql_patches") {
                                // Load extension's file
                                include_once($file1);
                        } else {
index 209036a08c221ece060e498d18381dea812e77a9..f02615ef8435c52725a7ca629d3a1798d677c2c0 100644 (file)
  ************************************************************************/
 
 // Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))
-{
+if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
+
 // Add description as navigation point
 ADD_DESCR("admin", basename(__FILE__));
 
diff --git a/inc/modules/admin/what-add_surfbar_url.php b/inc/modules/admin/what-add_surfbar_url.php
new file mode 100644 (file)
index 0000000..2aef15f
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/09/2008 *
+ * ================                             Last change: 09/09/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-add_surfbar_url.php                         *
+ * -------------------------------------------------------------------- *
+ * Short description : Admin may add own URLs to the surfbar            *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Admin kann eigene URLs der Surfbar hinzufuegen   *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+}
+
+// Add description as navigation point
+ADD_DESCR("admin", basename(__FILE__));
+
+// Was an URL added?
+if ((isset($_POST['add'])) && (!empty($_POST['url']))) {
+       // Then add this URL
+       if (SURFBAR_ADMIN_ADD_URL($_POST['url'])) {
+               // URL was added
+               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_URL_ADDED);
+       } else {
+               // Not added
+               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_URL_NOT_ADDED);
+       }
+} // END - if
+
+// Load template
+LOAD_TEMPLATE("admin_add_surfbar_url");
+
+//
+?>
index 1cd75f1270cddb5414a29bdb80f1ac936e6c9085..e4a40f8023c71ffbb8a2f2299b78c40f32d750cf 100644 (file)
@@ -75,17 +75,6 @@ if (isset($_POST['ok'])) {
                define('__CONFIG_SURFBAR_PAY_MODEL_DYNAMIC', " checked=\"checked\"");
        }
 
-       // Prepare admin notify
-       if ($_CONFIG['surfbar_notify_admin_unlock'] == "Y") {
-               // Yes selected
-               define('__CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK_Y' , " checked=\"checked\"");
-               define('__CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK_N', "");
-       } else {
-               // No selected
-               define('__CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK_Y' , "");
-               define('__CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK_N', " checked=\"checked\"");
-       }
-
        // Prepare auto-sart
        if ($_CONFIG['surfbar_autostart'] == "Y") {
                // Yes selected
diff --git a/inc/modules/admin/what-list_surfbar_reflvl.php b/inc/modules/admin/what-list_surfbar_reflvl.php
deleted file mode 100644 (file)
index 839bce0..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-/************************************************************************
- * MXChange v0.2.1                                    Start: 09/01/2008 *
- * ================                             Last change: 09/01/2008 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : what-list_surfbar_reflvl.php                     *
- * -------------------------------------------------------------------- *
- * Short description : List referal levels for surfbar                  *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Referalebenen der Surfbar auflisten              *
- * -------------------------------------------------------------------- *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
- * For more information visit: http://www.mxchange.org                  *
- *                                                                      *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or    *
- * (at your option) any later version.                                  *
- *                                                                      *
- * This program is distributed in the hope that it will be useful,      *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
- * GNU General Public License for more details.                         *
- *                                                                      *
- * You should have received a copy of the GNU General Public License    *
- * along with this program; if not, write to the Free Software          *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
- * MA  02110-1301  USA                                                  *
- ************************************************************************/
-
-// Some security stuff...
-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 a level?
-if ((isset($_POST['add'])) && (!empty($_POST['lvl'])) && (!empty($_POST['perc']))) {
-       // Rewrite percentage and level
-       $percent = (float) str_replace(",", ".", $_POST['perc']);
-       $level   = bigintval($_POST['lvl']);
-
-       // Add the referal level
-       ADMIN_SPONSOR_ADD_REFERAL_LEVEL($levl, $percent);
-} // END - if
-
-// Load all referal levels
-$result = SQL_QUERY("SELECT id, level, percent FROM "._MYSQL_PREFIX."_surfbar_reflevels ORDER BY level ASC", __FILE__, __LINE__);
-
-// Some levels found?
-if (SQL_NUMROWS($result) > 0) {
-       // List all levels
-       $OUT = ""; $SW = 2;
-       while ($content = SQL_FETCHARRAY($result)) {
-               // Prepare content
-               $content['percent'] = TRANSLATE_COMMA($content['percent']);
-               $content['sw'] = $SW;
-
-               // Load row template
-               $OUT .= LOAD_TEMPLATE("admin_list_surfbar_reflvl_row", true, $content);
-
-               // Switch color
-               $SW = 3 - $SW;
-       } // END - while
-
-       // Load main template
-       LOAD_TEMPLATE("admin_list_surfbar_reflvl", false, $OUT);
-} else {
-       // No level setup so far
-       LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_NO_REF_LEVELS_FOUND);
-}
-
-// Free result
-SQL_FREERESULT($result);
-
-// Add space
-OUTPUT_HTML("<br />");
-
-// Output form for adding new level
-LOAD_TEMPLATE("admin_add_surfbar_reflvl");
-
-//
-?>
index 89da1f3e73feb4c4dd2645a6d22a0f83e0cb425c..0131dd295beec94a4affb3f35fd0884cc0d7c1be 100644 (file)
@@ -94,25 +94,15 @@ LIMIT 1",
 
                                                // Subtract bonus points from system
                                                BONUS_POINTS_HANDLER($_CONFIG['bonus_order']);
-                                       }
+                                       } // END - if
 
-                                       // Check for surfbar extension
-                                       $msg_user = "MISSING";
-                                       if (EXT_IS_ACTIVE("surfbar")) {
-                                               // Add the url
-                                               $insertId = SURFBAR_ADMIN_ADD_URL($DATA['url'], $DATA['sender'], $DATA['payment'], $DATA['payment_id']);
-
-                                               // Load email template
-                                               $msg_user = LOAD_EMAIL_TEMPLATE("order_accept_sb", $insertId, $DATA['sender']);
-                                       } else {
-                                               // Load email template
-                                               $msg_user = LOAD_EMAIL_TEMPLATE("order-accept", "", $DATA['sender']);
-                                       }
+                                       // Load email template
+                                       $msg_user = LOAD_EMAIL_TEMPLATE("order-accept", "", $DATA['sender']);
 
                                        // Send email
                                        SEND_EMAIL($DATA['sender'], MEMBER_ORDER_ACCEPTED, $msg_user);
-                               }
-                       }
+                               } // END - if
+                       } // END - foreach
 
                        // Set message
                        $MSG = ADMIN_MAILS_ACTIVATED;
index 65dddf0dc441b654ba9ca2df7ad8959a2142ff7f..acb470a3a77c351fed88918dd9959998fdb036f4 100644 (file)
@@ -56,7 +56,7 @@ $content = array(
 );
 
 // Load the template
-LOAD_TEMPLATE("member_start_".strtolower($_CONFIG['surfbar_pay_model']), false, $content);
+LOAD_TEMPLATE("member_surfbar_start_".strtolower($_CONFIG['surfbar_pay_model']), false, $content);
 
 // Load surfbar link template
 LOAD_TEMPLATE("member_surfbar_link");
index 61a98d58c70fcdd46e45dae4a10e07575dcdd792..ade9cabcd67dffc5535110075814da747b30a4b3 100644 (file)
@@ -1044,6 +1044,9 @@ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $lock
 {
        global $DEPTH, $_CONFIG, $DATA, $link;
 
+       // Debug message
+       //DEBUG_LOG(__FUNCTION__.": uid={$uid},points={$points}");
+
        // When $uid = 0 add points to jackpot
        if ($uid == "0") {
                // Add points to jackpot
@@ -1067,48 +1070,65 @@ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $lock
        // Which points, locked or normal?
        $data = "points"; if ($locked) $data = "locked_points";
 
+       // Check user account
        $result_user = SQL_QUERY_ESC("SELECT refid, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
         array(bigintval($uid)), __FILE__, __LINE__);
+
        //* DEBUG */ echo "+".SQL_NUMROWS($result_user).":".$points."+<br />\n";
        if (SQL_NUMROWS($result_user) == 1) {
                // This is the user and his ref
                list ($ref, $email) = SQL_FETCHROW($result_user);
-               SQL_FREERESULT($result_user);
 
-               $result = SQL_QUERY_ESC("SELECT %s FROM "._MYSQL_PREFIX."_%s WHERE level='%s' LIMIT 1",
+               // Debug message
+               //DEBUG_LOG(__FUNCTION__.": ref={$ref},email={$email},DEPTH={$DEPTH}");
+
+               // Get referal data
+               $result_lvl = SQL_QUERY_ESC("SELECT %s FROM "._MYSQL_PREFIX."_%s WHERE level='%s' LIMIT 1",
                 array($percents, $table, bigintval($DEPTH)), __FILE__, __LINE__);
                //* DEBUG */ echo "DEPTH:".$DEPTH."<br />\n";
-               if (SQL_NUMROWS($result) == 1) {
-                       list($per) = SQL_FETCHROW($result);
-                       SQL_FREERESULT($result);
-                       $P = $points * $per / 100;
-                       //* DEBUG */ echo "ADD:".$P."<br />\n";
+               if (SQL_NUMROWS($result_lvl) == 1) {
+                       // Get percents
+                       list($per) = SQL_FETCHROW($result_lvl);
+
+                       // Calculate new points
+                       $ref_points = $points * $per / 100;
+
+                       // Debug message
+                       //DEBUG_LOG(__FUNCTION__.": percent={$per},ref_points={$ref_points}");
 
                        // Update points...
-                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET %s=%s+%s WHERE userid=%s AND ref_depth=%s LIMIT 1",
-                        array($data, $data, $P, bigintval($uid), bigintval($DEPTH)), __FILE__, __LINE__);
-                       if (SQL_AFFECTEDROWS($link, __FILE__, __LINE__) == 0) {
+                       SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET %s=%s+%s WHERE userid=%s AND ref_depth=%d LIMIT 1",
+                        array($data, $data, $ref_points, bigintval($uid), bigintval($DEPTH)), __FILE__, __LINE__);
+
+                       // Debug log
+                       //DEBUG_LOG(__FUNCTION__.": affectedRows=".SQL_AFFECTEDROWS().",DEPTH={$DEPTH}");
+
+                       // No entry updated?
+                       if (SQL_AFFECTEDROWS() == 0) {
                                // First ref in this level! :-)
-                               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid, ref_depth, %s) VALUES (%s, %s, %s)",
-                                array($data, bigintval($uid), bigintval($DEPTH), $P), __FILE__, __LINE__);
-                       }
+                               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid, ref_depth, %s) VALUES (%s, %d, %s)",
+                                array($data, bigintval($uid), bigintval($DEPTH), $ref_points), __FILE__, __LINE__);
+
+                               // Debug log
+                               //DEBUG_LOG(__FUNCTION__.": insertedRows=".SQL_AFFECTEDROWS()."");
+                       } // END - if
 
                        // Update mediadata as well
                        if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
                                // Update database
-                               MEDIA_UPDATE_ENTRY(array("total_points"), "add", $P);
-                       }
+                               MEDIA_UPDATE_ENTRY(array("total_points"), "add", $ref_points);
+                       } // END - if
 
                        // Points updated, maybe I shall send him an email?
                        if (($send_notify) && ($ref > 0) && (!$locked)) {
                                //              0                1      2              3
-                               $DATA = array($per, bigintval($DEPTH), $P, bigintval($ref));
+                               $DATA = array($per, bigintval($DEPTH), $ref_points, bigintval($ref));
                                $msg = LOAD_EMAIL_TEMPLATE("confirm-referral", "", bigintval($uid));
 
                                SEND_EMAIL($email, THANX_REFERRAL_ONE, $msg);
                        } elseif (($send_notify) && ($ref == 0) && (!$locked) && ($add_mode == "direct") && (!defined('__POINTS_VALUE'))) {
                                // Direct payment shall be notified about
-                               define('__POINTS_VALUE', $P);
+                               define('__POINTS_VALUE', $ref_points);
 
                                // Load message
                                $msg = LOAD_EMAIL_TEMPLATE("add-points", REASON_DIRECT_PAYMENT, $uid);
@@ -1124,7 +1144,13 @@ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $lock
                                ADD_POINTS_REFSYSTEM($ref, $points, $send_notify, $ref, $locked);
                        }
                }
+
+               // Free result
+               SQL_FREERESULT($result_lvl);
        }
+
+       // Free result
+       SQL_FREERESULT($result_user);
 }
 //
 function UPDATE_REF_COUNTER($uid)
@@ -1635,7 +1661,7 @@ function UPDATE_CONFIG ($entries, $values, $updateMode="") {
        }
 
        // Run database update
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__.":entries={$entries}");
+       //DEBUG_LOG(__FUNCTION__.":entries={$entries}");
        SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET ".$entries." WHERE config=0 LIMIT 1", __FILE__, __LINE__);
 
        // Destroy cache
index d02553d28cf7f2190d43cec05d7fb7a24d2c35e5..ed38b6744a77982e28883baf775165ffd31655d1 100644 (file)
@@ -6,17 +6,9 @@ Hier sind alle Daten aus der Mail:
 ------------------------------------------
 Gebuchte URL: $content[url]
 ------------------------------------------
-Betreff: $DATA[subject]
-------------------------------------------
-Email: $DATA[email]
-------------------------------------------
 Framekiller-Test:
 $content[frametester]
 ------------------------------------------
-User-ID: $content[uid]
-------------------------------------------
-Verg&uuml;tung/Aufruf: $content[reward] {!POINTS!}
-------------------------------------------
 Status: $content[status]
 ------------------------------------------
 ID in der Surfbar: $content[insert_id]
diff --git a/templates/de/html/admin/admin_add_surfbar_reflvl.tpl b/templates/de/html/admin/admin_add_surfbar_reflvl.tpl
deleted file mode 100644 (file)
index 6d13d3e..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<FORM action="{!URL!}/modules.php?module=admin&amp;what=list_surfbar_reflvl" method="POST" style="margin-bottom: 0px">
-<TABLE border="0" cellspacing="0" cellpadding="0" align="center" class="admin_table dashed">
-       <TR>
-               <TD class="admin_title bottom2" width="10" height="30">&nbsp;</TD>
-               <TD class="admin_title bottom2" colspan="3" align="center">
-                       <STRONG>{--ADMIN_SURFBAR_ADD_NEW_REFDEPTH--}</STRONG>
-               </TD>
-               <TD class="admin_title bottom2" width="10">&nbsp;</TD>
-       </TR>
-       <TR>
-               <TD class="seperator" colspan="5" height="7">&nbsp;</TD>
-       </TR>
-       <TR>
-               <TD class="seperator" width="10">&nbsp;</TD>
-               <TD align="right" width="200">{--ENTER_REF_LVL--}:</TD>
-               <TD class="seperator" width="10">&nbsp;</TD>
-               <TD><INPUT type="text" name="lvl" class="admin_normal" size="3" maxlength="3" /></TD>
-               <TD class="seperator" width="10">&nbsp;</TD>
-       </TR>
-       <TR>
-               <TD class="seperator" colspan="5" height="7">&nbsp;</TD>
-       </TR>
-       <TR>
-               <TD class="seperator" width="10">&nbsp;</TD>
-               <TD align="right" width="200">{--ENTER_REF_PERCENTS--}:</TD>
-               <TD class="seperator" width="10">&nbsp;</TD>
-               <TD><INPUT type="text" name="perc" class="admin_normal" size="3" maxlength="3" />%</TD>
-               <TD class="seperator" width="10">&nbsp;</TD>
-       </TR>
-       <TR>
-               <TD class="seperator bottom2" colspan="5" height="7">&nbsp;</TD>
-       </TR>
-       <TR>
-               <TD class="admin_footer seperator" width="10">&nbsp;</TD>
-               <TD class="admin_footer" colspan="3" align="center">
-                       <INPUT type="reset" class="admin_reset" value="{--CLEAR_FORM--}" />&nbsp;*
-                       <INPUT type="submit" name="add" class="admin_submit" value="{--ADD_DEPTH--}">
-               </TD>
-               <TD class="admin_footer seperator" width="10">&nbsp;</TD>
-       </TR>
-</TABLE>
-</FORM>
\ No newline at end of file
diff --git a/templates/de/html/admin/admin_add_surfbar_url.tpl b/templates/de/html/admin/admin_add_surfbar_url.tpl
new file mode 100644 (file)
index 0000000..16a2606
--- /dev/null
@@ -0,0 +1,16 @@
+<form action="{!URL!}/modules.php?module=admin&amp;what=add_surfbar_url" method="post">
+<div class="admin_table dashed" style="width:600px;margin-top:10px">
+       <div class="admin_title bottom2" style="padding-top:5px;padding-bottom:5px">
+               <strong>URL in Surfbar hinzuf&uuml;gen:</strong>
+       </div>
+
+       <div class="admin_input" style="padding-top:5px;padding-bottom:5px" align="center">
+               URL eingeben: <input type="text" name="url" size="20" maxlength="255" value="http://" />
+       </div>
+
+       <div class="admin_title top2" style="padding-top:3px;padding-bottom:3px">
+               <input type="reset" class="admin_reset" value="{--CLEAR_FORM--}" />&nbsp;*
+               <input type="submit" class="admin_submit" name="add" value="{--ADMIN_SURFBAR_ADD_URL--}" />
+       </div>
+</div>
+</form>
index 0228fd16850a67ddc281a2f182a5ef92201d9b66..47a9711d7de5ce96dfe12020e0d1feaa4fb8ba28 100644 (file)
                </TD>
        </TR>
        <TR>
-               <TD align="center" style="padding-right:5px">
+               <TD height="30" align="right" style="padding-right:5px">
                        {--ADMIN_CONFIG_SURFBAR_PAYMENT_MODEL_DYNAMIC--}
                </TD>
                <TD>
                        <INPUT type="radio" name="surfbar_pay_model" value="DYNAMIC"{--__CONFIG_SURFBAR_PAY_MODEL_DYNAMIC--} />
                </TD>
        </TR>
-       <TR><TD height="8" colspan="2" class="seperator">&nbsp;</TD></TR>
-       <TR><TD height="3" colspan="2" class="seperator bottom2">&nbsp;</TD></TR>
-       <TR>
-               <TD height="30" align="center" colspan="2" class="admin_footer bottom2">
-                       {--ADMIN_CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK--}
-               </TD>
-       </TR>
-       <TR><TD height="8" colspan="2" class="seperator">&nbsp;</TD></TR>
-       <TR>
-               <TD align="center" colspan="2">
-                       <INPUT type="radio" name="surfbar_notify_admin_unlock" value="Y"{--__CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK_Y--} /> {--ADMIN_SURFBAR_NOTIFY_UNLOCK_YES--}<BR />
-                       <INPUT type="radio" name="surfbar_notify_admin_unlock" value="N"{--__CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK_N--} /> {--ADMIN_SURFBAR_NOTIFY_UNLOCK_NO--}
-               </TD>
-       </TR>
-       <TR><TD height="8" colspan="2" class="seperator">&nbsp;</TD></TR>
        <TR><TD height="3" colspan="2" class="seperator bottom2">&nbsp;</TD></TR>
        <TR>
                <TD height="30" align="center" colspan="2" class="admin_footer bottom2">
diff --git a/templates/de/html/admin/admin_list_surfbar_reflvl.tpl b/templates/de/html/admin/admin_list_surfbar_reflvl.tpl
deleted file mode 100644 (file)
index bd5b74c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<FORM action="{!URL!}/modules.php?module=admin&amp;what=list_surfbar_reflvl" method="POST">
-<TABLE border="0" cellspacing="0" cellpadding="0" class="admin_table dashed">
-       <TR>
-               <TD align="center" colspan="3" class="admin_title" height="30"><STRONG>{--EDIT_DEL_REFDEPTH--}</STRONG>
-               </TD>
-       </TR>
-       <TR>
-               <TD class="admin_title bottom2 right2" width="30" align="center"><STRONG>{--ID_SELECT--}</STRONG></TD>
-               <TD class="admin_title bottom2 right2" width="275" align="center"><STRONG>{--REF_LEVEL--}:</STRONG></TD>
-               <TD class="admin_title bottom2" width="275" align="center"><STRONG>{--REF_PERCENT--}:</STRONG></TD>
-       </TR>
-       $content
-       <TR>
-               <TD class="admin_footer" colspan="3">
-                       <INPUT type="reset" class="admin_reset" value="{--UNDO_SELECTIONS--}">&nbsp;*
-                       <INPUT type="submit" name="edit" class="admin_submit" value="{--EDIT_LVL--}">&nbsp;*
-                       <INPUT type="submit" name="del" class="admin_delete" value="{--DEL_LVL--}">
-               </TD>
-       </TR>
-</TABLE>
-</FORM>
-
-<DIV class="admin_note">
-       {--ADMIN_REFERAL_LEVEL_ZERO_NOTICE--}
-</DIV>
diff --git a/templates/de/html/admin/admin_list_surfbar_reflvl_row.tpl b/templates/de/html/admin/admin_list_surfbar_reflvl_row.tpl
deleted file mode 100644 (file)
index 7a5b96d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<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[level]
-       </TD>
-       <TD align="center" class="bottom2 switch_sw$content[sw]">
-               $content[percent]%
-       </TD>
-</TR>
index 94d78173a073f4887eac0ef9c4adda67a855b63c..b95ed3735f52f4fd811bc6fab70a5024321058f4 100644 (file)
@@ -28,17 +28,3 @@ $content
 </TR>
 </TABLE>
 </FORM>
-
-<P></P>
-
-<FORM action="{!URL!}/modules.php?module=admin&amp;what=list_surfbar_urls" method="post">
-<DIV class="admin_table dashed" style="width:500px">
-       <DIV class="admin_title bottom2">
-               <STRONG>{--ADMIN_SURFBAR_SYNC_TITLE--}</STRONG>
-       </DIV>
-
-       <DIV class="admin_footer">
-               <INPUT type="submit" class="admin_submit" name="sync" value="{--ADMIN_SURFBAR_SYNC_BUTTON--}" />
-       </DIV>
-</DIV>
-</FORM>
index 957f122c186051727121f888bab5e8e9f4896384..7c6f3abbc3ccbbae151cfa35d0ce8dba770a6744 100644 (file)
@@ -34,6 +34,7 @@ function Confirm() {
 }
 
 function ReloadThis() {
+       parent.surfbar_stats.location.reload();
        this.location.reload();
 }