X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Ffilter%2Fsurfbar_filter.php;h=85c220a289fd947a93385449ce084132c37a91fc;hb=7a27c44db48d021c1e54a76916914ef41ff49372;hp=e2e26f7a5dec2574f08a9015643b2cec276287c4;hpb=2f04bc3527df8214a7a1ac985210d9660824ad53;p=mailer.git diff --git a/inc/filter/surfbar_filter.php b/inc/filter/surfbar_filter.php index e2e26f7a5d..85c220a289 100644 --- a/inc/filter/surfbar_filter.php +++ b/inc/filter/surfbar_filter.php @@ -17,7 +17,7 @@ * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * 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 * @@ -42,8 +42,46 @@ if (!defined('__SECURITY')) { // Filter for changing URL status function FILTER_SURFBAR_CHANGE_URL_STATUS ($filterData) { - die('
'.print_r($filterData, true).''); + // Prepare content for notification routines + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + $filterData['data'][$filterData['url_id']]['url_userid'] = $filterData['data'][$filterData['url_id']]['url_userid']; + $filterData['data'][$filterData['url_id']]['frametester'] = '{%pipe,generateFrametesterUrl=' . $filterData['data'][$filterData['url_id']]['url'] . '%}'; + $filterData['data'][$filterData['url_id']]['reward'] = '{%config,translateComma=surfbar_static_reward%}'; + $filterData['data'][$filterData['url_id']]['costs'] = '{%config,translateComma=surfbar_static_costs%}'; + + // Do some dirty fixing here: + if (($filterData['data'][$filterData['url_id']]['url_status'] == 'STOPPED') && ($filterData['new_status'] == 'pending')) { + // Fix for template change + $filterData['new_status'] = 'continued'; + } // END - if + + // Send admin notification + SURFBAR_NOTIFY_ADMIN('url_' . strtolower($filterData['data'][$filterData['url_id']]['url_status']) . '_' . $filterData['new_status'], $filterData['data'][$filterData['url_id']]); + + // Send user notification + SURFBAR_NOTIFY_USER('url_' . strtolower($filterData['data'][$filterData['url_id']]['url_status']) . '_' . $filterData['new_status'], $filterData['data'][$filterData['url_id']]); + + // Return filter data + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; +} + +// Filter for validating status +function FILTER_SURFBAR_CHANGE_URL_VALIDATE_DATA ($filterData) { + // Is the new status set? + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + if ((!is_string($filterData['new_status'])) || (empty($filterData['new_status']))) { + // Abort here, but fine! + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'newStatus[' . gettype($filterData['new_status']) . ']=' . $filterData['new_status'] . ' - EXIT!'); + $filterData['abort'] = true; + } elseif ($filterData['data'][$filterData['url_id']]['url_status'] != $filterData['prev_status']) { + // Status is not like prevStatus + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterData['data'][$filterData['url_id']]['url_status'] . '!=' . $filterData['prev_status'] . ' - EXIT!'); + $filterData['abort'] = false; + } // END - if + // Return filter data + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); return $filterData; }