本文整理汇总了PHP中oseDB类的典型用法代码示例。如果您正苦于以下问题:PHP oseDB类的具体用法?PHP oseDB怎么用?PHP oseDB使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了oseDB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItem
function getItem()
{
$result = array();
$post = JRequest::get('post');
$post = oseMscAddon::getPost('licseat_', $post);
if (!isset($post['contact_send'])) {
$post['contact_send'] = 0;
}
if (!isset($post['internal_contact_send'])) {
$post['internal_contact_send'] = 0;
}
$db = oseDB::instance();
$msc_id = JRequest::getInt('msc_id', 0);
$member_id = JRequest::getInt('member_id', 0);
$mscLicInfo = oseRegistry::call('msc')->getExtInfo($msc_id, 'lic', 'obj');
$mscLicInfoParams = oseObject::getParams($mscLicInfo);
$where = array();
$where[] = "license_user_id = '{$member_id}'";
if (empty($mscLicInfoParams->id)) {
$where[] = "license_id = '{$mscLicInfoParams->id}'";
}
$where = oseDB::implodeWhere();
$query = " SELECT * FROM `#__oselic_license_seat`" . $where . " ORDER BY id DESC";
$db->setQuery($query);
$item = oseDB::loadItem('obj');
$result['success'] = empty($item) ? false : true;
$result['total'] = empty($item) ? 0 : 1;
$result['result'] = empty($item) ? array() : $item;
//$result = oseJson::encode($result);
return $result;
}
示例2: generateDesc
function generateDesc($order_id)
{
$title = null;
$db = oseDB::instance();
$query = "SELECT * FROM `#__osemsc_order_item` WHERE `order_id` = '{$order_id}'";
$db->setQuery($query);
$obj = $db->loadObject();
$params = oseJson::decode($obj->params);
$msc_id = $obj->entry_id;
$query = "SELECT title FROM `#__osemsc_acl` WHERE `id` = " . (int) $msc_id;
$db->setQuery($query);
$msc_name = $db->loadResult();
$msc_option = $params->msc_option;
$query = "SELECT params FROM `#__osemsc_ext` WHERE `type` = 'payment' AND `id` = " . (int) $msc_id;
$db->setQuery($query);
$result = oseJson::decode($db->loadResult());
foreach ($result as $key => $value) {
if ($msc_option == $key) {
if ($value->recurrence_mode == 'period') {
if ($value->eternal) {
$title = 'Life Time Membership';
} else {
$title = $value->recurrence_num . ' ' . ucfirst($value->recurrence_unit) . ' Membership';
}
} else {
$start_date = date("l,d F Y", strtotime($value->start_date));
$expired_date = date("l,d F Y", strtotime($value->expired_date));
$title = $start_date . ' - ' . $expired_date . ' Membership';
}
}
}
$title = $msc_name . ' : ' . $title;
return $title;
}
示例3: getMSCs
public static function getMSCs()
{
$my = JFactory::getUser();
$member_id = $my->id;
$result = array();
$db= oseDB :: instance();
$query= " SELECT acl.id, acl.title FROM `#__osemsc_member_history` AS omh"
." INNER JOIN `#__osemsc_acl` AS acl"
." ON omh.`msc_id` = acl.`id`"
." WHERE omh.`member_id` = '{$member_id}'"
." GROUP BY acl.`id`";
$db->setQuery($query);
$items = oseDB :: loadList();
if(count($items) < 1)
{
$result['total'] = 0;
$result['results'] = '';
}else
{
$result['total'] = count($items);
$result['results'] = $items;
}
$result = oseJson :: encode($result);
oseExit($result);
}
示例4: 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);
}
}
示例5: activate
public static function activate($params)
{
$result = array();
$result['success'] = true;
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Renew.History');
return $result;
}
unset($params['allow_work']);
$db = oseDB::instance();
$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$result = array();
$result['success'] = true;
if (empty($msc_id)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_(" History Error ");
return $result;
}
$history = oseRegistry::call('member')->getInstance('History');
if (!$history->record($msc_id, $member_id, 'activate')) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_(" Fail Record Member's Footprint! ");
}
return $result;
}
示例6: cancel
public static function cancel($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']);
$db = oseDB::instance();
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$msc = oseRegistry::call('msc');
$member = oseRegistry::call('member');
$payment = oseRegistry::call('payment');
$ext = $msc->getExtInfo($msc_id, 'msc', 'obj');
$member->instance($member_id);
$userInfo = $member->getBasicInfo('obj');
$member = oseRegistry::call('member');
$email = $member->getInstance('email');
$emailTempDetail = $email->getDoc($ext->cancel_email, 'obj');
$variables = $email->getEmailVariablesCancel($member_id, $msc_id);
$emailParams = $email->buildEmailParams($emailTempDetail->type);
$emailDetail = $email->transEmail($emailTempDetail, $variables, $emailParams);
$email->sendEmail($emailDetail, $userInfo->email);
$emailConfig = oseMscConfig::getConfig('email', 'obj');
if ($emailConfig->sendWel2Admin) {
$email->sendToAdminGroup($emailDetail, $emailConfig->admin_group);
}
return $result;
}
示例7: getLangID
function getLangID($lang)
{
$db = oseDB::instance();
$query = "SELECT id FROM `#__languages` WHERE `code` = " . $db->Quote($lang, true) . " OR `shortcode` = " . $db->Quote($lang, true);
$id = $db->loadResult();
return $id;
}
示例8: getloginRedirect
function getloginRedirect($msc_id)
{
$db = oseDB::instance();
oseDB::lock('#__menu');
$objs = array();
$where = array();
//$where = array_merge($where,oseJSON::generateQueryWhere());
// Added in V 4.4, menu access levels
//$where[] = 'm.menutype = '.$db->Quote($menutype);
$where[] = 'm.published != -2';
$where[] = 'm.client_id = 0';
$where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : '';
$query = 'SELECT m.*, com.name AS com_name' . ' FROM `#__menu` AS m' . ' LEFT JOIN `#__extensions` AS com ON com.extension_id = m.component_id' . $where . ' ORDER BY m.lft';
$db->setQuery($query);
//oseExit($db->getQuery());
$menus = $db->loadObjectList();
$i = 0;
if (!empty($menus)) {
foreach ($menus as $menu) {
$objs[$i]->menuid = $menu->id;
$objs[$i]->displayText = str_repeat('<span class="gtr">|—</span>', $menu->level) . '[ID-' . $menu->id . ']-' . $menu->title;
$i++;
}
}
oseDB::unlock();
return $objs;
}
示例9: getList
function getList()
{
$db = oseDB::instance();
$query = 'SELECT * FROM `#__groups` AS a ORDER by a.id ASC';
$db->setQuery($query);
$results = oseDB::loadList();
return $results;
}
示例10: 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;
}
示例11: 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");
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::_("Renew Msc: No Msc ID");
return $result;
}
// get the plan id of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'osecredit'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if (empty($data->osecredit_id) || empty($data->enable)) {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
$query = "SELECT credit_amount FROM `#__ose_credit_plan` WHERE `id` = '{$data->osecredit_id}'";
$db->setQuery($query);
$amount = $db->loadResult();
$query = "SELECT * FROM `#__ose_credit_member` WHERE `member_id` = '{$member_id}'";
$db->setQuery($query);
$obj = $db->loadObject();
if (empty($obj)) {
$credit_params = oseJson::encode(array());
$query = " INSERT INTO `#__ose_credit_member` (`member_id`, `credit_amount`, `params`)" . " VALUES" . " ('{$member_id}', '{$amount}', '{$credit_params}')";
} else {
$amount = $amount + $obj->credit_amount;
$query = "UPDATE `#__ose_credit_member` SET `credit_amount` = '{$amount}' WHERE `id` = '{$obj->id}'";
}
$db->setQuery($query);
if (!$db->query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error');
return $result;
}
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
示例12: activate
public static function activate($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::_("Renew Msc: No Msc ID");
return $result;
}
// get the docman groups_id of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'docman'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if (empty($data->groups_id) || $data->groups_id == '-1') {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
$docman_group_id = $data->groups_id;
$query = "SELECT * FROM `#__docman_groups` WHERE `groups_id` = " . (int) $docman_group_id;
$db->setQuery($query);
$obj = $db->loadObject();
if (!empty($obj)) {
$newmembers[] = $member_id;
if (!empty($obj->groups_members)) {
$oldmembers = explode(",", $obj->groups_members);
if (count($oldmembers) > 0) {
$newmembers = array_merge($oldmembers, $newmembers);
}
}
$newmembers = array_unique($newmembers);
$newmembers = implode(",", $newmembers);
$query = "UPDATE `#__docman_groups` SET `groups_members` = '" . $newmembers . "' WHERE `groups_id` = " . (int) $docman_group_id;
$db->setQuery($query);
if (!$db->query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
}
return $result;
}
示例13: getUserInfo
public static function getUserInfo($member_id)
{
//@todo : change to load msc addon if no expired date if order mistake
$db = oseDB::instance();
$query = "SELECT * FROM `#__users` " . " WHERE `id` = '{$member_id}'";
$db->setQuery($query);
$obj = $db->loadObject();
return $obj;
}
示例14: getItems
function getItems()
{
// Get a storage key.
$store = $this->getStoreId('getItems');
// Try to load the data from internal storage.
if (!empty($this->cache[$store])) {
return $this->cache[$store];
}
$search = $this->getState('filter.search');
$searchid = $this->getState('filter.searchid');
$searchpe = $this->getState('filter.searchpe');
// Load the list items.
$items = parent::getItems();
// If emtpy or an error, just return.
if (empty($items)) {
return array();
}
//oseExit($items);
$db = oseDB::instance();
// Inject the values back into the array.
foreach ($items as $k => $item) {
$order_id = null;
if ($item->msc_id > 0) {
$params = oseJson::decode($item->params);
$order_id = oseGetValue($params, 'order_id', 0);
$query = " SELECT `title` FROM `#__osemsc_acl`" . " WHERE `id` = '{$item->msc_id}'";
$db->setQuery($query);
$item->membership = $db->loadResult();
$query = " SELECT *" . " FROM `#__osemsc_order_fix`" . " WHERE `member_id` = '{$item->id}'";
$db->setQuery($query);
$ofItem = oseDB::loadItem('obj');
$item->paypal_email = oseObject::getValue($ofItem, 'email', $item->email);
} else {
$item->expired_date = null;
$item->status = '';
}
if (empty($search) && empty($searchid) && empty($searchpe)) {
//return array();
} else {
//$item->order_number = null;
if (!empty($order_id)) {
$query = " SELECT `order_id`,`order_number`,`payment_serial_number`,`order_status`" . " FROM `#__osemsc_order`" . " WHERE `order_id` = '{$order_id}'";
$db->setQuery($query);
$oItem = oseDB::loadItem('obj');
$item->order_number = $oItem->order_number;
$item->order_id = $oItem->order_id;
$item->payment_serial_number = $oItem->payment_serial_number;
$item->order_status = $oItem->order_status;
} else {
}
}
$items[$k] = $item;
}
// Add the items to the internal cache.
$this->cache[$store] = $items;
return $this->cache[$store];
}
示例15: PayFastOneOffPostForm
function PayFastOneOffPostForm($orderInfo, $params = array())
{
$pConfig = oseMscConfig::getConfig('payment', 'obj');
$merchantId = $pConfig->payfast_merchant_id;
$merchantKey = $pConfig->payfast_merchant_key;
$html = array();
$test_mode = $pConfig->payfast_testmode;
if (!$test_mode) {
if (empty($merchantId) || empty($merchantKey)) {
$html['form'] = "";
$html['url'] = "";
return $html;
}
}
if ($test_mode == true) {
$merchantId = '10000100';
$merchantKey = '46f0cd694581a';
$url = "https://sandbox.payfast.co.za/eng/process";
} else {
$url = "https://www.payfast.co.za/eng/process";
}
$db = oseDB::instance();
$member = oseRegistry::call('member');
$member->instance($orderInfo->user_id);
$payment = oseRegistry::call('payment');
$paymentOrder = $payment->getInstance('Order');
$billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id);
$amount = $orderInfo->payment_price;
$currency = $orderInfo->payment_currency;
$order_id = $orderInfo->order_id;
$order_number = $orderInfo->order_number;
$user =& JFactory::getUser($orderInfo->user_id);
$orderInfoParams = oseJson::decode($orderInfo->params);
$cancelUrl = JURI::base() . "index.php";
$notifyUrl = JURI::base() . "components/com_osemsc/ipn/payfast_notify.php";
$returnUrl = urldecode(JROUTE::_(JURI::base() . "index.php?option=com_osemsc&view=thankyou&order_id=" . $orderInfo->order_id));
$returnUrl = $returnUrl ? $returnUrl : JURI::base() . "index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}";
// Create description
$description = '';
$vendor_image_url = "";
$app =& JFactory::getApplication();
$currentSession = JSession::getInstance('none', array());
$stores = $currentSession->getStores();
$html['form'] = '<form action="' . $url . '" method="post">';
// Construct variables for post
$post_variables = array('merchant_id' => $merchantId, 'merchant_key' => $merchantKey, 'return_url' => $returnUrl, 'cancel_url' => $cancelUrl, 'notify_url' => $notifyUrl, 'name_first' => substr($billinginfo->firstname, 0, 100), 'name_last' => substr($billinginfo->lastname, 0, 100), 'email_address' => substr($billinginfo->email, 0, 255), 'item_name' => JText::_('Order ID: ') . $order_id, 'item_description' => $description, 'amount' => number_format($amount, 2, '.', ''), 'm_payment_id' => $order_id, 'currency_code' => $currency, 'custom_str1' => $order_number, 'user_agent' => 'Open Source Membership Control V5');
$html['form'] .= '<input type="image" id="payfast_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with PayFast') . '" />';
// Process payment variables;
$html['url'] = $url . "?";
foreach ($post_variables as $name => $value) {
$html['form'] .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
$html['url'] .= $name . "=" . urlencode($value) . "&";
}
$html['form'] .= '</form>';
return $html;
}