public static function instanceExists($instance)
 {
     if (in_array($instance, array('www', 'dev', 'dev2', 'demo', 'admin', 'manager'))) {
         return true;
     }
     return erLhcoreClassModelInstance::getCount(array('filter' => array('address' => $instance))) > 0;
 }
 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;
     }
 }
Ejemplo n.º 3
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

/**
 * Iterates through all instances and executes callback timeout
 * At the moment it's a simple foreach. In the future we may need to enahance this part
 * with some queues etc.
 * 
 * php cron.php -s site_admin -e instance -c cron/extensions_update
 * */
$cfg = erConfigClassLhConfig::getInstance();
$db = ezcDbInstance::get();
foreach (erLhcoreClassModelInstance::getList(array('limit' => 1000000, 'filter' => array('status' => erLhcoreClassModelInstance::WORKING))) as $instance) {
    echo "Executing request to update instance internal structure for extensions - ", $instance->id, "\n";
    $secretHash = $cfg->getSetting('site', 'seller_secret_hash');
    $hash = sha1($instance->id . 'extensions' . date('Ym') . $secretHash);
    if ($instance->full_domain == 1) {
        $url = erConfigClassLhConfig::getInstance()->getSetting('site', 'http_mode') . $instance->address . '/index.php/instance/extensionsstructure/' . $instance->id . '/' . date('Ym') . '/' . $hash;
    } else {
        $url = erConfigClassLhConfig::getInstance()->getSetting('site', 'http_mode') . $instance->address . '.' . $cfg->getSetting('site', 'seller_domain') . '/index.php/instance/extensionsstructure/' . $instance->id . '/' . date('Ym') . '/' . $hash;
    }
    $response = erLhcoreClassModelChatOnlineUser::executeRequest($url);
    echo "Response:\n";
    print_r($response);
    echo PHP_EOL;
}
Ejemplo n.º 5
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhinstance/new.tpl.php');
$Instance = new erLhcoreClassModelInstance();
// Allow extensions to setup default attributes
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.new_instance', array('instance' => &$Instance));
$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['Save_departament'])) {
    $definition = array('Address' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'), 'Request' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'RequestUsed' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'Status' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0)), 'Expires' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'DateFormat' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'DateHourFormat' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'DateAndHourFormat' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'UserTimeZone' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'FrontSiteaccess' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'Language' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'UserTimeZone' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ResellerTitle' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ResellerMaxRequest' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ResellerMaxInstance' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ResellerSecretHash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ResellerRequest' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'Reseller' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'files_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'atranslations_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'cobrowse_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'forms_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'cannedmsg_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'faq_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'feature_1_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'feature_2_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'feature_3_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'reporting_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'chatbox_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'browseoffers_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'questionnaire_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'proactive_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'screenshot_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'blocked_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'footprint_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'previouschats_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'autoresponder_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'chatremarks_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'geoadjustment_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'onlinevisitortrck_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'speech_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'transfer_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'operatorschat_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'chat_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'xmpp_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'offline_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'sugarcrm_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'cobrowse_forms_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'AttrInt1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'AttrInt2' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'AttrInt3' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'max_operators' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'one_per_account' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'fullAddress' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'full_xmpp_chat_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'ClientData' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('speech_supported') && $form->speech_supported == true) {
        $Instance->speech_supported = 1;
    } else {
        $Instance->speech_supported = 0;
    }
    if ($form->hasValidData('one_per_account') && $form->one_per_account == true) {
        $Instance->one_per_account = 1;
    } else {
        $Instance->one_per_account = 0;
    }
    if ($form->hasValidData('fullAddress') && $form->fullAddress == true) {
        $Instance->full_domain = 1;
 /**
  * Adjust inform workflow attributes based on expire data
  * */
 public function setExpireInformStatus()
 {
     $expireOptions = erLhcoreClassInstance::getExpireOptions();
     $informStatusSet = false;
     foreach ($expireOptions as $expireOption) {
         $expireOption['filter']['filter']['id'] = $this->id;
         // We ignore status at this stage
         unset($expireOption['filter']['filter']['expire_inform_status']);
         foreach (erLhcoreClassModelInstance::getList($expireOption['filter']) as $item) {
             foreach ($expireOption['set'] as $attr => $attrValue) {
                 $this->{$attr} = $attrValue;
                 $this->saveThis();
                 $informStatusSet = true;
             }
         }
     }
     // None of above filters matched, so we can set default value
     if ($informStatusSet == false) {
         $this->expire_inform_status = 0;
         $this->saveThis();
     }
 }
<?php

$cfg = erConfigClassLhConfig::getInstance();
$secretHash = $cfg->getSetting('site', 'seller_secret_hash');
$validateHash = sha1((string) $Params['user_parameters']['address'] . $secretHash);
// http://manager.livehelperchat.com/index.php/instance/terminateinstance/remdex/138d07f5c478cbd4d1fcbfcc6ccd49d5961273bd
if ((string) $Params['user_parameters']['hash'] == $validateHash) {
    $list = erLhcoreClassModelInstance::getList(array('filter' => array('address' => (string) $Params['user_parameters']['address'])));
    if (!empty($list)) {
        $instance = array_shift($list);
        // Instance is initialized
        if ($instance->status == 1) {
            $instance->terminate = 1;
            $instance->saveThis();
        } elseif ($instance->status == 0) {
            // We can remove instantly instance
            erLhcoreClassInstance::getSession()->delete($instance);
        }
        echo json_encode(array('error' => 'false', 'msg' => 'instance terminated'));
    } else {
        echo json_encode(array('error' => 'false', 'msg' => 'Could not find an instance'));
    }
} else {
    echo json_encode(array('error' => 'true', 'reason' => 'invalid hash'));
}
exit;
Ejemplo n.º 8
0
<?php

// php cron.php -s site_admin -e instance -c cron/maintain
$cfgSite = erConfigClassLhConfig::getInstance();
if ($cfgSite->getSetting('site', 'expire_disabled', false) == false) {
    foreach (erLhcoreClassModelInstance::getList(array('filterlt' => array('expires' => time() - 14 * 24 * 3600))) as $item) {
        $item->removeThis();
    }
}
foreach (erLhcoreClassModelInstance::getList(array('filter' => array('terminate' => 1))) as $item) {
    $item->removeThis();
}
foreach (erLhcoreClassModelInstance::getList(array('filter' => array('status' => erLhcoreClassModelInstance::PENDING_CREATE))) as $item) {
    echo "Starting creating customer - ", $item->id, "\n";
    erLhcoreClassInstance::createCustomer($item);
    echo "Creating customer - ", $item->id, "\n";
}
Ejemplo n.º 9
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) {
Ejemplo n.º 10
0
/<?php 
echo $instance->id;
?>
" >Child instances [<?php 
echo $instance->reseller_instances_count;
?>
]</a>
    </div>
    <div class="panel-body">
       <table class="table">
       <tr>
           <th>Instance</th>
           <th>&nbsp;</th>
       </tr>
       <?php 
foreach (erLhcoreClassModelInstance::getList(array('sort' => 'id DESC', 'filter' => array('reseller_id' => $instance->id))) as $child) {
    ?>
       <tr>
            <td><a href="<?php 
    echo erLhcoreClassDesign::baseurl('instance/edit');
    ?>
/<?php 
    echo $child->id;
    ?>
"><?php 
    echo htmlspecialchars($child->address);
    ?>
</a></td>
            <td width="1"><i class="material-icons">info_outline</i></td>
       </tr>
       <?php 
Ejemplo n.º 11
0
<?php

try {
    $tpl = erLhcoreClassTemplate::getInstance('lhinstance/list.tpl.php');
    $pages = new lhPaginator();
    $pages->items_total = erLhcoreClassModelInstance::getCount();
    $pages->translationContext = 'abstract/list';
    $pages->serverURL = erLhcoreClassDesign::baseurl('instance/list');
    $pages->setItemsPerPage(20);
    $pages->paginate();
    $tpl->set('pages', $pages);
    $items = array();
    if ($pages->items_total > 0) {
        $items = erLhcoreClassModelInstance::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC'));
    }
    $tpl->set('items', $items);
    $tpl->set('pages', $pages);
    $Result['content'] = $tpl->fetch();
    $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instances')));
} catch (Exception $e) {
    print_r($e);
}
Ejemplo n.º 12
0
        $tpl->set('errors', array(erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Please choose at least one valid module!')));
    }
}
$pages = new lhPaginator();
$pages->items_total = erLhcoreClassModelInstanceInvoice::getCount(array('filter' => array('instance_id' => $instance->id)));
$pages->translationContext = 'instance/billing';
$pages->serverURL = erLhcoreClassDesign::baseurl('instance/billing');
$pages->setItemsPerPage(20);
$pages->paginate();
$tpl->set('pages', $pages);
$items = array();
if ($pages->items_total > 0) {
    $items = erLhcoreClassModelInstanceInvoice::getList(array('filter' => array('instance_id' => $instance->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page));
}
$tpl->set('items', $items);
if ($instance->is_reseller) {
    $pagesInstances = new lhPaginator();
    $pagesInstances->items_total = erLhcoreClassModelInstance::getCount(array('switch_db' => true, 'filter' => array('reseller_id' => $instance->id)));
    $pagesInstances->translationContext = 'instance/billing';
    $pagesInstances->serverURL = erLhcoreClassDesign::baseurl('instance/billinginstance');
    $pagesInstances->setItemsPerPage(20);
    $pagesInstances->paginate();
    $tpl->set('pagesInstance', $pagesInstances);
    $items = array();
    if ($pagesInstances->items_total > 0) {
        $items = erLhcoreClassModelInstance::getList(array('switch_db' => true, 'filter' => array('reseller_id' => $instance->id), 'offset' => $pagesInstances->low, 'limit' => $pagesInstances->items_per_page));
    }
    $tpl->set('itemsInstance', $items);
}
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Billing')));
Ejemplo n.º 13
0
                    }
                }
                if ($line == $startLine) {
                    $startParse = true;
                }
            }
        }
        fclose($handle);
    } else {
        echo "Warning: Cannot open apache log-file '{$logFilePath}' for reading, please check permissions and try again.\n";
    }
} else {
    echo "Warning: apache log-file '{$logFilePath}' doesn't exist, please check your ini-settings and try again.\n";
}
foreach ($partsHost as $address => $hits) {
    $items = erLhcoreClassModelInstance::getList(array('filter' => array('address' => $address)));
    if (!empty($items)) {
        $host = array_shift($items);
        $host->request -= $hits;
        $host->saveThis();
        echo $host->address, '-', $hits, "\n";
    }
}
$fh = fopen($updateViewLogPath, "w");
if ($fh) {
    fwrite($fh, "# Finished at " . date('Y-m-d H:i:s') . "\n");
    fwrite($fh, "# Last updated entry:" . "\n");
    fwrite($fh, $lastLine . "\n");
    fclose($fh);
}
echo "Finished at " . date('Y-m-d H:i:s') . "\n";
 /**
  * Processes all informing actions about expiring instances.
  * Sponsored :)
  * 
  * */
 public static function informAboutExpiration()
 {
     $status = array();
     foreach (self::getExpireOptions() as $expireOption) {
         foreach (erLhcoreClassModelInstance::getList($expireOption['filter']) as $item) {
             $status[] = "Expire option - " . $expireOption['template'] . '-' . $item->id;
             foreach ($expireOption['set'] as $attr => $attrValue) {
                 $item->{$attr} = $attrValue;
             }
             $item->saveThis();
             // Send e-mail only if enabled
             if ($expireOption['enabled'] == true) {
                 self::sendExpireMail($item, $expireOption);
                 $status[] = "Informing about expiration...";
             }
         }
     }
     return $status;
 }
Ejemplo n.º 15
0
            $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) {
    $items = erLhcoreClassModelInstance::getList(array('filter' => array('reseller_id' => $Instance->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC'));
}
$tpl->set('items', $items);
$tpl->set('pages', $pages);
$tpl->set('instance', $Instance);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('instance/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instances')), array('url' => erLhcoreClassDesign::baseurl('instance/edit') . '/' . $Instance->id, 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instance') . ' - ' . $Instance->address), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Child instances')));