Beispiel #1
0
 public function hack($filename, $check_hack, $undohack, $checkonly = false)
 {
     $db = JFactory::getDBO();
     $app = JFactory::getApplication();
     $aec_hack_start = "// AEC HACK %s START" . "\n";
     $aec_hack_end = "// AEC HACK %s END" . "\n";
     $aec_condition_start = 'if (file_exists( JPATH_ROOT."/components/com_acctexp/acctexp.class.php" )) {' . "\n";
     $aec_condition_end = '}' . "\n";
     $aec_include_class = 'include_once(JPATH_SITE . "/components/com_acctexp/acctexp.class.php");' . "\n";
     $aec_verification_check = "AECToolBox::VerifyUsername( %s );" . "\n";
     $aec_userchange_clause = '$mih = new microIntegrationHandler();' . "\n" . '$mih->userchange($row, $_POST, \'%s\');' . "\n";
     $aec_userchange_clauseCB12 = '$mih = new microIntegrationHandler();' . "\n" . '$mih->userchange($userComplete, $_POST, \'%s\');' . "\n";
     $aec_userchange_clause15 = '$mih = new microIntegrationHandler();' . "\n" . '$mih->userchange($userid, $post, \'%s\');' . "\n";
     $aec_userregchange_clause15 = '$mih = new microIntegrationHandler();' . "\n" . '$mih->userchange($user, $post, \'%s\');' . "\n";
     $aec_global_call = "\n";
     $aec_redirect_notallowed = 'aecRedirect( $mosConfig_live_site . "/index.php?option=com_acctexp&task=NotAllowed" );' . "\n";
     $aec_redirect_notallowed15 = '$app = JFactory::getApplication();' . "\n" . '$app->redirect( "index.php?option=com_acctexp&task=NotAllowed" );' . "\n";
     $aec_redirect_subscribe = 'aecRedirect( JURI::root() . \'index.php?option=com_acctexp&task=subscribe\' );' . "\n";
     $aec_normal_hack = $aec_hack_start . $aec_global_call . $aec_condition_start . $aec_redirect_notallowed . $aec_condition_end . $aec_hack_end;
     $aec_jhack1 = $aec_hack_start . 'function mosNotAuth($override=false) {' . "\n" . $aec_global_call . $aec_condition_start . 'if (!$override) {' . "\n" . $aec_redirect_notallowed . $aec_condition_end . $aec_condition_end . $aec_hack_end;
     $aec_jhack2 = $aec_hack_start . $aec_global_call . $aec_condition_start . $aec_redirect_notallowed . $aec_condition_end . $aec_hack_end;
     $aec_jhack3 = $aec_hack_start . $aec_global_call . $aec_condition_start . $aec_include_class . sprintf($aec_verification_check, '$credentials[\'username\']') . $aec_condition_end . $aec_hack_end;
     $aec_cbmhack = $aec_hack_start . "mosNotAuth(true);" . "\n" . $aec_hack_end;
     $aec_uchangehack = $aec_hack_start . $aec_global_call . $aec_condition_start . $aec_include_class . $aec_userchange_clause . $aec_condition_end . $aec_hack_end;
     $aec_uchangehackCB12 = str_replace('$row', '$userComplete', $aec_uchangehack);
     $aec_uchangehackCB12x = str_replace('$row', '$this', $aec_uchangehack);
     $aec_uchangehackCB12 = $aec_hack_start . $aec_global_call . $aec_condition_start . $aec_include_class . $aec_userchange_clauseCB12 . $aec_condition_end . $aec_hack_end;
     $aec_uchangehack15 = $aec_hack_start . $aec_global_call . $aec_condition_start . $aec_include_class . $aec_userregchange_clause15 . $aec_condition_end . $aec_hack_end;
     $aec_uchangereghack15 = $aec_hack_start . $aec_global_call . $aec_condition_start . $aec_include_class . $aec_userchange_clause15 . $aec_condition_end . $aec_hack_end;
     $aec_rhackbefore = $aec_hack_start . $aec_global_call . $aec_condition_start . 'if (!isset($_POST[\'planid\'])) {' . "\n" . $aec_include_class . 'aecRedirect(JURI::root() . "index.php?option=com_acctexp&task=subscribe");' . "\n" . $aec_condition_end . $aec_condition_end . $aec_hack_end;
     $aec_rhackbefore_fix = str_replace("planid", "usage", $aec_rhackbefore);
     $aec_rhackbefore2 = $aec_hack_start . $aec_global_call . '$app = JFactory::getApplication();' . "\n" . $aec_condition_start . 'if (!isset($_POST[\'usage\'])) {' . "\n" . $aec_include_class . 'aecRedirect(JURI::root() . "index.php?option=com_acctexp&task=subscribe");' . "\n" . $aec_condition_end . $aec_condition_end . $aec_hack_end;
     $aec_optionhack = $aec_hack_start . $aec_global_call . $aec_condition_start . '$option = "com_acctexp";' . "\n" . $aec_condition_end . $aec_hack_end;
     $aec_regvarshack = '<?php' . "\n" . $aec_hack_start . $aec_global_call . $aec_condition_start . '?>' . "\n" . '<input type="hidden" name="planid" value="<?php echo $_POST[\'planid\'];?>" />' . "\n" . '<input type="hidden" name="processor" value="<?php echo $_POST[\'processor\'];?>" />' . "\n" . '<?php' . "\n" . 'if ( isset( $_POST[\'recurring\'] ) ) {' . '?>' . "\n" . '<input type="hidden" name="recurring" value="<?php echo $_POST[\'recurring\'];?>" />' . "\n" . '<?php' . "\n" . '}' . "\n" . $aec_condition_end . $aec_hack_end . '?>' . "\n";
     $aec_regvarshack_fix = str_replace('planid', 'usage', $aec_regvarshack);
     $aec_regvarshack_fixcb = $aec_hack_start . $aec_global_call . $aec_condition_start . 'if ( isset( $_POST[\'usage\'] ) ) {' . "\n" . '$regFormTag .= \'<input type="hidden" name="usage" value="\' . $_POST[\'usage\'] . \'" />\';' . "\n" . '}' . "\n" . 'if ( isset( $_POST[\'processor\'] ) ) {' . "\n" . '$regFormTag .= \'<input type="hidden" name="processor" value="\' . $_POST[\'processor\'] . \'" />\';' . "\n" . '}' . "\n" . 'if ( isset( $_POST[\'recurring\'] ) ) {' . "\n" . '$regFormTag .= \'<input type="hidden" name="recurring" value="\' . $_POST[\'recurring\'] . \'" />\';' . "\n" . '}' . "\n" . $aec_condition_end . $aec_hack_end;
     $aec_regredirect = $aec_hack_start . $aec_global_call . $aec_condition_start . $aec_redirect_subscribe . $aec_condition_end . $aec_hack_end;
     $juser_blind = $aec_hack_start . 'case \'blind\':' . "\n" . 'break;' . "\n" . $aec_hack_end;
     $aec_j15hack1 = $aec_hack_start . 'if ( $error->message == JText::_("ALERTNOTAUTH") ) {' . $aec_condition_start . $aec_redirect_notallowed15 . $aec_condition_end . $aec_condition_end . $aec_hack_end;
     $n = 'errorphp';
     $hacks[$n]['name'] = 'error.php ' . JText::_('AEC_HACK_HACK') . ' #1';
     $hacks[$n]['desc'] = JText::_('AEC_HACKS_NOTAUTH');
     $hacks[$n]['type'] = 'file';
     $hacks[$n]['filename'] = JPATH_SITE . '/libraries/joomla/error/error.php';
     $hacks[$n]['read'] = '// Initialize variables';
     $hacks[$n]['insert'] = sprintf($aec_j15hack1, $n, $n) . "\n" . $hacks[$n]['read'];
     $hacks[$n]['legacy'] = 1;
     $n = 'joomlaphp4';
     $hacks[$n]['name'] = 'authentication.php';
     $hacks[$n]['desc'] = JText::_('AEC_HACKS_LEGACY_PLUGIN');
     $hacks[$n]['uncondition'] = 'joomlaphp';
     $hacks[$n]['type'] = 'file';
     $hacks[$n]['filename'] = JPATH_SITE . '/libraries/joomla/user/authentication.php';
     $hacks[$n]['read'] = 'if(empty($response->username)) {';
     $hacks[$n]['insert'] = sprintf($aec_jhack3, $n, $n) . "\n" . $hacks[$n]['read'];
     $hacks[$n]['legacy'] = 1;
     if (aecComponentHelper::detect_component('UHP2')) {
         $n = 'uhp2menuentry';
         $hacks[$n]['name'] = JText::_('AEC_HACKS_UHP2');
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_UHP2_DESC');
         $hacks[$n]['uncondition'] = 'uhp2managephp';
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/modules/mod_uhp2_manage.php';
         $hacks[$n]['read'] = '<?php echo "$settings"; ?></a>';
         $hacks[$n]['insert'] = sprintf($hacks[$n]['read'] . "\n</li>\n<?php " . $aec_hack_start . '?>' . '<li class="latest<?php echo $moduleclass_sfx; ?>">' . '<a href="index.php?option=com_acctexp&task=subscriptionDetails" class="latest<?php echo $moduleclass_sfx; ?>">' . JText::_('AEC_SPEC_MENU_ENTRY') . '</a>' . "\n<?php " . $aec_hack_end . "?>", $n, $n);
     }
     if (aecComponentHelper::detect_component('CB1.2')) {
         $n = 'comprofilerphp2';
         $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #2';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_CB2');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
         $hacks[$n]['read'] = 'function registerForm( $option, $emailpass, $regErrorMSG = null ) {';
         $hacks[$n]['insert'] = $hacks[$n]['read'] . "\n" . sprintf($aec_optionhack, $n, $n);
         $hacks[$n]['legacy'] = 1;
         $n = 'comprofilerphp6';
         $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #6';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_CB6');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
         $hacks[$n]['read'] = 'HTML_comprofiler::registerForm( $option, $emailpass, $userComplete, $regErrorMSG );';
         $hacks[$n]['insert'] = sprintf($aec_rhackbefore_fix, $n, $n) . "\n" . $hacks[$n]['read'];
         $hacks[$n]['legacy'] = 1;
         $n = 'comprofilerhtml2';
         $hacks[$n]['name'] = 'comprofiler.html.php ' . JText::_('AEC_HACK_HACK') . ' #2';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_CB_HTML2');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.html.php';
         $hacks[$n]['read'] = 'echo HTML_comprofiler::_cbTemplateRender( $user, \'RegisterForm\'';
         $hacks[$n]['insert'] = sprintf($aec_regvarshack_fixcb, $n, $n) . "\n" . $hacks[$n]['read'];
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_LEGACY');
         $hacks[$n]['legacy'] = 1;
     } elseif (aecComponentHelper::detect_component('CB')) {
         $n = 'comprofilerphp2';
         $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #2';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_CB2');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
         $hacks[$n]['read'] = 'if ($regErrorMSG===null) {';
         $hacks[$n]['insert'] = sprintf($aec_optionhack, $n, $n) . "\n" . $hacks[$n]['read'];
         $n = 'comprofilerphp6';
         $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #6';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_CB6');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['condition'] = 'comprofilerphp2';
         $hacks[$n]['uncondition'] = 'comprofilerphp3';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
         $hacks[$n]['read'] = 'HTML_comprofiler::registerForm';
         $hacks[$n]['insert'] = sprintf($aec_rhackbefore_fix, $n, $n) . "\n" . $hacks[$n]['read'];
         $n = 'comprofilerhtml2';
         $hacks[$n]['name'] = 'comprofiler.html.php ' . JText::_('AEC_HACK_HACK') . ' #2';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_CB_HTML2');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['uncondition'] = 'comprofilerhtml';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.html.php';
         $hacks[$n]['read'] = '<input type="hidden" name="task" value="saveregisters" />';
         $hacks[$n]['insert'] = $hacks[$n]['read'] . "\n" . sprintf($aec_regvarshack_fix, $n, $n);
     } elseif (aecComponentHelper::detect_component('CBE')) {
         $n = 'comprofilerphp2';
         $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #2';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_CB2');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
         $hacks[$n]['read'] = '$rowFieldValues=array();';
         $hacks[$n]['insert'] = sprintf($aec_optionhack, $n, $n) . "\n" . $hacks[$n]['read'];
         $n = 'comprofilerphp6';
         $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #6';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_CB6');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['condition'] = 'comprofilerphp2';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
         $hacks[$n]['read'] = 'HTML_comprofiler::registerForm';
         $hacks[$n]['insert'] = sprintf($aec_rhackbefore2, $n, $n) . "\n" . $hacks[$n]['read'];
         $n = 'comprofilerhtml2';
         $hacks[$n]['name'] = 'comprofiler.html.php ' . JText::_('AEC_HACK_HACK') . ' #2';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_CB_HTML2');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['uncondition'] = 'comprofilerhtml';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.html.php';
         $hacks[$n]['read'] = '<input type="hidden" name="task" value="saveRegistration" />';
         $hacks[$n]['insert'] = $hacks[$n]['read'] . "\n" . sprintf($aec_regvarshack_fix, $n, $n);
     } elseif (aecComponentHelper::detect_component('JUSER')) {
         $n = 'juserhtml1';
         $hacks[$n]['name'] = 'juser.html.php ' . JText::_('AEC_HACK_HACK') . ' #1';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_JUSER_HTML1');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_juser/juser.html.php';
         $hacks[$n]['read'] = '<input type="hidden" name="option" value="com_juser" />';
         $hacks[$n]['insert'] = sprintf($aec_regvarshack_fix, $n, $n) . "\n" . '<input type="hidden" name="option" value="com_acctexp" />';
         $n = 'juserphp1';
         $hacks[$n]['name'] = 'juser.php ' . JText::_('AEC_HACK_HACK') . ' #1';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_JUSER_PHP1');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_juser/juser.php';
         $hacks[$n]['read'] = 'HTML_JUser::userEdit( $row, $option, $params, $ext_row, \'saveUserRegistration\' );';
         $hacks[$n]['insert'] = sprintf($aec_rhackbefore_fix, $n, $n) . "\n" . $hacks[$n]['read'];
         $n = 'juserphp2';
         $hacks[$n]['name'] = 'juser.php ' . JText::_('AEC_HACK_HACK') . ' #2';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_JUSER_PHP2');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_juser/juser.php';
         $hacks[$n]['read'] = 'default:';
         $hacks[$n]['insert'] = sprintf($juser_blind, $n, $n) . "\n" . $hacks[$n]['read'];
     } else {
         $n = 'registrationhtml2';
         $hacks[$n]['name'] = 'registration.html.php ' . JText::_('AEC_HACK_HACK') . ' #2';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_LEGACY');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['uncondition'] = 'registrationhtml';
         $hacks[$n]['condition'] = 'registrationphp2';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_user/views/register/tmpl/default.php';
         $hacks[$n]['read'] = '<input type="hidden" name="task" value="register_save" />';
         $hacks[$n]['insert'] = $hacks[$n]['read'] . "\n" . sprintf($aec_regvarshack_fix, $n, $n);
         $hacks[$n]['legacy'] = 1;
         $n = 'registrationphp6';
         $hacks[$n]['name'] = 'user.php';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_REG5');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['uncondition'] = 'registrationphp5';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_user/controller.php';
         $hacks[$n]['read'] = 'JRequest::setVar(\'view\', \'register\');';
         $hacks[$n]['insert'] = $hacks[$n]['read'] . "\n" . sprintf($aec_regredirect, $n, $n);
         $hacks[$n]['legacy'] = 1;
     }
     if (aecComponentHelper::detect_component('anyCB')) {
         if (aecComponentHelper::detect_component('CB1.2')) {
             $n = 'comprofilerphp7';
             $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #7';
             $hacks[$n]['desc'] = JText::_('AEC_HACKS_MI1');
             $hacks[$n]['type'] = 'file';
             $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
             $hacks[$n]['read'] = '$_PLUGINS->trigger( \'onAfterUserRegistrationMailsSent\',';
             $hacks[$n]['insert'] = sprintf($aec_uchangehackCB12, $n, 'registration', $n) . "\n" . $hacks[$n]['read'];
             $hacks[$n]['legacy'] = 1;
             $n = 'comprofilerphp8';
             $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #8';
             $hacks[$n]['desc'] = JText::_('AEC_HACKS_MI1');
             $hacks[$n]['type'] = 'file';
             $hacks[$n]['filename'] = JPATH_SITE . '/administrator/components/com_comprofiler/library/cb/cb.tables.php';
             $hacks[$n]['read'] = '$_PLUGINS->trigger( \'onAfterUserUpdate\', array( &$this, &$this, true ) );';
             $hacks[$n]['insert'] = $hacks[$n]['read'] . "\n" . sprintf($aec_uchangehackCB12x, $n, 'user', $n);
             $hacks[$n]['legacy'] = 1;
         } else {
             $n = 'comprofilerphp4';
             $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #4';
             $hacks[$n]['desc'] = JText::_('AEC_HACKS_MI1');
             $hacks[$n]['type'] = 'file';
             $hacks[$n]['filename'] = JPATH_SITE . "/components/com_comprofiler/comprofiler.php";
             $hacks[$n]['read'] = '$_PLUGINS->trigger( \'onAfterUserRegistrationMailsSent\',';
             $hacks[$n]['insert'] = sprintf($aec_uchangehack, $n, "user", $n) . "\n" . $hacks[$n]['read'];
             $hacks[$n]['legacy'] = 1;
             $n = 'comprofilerphp5';
             $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #5';
             $hacks[$n]['desc'] = JText::_('AEC_HACKS_MI2');
             $hacks[$n]['type'] = 'file';
             $hacks[$n]['filename'] = JPATH_SITE . "/components/com_comprofiler/comprofiler.php";
             $hacks[$n]['read'] = '$_PLUGINS->trigger( \'onAfterUserUpdate\', array($row, $rowExtras, true));';
             $hacks[$n]['insert'] = $hacks[$n]['read'] . "\n" . sprintf($aec_uchangehack, $n, "registration", $n);
             $hacks[$n]['legacy'] = 1;
             $n = 'comprofilerphp7';
             $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #7';
             $hacks[$n]['desc'] = JText::_('AEC_HACKS_MI1');
             $hacks[$n]['type'] = 'file';
             $hacks[$n]['uncondition'] = 'comprofilerphp4';
             $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
             $hacks[$n]['read'] = '$_PLUGINS->trigger( \'onAfterUserRegistrationMailsSent\',';
             $hacks[$n]['insert'] = sprintf($aec_uchangehack, $n, 'registration', $n) . "\n" . $hacks[$n]['read'];
             $n = 'comprofilerphp8';
             $hacks[$n]['name'] = 'comprofiler.php ' . JText::_('AEC_HACK_HACK') . ' #8';
             $hacks[$n]['desc'] = JText::_('AEC_HACKS_MI1');
             $hacks[$n]['type'] = 'file';
             $hacks[$n]['uncondition'] = 'comprofilerphp5';
             $hacks[$n]['filename'] = JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
             $hacks[$n]['read'] = '$_PLUGINS->trigger( \'onAfterUserUpdate\', array($row, $rowExtras, true));';
             $hacks[$n]['insert'] = $hacks[$n]['read'] . "\n" . sprintf($aec_uchangehack, $n, 'user', $n);
         }
     } else {
         $n = 'userphp';
         $hacks[$n]['name'] = 'user.php';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_LEGACY');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_user/controller.php';
         $hacks[$n]['read'] = 'if ($model->store($post)) {';
         $hacks[$n]['insert'] = sprintf($aec_uchangehack15, $n, "user", $n) . "\n" . $hacks[$n]['read'];
         $hacks[$n]['legacy'] = 1;
         $n = 'registrationphp1';
         $hacks[$n]['name'] = 'registration.php ' . JText::_('AEC_HACK_HACK') . ' #1';
         $hacks[$n]['desc'] = JText::_('AEC_HACKS_LEGACY');
         $hacks[$n]['type'] = 'file';
         $hacks[$n]['filename'] = JPATH_SITE . '/components/com_user/controller.php';
         $hacks[$n]['read'] = 'UserController::_sendMail($user, $password);';
         $hacks[$n]['insert'] = $hacks[$n]['read'] . "\n" . sprintf($aec_uchangereghack15, $n, "registration", $n);
         $hacks[$n]['legacy'] = 1;
     }
     $n = 'adminuserphp';
     $hacks[$n]['name'] = 'admin.user.php';
     $hacks[$n]['desc'] = JText::_('AEC_HACKS_LEGACY');
     $hacks[$n]['type'] = 'file';
     $hacks[$n]['filename'] = JPATH_SITE . '/administrator/components/com_users/controller.php';
     $hacks[$n]['read'] = 'if (!$user->save())';
     $hacks[$n]['insert'] = sprintf($aec_uchangehack15, $n, 'adminuser', $n) . "\n" . $hacks[$n]['read'];
     $hacks[$n]['legacy'] = 1;
     if (aecComponentHelper::detect_component('CBM')) {
         if (!aecComponentHelper::detect_component('CB1.2')) {
             $n = 'comprofilermoderator';
             $hacks[$n]['name'] = 'comprofilermoderator.php';
             $hacks[$n]['desc'] = JText::_('AEC_HACKS_CBM');
             $hacks[$n]['type'] = 'file';
             $hacks[$n]['filename'] = JPATH_SITE . '/modules/mod_comprofilermoderator.php';
             $hacks[$n]['read'] = 'mosNotAuth();';
             $hacks[$n]['insert'] = sprintf($aec_cbmhack, $n, $n);
         }
     }
     $mih = new microIntegrationHandler();
     $new_hacks = $mih->getHacks();
     if (is_array($new_hacks)) {
         $hacks = array_merge($hacks, $new_hacks);
     }
     // Receive the status for the hacks
     foreach ($hacks as $name => $hack) {
         $hacks[$name]['status'] = 0;
         if (!empty($hack['filename'])) {
             if (!file_exists($hack['filename'])) {
                 continue;
             }
         }
         if ($hack['type']) {
             switch ($hack['type']) {
                 case 'file':
                     if ($hack['filename'] != 'UNKNOWN') {
                         $originalFileHandle = fopen($hack['filename'], 'r');
                         $oldData = fread($originalFileHandle, filesize($hack['filename']));
                         fclose($originalFileHandle);
                         if (strpos($oldData, 'AEC HACK START') || strpos($oldData, 'AEC CHANGE START')) {
                             $hacks[$name]['status'] = 'legacy';
                         } else {
                             if (strpos($oldData, 'AEC HACK ' . $name . ' START') > 0 || strpos($oldData, 'AEC CHANGE ' . $name . ' START') > 0) {
                                 $hacks[$name]['status'] = 1;
                             }
                         }
                         if (function_exists('posix_getpwuid')) {
                             $hacks[$name]['fileinfo'] = posix_getpwuid(fileowner($hack['filename']));
                         }
                     }
                     break;
                 case 'menuentry':
                     $query = 'SELECT COUNT(*)' . ' FROM #__menu' . ' WHERE `link` = \'' . JURI::root() . '/index.php?option=com_acctexp&task=subscriptionDetails\'';
                     $db->setQuery($query);
                     $count = $db->loadResult();
                     if ($count) {
                         $hacks[$name]['status'] = 1;
                     }
                     break;
             }
         }
     }
     if ($checkonly) {
         return $hacks[$filename]['status'];
     }
     // Commit the hacks
     if (!$check_hack) {
         switch ($hacks[$filename]['type']) {
             case 'file':
                 // mic: fix if CMS is not Joomla or Mambo
                 if ($hack['filename'] != 'UNKNOWN') {
                     $originalFileHandle = fopen($hacks[$filename]['filename'], 'r') or die("Cannot open " . $hacks[$filename]['filename']);
                     // Transfer File into variable $oldData
                     $oldData = fread($originalFileHandle, filesize($hacks[$filename]['filename']));
                     fclose($originalFileHandle);
                     if (!$undohack) {
                         // hack
                         $newData = str_replace($hacks[$filename]['read'], $hacks[$filename]['insert'], $oldData);
                         //make a backup
                         if (!$this->backupFile($hacks[$filename]['filename'], $hacks[$filename]['filename'] . '.aec-backup')) {
                             // Echo error message
                         }
                     } else {
                         // undo hack
                         if (strcmp($hacks[$filename]['status'], 'legacy') === 0) {
                             $newData = preg_replace('/\\/\\/.AEC.(HACK|CHANGE).START\\n.*\\/\\/.AEC.(HACK|CHANGE).END\\n/s', $hacks[$filename]['read'], $oldData);
                         } else {
                             if (strpos($oldData, $hacks[$filename]['insert'])) {
                                 if (isset($hacks[$filename]['oldread']) && isset($hacks[$filename]['oldinsert'])) {
                                     $newData = str_replace($hacks[$filename]['oldinsert'], $hacks[$filename]['oldread'], $oldData);
                                 }
                                 $newData = str_replace($hacks[$filename]['insert'], $hacks[$filename]['read'], $oldData);
                             } else {
                                 $newData = preg_replace('/\\/\\/.AEC.(HACK|CHANGE).' . $filename . '.START\\n.*\\/\\/.AEC.(HACK|CHANGE).' . $filename . '.END\\n/s', $hacks[$filename]['read'], $oldData);
                             }
                         }
                     }
                     $oldperms = fileperms($hacks[$filename]['filename']);
                     chmod($hacks[$filename]['filename'], $oldperms | 0222);
                     if ($fp = fopen($hacks[$filename]['filename'], 'wb')) {
                         fwrite($fp, $newData, strlen($newData));
                         fclose($fp);
                         chmod($hacks[$filename]['filename'], $oldperms);
                     }
                 }
                 break;
         }
     }
     return $hacks;
 }
Beispiel #2
0
 public function dummyUser($passthrough)
 {
     $this->hasSubscription = false;
     $this->cmsUser = new stdClass();
     $this->cmsUser->gid = 29;
     if (is_array($passthrough) && !empty($passthrough) && !empty($passthrough['username'])) {
         $cpass = $passthrough;
         unset($cpass['id']);
         $cmsfields = array('name', 'username', 'email', 'password');
         // Create dummy CMS user
         foreach ($cmsfields as $cmsfield) {
             foreach ($cpass as $k => $v) {
                 if ($k == $cmsfield) {
                     $this->cmsUser->{$cmsfield} = $v;
                     unset($cpass[$k]);
                 }
             }
         }
         if (empty($this->cmsUser->name) && (!empty($cpass['firstname']) || !empty($cpass['middlename']) || !empty($cpass['lastname']))) {
             $names = array('firstname', 'middlename', 'lastname');
             $namearray = array();
             foreach ($names as $n) {
                 if (!empty($cpass[$n])) {
                     $namearray[] = $cpass[$n];
                 }
             }
             $this->cmsUser->name = implode(" ", $namearray);
         }
         // Create dummy CB/CBE user
         if (aecComponentHelper::detect_component('anyCB')) {
             $this->hasCBprofile = 1;
             $this->cbUser = new stdClass();
             foreach ($cpass as $cbfield => $cbvalue) {
                 if (is_array($cbvalue)) {
                     $this->cbUser->{$cbfield} = implode(';', $cbvalue);
                 } else {
                     $this->cbUser->{$cbfield} = $cbvalue;
                 }
             }
         }
         if (isset($this->_incomplete)) {
             unset($this->_incomplete);
         }
         return true;
     } else {
         $this->_incomplete = true;
         return null;
     }
 }
 public function getButton($pp, $usage, $register, $passthrough, $return)
 {
     global $aecConfig;
     $btnarray = array();
     $btnarray['usage'] = $usage;
     $btnarray['userid'] = $this->metaUser->userid;
     // Rewrite Passthrough
     if (!empty($passthrough)) {
         $btnarray['aec_passthrough'] = $passthrough;
     }
     if (strtolower($pp->processor_name) == 'add_to_cart') {
         return array_merge($btnarray, array('option' => 'com_acctexp', 'task' => 'addtocart', 'class' => 'btn btn-processor', 'content' => aecHTML::Icon('plus', ' narrow') . JText::_('AEC_BTN_ADD_TO_CART'), 'returngroup' => $return));
     }
     if (strtolower($pp->processor_name) == 'select') {
         return array_merge($btnarray, array('option' => 'com_acctexp', 'task' => 'subscribe', 'class' => 'btn btn-processor', 'content' => JText::_('BUTTON_SELECT'), 'returngroup' => $return));
     }
     $btnarray['view'] = '';
     if ($register) {
         $iscb = aecComponentHelper::detect_component('anyCB');
         $isjs = aecComponentHelper::detect_component('JOMSOCIAL');
         if ($iscb) {
             $btnarray['option'] = 'com_comprofiler';
             $btnarray['task'] = 'registers';
             $btnarray['view'] = 'registers';
         } elseif ($isjs) {
             $btnarray['option'] = 'com_community';
             $btnarray['view'] = 'register';
         } else {
             if (defined('JPATH_MANIFESTS')) {
                 $btnarray['option'] = 'com_users';
                 $btnarray['task'] = '';
                 $btnarray['view'] = 'registration';
             } else {
                 $btnarray['option'] = 'com_user';
                 $btnarray['task'] = '';
                 $btnarray['view'] = 'register';
             }
         }
     } else {
         $btnarray['option'] = 'com_acctexp';
         $btnarray['task'] = 'confirm';
     }
     $btnarray['class'] = 'btn btn-processor';
     if ($pp->processor_name == 'free') {
         $btnarray['content'] = JText::_('AEC_PAYM_METHOD_FREE');
     } elseif (is_object($pp->processor)) {
         if ($pp->processor->getLogoFilename() == '') {
             $btnarray['content'] = '<span class="btn-tallcontent">' . $pp->info['longname'] . '</span>';
         } else {
             $btnarray['css'] = '.btn-processor-' . $pp->processor_name . ' { background-image: url(' . $pp->getLogoPath() . ') !important; }';
         }
     }
     if (!empty($pp->settings['generic_buttons'])) {
         if (!empty($pp->recurring)) {
             $btnarray['content'] = JText::_('AEC_PAYM_METHOD_SUBSCRIBE');
         } else {
             $btnarray['content'] = JText::_('AEC_PAYM_METHOD_BUYNOW');
         }
     } else {
         $btnarray['class'] .= ' btn-processor-' . $pp->processor_name;
         if ((isset($pp->recurring) || isset($pp->info['recurring'])) && !empty($pp->info['recurring'])) {
             if ($pp->info['recurring'] == 2) {
                 if (!empty($pp->recurring)) {
                     $btnarray['content'] = '<i class="btn-overlay">' . JText::_('AEC_PAYM_METHOD_RECURRING_BILLING') . '</i>';
                 } else {
                     $btnarray['content'] = '<i class="btn-overlay">' . JText::_('AEC_PAYM_METHOD_ONE_TIME_BILLING') . '</i>';
                 }
             } elseif ($pp->info['recurring'] == 1) {
                 $btnarray['content'] = '<i class="btn-overlay">' . JText::_('AEC_PAYM_METHOD_RECURRING_BILLING') . '</i>';
             }
         }
     }
     if (!empty($pp->recurring)) {
         $btnarray['recurring'] = 1;
     } else {
         $btnarray['recurring'] = 0;
     }
     $btnarray['processor'] = $pp->processor_name;
     return $btnarray;
 }
 static function saveUserRegistration($var, $internal = false, $overrideActivation = false, $overrideEmails = false, $overrideJS = false)
 {
     $db = JFactory::getDBO();
     global $task, $aecConfig;
     $app = JFactory::getApplication();
     ob_start();
     // Let CB/JUSER think that everything is going fine
     if (aecComponentHelper::detect_component('anyCB')) {
         if (aecComponentHelper::detect_component('CBE') || $overrideActivation) {
             global $ueConfig;
         }
         $savetask = $task;
         $_REQUEST['task'] = 'done';
         include_once JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
         $task = $savetask;
         if ($overrideActivation) {
             $ueConfig['reg_confirmation'] = 0;
         }
         if ($overrideEmails) {
             $ueConfig['reg_welcome_sub'] = '';
             // Only disable "Pending Approval / Confirmation" emails if it makes sense
             if (!$ueConfig['reg_confirmation'] || !$ueConfig['reg_admin_approval']) {
                 $ueConfig['reg_pend_appr_sub'] = '';
             }
         }
     } elseif (aecComponentHelper::detect_component('JUSER')) {
         $savetask = $task;
         $task = 'blind';
         include_once JPATH_SITE . '/components/com_juser/juser.php';
         include_once JPATH_SITE . '/administrator/components/com_juser/juser.class.php';
         $task = $savetask;
     } elseif (aecComponentHelper::detect_component('JOMSOCIAL')) {
     }
     // For joomla and CB, we must filter out some internal variables before handing over the POST data
     $badbadvars = array('userid', 'method_name', 'usage', 'processor', 'recurring', 'currency', 'amount', 'invoice', 'id', 'gid');
     foreach ($badbadvars as $badvar) {
         if (isset($var[$badvar])) {
             unset($var[$badvar]);
         }
     }
     if (empty($var['name']) && !empty($var['jform'])) {
         // Must be K2
         $var['name'] = aecEscape($var['jform']['name'], array('string', 'clear_nonalnum'));
         unset($var['jform']);
     }
     $_POST = $var;
     $var['username'] = aecEscape($var['username'], array('string', 'badchars'));
     $savepwd = aecEscape($var['password'], array('string', 'badchars'));
     if (aecComponentHelper::detect_component('anyCB')) {
         // This is a CB registration, borrowing their code to save the user
         if ($internal && !aecComponentHelper::detect_component('CBE')) {
             include_once JPATH_SITE . '/components/com_acctexp/lib/codeofshame/cbregister.php';
             if (empty($_POST['firstname']) && !empty($_POST['name'])) {
                 $name = metaUser::_explodeName($_POST['name']);
                 $_POST['firstname'] = $name['first'];
                 if (empty($name['last'])) {
                     $_POST['lastname'] = $name['first'];
                 } else {
                     $_POST['lastname'] = $name['last'];
                 }
             }
             $_POST['password__verify'] = $_POST['password2'];
             unset($_POST['password2']);
             @saveRegistrationNOCHECKSLOL('com_acctexp');
         } else {
             @saveRegistration('com_acctexp');
             $cbreply = ob_get_contents();
             $indicator = '<script type="text/javascript">alert(\'';
             $alertstart = strpos($cbreply, $indicator);
             // Emergency fallback
             if ($alertstart !== false) {
                 ob_clean();
                 $alertend = strpos($cbreply, '\'); </script>', $alertstart);
                 $alert = substr($cbreply, $alertstart + strlen($indicator), $alertend - $alertstart - strlen($indicator));
                 if ($aecConfig->cfg['plans_first']) {
                     aecErrorAlert($alert, $action = 'window.history.go(-2);');
                 } else {
                     aecErrorAlert($alert, $action = 'window.history.go(-3);');
                 }
             }
         }
     } elseif (aecComponentHelper::detect_component('JUSER')) {
         // This is a JUSER registration, borrowing their code to save the user
         saveRegistration('com_acctexp');
         $query = 'SELECT `id`' . ' FROM #__users' . ' WHERE `username` = \'' . $var['username'] . '\'';
         $db->setQuery($query);
         $uid = $db->loadResult();
         JUser::saveUser_ext($uid);
         //synchronize dublicate user data
         $query = 'SELECT `id`' . ' FROM #__juser_integration' . ' WHERE `published` = \'1\'' . ' AND `export_status` = \'1\'';
         $db->setQuery($query);
         $components = $db->loadObjectList();
         if (!empty($components)) {
             foreach ($components as $component) {
                 $synchronize = require_integration($component->id);
                 $synchronize->synchronizeFrom($uid);
             }
         }
     } elseif (aecComponentHelper::detect_component('JOMSOCIAL') && !$overrideJS) {
     } else {
         $data = array('username' => $var['username'], 'password' => $var['password'], 'password2' => $var['password2'], 'email' => $var['email'], 'name' => $var['name']);
         if (isset($var['jform']['profile'])) {
             $data['profile'] = $var['jform']['profile'];
         }
         if (defined('JPATH_MANIFESTS')) {
             $params = JComponentHelper::getParams('com_users');
             // Initialise the table with JUser.
             JUser::getTable('User', 'JTable');
             $user = new JUser();
             // Prepare the data for the user object.
             $useractivation = $params->get('useractivation');
             // Check if the user needs to activate their account.
             if (($useractivation == 1 || $useractivation == 2) && !$overrideActivation) {
                 jimport('joomla.user.helper');
                 $data['activation'] = xJ::getHash();
                 $data['block'] = 1;
             }
             $usersConfig = JComponentHelper::getParams('com_users');
             $system = $usersConfig->get('new_usertype', 2);
             $data['groups'][] = $system;
             // Bind the data.
             if (!$user->bind($data)) {
                 JError::raiseWarning(500, JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
                 return false;
             }
             // Load the users plugin group.
             JPluginHelper::importPlugin('users');
             // Store the data.
             if (!$user->save()) {
                 JError::raiseWarning(500, JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
                 return false;
             }
         } else {
             // This is a joomla registration, borrowing their code to save the user
             // Check for request forgeries
             if (!$internal) {
                 JRequest::checkToken() or die('Invalid Token');
             }
             // Get required system objects
             $user = clone JFactory::getUser();
             //$pathway 	=& $app->getPathway();
             $config = JFactory::getConfig();
             $authorize = JFactory::getACL();
             $document = JFactory::getDocument();
             // If user registration is not allowed, show 403 not authorized.
             $usersConfig = JComponentHelper::getParams('com_users');
             if ($usersConfig->get('allowUserRegistration') == '0') {
                 JError::raiseError(403, JText::_('Access Forbidden'));
                 return;
             }
             // Initialize new usertype setting
             $newUsertype = $usersConfig->get('new_usertype');
             if (!$newUsertype) {
                 $newUsertype = 'Registered';
             }
             // Bind the post array to the user object
             if (!$user->bind($data)) {
                 JError::raiseError(500, $user->getError());
                 unset($_POST);
                 subscribe('com_acctexp');
                 return false;
             }
             // Set some initial user values
             $user->set('id', 0);
             $user->set('usertype', '');
             $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
             $user->set('sendEmail', 0);
             $user->set('registerDate', date('Y-m-d H:i:s', (int) gmdate('U')));
             // If user activation is turned on, we need to set the activation information
             $useractivation = $usersConfig->get('useractivation');
             if ($useractivation == '1' && !$overrideActivation) {
                 jimport('joomla.user.helper');
                 $user->set('activation', md5(JUserHelper::genRandomPassword()));
                 $user->set('block', '1');
             }
             // If there was an error with registration, set the message and display form
             if (!$user->save()) {
                 JError::raiseWarning('', JText::_($user->getError()));
                 echo JText::_($user->getError());
                 return false;
             }
         }
         $row = $user;
         $name = $row->name;
         $email = $row->email;
         $username = $row->username;
         $subject = sprintf(JText::_('AEC_SEND_SUB'), $name, $app->getCfg('sitename'));
         $subject = html_entity_decode($subject, ENT_QUOTES, 'UTF-8');
         $usersConfig = JComponentHelper::getParams('com_users');
         $activation = $usersConfig->get('useractivation');
         if ($activation > 0 && !$overrideActivation) {
             $atext = JText::_('AEC_USEND_MSG_ACTIVATE');
             if (defined('JPATH_MANIFESTS')) {
                 $activation_link = JURI::root() . 'index.php?option=com_users&amp;task=registration.activate&amp;token=' . $row->activation;
                 if ($activation == 2) {
                     $atext = JText::_('COM_USERS_MSG_ADMIN_ACTIVATE');
                 }
             } else {
                 $activation_link = JURI::root() . 'index.php?option=com_user&amp;task=activate&amp;activation=' . $row->activation;
             }
             $message = sprintf($atext, $name, $app->getCfg('sitename'), $activation_link, JURI::root(), $username, $savepwd);
         } else {
             $message = sprintf(JText::_('AEC_USEND_MSG'), $name, $app->getCfg('sitename'), JURI::root());
         }
         $message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');
         // check if Global Config `mailfrom` and `fromname` values exist
         if ($app->getCfg('mailfrom') != '' && $app->getCfg('fromname') != '') {
             $adminName2 = $app->getCfg('fromname');
             $adminEmail2 = $app->getCfg('mailfrom');
         } else {
             // use email address and name of first superadmin for use in email sent to user
             $rows = xJACLhandler::getSuperAdmins();
             $row2 = $rows[0];
             $adminName2 = $row2->name;
             $adminEmail2 = $row2->email;
         }
         // Send email to user
         if (!($aecConfig->cfg['nojoomlaregemails'] || $overrideEmails)) {
             xJ::sendMail($adminEmail2, $adminEmail2, $email, $subject, $message);
         }
         // Send notification to all administrators
         $aecUser = AECToolbox::aecIP();
         $subject2 = sprintf(JText::_('AEC_SEND_SUB'), $name, $app->getCfg('sitename'));
         $message2 = sprintf(JText::_('AEC_ASEND_MSG_NEW_REG'), $adminName2, $app->getCfg('sitename'), $row->name, $email, $username, $aecUser['ip'], $aecUser['isp']);
         $subject2 = html_entity_decode($subject2, ENT_QUOTES, 'UTF-8');
         $message2 = html_entity_decode($message2, ENT_QUOTES, 'UTF-8');
         // get email addresses of all admins and superadmins set to recieve system emails
         $admins = AECToolbox::getAdminEmailList();
         foreach ($admins as $adminemail) {
             if (!empty($adminemail)) {
                 xJ::sendMail($adminEmail2, $adminEmail2, $adminemail, $subject2, $message2);
             }
         }
     }
     ob_clean();
     // We need the new userid, so we're fetching it from the newly created entry here
     $query = 'SELECT `id`' . ' FROM #__users' . ' WHERE `username` = \'' . $var['username'] . '\'';
     $db->setQuery($query);
     return $db->loadResult();
 }
Beispiel #5
0
 public function getAdditionalVars($vars)
 {
     if (!file_exists(JPATH_ROOT . "/components/com_acctexp/acctexp.class.php")) {
         return;
     }
     include_once JPATH_ROOT . "/components/com_acctexp/acctexp.class.php";
     global $aecConfig;
     $vars['ccb12'] = aecComponentHelper::detect_component('CB1.2');
     $vars['pfirst'] = $aecConfig->cfg['plans_first'];
     $vars['int_reg'] = $aecConfig->cfg['integrate_registration'];
     $vars['usage'] = aecGetParam('usage', 0, true, array('word', 'string', 'clear_nonalnum'));
     $vars['processor'] = aecGetParam('processor', '', true, array('word', 'string', 'clear_nonalnum'));
     $vars['recurring'] = aecGetParam('recurring', 0, true, array('word', 'int'));
     $vars['username'] = aecGetParam('username', "", true, array('string', 'clear_nonalnumwhitespace'));
     $vars['has_usage'] = !empty($vars['usage']);
     if (($vars['joms_any'] || $vars['ccb12'] || $vars['k2_regsv'] || $vars['alpha_regsv']) && !$vars['has_usage']) {
         if ($vars['joms_any']) {
             $vars['username'] = aecGetParam('jsusername', "", true, array('string', 'clear_nonalnumwhitespace'));
         } else {
             $vars['username'] = aecGetParam('username', "", true, array('string', 'clear_nonalnumwhitespace'));
         }
         if (empty($vars['username']) && $vars['k2_regsv']) {
             $vars['username'] = aecEscape($_REQUEST['jform']['username'], array('string', 'clear_nonalnumwhitespace'));
         }
         $temptoken = new aecTempToken();
         $temptoken->getComposite();
         if (!empty($temptoken->content['usage'])) {
             $vars['has_usage'] = true;
             $vars['usage'] = $temptoken->content['usage'];
             $vars['processor'] = $temptoken->content['processor'];
             if (isset($temptoken->content['recurring'])) {
                 $vars['recurring'] = $temptoken->content['recurring'];
             } else {
                 $vars['recurring'] = 0;
             }
             if (isset($temptoken->content['username'])) {
                 $vars['username'] = $temptoken->content['username'];
                 $vars['has_user'] = true;
             }
             if (!empty($_REQUEST['username']) && !empty($_REQUEST['password']) && !empty($_REQUEST['email']) && empty($temptoken->content['username']) && empty($temptoken->content['password']) && empty($temptoken->content['email'])) {
                 $temptoken = new aecTempToken();
                 $temptoken->getComposite();
                 $temptoken->content['username'] = $_REQUEST['username'];
                 $temptoken->content['password'] = $_REQUEST['password'];
                 if (isset($_REQUEST['password2'])) {
                     $temptoken->content['password2'] = $_REQUEST['password2'];
                 } elseif (isset($_REQUEST['password__verify'])) {
                     $temptoken->content['password2'] = $_REQUEST['password__verify'];
                 }
                 $temptoken->content['email'] = $_REQUEST['email'];
                 if ($vars['k2_regsv']) {
                     $temptoken->content['handler'] = 'k2';
                 } elseif ($vars['joms_regsv']) {
                     $temptoken->content['handler'] = 'jomsocial';
                 } elseif ($vars['cb_sregsv']) {
                     $temptoken->content['handler'] = 'cb';
                 }
                 $temptoken->storeload();
             }
         } elseif (!empty($temptoken->content['username'])) {
             if (isset($temptoken->content['username'])) {
                 $vars['username'] = $temptoken->content['username'];
                 $vars['has_user'] = true;
             }
         }
     }
     $vars['has_user'] = !empty($vars['username']);
     switch ($vars['forget']) {
         case 'userdetails':
             $vars['has_user'] = false;
             break;
         case 'usage':
             $vars['pfirst'] = false;
             $vars['usage'] = null;
             $vars['has_usage'] = false;
             break;
         default:
             break;
     }
     return $vars;
 }
Beispiel #6
0
function confirmSubscription($option)
{
    $user = JFactory::getUser();
    global $aecConfig;
    $app = JFactory::getApplication();
    $userid = aecGetParam('userid', 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'));
    $username = aecGetParam('username', '', true, array('string', 'clear_nonalnumwhitespace'));
    $passthrough = array();
    if (isset($_POST['aec_passthrough'])) {
        if (is_array($_POST['aec_passthrough'])) {
            $passthrough = $_POST['aec_passthrough'];
        } else {
            $passthrough = unserialize(base64_decode($_POST['aec_passthrough']));
        }
    }
    if ($aecConfig->cfg['plans_first'] && !empty($usage) && empty($username) && empty($passthrough['username']) && !$userid && !$user->id && empty($aecConfig->cfg['skip_registration'])) {
        if (aecComponentHelper::detect_component('anyCB')) {
            // This is a CB registration, borrowing their code to register the user
            include_once JPATH_SITE . '/components/com_comprofiler/comprofiler.html.php';
            include_once JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
            registerForm($option, $app->getCfg('emailpass'), null);
        } else {
            // This is a joomla registration
            joomlaregisterForm($option, $app->getCfg('useractivation'));
        }
    } else {
        if (!empty($usage)) {
            $iFactory = new InvoiceFactory($userid, $usage, $group, $processor);
            $iFactory->confirm();
        } else {
            subscribe($option);
        }
    }
}
Beispiel #7
0
 * @version $Id: access_denied/html.php
 * @package AEC - Account Control Expiration - Membership Manager
 * @subpackage Main Frontend
 * @copyright 2012 Copyright (C) David Deutsch
 * @author David Deutsch <*****@*****.**> & Team AEC - http://www.valanx.org
 * @license GNU/GPL v.3 http://www.gnu.org/licenses/gpl.html or, at your option, any later version
 */
// Dont allow direct linking
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
$tmpl->setTitle(JText::_('NOT_ALLOWED_HEADLINE'));
if ($user->id) {
    $registerlink = AECToolbox::deadsureURL('index.php?option=com_acctexp&task=renewsubscription');
    $loggedin = 1;
} else {
    $loggedin = 0;
    if (aecComponentHelper::detect_component('anyCB')) {
        $registerlink = AECToolbox::deadsureURL('index.php?option=com_comprofiler&task=registers');
    } else {
        if (defined('JPATH_MANIFESTS')) {
            $registerlink = AECToolbox::deadsureURL('index.php?option=com_users&view=registration');
        } else {
            $registerlink = AECToolbox::deadsureURL('index.php?option=com_user&view=register');
        }
    }
}
if ($loggedin) {
    $loginlink = JText::_('NOT_ALLOWED_FIRSTPAR_LOGGED') . '&nbsp;' . $tmpl->lnk($registerlink, JText::_('NOT_ALLOWED_REGISTERLINK_LOGGED'), 'btn btn-default');
} else {
    $loginlink = JText::_('NOT_ALLOWED_FIRSTPAR') . '&nbsp;' . $tmpl->lnk($registerlink, JText::_('NOT_ALLOWED_REGISTERLINK'), 'btn btn-default');
}
$tmpl->defaultHeader();
 public function armRewrite()
 {
     global $aecConfig;
     $this->rewrite = array();
     $this->rewrite['system_timestamp'] = AECToolbox::formatDate((int) gmdate('U'), false, false);
     $this->rewrite['system_timestamp_backend'] = AECToolbox::formatDate((int) gmdate('U'), true, false);
     $this->rewrite['system_serverstamp_time'] = AECToolbox::formatDate((int) gmdate('U'));
     $this->rewrite['system_server_timestamp_backend'] = AECToolbox::formatDate((int) gmdate('U'), true);
     $this->rewrite['cms_absolute_path'] = JPATH_SITE;
     $this->rewrite['cms_live_site'] = JURI::root();
     if (empty($this->data['invoice'])) {
         $this->data['invoice'] = null;
     }
     if (!empty($this->data['metaUser'])) {
         if (is_object($this->data['metaUser'])) {
             if (isset($this->data['metaUser']->cmsUser->id)) {
                 $this->rewrite['user_id'] = $this->data['metaUser']->cmsUser->id;
             } else {
                 $this->rewrite['user_id'] = 0;
             }
             if (!empty($this->data['metaUser']->cmsUser->username)) {
                 $this->rewrite['user_username'] = $this->data['metaUser']->cmsUser->username;
             } else {
                 $this->rewrite['user_username'] = "";
             }
             if (!empty($this->data['metaUser']->cmsUser->name)) {
                 $this->rewrite['user_name'] = $this->data['metaUser']->cmsUser->name;
             } else {
                 $this->rewrite['user_name'] = "";
             }
             $name = $this->data['metaUser']->explodeName();
             $this->rewrite['user_first_name'] = $name['first'];
             $this->rewrite['user_first_first_name'] = $name['first_first'];
             $this->rewrite['user_last_name'] = $name['last'];
             if (!empty($this->data['metaUser']->cmsUser->email)) {
                 $this->rewrite['user_email'] = $this->data['metaUser']->cmsUser->email;
             } else {
                 $this->rewrite['user_name'] = "";
             }
             if (defined('JPATH_MANIFESTS')) {
                 if (empty($this->data['metaUser']->hasJProfile)) {
                     $this->data['metaUser']->loadJProfile();
                 }
                 if (!empty($this->data['metaUser']->hasJProfile)) {
                     foreach ($this->data['metaUser']->jProfile as $field => $value) {
                         $this->rewrite['user_' . $field] = $value;
                     }
                 }
             }
             if (aecComponentHelper::detect_component('JOMSOCIAL')) {
                 if (!$this->data['metaUser']->hasJSprofile) {
                     $this->data['metaUser']->loadJSuser();
                 }
                 if (!empty($this->data['metaUser']->hasJSprofile)) {
                     foreach ($this->data['metaUser']->jsUser as $k => $v) {
                         $this->rewrite['user_js_' . $k] = $v;
                     }
                 }
             }
             if (aecComponentHelper::detect_component('anyCB')) {
                 if (!$this->data['metaUser']->hasCBprofile) {
                     $this->data['metaUser']->loadCBuser();
                 }
                 if (!empty($this->data['metaUser']->hasCBprofile)) {
                     $fields = get_object_vars($this->data['metaUser']->cbUser);
                     if (!empty($fields)) {
                         foreach ($fields as $fieldname => $fieldcontents) {
                             $this->rewrite['user_' . $fieldname] = $fieldcontents;
                         }
                     }
                     if (isset($this->data['metaUser']->cbUser->cbactivation)) {
                         $this->rewrite['user_activationcode'] = $this->data['metaUser']->cbUser->cbactivation;
                         $this->rewrite['user_activationlink'] = JURI::root() . "index.php?option=com_comprofiler&task=confirm&confirmcode=" . $this->data['metaUser']->cbUser->cbactivation;
                     } else {
                         $this->rewrite['user_activationcode'] = "";
                         $this->rewrite['user_activationlink'] = "";
                     }
                 } else {
                     if (isset($this->data['metaUser']->cmsUser->activation)) {
                         $this->rewrite['user_activationcode'] = $this->data['metaUser']->cmsUser->activation;
                         $v = new JVersion();
                         if ($v->isCompatible('1.6')) {
                             $this->rewrite['user_activationlink'] = JURI::root() . 'index.php?option=com_users&amp;task=registration.activate&amp;token=' . $this->data['metaUser']->cmsUser->activation;
                         } else {
                             $this->rewrite['user_activationlink'] = JURI::root() . 'index.php?option=com_user&amp;task=activate&amp;activation=' . $this->data['metaUser']->cmsUser->activation;
                         }
                     } else {
                         $this->rewrite['user_activationcode'] = "";
                         $this->rewrite['user_activationlink'] = "";
                     }
                 }
             } else {
                 if (isset($this->data['metaUser']->cmsUser->activation)) {
                     $this->rewrite['user_activationcode'] = $this->data['metaUser']->cmsUser->activation;
                     $v = new JVersion();
                     if ($v->isCompatible('1.6')) {
                         $this->rewrite['user_activationlink'] = JURI::root() . 'index.php?option=com_users&amp;task=registration.activate&amp;token=' . $this->data['metaUser']->cmsUser->activation;
                     } else {
                         $this->rewrite['user_activationlink'] = JURI::root() . 'index.php?option=com_user&amp;task=activate&amp;activation=' . $this->data['metaUser']->cmsUser->activation;
                     }
                 }
             }
             if (!empty($this->data['metaUser']->meta->custom_params)) {
                 foreach ($this->data['metaUser']->meta->custom_params as $k => $v) {
                     if (is_array($v)) {
                         foreach ($v as $xk => $xv) {
                             if (is_array($xv)) {
                                 foreach ($xv as $xyk => $xyv) {
                                     $this->rewrite['user_' . $k . '_' . $xk . '_' . $xyk] = $xyv;
                                 }
                             } else {
                                 $this->rewrite['user_' . $k . '_' . $xk] = $xv;
                             }
                         }
                     } else {
                         $this->rewrite['user_' . $k] = $v;
                     }
                 }
             }
             if ($this->data['metaUser']->hasSubscription) {
                 $this->rewrite['subscription_id'] = $this->data['metaUser']->focusSubscription->id;
                 $this->rewrite['subscription_type'] = $this->data['metaUser']->focusSubscription->type;
                 $this->rewrite['subscription_status'] = $this->data['metaUser']->focusSubscription->status;
                 $this->rewrite['subscription_signup_date'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->signup_date);
                 $this->rewrite['subscription_signup_date_backend'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->signup_date, true);
                 $this->rewrite['subscription_lastpay_date'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->lastpay_date);
                 $this->rewrite['subscription_lastpay_date_backend'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->lastpay_date, true);
                 $this->rewrite['subscription_plan'] = $this->data['metaUser']->focusSubscription->plan;
                 if (!empty($this->data['metaUser']->focusSubscription->previous_plan)) {
                     $this->rewrite['subscription_previous_plan'] = $this->data['metaUser']->focusSubscription->previous_plan;
                 } else {
                     $this->rewrite['subscription_previous_plan'] = "";
                 }
                 $this->rewrite['subscription_recurring'] = $this->data['metaUser']->focusSubscription->recurring;
                 $this->rewrite['subscription_lifetime'] = $this->data['metaUser']->focusSubscription->lifetime;
                 $this->rewrite['subscription_expiration_date'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->expiration);
                 $this->rewrite['subscription_expiration_date_backend'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->expiration, true);
                 $this->rewrite['subscription_expiration_daysleft'] = round((strtotime($this->data['metaUser']->focusSubscription->expiration) - (int) gmdate('U')) / 86400);
                 if (!empty($this->data['metaUser']->focusSubscription->customparams['notes'])) {
                     $this->rewrite['subscription_notes'] = $this->data['metaUser']->focusSubscription->customparams['notes'];
                 } else {
                     $this->rewrite['subscription_notes'] = '';
                 }
             }
             if (empty($this->data['invoice']) && !empty($this->data['metaUser']->cmsUser->id)) {
                 $lastinvoice = aecInvoiceHelper::lastClearedInvoiceIDbyUserID($this->data['metaUser']->cmsUser->id);
                 $this->data['invoice'] = new Invoice();
                 $this->data['invoice']->load($lastinvoice);
             }
         }
     }
     if (is_object($this->data['invoice'])) {
         if (!empty($this->data['invoice']->id)) {
             $this->rewrite['invoice_id'] = $this->data['invoice']->id;
             $this->rewrite['invoice_number'] = $this->data['invoice']->invoice_number;
             $this->rewrite['invoice_created_date'] = $this->data['invoice']->created_date;
             $this->rewrite['invoice_transaction_date'] = $this->data['invoice']->transaction_date;
             $this->rewrite['invoice_method'] = $this->data['invoice']->method;
             $this->rewrite['invoice_amount'] = $this->data['invoice']->amount;
             $this->rewrite['invoice_currency'] = $this->data['invoice']->currency;
             if (!empty($this->data['invoice']->coupons) && is_array($this->data['invoice']->coupons)) {
                 $this->rewrite['invoice_coupons'] = implode(';', $this->data['invoice']->coupons);
             } else {
                 $this->rewrite['invoice_coupons'] = '';
             }
             if (!empty($this->data['metaUser']) && !empty($this->data['invoice'])) {
                 if (!empty($this->data['invoice']->id)) {
                     $this->data['invoice']->formatInvoiceNumber();
                     $this->rewrite['invoice_number_format'] = $this->data['invoice']->invoice_number;
                     $this->data['invoice']->deformatInvoiceNumber();
                 }
             }
         }
     }
     if (!empty($this->data['plan'])) {
         if (is_object($this->data['plan'])) {
             $this->rewrite['plan_name'] = $this->data['plan']->getProperty('name');
             $this->rewrite['plan_desc'] = $this->data['plan']->getProperty('desc');
             if (!empty($this->data['plan']->params['notes'])) {
                 $this->rewrite['plan_notes'] = $this->data['plan']->params['notes'];
             } else {
                 $this->rewrite['plan_notes'] = '';
             }
         }
     }
 }
Beispiel #9
0
    /**
     * @param metaUser $metaUser
     * @param $invoices
     * @param $coupons
     * @param $mi
     * @param $lists
     * @param aecHTML $aecHTML
     */
    static function userForm($metaUser, $invoices, $coupons, $mi, $lists, $aecHTML)
    {
        ?>
<script type="text/javascript">
		jQuery(document).ready(function() {
			if ( jQuery("input#ck_lifetime").is(':checked') ) {
				jQuery("input#expiration").attr("disabled", "disabled");
			}

			jQuery("input#ck_lifetime").on('click', function() {
				if (jQuery(this).is(':checked')) {
					jQuery("input#expiration").attr("disabled", "disabled");
				} else {
					jQuery("input#expiration").removeAttr("disabled");
				}
			});
		});
	</script><?php 
        HTML_myCommon::startCommon('aec-wrap-geometry', 'aec-wrap-inner-light');
        if (defined('JPATH_MANIFESTS')) {
            $edituserlink = 'index.php?option=com_users&amp;task=user.edit&amp;id=' . $metaUser->userid;
            $activateuserlink = 'index.php?option=com_users&amp;task=registration.activate&amp;token=' . $metaUser->cmsUser->activation;
        } else {
            $edituserlink = 'index.php?option=com_users&amp;view=user&amp;task=edit&amp;cid[]=' . $metaUser->userid;
            $activateuserlink = 'index.php?option=com_user&amp;task=activate&amp;activation=' . $metaUser->cmsUser->activation;
        }
        $exp = $icon = $status = "";
        if ($metaUser->hasSubscription) {
            if (isset($metaUser->focusSubscription->expiration)) {
                $exp = $metaUser->focusSubscription->expiration;
            }
            switch ($metaUser->focusSubscription->status) {
                case 'Excluded':
                    $icon = 'repeat';
                    $status = JText::_('AEC_CMN_EXCLUDED');
                    break;
                case 'Trial':
                    $icon = 'star';
                    $status = JText::_('AEC_CMN_TRIAL');
                    break;
                case 'Pending':
                    $icon = 'star';
                    $status = JText::_('AEC_CMN_PENDING');
                    break;
                case 'Active':
                    $icon = 'ok';
                    $status = JText::_('AEC_CMN_ACTIVE');
                    break;
                case 'Cancelled':
                case 'Cancel':
                    $icon = 'warning-sign';
                    $status = JText::_('AEC_CMN_CANCEL');
                    break;
                case 'Held':
                case 'Hold':
                    $icon = 'warning-sign';
                    $status = JText::_('AEC_CMN_HOLD');
                    break;
                case 'Expired':
                    $icon = 'remove';
                    $status = JText::_('AEC_CMN_EXPIRED');
                    break;
                case 'Closed':
                    $icon = 'remove';
                    $status = JText::_('AEC_CMN_CLOSED');
                    break;
                default:
                    $icon = 'remove-circle';
                    $status = JText::_('AEC_CMN_NOT_SET');
                    break;
            }
        }
        $buttons = array('apply' => array('style' => 'info', 'text' => JText::_('APPLY'), 'icon' => 'ok-sign'), 'save' => array('style' => 'success', 'text' => JText::_('SAVE'), 'icon' => 'ok'), 'hl1' => array(), 'cancel' => array('style' => 'danger', 'text' => JText::_('CANCEL'), 'icon' => 'remove'));
        HTML_myCommon::startForm();
        HTML_myCommon::getHeader('AEC_HEAD_SETTINGS', 'edit', $metaUser->cmsUser->username . ' (' . JText::_('AEC_CMN_ID') . ': ' . $metaUser->userid . ')', false, $buttons, 'Membership');
        ?>
<div class="col-sm-12"><?php 
        $tabs = new bsPaneTabs();
        $tabs->startTabs();
        $tabs->newTab('user', JText::_('AEC_HEAD_PLAN_INFO'));
        $tabs->newTab('mis', JText::_('AEC_USER_MICRO_INTEGRATION'));
        $tabs->endTabs();
        $tabs->startPanes();
        $tabs->nextPane('user', true);
        ?>
	<div class="row">
	<div class="col-sm-6">
		<section class="paper">
			<h4><?php 
        echo JText::_('AEC_USER_SUBSCRIPTION');
        ?>
</h4>
			<div class="row">
				<?php 
        if ($metaUser->hasSubscription) {
            ?>
					<div class="col-sm-6">
						<div class="form-group">
							<label class="col-sm-4 control-label"><?php 
            echo JText::_('AEC_USER_SUBSCRIPTIONS_ID');
            ?>
</label>
							<div class="col-sm-8">
								<p class="form-control-static"><?php 
            echo $metaUser->focusSubscription->id;
            ?>
</p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label"><?php 
            echo JText::_('AEC_USER_CURR_SUBSCR_PLAN');
            ?>
</label>
							<div class="col-sm-8">
								<p class="form-control-static">#<?php 
            echo $metaUser->focusSubscription->plan;
            ?>
 - "<?php 
            echo $metaUser->focusSubscription->plan ? HTML_AcctExp::SubscriptionName($metaUser->focusSubscription->plan) : '<span style="color:#FF0000;">' . JText::_('AEC_CMN_NOT_SET') . '</span>';
            ?>
"</p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label"><?php 
            echo JText::_('AEC_USER_STATUS');
            ?>
</label>
							<div class="col-sm-8">
								<p class="form-control-static"><?php 
            echo aecHTML::Icon($icon);
            ?>
&nbsp;<?php 
            echo $status;
            ?>
</p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label"><?php 
            echo JText::_('AEC_USER_PAYMENT_PROC');
            ?>
</label>
							<div class="col-sm-8">
								<p class="form-control-static"><?php 
            echo $metaUser->focusSubscription->type ? $metaUser->focusSubscription->type : JText::_('AEC_CMN_NOT_SET');
            ?>
</p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label" for="ck_primary">
								<span><?php 
            echo JText::_('AEC_USER_CURR_SUBSCR_PLAN_PRIMARY');
            ?>
</span>
							</label>
							<div class="col-sm-8">
								<input type="hidden" value="0" name="ck_primary"/>
								<div>
									<input id="ck_primary" class="bootstrap-toggle" type="checkbox" name="ck_primary"<?php 
            echo $metaUser->focusSubscription->primary ? ' checked="checked" ' : '';
            ?>
 value="1" data-state="<?php 
            echo $metaUser->focusSubscription->primary;
            ?>
"/>
								</div>
							</div>
						</div>
					</div>
					<div class="col-sm-6">
						<div class="form-group">
							<label class="col-sm-4 control-label" for="expiration_current">
								<span><?php 
            echo JText::_('AEC_USER_CURR_EXPIRE_DATE');
            ?>
</span>
							</label>
							<div class="col-sm-8">
								<p class="form-control-static"><?php 
            echo $metaUser->focusSubscription->lifetime ? JText::_('AEC_USER_LIFETIME') : HTML_AcctExp::DisplayDateInLocalTime($exp);
            ?>
</p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label" for="ck_lifetime">
								<span><?php 
            echo JText::_('AEC_USER_LIFETIME');
            ?>
</span>
							</label>
							<div class="col-sm-8">
								<input type="hidden" value="0" name="ck_lifetime"/>
								<div>
									<input id="ck_lifetime" class="bootstrap-toggle" type="checkbox" name="ck_lifetime"<?php 
            echo $metaUser->focusSubscription->lifetime ? ' checked="checked" ' : '';
            ?>
 value="1" data-state="<?php 
            echo $metaUser->focusSubscription->lifetime;
            ?>
"/>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label">
								<span><?php 
            echo JText::_('AEC_USER_RESET_EXP_DATE');
            ?>
</span>
							</label>
							<div class="col-sm-8">
								<div>
									<input id="datepicker-expiration" name="expiration" class="jqui-datetimepicker" type="text" value="<?php 
            echo $exp;
            ?>
">
									<input type="hidden" name="expiration_check" id="expiration_check" value="<?php 
            echo !empty($exp) ? $exp : date('Y-m-d H:i:s');
            ?>
"/>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label" for="set_status">
								<span><?php 
            echo JText::_('AEC_USER_RESET_STATUS');
            ?>
</span>
							</label>
							<div class="col-sm-8">
								<div>
									<?php 
            echo $lists['set_status'];
            ?>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label" for="assignto_plan">
								<span><?php 
            echo JText::_('AEC_USER_ASSIGN_TO_PLAN');
            ?>
</span>
							</label>
							<div class="col-sm-8">
								<div>
									<?php 
            echo $lists['assignto_plan'];
            ?>
								</div>
							</div>
						</div>
					</div>

				<?php 
        } else {
            ?>
					<div class="col-sm-12">
						<div class="form-group">
							<label class="col-sm-4 control-label" for="assignto_plan">
								<span><?php 
            echo JText::_('AEC_USER_ASSIGN_TO_PLAN');
            ?>
</span>
							</label>
							<div class="col-sm-8">
								<div>
									<?php 
            echo $lists['assignto_plan'];
            ?>
								</div>
							</div>
						</div>
					</div>
				<?php 
        }
        ?>
			</div>
		</section>
		<section class="paper">
			<h4><?php 
        echo JText::_('AEC_USER_SUBSCRIPTION');
        ?>
 History</h4>
			<?php 
        if ($metaUser->hasSubscription) {
            ?>
				<div class="form-group">
					<label class="col-sm-4 control-label"><?php 
            echo JText::_('AEC_USER_PREV_SUBSCR_PLAN');
            ?>
</label>
					<div class="col-sm-8">
						<p class="form-control-static">#<?php 
            echo $metaUser->focusSubscription->previous_plan;
            ?>
 - "<?php 
            echo $metaUser->focusSubscription->previous_plan ? HTML_AcctExp::SubscriptionName($metaUser->focusSubscription->previous_plan) : '<span style="color:#FF0000;">' . JText::_('AEC_CMN_NOT_SET') . '</span>';
            ?>
"</p>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-4 control-label"><?php 
            echo JText::_('AEC_USER_USED_PLANS');
            ?>
</label>
					<div class="col-sm-8">
						<div>
									<span>
										<?php 
            if (!empty($metaUser->meta->plan_history->used_plans)) {
                ?>
											<ul>
												<?php 
                foreach ($metaUser->meta->plan_history->used_plans as $used => $amount) {
                    ?>
													<li>#<?php 
                    echo $used;
                    ?>
 - "<?php 
                    echo HTML_AcctExp::SubscriptionName($used);
                    ?>
" (<?php 
                    echo $amount . " " . ($amount > 1 ? JText::_('AEC_USER_TIMES') : JText::_('AEC_USER_TIME'));
                    ?>
)</li>
												<?php 
                }
                ?>
											</ul>
										<?php 
            } else {
                echo JText::_('AEC_USER_NO_PREV_PLANS');
            }
            ?>
									</span>
						</div>
					</div>
				</div>
			<?php 
        }
        ?>
			<?php 
        if ($metaUser->hasSubscription && !empty($metaUser->allSubscriptions)) {
            ?>
				<br />
				<p><strong><?php 
            echo JText::_('AEC_USER_ALL_SUBSCRIPTIONS');
            ?>
:</strong></p>
				<table class="infobox_table table-striped">
					<tr>
						<th>&nbsp;</th>
						<th>&nbsp;</th>
						<th><?php 
            echo JText::_('AEC_USER_SUBSCRIPTIONS_ID');
            ?>
</th>
						<th><?php 
            echo JText::_('AEC_USER_SUBSCRIPTIONS_STATUS');
            ?>
</th>
						<th><?php 
            echo JText::_('AEC_USER_SUBSCRIPTIONS_PROCESSOR');
            ?>
</th>
						<th><?php 
            echo JText::_('AEC_USER_SUBSCRIPTIONS_SINGUP');
            ?>
</th>
						<th><?php 
            echo JText::_('AEC_USER_SUBSCRIPTIONS_EXPIRATION');
            ?>
</th>
					</tr>
					<?php 
            foreach ($metaUser->allSubscriptions as $subs) {
                ?>
						<tr<?php 
                echo isset($subs->current_focus) ? ' class="current-focus"' : '';
                ?>
>
							<td><?php 
                echo isset($subs->current_focus) ? '<strong>&rArr;</strong>' : '&nbsp;';
                ?>
</td>
							<td><?php 
                echo $subs->primary ? aecHTML::Icon('star') : '&nbsp;';
                ?>
</td>
							<td><?php 
                echo !isset($subs->current_focus) ? '<a href="index.php?option=com_acctexp&amp;task=edit&amp;entity=Membership&subscriptionid=' . $subs->id . '">' . $subs->id . '</a>' : $subs->id;
                ?>
</td>
							<td><?php 
                echo $subs->status;
                ?>
</td>
							<td><?php 
                echo $subs->type;
                ?>
</td>
							<td><?php 
                echo $subs->signup_date;
                ?>
</td>
							<td><?php 
                echo $subs->lifetime ? JText::_('AEC_CMN_LIFETIME') : HTML_AcctExp::DisplayDateInLocalTime($subs->expiration);
                ?>
</td>
						</tr>
					<?php 
            }
            ?>
				</table>
			<?php 
        } elseif ($metaUser->hasSubscription) {
            ?>
				<p><?php 
            echo JText::_('AEC_USER_ALL_SUBSCRIPTIONS_NOPE');
            ?>
</p>
			<?php 
        } else {
            ?>
				<div class="alert alert-danger">
					<p><?php 
            echo JText::_('AEC_USER_ALL_SUBSCRIPTIONS_NONE');
            ?>
</p>
				</div>
			<?php 
        }
        ?>
		</section>
		<section class="paper">
			<h4><?php 
        echo 'Notes';
        ?>
</h4>
			<textarea style="width:90%" cols="450" rows="10" name="notes" id="notes" ><?php 
        echo !empty($metaUser->focusSubscription->customparams['notes']) ? $metaUser->focusSubscription->customparams['notes'] : "";
        ?>
</textarea>
		</section>
	</div>
	<div class="col-sm-6">
		<section class="paper">
			<h4><?php 
        echo JText::_('AEC_USER_USER_INFO');
        ?>
</h4>
			<div class="row">
				<div class="col-sm-6">
					<div class="form-group">
						<label class="col-sm-4 control-label"><?php 
        echo JText::_('AEC_USER_USERID');
        ?>
</label>
						<div class="col-sm-8">
							<p class="form-control-static"><?php 
        echo $metaUser->userid;
        ?>
</p>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label"><?php 
        echo JText::_('AEC_USER_STATUS');
        ?>
</label>
						<div class="col-sm-8">
							<p class="form-control-static"><?php 
        echo !$metaUser->cmsUser->block ? aecHTML::Icon('ok') . '&nbsp;' . JText::_('AEC_USER_ACTIVE') . '</strong>' : aecHTML::Icon('warning-sign') . '&nbsp;' . JText::_('AEC_USER_BLOCKED') . '</strong>' . ($metaUser->cmsUser->activation == '' ? '' : ' (<a href="' . JURI::root() . $activateuserlink . '" target="_blank">' . JText::_('AEC_USER_ACTIVE_LINK') . '</a>)');
        ?>
</p>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label"><?php 
        echo JText::_('AEC_USER_PROFILE');
        ?>
</label>
						<div class="col-sm-8">
							<p class="form-control-static"><a href="<?php 
        echo $edituserlink;
        ?>
"><?php 
        echo aecHTML::Icon('user');
        ?>
&nbsp;<?php 
        echo JText::_('AEC_USER_PROFILE_LINK');
        ?>
</a></p>
						</div>
					</div>
					<?php 
        if (aecComponentHelper::detect_component('anyCB')) {
            ?>
						<div class="form-group">
							<label class="col-sm-4 control-label">CB Profile</label>
							<div class="col-sm-8">
								<p class="form-control-static"><?php 
            echo '<a href="index.php?option=com_comprofiler&amp;task=edit&amp;cid=' . $metaUser->userid . '">' . aecHTML::Icon('user') . '&nbsp;' . JText::_('AEC_USER_PROFILE_LINK') . '</a>';
            ?>
</p>
							</div>
						</div>
					<?php 
        }
        ?>
					<?php 
        if (aecComponentHelper::detect_component('JOMSOCIAL')) {
            ?>
						<div class="form-group">
							<label class="col-sm-4 control-label">JomSocial Profile</label>
							<div class="col-sm-8">
								<p class="form-control-static"><?php 
            echo '<a href="index.php?option=com_community&amp;view=users&amp;layout=edit&amp;id=' . $metaUser->userid . '">' . aecHTML::Icon('user') . '&nbsp;' . JText::_('AEC_USER_PROFILE_LINK') . '</a>';
            ?>
</p>
							</div>
						</div>
					<?php 
        }
        ?>
				</div>
				<div class="col-sm-6">
					<div class="form-group">
						<label class="col-sm-4 control-label"><?php 
        echo JText::_('AEC_USER_USERNAME');
        ?>
</label>
						<div class="col-sm-8">
							<p class="form-control-static"><?php 
        echo $metaUser->cmsUser->username;
        ?>
</p>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label"><?php 
        echo JText::_('AEC_USER_NAME');
        ?>
</label>
						<div class="col-sm-8">
							<p class="form-control-static"><?php 
        echo $metaUser->cmsUser->name;
        ?>
</p>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label"><?php 
        echo JText::_('AEC_USER_EMAIL');
        ?>
</label>
						<div class="col-sm-8">
							<p class="form-control-static"><?php 
        echo $metaUser->cmsUser->email;
        ?>
 (<a href="mailto:<?php 
        echo $metaUser->cmsUser->email;
        ?>
">&nbsp;<?php 
        echo aecHTML::Icon('envelope');
        ?>
&nbsp;<?php 
        echo JText::_('AEC_USER_SEND_MAIL');
        ?>
</a>)</p>
						</div>
					</div>
					<?php 
        if (!defined('JPATH_MANIFESTS')) {
            ?>
						<div class="form-group">
							<label class="col-sm-4 control-label"><?php 
            echo JText::_('AEC_USER_TYPE');
            ?>
</label>
							<div class="col-sm-8">
								<p class="form-control-static"><?php 
            echo $metaUser->cmsUser->usertype;
            ?>
</p>
							</div>
						</div>
					<?php 
        }
        ?>
					<div class="form-group">
						<label class="col-sm-4 control-label"><?php 
        echo JText::_('AEC_USER_REGISTERED');
        ?>
</label>
						<div class="col-sm-8">
							<p class="form-control-static"><?php 
        echo aecHTML::Icon('calendar');
        echo $metaUser->cmsUser->registerDate;
        ?>
</p>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label"><?php 
        echo JText::_('AEC_USER_LAST_VISIT');
        ?>
</label>
						<div class="col-sm-8">
							<p class="form-control-static"><?php 
        echo $metaUser->cmsUser->lastvisitDate;
        ?>
</p>
						</div>
					</div>
				</div>
			</div>
		</section>
		<section class="paper">
			<h4><?php 
        echo JText::_('AEC_USER_INVOICES');
        ?>
</h4>
			<table class="infobox_table table-striped">
				<thead>
				<tr>
					<th><?php 
        echo JText::_('HISTORY_COL_INVOICE');
        ?>
</th>
					<th><?php 
        echo JText::_('HISTORY_COL_AMOUNT');
        ?>
</th>
					<th><?php 
        echo JText::_('HISTORY_COL_DATE');
        ?>
</th>
					<th><?php 
        echo JText::_('HISTORY_COL_METHOD');
        ?>
</th>
					<th><?php 
        echo JText::_('HISTORY_COL_PLAN');
        ?>
</th>
					<th><?php 
        echo JText::_('HISTORY_COL_ACTION');
        ?>
</th>
				</tr>
				</thead>
				<tbody>
				<?php 
        if (!empty($invoices)) {
            foreach ($invoices as $invoice_id => $invoice) {
                ?>
						<tr<?php 
                echo $invoice['rowstyle'];
                ?>
>
							<td>
								<a href="index.php?option=com_acctexp&amp;task=edit&amp;entity=Invoice&amp;returnTask=invoices&amp;id=<?php 
                echo $invoice_id;
                ?>
"><?php 
                echo $invoice['invoice_number'];
                ?>
</a>
							</td>
							<td><?php 
                echo $invoice['amount'];
                ?>
</td>
							<td><?php 
                echo $invoice['status'];
                ?>
</td>
							<td><?php 
                echo $invoice['processor'];
                ?>
</td>
							<td><a href="index.php?option=com_acctexp&amp;task=edit&amp;entity=SubscriptionPlan&amp;id=<?php 
                echo $invoice['usage'];
                ?>
" target="_blank"><?php 
                echo $invoice['usage'];
                ?>
</a></td>
							<td style="text-align:center;"><?php 
                echo $invoice['actions'];
                ?>
</td>
						</tr>
					<?php 
            }
            if ($aecHTML->invoice_pages > 1) {
                echo '<div class="aec-invoices-pagination"><p>';
                $plist = array();
                for ($i = 0; $i < $aecHTML->invoice_pages; $i++) {
                    if ($i == $aecHTML->invoice_page) {
                        $plist[] = $i + 1;
                    } else {
                        $plist[] = '<a href="index.php?option=com_acctexp&amp;task=edit&amp;entity=Membership&amp;subscriptionid=' . $aecHTML->sid . '&amp;page=' . $i . '">' . ($i + 1) . '</a>';
                    }
                }
                echo implode('&nbsp;&middot;&nbsp;', $plist) . '</p></div>';
            }
        } else {
            echo '<tr><td colspan="6" style="text-align:center;">&gt;&gt;&nbsp;' . JText::_('AEC_USER_NO_INVOICES') . '&nbsp;&lt;&lt;</td></tr>' . "\n";
        }
        ?>
				</tbody>
				<tfoot>
				<tr><td colspan="6"><a href="index.php?option=com_acctexp&amp;task=NewInvoice&amp;returnTask=1&amp;userid=<?php 
        echo $metaUser->userid;
        ?>
" class="btn btn-info pull-right"><?php 
        echo aecHTML::Icon('plus');
        ?>
 Add Invoice</a></td></tr>
				</tfoot>
			</table>
		</section>
		<section class="paper">
			<h4><?php 
        echo JText::_('AEC_USER_COUPONS');
        ?>
</h4>
			<table class="infobox_table table-striped">
				<thead>
				<tr>
					<th><?php 
        echo JText::_('HISTORY_COL_COUPON_CODE');
        ?>
</th>
					<th><?php 
        echo JText::_('HISTORY_COL_INVOICE');
        ?>
</th>
				</tr>
				</thead>
				<tbody>
				<?php 
        if (!empty($coupons)) {
            foreach ($coupons as $coupon) {
                ?>
						<tr>
							<td><?php 
                echo $coupon['coupon_code'];
                ?>
</td>
							<td><?php 
                echo $coupon['invoices'];
                ?>
</td>
						</tr>
					<?php 
            }
        } else {
            echo '<tr><td colspan="2" style="text-align:center;">&gt;&gt;&nbsp;' . JText::_('AEC_USER_NO_COUPONS') . '&nbsp;&lt;&lt;</td></tr>' . "\n";
        }
        ?>
				</tbody>
			</table>
		</section>
	</div>
	</div>
	<?php 
        $tabs->nextPane('mis');
        ?>
	<div class="row">
		<?php 
        if (!empty($mi['profile']) || !empty($mi['profile_form'])) {
            ?>
			<div class="col-sm-6">
				<section class="paper">
					<h4><?php 
            echo JText::_('Profile Form');
            ?>
</h4>
					<p>(This is what the user sees on the frontend.)</p>
					<?php 
            if (!empty($mi['profile'])) {
                ?>
						<?php 
                foreach ($mi['profile'] as $mix) {
                    ?>
							<div class="profileinfobox">
								<h4><?php 
                    echo $mix['name'];
                    ?>
</h4>
								<p><?php 
                    echo $mix['info'];
                    ?>
</p>
							</div>
						<?php 
                }
                ?>
					<?php 
            }
            if (!empty($mi['profile_form'])) {
                ?>
						<?php 
                foreach ($mi['profile_form'] as $k) {
                    ?>
							<?php 
                    echo $aecHTML->createSettingsParticle($k);
                    ?>
						<?php 
                }
                ?>
					<?php 
            }
            ?>
				</section>
			</div>
		<?php 
        }
        ?>
		<?php 
        if (!empty($mi['admin']) || !empty($mi['admin_form'])) {
            ?>
			<div class="col-sm-6">
				<section class="paper">
					<h4><?php 
            echo JText::_('Admin Form');
            ?>
</h4>
					<?php 
            if (!empty($mi['admin'])) {
                ?>
						<?php 
                foreach ($mi['admin'] as $mix) {
                    ?>
							<div class="admininfobox">
								<h4><?php 
                    echo $mix['name'];
                    ?>
</h4>
								<p><?php 
                    echo $mix['info'];
                    ?>
</p>
							</div>
						<?php 
                }
                ?>
					<?php 
            }
            if (!empty($mi['admin_form'])) {
                ?>
						<?php 
                foreach ($mi['admin_form'] as $k) {
                    ?>
							<?php 
                    echo $aecHTML->createSettingsParticle($k);
                    ?>
						<?php 
                }
                ?>
					<?php 
            }
            ?>
				</section>
			</div>
		<?php 
        }
        if (!empty($metaUser->meta->params->mi)) {
            ?>
			<div class="col-sm-12">
				<section class="paper">
					<h4><?php 
            echo JText::_('Database Records');
            ?>
</h4>
					<pre class="prettyprint"><?php 
            print_r($metaUser->meta->params->mi);
            ?>
</pre>
				</section>
			</div>
		<?php 
        }
        ?>
	</div>
	<?php 
        $tabs->endPanes();
        ?>
	<input type="hidden" name="option" value="com_acctexp" />
	<input type="hidden" name="subscriptionid" value="<?php 
        echo !empty($metaUser->focusSubscription->id) ? $metaUser->focusSubscription->id : '';
        ?>
" />
	<input type="hidden" name="userid" value="<?php 
        echo $metaUser->userid;
        ?>
" />
	<input type="hidden" name="task" value="save" />
	<input type="hidden" name="entity" value="Membership" />
	</form>

	<?php 
        HTML_myCommon::endCommon();
    }