X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-newsletter.php;h=aa3d6f531a242103fee6410977ea4d0be2f43d2e;hb=f42e417c1cd63d07563965c54bf10f6e1cd4248f;hp=efe6475d10a89884660a18ee4236a4d1816c8d6a;hpb=3c4fbc22e3c04348734182d4d29bfef7eb050aa6;p=mailer.git diff --git a/inc/modules/member/what-newsletter.php b/inc/modules/member/what-newsletter.php index efe6475d10..aa3d6f531a 100644 --- a/inc/modules/member/what-newsletter.php +++ b/inc/modules/member/what-newsletter.php @@ -10,9 +10,14 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : * * -------------------------------------------------------------------- * - * * + * $Revision:: $ * + * $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 - 2008 by Roland Haeder * + * Copyright (c) 2003 - 2009 by Roland Haeder * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -33,79 +38,19 @@ // Some security stuff... if (!defined('__SECURITY')) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; - require($INC); -} elseif (!IS_MEMBER()) { - LOAD_URL("modules.php?module=index"); -} elseif ((!EXT_IS_ACTIVE("newsletter")) && (!IS_ADMIN())) { - ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "newsletter"); - return; + die(); +} elseif (!isMember()) { + redirectToIndexMemberOnlyModule(); } // Add description as navigation point -ADD_DESCR("member", __FILE__); - -// Load status -$result = SQL_QUERY_ESC("SELECT nl_receive, nl_until, nl_timespan FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", - array($GLOBALS['userid']), __FILE__, __LINE__); -list($status, $until, $span) = SQL_FETCHROW($result); -SQL_FREERESULT($result); - -// Remember charge value -define('__CHARGE_VALUE', TRANSLATE_COMMA($_CONFIG['nl_charge'])); - -if ((isset($_POST['ok'])) && ($status == "Y") && ($span == "0")) -{ - // Save request - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET nl_timespan='".($_CONFIG['one_day'] * 30)."' WHERE userid=%s LIMIT 1", - array($GLOBALS['userid']), __FILE__, __LINE__); - - // Load admin message - $admin_msg = LOAD_EMAIL_TEMPLATE("admin_newsletter_request", array(), $GLOBALS['userid']); - - // Add task - $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, status, task_type, subject, text, task_created, userid) -VALUES ('0','NEW','NL_UNSUBSCRIBE','".ADMIN_NL_SUBJECT."','".$admin_msg."', UNIX_TIMESTAMP(),'%s')", array($GLOBALS['userid']), __FILE__, __LINE__); - - // Send mail to member - $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_request", array(), $GLOBALS['userid']); - SEND_EMAIL($GLOBALS['userid'], NL_MEMBER_SUBJECT, $msg); +addMenuDescription('member', __FILE__); - // Send mail to all admins - SEND_ADMIN_NOTIFICATION(NL_ADMIN_SUBJECT, "admin_newsletter_request", array(), $GLOBALS['userid']); - - // Display message - LOAD_TEMPLATE("admin_settings_saved", false, NL_MEMBER_REQUEST_DONE); -} - elseif ($span > 0) -{ - // Already ordered - LOAD_TEMPLATE("admin_settings_saved", false, NL_MEMBER_REQUEST_ALREADY); -} - else -{ - // Load template for the note - define('NL_MEMBER_NOTE', LOAD_TEMPLATE("member_newsletter_note", true)); - - // Set status message and submit button - switch ($status) - { - case 'Y': // Receives the newsletter - define('__STATUS_VALUE', NL_MEMBER_ON); - define('__UNTIL_VALUE', ""); - define('NL_SUBMIT', NL_MEMBER_SUBMIT_OFF); - break; - - case 'N': // Does not receive the newsletter - define('__STATUS_VALUE', NL_MEMBER_OFF); - define('__UNTIL_VALUE', MAKE_DATETIME($until, "2")); - define('NL_SUBMIT', NL_MEMBER_SUBMIT_ON); - break; - } +if ((!isExtensionActive('newsletter')) && (!isAdmin())) { + loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('newsletter')); + return; +} // END - if - // Load template and member settings - LOAD_TEMPLATE("member_newsletter"); -} -// +// [EOF] ?>