コード例 #1
0
	public static function getItem($params = array())
	{
		$user = JFactory::getUser();
    	$member_id = $user->id;
    	
    	$db = oseDB::instance();
    	
    	$query = " SELECT company.* FROM `#__oselic_cs_company` AS company "
				." INNER JOIN  `#__oselic_cs_keys_view` AS lic_view ON lic_view.company_id = company.company_id"
    			." WHERE lic_view.user_id = {$member_id}";
    			;
		$db->setQuery($query);
		//oseExit($db->_sql);
		$info = oseDB::loadList();
		//$member = oseRegistry::call('member');
		
		//$member->instance($member_id);
		//$info = $member->getBillingInfo();
		
		$result['success'] = true;
		if(empty($info))
		{
			$result['total'] = 0;
			$result['result'] = '';
		}
		else
		{
			$result['total'] = 1;
			$result['result'] = $info;
		}
		
		return $result;
	}
コード例 #2
0
 public function getList($type, $backend = false)
 {
     $db = oseDB::instance();
     $where = array();
     if ('member' == substr($type, 0, 6)) {
         $where[] = "a.`type` LIKE 'member_%'";
     } else {
         $where[] = "a.`type` = " . $db->Quote($type);
     }
     $where[] = "b.`enabled` = 1 ";
     $where = oseDB::implodeWhere($where);
     $query = " SELECT a.*,b.enabled,b.custom,b.backend AS custom_backend, b.backend_enabled AS custom_backend_enabled,b.frontend AS custom_frontend, b.frontend_enabled AS custom_frontend_enabled" . " FROM `#__osemsc_addon` AS a" . " INNER JOIN `#__osemsc_addon_applied` AS b ON b.addon_id =a.id" . $where;
     $db->setQuery($query);
     $types = oseDB::loadList('array', 'name');
     foreach ($types as $key => $type) {
         $valid = $this->authorize($type['type'], $type['name'], $backend);
         if (!$valid) {
             unset($types[$key]);
             continue;
         }
         if ($type['custom']) {
             $type['backend'] = $type['custom_backend'];
             $type['frontend'] = $type['custom_frontend'];
             $type['backend_enabled'] = $type['custom_backend_enabled'];
             $type['frontend_enabled'] = $type['custom_frontend_enabled'];
         }
         if ($type['action'] == 1) {
             $type['action'] = "{$type['type']}.{$type['name']}";
         }
         $types[$key] = $type;
     }
     //$types = array_values($types);
     return $types;
 }
コード例 #3
0
	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
0
 function getMap()
 {
     // get License
     $db = oseDB::instance();
     // active
     $where = array();
     $where[] = "`member_id` = '{$this->user_id}'";
     $where[] = "`status` = 1";
     $where = oseDB::implodeWhere($where);
     $query = " SELECT * FROM `{$this->_table}`" . $where . " ORDER BY `id` ASC";
     $db->setQuery($query);
     $items = oseDB::loadList('obj', 'msc_id');
     $this->set('active_membership', $items);
     //expired
     $where = array();
     $where[] = "`member_id` = '{$this->user_id}'";
     $where[] = "`status` = 0";
     $where = oseDB::implodeWhere($where);
     $query = " SELECT * FROM `{$this->_table}`" . $where . " ORDER BY `id` ASC";
     $db->setQuery($query);
     $items = oseDB::loadList('obj', 'msc_id');
     $this->set('expired_membership', $items);
     //suspend
     $where = array();
     $where[] = "`member_id` = '{$this->user_id}'";
     $where[] = "`status` = 3";
     $where = oseDB::implodeWhere($where);
     $query = " SELECT * FROM `{$this->_table}`" . $where . " ORDER BY `id` ASC";
     $db->setQuery($query);
     $items = oseDB::loadList('obj', 'msc_id');
     $this->set('suspend_membership', $items);
 }
コード例 #5
0
ファイル: levels.php プロジェクト: kosmosby/medicine-prof
 function getList()
 {
     $db = oseDB::instance();
     $query = 'SELECT * FROM `#__groups` AS a ORDER by a.id ASC';
     $db->setQuery($query);
     $results = oseDB::loadList();
     return $results;
 }
コード例 #6
0
 function getUsers($where = null, $start = 0, $limit = 20, $type = 'array')
 {
     $db = oseDB::instance();
     $query = " SELECT u.username,u.name,u.email,u.id FROM `#__users` AS u" . $where;
     $db->setQuery($query, $start, $limit);
     $items = oseDB::loadList($type);
     //oseExit($db->_sql);
     return $items;
 }
コード例 #7
0
ファイル: member.php プロジェクト: kosmosby/medicine-prof
	function getOwnMsc() {
		$member = oseRegistry::call('member');
		$user = JFactory::getUser();
		$member->instance($user->id);
		$db = oseDB::instance();
		$query = " SELECT acl.*,mem.*, (SELECT DATEDIFF(mem.expired_date,NOW())) AS days_left FROM `#__osemsc_member` AS mem "
				. " INNER JOIN `#__osemsc_acl` AS acl ON acl.id = mem.msc_id" . " WHERE member_id = {$user->id}";
		$db->setQuery($query);
		return oseDB::loadList();
	}
コード例 #8
0
ファイル: oseConfig.php プロジェクト: kosmosby/medicine-prof
 public static function load($app = 'msc', $config_type = null, $type = 'array')
 {
     static $sApp, $objs;
     if ($sApp != $app) {
         $db = oseDB::instance();
         $where = array();
         if (!empty($config_type)) {
             if (is_array($config_type)) {
                 $values = array();
                 foreach ($config_type as $configType) {
                     $values[] = $db->Quote($configType);
                 }
             } else {
             }
         }
         $where[] = '`app`=' . $db->Quote($app);
         $where = oseDB::implodeWhere($where);
         $query = " SELECT * FROM `#__ose_app_config` " . $where;
         $db->setQuery($query);
         $objs = oseDB::loadList('obj');
     }
     if ($type == 'array') {
         $config = array();
     } else {
         $config = new stdClass();
     }
     if (empty($objs)) {
         return false;
     }
     foreach ($objs as $obj) {
         if (is_array($config_type)) {
             if (!in_array($obj->type, $config_type)) {
                 continue;
             }
         } else {
             if ($obj->type != $config_type && !empty($config_type)) {
                 continue;
             }
         }
         if (is_float($obj->value)) {
             $config = oseSetValue($config, $obj->key, (double) $obj->value);
         } elseif (is_numeric($obj->value)) {
             $config = oseSetValue($config, $obj->key, (int) $obj->value);
         } else {
             $config = oseSetValue($config, $obj->key, $obj->value);
         }
     }
     $config = oseSetValue($config, 'id', 1);
     $sApp = $app;
     return $config;
 }
コード例 #9
0
ファイル: orders.php プロジェクト: kosmosby/medicine-prof
 public function getOrders($type, $start, $limit)
 {
     $db = oseDB::instance();
     $where = array();
     $search_order = JRequest::getString('search_order', null);
     $search_order = JString::strtolower($search_order);
     $search_user = JRequest::getString('search_user', null);
     $search_user = JString::strtolower($search_user);
     $filterStatus = JRequest::getString('filter_status', null);
     if (!empty($search_order)) {
         $searchQuery = $db->Quote('%' . $search_order . '%');
         $where[] = "o.payment_serial_number LIKE {$searchQuery} OR o.order_id =" . (int) $search_order . " OR o.order_number LIKE {$searchQuery}";
     }
     if (!empty($search_user)) {
         $searchQuery = $db->Quote('%' . $search_user . '%');
         $where[] = "u.username LIKE {$searchQuery} OR u.name LIKE {$searchQuery} OR u.email LIKE {$searchQuery} OR u.id=" . (int) $search_user;
     }
     /*if (isset( $search ) && $search!= '')
     		{
     			$searchEscaped = $db->Quote('%'.$search.'%');
     			$where[] = " u.username LIKE {$searchEscaped} OR u.name LIKE {$searchEscaped}";
     		}*/
     if (!empty($filterStatus)) {
         $where[] = "o.order_status = " . $db->Quote($filterStatus);
     }
     $where[] = "o.entry_type IN ('msc','msc_list')";
     $where[] = "o.payment_from != 'system_admin'";
     $where = oseDB::implodeWhere($where);
     $query = " SELECT COUNT(*) " . " FROM `#__osemsc_order` AS o " . " INNER JOIN `#__users` AS u ON u.id = o.user_id" . $where;
     $db->setQuery($query);
     //oseExit($db->getQuery());
     $total = $db->loadResult();
     $query = " SELECT CONCAT('Order:',o.order_id) AS title, u.username,u.name, o.* " . " FROM `#__osemsc_order` AS o " . " INNER JOIN `#__users` AS u ON u.id = o.user_id" . $where . " ORDER BY o.create_date DESC";
     $db->setQuery($query, $start, $limit);
     //oseExit($db->getQuery());
     $items = oseDB::loadList();
     $return = array();
     $i = 0;
     foreach ($items as $item) {
         $item['mscTitle'] = self::getMSCTitle($item['order_id']);
         $item['name'] = $item['user_id'] . ' - ' . $item['name'];
         $item['title'] = $item['title'] . ' - ' . $item['mscTitle'];
         $return[$i] = $item;
         $i++;
     }
     $result = array();
     $result['total'] = $total;
     //$this->getTotal();
     $result['results'] = $return;
     return $result;
 }
コード例 #10
0
 public static function getHistory($msc_id, $member_id, $action = null)
 {
     $db = oseDB::instance();
     $where = array();
     if (!empty($action)) {
         $where[] = " `action` = '{$action}'";
     }
     $where[] = " `msc_id` = '{$msc_id}'";
     $where[] = " `member_id` = '{$member_id}'";
     $where = oseDB::implodeWhere($where);
     $query = " SELECT * FROM `#__osemsc_member_history` " . $where . " ORDER BY date DESC";
     $db->setQuery($query);
     $objs = oseDB::loadList('obj');
     return $objs;
 }
コード例 #11
0
 function &getList()
 {
     $db = oseDB::instance();
     $search = JRequest::getString('search', null);
     $search = JString::strtolower($search);
     $msc_id = JRequest::getInt('msc_id', 0);
     $start = JRequest::getInt('start', 0);
     $limit = JRequest::getInt('limit', 20);
     $levellimit = JRequest::getInt('levellimit', 10);
     $where = array();
     $where[] = 'rok.`folder` = 1';
     $where[] = 'rok.`published` = 1';
     if ($search) {
         $searchQuery = ' LOWER(rok.`name`) LIKE ' . $db->Quote('%' . $search . '%');
         $where[] = $searchQuery;
     }
     $access = oseMscJaccess::get_msc_aid(25);
     if (!empty($access)) {
         //$where[] = "m.access <= {$access} ";
     }
     //Added in V 4.4, menu access levels
     // Generate where query
     $where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : '';
     $query = ' SELECT rok.*' . ' FROM `#__rokdownloads` AS rok' . $where . ' ORDER BY rok.id';
     $db->setQuery($query);
     //oseExit($db->_sql);
     $rows = oseDB::loadList('obj');
     $total = count($rows);
     // slice out elements based on limits
     $list = array_slice($rows, $start, $limit);
     foreach ($list as $item) {
         $obj = oseRegistry::call('content')->getInstance('msc')->getItem('rokdownload', 'category', $item->id, 'msc', $msc_id, null, 'obj');
         $item->type = empty($obj->content_type) ? 'category' : $obj->content_type;
         $controlled = empty($obj) ? 0 : $obj->status;
         if ($controlled == '1') {
             $item->controlled = JText::_('SHOW_TO_MEMBERS');
         } elseif ($controlled == '-1') {
             $item->controlled = JText::_('HIDE_TO_MEMBERS');
         } else {
             $item->controlled = JText::_('SHOW_TO_ALL');
         }
     }
     $items = array_values($list);
     $result = array();
     $result['total'] = $total;
     $result['results'] = $items;
     return $result;
 }
コード例 #12
0
 public static function getList($params = array())
 {
     $db = oseDB::instance();
     $query = "SELECT * FROM `#__acymailing_list` WHERE `type`= 'list'";
     $db->setQuery($query);
     $planArray = oseDB::loadList();
     $result = array();
     if (count($planArray) < 1) {
         $result['total'] = 0;
         $result['results'] = '';
     } else {
         $result['total'] = count($planArray);
         $result['results'] = $planArray;
     }
     return $result;
 }
コード例 #13
0
 public static function getGroups($params = array())
 {
     $db = oseDB::instance();
     $query = " SELECT id,name FROM `#__k2_user_groups` ORDER BY `name` ASC ";
     $db->setQuery($query);
     $items = oseDB::loadList();
     $result = array();
     if (count($items) < 1) {
         $result['total'] = 0;
         $result['results'] = '';
     } else {
         $result['total'] = count($items);
         $result['results'] = $items;
     }
     return $result;
 }
コード例 #14
0
 public static function getProfileFields($params = array())
 {
     $db = oseDB::instance();
     $query = " SELECT id,name FROM `#__osemsc_fields` WHERE `published` = 1 ORDER BY `ordering` ASC ";
     $db->setQuery($query);
     $items = oseDB::loadList();
     $result = array();
     if (count($items) < 1) {
         $result['total'] = 0;
         $result['results'] = '';
     } else {
         $result['total'] = count($items);
         $result['results'] = $items;
     }
     return $result;
 }
コード例 #15
0
 public static function getPlans($params = array())
 {
     $db = oseDB::instance();
     $query = " SELECT id,title FROM `#__ose_credit_plan` ORDER BY `title` ASC ";
     $db->setQuery($query);
     $items = oseDB::loadList();
     $result = array();
     if (count($items) < 1) {
         $result['total'] = 0;
         $result['results'] = '';
     } else {
         $result['total'] = count($items);
         $result['results'] = $items;
     }
     return $result;
 }
コード例 #16
0
ファイル: panel.cb.php プロジェクト: kosmosby/medicine-prof
 public static function getField($params = array())
 {
     $db = oseDB::instance();
     $query = " SELECT tabid,tablecolumns,name FROM `#__comprofiler_fields` ORDER BY `fieldid` ASC ";
     $db->setQuery($query);
     $items = oseDB::loadList();
     $result = array();
     if (count($items) < 1) {
         $result['total'] = 0;
         $result['results'] = '';
     } else {
         $result['total'] = count($items);
         $result['results'] = $items;
     }
     return $result;
 }
コード例 #17
0
ファイル: oseMemUser.php プロジェクト: kosmosby/medicine-prof
 function getProfile()
 {
     $db = oseDB::instance();
     $query = "SELECT * FROM `#__osemsc_fields` WHERE `published` = '1' ORDER BY `ordering`";
     $db->setQuery($query);
     $items = oseDB::loadList('obj');
     $return = array();
     $i = 0;
     if (!empty($items)) {
         foreach ($items as $item) {
             $return[$i]['name'] = 'custom.' . strtolower(str_replace(" ", "_", $item->name));
             $query = "SELECT value FROM `#__osemsc_fields_values` WHERE `field_id` = " . (int) $item->id . " AND `member_id` = " . (int) $this->user_id;
             $db->setQuery($query);
             $return[$i]['value'] = $db->loadResult();
             $i++;
         }
     }
     return $return;
 }
コード例 #18
0
 public function getOrders()
 {
     $db = oseDB::instance();
     //$my = JFactory::getUser();
     $member_id = JRequest::getInt('member_id', 0);
     $start = JRequest::getInt('start', 0);
     $limit = JRequest::getInt('limit', 20);
     $where = array();
     $where[] = "o.user_id = '{$member_id}'";
     $where[] = "o.entry_type IN ('msc','msc_list')";
     $where = oseDB::implodeWhere($where);
     $query = " SELECT u.username,u.name, o.* " . " FROM `#__osemsc_order` AS o " . " INNER JOIN `#__users` AS u ON u.id = o.user_id" . $where . " LIMIT {$start},{$limit} ";
     $db->setQuery($query);
     //oseExit($db->_sql);
     //oseExit($db->_sql);
     $items = oseDB::loadList();
     $result = array();
     $result['total'] = $this->getTotal();
     $result['results'] = $items;
     return $result;
 }
コード例 #19
0
ファイル: oseMscItem.php プロジェクト: kosmosby/medicine-prof
 function __construct($p = array())
 {
     parent::__construct($p);
     if (count($this->get('_type')) < 1) {
         $db = oseDB::instance();
         $query = " SELECT * FROM `{$this->_tableType}`";
         $db->setQuery($query);
         $this->set('_type', oseDB::loadList('obj', 'id'));
     }
     if ($this->get('id', 0) > 0) {
         $info = $this->getTypeInfo();
         unset($info['id']);
         if (isset($info['params'])) {
             $info['typeParams'] = oseGetValue($info, 'params');
             unset($info['params']);
         }
         $this->setProperties($info);
     } else {
         $this->set('_isNew', true);
     }
 }
コード例 #20
0
 function &getList()
 {
     $db = oseDB::instance();
     $search = JRequest::getString('search', null);
     $search = JString::strtolower($search);
     $msc_id = JRequest::getInt('msc_id', 0);
     $start = JRequest::getInt('start', 0);
     $limit = JRequest::getInt('limit', 20);
     $where = array();
     if ($search) {
         $searchQuery = ' LOWER(aqc.`CategoryName`) LIKE ' . $db->Quote('%' . $search . '%');
         $where[] = $searchQuery;
     }
     $where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : '';
     // Generate where query
     $query = ' SELECT aqc.CategoryId AS id, aqc.CategoryName AS name' . ' FROM `#__ariquizcategory` AS aqc' . $where . ' ORDER BY aqc.`CategoryId`';
     $db->setQuery($query);
     //oseExit($db->_sql);
     $rows = oseDB::loadList('obj');
     $total = count($rows);
     // slice out elements based on limits
     $list = array_slice($rows, $start, $limit);
     foreach ($list as $item) {
         $obj = oseRegistry::call('content')->getInstance('msc')->getItem('ariquiz', 'category', $item->id, 'msc', $msc_id, null, 'obj');
         $item->type = empty($obj->content_type) ? 'category' : $obj->content_type;
         $controlled = empty($obj) ? 0 : $obj->status;
         if ($controlled == '1') {
             $item->controlled = JText::_('SHOW_TO_MEMBERS');
         } elseif ($controlled == '-1') {
             $item->controlled = JText::_('HIDE_TO_MEMBERS');
         } else {
             $item->controlled = JText::_('SHOW_TO_ALL');
         }
     }
     $items = array_values($list);
     $result = array();
     $result['total'] = $total;
     $result['results'] = $items;
     return $result;
 }
コード例 #21
0
 static function getConfig($config_type = null, $type = 'array')
 {
     $db = oseDB::instance();
     $where = array();
     if (!empty($config_type)) {
         if (is_array($config_type)) {
             $values = array();
             foreach ($config_type as $configType) {
                 $values[] = $db->Quote($configType);
             }
             $where[] = 'type IN (' . implode(',', $values) . ')';
         } else {
             $where[] = 'type=' . $db->Quote($config_type);
         }
     }
     $where = oseDB::implodeWhere($where);
     $query = " SELECT * FROM `#__osemsc_configuration` " . $where;
     $db->setQuery($query);
     $objs = oseDB::loadList('obj');
     if ($type == 'array') {
         $config = array();
         foreach ($objs as $obj) {
             $config[$obj->key] = $obj->value;
             //oseObject::setValue($config,$obj->key,$obj->value);
         }
     } else {
         $config = new stdClass();
         foreach ($objs as $obj) {
             $config->{$obj->key} = $obj->value;
             //oseObject::setValue($config,$obj->key,$obj->value);
         }
     }
     /*foreach($objs as $obj)
     		{
     			$config = oseObject::setValue($config,$obj->key,$obj->value);
     		}*/
     $config = oseObject::setValue($config, 'id', 1);
     return $config;
 }
コード例 #22
0
ファイル: members.php プロジェクト: kosmosby/medicine-prof
 function getList()
 {
     $model = $this->getModel('members');
     $msc_id = JRequest::getVar('msc_id', array(), 'post');
     if (empty($msc_id[0])) {
         $db = oseDB::instance();
         $query = "SELECT * FROM `#__osemsc_acl`";
         $db->setQuery($query);
         $objs = oseDB::loadList('obj');
         $msc_id = array();
         foreach ($objs as $obj) {
             $msc_id[] = $obj->id;
         }
     }
     $result = $model->getList($msc_id);
     if ($result['total'] < 1) {
         $result['total'] = 0;
     }
     $result = oseJSON::encode($result);
     echo $result;
     exit;
 }
コード例 #23
0
	function getFaiths()
	{
		$db= oseDB::instance();
		
		$query = " SELECT * FROM `#__osemsc_email` "
				." WHERE type = 'faith' "
				;
		
		$db->setQuery($query);
		
		$terms = oseDB::loadList();
		
		$total = count($terms);
		
		$result = array();
		$result['total'] = $total;
		$result['results'] = $terms;
		
		$result = oseJson::encode($result);
		
		oseExit($result);
	}
コード例 #24
0
 public function getList()
 {
     $db = oseDB::instance();
     $search = JRequest::getString('search', null);
     $search = JString::strtolower($search);
     $start = JRequest::getInt('start', 0);
     $limit = JRequest::getInt('limit', 20);
     $dir = JRequest::getCmd('dir', 'ASC');
     $sortField = JRequest::getCmd('sort', 'domain');
     $msc_id = JRequest::getInt('msc_id');
     $user_id = JRequest::getInt('user_id');
     $where = array();
     $where[] = "`mscID` = '{$msc_id}'";
     $where[] = "`userID` = '{$user_id}'";
     if (!empty($search)) {
         $searchQuery = $db->Quote('%' . $search . '%');
         $where[] = "`domain` LIKE {$searchQuery}";
     }
     $where = oseDB::implodeWhere($where);
     $query = " SELECT COUNT(*) " . " FROM `#__osetickets_domains` " . $where;
     $db->setQuery($query);
     $total = $db->loadResult();
     $query = " SELECT *" . " FROM `#__osetickets_domains` " . $where . " ORDER BY {$sortField} {$dir}";
     if ($start >= 0 && $limit >= 0) {
         $db->setQuery($query, $start, $limit);
     } else {
         $db->setQuery($query);
     }
     $items = oseDB::loadList('obj');
     $list = array();
     foreach ($items as $key => $item) {
         $list[$key] = $item;
     }
     $resul = array();
     $result['total'] = $total;
     $result['results'] = $list;
     oseExit(oseJson::encode($result));
 }
コード例 #25
0
ファイル: coupons.php プロジェクト: kosmosby/medicine-prof
 function getCurrencyList()
 {
     $db = oseDB::instance();
     $query = " SELECT * FROM `#__osemsc_configuration` WHERE `key` = 'primary_currency'";
     $db->setQuery($query);
     $objs = oseDB::loadList('obj');
     $currency = array();
     $currency[0]['title'] = $objs[0]->value;
     $currency[0]['value'] = $objs[0]->value;
     $others = oseJSON::decode($objs[0]->default);
     $i = 1;
     if (!empty($others)) {
         foreach ($others as $key => $value) {
             $currency[$i]['title'] = $key;
             $currency[$i]['value'] = $key;
             $i++;
         }
     }
     $result = array();
     $result['results'] = $currency;
     $result['total'] = count($result['results']);
     $result = oseJson::encode($result);
     oseExit($result);
 }
コード例 #26
0
 public static function updateLocationInfo($params = array())
 {
     $db = oseDB::instance();
     $post = JRequest::get('post');
     $result = array();
     $result['success'] = true;
     $result['title'] = 'Done';
     $result['content'] = JText::_('Saved Directory Info.');
     $directory = array();
     foreach ($post as $key => $value) {
         if (strstr($key, 'directory_')) {
             $billKey = preg_replace('/directory_/', '', $key, 1);
             $directory[$billKey] = $value;
         }
     }
     //$directory['directory_id'] = $directory['id'];
     $directory_id = $directory['id'];
     unset($directory['id']);
     //$user = JFactory::getUser();
     $location_id = JRequest::getInt('location_id', 0);
     // Add to Mt Link
     /*
     $query = " SELECT directory.* FROM `#__osemsc_directory` AS directory "
     				." INNER JOIN  `#__oselic_cs_keys_view` AS luv ON luv.company_id = directory.company_id"
     		." WHERE luv.location_id = {$location_id}";
     		;
     $db->setQuery($query);
     $item = oseDB::loadItem('obj');
     
     $directory_id = $item->directory_id;
     */
     /*
     $query = " SELECT directory_id FROM `#__osemsc_location` "
     		." WHERE location_id = {$location_id}"
     		;
     $db->setQuery($query);
     
     $item = oseDB::loadItem('obj');		
     */
     $query = " SELECT * FROM `#__oselic_cs_company_view` AS lcc " . " INNER JOIN  `#__oselic_cs_keys_view` AS luv ON luv.company_id = lcc.company_id" . " WHERE lcc.directory_id = {$directory_id} " . " ORDER BY lcc.location_id";
     $db->setQuery($query);
     $objs = oseDB::loadList('obj');
     //$location_id = JRequest::getInt('location_id',0);
     if (count($objs) < 1) {
         self::addToMtLink($directory_id, $directory);
     } else {
         if (!empty($location_id) && $location_id == $objs[0]->location_id) {
             self::addToMtLink($directory_id, $directory);
         }
     }
     // Add ends
     if (empty($location_id)) {
         $keys = array_keys($directory);
         $keys = '`' . implode('`,`', $keys) . '`';
         $fields = $db->getTableFields('#__osemsc_location');
         foreach ($directory as $key => $value) {
             if (!isset($fields['#__osemsc_location'][$key])) {
                 /*
                 $query = "ALTER TABLE `#__osemsc_billinginfo` ADD `{$key}` TEXT NULL DEFAULT NULL";
                 $db->setQuery($query);
                 if (!$db->query())
                 {
                 	return false;
                 }
                 */
                 unset($directory[$key]);
             }
         }
         $values = array();
         foreach ($directory as $key => $value) {
             $values[$key] = $db->Quote($value);
         }
         $values = implode(',', $values);
         $query = "INSERT INTO `#__osemsc_location` (`directory_id`,{$keys}) VALUES ('{$directory_id}',{$values});";
     } else {
         foreach ($directory as $key => $value) {
             $company[$key] = "`{$key}`=" . $db->Quote($value);
         }
         $values = implode(',', $company);
         $query = " UPDATE `#__osemsc_location` SET {$values}" . " WHERE `location_id` ={$location_id}";
     }
     //echo $query;exit;
     $db->setQuery($query);
     $result = array();
     if (!oseDB::query()) {
         $result['success'] = false;
         $result['title'] = JText::_('Error');
         $result['content'] = JText::_('Fail Saving Directory Info.');
     } else {
         $result['success'] = true;
         $result['title'] = JText::_('Done');
         $result['content'] = JText::_('Saved Directory Info.');
     }
     return $result;
 }
コード例 #27
0
		$query = "SELECT `payment_serial_number` FROM `#__osemsc_order` WHERE `order_id` = ".(int)$order_id; 
		$db->setQuery($query);
		$tmpresult = $db->loadResult(); 
		if (empty($tmpresult))
		{
			$subID = $process->get('subscr_id'); 
			$txnID = $process->get('txn_id');
			$referenceID = (!empty($subID))?$subID:$txnID;
			$query = " UPDATE `#__osemsc_order` SET `payment_serial_number` = ". $db->Quote($referenceID);
			$db->setQuery($query);
			$db->query();
		}
		
		$query= " SELECT * FROM `#__osemsc_order_item`".		" WHERE order_id = '{$order_id}'";
		$db->setQuery($query);
		$orderItems= oseDB :: loadList('obj');
		// $msc_id = $orderInfo->entry_id;
		// remove post headers if present.
		//OSE pending
		$res= preg_replace("'Content-type: text/plain'si", "", $res);
		//-------------------------------------------
		// ...read the results of the verification...
		// If VERIFIED = continue to process the TX...
		//-------------------------------------------
		if(eregi("VERIFIED", $res)) {
			// check the invoice
			$isValid= false;
			if(!$process->checkInvoice()) {
				$payment_status= "Failed";
				$mailsubject= "PayPal IPN Transaction on your site: Order ID not found";
				$mailbody= "The right order_id wasn't found during a PayPal transaction on your website.
コード例 #28
0
 function generateOrderTable($order_id, $user_id)
 {
     $db = oseDB::instance();
     $payment = oseRegistry::call('payment');
     $where = array();
     $where[] = "order_id = {$order_id}";
     $orderInfo = $payment->getOrder($where, 'obj');
     $orderInfoParams = oseJson::decode($orderInfo->params);
     $query = " SELECT * FROM `#__osemsc_order_item`" . " WHERE `order_id` = '{$order_id}'";
     $db->setQuery($query);
     $objs = oseDB::loadList('obj');
     $table = array();
     $tHeads = array();
     $tHeads[] = '<thead>';
     $tHeads[] = '<tr>';
     $tHeads[] = '<th>' . JText::_('MEMBERSHIP_PLAN') . '</th>';
     $tHeads[] = '<th>' . JText::_('START_DATE') . '</th>';
     $tHeads[] = '<th>' . JText::_('EXPIRED_DATE') . '</th>';
     $tHeads[] = '<th>' . JText::_('PRICE') . '</th>';
     $tHeads[] = '</tr>';
     $tHeads[] = '</thead>';
     $tBody = array();
     $tBody[] = '<tbody>';
     foreach ($objs as $obj) {
         switch ($obj->entry_type) {
             case 'msc':
                 $obj->payment_price = $orderInfoParams->recurrence_times > 1 ? $orderInfoParams->next_total : $orderInfoParams->total;
                 $msc_id = $obj->entry_id;
                 break;
             case 'license':
                 $params = oseJson::decode($obj->params);
                 $msc_id = $params->msc_id;
                 break;
         }
         $query = " SELECT *,DATE_SUB(`expired_date`,INTERVAL 1 DAY) AS `real_expired_date` " . " FROM `#__osemsc_member`" . " WHERE member_id = {$user_id} AND msc_id={$msc_id}";
         $db->setQuery($query);
         $memberInfo = oseDB::loadItem('obj');
         $globalConfig = oseRegistry::call('msc')->getConfig('global', 'obj');
         if (!empty($globalConfig->DateFormat)) {
             $memberInfo->start_date = date($globalConfig->DateFormat, strtotime($memberInfo->start_date));
             if ($memberInfo->expired_date != '0000-00-00 00:00:00') {
                 $memberInfo->expired_date = date($globalConfig->DateFormat, strtotime($memberInfo->expired_date));
             }
             if ($memberInfo->real_expired_date != '0000-00-00 00:00:00') {
                 $memberInfo->real_expired_date = date($globalConfig->DateFormat, strtotime($memberInfo->real_expired_date));
             }
         }
         $query = " SELECT * FROM `#__osemsc_acl`" . " WHERE id = '{$msc_id}'";
         $db->setQuery($query);
         $item = oseDB::loadItem('obj');
         $tr = '<tr>';
         $tr .= "<td>{$item->title}</td>";
         $tr .= "<td>{$memberInfo->start_date}</td>";
         if ($obj->payment_mode == 'a') {
             $tr .= "<td>{$memberInfo->real_expired_date}</td>";
         } else {
             if ($memberInfo->eternal) {
                 $memberInfo->expired_date = 'Life Time';
             }
             $tr .= "<td>{$memberInfo->expired_date}</td>";
         }
         $tr .= "<td>{$obj->payment_currency} {$obj->payment_price}</td>";
         $tr .= '</tr>';
         $tBody[] = $tr;
     }
     $tBody[] = '</tbody>';
     $table[] = '<table width="100%">';
     $table[] = implode("\r\n", $tHeads);
     $table[] = implode("\r\n", $tBody);
     $table[] = '</table>';
     $html = implode("\r\n", $table);
     return $html;
 }
コード例 #29
0
 function refundOrder($order_id, $params = array())
 {
     $db = oseDB::instance();
     $this->updateOrder($order_id, "refunded", $params);
     $where = array();
     $where[] = '`order_id` = ' . $db->Quote($order_id);
     $orderInfo = $this->getOrder($where, 'obj');
     $user_id = $orderInfo->user_id;
     $query = " SELECT * FROM `#__osemsc_order_item`" . " WHERE `order_id` = '{$orderInfo->order_id}'";
     $db->setQuery($query);
     $items = oseDB::loadList('obj');
     foreach ($items as $item) {
         switch ($item->entry_type) {
             case 'license':
                 $license = oseRegistry::call('lic')->getInstance(0);
                 $licenseInfo = $license->getKeyInfo($item->entry_id, 'obj');
                 $licenseInfoParams = oseJson::decode($licenseInfo->params);
                 $msc_id = $licenseInfoParams->msc_id;
                 $updated = $this->cancelMsc($order_id, $item->order_item_id, $msc_id, $user_id);
                 break;
             default:
             case 'msc':
                 $updated = $this->cancelMsc($order_id, $item->order_item_id, $item->entry_id, $user_id);
                 break;
         }
         if (!$updated['success']) {
             return $updated;
         }
     }
     $return['success'] = true;
     $return['title'] = JText::_('Success');
     $return['content'] = JText::_('Refunded Successfully');
     $session = JFactory::getSession();
     $session->set('osecart', array());
     return $return;
 }
コード例 #30
0
ファイル: register.php プロジェクト: kosmosby/medicine-prof
	function getMscList($msc_id = 0) {
		$db = oseDB::instance();
		$where = array();
		$where[] = "published = 1";
		if (!empty($msc_id)) {
			$where[] = "id = {$msc_id}";
		}
		$where = oseDB::implodeWhere($where);
		$query = " SELECT * FROM `#__osemsc_acl`" . $where . " ORDER BY lft ASC";
		$db->setQuery($query);
		$objs = oseDB::loadList('obj');
		$mscExtend = oseRegistry::call('msc')->getConfig('global', 'obj')->msc_extend;
		$items = array();
		$session = JFactory::getSession();
		$osePaymentCurrency = $session->get('osePaymentCurrency', oseRegistry::call('msc')->getConfig('currency', 'obj')->primary_currency);
		foreach ($objs as $obj) {
			$paymentInfos = oseRegistry::call('msc')->getExtInfo($obj->id, 'payment', 'array');
			foreach ($paymentInfos as $key => $paymentInfo) {
				if (!empty($mscExtend)) {
					$ext = oseRegistry::call($mscExtend);
					$item = oseRegistry::call('payment')->getInstance('View')->getMscInfo($obj->id, $osePaymentCurrency, oseObject::getValue($paymentInfo, 'id'));
					$itemExtend = $ext->getMscExtendInfo($obj->id);
					$fItem = (object) array_merge((array) $item, (array) $itemExtend);
				} else {
					$item = oseRegistry::call('payment')->getInstance('View')->getMscInfo($obj->id, $osePaymentCurrency, oseObject::getValue($paymentInfo, 'id'));
					$fItem = $item;
				}
				$items[] = $fItem;
			}
		}
		return $items;
	}