A lot has been rewritten, ext-teams added, ext-forced continued:
[mailer.git] / inc / modules / guest / what-sponsor_login.php
index 85c1595ec94d7cd47d53ab0e77fe484f704a93bb..caaab113579a429136f15defa03c6464dbcda65c 100644 (file)
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -43,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Add description as navigation point
-addMenuDescription('guest', __FILE__);
+addYouAreHereLink('guest', __FILE__);
 
 if ((!isExtensionActive('sponsor'))) {
-       loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('sponsor'));
+       displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=sponsor%}');
        return;
 } elseif (isSponsor()) {
        // Is already a logged-in sponsor
@@ -66,10 +64,10 @@ if (isGetRequestParameterSet('mode')) {
 if (isGetRequestParameterSet('hash')) {
        // Lookup sponsor
        $result = SQL_QUERY_ESC("SELECT
-       `id`, `status`, `gender`, `surname`, `family`,
-       `company`, `position`, `tax_ident`,
-       `street_nr1`, `street_nr2`, `country`, `zip`, `city`, `email`, `phone`, `fax`, `cell`,
-       `points_amount` AS points, `last_pay` AS pay, `last_curr` AS curr
+       `id`,`status`,`gender`,`surname`,`family`,
+       `company`,`position`,`tax_ident`,
+       `street_nr1`,`street_nr2`,`country`,`zip`,`city`,`email`,`phone`,`fax`,`cell`,
+       `points_amount` AS `points`,`last_payment`,`last_currency`
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
 WHERE
@@ -101,7 +99,7 @@ LIMIT 1",
                                ), __FILE__, __LINE__);
 
                        // Check on success
-                       if (SQL_AFFECTEDROWS() == 1) {
+                       if (!SQL_HASZEROAFFECTED()) {
                                // Prepare mail and send it to the sponsor
                                $message = loadEmailTemplate('sponsor_pending', $data);
                                sendEmail($data['email'], '{--SPONSOR_ACCOUNT_PENDING_SUBJECT--}', $message);
@@ -110,10 +108,10 @@ LIMIT 1",
                                sendAdminNotification('{--ADMIN_NEW_SPONSOR--}', 'admin_sponsor_pending', $data);
 
                                // Sponsor account set to pending
-                               loadTemplate('admin_settings_saved', false, '{--SPONSOR_ACCOUNT_IS_PENDING--}');
+                               displayMessage('{--SPONSOR_ACCOUNT_IS_PENDING--}');
                        } else {
                                // Could not unlock account!
-                               loadTemplate('admin_settings_saved', false, '{--SPONSOR_ACCOUNT_PENDING_FAILED--}');
+                               displayMessage('{--SPONSOR_ACCOUNT_PENDING_FAILED--}');
                        }
                } elseif ($data['status'] == 'EMAIL') {
                        // Changed email adress need to be confirmed
@@ -130,20 +128,20 @@ LIMIT 1",
                                array(bigintval($data['id']), getRequestParameter('hash')), __FILE__, __LINE__);
 
                        // Check on success
-                       if (SQL_AFFECTEDROWS() == 1) {
+                       if (!SQL_HASZEROAFFECTED()) {
                                // Sponsor account is unlocked again
-                               loadTemplate('admin_settings_saved', false, '{--SPONSOR_ACCOUNT_IS_CONFIRMED_AGAIN--}');
+                               displayMessage('{--SPONSOR_ACCOUNT_IS_CONFIRMED_AGAIN--}');
                        } else {
                                // Could not unlock account!
-                               loadTemplate('admin_settings_saved', false, '{--SPONSOR_ACCOUNT_EMAIL_FAILED--}');
+                               displayMessage('{--SPONSOR_ACCOUNT_EMAIL_FAILED--}');
                        }
                } else {
-                       /// ??? Other status?
-                       loadTemplate('admin_settings_saved', false, '{--SPONSOR_ACCOUNT_STATUS_FAILED--}');
+                       // ??? Other status?
+                       displayMessage('{--SPONSOR_ACCOUNT_STATUS_FAILED--}');
                }
        } else {
                // No sponsor found
-               loadTemplate('admin_settings_saved', false, getMaskedMessage('SPONSOR_ACCOUNT_404', getRequestParameter('hash')));
+               displayMessage('{%message,SPONSOR_ACCOUNT_404=' . getRequestParameter('hash') . '%}');
        }
 
        // Free memory
@@ -158,7 +156,7 @@ LIMIT 1",
        if (isFormSent()) {
                // Check email
                $result = SQL_QUERY_ESC("SELECT
-       `id`, `hash`, `status`, `remote_addr`, `gender`, `surname`, `family`,
+       `id`,`hash`,`status`,`remote_addr`,`gender`,`surname`,`family`,
        UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created`
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
@@ -187,10 +185,10 @@ LIMIT 1",
                        sendEmail(postRequestParameter('email'), '{--SPONSOR_ACTIVATION_LINK_SUBJECT--}', $message_sponsor);
 
                        // Output message
-                       loadTemplate('admin_settings_saved', false, '{--SPONSOR_ACTIVATION_LINK_SENT--}');
+                       displayMessage('{--SPONSOR_ACTIVATION_LINK_SENT--}');
                } else {
                        // No account found or not UNCONFIRMED
-                       loadTemplate('admin_settings_saved', false, '{--SPONSOR_ACTIVATION_LINK_404--}');
+                       displayMessage('{--SPONSOR_ACTIVATION_LINK_404--}');
                }
 
                // Free memory
@@ -209,7 +207,7 @@ LIMIT 1",
        if (isFormSent()) {
                // Check email
                $result = SQL_QUERY_ESC("SELECT
-       `id`, `hash`, `remote_addr`, `gender`, `surname`, `family`,
+       `id`,`hash`,`remote_addr`,`gender`,`surname`,`family`,
        UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created`
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
@@ -244,10 +242,10 @@ LIMIT 1",
                                array(md5($DATA['password']), bigintval($DATA['id'])), __FILE__, __LINE__);
 
                        // Output message
-                       loadTemplate('admin_settings_saved', false, '{--SPONSOR_LOST_PASSWORD_SENT--}');
+                       displayMessage('{--SPONSOR_LOST_PASSWORD_SENT--}');
                } else {
                        // No account found or not UNCONFIRMED
-                       loadTemplate('admin_settings_saved', false, '{--SPONSOR_LOST_PASSWORD_404--}');
+                       displayMessage('{--SPONSOR_LOST_PASSWORD_404--}');
                }
 
                // Free memory
@@ -285,21 +283,21 @@ LIMIT 1",
                                redirectToUrl('modules.php?module=sponsor');
                        } else {
                                // Cookie setup failed!
-                               loadTemplate('admin_settings_saved', false, '{--SPONSPOR_COOKIE_SETUP_FAILED--}');
+                               displayMessage('{--SPONSOR_COOKIE_SETUP_FAILED--}');
 
                                // Login formular and other links
                                loadTemplate('guest_sponsor_login');
                        }
                } else {
                        // Status is not fine
-                       loadTemplate('admin_settings_saved', false, '{--SPONSOR_LOGIN_FAILED_' . strtoupper($status) . '--}');
+                       displayMessage('{--SPONSOR_LOGIN_FAILED_' . strtoupper($status) . '--}');
 
                        // Login formular and other links
                        loadTemplate('guest_sponsor_login');
                }
        } else {
                // Account missing or wrong pass! We shall not find this out for the "cracker folks"...
-               loadTemplate('admin_settings_saved', false, '{--SPONSOR_LOGIN_FAILED_404_WRONG_PASS--}');
+               displayMessage('{--SPONSOR_LOGIN_FAILED_404_WRONG_PASS--}');
 
                // Login formular and other links
                loadTemplate('guest_sponsor_login');