Esempio n. 1
0
 function sendSavedReports(Am_Event $event)
 {
     class_exists('Am_Report', true);
     require_once 'Am/Report/Standard.php';
     foreach ($this->getDi()->adminTable->findBy() as $admin) {
         $frequency = $admin->getPref(Admin::PREF_REPORTS_SEND_FREQUENCY);
         if ($frequency == $event->getId()) {
             $content = '';
             foreach ($this->findByAdminId($admin->pk()) as $report) {
                 $r = Am_Report_Abstract::createById($report->report_id);
                 $r->applyConfigForm(new Am_Request(unserialize($report->request)));
                 $result = $r->getReport();
                 $output = new Am_Report_Text($result);
                 $content .= $report->title . "\n----------------------------\n";
                 $content .= $output->render() . "\n";
             }
             if ($content) {
                 $mail = $this->getDi()->mail;
                 $mail->addTo($admin->email);
                 $mail->setSubject($this->getDi()->config->get('site_title') . ': Reports');
                 $mail->setBodyText($content);
                 $mail->send();
             }
         }
     }
 }
Esempio n. 2
0
 /**
  * 
  * Set Invoice ID wich will be displayed in pdf invoice
  */
 protected function setDisplayInvoiceId()
 {
     $e = new Am_Event(Am_Event::SET_DISPLAY_INVOICE_REFUND_ID, array('record' => $this));
     $e->setReturn($this->getInvoice()->public_id . '/' . $this->receipt_id);
     $this->getDi()->hook->call($e);
     $this->display_invoice_id = $e->getReturn();
     $this->updateSelectedFields('display_invoice_id');
 }
Esempio n. 3
0
 public function onPdfInvoiceColLeft(Am_Event $e)
 {
     $invoice = $e->getInvoice();
     if ($invoice->paysys_id == $this->getId()) {
         $c = $e->getCol();
         $c->ddr = ___('Direct Debit Reference: %s', self::REF_PREFIX . $invoice->public_id);
     }
 }
Esempio n. 4
0
 function onSignupUserAdded(Am_Event $event)
 {
     $user = $event->getUser();
     // validate if user is logged-in to Facebook
     $api = $this->getApi();
     if ($api->getSignedRequest() && ($fbuid = $api->getUser())) {
         $user->data()->set(self::FACEBOOK_UID, $fbuid)->update();
     }
 }
Esempio n. 5
0
 function indexAction()
 {
     $this->form = new Am_Form_Profile();
     $this->form->addCsrf();
     if ($c = $this->getFiltered('c')) {
         $record = $this->getDi()->savedFormTable->findFirstBy(array('code' => $c, 'type' => SavedForm::T_PROFILE));
     } else {
         $record = $this->getDi()->savedFormTable->getDefault(SavedForm::D_PROFILE);
     }
     $event = new Am_Event(Am_Event::LOAD_PROFILE_FORM, array('request' => $this->_request, 'user' => $this->getDi()->auth->getUser()));
     $event->setReturn($record);
     $this->getDi()->hook->call($event);
     $record = $event->getReturn();
     if (!$record) {
         throw new Am_Exception_Configuration("No profile form configured");
     }
     if ($record->meta_title) {
         $this->view->meta_title = $record->meta_title;
     }
     if ($record->meta_keywords) {
         $this->view->headMeta()->setName('keywords', $record->meta_keywords);
     }
     if ($record->meta_description) {
         $this->view->headMeta()->setName('description', $record->meta_description);
     }
     $this->form->initFromSavedForm($record);
     $this->form->setUser($this->user);
     $u = $this->user->toArray();
     unset($u['pass']);
     $dataSources = array(new HTML_QuickForm2_DataSource_Array($u));
     if ($this->form->isSubmitted()) {
         array_unshift($dataSources, $this->_request);
     }
     $this->form->setDataSources($dataSources);
     if ($this->form->isSubmitted() && $this->form->validate()) {
         $oldUser = clone $this->user;
         $oldUser->toggleFrozen(true);
         $vars = $this->form->getValue();
         unset($vars['user_id']);
         if (!empty($vars['pass'])) {
             $this->user->setPass($vars['pass']);
         }
         unset($vars['pass']);
         $ve = $this->handleEmail($record, $vars) ? 1 : 0;
         $u = $this->user->setForUpdate($vars);
         $this->emailChangesToAdmin();
         $u->update();
         $this->getDi()->hook->call(Am_Event::PROFILE_USER_UPDATED, array('vars' => $vars, 'oldUser' => $oldUser, 'user' => $u, 'form' => $this->form));
         $this->getDi()->auth->setUser($u, '');
         $msg = $ve ? ___('Verification email has been sent to your address.
                 E-mail will be changed in your account after confirmation') : ___('Your profile has been updated successfully');
         return $this->redirectLocation($this->getFullUrl() . '?a=saved&_msg=' . urlencode($msg));
     }
     $this->view->title = $record->title;
     $this->view->form = $this->form;
     $this->view->display('member/profile.phtml');
 }
Esempio n. 6
0
 function onGridProductValuesToForm(Am_Event $event)
 {
     $args = $event->getArgs();
     $values = $args[0];
     $product = $event->getGrid()->getRecord();
     if ($sliiing_billers = json_decode($product->data()->getBlob('sliiing_billers'), true)) {
         $values['_sliiing_billers'] = $sliiing_billers;
         $event->setArg(0, $values);
     }
 }
Esempio n. 7
0
function redirectThankyou(Am_Event $event)
{
    // get list of product objects
    $product_list = $event->getInvoice()->getProducts();
    foreach ($product_list as $product) {
        // find a product, may only be one, that has redirect configured
        if (trim($product->data()->get('thankyou_redirect'))) {
            header('location: ' . $product->data()->get('thankyou_redirect'));
            exit;
        }
    }
}
Esempio n. 8
0
 function onGetMemberLinks(Am_Event $event)
 {
     $user = $event->getUser();
     if ($user->status == User::STATUS_PENDING) {
         return;
     }
     // @todo fixme make it without loading of all of plugins
     foreach ($this->getPlugins() as $pl) {
         if ($pl->storesCcInfo() && $this->getDi()->ccRecordTable->findFirstByUserId($user->user_id)) {
             $event->addReturn(___("Update Credit Card Info"), ROOT_SURL . "/payment/" . $pl->getId() . "/update");
         }
     }
 }
Esempio n. 9
0
 static function getAvailableOptions()
 {
     $ret = array();
     foreach (get_declared_classes() as $className) {
         if (strpos($className, __CLASS__ . '_') === 0) {
             $o = new $className();
             $ret[$o->getId()] = $o->getTitle();
         }
     }
     $event = new Am_Event(Bootstrap_Aff::AFF_GET_PAYOUT_OPTIONS);
     $event->setReturn($ret);
     Am_Di::getInstance()->hook->call($event);
     return $event->getReturn();
 }
Esempio n. 10
0
 function loadForm()
 {
     if ($c = $this->getFiltered('c')) {
         if ($c == 'cart') {
             if ($this->_request->getParam('amember_redirect_url')) {
                 $this->getSession()->redirectUrl = $this->_request->getParam('amember_redirect_url');
             }
             if ($this->getDi()->auth->getUser() != null) {
                 $url = $this->getSession()->redirectUrl;
                 $this->getSession()->redirectUrl = '';
                 $this->_redirect('cart/' . urldecode($url));
             } else {
                 $this->record = $this->getDi()->savedFormTable->getByType(SavedForm::T_CART);
             }
         } else {
             $this->record = $this->getDi()->savedFormTable->findFirstBy(array('code' => $c, 'type' => SavedForm::T_SIGNUP));
         }
     } else {
         $this->record = $this->getDi()->savedFormTable->getDefault($this->getDi()->auth->getUserId() ? SavedForm::D_MEMBER : SavedForm::D_SIGNUP);
     }
     // call a hook to allow load another form
     $event = new Am_Event(Am_Event::LOAD_SIGNUP_FORM, array('request' => $this->_request, 'user' => $this->getDi()->auth->getUser()));
     $event->setReturn($this->record);
     $this->getDi()->hook->call($event);
     $this->record = $event->getReturn();
     if (!$this->record) {
         $this->getDi()->errorLogTable->log("Wrong signup form code - the form does not exists. Redirect Customer to default form. Referrer: " . $this->getRequest()->getHeader('REFERER'));
         $this->redirect('/signup', array('code' => 302));
     }
     /* @var $this->record SavedForm */
     if (!$this->record->isSignup()) {
         throw new Am_Exception_InputError("Wrong signup form loaded [{$this->record}->saved_form_id] - it is not a signup form!");
     }
     if ($this->record->meta_title) {
         $this->view->meta_title = $this->record->meta_title;
     }
     if ($this->record->meta_keywords) {
         $this->view->headMeta()->setName('keywords', $this->record->meta_keywords);
     }
     if ($this->record->meta_description) {
         $this->view->headMeta()->setName('description', $this->record->meta_description);
     }
     $this->view->code = $this->record->code;
 }
Esempio n. 11
0
 function onInvoiceBeforePayment(Am_Event $event)
 {
     /* @var $invoice Invoice */
     $invoice = $event->getInvoice();
     $user = $invoice->getUser();
     foreach ($invoice->getItems() as $item) {
         if ($item->item_type != 'product') {
             continue;
         }
         $product = $this->getDi()->productTable->load($item->item_id);
         if (($limit = $product->data()->get('subscription_limit')) && $limit < $item->qty) {
             throw new Am_Exception_InputError(sprintf('There is not such amount (%d) of product %s', $item->qty, $item->item_title));
         }
         $count = $this->getDI()->db->selectCell("\n                SELECT SUM(ii.qty) \n                FROM ?_invoice_item ii LEFT JOIN ?_invoice i ON ii.invoice_id = i.invoice_id \n                WHERE i.user_id = ? and ii.item_id=? and i.status<>0\n                ", $user->pk(), $product->pk());
         if (($limit = $product->data()->get('subscription_user_limit')) && $limit < $item->qty + $count) {
             throw new Am_Exception_InputError(sprintf('There is not such amount (%d) of product %s you can purchase only %s items.', $item->qty, $item->item_title, $limit));
         }
     }
 }
Esempio n. 12
0
 /**
  * Return array - key => value of available options for template with given $id
  * @param type $id
  * @return array
  */
 public function getTagsOptions($id)
 {
     $record = @$this[$id];
     $ret = array('%site_title%' => 'Site Title', '%root_url%' => 'aMember Root URL', '%admin_email%' => 'Admin E-Mail Address');
     if (!$record || empty($record['vars'])) {
         return $ret;
     }
     foreach ($record['vars'] as $k => $v) {
         if (is_int($k)) {
             // tag set
             $ret = array_merge($ret, $this->tagSets[$v]);
         } else {
             // single variable
             $ret['%' . $k . '%'] = $v;
         }
     }
     $event = new Am_Event(Am_Event::EMAIL_TEMPLATE_TAG_OPTIONS, array('templateName' => $id));
     $event->setReturn($ret);
     Am_Di::getInstance()->hook->call($event);
     $ret = $event->getReturn();
     return $ret;
 }
Esempio n. 13
0
 function onBuildDemo(Am_Event $event)
 {
     $subjects = array('Please help', 'Urgent question', 'I have a problem', 'Important question', 'Pre-sale inquiry');
     $questions = array("My website is now working. Can you help?", "I have a problem with website script.\nWhere can I find documentation?", "I am unable to place an order, my credit card is not accepted.");
     $answers = array("Please call us to phone# 1-800-222-3334", "We are looking to your problem, and it will be resolved within 4 hours");
     $user = $event->getUser();
     /* @var $user User */
     while (rand(0, 10) < 4) {
         $ticket = $this->getDi()->helpdeskTicketRecord;
         $ticket->status = HelpdeskTicket::STATUS_AWAITING_ADMIN_RESPONSE;
         $ticket->subject = $subjects[rand(0, count($subjects) - 1)];
         $ticket->user_id = $user->pk();
         $ticket->created = sqlTime('now');
         $ticket->insert();
         //
         $msg = $this->getDi()->helpdeskMessageRecord;
         $msg->content = $questions[rand(0, count($questions) - 1)];
         $msg->type = 'message';
         $msg->ticket_id = $ticket->pk();
         $msg->dattm = $tm = sqlTime(time() - rand(3600, 3600 * 24 * 180));
         $msg->insert();
         //
         if (rand(0, 10) < 6) {
             $msg = $this->getDi()->helpdeskMessageRecord;
             $msg->content = $answers[rand(0, count($answers) - 1)];
             $msg->type = 'message';
             $msg->ticket_id = $ticket->pk();
             $msg->dattm = sqlTime(strtotime($tm) + rand(180, 3600 * 24));
             $msg->admin_id = $this->getDi()->adminTable->findFirstBy()->pk();
             $msg->insert();
             if (rand(0, 10) < 6) {
                 $ticket->status = HelpdeskTicket::STATUS_AWAITING_USER_RESPONSE;
             } else {
                 $ticket->status = HelpdeskTicket::STATUS_CLOSED;
             }
             $ticket->update();
         }
     }
 }
Esempio n. 14
0
 function onThanksPage(Am_Event $event)
 {
     if (!$event->getInvoice()) {
         return;
     }
     $url = null;
     foreach ($event->getInvoice()->getProducts() as $pr) {
         if ($url = $pr->data()->get('thanks_redirect_url')) {
             break;
         }
     }
     $t = new Am_SimpleTemplate();
     $t->assign('invoice', $event->getInvoice());
     $t->assign('user', $event->getInvoice()->getUser());
     $url = $t->render($url);
     if ($url) {
         $event->getController()->redirectLocation($url);
     }
 }
Esempio n. 15
0
 public function deleted(Am_Event $event)
 {
     $st = $event->getUser()->status;
     // change it to trick update function
     $event->getUser()->status = User::STATUS_EXPIRED;
     $this->updated($event);
     // change it back
     $event->getUser()->status = $st;
 }
Esempio n. 16
0
 function onBeforeRender(Am_Event $e)
 {
     $view = $e->getView();
     $tmpl = $e->getTemplateName();
     if (!defined('AM_ADMIN') && !$view->jsClickCodeAdded) {
         $view->jsClickCodeAdded = true;
         $view->placeholder('body-finish')->prepend($this->getClickJs());
     }
 }
Esempio n. 17
0
 function onGetPermissionsList(Am_Event $event)
 {
     $event->addReturn(___('Can Operate with OTO'), self::ADMIN_PERM_ID);
 }
Esempio n. 18
0
 public function getOkUrl()
 {
     $event = new Am_Event(Am_Event::AUTH_GET_OK_REDIRECT, array('user' => $this->getDi()->user));
     $event->setReturn($this->getConfiguredRedirect());
     $this->getDi()->hook->call($event);
     return get_first($this->redirect_url, $event->getReturn());
 }
Esempio n. 19
0
 public function triggerEvent(Am_Event $e)
 {
     $oldUser = $e->getOldUser();
     $user = $e->getUser();
     if ($oldUser->unsubscribed != $user->unsubscribed) {
         Am_Di::getInstance()->hook->call(Am_Event::USER_UNSUBSCRIBED_CHANGED, array('user' => $user, 'unsubscribed' => $user->unsubscribed));
     }
 }
Esempio n. 20
0
 /**
  * Process invoice and insert necessary commissions for it
  *
  * External code should guarantee that this method with $payment = null will be called
  * only once for each user for First user invoice
  */
 public function processPayment(Invoice $invoice, InvoicePayment $payment = null)
 {
     $aff_id = $invoice->aff_id;
     /* @var $coupon Coupon */
     try {
         if (!$aff_id && ($coupon = $invoice->getCoupon())) {
             // try to find affiliate by coupon
             $aff_id = $coupon->aff_id ? $coupon->aff_id : $coupon->getBatch()->aff_id;
         }
     } catch (Am_Exception_Db_NotFound $e) {
         //coupon not found
     }
     if (empty($aff_id)) {
         $aff_id = $invoice->getUser()->aff_id;
     }
     if ($aff_id && empty($invoice->aff_id)) {
         // set aff_id to invoice for quick access next time
         $invoice->updateQuick('aff_id', $aff_id);
     }
     // run event to get plugins chance choose another affiliate
     $event = new Am_Event(Bootstrap_Aff::AFF_FIND_AFFILIATE, array('invoice' => $invoice, 'payment' => $payment));
     $event->setReturn($aff_id);
     $this->getDi()->hook->call($event);
     $aff_id = $event->getReturn();
     if (empty($aff_id)) {
         return;
     }
     // no affiliate id registered
     if ($aff_id == $invoice->getUser()->pk()) {
         return;
     }
     //strange situation
     // load affiliate and continue
     $aff = $this->getDi()->userTable->load($aff_id, false);
     if (!$aff || !$aff->is_affiliate) {
         return;
     }
     // affiliate not found
     $user = $invoice->getUser();
     if (!$user->aff_id) {
         $user->aff_id = $aff->pk();
         $user->aff_added = sqlTime('now');
         $user->data()->set('aff-source', 'invoice-' . $invoice->pk());
         $user->save();
     }
     // try to load other tier affiliate
     $aff_tier = $aff;
     $aff_tiers = array();
     $aff_tiers_exists = array($aff->pk());
     for ($tier = 1; $tier <= $this->getMaxTier(); $tier++) {
         if (!$aff_tier->aff_id || $aff_tier->pk() == $invoice->getUser()->pk()) {
             break;
         }
         $aff_tier = $this->getDi()->userTable->load($aff_tier->aff_id, false);
         if (!$aff_tier || !$aff_tier->is_affiliate || $aff_tier->pk() == $invoice->getUser()->pk() || in_array($aff_tier->pk(), $aff_tiers_exists)) {
             //already in chain
             break;
         }
         $aff_tiers[$tier] = $aff_tier;
         $aff_tiers_exists[] = $aff_tier->pk();
     }
     $isFirst = !$payment || $payment->isFirst();
     //to define price field
     $paymentNumber = is_null($payment) ? 0 : $invoice->getPaymentsCount();
     if (!$payment) {
         $tax = 0;
     } else {
         $tax = $this->getDi()->config->get('aff.commission_include_tax', false) ? 0 : doubleval($payment->tax);
     }
     $amount = $payment ? $payment->amount - $tax : 0;
     $date = $payment ? $payment->dattm : 'now';
     // now calculate commissions
     $items = is_null($payment) ? array_slice($invoice->getItems(), 0, 1) : $invoice->getItems();
     foreach ($items as $item) {
         //we do not calculate commission for free items in invoice
         $prefix = $isFirst ? 'first' : 'second';
         if (!is_null($payment) && !(double) $item->get("{$prefix}_total")) {
             continue;
         }
         $comm = $this->getDi()->affCommissionRecord;
         $comm->date = sqlDate($date);
         $comm->record_type = AffCommission::COMMISSION;
         $comm->invoice_id = $invoice->invoice_id;
         $comm->invoice_item_id = $item->invoice_item_id;
         $comm->invoice_payment_id = $payment ? $payment->pk() : null;
         $comm->receipt_id = $payment ? $payment->receipt_id : null;
         $comm->product_id = $item->item_id;
         $comm->is_first = $paymentNumber <= 1;
         $comm->_setPayment($payment);
         $comm->_setInvoice($invoice);
         $comm_tier = clone $comm;
         $rules = array();
         $topay_this = $topay = $this->calculate($invoice, $item, $aff, $paymentNumber, 0, $amount, $date, $rules);
         if ($topay > 0) {
             $comm->aff_id = $aff->pk();
             $comm->amount = $topay;
             $comm->tier = 0;
             $comm->_setAff($aff);
             $comm->insert();
             $comm->setCommissionRules(array_map(create_function('$el', 'return $el->pk();'), $rules));
         }
         foreach ($aff_tiers as $tier => $aff_tier) {
             $rules = array();
             $topay_this = $this->calculate($invoice, $item, $aff_tier, $paymentNumber, $tier, $topay_this, $date, $rules);
             if ($topay_this > 0) {
                 $comm_this = clone $comm_tier;
                 $comm_this->aff_id = $aff_tier->pk();
                 $comm_this->amount = $topay_this;
                 $comm_this->tier = $tier;
                 $comm_this->_setAff($aff_tier);
                 $comm_this->insert();
                 $comm_this->setCommissionRules(array_map(create_function('$el', 'return $el->pk();'), $rules));
             }
         }
     }
 }
Esempio n. 21
0
 /**
  * call registered hooks
  *
  * This function can be called like:
  *  $m->call(new Am_Event_SubscriptionAdded())
  *  $m->call(new Event('myEventId', array('user' => $user)));
  *  or the same 
  *  $m->call('myEventId', array('user' => $user));
  *  or if no parameters necessary
  *  $m->call('myEventId');
  * 
  * @param string|Am_Event $hookOrEvent
  * @param Am_Event|arraynull $event
  * @return Am_Event
  */
 function call($hook, $event = null)
 {
     if ($event === null) {
         if (is_string($hook)) {
             $event = new Am_Event($hook);
         } elseif ($hook instanceof Am_Event) {
             $event = $hook;
             $hook = $event->getId();
         } else {
             throw new Am_Exception_InternalError("Unknown argument for " . __METHOD__);
         }
     } elseif (is_array($event)) {
         $event = new Am_Event($hook, $event);
     }
     $event->_setDi($this->di);
     foreach ($this->observers as $o) {
         // notify observers
         call_user_func($o, $event, $hook, $this);
     }
     if (!$this->disableAll && !array_key_exists($hook, $this->disabled) && array_key_exists($hook, $this->hooks) && count($this->hooks[$hook])) {
         $event->handle($this->hooks[$hook]);
     }
     return $event;
 }
Esempio n. 22
0
 function onGetPermissionsList(Am_Event $event)
 {
     $event->addReturn(___("Manage Newsletters"), "newsletter");
 }
Esempio n. 23
0
 public function __construct($action = null, array &$args, Am_Grid_ReadOnly $grid)
 {
     parent::__construct();
     $this->action = $action;
     $this->grid = $grid;
     $this->args = $args;
 }
Esempio n. 24
0
 public function onInvoiceAfterInsert(Am_Event $event)
 {
     $invoice = $event->getInvoice();
     if ($invoice->data()->get('added-by-admin')) {
         return;
     }
     // do not send automatic e-mails if invoice added by admin
     $this->_sendZeroPendingNotifications('pending_to_user', array($this, 'sendPendingNotificationToUser'), $invoice);
     $this->_sendZeroPendingNotifications('pending_to_admin', array($this, 'sendPendingNotificationToAdmin'), $invoice);
 }
Esempio n. 25
0
 /** @return array of Am_Form_Brick */
 function getBricks()
 {
     $ret = array();
     foreach ($this->getFields() as $brickConfig) {
         if (strpos($brickConfig['id'], 'PageSeparator') === 0) {
             continue;
         }
         $b = Am_Form_Brick::createFromRecord($brickConfig);
         if (!$b) {
             continue;
         }
         $ret[] = $b;
     }
     $event = new Am_Event(Am_Event::SAVED_FORM_GET_BRICKS, array('type' => $this->type, 'code' => $this->code, 'savedForm' => $this));
     $event->setReturn($ret);
     $this->getDi()->hook->call($event);
     $ret = $event->getReturn();
     foreach ($ret as $brick) {
         $brick->init();
     }
     return $ret;
 }
Esempio n. 26
0
 /**  run additional checks on authenticated user */
 public function checkUser($user, $ip)
 {
     /* @var $user User */
     if (!$user->isLocked()) {
         // now log access and check for account sharing
         $accessLog = $this->getDi()->accessLogTable;
         $accessLog->logOnce($user->user_id, $ip);
         if ($user->is_locked >= 0 && $accessLog->isIpCountExceeded($user->user_id, $ip)) {
             $this->onIpCountExceeded($user);
             $this->setUser(null, $ip);
             return new Am_Auth_Result(Am_Auth_Result::LOCKED);
         }
     } else {
         // if locked
         $this->setUser(null, $ip);
         return new Am_Auth_Result(Am_Auth_Result::LOCKED);
     }
     if (!$user->isApproved()) {
         return new Am_Auth_Result(Am_Auth_Result::NOT_APPROVED);
     }
     $event = new Am_Event(Am_Event::AUTH_CHECK_USER, array('user' => $user));
     $event->setReturn(null);
     $this->getDi()->hook->call($event);
     return $event->getReturn();
 }
Esempio n. 27
0
 function getStrongPasswordRegex()
 {
     $regexp = '/^(?=.*[0-9].*[0-9])(?=.*[-!@#$%^&*().,=+`~].*[-!@#$%^&*().,=+`~])(?=.*[A-Z].*[A-Z])/';
     $event = new Am_Event(Am_Event::GET_STRONG_PASSWORD_REGEX);
     $event->setReturn($regexp);
     $this->getDi()->hook->call($event);
     return $event->getReturn();
 }
Esempio n. 28
0
 public function onAdminWarnings(Am_Event $event)
 {
     if (!$this->isConfigured()) {
         $setupUrl = REL_ROOT_URL . '/admin-setup/' . $this->getId();
         $event->addReturn(___("Plugin [%s] is not configured yet. Please %scomplete configuration%s", $this->getId(), '<a href="' . $setupUrl . '">', '</a>'));
     }
 }
Esempio n. 29
0
 public function handlePayment(Am_Event $e)
 {
     if ($this->getConfig('unsubscribe_after_signup') != self::UNSUBSCRIBE_AFTER_PAID) {
         return;
     }
     $user = $e->getUser();
     if ($user->data()->get('unsubscribe_after_signup')) {
         return;
     }
     $user->data()->set('unsubscribe_after_signup', self::UNSUBSCRIBE_AFTER_PAID)->update();
     if (!($lists = $this->getConfig('unsubscribe_after_signup_lists'))) {
         return;
     }
     try {
         $this->changeSubscription($e->getUser(), array(), $lists);
     } catch (Exception $e) {
         //just log
         $this->getDi()->errorLogTable->logException($e);
     }
 }
Esempio n. 30
0
 /**
  * @return array of instantiated Am_Billing_Calc_* objects
  */
 function getCalculators()
 {
     $ret = array(new Am_Billing_Calc_Zero(), new Am_Billing_Calc_Coupon(), new Am_Billing_Calc_Tax(), new Am_Billing_Calc_Shipping(), new Am_Billing_Calc_Total());
     $event = new Am_Event(Am_Event::INVOICE_GET_CALCULATORS);
     $event->setReturn($ret);
     $this->getDi()->hook->call($event);
     return $event->getReturn();
 }