Subrion - open source content management system Copyright (C) 2016 Intelliants, LLC This file is part of Subrion. Subrion is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Subrion is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Subrion. If not, see .
Inheritance: extends abstractCore
Example #1
0
 public function __construct()
 {
     parent::__construct();
     $iaPlan = $this->_iaCore->factory('plan');
     $this->setHelper($iaPlan);
     $this->setTable(iaPlan::getTable());
     $this->_fields = $this->_getFieldsList();
     $this->_items = $this->_iaCore->factory('item')->getItems(true);
 }
Example #2
0
            } else {
                $iaView->setMessages($messages);
            }
        }
        if (isset($_POST['plan_id']) && $_POST['plan_id'] != iaUsers::getIdentity()->sponsored_plan_id) {
            if ($plan = $iaPlan->getById((int) $_POST['plan_id'])) {
                $url = $iaPlan->prePayment($itemName, iaUsers::getIdentity(true), $plan['id'], IA_SELF);
                iaUtil::redirect(iaLanguage::get('thanks'), iaLanguage::get('plan_added'), $url);
            } else {
                $iaPlan->setUnpaid(iaUsers::getItemName(), iaUsers::getIdentity()->id);
            }
        }
    }
    $iaCore->startHook('phpFrontAfterProfileProcessData');
    $item = iaUsers::getIdentity(true);
    // get fieldgroups
    list($tabs, $fieldgroups) = $iaField->generateTabs($iaField->filterByGroup($item, $itemName));
    // compose tabs
    $sections = array_merge(array('common' => $fieldgroups), $tabs);
    $extraTabs = array();
    $iaCore->startHook('phpFrontEditProfileExtraTabs', array('tabs' => &$extraTabs, 'item' => &$item));
    $sections = array_merge($sections, $extraTabs);
    if (iaUsers::MEMBERSHIP_ADMINISTRATOR != iaUsers::getIdentity()->usergroup_id) {
        $iaView->assign('assignableGroups', $assignableGroups);
    }
    $iaView->assign('sections', $sections);
    $iaView->assign('plans_count', (int) $iaDb->one(iaDb::STMT_COUNT_ROWS, null, iaPlan::getTable()));
    $iaView->assign('item', $item);
    $iaView->assign('plans', $plans);
    $iaDb->resetTable();
}
Example #3
0
 protected function _jsonAction()
 {
     $output = array('error' => false, 'message' => array());
     $transaction = array('member_id' => (int) $_POST['member'], 'plan_id' => (int) $_POST['plan'], 'email' => $_POST['email'], 'item_id' => (int) $_POST['itemid'], 'gateway' => (string) $_POST['gateway'], 'sec_key' => uniqid('t'), 'reference_id' => empty($_POST['reference_id']) ? date('mdyHis') : $_POST['reference_id'], 'amount' => (double) $_POST['amount'], 'currency' => $this->_iaCore->get('currency'), 'date' => $_POST['date'] . ' ' . $_POST['time']);
     if ($transaction['plan_id']) {
         $this->_iaCore->factory('plan');
         if ($plan = $this->_iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($transaction['plan_id']), iaPlan::getTable())) {
             $transaction['item'] = $plan['item'];
             $transaction['operation'] = iaLanguage::get('plan_title_' . $plan['id']);
         } else {
             $output['error'] = true;
             $output['message'][] = iaLanguage::get('error_plan_not_exists');
         }
     } else {
         $transaction['item'] = iaTransaction::TRANSACTION_MEMBER_BALANCE;
         $transaction['operation'] = iaLanguage::get('funds');
     }
     if (isset($_POST['username']) && $_POST['username']) {
         if ($memberId = $this->_iaDb->one_bind(iaDb::ID_COLUMN_SELECTION, '`username` = :user', array('user' => $_POST['username']), iaUsers::getTable())) {
             $transaction['member_id'] = $memberId;
         } else {
             $output['error'] = true;
             $output['message'][] = iaLanguage::get('incorrect_username');
         }
     }
     if ($transaction['email'] && !iaValidate::isEmail($transaction['email'])) {
         $output['error'] = true;
         $output['message'][] = iaLanguage::get('error_email_incorrect');
     }
     if (isset($transaction['item']) && in_array($transaction['item'], array(iaTransaction::TRANSACTION_MEMBER_BALANCE, 'members'))) {
         $transaction['item_id'] = $transaction['member_id'];
     }
     if (!$output['error']) {
         $output['success'] = (bool) $this->_iaDb->insert($transaction);
         $output['message'] = $output['success'] ? iaLanguage::get('transaction_added') : iaLanguage::get('invalid_parameters');
     }
     return $output;
 }
Example #4
0
<?php

//##copyright##
$iaPlan = $iaCore->factory('plan');
$itemNames = $iaDb->onefield('item', "`status` = 'active' AND `duration` > 0 GROUP BY `item`", null, null, iaPlan::getTable());
foreach ($itemNames as $itemName) {
    $tableName = $iaItem->getItemTable($itemName);
    $itemIds = $iaDb->onefield(iaDb::ID_COLUMN_SELECTION, '`sponsored` = 1 AND `sponsored_end` < NOW()', null, null, $tableName);
    if ($itemIds) {
        foreach ($itemIds as $itemId) {
            $iaPlan->setUnpaid($itemName, $itemId);
        }
    }
}