/** * Constructor */ public function __construct() { // this 'if' above is added for compatibility during update over CBSubs 1.0.x cbpaidApp::getBaseClass($this); parent::__construct(); cbpaidApp::loadLang(); }
/** * Saves record payment view * * @param int $paymentBasketId * @return null|string */ public static function saveRecordPayment($paymentBasketId) { cbpaidApp::loadLang('admin'); $paymentRecorder = new self(); $exists = $paymentBasketId && $paymentRecorder->load((int) $paymentBasketId); if ($exists) { if ($paymentRecorder->authoriseAction('cbsubs.recordpayments')) { $return = $paymentRecorder->saveRecordPaymentForm(); } else { $return = CBPTXT::T("You are not authorized to record payments."); } } else { $return = CBPTXT::T("No unpaid payment basket found."); } return $return; }
/** * Constructor */ public function __construct( ) { if ( is_callable( array( 'cbpaidApp', 'getBaseClass' ) ) ) { // this 'if' above is added for compatibility during update over CBSubs 1.0.x cbpaidApp::getBaseClass( $this ); parent::__construct(); cbpaidApp::loadLang(); } else { // old method for CBSubs 1.0.3 classes during upgrade: parent::__construct(); /** @noinspection PhpUndefinedCallbackInspection */ call_user_func_array( array( $this, '_loadLang' ), array() ); // phplint-safe: $this->_loadLang(); } }
/** * Event handler as soon as system started * * @return void */ public function onAlittleMoreAfterStart( ) { global $_CB_framework, $_GET, $_POST; if ( $this->paidsubsManager === null ) { return; } // already done in SysPlug: $this->_checkExpireMe(); $userId = $_CB_framework->myId(); $getPostArray = new cbpaidBotInput( $_GET, $_POST, $_REQUEST, JFactory::getApplication()->input ); // redirection trick for joomla "Register to read more link": if ( ( ( $this->option == 'com_user' ) && ( ( $this->task == 'register' ) || ( $this->view == 'login' ) ) ) // 1.5 || ( ( $this->option == 'com_registration' ) && ( $this->task == 'register' ) ) ) // mambo & 1.0 { cbRedirect( cbSef( 'index.php?option=com_comprofiler&task=registers', false ) ); } $message = null; $allowAccess = $this->checkAccess( $userId, $this->option, 'cpaycontent_components' ); if ( $allowAccess === false ) { $message = "Access to this component not allowed without %s"; $redirectVars = array( 'accesstype' => 'components', 'accessvalue' => $this->option ); } elseif ( isset( $getPostArray['Itemid'] ) ) { if ( ( $this->option == 'com_comprofiler' ) && ( in_array( strtolower( $this->task ), array( 'fieldclass', 'tabclass', 'lostpassword', 'sendnewpass', 'registers', 'saveregisters', 'login', 'logout', 'confirm', 'teamcredits', 'done', 'performcheckusername', 'performcheckemail' ) ) || ( ( $this->task == 'pluginclass' ) && ( $this->taskPlugin == 'cbpaidsubscriptions' ) ) ) ) { // legit CB or CBSubs access that should not be protected by menu ! } else { $allowAccess = $this->checkAccess( $userId, (int) $getPostArray['Itemid'], 'cpaycontent_menus' ); if ( $allowAccess === false ) { $message = "Access to this menu item not allowed without %s"; $redirectVars = array( 'accesstype' => 'menus', 'accessvalue' => (int) $getPostArray['Itemid'] ); } } } $postsMissingInGetToFindPlans = array(); if ( $allowAccess !== false ) { $allowAccess = $this->checkAccessUrl( $userId, $getPostArray, $_GET, $postsMissingInGetToFindPlans, 'cpaycontent_urls' ); if ( $allowAccess === false ) { $message = "Access to this location not allowed without %s"; $redirectVars = array( 'accesstype' => 'urls' ); // , 'accessvalue' => cbpaidsubsbot_encodeArrayUrl( $_GET ) ); } else { $redirectVars = array(); $allowAccess = $this->checkContentUrl( $userId, $getPostArray, 'cpaycontent_sections', 'cpaycontent_categories', 'cpaycontent_sections_list', 'cpaycontent_categories_list', $redirectVars ); if ( $allowAccess === false ) { $message = "Access to this content list not allowed without %s"; // done below $redirectVars['accessurl'] = cbpaidsubsbot_encodeArrayUrl( $_GET ); } } } // if ( ( $allowAccess === false ) && ( ! ( ( $this->option == 'com_comprofiler' ) && ( $this->task == 'pluginclass' ) && ( $this->taskPlugin == 'cbpaidsubscriptions' ) ) ) ) { if ( $allowAccess === false ) { $allowedComprofilerTasks = array( 'fieldclass', 'tabclass', 'lostpassword', 'sendnewpass', 'registers', 'saveregisters', 'login', 'logout', 'confirm', 'teamcredits', 'done', 'performcheckusername', 'performcheckemail' ); if ( ( $this->option != 'com_comprofiler' ) || ( ! in_array( strtolower( $this->task ), $allowedComprofilerTasks ) ) || ! ( ( $this->task == 'pluginclass' ) && ( $this->taskPlugin == 'cbpaidsubscriptions' ) ) ) { $params =& cbpaidApp::settingsParams(); // allow access to someone who is unrestricted: if ( ! $this->hasAccessAnyway( $userId ) ) { // not someone who is unrestricted: $redirectVars['accessurl'] = cbpaidsubsbot_encodeArrayUrl( array_merge( $_GET, $postsMissingInGetToFindPlans ) ); $redirectUrl = 'index.php?option=com_comprofiler&task=pluginclass&plugin=cbpaidsubscriptions&do=accessdenied' . getCBprofileItemid( false); // &Itemid= ??? if ( is_array( $redirectVars ) ) { foreach ( $redirectVars as $k => $v ) { $redirectUrl .= '&' . urlencode( $k ) . '=' . urlencode( $v ); } } // if ( strlen( $redirectUrl ) > 1000 ) { echo $redirectUrl . '<br />'; var_dump( $this );exit; } // translate message: cbpaidApp::loadLang(); $subscriptionText = CBPTXT::T( $params->get( 'subscription_name', 'subscription' ) ); $message = sprintf( CBPTXT::T( $message ), $subscriptionText ); $_CB_framework->redirect( cbSef( $redirectUrl, false ), $message, 'warning' ); } } } }