本文整理汇总了PHP中oseDB::query方法的典型用法代码示例。如果您正苦于以下问题:PHP oseDB::query方法的具体用法?PHP oseDB::query怎么用?PHP oseDB::query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oseDB
的用法示例。
在下文中一共展示了oseDB::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public static function save($params) {
$result = array();
$post = JRequest::get('post');
$member_id = $params['member_id'];
JRequest::setVar('member_id', $member_id);
if (empty($member_id)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error');
return $result;
}
$db = oseDB::instance();
$firstname = $db->Quote(oseObject::getValue($post, 'juser_firstname', $post['juser_username']));
$lastname = $db->Quote(oseObject::getValue($post, 'juser_lastname'));
$query = " SELECT COUNT(*) FROM `#__osemsc_userinfo` WHERE user_id = ". (int)$member_id;
$db->setQuery($query);
$exists = ($db->loadResult() > 0) ? true : false;
if ($exists) {
return array('success' => true);
} else {
$query = " INSERT INTO `#__osemsc_userinfo` (user_id,firstname,lastname)"
. " VALUES" . " ({$member_id},{$firstname},{$lastname})";
$db->setQuery($query);
if (!oseDB::query()) {
$result = array();
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Fail Saving OSE User Info.');
return $result;
}
return array('success' => true);
}
}
示例2: add
function add($level_name)
{
$db = oseDB::instance();
$level_name = $db->Quote($level_name);
$query = "SELECT * FROM `#__groups` WHERE `name` = " . $level_name;
$db->setQuery($query);
$item = $db->loadObject();
$result = array();
if (empty($item)) {
$query = " SELECT id FROM `#__groups` " . " ORDER BY id DESC";
$db->setQuery($query);
$oid = $db->loadResult();
$nid = $oid + 1;
$query = "INSERT INTO `#__groups` (`id`,`name`) VALUES ({$nid}, {$level_name});";
$db->setQuery($query);
if (oseDB::query()) {
$result['success'] = true;
$result['title'] = 'Done';
$result['content'] = JText::_("Added successfully");
} else {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Failed adding ACL group.");
}
} else {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Failed adding ACL group.");
}
return $result;
}
示例3: save
function save($post)
{
$post = JRequest::get('post');
$addon_id = JRequest::getInt('addon_id', 0);
unset($post['addon_id']);
$addon = array();
foreach ($post as $key => $value) {
if (strstr($key, 'addon_')) {
$billKey = preg_replace('/addon_/', '', $key, 1);
$addon[$billKey] = $value;
}
}
//oseExit($company);
$db = oseDB::instance();
if (empty($addon_id)) {
$keys = array_keys($addon);
$keys = '`' . implode('`,`', $keys) . '`';
$fields = $db->getTableFields('#__osemsc_addon');
foreach ($addon as $key => $value) {
if (!isset($fields['#__osemsc_addon'][$key])) {
/*
$query = "ALTER TABLE `#__osemsc_billinginfo` ADD `{$key}` TEXT NULL DEFAULT NULL";
$db->setQuery($query);
if (!$db->query())
{
return false;
}
*/
unset($addon[$key]);
}
}
foreach ($addon as $key => $value) {
$addon[$key] = $db->Quote($value);
}
$values = implode(',', $addon);
$query = "INSERT INTO `#__osemsc_addon` ({$keys}) VALUES ({$values});";
$db->setQuery($query);
if (!oseDB::query()) {
$result = array();
return false;
}
oseMscAddon::reorder($post['addon_type']);
} else {
foreach ($addon as $key => $value) {
$addon[$key] = "`{$key}`=" . $db->Quote($value);
}
$values = implode(',', $addon);
$query = " UPDATE `#__osemsc_addon` SET {$values}" . " WHERE `id` ={$addon_id}";
$db->setQuery($query);
if (!oseDB::query()) {
$result = array();
return false;
}
$ordering = JRequest::getInt('ordering', 0);
$this->updateOrder($addon_id, $ordering);
}
//echo $query;exit;
return true;
}
示例4: save
public static function save($params) {
$result = array();
$result['success'] = true;
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.Order.1');
return $result;
}
unset($params['allow_work']);
if ($params['join_from'] != 'payment') {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_('Done Join.Order');
return $result;
}
$db = oseDB::instance();
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$order_id = $params['order_id'];
$order_item_id = $params['order_item_id'];
$where = array();
$where[] = "order_id = {$order_id}";
$payment = oseRegistry::call('payment');
$curOrder = $payment->getOrder($where, 'obj');
$member = oseRegistry::call('member');
$member->instance($member_id);
$memParams = $member->getMemberInfo($msc_id, 'obj')->memParams;
if (empty($memParams)) {
$memParams = new stdClass();
} else {
$memParams = oseJSON::decode($memParams);
}
$memParams->order_id = $order_id;
$memParams->payment_mode = $curOrder->payment_mode;
$memParams->order_item_id = $order_item_id;
// Order problem for system add
$memParams = oseJSON::encode($memParams);
$query = " UPDATE `#__osemsc_member`" . " SET `params` = " . $db->Quote($memParams) . " WHERE msc_id = {$msc_id} AND member_id = {$member_id}";
$memConfig = oseMscConfig::getConfig('register', 'obj');
$db->setQuery($query);
if (!oseDB::query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.Order.2');
}
// User activation function;
$params = JComponentHelper::getParams('com_users');
$useractivation = $params->get('useractivation');
if (oseObject::getValue($memConfig, 'disabled_non_paid', false) == true) {
if ($useractivation == 0) {
$query = " UPDATE `#__users` SET `block` = 0 where `id` = " . $member_id;
$db->setQuery($query);
$db->query();
}
}
return $result;
}
示例5: save
public static function save($params)
{
$result = array();
$result['success'] = true;
if(empty($params['allow_work']))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
unset($params['allow_work']);
//oseExit($params);
$db = oseDB::instance();
$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
if(empty($msc_id))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Join History: No Membership ");
}
$history = oseRegistry::call('member')->getInstance('History');
$updated = $history->record($msc_id,$member_id,'join');
if(!$updated)
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_(" Fail Record Member's Footprint! ");
}
// Order problem for system add
$hisParams = oseJSON::encode(array('order_id' => $params['order_id']));
$query = " UPDATE `#__osemsc_member_history`"
." SET params = ".$db->Quote($hisParams)
." WHERE id = {$updated}"
;
$db->setQuery($query);
//oseExit($db->_sql);
if(!oseDB::query())
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.Order.2');
}
return $result;
}
示例6: save
public static function save($params = array())
{
$db = oseDB::instance();
$post = JRequest::get('post');
$id = JRequest::getCmd('id', null);
$msc_id = JRequest::getInt('msc_id', 0);
if (empty($id)) {
$id = uniqid();
}
$extItem = oseRegistry::call('msc')->getExtInfoItem($msc_id, 'acymailing2', 'obj');
$extItem->params = empty($extItem->params) ? '{}' : $extItem->params;
$items = oseJson::decode($extItem->params, true);
$where = array();
$msc_id = isset($msc_id) ? $msc_id : null;
if (empty($msc_id)) {
return false;
// No membership exists in the addon
} else {
unset($post['msc_id']);
$where[] = 'id = ' . $db->Quote($msc_id);
}
$where[] = 'type = ' . $db->Quote('acymailing2');
$params = array();
$prefix = 'acymailing2_';
foreach ($post as $key => $value) {
if (strstr($key, $prefix)) {
$newKey = preg_replace("/{$prefix}/", '', $key, 1);
$params[$newKey] = $value;
}
}
ksort($params);
$params['id'] = $id;
$items[$id] = $params;
$newParams = $db->Quote(oseJson::encode($items));
$where = oseDB::implodeWhere($where);
$query = " SELECT * FROM `#__osemsc_ext` " . $where;
$db->setQuery($query);
$obj = oseDB::loadItem('obj');
if (empty($obj)) {
$query = " INSERT INTO `#__osemsc_ext` " . " (id,type,params)" . " VALUES " . " ({$msc_id}," . $db->Quote('acymailing2') . ",{$newParams}) ";
$db->setQuery($query);
//oseExit($db->_sql);
} else {
$query = " UPDATE `#__osemsc_ext` " . " SET " . " params = {$newParams} " . " WHERE id = {$obj->id}" . " AND type = " . $db->Quote('acymailing2');
$db->setQuery($query);
}
if (oseDB::query()) {
$result['success'] = true;
$result['title'] = JText::_('Finished');
$result['content'] = JText::_('Save Successfully!');
} else {
$result['success'] = false;
$result['title'] = JText::_('Error');
$result['content'] = JText::_('Error in Saving License Parameters');
}
return $result;
}
示例7: remove
function remove($id)
{
$db = oseDB::instance();
$query = " DELETE FROM `#__osemsc_coupon` " . " WHERE id = '{$id}'";
$db->setQuery($query);
if (oseDB::query()) {
$query = " DELETE FROM `#__osemsc_coupon_user` " . " WHERE coupon_id = '{$id}'";
$db->setQuery($query);
return oseDB::query();
} else {
return false;
}
}
示例8: archive
public static function archive($msc_id, $member_id, $action)
{
$db = oseDB::instance();
$date = oseHTML::getDateTime();
$date = $db->Quote($date);
$query = " INSERT INTO `#__osemsc_member_history` " . " (`msc_id`,`member_id`,`action`,`date`, `accumulated`) " . " VALUES " . " ({$msc_id},{$member_id},'{$action}',{$date}, '0') ";
$db->setQuery($query);
if (oseDB::query()) {
return $db->insertid();
} else {
return false;
}
}
示例9: getUserInfo
function getUserInfo()
{
$db = oseDB::instance();
$query = " SELECT * FROM `#__osemsc_userinfo_view` WHERE `user_id` = " . (int) $this->user_id;
$db->setQuery($query);
$item = oseDB::loadItem('obj');
if (empty($item)) {
$query = " INSERT INTO `#__osemsc_userinfo` (`user_id`) VALUES (" . (int) $this->user_id . ")";
$db->setQuery($query);
oseDB::query();
$item = self::getUserInfo();
}
return $item;
}
示例10: companySave
public static function companySave($params)
{
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
unset($params['allow_work']);
$db = oseDB::instance();
$post = JRequest::get('post');
$member_id = $params['member_id'];
//JRequest::setVar('member_id',$member_id);
if (empty($member_id)) {
return false;
}
$company = array();
foreach ($post as $key => $value) {
if (strstr($key, 'company_')) {
$billKey = preg_replace('/company_/', '', $key, 1);
$company[$billKey] = $value;
}
}
//get vm country code
$query = " SELECT country_3_code FROM `#__vm_country` WHERE `country_2_code` = '{$company['country']}'";
$db->setQuery($query);
$country_code = $db->loadResult();
$company['country'] = empty($country_code) ? $company['country'] : $country_code;
//get vm state code
$query = " SELECT state_2_code FROM `#__vm_state` WHERE `state_name` = '{$company['state']}'";
$db->setQuery($query);
$state_code = $db->loadResult();
$company['state'] = empty($state_code) ? $company['state'] : $state_code;
$query = " UPDATE `#__vm_user_info` " . " SET `company` = '{$company['company']}', `phone_1` = '{$company['telephone']}', `address_1` = '{$company['addr1']}', `address_2` = '{$company['addr2']}', `city` = '{$company['city']}', `state` = '{$company['state']}', `country` = '{$company['country']}', `zip` = '{$company['postcode']}' " . " WHERE `user_id` = '{$member_id}' AND `address_type` = 'BT' ";
$db->setQuery($query);
if (!oseDB::query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Fail Saving Company info.');
return $result;
}
$result = array();
$result['success'] = true;
$result['title'] = 'Done';
$result['content'] = JText::_('Saved Company Info.');
return $result;
}
示例11: save
public static function save($params)
{
$result = array();
$result['success'] = true;
//oseExit($params);
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.Order.1');
return $result;
}
unset($params['allow_work']);
if ($params['join_from'] != 'payment') {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_('Done Join.Order');
return $result;
}
$db = oseDB::instance();
//$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$order_id = $params['order_id'];
$where = array();
$where[] = "order_id = {$order_id}";
$payment = oseRegistry::call('payment');
$curOrder = $payment->getOrder($where, 'obj');
$member = oseRegistry::call('member');
$member->instance($member_id);
$memParams = $member->getMemberInfo($msc_id, 'obj')->memParams;
$memParams = oseJSON::decode($memParams);
$memParams->order_id = $order_id;
$memParams->payment_mode = $curOrder->payment_mode;
// Order problem for system add
$memParams = oseJSON::encode($memParams);
$query = " UPDATE `#__osemsc_member`" . " SET params = " . $db->Quote($memParams) . " WHERE msc_id = {$msc_id} AND member_id = {$member_id}";
$db->setQuery($query);
//oseExit($db->_sql);
if (!oseDB::query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.Order.2');
}
return $result;
}
示例12: renew
public static function renew($params)
{
$result = array();
$result['success'] = true;
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Renew.Order');
return $result;
}
unset($params['allow_work']);
if ($params['join_from'] != 'payment') {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Success");
return $result;
}
$db = oseDB::instance();
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$query = " SELECT mm.link_id " . " FROM `#__osemsc_mtrel` AS mm" . " INNER JOIN `#__osemsc_directory` AS directory ON directory.directory_id = mm.directory_id" . " INNER JOIN `#__oselic_cs_company` AS lcc ON lcc.company_id = directory.company_id" . " WHERE lcc.user_id = {$member_id}";
$db->setQuery($query);
$link_id = $db->loadResult();
//oseExit($db->_sql);
if (empty($link_id)) {
return $result;
}
$member = oseRegistry::call('member');
$member->instance($member_id);
$memInfo = $member->getMemberInfo($msc_id, 'obj');
$query = " UPDATE `#__mt_links`" . " SET `publish_down` = " . $db->Quote($memInfo->expired_date) . " WHERE link_id = {$link_id}";
$db->setQuery($query);
if (oseDB::query()) {
return $result;
} else {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("cancel.directory");
return $result;
}
}
示例13: joinInAutomaticMode
private static function joinInAutomaticMode($msc_id, $member_id, $orderInfo)
{
$db = oseDB::instance();
$result = array();
$result['success'] = true;
$orderParams = oseJSON::decode($orderInfo->params);
$start_date = oseHTML::getDateTime();
$start_date = $db->Quote($start_date);
if ($orderParams->has_trial) {
$recurrence_num = $orderParams->p1 + 1;
$recurrence_unit = $orderParams->t1;
} else {
$recurrence_num = $orderParams->p3 + 1;
$recurrence_unit = $orderParams->t3;
}
$expired_date = " DATE_ADD({$start_date},INTERVAL {$recurrence_num} {$recurrence_unit}) ";
$query = " UPDATE `#__osemsc_member` " . " SET start_date = {$start_date} , expired_date = {$expired_date}" . " WHERE member_id = {$member_id} AND msc_id = {$msc_id} ";
$db->setQuery($query);
if (!oseDB::query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_(' Fail Updated Member\'s Recurrence ');
return $result;
}
return $result;
}
示例14: delete
function delete()
{
$db = oseDB::instance();
$query = " SELECT `id` FROM `{$this->_table}`" . " WHERE lft BETWEEN {$this->lft} AND {$this->rgt}";
$db->setQuery($query);
$ids = $db->loadResultArray();
JArrayHelper::toInteger($ids);
$ids = implode(',', $ids);
$updated = parent::delete();
if ($updated) {
foreach ($this->_type as $k => $o) {
$class = $this->getTypeItem($o->id);
$query = " DELETE FROM `" . $class->get('_table') . "`" . " WHERE `plan_id` IN ({$ids})";
$db->setQuery($query);
oseDB::query();
}
}
return $updated;
/*
$updated = oseDB::delete($this->_table,array('id'=>$this->get('id')));
if($updated)
{
foreach($this->_type as $k => $o)
{
$class = $this->getTypeItem($o->id);
$class->delete();
}
}
return $updated;*/
}
示例15: save
public static function save($params)
{
if(!class_exists('oseMscPublic'))
{
require_once(OSEMSC_F_HELPER.DS.'oseMscPublic.php');
}
$result = array();
$result['success'] = true;
//oseExit($params);
if(empty($params['allow_work']))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.PAP');
return $result;
}
unset($params['allow_work']);
/* Offline payments should be counted as well; removed from v 6.0.5
if( $params['join_from'] != 'payment')
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_('Done Join.Order');
return $result;
}
*/
$oseMscConfig = oseRegistry::call('msc')->getConfig('thirdparty','obj');
if(empty($oseMscConfig->pap_enable))
{
return $result;
}
if(empty($oseMscConfig->pap_url))
{
return $result;
}
$db = oseDB::instance();
//$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$order_id = $params['order_id'];
$order_item_id = $params['order_item_id'];
$where = array();
$where[] = "order_id = {$order_id}";
$payment = oseRegistry::call('payment');
$curOrder = $payment->getOrder($where,'obj');
$curOrderParams = oseJson::decode($curOrder->params);
$recurrence_times = ($curOrderParams->has_trial)?$curOrderParams->recurrence_times+1:$curOrderParams->recurrence_times;
$member = oseRegistry::call('member');
$member->instance($member_id);
$userInfo = $member->getUserInfo('obj');
$memParams = $member->getMemberInfo($msc_id,'obj')->memParams;
$memParams = oseJSON::decode($memParams);
$memParams->first_ip = oseObject::getValue($curOrderParams,'first_ip');;
if(empty($curOrderParams->pap_visitorid))
{
return $result;
//$memParams->pap_visitorid = 'paypal';
}
else
{
$memParams->pap_visitorid = $curOrderParams->pap_visitorid;
//$memParams->pap_visitorid = $_COOKIE['PAPVisitorId'];
}
$memParams_encode = oseJSON::encode($memParams);
$query = " UPDATE `#__osemsc_member`"
." SET params = ".$db->Quote($memParams_encode)
." WHERE msc_id = {$msc_id} AND member_id = {$member_id}"
;
$db->setQuery($query);
//oseExit($db->_sql);
if(!oseDB::query())
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.Order.2');
return $result;
}
try {
require_once(OSEMSC_B_LIB.DS.'PapApi.class.php');
$saleTracker = new Pap_Api_SaleTracker($oseMscConfig->pap_url.'/scripts/sale.php');
$saleTracker->setAccountId(oseObject::getValue($oseMscConfig,'pap_account_id','default1'));
$saleTracker->setVisitorId($memParams->pap_visitorid);
$sale1 = $saleTracker->createSale();
$msc = oseRegistry::call('msc');
//.........这里部分代码省略.........