$labelMap = array();
                foreach (array_keys($data) as $label) {
                    $mapName = 'LabelMap_' . $label;
                    if ($http->hasPostVariable($mapName)) {
                        if ($http->postVariable($mapName) != '0') {
                            $labelMap[$http->postVariable($mapName)] = $label;
                        }
                    }
                }
                if ($http->hasPostVariable('RowNum')) {
                    $subscriptionListID = $subscriptionList->attribute('id');
                    foreach ($http->postVariable('RowNum') as $rowIndex) {
                        if ($data[$labelMap['email']][$rowIndex] != "") {
                            if (!eZSubscription::fetchByEmailSubscriptionListID($data[$labelMap['email']][$rowIndex], $subscriptionListID)) {
                                if (!eZRobinsonListEntry::inList($data[$labelMap['email']][$rowIndex])) {
                                    $subscription = eZSubscription::create($subscriptionListID, $data[$labelMap['firstname']][$rowIndex], $data[$labelMap['name']][$rowIndex], $data[$labelMap['mobile']][$rowIndex], $data[$labelMap['email']][$rowIndex]);
                                    $subscription->setAttribute('status', eZSubscription::StatusApproved);
                                    $subscription->publish();
                                }
                            }
                        }
                    }
                }
                $http->removeSessionVariable('CSVData');
                return $Module->redirectToView('subscription_list', array($subscriptionList->attribute('url_alias')));
            }
        }
    }
}
$data = array();
if (eZHTTPFile::canFetch('UploadCSVFile')) {
 function registerUser($userID)
 {
     if ($this->userExists($userID)) {
         return false;
     }
     $subscription = eZSubscription::create($this->attribute('id'), '', '', '', '', $userID);
     if (!$subscription) {
         eZDebug::writeError('could not create eZSubscription', __METHOD__ . ' line:' . __LINE__);
         return false;
     }
     $subscription->setAttribute('status', eZSubscription::StatusConfirmed);
     if ($this->attribute('auto_approve_registered')) {
         $subscription->setAttribute('status', eZSubscription::StatusApproved);
     }
     $subscription->publish();
     return $subscription;
 }
//   MA 02110-1301, USA.
//
// This source file is part of the eZ publish (tm) Open Source Content
// Management System.
//
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
/*! \file edit_subscription.php
*/
$Module = $Params['Module'];
$http = eZHTTPTool::instance();
$warnings = array();
$subscriptionID = $Params['SubscriptionID'];
$subscription = eZSubscription::fetchDraft($subscriptionID);
if (!$subscription) {
    $subscription = eZSubscription::create();
}
if (!$subscription) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($http->hasPostVariable('StoreButton') || $http->hasPostVariable('ProfileButton') || $http->hasPostVariable('BrowseUserButton') || $http->hasPostVariable('UnsetUserButton')) {
    if (!eZRobinsonListEntry::inList($http->postVariable('Email')) && !eZRobinsonListEntry::inList($http->postVariable('Mobile'))) {
        if (!eZMail::validate($http->postVariable('Email'))) {
            $warnings[] = ezpI18n::tr('eznewsletter/newsletter/edit_subscription', 'You must provide a valid email address.');
        } else {
            $subscription->setAttribute('email', $http->postVariable('Email'));
        }
        $subscription->setAttribute('firstname', $http->postVariable('Firstname'));
        $subscription->setAttribute('name', $http->postVariable('Name'));
        $subscription->setAttribute('mobile', $http->postVariable('Mobile'));
        $subscription->setAttribute('status', $http->postVariable('Status'));
*/
$statusFilterArray = explode(',', $statusFilter);
$userParameters = $Params['UserParameters'];
//$statusFilter = isset( $userParameters['statusFilter'] ) ? explode( ',', $userParameters['statusFilter'] ) : array( -1 );
//$vipFilter = isset( $userParameters['vipFilter'] ) ? explode( ',', $userParameters['vipFilter'] ) : array( -1 );
$offset = isset($userParameters['offset']) ? $userParameters['offset'] : 0;
//$limitKey = isset( $userParameters['limit'] ) ? $userParameters['limit'] : '1';
$limitList = array('1' => 10, '2' => 25, '3' => 50);
$limit = $limitList[(string) $limitKey];
$viewParameters = array('offset' => $offset);
$subscriptionList = eZSubscriptionList::fetch($Params['SubscriptionListID']);
if (!$subscriptionList) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($http->hasPostVariable('CreateSubscriptionButton')) {
    $subscription = eZSubscription::create($subscriptionList->attribute('id'));
    return $Module->redirectToView('edit_subscription', array($subscription->attribute('id')));
}
/*
$condArray = array();
if ( !in_array( -1, $statusFilter ) )
{
    $condArray['status'] = array( $statusFilter );
}
//if ( !in_array( -1, $vipFilter ) )
//{
//    $condArray['vip'] = array( $vipFilter );
//}
*/
$condArray = array();
if (!in_array(-1, $statusFilterArray)) {