public function __get($var)
 {
     switch ($var) {
         case 'amount_front':
             $this->amount_front = round($this->amount / 100, 2);
             return $this->amount_front;
             break;
         case 'price_front':
             $this->price_front = $this->amount_front . ' ' . $this->currency;
             return $this->price_front;
             break;
         case 'json_data':
             $this->json_data = json_decode($this->log, true);
             return $this->json_data;
             break;
         case 'option_selection1':
             $this->option_selection1 = isset($this->json_data['option_selection1']) ? $this->json_data['option_selection1'] : '-';
             return $this->option_selection1;
             break;
         case 'date_front':
             $this->date_front = date('Y-m-d H:i:s', $this->odate);
             return $this->date_front;
             break;
         case 'instance':
             try {
                 $this->instance = erLhcoreClassModelInstance::fetch($this->instance_id);
             } catch (Exception $e) {
                 $this->instance = false;
             }
             return $this->instance;
             break;
         case 'customer_name':
             if ($this->instance !== false && $this->instance->client_title != '') {
                 $this->customer_name = $this->instance->client_title;
                 return $this->customer_name;
             } else {
                 $this->customer_name = isset($this->json_data['payer_email']) ? $this->json_data['payer_email'] : '';
                 if (isset($this->json_data['first_name'])) {
                     $this->customer_name .= "<br/>" . $this->json_data['first_name'] . ' ' . $this->json_data['last_name'];
                 }
                 return $this->customer_name;
             }
             break;
         default:
             break;
     }
 }
Пример #2
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhinstance/edit.tpl.php');
$Instance = erLhcoreClassModelInstance::fetch((int) $Params['user_parameters']['instance_id']);
$cfgSite = erConfigClassLhConfig::getInstance();
$tpl->set('locales', $cfgSite->getSetting('site', 'available_site_access'));
if (isset($_POST['Cancel_departament'])) {
    erLhcoreClassModule::redirect('instance/list');
    exit;
}
$modules = array('reporting_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Statistic supported'), 'atranslations_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Automatic translations supported'), 'cobrowse_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Co-Browse supported'), 'cobrowse_forms_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Co-Browse forms filling supported'), 'forms_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Forms supported'), 'cannedmsg_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Canned messages supported'), 'faq_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'FAQ supported'), 'reporting_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Reporting supported'), 'chatbox_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Chatbox supported'), 'browseoffers_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Browse offers supported'), 'questionnaire_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Questionnaire supported'), 'proactive_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Proactive supported'), 'screenshot_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Screenshot supported'), 'blocked_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'User blocking supported'), 'files_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Files supported'), 'sms_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'SMS chat supported'), 'onlinevisitortrck_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Online visitors list supported'), 'geoadjustment_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'GEO adjustment supporte'), 'chatremarks_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Chat notes supported'), 'autoresponder_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Autoresponder supported'), 'previouschats_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Previous chats supported'), 'footprint_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Footprint supported'), 'chat_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Chat supported'), 'speech_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Speech supported'), 'transfer_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Chat transfer supported'), 'operatorschat_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Chat between operators supported'), 'xmpp_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'XMPP supported'), 'offline_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Offline supported'), 'sugarcrm_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'SugarCRM supported'), 'full_xmpp_chat_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Full XMPP chat supported'), 'full_xmpp_visitors_tracking' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Track online visitors in XMPP'));
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.features_titles', array('features' => &$modules));
$tpl->set('modules_features', $modules);
if (isset($_POST['ChangePassword'])) {
    $definition = array('InstancePassword' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'InstanceUsername' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('InstancePassword') && $form->InstancePassword != '') {
        $Instance->setPassword($form->InstancePassword);
        $tpl->set('updated', true);
    } else {
        $tpl->set('errors', array('Password was not change'));
    }
    if ($form->hasValidData('InstanceUsername') && $form->InstanceUsername != '') {
        $Instance->setUsername($form->InstanceUsername);
        $tpl->set('updated', true);
    } else {
        $tpl->set('errors', array('Username was not change'));
    }
}
if (isset($_POST['UpdateUsers'])) {
<?php

$cfg = erConfigClassLhConfig::getInstance();
try {
    $reseller = erLhcoreClassModelInstance::fetch($Params['user_parameters']['id']);
} catch (Exception $e) {
    echo json_encode(array('error' => 'true', 'reason' => 'Could not find a reseller'));
    exit;
}
if ($reseller->is_reseller == 0) {
    echo json_encode(array('error' => 'true', 'reason' => 'This instance is not a reseller'));
    exit;
}
$secretHash = (string) $reseller->reseller_secret_hash;
if ($secretHash == '') {
    echo json_encode(array('error' => 'true', 'reason' => 'This instance does not have a secret hash'));
    exit;
}
$validateHash = sha1((string) $Params['user_parameters']['address'] . (string) $Params['user_parameters']['email'] . (string) $Params['user_parameters']['request'] . (string) $Params['user_parameters']['period'] . $secretHash);
if ((string) $Params['user_parameters']['hash'] == $validateHash) {
    if (erLhcoreClassInstance::instanceExists((string) $Params['user_parameters']['address']) == false) {
        $instance = new erLhcoreClassModelInstance();
        if ($reseller->reseller_max_instances == $reseller->reseller_instances_count) {
            echo json_encode(array('error' => 'true', 'reason' => 'Reseller cannot have more than ' . $reseller->reseller_max_instances . ' instances'));
            exit;
        }
    } else {
        $list = erLhcoreClassModelInstance::getList(array('filter' => array('address' => (string) $Params['user_parameters']['address'])));
        $instance = array_shift($list);
        if ($instance->reseller_id != $reseller->id) {
            echo json_encode(array('error' => 'false', 'msg' => 'You do not have permission to edit this instance'));
Пример #4
0
     $db->beginTransaction();
     $invoice = new erLhcoreClassModelInstanceInvoice();
     $invoice->order_item = $_POST['option_selection1'];
     $invoice->txn_id = $txn_id;
     $invoice->instance_id = (int) $_POST['custom'];
     $invoice->amount = round($payment_amount * 100);
     $invoice->currency = $payment_currency;
     $dataLog = $_POST;
     $dataLog['raw_response'] = $res;
     $invoice->log = json_encode($dataLog, JSON_PRETTY_PRINT);
     $invoice->saveThis();
     $optionPurchased = $_POST['option_selection1'];
     $paypalSellerOptions = erConfigClassLhConfig::getInstance()->getSetting('site', 'seller_paypal_options');
     $requestNumber = $paypalSellerOptions[$optionPurchased]['r'];
     $periodDays = $paypalSellerOptions[$optionPurchased]['p'];
     $instance = erLhcoreClassModelInstance::fetch($invoice->instance_id);
     if ($instance->is_reseller) {
         $instance->reseller_request += $requestNumber;
     } else {
         $instance->request += $requestNumber;
     }
     if ($instance->expires == 0 || $instance->expires < time()) {
         $instance->expires = time() + (int) $periodDays * 24 * 3600;
     } else {
         $instance->expires += (int) $periodDays * 24 * 3600;
     }
     $instance->saveThis();
     // Set expire inform status
     $instance->setExpireInformStatus();
     $db->commit();
 } catch (Exception $e) {
Пример #5
0
    $definition = array('InstanceAddress' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('InstanceAddress') && $form->InstanceAddress != '') {
        $instanceAssign = erLhcoreClassModelInstance::findOne(array('filter' => array('address' => $form->InstanceAddress)));
        if ($instanceAssign !== false && $instanceAssign->reseller_id !== $Instance->id) {
            $instanceAssign->reseller_id = $Instance->id;
            $instanceAssign->saveThis();
        }
    }
}
/**
 * Unasign instance
 */
if (is_numeric($Params['user_parameters_unordered']['unasign']) && $Params['user_parameters_unordered']['unasign'] > 0) {
    $instanceAssign = erLhcoreClassModelInstance::fetch($Params['user_parameters_unordered']['unasign']);
    $instanceAssign->reseller_id = 0;
    $instanceAssign->saveThis();
}
/**
 * Child instances
 * */
$pages = new lhPaginator();
$pages->items_total = erLhcoreClassModelInstance::getCount(array('filter' => array('reseller_id' => $Instance->id)));
$pages->translationContext = 'abstract/list';
$pages->serverURL = erLhcoreClassDesign::baseurl('instance/assign') . '/' . $Instance->id;
$pages->setItemsPerPage(20);
$pages->paginate();
$tpl->set('pages', $pages);
$items = array();
if ($pages->items_total > 0) {