Exemple #1
0
 public function onAfterStoreUser($user, $isnew, $success, $msg)
 {
     if (file_exists(JPATH_ROOT . "/components/com_acctexp/acctexp.class.php")) {
         include_once JPATH_ROOT . "/components/com_acctexp/acctexp.class.php";
         if ($isnew) {
             $mih = new microIntegrationHandler();
             $mih->userchange($user, $_POST, 'registration');
         }
     }
 }
Exemple #2
0
 public function getMIcount($mi_id)
 {
     $plans = $this->getAllCurrentSubscriptionPlans();
     $count = 0;
     foreach ($plans as $plan_id) {
         $mis = microIntegrationHandler::getMIsbyPlan($plan_id);
         if (!empty($mis)) {
             foreach ($mis as $mi) {
                 if ($mi == $mi_id) {
                     $count++;
                 }
             }
         }
     }
     return $count;
 }
Exemple #3
0
 public function touchMIs()
 {
     // Make sure mi language files are updated
     $milist = microIntegrationHandler::getMIList();
     $midone = array();
     foreach ($milist as $miobj) {
         if (in_array($miobj->class_name, $midone)) {
             continue;
         }
         $mifobj = new microIntegration();
         if ($mifobj->load($miobj->id)) {
             $mifobj->copyAssets();
             $midone[] = $miobj->class_name;
         }
     }
 }
Exemple #4
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;
 }
 public function getMicroIntegrationsSeparate($strip_inherited = false)
 {
     if (empty($this->params['micro_integrations'])) {
         $milist = array();
     } else {
         $milist = $this->params['micro_integrations'];
     }
     // Find parent ItemGroups to attach their MIs
     $parents = ItemGroupHandler::getParents($this->id, 'group');
     $gmilist = array();
     if (!empty($parents)) {
         foreach ($parents as $parent) {
             $g = new ItemGroup();
             $g->load($parent);
             if (!empty($g->params['micro_integrations'])) {
                 $gmilist = array_merge($gmilist, $g->params['micro_integrations']);
             }
         }
     }
     if (empty($milist) && empty($gmilist)) {
         return array('group' => array(), 'inherited' => array());
     }
     $milist = microIntegrationHandler::getActiveListbyList($milist);
     $gmilist = microIntegrationHandler::getActiveListbyList($gmilist);
     if (empty($milist) && empty($gmilist)) {
         return array('group' => array(), 'inherited' => array());
     }
     if ($this->id > 1) {
         // Remove entries from the group MIs that are already inherited
         if (!empty($gmilist) && !empty($milist) && $strip_inherited) {
             $theintersect = array_intersect($gmilist, $milist);
             if (!empty($theintersect)) {
                 foreach ($theintersect as $value) {
                     // STAY IN THE CAR
                     unset($milist[array_search($value, $milist)]);
                 }
             }
         }
     } else {
         $gmilist = array();
     }
     return array('group' => $milist, 'inherited' => $gmilist);
 }
 public function savePOSTsettings($post)
 {
     if (!empty($post['id'])) {
         $planid = $post['id'];
     } else {
         // Fake knowing the planid if is zero.
         $planid = $this->getMax() + 1;
     }
     if (isset($post['id'])) {
         unset($post['id']);
     }
     if (isset($post['inherited_micro_integrations'])) {
         unset($post['inherited_micro_integrations']);
     }
     if (!empty($post['add_group'])) {
         ItemGroupHandler::setChildren($post['add_group'], array($planid));
         unset($post['add_group']);
     }
     if (empty($post['micro_integrations'])) {
         $post['micro_integrations'] = array();
     }
     if (!empty($post['micro_integrations_plan'])) {
         foreach ($post['micro_integrations_plan'] as $miname) {
             // Create new blank MIs
             $mi = new microIntegration();
             $mi->load(0);
             $mi->class_name = $miname;
             if (!$mi->callIntegration(true)) {
                 continue;
             }
             $mi->hidden = 1;
             $mi->storeload();
             // Add in new MI id
             $post['micro_integrations'][] = $mi->id;
         }
         $mi->reorder();
         unset($post['micro_integrations_plan']);
     }
     if (!empty($post['micro_integrations_hidden'])) {
         // Recover hidden MI relation to full list
         $post['micro_integrations'] = array_merge($post['micro_integrations'], $post['micro_integrations_hidden']);
         unset($post['micro_integrations_hidden']);
     }
     if (!empty($post['micro_integrations_inherited'])) {
         unset($post['micro_integrations_inherited']);
     }
     // Update MI settings
     foreach ($post['micro_integrations'] as $miid) {
         $mi = new microIntegration();
         $mi->load($miid);
         // Only act special on hidden MIs
         if (!$mi->hidden) {
             continue;
         }
         $prefix = 'MI_' . $miid . '_';
         // Get Settings from post array
         $settings = array();
         foreach ($post as $name => $value) {
             if (strpos($name, $prefix) === 0) {
                 $rname = str_replace($prefix, '', $name);
                 $settings[$rname] = $value;
                 unset($post[$name]);
             }
         }
         // If we indeed HAVE settings, more to come here
         if (empty($settings)) {
             continue;
         }
         $mi->savePostParams($settings);
         // First, check whether there is already an MI with the exact same settings
         $similarmis = microIntegrationHandler::getMIList(false, false, true, false, $mi->classname);
         $similarmi = false;
         if (!empty($similarmis)) {
             foreach ($similarmis as $miobj) {
                 if ($miobj->id == $mi->id) {
                     continue;
                 }
                 if (microIntegrationHandler::compareMIs($mi, $miobj->id)) {
                     $similarmi = $miobj->id;
                 }
             }
         }
         if ($similarmi) {
             // We have a similar MI - unset old reference
             $ref = array_search($mi->id, $post['micro_integrations']);
             unset($post['micro_integrations'][$ref]);
             // No MI is similar, lets check for other plans
             $plans = microIntegrationHandler::getPlansbyMI($mi->id);
             foreach ($plans as $cid => $pid) {
                 if ($pid == $this->id) {
                     unset($plans[$cid]);
                 }
             }
             if (count($plans) <= 1) {
                 // No other plan depends on this MI, just delete it
                 $mi->delete();
             }
             // Set new MI
             $post['micro_integrations'][] = $similarmi;
         } else {
             // No MI is similar, lets check for other plans
             $plans = microIntegrationHandler::getPlansbyMI($mi->id);
             foreach ($plans as $cid => $pid) {
                 if ($pid == $this->id) {
                     unset($plans[$cid]);
                 }
             }
             if (count($plans) > 1) {
                 // We have other plans depending on THIS setup of the MI, unset original reference
                 $ref = array_search($mi->id, $post['micro_integrations']);
                 unset($post['micro_integrations'][$ref]);
                 // And create new MI
                 $mi->id = 0;
                 $mi->storeload();
                 // Set new MI
                 $post['micro_integrations'][] = $mi->id;
             } else {
                 $mi->storeload();
             }
         }
     }
     // Filter out fixed variables
     $fixed = array('active', 'visible', 'name', 'desc', 'email_desc', 'micro_integrations');
     foreach ($fixed as $varname) {
         if (isset($post[$varname])) {
             $this->{$varname} = $post[$varname];
             unset($post[$varname]);
         } else {
             $this->{$varname} = '';
         }
     }
     // Get selected processors ( have to be filtered out )
     $processors = array();
     foreach ($post as $key => $value) {
         if ($key == 'processor_selectmode') {
             continue;
         }
         if (strpos($key, 'processor_') === 0 && $value) {
             $ppid = str_replace('processor_', '', $key);
             if (!in_array($ppid, $processors)) {
                 $processors[] = $ppid;
                 unset($post[$key]);
             }
         }
     }
     // Filter out params
     $fixed = array('full_free', 'full_amount', 'full_period', 'full_periodunit', 'trial_free', 'trial_amount', 'trial_period', 'trial_periodunit', 'gid_enabled', 'gid', 'lifetime', 'standard_parent', 'fallback', 'fallback_req_parent', 'similarplans', 'equalplans', 'make_active', 'make_primary', 'update_existing', 'customthanks', 'customtext_thanks_keeporiginal', 'customamountformat', 'customtext_thanks', 'override_activation', 'override_regmail', 'notauth_redirect', 'fixed_redirect', 'hide_duration_checkout', 'addtocart_redirect', 'addtocart_max', 'cart_behavior', 'notes', 'meta', 'processor_selectmode');
     $params = array();
     foreach ($fixed as $varname) {
         if (!isset($post[$varname])) {
             continue;
         }
         $params[$varname] = $post[$varname];
         unset($post[$varname]);
     }
     $params['processors'] = $processors;
     $this->saveParams($params);
     // Filter out restrictions
     $fixed = aecRestrictionHelper::paramList();
     $fixed = array_merge($fixed, array('inventory_amount_enabled', 'inventory_amount', 'inventory_amount_used'));
     $restrictions = array();
     foreach ($fixed as $varname) {
         if (!isset($post[$varname])) {
             continue;
         }
         $restrictions[$varname] = $post[$varname];
         unset($post[$varname]);
     }
     $this->restrictions = $restrictions;
     // There might be deletions set for groups
     foreach ($post as $varname => $content) {
         if (strpos($varname, 'group_delete_') !== false && $content) {
             $parentid = (int) str_replace('group_delete_', '', $varname);
             ItemGroupHandler::removeChildren($planid, array($parentid));
             unset($post[$varname]);
         }
     }
     // The rest of the vars are custom params
     $custom_params = array();
     foreach ($post as $varname => $content) {
         if (substr($varname, 0, 4) != 'mce_') {
             $custom_params[$varname] = $content;
         }
         unset($post[$varname]);
     }
     $this->custom_params = $custom_params;
 }
 public function expire($overridefallback = false, $special = null, $now = true)
 {
     // Users who are excluded cannot expire
     if ($this->isExcluded()) {
         return null;
     }
     $plan = $this->getPlan();
     if (empty($plan)) {
         if ($now) {
             $this->expireNow();
         }
         return $this->setStatus('Expired');
     }
     $expired = true;
     // Recognize the fallback plan, if not overridden
     if (!empty($plan->params['fallback']) && !$overridefallback) {
         // Prevent fallback if an active parent is required, but not this or not present
         if (!$this->isPrimary() && !$plan->params['make_primary'] && !empty($plan->params['fallback_req_parent'])) {
             $metaUser = new metaUser($this->userid);
             $overridefallback = $metaUser->objSubscription->isExpired();
         }
         if (!$overridefallback) {
             $this->applyUsage($plan->params['fallback'], 'none', 1);
             $expired = null;
         }
     } else {
         // Set a Trial flag if this is an expired Trial for further reference
         if ($this->isTrial()) {
             $this->addParams(array('trialflag' => 1));
         } elseif (is_array($this->params)) {
             if (in_array('trialflag', $this->params)) {
                 $this->delParams(array('trialflag'));
             }
         }
         if (!$this->isStatus('Expired') && !$this->isClosed()) {
             if ($now) {
                 $this->expireNow();
             }
             $this->setStatus('Expired');
         }
         $metaUser = new metaUser($this->userid);
         if ($metaUser->moveFocus($this->id)) {
             // Call Expiration MIs
             $mih = new microIntegrationHandler();
             $mih->userPlanExpireActions($metaUser, $plan, $special);
         }
     }
     $this->reload();
     return $expired;
 }
Exemple #8
0
    foreach ($olddirs as $olddir) {
        $eucaInstall->rrmdir($mih->mi_dir . '/' . $olddir);
    }
    // Try to preserve custom MIs
    foreach ($testmis as $mik) {
        $handle = str_replace(array('mi_', '.php'), '', $mik);
        if (is_dir($mih->mi_dir . '/' . $mik) || strpos($mik, '.php') === false) {
            continue;
        }
        if (is_dir($mih->mi_dir . '/' . $handle)) {
            unlink($mih->mi_dir . '/' . $mik);
            continue;
        }
        $newdir = $mih->mi_dir . '/' . $handle;
        mkdir($newdir);
        rename($mih->mi_dir . '/' . $mik, $newdir . '/' . $handle . '.php');
    }
    $milist = microIntegrationHandler::getDetailedList();
    $mixsearch = array('mi_hotproperty', 'docman', 'uddeim');
    $mixhits = array();
    foreach ($milist as $mix) {
        if (in_array($mix->class_name, $mixsearch) && !in_array($mix->class_name, $mixhits)) {
            $mixhits[] = $mix->class_name;
        }
    }
    if (!empty($mixhits)) {
        foreach ($mixhits as $mixclass) {
            $errors[] = array("The directory structure for the MicroIntegrations has changed. Please update the hacks for the following MI: " . $mixclass);
        }
    }
}
Exemple #9
0
 public function cmdHas($params)
 {
     switch (strtolower($params[0])) {
         case 'subscriptionid':
             return explode(',', $params[1]);
             break;
         case 'userid':
             $db = JFactory::getDBO();
             $query = 'SELECT `id`' . ' FROM #__users' . ' WHERE `userid` IN (' . $params[1] . ')';
             $db->setQuery($query);
             return xJ::getDBArray($db);
             break;
         case 'username':
             $db = JFactory::getDBO();
             $query = 'SELECT `id`' . ' FROM #__users' . ' WHERE LOWER( `username` ) LIKE \'%' . $params[1] . '%\'';
             $db->setQuery($query);
             $ids = xJ::getDBArray($db);
             $p = array();
             $p[0] = 'userid';
             $p[1] = implode(',', $ids);
             return $this->cmdHas($p);
             break;
         case 'plan':
             $db = JFactory::getDBO();
             $query = 'SELECT ' . ($this->focus == 'users' ? 'DISTINCT `userid`' : '`id`') . ' FROM #__acctexp_subscr' . ' WHERE `plan` IN (' . $params[1] . ')' . ' AND `status` != \'Expired\'' . ' AND `status` != \'Closed\'' . ' AND `status` != \'Hold\'';
             $db->setQuery($query);
             return xJ::getDBArray($db);
             break;
         case 'mi':
             $mis = explode(',', $params[1]);
             $plans = array();
             foreach ($mis as $mi) {
                 $plans = array_merge($plans, microIntegrationHandler::getPlansbyMI($mi));
             }
             $plans = array_unique($plans);
             $p = array();
             $p[0] = 'plan';
             $p[1] = implode(',', $plans);
             return $this->cmdHas($p);
             break;
     }
 }
Exemple #10
0
 public function onAfterRoute()
 {
     if (strpos(JPATH_BASE, '/administrator')) {
         // Don't act when on backend
         return true;
     }
     $vars = $this->getVars();
     // Make sure we need to make a call at all
     if (!($vars['j_reg'] || $vars['k2_regsv'] || $vars['ccb'] || $vars['joms'] || $vars['alpha'] || $vars['aec'])) {
         return true;
     }
     $vars = $this->getAdditionalVars($vars);
     if (($vars['isreg'] || $vars['cb_sregsv'] || $vars['k2_regsv'] || $vars['alpha_regsv']) && $vars['int_reg']) {
         // Joomla or CB registration...
         if ($vars['pfirst'] && !$vars['has_usage']) {
             // Plans first and not yet selected -> select!
             $this->deleteToken();
             $app = JFactory::getApplication();
             $app->redirect(AECToolbox::deadsureURL('index.php?option=com_acctexp&task=subscribe', false, true));
         } elseif (!$vars['pfirst'] && $vars['joms_regs'] && !$vars['has_user'] && !$vars['has_usage']) {
             $this->redirectToken();
         } elseif ($vars['has_user'] && $vars['joms_regs']) {
             $this->redirectToken();
         } elseif ($vars['has_user'] && ($vars['alpha_regsv'] || $vars['joms_regsv'] || $vars['cb_sregsv'] || $vars['k2_regsv'])) {
             if ($vars['joms_regsv']) {
                 $name = aecGetParam('jsname', "", true, array('string', 'clear_nonalnum'));
                 $username = aecGetParam('jsusername', "", true, array('string', 'clear_nonalnumwhitespace'));
                 $password = aecGetParam('jspassword', "", true, array('string'));
                 $password2 = aecGetParam('jspassword2', "", true, array('string'));
                 $email = aecGetParam('jsemail', "", true, array('string', 'clear_nonemail'));
             } else {
                 $name = aecGetParam('name', "", true, array('string', 'clear_nonalnum'));
                 $username = aecGetParam('username', "", true, array('string', 'clear_nonalnumwhitespace'));
                 $password = aecGetParam('password', "", true, array('string'));
                 $password2 = aecGetParam('password2', "", true, array('string'));
                 if (empty($password2)) {
                     $password2 = aecGetParam('password__verify', "", true, array('string'));
                 }
                 $email = aecGetParam('email', "", true, array('string', 'clear_nonemail'));
                 if (empty($username)) {
                     $name = aecEscape($_REQUEST['jform']['name'], array('string', 'clear_nonalnum'));
                     $username = aecEscape($_REQUEST['jform']['username'], array('string', 'clear_nonalnum'));
                     $password = aecEscape($_REQUEST['jform']['password1'], array('string', 'clear_nonalnum'));
                     $password2 = aecEscape($_REQUEST['jform']['password2'], array('string', 'clear_nonalnum'));
                     if (empty($password2)) {
                         $password2 = aecEscape($_REQUEST['jform']['password__verify'], array('string', 'clear_nonalnum'));
                     }
                     $email = aecEscape($_REQUEST['jform']['email1'], array('string', 'clear_nonalnum'));
                 }
             }
             if (!empty($username) && !empty($password) && !empty($email)) {
                 $temptoken = new aecTempToken();
                 $temptoken->getComposite();
                 $skip = array('coupon_code', 'task', 'option');
                 foreach ($_POST as $k => $v) {
                     if (!in_array($k, $skip)) {
                         $temptoken->content[$k] = aecGetParam($k, "", true, array('string'));
                     }
                 }
                 $temptoken->content['name'] = $name;
                 $temptoken->content['username'] = $username;
                 $temptoken->content['password'] = $password;
                 $temptoken->content['password2'] = $password2;
                 $temptoken->content['email'] = $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();
                 if ($vars['cb_sregsv'] || $vars['k2_regsv']) {
                     $this->redirectToken();
                 }
             }
             if ($vars['alpha_regsv']) {
                 $this->redirectToken();
             }
         } elseif ($vars['has_usage']) {
             $existing = $this->saveToToken($vars);
             if ($vars['joms_reg'] && !$existing) {
                 // I have... seen things you people wouldn't believe
                 // Logic on fire on the shore of JomSocial
                 $uri = JFactory::getURI();
                 $app = JFactory::getApplication();
                 $app->redirect($uri->toString());
             }
         }
     } elseif ($vars['has_usage'] && !$vars['checkout']) {
         $this->saveToToken($vars);
     } elseif ($vars['cbsreg']) {
         // Any kind of user profile edit = trigger MIs
         $row = new stdClass();
         $row->username = $vars['username'];
         $mih = new microIntegrationHandler();
         $mih->userchange($row, $_POST, 'registration');
     }
 }
 public function beat()
 {
     $this->processors = array();
     $this->proc_prepare = array();
     $this->result = array('fail_expired' => 0, 'fallback' => 0, 'skipped' => 0, 'expired' => 0, 'pre_expired' => 0, 'pre_exp_actions' => 0);
     // Some cleanup
     $this->deleteTempTokens();
     // Receive maximum pre expiration time
     $pre_expiration = microIntegrationHandler::getMaxPreExpirationTime();
     $subscription_list = $this->getSubscribers($pre_expiration);
     // Efficient way to check for expired users without checking on each one
     if (empty($subscription_list)) {
         return $this->endBeat();
     }
     foreach ($subscription_list as $sid => $sub_id) {
         $subscription = new Subscription();
         $subscription->load($sub_id);
         if (!aecUserHelper::UserExists($subscription->userid)) {
             unset($subscription_list[$sid]);
             continue;
         }
         // Check whether this user really is expired
         // If this check fails, the following subscriptions might still be pre-expiration events
         if ($subscription->isExpired()) {
             // If we don't have any validation response, expire
             $validate = $this->processorValidation($subscription, $subscription_list);
             if ($validate === false) {
                 // There was some kind of fatal error, return.
                 return false;
             } elseif ($validate !== true) {
                 $expire = $subscription->expire();
                 if ($expire) {
                     $this->result['expired']++;
                 } elseif ($expire === false) {
                     $this->result['fail_expired']++;
                 } elseif (is_null($expire)) {
                     $this->result['fallback']++;
                 } else {
                     $this->result['skipped']++;
                 }
             }
             unset($subscription_list[$sid]);
         } elseif (!$subscription->recurring) {
             break;
         }
     }
     // Only go for pre expiration action if we have at least one user for it
     if (empty($pre_expiration) || empty($subscription_list)) {
         return $this->endBeat();
     }
     // Get all the MIs which have a pre expiration check
     $mi_pexp = microIntegrationHandler::getPreExpIntegrations();
     // Find plans which have the MIs assigned
     $expmi_plans = microIntegrationHandler::getPlansbyMI($mi_pexp);
     // Filter out the users which dont have the correct plan
     $query = 'SELECT `id`, `userid`' . ' FROM #__acctexp_subscr' . ' WHERE `id` IN (' . implode(',', $subscription_list) . ')' . ' AND `plan` IN (' . implode(',', $expmi_plans) . ')';
     $this->_db->setQuery($query);
     $sub_list = $this->_db->loadObjectList();
     if (!empty($sub_list)) {
         foreach ($sub_list as $sl) {
             $metaUser = new metaUser($sl->userid);
             $metaUser->moveFocus($sl->id);
             $res = $metaUser->focusSubscription->triggerPreExpiration($metaUser, $mi_pexp);
             if ($res) {
                 $this->result['pre_exp_actions'] += $res;
                 $this->result['pre_expired']++;
             }
         }
     }
     return $this->endBeat();
 }
 public function overloadByPlan($plan)
 {
     // Get list of service MIs
     $mis = microIntegrationHandler::getMIsbyPlan($plan);
     if (empty($mis)) {
         return;
     }
     foreach ($mis as $miid) {
         $mi = new microIntegration();
         $mi->load($miid);
         if (!$mi->callIntegration()) {
             continue;
         }
         if (method_exists($mi->mi_class, 'overrideService')) {
             $mi->mi_class->overrideService($this);
         }
     }
 }
Exemple #13
0
 /**
  * @param string $method
  */
 public function aecReadout($optionlist, $method)
 {
     $this->optionlist = $optionlist;
     $this->method = "conversionHelper" . strtoupper($method);
     $this->lists = array();
     $this->acllist = xJACLhandler::aclList();
     foreach ($this->acllist as $aclitem) {
         $this->lists['gid'][$aclitem->group_id] = $aclitem->name;
     }
     $this->planlist = SubscriptionPlanHandler::getFullPlanList();
     foreach ($this->planlist as $planitem) {
         $this->lists['plan'][$planitem->id] = $planitem->name;
     }
     $this->milist = microIntegrationHandler::getMIList(null, null, isset($_POST['use_ordering']), true);
     foreach ($this->milist as $miitem) {
         $this->lists['mi'][$miitem->id] = $miitem->name;
     }
 }