]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_rallyes.php
More misc fixes and rewrites (sorry, lame description)
[mailer.git] / inc / modules / admin / what-list_rallyes.php
index 5d8c97163f4b550e24f8ad2251a63f53d87f9897..c2ed620c93e438ec6ca053ea9f5cd086b230592b 100644 (file)
@@ -57,37 +57,37 @@ if (REQUEST_ISSET_GET(('rallye'))) {
                // Activate / deactivate
                switch (REQUEST_GET('activate'))
                {
-               case '1': // Activate
-                       ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='Y' WHERE `id`=%s AND is_active='N' LIMIT 1");
-                       break;
+                       case '1': // Activate
+                               ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='Y' WHERE `id`=%s AND is_active='N' LIMIT 1");
+                               break;
 
-               case '0': // Deactivate
-                       ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='N' WHERE `id`=%s AND is_active='Y' LIMIT 1");
-                       break;
+                       case '0': // Deactivate
+                               ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='N' WHERE `id`=%s AND is_active='Y' LIMIT 1");
+                               break;
                }
-       } elseif (REQUEST_ISSET_GET(('notify'))) {
+       } elseif (REQUEST_ISSET_GET('notify')) {
                // Automatic notification
                switch (REQUEST_GET('notify'))
                {
-               case '1': // Activate
-                       ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='Y' WHERE `id`=%s AND send_notify='N' LIMIT 1");
-                       break;
+                       case '1': // Activate
+                               ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='Y' WHERE `id`=%s AND send_notify='N' LIMIT 1");
+                               break;
 
-               case '0': // Deactivate
-                       ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='N' WHERE `id`=%s AND send_notify='Y' LIMIT 1");
-                       break;
+                       case '0': // Deactivate
+                               ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='N' WHERE `id`=%s AND send_notify='Y' LIMIT 1");
+                               break;
                }
        } elseif (REQUEST_ISSET_GET(('auto'))) {
                // Automatic adding of new members
                switch (REQUEST_GET('auto'))
                {
-               case '1': // Activate
-                       ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='Y' WHERE `id`=%s AND auto_add_new_user='N' LIMIT 1");
-                       break;
+                       case '1': // Activate
+                               ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='Y' WHERE `id`=%s AND auto_add_new_user='N' LIMIT 1");
+                               break;
 
-               case '0': // Deactivate
-                       ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='N' WHERE `id`=%s AND auto_add_new_user='Y' LIMIT 1");
-                       break;
+                       case '0': // Deactivate
+                               ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='N' WHERE `id`=%s AND auto_add_new_user='Y' LIMIT 1");
+                               break;
                }
        }
 
@@ -104,11 +104,11 @@ if (REQUEST_ISSET_GET(('rallye'))) {
                foreach (REQUEST_POST('sel') as $id => $selected) {
                        // Remove selected rallye entirely...
                        ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE `id`=%s LIMIT 1",
-                               array(bigintval($id)), __FILE__, __LINE__, false));
+                       array(bigintval($id)), __FILE__, __LINE__, false));
                        ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s",
-                               array(bigintval($id)), __FILE__, __LINE__, false));
+                       array(bigintval($id)), __FILE__, __LINE__, false));
                        ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s",
-                               array(bigintval($id)), __FILE__, __LINE__, false));
+                       array(bigintval($id)), __FILE__, __LINE__, false));
                } // END - foreach
 
                // Run SQLS
@@ -146,16 +146,16 @@ end_time='%s',
 min_users='%s',
 min_prices='%s'
 WHERE `id`='".$id."' LIMIT 1",
-                               array(
-                                       $title,
-                                       REQUEST_POST('descr', $id),
-                                       REQUEST_POST('templ', $id),
-                                       bigintval($START),
-                                       bigintval($END),
-                                       bigintval(REQUEST_POST('min_users', $id)),
-                                       bigintval(REQUEST_POST('min_prices', $id)),
-                                       $id
-                               ), __FILE__, __LINE__, false));
+                       array(
+                       $title,
+                       REQUEST_POST('descr', $id),
+                       REQUEST_POST('templ', $id),
+                       bigintval($START),
+                       bigintval($END),
+                       bigintval(REQUEST_POST('min_users', $id)),
+                       bigintval(REQUEST_POST('min_prices', $id)),
+                       $id
+                       ), __FILE__, __LINE__, false));
                }
 
                // Run SQLS
@@ -178,7 +178,7 @@ if (REQUEST_ISSET_POST('edit')) {
 FROM `{!_MYSQL_PREFIX!}_rallye_data`
 WHERE `id`=%s
 LIMIT 1",
-                               array(bigintval($id)), __FILE__, __LINE__);
+                       array(bigintval($id)), __FILE__, __LINE__);
                        // Fetch an array
                        $content = SQL_FETCHARRAY($result);
 
@@ -225,7 +225,7 @@ LIMIT 1",
 } elseif ((REQUEST_GET('sub') == 'users') && (REQUEST_GET('rallye') > 0)) {
        // List users and their refs before start and current
        $result = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s ORDER BY `userid` ASC",
-               array(bigintval(REQUEST_GET('rallye'))), __FILE__, __LINE__);
+       array(bigintval(REQUEST_GET('rallye'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                $OUT = ''; $SW = 2;
                // @TODO Rewrite this constant
@@ -243,12 +243,12 @@ LIMIT 1",
                        if (($content['refs'] > 0) || ($cnt > 0)) {
                                // Insert link to referal list
                                //* DEBUG: */ echo '-'.$content['userid'].'/'.$cnt.'/'.$content['refs']."-<br />";
-                               $cnt = generateUserProfileLink($content['userid'], $cnt, "list_refs");
-                               $content['refs'] = generateUserProfileLink($content['userid'], $content['refs'], "list_refs");
+                               $cnt = generateUserProfileLink($content['userid'], $cnt, 'list_refs');
+                               $content['refs'] = generateUserProfileLink($content['userid'], $content['refs'], 'list_refs');
                        } // END - if
 
                        // Get user points
-                       $points = GET_TOTAL_DATA($content['userid'], "user_points", "points", 'userid', false, " AND ref_depth=1 LIMIT 1");
+                       $points = GET_TOTAL_DATA($content['userid'], 'user_points', 'points', 'userid', false, " AND `ref_depth`=1 LIMIT 1");
                        //* DEBUG: */ echo basename(__FILE__).":uid={$content['userid']},points={$points},opoints={$content['curr_points']}<br />\n";
 
                        // Prepare content
@@ -283,7 +283,7 @@ LIMIT 1",
        $result = SQL_QUERY("SELECT id, admin_id, title, descr, template, start_time, end_time, auto_add_new_user, is_active, send_notify, notified, min_users, min_prices
 FROM `{!_MYSQL_PREFIX!}_rallye_data`
 ORDER BY start_time DESC",
-               __FILE__, __LINE__);
+       __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // List found rallyes
                $OUT = ''; $SW = 2;
@@ -292,7 +292,7 @@ ORDER BY start_time DESC",
                        $content['alogin'] = getAdminLogin($content['admin_id']);
 
                        // Count joined userids
-                       $joined = GET_TOTAL_DATA($content['id'], "rallye_users", "id", "rallye_id", true);
+                       $joined = GET_TOTAL_DATA($content['id'], "rallye_users", 'id', "rallye_id", true);
 
                        // Did some users joined this rallye?
                        if ($joined > 0) {
@@ -310,7 +310,7 @@ ORDER BY start_time DESC",
                        $content = array(
                                'select'     => "<input type=\"checkbox\" name=\"sel[".$content['id']."]\" class=\"admin_normal\" value=\"1\" />",
                                'aid'        => $content['admin_id'],
-                               'email_link' => generateMemberEmailLink($content['admin_id']),
+                               'email_link' => generateEmailLink($content['admin_id']),
                                'alogin'     => $content['alogin'],
                                'id'         => $content['id'],
                                'sw'         => $SW,
@@ -332,45 +332,45 @@ ORDER BY start_time DESC",
                        // Is the rallye active or not?
                        switch ($content['is_active'])
                        {
-                       case 'Y':
-                               // Rallye is active so do not edit it!
-                               $content['select'] = "<div class=\"big\">".$content['id']."</div>";
-                               $content['active_title'] = getMessage('RALLYE_DEACTIVATE_NOW');
-                               $content['active'] = 0;
-                               break;
-
-                       case 'N':
-                               $content['active_title'] = getMessage('RALLYE_ACTIVATE_NOW');
-                               $content['active'] = '1';
-                               break;
+                               case 'Y':
+                                       // Rallye is active so do not edit it!
+                                       $content['select'] = "<div class=\"big\">".$content['id']."</div>";
+                                       $content['active_title'] = getMessage('RALLYE_DEACTIVATE_NOW');
+                                       $content['active'] = 0;
+                                       break;
+
+                               case 'N':
+                                       $content['active_title'] = getMessage('RALLYE_ACTIVATE_NOW');
+                                       $content['active'] = '1';
+                                       break;
                        }
 
                        // Notification to members?
                        switch ($content['send_notify'])
                        {
-                       case 'Y':
-                               $content['notify_title'] = getMessage('RALLYE_STOP_NOTIFY_NOW');
-                               $content['notify'] = 0;
-                               break;
-
-                       case 'N':
-                               $content['notify_title'] = getMessage('RALLYE_START_NOTIFY_NOW');
-                               $content['notify'] = '1';
-                               break;
+                               case 'Y':
+                                       $content['notify_title'] = getMessage('RALLYE_STOP_NOTIFY_NOW');
+                                       $content['notify'] = 0;
+                                       break;
+
+                               case 'N':
+                                       $content['notify_title'] = getMessage('RALLYE_START_NOTIFY_NOW');
+                                       $content['notify'] = '1';
+                                       break;
                        }
 
                        // Auto-add of new joined members?
                        switch ($content['auto_add_new_user'])
                        {
-                       case 'Y':
-                               $content['auto_title'] = getMessage('RALLYE_STOP_AUTO_ADD_NOW');
-                               $content['auto'] = 0;
-                               break;
-
-                       case 'N':
-                               $content['auto_title'] = getMessage('RALLYE_START_AUTO_ADD_NOW');
-                               $content['auto'] = '1';
-                               break;
+                               case 'Y':
+                                       $content['auto_title'] = getMessage('RALLYE_STOP_AUTO_ADD_NOW');
+                                       $content['auto'] = 0;
+                                       break;
+
+                               case 'N':
+                                       $content['auto_title'] = getMessage('RALLYE_START_AUTO_ADD_NOW');
+                                       $content['auto'] = '1';
+                                       break;
                        }
 
                        // Output row