]> git.mxchange.org Git - mailer.git/commitdiff
Sub id tracking continued:
authorRoland Häder <roland@mxchange.org>
Mon, 8 Oct 2012 17:27:14 +0000 (17:27 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 8 Oct 2012 17:27:14 +0000 (17:27 +0000)
- destroyMemberSession() does now accept optional $destroy parameter which will
  call session_destroy() instead of deleting member session entries
- Added sub modules for sub id tracking (with extra checks)
- Introduced isUserSubIdAssignedCurrentMember()
- TODOs.txt updated

.gitattributes
DOCS/TODOs.txt
inc/language/user_de.php
inc/libs/user_functions.php
inc/modules/member/subid- [new file with mode: 0644]
inc/modules/member/subid-stats.php [new file with mode: 0644]
inc/modules/member/what-logout.php
inc/modules/member/what-subids.php
inc/session-functions.php

index 483585893dd1d22f5874c95428ff02a29a12ab24..a1cfd2f84513081197d1f7e79682b75da2527e8a 100644 (file)
@@ -687,6 +687,8 @@ inc/modules/member/action-rals.php svneol=native#text/plain
 inc/modules/member/action-stats.php svneol=native#text/plain
 inc/modules/member/action-surfbar.php svneol=native#text/plain
 inc/modules/member/action-themes.php svneol=native#text/plain
+inc/modules/member/subid- svneol=native#text/plain
+inc/modules/member/subid-stats.php svneol=native#text/plain
 inc/modules/member/what- svneol=native#text/plain
 inc/modules/member/what-bank_create.php svneol=native#text/plain
 inc/modules/member/what-bank_deposit.php svneol=native#text/plain
index c48e27b4052d07ebaf463d84d4b39406396563fc..f2be12a9972cc4938dfa68f2603f727e38489c5b 100644 (file)
 ./inc/modules/member/what-beg.php:54:// @TODO Can't this be moved into EL?
 ./inc/modules/member/what-beg.php:63:// @TODO No more needed? define('__BEG_USERID_TIMEOUT', createFancyTime(getBegUseridTimeout()));
 ./inc/modules/member/what-logout.php:17: * @TODO Rewrite the code to a filter                                   *
+./inc/modules/member/what-logout.php:52:       // @TODO Move this in a filter, e.g. member_logout
 ./inc/modules/member/what-order.php:471:                       // @TODO Rewrite this to a filter
 ./inc/modules/member/what-order.php:84:                // @TODO Rewrite this to SQL_FETCHARRAY()
 ./inc/modules/member/what-payout.php:194:                                      // @TODO Rewrite this to a filter
index 2a4e3943ad926295b1a2fc905879f33c4ceb4a58..c027a56d6ca99fdcde90edf0183f1d9fc4a352c9 100644 (file)
@@ -126,8 +126,14 @@ addMessages(array(
        'MEMBER_USER_SUBID_STATS_LINK' => "Aufrufstatistiken",
        'MEMBER_USER_SUBID_ADDED' => "Sub-Id hinzugef&uuml;gt",
        'MEMBER_CHANGE_USER_SUBID' => "Geben Sie eine neue ein:",
+       'MEMBER_INVALID_DO_USER_SUBID' => "Ung&uuml;ltiges Sub-Modul aufgerufen! Sollten Sie der Meinung sein, dies ist ein Fehler, so teilen Sie bitte dem Support mit, wie es zu dieser Meldung gekommen ist.",
+       'MEMBER_USER_SUBID_NOT_ASSIGNED_404' => "Die angegebene Sub-Id-Kennung ist Ihrem Mitgliedsaccount nicht zugewiesen oder existiert nicht.",
+
+       // Member - sub ids - submit buttons
        'MEMBER_USER_SUBIDS_CHANGE_SUBMIT' => "Sub-Ids &auml;ndern",
        'MEMBER_USER_SUBIDS_REMOVE_SUBMIT' => "Sub-Ids l&ouml;schen",
+
+       // Member - sub ids - notices
        'MEMBER_EDIT_USER_SUBIDS_NOTICE' => "Wenn Sie doch nichts &auml;ndern wollen, klicken Sie einfach auf <strong>{--MEMBER_USER_SUBIDS_CHANGE_SUBMIT--}</strong> oder in der Navigation <strong>{--YOU_ARE_HERE--}</strong> auf Sub-Id Tracking.",
        'MEMBER_DELETE_USER_SUBIDS_NOTICE' => "Wollen Sie die oben aufgef&uuml;hrte(n) Sub-Id(s) wirklich l&ouml;schen? Dieses ist nicht umkehrbar! Die Statistik dazu bleibt noch eine Weile gespeichert, ist aber nicht mehr aus der Auswahl aufrufbar (Sie k&ouml;nnen sich ja den Link notieren?).",
 
index 06d621c0a877b29488a5ceaab649235c502666d0..e31d35a01634d148c55d734518f29258ad46ae59 100644 (file)
@@ -823,6 +823,18 @@ function prepareSubId ($subId) {
        return $subId;
 }
 
+// Check whether given sub *id* is assigned to current member
+function isUserSubIdAssignedToMember ($subId) {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__][$subId])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__][$subId] = ((isMember()) && (countSumTotalData(getMemberId(), 'user_subids', 'id', 'userid', true, sprintf(" AND `id`=%s", bigintval($subId))) == 1));
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__][$subId];
+}
+
 //-----------------------------------------------------------------------------
 //                                EL code functions
 //-----------------------------------------------------------------------------
diff --git a/inc/modules/member/subid- b/inc/modules/member/subid-
new file mode 100644 (file)
index 0000000..cae8812
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 10/08/2012 *
+ * ===================                          Last change: 10/08/2012 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : subid-                                           *
+ * -------------------------------------------------------------------- *
+ * Short description :                                                  *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  :                                                  *
+ * -------------------------------------------------------------------- *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://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 (!defined('__SECURITY')) {
+       exit();
+} elseif (!isMember()) {
+       redirectToIndexMemberOnlyModule();
+} elseif ((!isGetRequestElementSet('id')) || (!isUserSubIdAssignedToMember(getRequestElement('id')))) {
+       redirectToUrl('modules.php?module=login&amp;what=subids');
+}
+
+// [EOF]
+?>
diff --git a/inc/modules/member/subid-stats.php b/inc/modules/member/subid-stats.php
new file mode 100644 (file)
index 0000000..d9d3649
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 10/08/2012 *
+ * ===================                          Last change: 10/08/2012 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : subid-stats.php                                  *
+ * -------------------------------------------------------------------- *
+ * Short description : Statistics sub-module for sub ids                *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Statistik-Untermodul fuer Sub-Ids                *
+ * -------------------------------------------------------------------- *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://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 (!defined('__SECURITY')) {
+       exit();
+} elseif (!isMember()) {
+       redirectToIndexMemberOnlyModule();
+} elseif ((!isGetRequestElementSet('id')) || (!isUserSubIdAssignedToMember(getRequestElement('id')))) {
+       redirectToUrl('modules.php?module=login&amp;what=subids');
+}
+
+// [EOF]
+?>
index 7bc1b6cd85b970ba8a84e6443556ed0170467b20..444063102b52d84327a0bbbf56aa24cc24c1bb79 100644 (file)
@@ -46,8 +46,10 @@ if (!defined('__SECURITY')) {
 // Base URL for redirection (both cases)
 $url = 'modules.php?module=index&amp;code=';
 
-if (destroyMemberSession()) {
+// Do the logout but keep session if current user is also admin
+if (destroyMemberSession(!isAdmin())) {
        // Remove theme cookie as well
+       // @TODO Move this in a filter, e.g. member_logout
        if (isExtensionActive('theme')) {
                setMailerTheme('');
        } // END - if
index 335e90d457ecaf1c0ef8648c6a9d830c03599de9..61f295ae035fd1608e1741616831a959f363eb92 100644 (file)
@@ -89,6 +89,24 @@ if (isFormSent('add_subid')) {
 } elseif (isFormSent('do_delete')) {
        // Remove entries from database
        showEntriesByXmlCallback('member_delete_do_user_subid');
+} elseif ((isGetRequestElementSet('do')) && (isGetRequestElementSet('id'))) {
+       // Construct module name
+       $incFile = sprintf("inc/modules/member/subid-%s.php", SQL_ESCAPE(getRequestElement('do')));
+
+       // Is the include readable and is the sub id assigned to current member?
+       if (!isUserSubIdAssignedToMember(getRequestElement('id'))) {
+               // Sub id is not assigned to current member or doesn't exist
+               displayMessage('{--MEMBER_USER_SUBID_NOT_ASSIGNED_404--}');
+       } elseif (isIncludeReadable($incFile)) {
+               // Then include it
+               loadIncludeOnce($incFile);
+
+               // Do not show the list of URLs after this template
+               $show = false;
+       } else {
+               // Display error message
+               displayMessage('{--MEMBER_INVALID_DO_USER_SUBID--}');
+       }
 }
 
 // Show entries?
index 706a483c1c71f8e841a26ea005427ed2b524a99a..dc6c3ff8728f7d906250b2f601822c25a2e4020f 100644 (file)
@@ -115,12 +115,17 @@ function getSessionArray () {
 }
 
 // Destroy user session
-function destroyMemberSession () {
+function destroyMemberSession ($destroy = false) {
        // Reset userid
        initMemberId();
 
        // Remove all user data from session
-       return ((setSession('userid', '')) && (setSession('u_hash', '')));
+       if ($destroy === true) {
+               // Destroy whole session
+               return session_destroy();
+       } else {
+               return ((setSession('userid', '')) && (setSession('u_hash', '')));
+       }
 }
 
 // Destroys the admin session