本文整理汇总了PHP中erLhcoreClassInstance::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassInstance::getSession方法的具体用法?PHP erLhcoreClassInstance::getSession怎么用?PHP erLhcoreClassInstance::getSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassInstance
的用法示例。
在下文中一共展示了erLhcoreClassInstance::getSession方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupInstance
public static function setupInstance($db)
{
if (isset($_SERVER['HTTP_HOST'])) {
$cfg = erConfigClassLhConfig::getInstance();
$subdomain = str_replace('.' . $cfg->getSetting('site', 'seller_domain'), '', $_SERVER['HTTP_HOST']);
$session = erLhcoreClassInstance::getSession();
$q = $session->createFindQuery('erLhcoreClassModelInstance');
$q->where($q->expr->eq('address', $q->bindValue($subdomain)) . ' OR (full_domain = 1 AND ' . $q->expr->eq('address', $q->bindValue($_SERVER['HTTP_HOST'])) . ')');
$items = $session->find($q);
if (!empty($items)) {
erLhcoreClassInstance::$instanceChat = array_shift($items);
$db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . erLhcoreClassInstance::$instanceChat->id);
} else {
header('Location: ' . $cfg->getSetting('site', 'seller_url'));
exit;
}
}
}
示例2: getList
public static function getList($paramsSearch = array())
{
$paramsDefault = array('limit' => 32, 'offset' => 0);
$params = array_merge($paramsDefault, $paramsSearch);
$session = erLhcoreClassInstance::getSession();
$q = $session->createFindQuery('erLhcoreClassModelInstance');
$conditions = array();
if (isset($params['filter']) && count($params['filter']) > 0) {
foreach ($params['filter'] as $field => $fieldValue) {
$conditions[] = $q->expr->eq($field, $q->bindValue($fieldValue));
}
}
if (isset($params['filterin']) && count($params['filterin']) > 0) {
foreach ($params['filterin'] as $field => $fieldValue) {
$conditions[] = $q->expr->in($field, $fieldValue);
}
}
if (isset($params['filterlt']) && count($params['filterlt']) > 0) {
foreach ($params['filterlt'] as $field => $fieldValue) {
$conditions[] = $q->expr->lt($field, $q->bindValue($fieldValue));
}
}
if (isset($params['filtergt']) && count($params['filtergt']) > 0) {
foreach ($params['filtergt'] as $field => $fieldValue) {
$conditions[] = $q->expr->gt($field, $q->bindValue($fieldValue));
}
}
if (count($conditions) > 0) {
$q->where($conditions);
}
$q->limit($params['limit'], $params['offset']);
$q->orderBy(isset($params['sort']) ? $params['sort'] : 'id ASC');
$objects = $session->find($q);
return $objects;
}
示例3: sha1
<?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;
示例4: getList
public static function getList($paramsSearch = array())
{
if (isset($paramsSearch['switch_db'])) {
$db = ezcDbInstance::get();
$cfg = erConfigClassLhConfig::getInstance();
$db->query('USE ' . $cfg->getSetting('db', 'database'));
}
$paramsDefault = array('limit' => 32, 'offset' => 0);
$params = array_merge($paramsDefault, $paramsSearch);
$session = erLhcoreClassInstance::getSession();
$q = $session->createFindQuery('erLhcoreClassModelInstance');
$conditions = array();
if (isset($params['filter']) && count($params['filter']) > 0) {
foreach ($params['filter'] as $field => $fieldValue) {
$conditions[] = $q->expr->eq($field, $q->bindValue($fieldValue));
}
}
if (isset($params['filterin']) && count($params['filterin']) > 0) {
foreach ($params['filterin'] as $field => $fieldValue) {
$conditions[] = $q->expr->in($field, $fieldValue);
}
}
if (isset($params['filterlt']) && count($params['filterlt']) > 0) {
foreach ($params['filterlt'] as $field => $fieldValue) {
$conditions[] = $q->expr->lt($field, $q->bindValue($fieldValue));
}
}
if (isset($params['filtergt']) && count($params['filtergt']) > 0) {
foreach ($params['filtergt'] as $field => $fieldValue) {
$conditions[] = $q->expr->gt($field, $q->bindValue($fieldValue));
}
}
if (count($conditions) > 0) {
$q->where($conditions);
}
$q->limit($params['limit'], $params['offset']);
$q->orderBy(isset($params['sort']) ? $params['sort'] : 'id ASC');
$objects = $session->find($q);
if (isset($paramsSearch['switch_db'])) {
$db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . erLhcoreClassInstance::$instanceChat->id);
}
return $objects;
}