function subscribe($option) { $db = JFactory::getDBO(); $user = JFactory::getUser(); if (defined('JPATH_MANIFESTS') && !empty($_REQUEST['jform'])) { foreach ($_REQUEST['jform'] as $k => $v) { $map = array('password1' => 'password', 'email1' => 'email'); if (isset($map[$k])) { $_POST[$map[$k]] = $v; } else { $_POST[$k] = $v; } } } $intro = aecGetParam('intro', 0, true, array('word', 'int')); $usage = aecGetParam('usage', 0, true, array('word', 'string', 'clear_nonalnum')); $group = aecGetParam('group', 0, true, array('word', 'int')); $processor = aecGetParam('processor', '', true, array('word', 'string', 'clear_nonalnum')); $userid = aecGetParam('userid', 0, true, array('word', 'int')); $username = aecGetParam('username', '', true, array('string', 'clear_nonalnumwhitespace')); $email = aecGetParam('email', '', true, array('string', 'clear_nonemail')); $token = aecGetParam('aectoken', 0, true, array('string')); $forget = aecGetParam('forget', '', true, array('string')); $k2mode = false; if ($token) { $temptoken = new aecTempToken(); $temptoken->getComposite(); if (!empty($temptoken->content['handler'])) { if ($temptoken->content['handler'] == 'k2') { $k2mode = true; } } if (!empty($temptoken->content)) { $password = null; $details = array(); if ($forget == 'usage') { $details[] = 'usage'; $details[] = 'processor'; $details[] = 'recurring'; } if ($forget == 'userdetails') { $details[] = 'username'; $details[] = 'email'; $details[] = 'password'; $details[] = 'password2'; } foreach ($temptoken->content as $k => $v) { if (!in_array($k, $details)) { ${$k} = $v; $_POST[$k] = $v; } } if (!empty($username)) { $query = 'SELECT id' . ' FROM #__users' . ' WHERE username = \'' . $username . '\''; $db->setQuery($query); $id = $db->loadResult(); if (!empty($id)) { $userid = $id; $metaUser = new metaUser($id); $metaUser->setTempAuth($password); } } } } if (!empty($username) && $usage) { $CB = aecComponentHelper::detect_component('anyCB'); $AL = aecComponentHelper::detect_component('ALPHA'); $JS = aecComponentHelper::detect_component('JOMSOCIAL'); if (!$AL && !$CB && !$JS && !$k2mode) { // Joomla 1.6+ Sanity Check if (isset($_POST['email2']) && isset($_POST['email'])) { if ($_POST['email2'] !== $_POST['email']) { aecErrorAlert(JText::_('AEC_WARNREG_EMAIL_NOMATCH')); return JText::_('AEC_WARNREG_EMAIL_NOMATCH'); } } if (isset($_POST['password2']) && isset($_POST['password'])) { if ($_POST['password2'] !== $_POST['password']) { aecErrorAlert(JText::_('AEC_WARNREG_PASSWORD_NOMATCH')); return JText::_('AEC_WARNREG_PASSWORD_NOMATCH'); } } // Joomla 1.5 Sanity Check // Get required system objects $user = clone JFactory::getUser(); $duplicationcheck = checkUsernameEmail($username, $email); $usertype = JRequest::get('post'); // Bind the post array to the user object if (!$user->bind($usertype, 'usertype') || $duplicationcheck !== true) { $binderror = $user->getError(); if (!empty($binderror)) { JError::raiseError(500, $user->getError()); } else { JError::raiseError(500, $duplicationcheck); } unset($_POST); subscribe($option); return false; } JRequest::checkToken() or die('Invalid Token'); } elseif (empty($token)) { if (isset($_POST['username']) && isset($_POST['email'])) { $check = checkUsernameEmail($username, $email); if ($check !== true) { return $check; } } } $iFactory = new InvoiceFactory($userid, $usage, $group, $processor); $iFactory->confirm(); } else { if ($user->id) { $userid = $user->id; $passthrough = array(); } elseif (!empty($userid) && !isset($_POST['username'])) { $passthrough = array(); } elseif (empty($userid)) { if (!empty($_POST['username']) && !empty($_POST['email'])) { $check = checkUsernameEmail($username, $email); if ($check !== true) { return $check; } } $nopass = array('option', 'task', 'intro', 'usage', 'group', 'processor', 'recurring', 'Itemid', 'submit_x', 'submit_y', 'userid', 'id', 'gid'); $passthrough = array(); foreach ($_POST as $k => $v) { if (in_array($k, $nopass)) { unset($_POST[$k]); } else { $passthrough[$k] = $v; } } } if (!empty($userid)) { $passthrough['userid'] = $userid; $password = aecGetParam('password', '', true, array('string')); if (!empty($password)) { $passthrough['password'] = $password; } } $iFactory = new InvoiceFactory($userid, $usage, $group, $processor, null, $passthrough, false); if (!$iFactory->authed) { if (!$iFactory->checkAuth()) { return false; } } if (!empty($iFactory->passthrough['invoice'])) { repeatInvoice($option, $iFactory->passthrough['invoice'], null, $userid); } else { $iFactory->create($intro, $usage, $group, $processor, 0); } } }